Attributes: Support quaternion attribute in spreadsheet
Support drawing quaternion attributes. Row filters remain unimplemented.
This commit is contained in:
parent
a7ac317159
commit
b275851d1c
|
@ -346,6 +346,7 @@ static float get_default_column_width(const ColumnValues &values)
|
|||
return 3.0f * float_width;
|
||||
case SPREADSHEET_VALUE_TYPE_COLOR:
|
||||
case SPREADSHEET_VALUE_TYPE_BYTE_COLOR:
|
||||
case SPREADSHEET_VALUE_TYPE_QUATERNION:
|
||||
return 4.0f * float_width;
|
||||
case SPREADSHEET_VALUE_TYPE_INSTANCES:
|
||||
return 8.0f;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "BLI_color.hh"
|
||||
#include "BLI_cpp_type.hh"
|
||||
#include "BLI_hash.hh"
|
||||
#include "BLI_math_quaternion_types.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_ref.hh"
|
||||
|
@ -56,6 +57,9 @@ eSpreadsheetColumnValueType cpp_type_to_column_type(const CPPType &type)
|
|||
if (type.is<ColorGeometry4b>()) {
|
||||
return SPREADSHEET_VALUE_TYPE_BYTE_COLOR;
|
||||
}
|
||||
if (type.is<math::Quaternion>()) {
|
||||
return SPREADSHEET_VALUE_TYPE_QUATERNION;
|
||||
}
|
||||
|
||||
return SPREADSHEET_VALUE_TYPE_UNKNOWN;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#include "BLI_math_quaternion_types.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
#include "BKE_geometry_set.hh"
|
||||
|
@ -204,6 +205,10 @@ class SpreadsheetLayoutDrawer : public SpreadsheetDrawer {
|
|||
const ColorGeometry4b value = data.get<ColorGeometry4b>(real_index);
|
||||
this->draw_byte_color(params, value);
|
||||
}
|
||||
else if (data.type().is<math::Quaternion>()) {
|
||||
const float4 value = float4(data.get<math::Quaternion>(real_index));
|
||||
this->draw_float_vector(params, Span(&value.x, 4));
|
||||
}
|
||||
else if (data.type().is<bke::InstanceReference>()) {
|
||||
const bke::InstanceReference value = data.get<bke::InstanceReference>(real_index);
|
||||
switch (value.type()) {
|
||||
|
|
|
@ -107,6 +107,7 @@ static std::string value_string(const SpreadsheetRowFilter &row_filter,
|
|||
}
|
||||
case SPREADSHEET_VALUE_TYPE_STRING:
|
||||
return row_filter.value_string;
|
||||
case SPREADSHEET_VALUE_TYPE_QUATERNION:
|
||||
case SPREADSHEET_VALUE_TYPE_UNKNOWN:
|
||||
return "";
|
||||
}
|
||||
|
@ -250,7 +251,8 @@ static void spreadsheet_filter_panel_draw(const bContext *C, Panel *panel)
|
|||
uiItemR(layout, filter_ptr, "value_string", 0, IFACE_("Value"), ICON_NONE);
|
||||
break;
|
||||
case SPREADSHEET_VALUE_TYPE_UNKNOWN:
|
||||
uiItemL(layout, IFACE_("Unknown column type"), ICON_ERROR);
|
||||
case SPREADSHEET_VALUE_TYPE_QUATERNION:
|
||||
uiItemL(layout, IFACE_("Unsupported column type"), ICON_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2028,6 +2028,7 @@ typedef enum eSpreadsheetColumnValueType {
|
|||
SPREADSHEET_VALUE_TYPE_BYTE_COLOR = 8,
|
||||
SPREADSHEET_VALUE_TYPE_INT8 = 9,
|
||||
SPREADSHEET_VALUE_TYPE_INT32_2D = 10,
|
||||
SPREADSHEET_VALUE_TYPE_QUATERNION = 11,
|
||||
} eSpreadsheetColumnValueType;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue