Cleanup: PointerRNA: Remove 'C-style' zero-initializations.

These are useless now that PointerRNA has explicit default values, and
become a problem when real constructors are added to this struct. Simply
use the default empty value initialization instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/130927
This commit is contained in:
Bastien Montagne
2024-11-25 18:35:27 +01:00
committed by Gitea
parent ac0eba2d0d
commit 4bf5a2f5cb
26 changed files with 55 additions and 53 deletions

View File

@@ -5894,7 +5894,7 @@ void ANIM_channel_draw_widgets(const bContext *C,
/* step 4) draw text - check if renaming widget is in use... */
if (is_being_renamed) {
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
/* draw renaming widget if we can get RNA pointer for it

View File

@@ -5558,7 +5558,7 @@ static rctf calculate_selection_fcurve_bounds(bAnimContext *ac,
static int view_curve_in_graph_editor_exec(bContext *C, wmOperator *op)
{
PointerRNA button_ptr = {nullptr};
PointerRNA button_ptr = {};
PropertyRNA *button_prop = nullptr;
uiBut *but;
int index;

View File

@@ -866,7 +866,7 @@ static const EnumPropertyItem *driver_mapping_type_itemf(bContext *C,
const EnumPropertyItem *input = prop_driver_create_mapping_types;
EnumPropertyItem *item = nullptr;
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
int index;
@@ -903,7 +903,7 @@ static const EnumPropertyItem *driver_mapping_type_itemf(bContext *C,
static bool add_driver_button_poll(bContext *C)
{
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
int index;
bool driven, special;
@@ -928,7 +928,7 @@ static bool add_driver_button_poll(bContext *C)
* (i.e. "manual/add later"). */
static int add_driver_button_none(bContext *C, wmOperator *op, short mapping_type)
{
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
int index;
int success = 0;
@@ -1024,7 +1024,7 @@ static void UNUSED_FUNCTION(ANIM_OT_driver_button_add_menu)(wmOperatorType *ot)
static int add_driver_button_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
{
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
int index;
@@ -1077,7 +1077,7 @@ void ANIM_OT_driver_button_add(wmOperatorType *ot)
static int remove_driver_button_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
bool changed = false;
int index;
@@ -1128,7 +1128,7 @@ void ANIM_OT_driver_button_remove(wmOperatorType *ot)
static int edit_driver_button_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
int index;
@@ -1161,7 +1161,7 @@ void ANIM_OT_driver_button_edit(wmOperatorType *ot)
static int copy_driver_button_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
bool changed = false;
int index;
@@ -1200,7 +1200,7 @@ void ANIM_OT_copy_driver_button(wmOperatorType *ot)
static int paste_driver_button_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
bool changed = false;
int index;

View File

@@ -1038,7 +1038,7 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *ts = scene->toolsettings;
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
uiBut *but;
const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(
@@ -1193,7 +1193,7 @@ void ANIM_OT_keyframe_insert_button(wmOperatorType *ot)
static int delete_key_button_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
Main *bmain = CTX_data_main(C);
const float cfra = BKE_scene_frame_get(scene);
@@ -1299,7 +1299,7 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
static int clear_key_button_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
Main *bmain = CTX_data_main(C);
bool changed = false;

View File

@@ -267,7 +267,7 @@ void ANIM_OT_keying_set_path_remove(wmOperatorType *ot)
static int add_keyingset_button_exec(bContext *C, wmOperator *op)
{
PropertyRNA *prop = nullptr;
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
int index = 0, pflag = 0;
if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) {
@@ -360,7 +360,7 @@ void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
{
PropertyRNA *prop = nullptr;
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
int index = 0;
if (!UI_context_active_but_prop_get(C, &ptr, &prop, &index)) {

View File

@@ -82,7 +82,7 @@ static bool gpencil_data_add_poll(bContext *C)
/* add new datablock - wrapper around API */
static int gpencil_data_add_exec(bContext *C, wmOperator *op)
{
PointerRNA gpd_owner = {nullptr};
PointerRNA gpd_owner = {};
bGPdata **gpd_ptr = ED_annotation_data_get_pointers(C, &gpd_owner);
if (gpd_ptr == nullptr) {
@@ -193,7 +193,7 @@ static int gpencil_layer_add_exec(bContext *C, wmOperator *op)
{
const bool is_annotation = STREQ(op->idname, "GPENCIL_OT_layer_annotation_add");
PointerRNA gpd_owner = {nullptr};
PointerRNA gpd_owner = {};
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bGPdata *gpd = nullptr;

View File

@@ -54,7 +54,7 @@
AnimData *ED_actedit_animdata_from_context(const bContext *C, ID **r_adt_id_owner)
{
{ /* Support use from the layout.template_action() UI template. */
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
UI_context_active_but_prop_get_templateID(C, &ptr, &prop);
/* template_action() sets a RNA_AnimData pointer, whereas other code may set
@@ -184,7 +184,7 @@ static void actedit_change_action(bContext *C, bAction *act)
static bool action_new_poll(bContext *C)
{
{ /* Support use from the layout.template_action() UI template. */
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
UI_context_active_but_prop_get_templateID(C, &ptr, &prop);
if (prop) {

View File

@@ -415,7 +415,7 @@ static void saction_channel_region_message_subscribe(const wmRegionMessageSubscr
* so just whitelist the entire structs for updates
*/
{
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
StructRNA *type_array[] = {
&RNA_DopeSheet, /* dopesheet filters */

View File

@@ -151,7 +151,7 @@ static void buttons_texture_users_find_nodetree(ListBase *users,
id,
ntree,
node,
{nullptr},
{},
nullptr,
category,
RNA_struct_ui_icon(ptr.type),

View File

@@ -1335,7 +1335,7 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
PropertyRNA *prop = nullptr;
int index = -1;
uiBut *but = nullptr;

View File

@@ -539,7 +539,7 @@ static void graph_region_message_subscribe(const wmRegionMessageSubscribeParams
* so just whitelist the entire structs for updates
*/
{
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
StructRNA *type_array[] = {
&RNA_DopeSheet, /* dopesheet filters */

View File

@@ -373,7 +373,7 @@ static int nlatracks_pushdown_exec(bContext *C, wmOperator *op)
/* get anim-channel to use (or more specifically, the animdata block behind it) */
if (track_index == -1) {
PointerRNA adt_ptr = {nullptr};
PointerRNA adt_ptr = {};
/* active animdata block */
if (nla_panel_context(C, &adt_ptr, nullptr, nullptr) == 0 || (adt_ptr.data == nullptr)) {

View File

@@ -510,7 +510,7 @@ static void nla_track_region_message_subscribe(const wmRegionMessageSubscribePar
* so just whitelist the entire struct for updates
*/
{
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
StructRNA *type_array[] = {
&RNA_DopeSheet,
};

View File

@@ -1250,7 +1250,7 @@ static void outliner_sync_to_properties_editors(const bContext *C,
static void outliner_set_properties_tab(bContext *C, TreeElement *te, TreeStoreElem *tselem)
{
PointerRNA ptr = {nullptr};
PointerRNA ptr = {};
int context = 0;
/* ID Types */

View File

@@ -631,7 +631,7 @@ static void sequencer_main_region_message_subscribe(const wmRegionMessageSubscri
&RNA_SequenceModifier,
&RNA_SequenceColorBalanceData,
};
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
for (int i = 0; i < ARRAY_SIZE(type_array); i++) {
msg_key_params.ptr.type = type_array[i];
WM_msg_subscribe_rna_params(

View File

@@ -1054,7 +1054,7 @@ void ED_view3d_cursor3d_update(bContext *C,
{
wmMsgBus *mbus = CTX_wm_message_bus(C);
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
msg_key_params.ptr = RNA_pointer_create(&scene->id, &RNA_View3DCursor, &scene->cursor);
WM_msg_publish_rna_params(mbus, &msg_key_params);
}

View File

@@ -1727,7 +1727,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
/* Type is #eSnapFlag, but type must match various snap attributes in #ToolSettings. */
short *snap_flag_ptr;
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
msg_key_params.ptr = RNA_pointer_create(&t->scene->id, &RNA_ToolSettings, ts);
if ((snap_flag_ptr = transform_snap_flag_from_spacetype_ptr(t, &msg_key_params.prop)) &&
(is_snap_enabled != bool(*snap_flag_ptr & SCE_SNAP)))

View File

@@ -151,7 +151,7 @@ PointerRNA RNA_id_pointer_create(ID *id)
StructRNA *type, *idtype = nullptr;
if (id) {
PointerRNA tmp = {nullptr};
PointerRNA tmp = {};
tmp.data = id;
idtype = rna_ID_refine(&tmp);

View File

@@ -261,9 +261,9 @@ struct RNAPropertyOverrideApplyContext {
bool do_insert = false;
/** Main RNA data and property pointers. */
PointerRNA ptr_dst = {0};
PointerRNA ptr_src = {0};
PointerRNA ptr_storage = {0};
PointerRNA ptr_dst = {};
PointerRNA ptr_src = {};
PointerRNA ptr_storage = {};
PropertyRNA *prop_dst = nullptr;
PropertyRNA *prop_src = nullptr;
PropertyRNA *prop_storage = nullptr;
@@ -274,9 +274,9 @@ struct RNAPropertyOverrideApplyContext {
int len_storage = 0;
/** Items, for RNA collections. */
PointerRNA ptr_item_dst = {0};
PointerRNA ptr_item_src = {0};
PointerRNA ptr_item_storage = {0};
PointerRNA ptr_item_dst = {};
PointerRNA ptr_item_src = {};
PointerRNA ptr_item_storage = {};
/** LibOverride data. */
IDOverrideLibrary *liboverride = nullptr;

View File

@@ -557,7 +557,7 @@ bool rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Poin
{
StructRNA *srna;
PropertyRNA *prop;
PointerRNA propptr = {nullptr};
PointerRNA propptr = {};
srna = ptr->type;
@@ -1293,8 +1293,8 @@ struct RNACompareOverrideDiffPropPtrContext {
/** RNA pointer specific diffing parameters. */
ID *owner_id_a = nullptr;
ID *owner_id_b = nullptr;
PointerRNA propptr_a = {0};
PointerRNA propptr_b = {0};
PointerRNA propptr_a = {};
PointerRNA propptr_b = {};
PropertyType property_type = PROP_BOOLEAN;
/**

View File

@@ -345,8 +345,8 @@ static void panel_draw(const bContext *C, Panel *panel)
/* Only test for adaptive subdivision if built with cycles. */
bool show_adaptive_options = false;
bool ob_use_adaptive_subdivision = false;
PointerRNA cycles_ptr = {nullptr};
PointerRNA ob_cycles_ptr = {nullptr};
PointerRNA cycles_ptr = {};
PointerRNA ob_cycles_ptr = {};
#ifdef WITH_CYCLES
Scene *scene = CTX_data_scene(C);
PointerRNA scene_ptr = RNA_id_pointer_create(&scene->id);

View File

@@ -276,7 +276,7 @@ static PyObject *bpy_msgbus_subscribe_rna(PyObject * /*self*/, PyObject *args, P
/* NOTE: we may want to have a way to pass this in. */
bContext *C = BPY_context_get();
wmMsgBus *mbus = CTX_wm_message_bus(C);
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
wmMsgSubscribeValue msg_val_params = {nullptr};
@@ -358,7 +358,7 @@ static PyObject *bpy_msgbus_publish_rna(PyObject * /*self*/, PyObject *args, PyO
/* NOTE: we may want to have a way to pass this in. */
bContext *C = BPY_context_get();
wmMsgBus *mbus = CTX_wm_message_bus(C);
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
if (py_msgbus_rna_key_from_py(py_sub, &msg_key_params, error_prefix) == -1) {
return nullptr;

View File

@@ -2656,7 +2656,7 @@ static eHandlerActionFlag wm_handler_operator_call(bContext *C,
if (ot && wm_operator_check_locked_interface(C, ot)) {
bool use_last_properties = true;
PointerRNA tool_properties = {nullptr};
PointerRNA tool_properties = {};
bToolRef *keymap_tool = nullptr;
if (handler_base->type == WM_HANDLER_TYPE_KEYMAP) {

View File

@@ -384,7 +384,7 @@ static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr
for (link = lb.first; link; link = link->next) {
const char *identifier = link->data;
PointerRNA ctx_item_ptr = {{0}};
PointerRNA ctx_item_ptr = {};
// CTX_data_pointer_get(C, identifier); /* XXX, this isn't working. */
if (ctx_item_ptr.type == nullptr) {

View File

@@ -350,14 +350,14 @@ void WM_msg_subscribe_ID(wmMsgBus *mbus,
const wmMsgSubscribeValue *msg_val_params,
const char *id_repr)
{
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
msg_key_params.ptr = RNA_id_pointer_create(id);
WM_msg_subscribe_rna_params(mbus, &msg_key_params, msg_val_params, id_repr);
}
void WM_msg_publish_ID(wmMsgBus *mbus, ID *id)
{
wmMsgParams_RNA msg_key_params = {{nullptr}};
wmMsgParams_RNA msg_key_params = {{}};
msg_key_params.ptr = RNA_id_pointer_create(id);
WM_msg_publish_rna_params(mbus, &msg_key_params);
}

View File

@@ -216,7 +216,7 @@ void WM_msg_publish_ID(wmMsgBus *mbus, ID *id);
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_) \
{ \
wmMsgParams_RNA msg_key_params_ = {{0}}; \
wmMsgParams_RNA msg_key_params_ = {{}}; \
msg_key_params_.ptr = RNA_pointer_create(id_, &RNA_##type_, data_); \
msg_key_params_.prop = &rna_##type_##_##prop_; \
WM_msg_publish_rna_params(mbus, &msg_key_params_); \
@@ -224,7 +224,7 @@ void WM_msg_publish_ID(wmMsgBus *mbus, ID *id);
((void)0)
#define WM_msg_subscribe_rna_prop(mbus, id_, data_, type_, prop_, value) \
{ \
wmMsgParams_RNA msg_key_params_ = {{0}}; \
wmMsgParams_RNA msg_key_params_ = {{}}; \
msg_key_params_.ptr = RNA_pointer_create(id_, &RNA_##type_, data_); \
msg_key_params_.prop = &rna_##type_##_##prop_; \
WM_msg_subscribe_rna_params(mbus, &msg_key_params_, value, __func__); \
@@ -234,8 +234,9 @@ void WM_msg_publish_ID(wmMsgBus *mbus, ID *id);
/* Anonymous variants (for convenience). */
#define WM_msg_subscribe_rna_anon_type(mbus, type_, value) \
{ \
PointerRNA msg_ptr_ = {0, &RNA_##type_}; \
wmMsgParams_RNA msg_key_params_ = {{0}}; \
PointerRNA msg_ptr_ = {}; \
msg_ptr_.type = &RNA_##type_; \
wmMsgParams_RNA msg_key_params_ = {{}}; \
msg_key_params_.ptr = msg_ptr_; \
\
WM_msg_subscribe_rna_params(mbus, &msg_key_params_, value, __func__); \
@@ -243,8 +244,9 @@ void WM_msg_publish_ID(wmMsgBus *mbus, ID *id);
((void)0)
#define WM_msg_subscribe_rna_anon_prop(mbus, type_, prop_, value) \
{ \
PointerRNA msg_ptr_ = {0, &RNA_##type_}; \
wmMsgParams_RNA msg_key_params_ = {{0}}; \
PointerRNA msg_ptr_ = {}; \
msg_ptr_.type = &RNA_##type_; \
wmMsgParams_RNA msg_key_params_ = {{}}; \
msg_key_params_.ptr = msg_ptr_; \
msg_key_params_.prop = &rna_##type_##_##prop_; \
\