RNA: Fix illegal types mismatch in extern'ed PropertyRNA data.
Previous code would declare properties as `extern PropertyRNA`, but implement them as type-refined data (e.g. `FloatPropertyRNA`). This is fully illegal thing, it happened to work 'fine' so far for two main reasons: * C-linking does not do type-checks on extern data. * Code using these publicly exposed data would always use them as `PorpertyRNA *` pointers, and pass them to RNA API. However, this (finally !) breaks when trying to move generated `RNA_property.h` header to C++, since at least MSVC2022 does mangle the type in the extern'ed symbol name, which makes linking fails epically. This commit fixes the issue by only declaring `PointerRNA *` pointers in the headers. These pointers are then defined in each implementation file (the `rna_xxx_gen.cc` ones), and assinged to the address of a matching local static variable. These static variables are type-refined, and actually contain the property definition data. Pull Request: https://projects.blender.org/blender/blender/pulls/124603
This commit is contained in:
@@ -96,7 +96,7 @@ static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
|
||||
|
||||
/* Set this to a sub-member of the property to trigger an update. */
|
||||
rna_update_ptr = ptr;
|
||||
rna_update_prop = &rna_ColorRamp_color_mode;
|
||||
rna_update_prop = rna_ColorRamp_color_mode;
|
||||
is_undo = RNA_struct_undo_check(ptr.type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -964,7 +964,7 @@ static void ui_apply_but_undo(uiBut *but)
|
||||
* because undo systems track data by their ID, see: #67002. */
|
||||
/* Exception for active shape-key, since changing this in edit-mode updates
|
||||
* the shape key from object mode data. */
|
||||
if (ELEM(but->rnaprop, &rna_ID_name, &rna_Object_active_shape_key_index)) {
|
||||
if (ELEM(but->rnaprop, rna_ID_name, rna_Object_active_shape_key_index)) {
|
||||
/* pass */
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -492,10 +492,10 @@ static void saction_main_region_message_subscribe(const wmRegionMessageSubscribe
|
||||
{
|
||||
bool use_preview = (scene->r.flag & SCER_PRV_RANGE);
|
||||
const PropertyRNA *props[] = {
|
||||
use_preview ? &rna_Scene_frame_preview_start : &rna_Scene_frame_start,
|
||||
use_preview ? &rna_Scene_frame_preview_end : &rna_Scene_frame_end,
|
||||
&rna_Scene_use_preview_range,
|
||||
&rna_Scene_frame_current,
|
||||
use_preview ? rna_Scene_frame_preview_start : rna_Scene_frame_start,
|
||||
use_preview ? rna_Scene_frame_preview_end : rna_Scene_frame_end,
|
||||
rna_Scene_use_preview_range,
|
||||
rna_Scene_frame_current,
|
||||
};
|
||||
|
||||
PointerRNA idptr = RNA_id_pointer_create(&scene->id);
|
||||
|
||||
@@ -518,10 +518,10 @@ static void graph_region_message_subscribe(const wmRegionMessageSubscribeParams
|
||||
{
|
||||
bool use_preview = (scene->r.flag & SCER_PRV_RANGE);
|
||||
const PropertyRNA *props[] = {
|
||||
use_preview ? &rna_Scene_frame_preview_start : &rna_Scene_frame_start,
|
||||
use_preview ? &rna_Scene_frame_preview_end : &rna_Scene_frame_end,
|
||||
&rna_Scene_use_preview_range,
|
||||
&rna_Scene_frame_current,
|
||||
use_preview ? rna_Scene_frame_preview_start : rna_Scene_frame_start,
|
||||
use_preview ? rna_Scene_frame_preview_end : rna_Scene_frame_end,
|
||||
rna_Scene_use_preview_range,
|
||||
rna_Scene_frame_current,
|
||||
};
|
||||
|
||||
PointerRNA idptr = RNA_id_pointer_create(&scene->id);
|
||||
|
||||
@@ -435,10 +435,10 @@ static void nla_main_region_message_subscribe(const wmRegionMessageSubscribePara
|
||||
{
|
||||
bool use_preview = (scene->r.flag & SCER_PRV_RANGE);
|
||||
const PropertyRNA *props[] = {
|
||||
use_preview ? &rna_Scene_frame_preview_start : &rna_Scene_frame_start,
|
||||
use_preview ? &rna_Scene_frame_preview_end : &rna_Scene_frame_end,
|
||||
&rna_Scene_use_preview_range,
|
||||
&rna_Scene_frame_current,
|
||||
use_preview ? rna_Scene_frame_preview_start : rna_Scene_frame_start,
|
||||
use_preview ? rna_Scene_frame_preview_end : rna_Scene_frame_end,
|
||||
rna_Scene_use_preview_range,
|
||||
rna_Scene_frame_current,
|
||||
};
|
||||
|
||||
PointerRNA idptr = RNA_id_pointer_create(&scene->id);
|
||||
|
||||
@@ -604,10 +604,10 @@ static void sequencer_main_region_message_subscribe(const wmRegionMessageSubscri
|
||||
{
|
||||
bool use_preview = (scene->r.flag & SCER_PRV_RANGE);
|
||||
const PropertyRNA *props[] = {
|
||||
use_preview ? &rna_Scene_frame_preview_start : &rna_Scene_frame_start,
|
||||
use_preview ? &rna_Scene_frame_preview_end : &rna_Scene_frame_end,
|
||||
&rna_Scene_use_preview_range,
|
||||
&rna_Scene_frame_current,
|
||||
use_preview ? rna_Scene_frame_preview_start : rna_Scene_frame_start,
|
||||
use_preview ? rna_Scene_frame_preview_end : rna_Scene_frame_end,
|
||||
rna_Scene_use_preview_range,
|
||||
rna_Scene_frame_current,
|
||||
};
|
||||
|
||||
PointerRNA idptr = RNA_id_pointer_create(&scene->id);
|
||||
|
||||
@@ -260,16 +260,16 @@ static void WIDGETGROUP_camera_message_subscribe(const bContext *C,
|
||||
|
||||
{
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_CameraDOFSettings_focus_distance,
|
||||
&rna_Camera_display_size,
|
||||
&rna_Camera_ortho_scale,
|
||||
&rna_Camera_sensor_fit,
|
||||
&rna_Camera_sensor_width,
|
||||
&rna_Camera_sensor_height,
|
||||
&rna_Camera_shift_x,
|
||||
&rna_Camera_shift_y,
|
||||
&rna_Camera_type,
|
||||
&rna_Camera_lens,
|
||||
rna_CameraDOFSettings_focus_distance,
|
||||
rna_Camera_display_size,
|
||||
rna_Camera_ortho_scale,
|
||||
rna_Camera_sensor_fit,
|
||||
rna_Camera_sensor_width,
|
||||
rna_Camera_sensor_height,
|
||||
rna_Camera_shift_x,
|
||||
rna_Camera_shift_y,
|
||||
rna_Camera_type,
|
||||
rna_Camera_lens,
|
||||
};
|
||||
|
||||
PointerRNA idptr = RNA_id_pointer_create(&ca->id);
|
||||
|
||||
@@ -174,7 +174,7 @@ static void WIDGETGROUP_gizmo_message_subscribe(const bContext *C,
|
||||
|
||||
{
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_ToolSettings_workspace_tool_type,
|
||||
rna_ToolSettings_workspace_tool_type,
|
||||
};
|
||||
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
@@ -1784,19 +1784,19 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
||||
|
||||
if (t->spacetype == SPACE_NODE) {
|
||||
snap_flag_ptr = &ts->snap_flag_node;
|
||||
msg_key_params.prop = &rna_ToolSettings_use_snap_node;
|
||||
msg_key_params.prop = rna_ToolSettings_use_snap_node;
|
||||
}
|
||||
else if (t->spacetype == SPACE_IMAGE) {
|
||||
snap_flag_ptr = &ts->snap_uv_flag;
|
||||
msg_key_params.prop = &rna_ToolSettings_use_snap_uv;
|
||||
msg_key_params.prop = rna_ToolSettings_use_snap_uv;
|
||||
}
|
||||
else if (t->spacetype == SPACE_SEQ) {
|
||||
snap_flag_ptr = &ts->snap_flag_seq;
|
||||
msg_key_params.prop = &rna_ToolSettings_use_snap_sequencer;
|
||||
msg_key_params.prop = rna_ToolSettings_use_snap_sequencer;
|
||||
}
|
||||
else {
|
||||
snap_flag_ptr = &ts->snap_flag;
|
||||
msg_key_params.prop = &rna_ToolSettings_use_snap;
|
||||
msg_key_params.prop = rna_ToolSettings_use_snap;
|
||||
}
|
||||
|
||||
if (t->modifiers & MOD_SNAP) {
|
||||
|
||||
@@ -123,8 +123,8 @@ static void gizmo2d_pivot_point_message_subscribe(wmGizmoGroup *gzgroup,
|
||||
PointerRNA ptr = RNA_pointer_create(&screen->id, &RNA_SpaceImageEditor, sima);
|
||||
{
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_SpaceImageEditor_pivot_point,
|
||||
(sima->around == V3D_AROUND_CURSOR) ? &rna_SpaceImageEditor_cursor_location : nullptr,
|
||||
rna_SpaceImageEditor_pivot_point,
|
||||
(sima->around == V3D_AROUND_CURSOR) ? rna_SpaceImageEditor_cursor_location : nullptr,
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(props); i++) {
|
||||
if (props[i] == nullptr) {
|
||||
|
||||
@@ -1225,7 +1225,7 @@ void gizmo_xform_message_subscribe(wmGizmoGroup *gzgroup,
|
||||
PointerRNA scene_ptr = RNA_id_pointer_create(&scene->id);
|
||||
{
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_Scene_transform_orientation_slots,
|
||||
rna_Scene_transform_orientation_slots,
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(props); i++) {
|
||||
WM_msg_subscribe_rna(mbus, &scene_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
|
||||
@@ -1241,8 +1241,8 @@ void gizmo_xform_message_subscribe(wmGizmoGroup *gzgroup,
|
||||
|
||||
{
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_TransformOrientationSlot_type,
|
||||
&rna_TransformOrientationSlot_use,
|
||||
rna_TransformOrientationSlot_type,
|
||||
rna_TransformOrientationSlot_use,
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(props); i++) {
|
||||
if (props[i]) {
|
||||
@@ -1257,7 +1257,7 @@ void gizmo_xform_message_subscribe(wmGizmoGroup *gzgroup,
|
||||
|
||||
if (ELEM(type_fn, VIEW3D_GGT_xform_gizmo, VIEW3D_GGT_xform_shear)) {
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_ToolSettings_transform_pivot_point,
|
||||
rna_ToolSettings_transform_pivot_point,
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(props); i++) {
|
||||
WM_msg_subscribe_rna(
|
||||
@@ -1267,7 +1267,7 @@ void gizmo_xform_message_subscribe(wmGizmoGroup *gzgroup,
|
||||
|
||||
{
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_ToolSettings_workspace_tool_type,
|
||||
rna_ToolSettings_workspace_tool_type,
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(props); i++) {
|
||||
WM_msg_subscribe_rna(
|
||||
@@ -1281,9 +1281,9 @@ void gizmo_xform_message_subscribe(wmGizmoGroup *gzgroup,
|
||||
GizmoGroup *ggd = static_cast<GizmoGroup *>(gzgroup->customdata);
|
||||
if (ggd->use_twtype_refresh) {
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_SpaceView3D_show_gizmo_object_translate,
|
||||
&rna_SpaceView3D_show_gizmo_object_rotate,
|
||||
&rna_SpaceView3D_show_gizmo_object_scale,
|
||||
rna_SpaceView3D_show_gizmo_object_translate,
|
||||
rna_SpaceView3D_show_gizmo_object_rotate,
|
||||
rna_SpaceView3D_show_gizmo_object_scale,
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(props); i++) {
|
||||
WM_msg_subscribe_rna(mbus, &view3d_ptr, props[i], &msg_sub_value_gz_tag_refresh, __func__);
|
||||
|
||||
@@ -480,7 +480,7 @@ static void gizmo_mesh_extrude_message_subscribe(const bContext *C,
|
||||
PointerRNA toolsettings_ptr = RNA_pointer_create(
|
||||
&scene->id, &RNA_ToolSettings, scene->toolsettings);
|
||||
const PropertyRNA *props[] = {
|
||||
&rna_ToolSettings_workspace_tool_type,
|
||||
rna_ToolSettings_workspace_tool_type,
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(props); i++) {
|
||||
WM_msg_subscribe_rna(
|
||||
|
||||
@@ -1625,7 +1625,7 @@ static char *rna_def_property_begin_func(
|
||||
|
||||
fprintf(f, "\n memset(iter, 0, sizeof(*iter));\n");
|
||||
fprintf(f, " iter->parent = *ptr;\n");
|
||||
fprintf(f, " iter->prop = (PropertyRNA *)&rna_%s_%s;\n", srna->identifier, prop->identifier);
|
||||
fprintf(f, " iter->prop = rna_%s_%s;\n", srna->identifier, prop->identifier);
|
||||
|
||||
if (dp->dnalengthname || dp->dnalengthfixed) {
|
||||
if (manualfunc) {
|
||||
@@ -3725,13 +3725,18 @@ static void rna_generate_blender(BlenderRNA *brna, FILE *f)
|
||||
|
||||
static void rna_generate_external_property_prototypes(BlenderRNA *brna, FILE *f)
|
||||
{
|
||||
fprintf(f, "struct PropertyRNA;\n\n");
|
||||
|
||||
rna_generate_struct_rna_prototypes(brna, f);
|
||||
|
||||
/* NOTE: Generate generic `PropertyRNA *` pointers. The actual, type-refined properties data are
|
||||
* static variables in their translation units (the `_gen.cc` files), which addresses are
|
||||
* assigned to these public generic `PointerRNA *` pointers. */
|
||||
for (StructRNA *srna = static_cast<StructRNA *>(brna->structs.first); srna;
|
||||
srna = static_cast<StructRNA *>(srna->cont.next))
|
||||
{
|
||||
LISTBASE_FOREACH (PropertyRNA *, prop, &srna->cont.properties) {
|
||||
fprintf(f, "extern struct PropertyRNA rna_%s_%s;\n", srna->identifier, prop->identifier);
|
||||
fprintf(f, "extern struct PropertyRNA *rna_%s_%s;\n", srna->identifier, prop->identifier);
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
@@ -3743,14 +3748,14 @@ static void rna_generate_internal_property_prototypes(BlenderRNA * /*brna*/,
|
||||
{
|
||||
StructRNA *base;
|
||||
|
||||
/* NOTE: Generic `PropertyRNA *` pointers, see #rna_generate_external_property_prototypes
|
||||
* comments for details. */
|
||||
base = srna->base;
|
||||
while (base) {
|
||||
fprintf(f, "\n");
|
||||
LISTBASE_FOREACH (PropertyRNA *, prop, &base->cont.properties) {
|
||||
fprintf(f,
|
||||
"%s%s rna_%s_%s;\n",
|
||||
"RNA_EXTERN_C_OR_EXTERN ",
|
||||
rna_property_structname(prop->type),
|
||||
"RNA_EXTERN_C_OR_EXTERN PropertyRNA *rna_%s_%s;\n",
|
||||
base->identifier,
|
||||
prop->identifier);
|
||||
}
|
||||
@@ -3762,11 +3767,7 @@ static void rna_generate_internal_property_prototypes(BlenderRNA * /*brna*/,
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (PropertyRNA *, prop, &srna->cont.properties) {
|
||||
fprintf(f,
|
||||
"RNA_EXTERN_C %s rna_%s_%s;\n",
|
||||
rna_property_structname(prop->type),
|
||||
srna->identifier,
|
||||
prop->identifier);
|
||||
fprintf(f, "RNA_EXTERN_C PropertyRNA *rna_%s_%s;\n", srna->identifier, prop->identifier);
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
@@ -3776,11 +3777,11 @@ static void rna_generate_parameter_prototypes(BlenderRNA * /*brna*/,
|
||||
FunctionRNA *func,
|
||||
FILE *f)
|
||||
{
|
||||
/* NOTE: Generic `PropertyRNA *` pointers, see #rna_generate_external_property_prototypes
|
||||
* comments for details. */
|
||||
LISTBASE_FOREACH (PropertyRNA *, parm, &func->cont.properties) {
|
||||
fprintf(f,
|
||||
"%s%s rna_%s_%s_%s;\n",
|
||||
"extern ",
|
||||
rna_property_structname(parm->type),
|
||||
"extern PropertyRNA *rna_%s_%s_%s;\n",
|
||||
srna->identifier,
|
||||
func->identifier,
|
||||
parm->identifier);
|
||||
@@ -3801,12 +3802,7 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna,
|
||||
for (func = static_cast<FunctionRNA *>(base->functions.first); func;
|
||||
func = static_cast<FunctionRNA *>(func->cont.next))
|
||||
{
|
||||
fprintf(f,
|
||||
"%s%s rna_%s_%s_func;\n",
|
||||
"extern ",
|
||||
"FunctionRNA",
|
||||
base->identifier,
|
||||
func->identifier);
|
||||
fprintf(f, "extern FunctionRNA rna_%s_%s_func;\n", base->identifier, func->identifier);
|
||||
rna_generate_parameter_prototypes(brna, base, func, f);
|
||||
}
|
||||
|
||||
@@ -3820,8 +3816,7 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna,
|
||||
for (func = static_cast<FunctionRNA *>(srna->functions.first); func;
|
||||
func = static_cast<FunctionRNA *>(func->cont.next))
|
||||
{
|
||||
fprintf(
|
||||
f, "%s%s rna_%s_%s_func;\n", "extern ", "FunctionRNA", srna->identifier, func->identifier);
|
||||
fprintf(f, "extern FunctionRNA rna_%s_%s_func;\n", srna->identifier, func->identifier);
|
||||
rna_generate_parameter_prototypes(brna, srna, func, f);
|
||||
}
|
||||
|
||||
@@ -4306,23 +4301,24 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
|
||||
break;
|
||||
}
|
||||
|
||||
/* Generate the RNA-private, type-refined property data.
|
||||
*
|
||||
* See #rna_generate_external_property_prototypes comments for details. */
|
||||
fprintf(f,
|
||||
"%s rna_%s%s_%s = {\n",
|
||||
"static %s rna_%s%s_%s_ = {\n",
|
||||
rna_property_structname(prop->type),
|
||||
srna->identifier,
|
||||
strnest,
|
||||
prop->identifier);
|
||||
|
||||
if (prop->next) {
|
||||
fprintf(
|
||||
f, "\t{(PropertyRNA *)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier);
|
||||
fprintf(f, "\t{rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier);
|
||||
}
|
||||
else {
|
||||
fprintf(f, "\t{nullptr, ");
|
||||
}
|
||||
if (prop->prev) {
|
||||
fprintf(
|
||||
f, "(PropertyRNA *)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier);
|
||||
fprintf(f, "rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier);
|
||||
}
|
||||
else {
|
||||
fprintf(f, "nullptr,\n");
|
||||
@@ -4569,7 +4565,20 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(f, "};\n\n");
|
||||
fprintf(f, "};\n");
|
||||
|
||||
/* Assign the RNA-private, type-refined static (local) property data address to the public
|
||||
* matching generic `PropertyRNA *` pointer.
|
||||
*
|
||||
* See #rna_generate_external_property_prototypes comments for details. */
|
||||
fprintf(f,
|
||||
"PropertyRNA *rna_%s%s_%s = reinterpret_cast<PropertyRNA *>(&rna_%s%s_%s_);\n\n",
|
||||
srna->identifier,
|
||||
strnest,
|
||||
prop->identifier,
|
||||
srna->identifier,
|
||||
strnest,
|
||||
prop->identifier);
|
||||
|
||||
if (freenest) {
|
||||
MEM_freeN(strnest);
|
||||
@@ -4622,11 +4631,7 @@ static void rna_generate_struct(BlenderRNA * /*brna*/, StructRNA *srna, FILE *f)
|
||||
|
||||
parm = static_cast<PropertyRNA *>(func->cont.properties.first);
|
||||
if (parm) {
|
||||
fprintf(f,
|
||||
"\t{(PropertyRNA *)&rna_%s_%s_%s, ",
|
||||
srna->identifier,
|
||||
func->identifier,
|
||||
parm->identifier);
|
||||
fprintf(f, "\t{rna_%s_%s_%s, ", srna->identifier, func->identifier, parm->identifier);
|
||||
}
|
||||
else {
|
||||
fprintf(f, "\t{nullptr, ");
|
||||
@@ -4634,11 +4639,7 @@ static void rna_generate_struct(BlenderRNA * /*brna*/, StructRNA *srna, FILE *f)
|
||||
|
||||
parm = static_cast<PropertyRNA *>(func->cont.properties.last);
|
||||
if (parm) {
|
||||
fprintf(f,
|
||||
"(PropertyRNA *)&rna_%s_%s_%s}},\n",
|
||||
srna->identifier,
|
||||
func->identifier,
|
||||
parm->identifier);
|
||||
fprintf(f, "rna_%s_%s_%s}},\n", srna->identifier, func->identifier, parm->identifier);
|
||||
}
|
||||
else {
|
||||
fprintf(f, "nullptr}},\n");
|
||||
@@ -4659,11 +4660,7 @@ static void rna_generate_struct(BlenderRNA * /*brna*/, StructRNA *srna, FILE *f)
|
||||
}
|
||||
|
||||
if (func->c_ret) {
|
||||
fprintf(f,
|
||||
"\t(PropertyRNA *)&rna_%s_%s_%s\n",
|
||||
srna->identifier,
|
||||
func->identifier,
|
||||
func->c_ret->identifier);
|
||||
fprintf(f, "\trna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier);
|
||||
}
|
||||
else {
|
||||
fprintf(f, "\tnullptr\n");
|
||||
@@ -4692,7 +4689,7 @@ static void rna_generate_struct(BlenderRNA * /*brna*/, StructRNA *srna, FILE *f)
|
||||
|
||||
prop = static_cast<PropertyRNA *>(srna->cont.properties.first);
|
||||
if (prop) {
|
||||
fprintf(f, "\t{(PropertyRNA *)&rna_%s_%s, ", srna->identifier, prop->identifier);
|
||||
fprintf(f, "\t{rna_%s_%s, ", srna->identifier, prop->identifier);
|
||||
}
|
||||
else {
|
||||
fprintf(f, "\t{nullptr, ");
|
||||
@@ -4700,7 +4697,7 @@ static void rna_generate_struct(BlenderRNA * /*brna*/, StructRNA *srna, FILE *f)
|
||||
|
||||
prop = static_cast<PropertyRNA *>(srna->cont.properties.last);
|
||||
if (prop) {
|
||||
fprintf(f, "(PropertyRNA *)&rna_%s_%s}},\n", srna->identifier, prop->identifier);
|
||||
fprintf(f, "rna_%s_%s}},\n", srna->identifier, prop->identifier);
|
||||
}
|
||||
else {
|
||||
fprintf(f, "nullptr}},\n");
|
||||
@@ -4723,7 +4720,7 @@ static void rna_generate_struct(BlenderRNA * /*brna*/, StructRNA *srna, FILE *f)
|
||||
base = base->base;
|
||||
}
|
||||
|
||||
fprintf(f, "\t(PropertyRNA *)&rna_%s_%s, ", base->identifier, prop->identifier);
|
||||
fprintf(f, "\trna_%s_%s, ", base->identifier, prop->identifier);
|
||||
}
|
||||
else {
|
||||
fprintf(f, "\tnullptr, ");
|
||||
@@ -4734,7 +4731,7 @@ static void rna_generate_struct(BlenderRNA * /*brna*/, StructRNA *srna, FILE *f)
|
||||
while (base->base && base->base->iteratorproperty == prop) {
|
||||
base = base->base;
|
||||
}
|
||||
fprintf(f, "(PropertyRNA *)&rna_%s_rna_properties,\n", base->identifier);
|
||||
fprintf(f, "rna_%s_rna_properties,\n", base->identifier);
|
||||
|
||||
if (srna->base) {
|
||||
fprintf(f, "\t&RNA_%s,\n", srna->base->identifier);
|
||||
|
||||
@@ -434,31 +434,31 @@ static bool rna_idproperty_verify_valid(PointerRNA *ptr, PropertyRNA *prop, IDPr
|
||||
}
|
||||
|
||||
static PropertyRNA *typemap[IDP_NUMTYPES] = {
|
||||
&rna_PropertyGroupItem_string,
|
||||
&rna_PropertyGroupItem_int,
|
||||
&rna_PropertyGroupItem_float,
|
||||
rna_PropertyGroupItem_string,
|
||||
rna_PropertyGroupItem_int,
|
||||
rna_PropertyGroupItem_float,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&rna_PropertyGroupItem_group,
|
||||
&rna_PropertyGroupItem_id,
|
||||
&rna_PropertyGroupItem_double,
|
||||
&rna_PropertyGroupItem_idp_array,
|
||||
&rna_PropertyGroupItem_bool,
|
||||
rna_PropertyGroupItem_group,
|
||||
rna_PropertyGroupItem_id,
|
||||
rna_PropertyGroupItem_double,
|
||||
rna_PropertyGroupItem_idp_array,
|
||||
rna_PropertyGroupItem_bool,
|
||||
};
|
||||
|
||||
static PropertyRNA *arraytypemap[IDP_NUMTYPES] = {
|
||||
nullptr,
|
||||
&rna_PropertyGroupItem_int_array,
|
||||
&rna_PropertyGroupItem_float_array,
|
||||
rna_PropertyGroupItem_int_array,
|
||||
rna_PropertyGroupItem_float_array,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&rna_PropertyGroupItem_collection,
|
||||
rna_PropertyGroupItem_collection,
|
||||
nullptr,
|
||||
&rna_PropertyGroupItem_double_array,
|
||||
rna_PropertyGroupItem_double_array,
|
||||
nullptr,
|
||||
(PropertyRNA *)&rna_PropertyGroupItem_bool_array,
|
||||
rna_PropertyGroupItem_bool_array,
|
||||
};
|
||||
|
||||
void rna_property_rna_or_id_get(PropertyRNA *prop,
|
||||
@@ -533,7 +533,7 @@ void rna_property_rna_or_id_get(PropertyRNA *prop,
|
||||
const IDPropertyUIDataInt *ui_data_int = reinterpret_cast<IDPropertyUIDataInt *>(
|
||||
idprop->ui_data);
|
||||
if (ui_data_int && ui_data_int->enum_items_num > 0) {
|
||||
r_prop_rna_or_id->rnaprop = &rna_PropertyGroupItem_enum;
|
||||
r_prop_rna_or_id->rnaprop = rna_PropertyGroupItem_enum;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -571,7 +571,7 @@ PropertyRNA *rna_ensure_property(PropertyRNA *prop)
|
||||
const IDPropertyUIDataInt *ui_data_int = reinterpret_cast<IDPropertyUIDataInt *>(
|
||||
idprop->ui_data);
|
||||
if (ui_data_int && ui_data_int->enum_items_num > 0) {
|
||||
return &rna_PropertyGroupItem_enum;
|
||||
return rna_PropertyGroupItem_enum;
|
||||
}
|
||||
}
|
||||
return typemap[int(idprop->type)];
|
||||
|
||||
@@ -2627,7 +2627,7 @@ static void radial_control_set_initial_mouse(bContext *C, RadialControl *rc, con
|
||||
d[1] *= zoom[1];
|
||||
}
|
||||
rc->scale_fac = 1.0f;
|
||||
if (rc->ptr.owner_id && GS(rc->ptr.owner_id->name) == ID_BR && rc->prop == &rna_Brush_size) {
|
||||
if (rc->ptr.owner_id && GS(rc->ptr.owner_id->name) == ID_BR && rc->prop == rna_Brush_size) {
|
||||
Brush *brush = reinterpret_cast<Brush *>(rc->ptr.owner_id);
|
||||
if ((brush && brush->gpencil_settings) && (brush->ob_mode == OB_MODE_PAINT_GPENCIL_LEGACY) &&
|
||||
(brush->gpencil_tool == GPAINT_TOOL_DRAW) && (brush->flag & BRUSH_LOCK_SIZE) != 0)
|
||||
|
||||
@@ -218,7 +218,7 @@ void WM_msg_publish_ID(wmMsgBus *mbus, ID *id);
|
||||
{ \
|
||||
wmMsgParams_RNA msg_key_params_ = {{0}}; \
|
||||
msg_key_params_.ptr = RNA_pointer_create(id_, &RNA_##type_, data_); \
|
||||
msg_key_params_.prop = &rna_##type_##_##prop_; \
|
||||
msg_key_params_.prop = rna_##type_##_##prop_; \
|
||||
WM_msg_publish_rna_params(mbus, &msg_key_params_); \
|
||||
} \
|
||||
((void)0)
|
||||
@@ -226,7 +226,7 @@ void WM_msg_publish_ID(wmMsgBus *mbus, ID *id);
|
||||
{ \
|
||||
wmMsgParams_RNA msg_key_params_ = {{0}}; \
|
||||
msg_key_params_.ptr = RNA_pointer_create(id_, &RNA_##type_, data_); \
|
||||
msg_key_params_.prop = &rna_##type_##_##prop_; \
|
||||
msg_key_params_.prop = rna_##type_##_##prop_; \
|
||||
WM_msg_subscribe_rna_params(mbus, &msg_key_params_, value, __func__); \
|
||||
} \
|
||||
((void)0)
|
||||
@@ -246,7 +246,7 @@ void WM_msg_publish_ID(wmMsgBus *mbus, ID *id);
|
||||
PointerRNA msg_ptr_ = {0, &RNA_##type_}; \
|
||||
wmMsgParams_RNA msg_key_params_ = {{0}}; \
|
||||
msg_key_params_.ptr = msg_ptr_; \
|
||||
msg_key_params_.prop = &rna_##type_##_##prop_; \
|
||||
msg_key_params_.prop = rna_##type_##_##prop_; \
|
||||
\
|
||||
WM_msg_subscribe_rna_params(mbus, &msg_key_params_, value, __func__); \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user