Fix: string attributes not shown properly in spreadsheet
Pull Request: https://projects.blender.org/blender/blender/pulls/127892
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
@@ -48,7 +49,7 @@ eSpreadsheetColumnValueType cpp_type_to_column_type(const CPPType &type)
|
||||
if (type.is<ColorGeometry4f>()) {
|
||||
return SPREADSHEET_VALUE_TYPE_COLOR;
|
||||
}
|
||||
if (type.is<std::string>()) {
|
||||
if (type.is<std::string>() || type.is<MStringProperty>()) {
|
||||
return SPREADSHEET_VALUE_TYPE_STRING;
|
||||
}
|
||||
if (type.is<bke::InstanceReference>()) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "spreadsheet_layout.hh"
|
||||
|
||||
#include "DNA_collection_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
@@ -249,6 +250,32 @@ class SpreadsheetLayoutDrawer : public SpreadsheetDrawer {
|
||||
0,
|
||||
nullptr);
|
||||
}
|
||||
else if (data.type().is<MStringProperty>()) {
|
||||
MStringProperty *prop = MEM_cnew<MStringProperty>(__func__);
|
||||
data.get_to_uninitialized(real_index, prop);
|
||||
uiBut *but = uiDefIconTextBut(params.block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
ICON_NONE,
|
||||
StringRef(prop->s, prop->s_len),
|
||||
params.xmin,
|
||||
params.ymin,
|
||||
params.width,
|
||||
params.height,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
|
||||
UI_but_func_tooltip_set(
|
||||
but,
|
||||
[](bContext * /*C*/, void *argN, const char * /*tip*/) {
|
||||
const MStringProperty &prop = *static_cast<MStringProperty *>(argN);
|
||||
return std::string(StringRef(prop.s, prop.s_len));
|
||||
},
|
||||
prop,
|
||||
MEM_freeN);
|
||||
}
|
||||
}
|
||||
|
||||
void draw_float_vector(const CellDrawParams ¶ms, const Span<float> values) const
|
||||
|
||||
Reference in New Issue
Block a user