Cleanup: Use newer API for creating IDProperties in most places
There are still a few places that are more complicated where the replacement to `IDP_New` isn't obvious, but this commit replaces most uses of the ugly `IDPropertyTemplate` usage.
This commit is contained in:
@@ -247,13 +247,9 @@ static void action_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
|
||||
static IDProperty *action_asset_type_property(const bAction *action)
|
||||
{
|
||||
using namespace blender;
|
||||
const bool is_single_frame = BKE_action_has_single_frame(action);
|
||||
|
||||
IDPropertyTemplate idprop = {0};
|
||||
idprop.i = is_single_frame;
|
||||
|
||||
IDProperty *property = IDP_New(IDP_INT, &idprop, "is_single_frame");
|
||||
return property;
|
||||
return bke::idprop::create("is_single_frame", int(is_single_frame)).release();
|
||||
}
|
||||
|
||||
static void action_asset_metadata_ensure(void *asset_ptr, AssetMetaData *asset_data)
|
||||
|
||||
@@ -155,9 +155,9 @@ void BKE_asset_metadata_catalog_id_set(AssetMetaData *asset_data,
|
||||
|
||||
void BKE_asset_metadata_idprop_ensure(AssetMetaData *asset_data, IDProperty *prop)
|
||||
{
|
||||
using namespace blender::bke;
|
||||
if (!asset_data->properties) {
|
||||
IDPropertyTemplate val = {0};
|
||||
asset_data->properties = IDP_New(IDP_GROUP, &val, "AssetMetaData.properties");
|
||||
asset_data->properties = idprop::create_group("AssetMetaData.properties").release();
|
||||
}
|
||||
/* Important: The property may already exist. For now just allow always allow a newly allocated
|
||||
* property, and replace the existing one as a way of updating. */
|
||||
|
||||
@@ -124,33 +124,26 @@ static CameraCyclesCompatibilityData camera_write_cycles_compatibility_data_crea
|
||||
if (prop) {
|
||||
return prop;
|
||||
}
|
||||
IDPropertyTemplate val = {0};
|
||||
prop = IDP_New(IDP_GROUP, &val, "cycles");
|
||||
prop = blender::bke::idprop::create_group("cycles").release();
|
||||
IDP_AddToGroup(group, prop);
|
||||
return prop;
|
||||
};
|
||||
|
||||
auto cycles_property_int_set = [](IDProperty *idprop, const char *name, int value) {
|
||||
IDProperty *prop = IDP_GetPropertyTypeFromGroup(idprop, name, IDP_INT);
|
||||
if (prop) {
|
||||
if (IDProperty *prop = IDP_GetPropertyTypeFromGroup(idprop, name, IDP_INT)) {
|
||||
IDP_Int(prop) = value;
|
||||
}
|
||||
else {
|
||||
IDPropertyTemplate val = {0};
|
||||
val.i = value;
|
||||
IDP_AddToGroup(idprop, IDP_New(IDP_INT, &val, name));
|
||||
IDP_AddToGroup(idprop, blender::bke::idprop::create(name, value).release());
|
||||
}
|
||||
};
|
||||
|
||||
auto cycles_property_float_set = [](IDProperty *idprop, const char *name, float value) {
|
||||
IDProperty *prop = IDP_GetPropertyTypeFromGroup(idprop, name, IDP_FLOAT);
|
||||
if (prop) {
|
||||
if (IDProperty *prop = IDP_GetPropertyTypeFromGroup(idprop, name, IDP_FLOAT)) {
|
||||
IDP_Float(prop) = value;
|
||||
}
|
||||
else {
|
||||
IDPropertyTemplate val = {0};
|
||||
val.f = value;
|
||||
IDP_AddToGroup(idprop, IDP_New(IDP_FLOAT, &val, name));
|
||||
IDP_AddToGroup(idprop, blender::bke::idprop::create(name, value).release());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -198,11 +198,8 @@ static void idp_resize_group_array(IDProperty *prop, int newlen, void *newarr)
|
||||
if (newlen >= prop->len) {
|
||||
/* bigger */
|
||||
IDProperty **array = static_cast<IDProperty **>(newarr);
|
||||
IDPropertyTemplate val;
|
||||
|
||||
for (int a = prop->len; a < newlen; a++) {
|
||||
val.i = 0; /* silence MSVC warning about uninitialized var when debugging */
|
||||
array[a] = IDP_New(IDP_GROUP, &val, "IDP_ResizeArray group");
|
||||
array[a] = blender::bke::idprop::create_group("IDP_ResizeArray group").release();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -42,8 +42,8 @@ wmKeyConfigPref *BKE_keyconfig_pref_ensure(UserDef *userdef, const char *kc_idna
|
||||
BLI_addtail(&userdef->user_keyconfig_prefs, kpt);
|
||||
}
|
||||
if (kpt->prop == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
kpt->prop = IDP_New(IDP_GROUP, &val, kc_idname); /* name is unimportant. */
|
||||
/* name is unimportant. */
|
||||
kpt->prop = blender::bke::idprop::create_group(kc_idname).release();
|
||||
}
|
||||
return kpt;
|
||||
}
|
||||
@@ -115,9 +115,7 @@ void BKE_keyconfig_pref_set_select_mouse(UserDef *userdef, int value, bool overr
|
||||
wmKeyConfigPref *kpt = BKE_keyconfig_pref_ensure(userdef, WM_KEYCONFIG_STR_DEFAULT);
|
||||
IDProperty *idprop = IDP_GetPropertyFromGroup(kpt->prop, "select_mouse");
|
||||
if (!idprop) {
|
||||
IDPropertyTemplate tmp{};
|
||||
tmp.i = value;
|
||||
IDP_AddToGroup(kpt->prop, IDP_New(IDP_INT, &tmp, "select_mouse"));
|
||||
IDP_AddToGroup(kpt->prop, blender::bke::idprop::create("select_mouse", value).release());
|
||||
}
|
||||
else if (override) {
|
||||
IDP_Int(idprop) = value;
|
||||
|
||||
@@ -1044,20 +1044,13 @@ static void object_lib_override_apply_post(ID *id_dst, ID *id_src)
|
||||
|
||||
static IDProperty *object_asset_dimensions_property(Object *ob)
|
||||
{
|
||||
using namespace blender::bke;
|
||||
float3 dimensions;
|
||||
BKE_object_dimensions_get(ob, dimensions);
|
||||
if (is_zero_v3(dimensions)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IDPropertyTemplate idprop{};
|
||||
idprop.array.len = 3;
|
||||
idprop.array.type = IDP_FLOAT;
|
||||
|
||||
IDProperty *property = IDP_New(IDP_ARRAY, &idprop, "dimensions");
|
||||
memcpy(IDP_Array(property), dimensions, sizeof(dimensions));
|
||||
|
||||
return property;
|
||||
return idprop::create("dimensions", Span(&dimensions.x, 3)).release();
|
||||
}
|
||||
|
||||
static void object_asset_metadata_ensure(void *asset_ptr, AssetMetaData *asset_data)
|
||||
@@ -1066,8 +1059,7 @@ static void object_asset_metadata_ensure(void *asset_ptr, AssetMetaData *asset_d
|
||||
BLI_assert(GS(ob->id.name) == ID_OB);
|
||||
|
||||
/* Update dimensions hint for the asset. */
|
||||
IDProperty *dimensions_prop = object_asset_dimensions_property(ob);
|
||||
if (dimensions_prop) {
|
||||
if (IDProperty *dimensions_prop = object_asset_dimensions_property(ob)) {
|
||||
BKE_asset_metadata_idprop_ensure(asset_data, dimensions_prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1561,6 +1561,7 @@ static void do_version_subsurface_methods(bNode *node)
|
||||
|
||||
static void version_geometry_nodes_add_attribute_input_settings(NodesModifierData *nmd)
|
||||
{
|
||||
using namespace blender;
|
||||
if (nmd->settings.properties == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -1583,14 +1584,13 @@ static void version_geometry_nodes_add_attribute_input_settings(NodesModifierDat
|
||||
char use_attribute_prop_name[MAX_IDPROP_NAME];
|
||||
SNPRINTF(use_attribute_prop_name, "%s%s", property->name, "_use_attribute");
|
||||
|
||||
IDPropertyTemplate idprop = {0};
|
||||
IDProperty *use_attribute_prop = IDP_New(IDP_INT, &idprop, use_attribute_prop_name);
|
||||
IDProperty *use_attribute_prop = bke::idprop::create(use_attribute_prop_name, 0).release();
|
||||
IDP_AddToGroup(nmd->settings.properties, use_attribute_prop);
|
||||
|
||||
char attribute_name_prop_name[MAX_IDPROP_NAME];
|
||||
SNPRINTF(attribute_name_prop_name, "%s%s", property->name, "_attribute_name");
|
||||
|
||||
IDProperty *attribute_prop = IDP_New(IDP_STRING, &idprop, attribute_name_prop_name);
|
||||
IDProperty *attribute_prop = bke::idprop::create(attribute_name_prop_name, "").release();
|
||||
IDP_AddToGroup(nmd->settings.properties, attribute_prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,14 +389,11 @@ int version_cycles_property_int(IDProperty *idprop, const char *name, int defaul
|
||||
|
||||
void version_cycles_property_int_set(IDProperty *idprop, const char *name, int value)
|
||||
{
|
||||
IDProperty *prop = IDP_GetPropertyTypeFromGroup(idprop, name, IDP_INT);
|
||||
if (prop) {
|
||||
if (IDProperty *prop = IDP_GetPropertyTypeFromGroup(idprop, name, IDP_INT)) {
|
||||
IDP_Int(prop) = value;
|
||||
}
|
||||
else {
|
||||
IDPropertyTemplate val = {0};
|
||||
val.i = value;
|
||||
IDP_AddToGroup(idprop, IDP_New(IDP_INT, &val, name));
|
||||
IDP_AddToGroup(idprop, blender::bke::idprop::create(name, value).release());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1258,9 +1258,8 @@ static std::optional<std::string> ui_but_event_operator_string_from_menu(const b
|
||||
MenuType *mt = UI_but_menutype_get(but);
|
||||
BLI_assert(mt != nullptr);
|
||||
|
||||
/* annoying, create a property */
|
||||
const IDPropertyTemplate val = {0};
|
||||
IDProperty *prop_menu = IDP_New(IDP_GROUP, &val, __func__); /* Dummy, name is unimportant. */
|
||||
/* Dummy, name is unimportant. */
|
||||
IDProperty *prop_menu = blender::bke::idprop::create_group(__func__).release();
|
||||
IDP_AddToGroup(prop_menu, IDP_NewStringMaxSize(mt->idname, sizeof(mt->idname), "name"));
|
||||
|
||||
const std::optional<std::string> result = WM_key_event_operator_string(
|
||||
@@ -1273,29 +1272,21 @@ static std::optional<std::string> ui_but_event_operator_string_from_menu(const b
|
||||
static std::optional<std::string> ui_but_event_operator_string_from_panel(const bContext *C,
|
||||
uiBut *but)
|
||||
{
|
||||
using namespace blender;
|
||||
/** Nearly exact copy of #ui_but_event_operator_string_from_menu */
|
||||
PanelType *pt = UI_but_paneltype_get(but);
|
||||
BLI_assert(pt != nullptr);
|
||||
|
||||
/* annoying, create a property */
|
||||
const IDPropertyTemplate group_val = {0};
|
||||
IDProperty *prop_panel = IDP_New(
|
||||
IDP_GROUP, &group_val, __func__); /* Dummy, name is unimportant. */
|
||||
/* Dummy, name is unimportant. */
|
||||
IDProperty *prop_panel = bke::idprop::create_group(__func__).release();
|
||||
IDP_AddToGroup(prop_panel, IDP_NewStringMaxSize(pt->idname, sizeof(pt->idname), "name"));
|
||||
IDPropertyTemplate space_type_val = {0};
|
||||
space_type_val.i = pt->space_type;
|
||||
IDP_AddToGroup(prop_panel, IDP_New(IDP_INT, &space_type_val, "space_type"));
|
||||
IDPropertyTemplate region_type_val = {0};
|
||||
region_type_val.i = pt->region_type;
|
||||
IDP_AddToGroup(prop_panel, IDP_New(IDP_INT, ®ion_type_val, "region_type"));
|
||||
IDP_AddToGroup(prop_panel, bke::idprop::create("space_type", pt->space_type).release());
|
||||
IDP_AddToGroup(prop_panel, bke::idprop::create("region_type", pt->region_type).release());
|
||||
BLI_SCOPED_DEFER([&]() { IDP_FreeProperty(prop_panel); });
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
/* FIXME(@ideasman42): We can't reasonably search all configurations - long term. */
|
||||
IDPropertyTemplate val = {0};
|
||||
val.i = i;
|
||||
|
||||
IDP_ReplaceInGroup(prop_panel, IDP_New(IDP_INT, &val, "keep_open"));
|
||||
IDP_ReplaceInGroup(prop_panel, bke::idprop::create("keep_open", i).release());
|
||||
if (std::optional<std::string> result = WM_key_event_operator_string(
|
||||
C, "WM_OT_call_panel", WM_OP_INVOKE_REGION_WIN, prop_panel, true))
|
||||
{
|
||||
@@ -1456,13 +1447,10 @@ static std::optional<std::string> ui_but_event_property_operator_string(const bC
|
||||
const StringRefNull data_path = data_path_variations[data_path_index];
|
||||
if (!data_path.is_empty() || (prop_enum_value_ok && prop_enum_value_id)) {
|
||||
/* Create a property to host the "data_path" property we're sending to the operators. */
|
||||
IDProperty *prop_path;
|
||||
|
||||
const IDPropertyTemplate group_val = {0};
|
||||
prop_path = IDP_New(IDP_GROUP, &group_val, __func__);
|
||||
IDProperty *prop_path = blender::bke::idprop::create_group(__func__).release();
|
||||
BLI_SCOPED_DEFER([&]() { IDP_FreeProperty(prop_path); });
|
||||
if (!data_path.is_empty()) {
|
||||
IDP_AddToGroup(prop_path, IDP_NewString(data_path.c_str(), "data_path"));
|
||||
IDP_AddToGroup(prop_path, bke::idprop::create("data_path", data_path).release());
|
||||
}
|
||||
if (prop_enum_value_ok) {
|
||||
const EnumPropertyItem *item;
|
||||
@@ -1473,13 +1461,10 @@ static std::optional<std::string> ui_but_event_property_operator_string(const bC
|
||||
IDProperty *prop_value;
|
||||
if (prop_enum_value_is_int) {
|
||||
const int value = item[index].value;
|
||||
IDPropertyTemplate val = {};
|
||||
val.i = value;
|
||||
prop_value = IDP_New(IDP_INT, &val, prop_enum_value_id);
|
||||
prop_value = bke::idprop::create(prop_enum_value_id, value).release();
|
||||
}
|
||||
else {
|
||||
const char *id = item[index].identifier;
|
||||
prop_value = IDP_NewString(id, prop_enum_value_id);
|
||||
prop_value = bke::idprop::create(prop_enum_value_id, item[index].identifier).release();
|
||||
}
|
||||
IDP_AddToGroup(prop_path, prop_value);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
|
||||
static IDProperty *shortcut_property_from_rna(bContext *C, uiBut *but)
|
||||
{
|
||||
using namespace blender;
|
||||
/* Compute data path from context to property. */
|
||||
|
||||
/* If this returns null, we won't be able to bind shortcuts to these RNA properties.
|
||||
@@ -69,15 +70,14 @@ static IDProperty *shortcut_property_from_rna(bContext *C, uiBut *but)
|
||||
}
|
||||
|
||||
/* Create ID property of data path, to pass to the operator. */
|
||||
const IDPropertyTemplate val = {0};
|
||||
IDProperty *prop = IDP_New(IDP_GROUP, &val, __func__);
|
||||
IDP_AddToGroup(prop, IDP_NewString(final_data_path.value().c_str(), "data_path"));
|
||||
|
||||
IDProperty *prop = bke::idprop::create_group(__func__).release();
|
||||
IDP_AddToGroup(prop, bke::idprop::create("data_path", final_data_path.value()).release());
|
||||
return prop;
|
||||
}
|
||||
|
||||
static const char *shortcut_get_operator_property(bContext *C, uiBut *but, IDProperty **r_prop)
|
||||
{
|
||||
using namespace blender;
|
||||
if (but->optype) {
|
||||
/* Operator */
|
||||
*r_prop = (but->opptr && but->opptr->data) ?
|
||||
@@ -108,17 +108,15 @@ static const char *shortcut_get_operator_property(bContext *C, uiBut *but, IDPro
|
||||
}
|
||||
|
||||
if (MenuType *mt = UI_but_menutype_get(but)) {
|
||||
const IDPropertyTemplate val = {0};
|
||||
IDProperty *prop = IDP_New(IDP_GROUP, &val, __func__);
|
||||
IDP_AddToGroup(prop, IDP_NewString(mt->idname, "name"));
|
||||
IDProperty *prop = bke::idprop::create_group(__func__).release();
|
||||
IDP_AddToGroup(prop, bke::idprop::create("name", mt->idname).release());
|
||||
*r_prop = prop;
|
||||
return "WM_OT_call_menu";
|
||||
}
|
||||
|
||||
if (PanelType *pt = UI_but_paneltype_get(but)) {
|
||||
const IDPropertyTemplate val = {0};
|
||||
IDProperty *prop = IDP_New(IDP_GROUP, &val, __func__);
|
||||
IDP_AddToGroup(prop, IDP_NewString(pt->idname, "name"));
|
||||
IDProperty *prop = blender::bke::idprop::create_group(__func__).release();
|
||||
IDP_AddToGroup(prop, bke::idprop::create("name", pt->idname).release());
|
||||
*r_prop = prop;
|
||||
return "WM_OT_call_panel";
|
||||
}
|
||||
|
||||
@@ -1294,8 +1294,7 @@ static uiBut *uiItemFullO_ptr_ex(uiLayout *layout,
|
||||
opptr->data = properties;
|
||||
}
|
||||
else {
|
||||
const IDPropertyTemplate val = {0};
|
||||
opptr->data = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
|
||||
opptr->data = blender::bke::idprop::create_group("wmOperatorProperties").release();
|
||||
}
|
||||
if (r_opptr) {
|
||||
*r_opptr = *opptr;
|
||||
|
||||
@@ -2703,8 +2703,7 @@ static eAutoPropButsReturn template_operator_property_buts_draw_single(
|
||||
eAutoPropButsReturn return_info = eAutoPropButsReturn(0);
|
||||
|
||||
if (!op->properties) {
|
||||
const IDPropertyTemplate val = {0};
|
||||
op->properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
|
||||
op->properties = blender::bke::idprop::create_group("wmOperatorProperties").release();
|
||||
}
|
||||
|
||||
/* poll() on this operator may still fail,
|
||||
|
||||
@@ -6231,6 +6231,7 @@ static bool texture_paint_image_from_view_poll(bContext *C)
|
||||
|
||||
static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
using namespace blender;
|
||||
Image *image;
|
||||
ImBuf *ibuf;
|
||||
char filename[FILE_MAX];
|
||||
@@ -6313,27 +6314,21 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
|
||||
if (image) {
|
||||
/* now for the trickiness. store the view projection here!
|
||||
* re-projection will reuse this */
|
||||
IDPropertyTemplate val;
|
||||
IDProperty *idgroup = IDP_EnsureProperties(&image->id);
|
||||
IDProperty *view_data;
|
||||
bool is_ortho;
|
||||
float *array;
|
||||
|
||||
val.array.len = PROJ_VIEW_DATA_SIZE;
|
||||
val.array.type = IDP_FLOAT;
|
||||
view_data = IDP_New(IDP_ARRAY, &val, PROJ_VIEW_DATA_ID);
|
||||
|
||||
array = (float *)IDP_Array(view_data);
|
||||
memcpy(array, rv3d->winmat, sizeof(rv3d->winmat));
|
||||
array += sizeof(rv3d->winmat) / sizeof(float);
|
||||
memcpy(array, rv3d->viewmat, sizeof(rv3d->viewmat));
|
||||
array += sizeof(rv3d->viewmat) / sizeof(float);
|
||||
is_ortho = ED_view3d_clip_range_get(depsgraph, v3d, rv3d, &array[0], &array[1], true);
|
||||
blender::Vector<float, PROJ_VIEW_DATA_SIZE> array;
|
||||
array.extend(Span(reinterpret_cast<float *>(rv3d->winmat), 16));
|
||||
array.extend(Span(reinterpret_cast<float *>(rv3d->viewmat), 16));
|
||||
float clip_start;
|
||||
float clip_end;
|
||||
const bool is_ortho = ED_view3d_clip_range_get(
|
||||
depsgraph, v3d, rv3d, &clip_start, &clip_end, true);
|
||||
array.append(clip_start);
|
||||
array.append(clip_end);
|
||||
/* using float for a bool is dodgy but since its an extra member in the array...
|
||||
* easier than adding a single bool prop */
|
||||
array[2] = is_ortho ? 1.0f : 0.0f;
|
||||
|
||||
IDP_AddToGroup(idgroup, view_data);
|
||||
array.append(is_ortho ? 1.0f : 0.0f);
|
||||
IDP_AddToGroup(idgroup, bke::idprop::create(PROJ_VIEW_DATA_ID, array.as_span()).release());
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
@@ -27,8 +27,7 @@ void IMB_metadata_ensure(IDProperty **metadata)
|
||||
return;
|
||||
}
|
||||
|
||||
IDPropertyTemplate val = {0};
|
||||
*metadata = IDP_New(IDP_GROUP, &val, "metadata");
|
||||
*metadata = blender::bke::idprop::create_group("metadata").release();
|
||||
}
|
||||
|
||||
void IMB_metadata_free(IDProperty *metadata)
|
||||
@@ -81,7 +80,7 @@ void IMB_metadata_set_field(IDProperty *metadata, const char *key, const char *v
|
||||
IDP_AssignString(prop, value);
|
||||
}
|
||||
else {
|
||||
prop = IDP_NewString(value, key);
|
||||
prop = blender::bke::idprop::create(key, value).release();
|
||||
IDP_AddToGroup(metadata, prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,22 +652,13 @@ void bc_set_IDPropertyMatrix(EditBone *ebone, const char *key, float mat[4][4])
|
||||
{
|
||||
IDProperty *idgroup = (IDProperty *)ebone->prop;
|
||||
if (idgroup == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
idgroup = IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties");
|
||||
idgroup = blender::bke::idprop::create_group("RNA_EditBone ID properties").release();
|
||||
ebone->prop = idgroup;
|
||||
}
|
||||
|
||||
IDPropertyTemplate val = {0};
|
||||
val.array.len = 16;
|
||||
val.array.type = IDP_FLOAT;
|
||||
|
||||
IDProperty *data = IDP_New(IDP_ARRAY, &val, key);
|
||||
float *array = (float *)IDP_Array(data);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
array[4 * i + j] = mat[i][j];
|
||||
}
|
||||
}
|
||||
IDProperty *data = blender::bke::idprop::create(
|
||||
key, blender::Span(reinterpret_cast<float *>(mat), 16))
|
||||
.release();
|
||||
|
||||
IDP_AddToGroup(idgroup, data);
|
||||
}
|
||||
@@ -682,14 +673,11 @@ static void bc_set_IDProperty(EditBone *ebone, const char *key, float value)
|
||||
{
|
||||
if (ebone->prop == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
ebone->prop = IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties");
|
||||
ebone->prop = blender::bke::idprop::create_group( "RNA_EditBone ID properties").release();
|
||||
}
|
||||
|
||||
IDProperty *pgroup = (IDProperty *)ebone->prop;
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *prop = IDP_New(IDP_FLOAT, &val, key);
|
||||
IDP_Float(prop) = value;
|
||||
IDP_AddToGroup(pgroup, prop);
|
||||
IDP_AddToGroup(pgroup, blender::bke::idprop::create(key, value).release());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -281,8 +281,7 @@ IDProperty *RNA_struct_idprops(PointerRNA *ptr, bool create)
|
||||
}
|
||||
|
||||
if (create && *property_ptr == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
*property_ptr = IDP_New(IDP_GROUP, &val, __func__);
|
||||
*property_ptr = blender::bke::idprop::create_group(__func__).release();
|
||||
}
|
||||
|
||||
return *property_ptr;
|
||||
@@ -2454,17 +2453,11 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
|
||||
bprop->set_ex(ptr, prop, value);
|
||||
}
|
||||
else if (prop->flag & PROP_EDITABLE) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *group;
|
||||
|
||||
val.i = value;
|
||||
|
||||
group = RNA_struct_idprops(ptr, true);
|
||||
if (group) {
|
||||
if (IDProperty *group = RNA_struct_idprops(ptr, true)) {
|
||||
#ifdef USE_INT_IDPROPS_FOR_BOOLEAN_RNA_PROP
|
||||
IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
|
||||
IDP_AddToGroup(group, blender::bke::idprop::create(prop->identifier, int(value)).release());
|
||||
#else
|
||||
IDP_AddToGroup(group, IDP_New(IDP_BOOLEAN, &val, prop->identifier));
|
||||
IDP_AddToGroup(group, blender::bke::idprop::create_bool(prop->identifier, value).release());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -2624,7 +2617,6 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bo
|
||||
}
|
||||
else if (prop->flag & PROP_EDITABLE) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *group;
|
||||
|
||||
val.array.len = prop->totarraylength;
|
||||
#ifdef USE_INT_IDPROPS_FOR_BOOLEAN_RNA_PROP
|
||||
@@ -2633,8 +2625,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bo
|
||||
val.array.type = IDP_BOOLEAN;
|
||||
#endif
|
||||
|
||||
group = RNA_struct_idprops(ptr, true);
|
||||
if (group) {
|
||||
if (IDProperty *group = RNA_struct_idprops(ptr, true)) {
|
||||
idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
|
||||
IDP_AddToGroup(group, idprop);
|
||||
int *values_dst = static_cast<int *>(IDP_Array(idprop));
|
||||
@@ -2825,16 +2816,9 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||
iprop->set_ex(ptr, prop, value);
|
||||
}
|
||||
else if (prop->flag & PROP_EDITABLE) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *group;
|
||||
|
||||
RNA_property_int_clamp(ptr, prop, &value);
|
||||
|
||||
val.i = value;
|
||||
|
||||
group = RNA_struct_idprops(ptr, true);
|
||||
if (group) {
|
||||
IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
|
||||
if (IDProperty *group = RNA_struct_idprops(ptr, true)) {
|
||||
IDP_AddToGroup(group, blender::bke::idprop::create(prop->identifier, value).release());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2961,6 +2945,7 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
|
||||
|
||||
void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
|
||||
{
|
||||
using namespace blender;
|
||||
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
|
||||
IDProperty *idprop;
|
||||
|
||||
@@ -2989,19 +2974,11 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v
|
||||
iprop->setarray_ex(ptr, prop, values);
|
||||
}
|
||||
else if (prop->flag & PROP_EDITABLE) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *group;
|
||||
|
||||
// RNA_property_int_clamp_array(ptr, prop, &value); /* TODO. */
|
||||
|
||||
val.array.len = prop->totarraylength;
|
||||
val.array.type = IDP_INT;
|
||||
|
||||
group = RNA_struct_idprops(ptr, true);
|
||||
if (group) {
|
||||
idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
|
||||
IDP_AddToGroup(group, idprop);
|
||||
memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len);
|
||||
if (IDProperty *group = RNA_struct_idprops(ptr, true)) {
|
||||
IDP_AddToGroup(
|
||||
group,
|
||||
bke::idprop::create(prop->identifier, Span(values, prop->totarraylength)).release());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3172,16 +3149,9 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
|
||||
fprop->set_ex(ptr, prop, value);
|
||||
}
|
||||
else if (prop->flag & PROP_EDITABLE) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *group;
|
||||
|
||||
RNA_property_float_clamp(ptr, prop, &value);
|
||||
|
||||
val.f = value;
|
||||
|
||||
group = RNA_struct_idprops(ptr, true);
|
||||
if (group) {
|
||||
IDP_AddToGroup(group, IDP_New(IDP_FLOAT, &val, prop->identifier));
|
||||
if (IDProperty *group = RNA_struct_idprops(ptr, true)) {
|
||||
IDP_AddToGroup(group, blender::bke::idprop::create(prop->identifier, value).release());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3373,19 +3343,12 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa
|
||||
fprop->setarray_ex(ptr, prop, values);
|
||||
}
|
||||
else if (prop->flag & PROP_EDITABLE) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *group;
|
||||
|
||||
// RNA_property_float_clamp_array(ptr, prop, &value); /* TODO. */
|
||||
|
||||
val.array.len = prop->totarraylength;
|
||||
val.array.type = IDP_FLOAT;
|
||||
|
||||
group = RNA_struct_idprops(ptr, true);
|
||||
if (group) {
|
||||
idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
|
||||
IDP_AddToGroup(group, idprop);
|
||||
memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len);
|
||||
if (IDProperty *group = RNA_struct_idprops(ptr, true)) {
|
||||
IDP_AddToGroup(group,
|
||||
blender::bke::idprop::create(prop->identifier,
|
||||
blender::Span(values, prop->totarraylength))
|
||||
.release());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3938,13 +3901,13 @@ void RNA_property_pointer_set(PointerRNA *ptr,
|
||||
}
|
||||
else {
|
||||
BLI_assert(idprop->type == IDP_GROUP);
|
||||
|
||||
IDPropertyTemplate val{};
|
||||
val.id = static_cast<ID *>(ptr_value.data);
|
||||
IDProperty *group = RNA_struct_idprops(ptr, true);
|
||||
BLI_assert(group != nullptr);
|
||||
|
||||
IDP_ReplaceInGroup_ex(group, IDP_New(IDP_ID, &val, idprop->name), idprop);
|
||||
IDP_ReplaceInGroup_ex(
|
||||
group,
|
||||
blender::bke::idprop::create(idprop->name, static_cast<ID *>(ptr_value.data)).release(),
|
||||
idprop);
|
||||
}
|
||||
}
|
||||
/* RNA property. */
|
||||
@@ -3957,14 +3920,11 @@ void RNA_property_pointer_set(PointerRNA *ptr,
|
||||
}
|
||||
/* IDProperty disguised as RNA property (and not yet defined in ptr). */
|
||||
else if (prop->flag & PROP_EDITABLE) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *group;
|
||||
|
||||
val.id = static_cast<ID *>(ptr_value.data);
|
||||
|
||||
group = RNA_struct_idprops(ptr, true);
|
||||
if (group) {
|
||||
IDP_ReplaceInGroup(group, IDP_New(IDP_ID, &val, prop->identifier));
|
||||
if (IDProperty *group = RNA_struct_idprops(ptr, true)) {
|
||||
IDP_ReplaceInGroup(
|
||||
group,
|
||||
blender::bke::idprop::create(prop->identifier, static_cast<ID *>(ptr_value.data))
|
||||
.release());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3988,14 +3948,11 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
|
||||
/* already exists */
|
||||
}
|
||||
else if (prop->flag & PROP_IDPROPERTY) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *group;
|
||||
|
||||
val.i = 0;
|
||||
|
||||
group = RNA_struct_idprops(ptr, true);
|
||||
if (group) {
|
||||
IDP_AddToGroup(group, IDP_New(IDP_GROUP, &val, prop->identifier));
|
||||
IDP_AddToGroup(group, blender::bke::idprop::create_group(prop->identifier).release());
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -4212,10 +4169,9 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
|
||||
}
|
||||
|
||||
if ((idprop = rna_idproperty_check(&prop, ptr))) {
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *item;
|
||||
|
||||
item = IDP_New(IDP_GROUP, &val, "");
|
||||
item = blender::bke::idprop::create_group("").release();
|
||||
if (is_liboverride) {
|
||||
item->flag |= IDP_FLAG_OVERRIDELIBRARY_LOCAL;
|
||||
}
|
||||
@@ -4227,14 +4183,13 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
|
||||
}
|
||||
else if (prop->flag & PROP_IDPROPERTY) {
|
||||
IDProperty *group, *item;
|
||||
IDPropertyTemplate val = {0};
|
||||
|
||||
group = RNA_struct_idprops(ptr, true);
|
||||
if (group) {
|
||||
idprop = IDP_NewIDPArray(prop->identifier);
|
||||
IDP_AddToGroup(group, idprop);
|
||||
|
||||
item = IDP_New(IDP_GROUP, &val, "");
|
||||
item = blender::bke::idprop::create_group("").release();
|
||||
if (is_liboverride) {
|
||||
item->flag |= IDP_FLAG_OVERRIDELIBRARY_LOCAL;
|
||||
}
|
||||
|
||||
@@ -1072,8 +1072,8 @@ static PointerRNA rna_Addon_preferences_get(PointerRNA *ptr)
|
||||
bAddonPrefType *apt = BKE_addon_pref_type_find(addon->module, true);
|
||||
if (apt) {
|
||||
if (addon->prop == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
addon->prop = IDP_New(IDP_GROUP, &val, addon->module); /* name is unimportant. */
|
||||
/* name is unimportant. */
|
||||
addon->prop = blender::bke::idprop::create_group(addon->module).release();
|
||||
}
|
||||
return rna_pointer_inherit_refine(ptr, apt->rna_ext.srna, addon->prop);
|
||||
}
|
||||
|
||||
@@ -162,11 +162,7 @@ static PointerRNA rna_gizmo_target_set_operator(wmGizmo *gz,
|
||||
}
|
||||
|
||||
/* For the return value to be usable, we need 'PointerRNA.data' to be set. */
|
||||
IDProperty *properties;
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
properties = IDP_New(IDP_GROUP, &val, "wmGizmoProperties");
|
||||
}
|
||||
IDProperty *properties = blender::bke::idprop::create_group("wmGizmoProperties").release();
|
||||
|
||||
return *WM_gizmo_operator_set(gz, part_index, ot, properties);
|
||||
}
|
||||
|
||||
@@ -312,10 +312,7 @@ static void update_id_properties_from_node_group(NodesModifierData *nmd)
|
||||
}
|
||||
|
||||
IDProperty *old_properties = nmd->settings.properties;
|
||||
{
|
||||
IDPropertyTemplate idprop = {0};
|
||||
nmd->settings.properties = IDP_New(IDP_GROUP, &idprop, "Nodes Modifier Settings");
|
||||
}
|
||||
nmd->settings.properties = bke::idprop::create_group("Nodes Modifier Settings").release();
|
||||
IDProperty *new_properties = nmd->settings.properties;
|
||||
|
||||
nodes::update_input_properties_from_node_tree(*nmd->node_group, old_properties, *new_properties);
|
||||
|
||||
@@ -920,11 +920,10 @@ void update_input_properties_from_node_tree(const bNodeTree &tree,
|
||||
const std::string use_attribute_id = socket_identifier + input_use_attribute_suffix();
|
||||
const std::string attribute_name_id = socket_identifier + input_attribute_name_suffix();
|
||||
|
||||
IDPropertyTemplate idprop = {0};
|
||||
IDProperty *use_attribute_prop = IDP_New(IDP_BOOLEAN, &idprop, use_attribute_id.c_str());
|
||||
IDProperty *use_attribute_prop = bke::idprop::create_bool(use_attribute_id, false).release();
|
||||
IDP_AddToGroup(&properties, use_attribute_prop);
|
||||
|
||||
IDProperty *attribute_prop = IDP_New(IDP_STRING, &idprop, attribute_name_id.c_str());
|
||||
IDProperty *attribute_prop = bke::idprop::create(attribute_name_id, "").release();
|
||||
IDP_AddToGroup(&properties, attribute_prop);
|
||||
|
||||
if (old_properties == nullptr) {
|
||||
|
||||
@@ -409,26 +409,21 @@ static const char *idp_try_read_name(PyObject *name_obj)
|
||||
|
||||
static IDProperty *idp_from_PyFloat(const char *name, PyObject *ob)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
val.d = PyFloat_AsDouble(ob);
|
||||
return IDP_New(IDP_DOUBLE, &val, name);
|
||||
return blender::bke::idprop::create(name, PyFloat_AsDouble(ob)).release();
|
||||
}
|
||||
|
||||
static IDProperty *idp_from_PyBool(const char *name, PyObject *ob)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
val.i = PyC_Long_AsBool(ob);
|
||||
return IDP_New(IDP_BOOLEAN, &val, name);
|
||||
return blender::bke::idprop::create(name, int(PyC_Long_AsBool(ob))).release();
|
||||
}
|
||||
|
||||
static IDProperty *idp_from_PyLong(const char *name, PyObject *ob)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
val.i = PyC_Long_AsI32(ob);
|
||||
if (val.i == -1 && PyErr_Occurred()) {
|
||||
const int value = PyC_Long_AsI32(ob);
|
||||
if (value == -1 && PyErr_Occurred()) {
|
||||
return nullptr;
|
||||
}
|
||||
return IDP_New(IDP_INT, &val, name);
|
||||
return blender::bke::idprop::create(name, value).release();
|
||||
}
|
||||
|
||||
static IDProperty *idp_from_PyUnicode(const char *name, PyObject *ob)
|
||||
@@ -642,7 +637,6 @@ static IDProperty *idp_from_PySequence(const char *name, PyObject *ob)
|
||||
static IDProperty *idp_from_PyMapping(const char *name, PyObject *ob)
|
||||
{
|
||||
IDProperty *prop;
|
||||
const IDPropertyTemplate val = {0};
|
||||
|
||||
PyObject *keys, *vals, *key, *pval;
|
||||
int i, len;
|
||||
@@ -652,7 +646,7 @@ static IDProperty *idp_from_PyMapping(const char *name, PyObject *ob)
|
||||
|
||||
/* We allocate the group first; if we hit any invalid data,
|
||||
* we can delete it easily enough. */
|
||||
prop = IDP_New(IDP_GROUP, &val, name);
|
||||
prop = blender::bke::idprop::create_group(name).release();
|
||||
len = PyMapping_Length(ob);
|
||||
for (i = 0; i < len; i++) {
|
||||
key = PySequence_GetItem(keys, i);
|
||||
@@ -676,9 +670,9 @@ static IDProperty *idp_from_PyMapping(const char *name, PyObject *ob)
|
||||
|
||||
static IDProperty *idp_from_DatablockPointer(const char *name, PyObject *ob)
|
||||
{
|
||||
IDPropertyTemplate val = {0};
|
||||
pyrna_id_FromPyObject(ob, &val.id);
|
||||
return IDP_New(IDP_ID, &val, name);
|
||||
ID *id = nullptr;
|
||||
pyrna_id_FromPyObject(ob, &id);
|
||||
return blender::bke::idprop::create(name, id).release();
|
||||
}
|
||||
|
||||
static IDProperty *idp_from_PyObject(PyObject *name_obj, PyObject *ob)
|
||||
|
||||
@@ -58,8 +58,7 @@ static wmGizmo *wm_gizmo_create(const wmGizmoType *gzt, PointerRNA *properties)
|
||||
gz->properties = IDP_CopyProperty(static_cast<const IDProperty *>(properties->data));
|
||||
}
|
||||
else {
|
||||
IDPropertyTemplate val = {0};
|
||||
gz->properties = IDP_New(IDP_GROUP, &val, "wmGizmoProperties");
|
||||
gz->properties = blender::bke::idprop::create_group("wmGizmoProperties").release();
|
||||
}
|
||||
*gz->ptr = RNA_pointer_create(static_cast<ID *>(G_MAIN->wm.first), gzt->srna, gz->properties);
|
||||
|
||||
@@ -231,8 +230,7 @@ int WM_gizmo_operator_invoke(bContext *C, wmGizmo *gz, wmGizmoOpElem *gzop, cons
|
||||
bToolRef *tref = WM_toolsystem_ref_from_context(C);
|
||||
if (tref && WM_toolsystem_ref_properties_get_from_operator(tref, gzop->type, &tref_ptr)) {
|
||||
if (gzop->ptr.data == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
gzop->ptr.data = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
|
||||
gzop->ptr.data = blender::bke::idprop::create_group("wmOperatorProperties").release();
|
||||
}
|
||||
IDP_MergeGroup(static_cast<IDProperty *>(gzop->ptr.data),
|
||||
static_cast<const IDProperty *>(tref_ptr.data),
|
||||
@@ -603,8 +601,7 @@ void WM_gizmo_properties_create(PointerRNA *ptr, const char *gtstring)
|
||||
void WM_gizmo_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *gtstring)
|
||||
{
|
||||
if (*properties == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
*properties = IDP_New(IDP_GROUP, &val, "wmOpItemProp");
|
||||
*properties = blender::bke::idprop::create_group("wmOpItemProp").release();
|
||||
}
|
||||
|
||||
if (*ptr == nullptr) {
|
||||
|
||||
@@ -1376,8 +1376,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm,
|
||||
op->properties = IDP_CopyProperty(static_cast<const IDProperty *>(properties->data));
|
||||
}
|
||||
else {
|
||||
IDPropertyTemplate val = {0};
|
||||
op->properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
|
||||
op->properties = blender::bke::idprop::create_group("wmOperatorProperties").release();
|
||||
}
|
||||
*op->ptr = RNA_pointer_create(&wm->id, ot->srna, op->properties);
|
||||
|
||||
|
||||
@@ -710,8 +710,7 @@ void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, con
|
||||
}
|
||||
|
||||
if (*properties == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
*properties = IDP_New(IDP_GROUP, &val, "wmOpItemProp");
|
||||
*properties = blender::bke::idprop::create_group("wmOpItemProp").release();
|
||||
}
|
||||
|
||||
if (*ptr == nullptr) {
|
||||
@@ -825,8 +824,7 @@ void WM_operator_properties_free(PointerRNA *ptr)
|
||||
static bool operator_last_properties_init_impl(wmOperator *op, IDProperty *last_properties)
|
||||
{
|
||||
bool changed = false;
|
||||
IDPropertyTemplate val = {0};
|
||||
IDProperty *replaceprops = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
|
||||
IDProperty *replaceprops = blender::bke::idprop::create_group("wmOperatorProperties").release();
|
||||
|
||||
PropertyRNA *iterprop = RNA_struct_iterator_property(op->type->srna);
|
||||
|
||||
@@ -894,8 +892,8 @@ bool WM_operator_last_properties_store(wmOperator *op)
|
||||
LISTBASE_FOREACH (wmOperator *, opm, &op->macro) {
|
||||
if (opm->properties) {
|
||||
if (op->type->last_properties == nullptr) {
|
||||
IDPropertyTemplate temp{};
|
||||
op->type->last_properties = IDP_New(IDP_GROUP, &temp, "wmOperatorProperties");
|
||||
op->type->last_properties =
|
||||
blender::bke::idprop::create_group("wmOperatorProperties").release();
|
||||
}
|
||||
IDProperty *idp_macro = IDP_CopyProperty(opm->properties);
|
||||
STRNCPY(idp_macro->name, opm->type->idname);
|
||||
@@ -1262,8 +1260,7 @@ wmOperator *WM_operator_last_redo(const bContext *C)
|
||||
IDProperty *WM_operator_last_properties_ensure_idprops(wmOperatorType *ot)
|
||||
{
|
||||
if (ot->last_properties == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
ot->last_properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
|
||||
ot->last_properties = blender::bke::idprop::create_group("wmOperatorProperties").release();
|
||||
}
|
||||
return ot->last_properties;
|
||||
}
|
||||
|
||||
@@ -869,8 +869,7 @@ static IDProperty *idprops_ensure_named_group(IDProperty *group, const char *idn
|
||||
{
|
||||
IDProperty *prop = IDP_GetPropertyFromGroup(group, idname);
|
||||
if ((prop == nullptr) || (prop->type != IDP_GROUP)) {
|
||||
IDPropertyTemplate val = {0};
|
||||
prop = IDP_New(IDP_GROUP, &val, __func__);
|
||||
prop = blender::bke::idprop::create_group(__func__).release();
|
||||
STRNCPY(prop->name, idname);
|
||||
IDP_ReplaceInGroup_ex(group, prop, nullptr);
|
||||
}
|
||||
@@ -889,8 +888,7 @@ IDProperty *WM_toolsystem_ref_properties_get_idprops(bToolRef *tref)
|
||||
IDProperty *WM_toolsystem_ref_properties_ensure_idprops(bToolRef *tref)
|
||||
{
|
||||
if (tref->properties == nullptr) {
|
||||
IDPropertyTemplate val = {0};
|
||||
tref->properties = IDP_New(IDP_GROUP, &val, __func__);
|
||||
tref->properties = blender::bke::idprop::create_group(__func__).release();
|
||||
}
|
||||
return idprops_ensure_named_group(tref->properties, tref->idname);
|
||||
}
|
||||
@@ -926,8 +924,7 @@ void WM_toolsystem_ref_properties_init_for_keymap(bToolRef *tref,
|
||||
dst_ptr->data = IDP_CopyProperty(static_cast<const IDProperty *>(dst_ptr->data));
|
||||
}
|
||||
else {
|
||||
IDPropertyTemplate val = {0};
|
||||
dst_ptr->data = IDP_New(IDP_GROUP, &val, "wmOpItemProp");
|
||||
dst_ptr->data = blender::bke::idprop::create_group("wmOpItemProp").release();
|
||||
}
|
||||
IDProperty *group = WM_toolsystem_ref_properties_get_idprops(tref);
|
||||
if (group != nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user