Cleanup: use _ separator for variable names including dummy

Names such as `dummyult` and `dummyet` didn't read very well,
underscore separate these names.

Also rename some variables that used old conventions which missed
being updated (`mpr` for manipulator instead of `gz` for gizmo).
This commit is contained in:
2023-02-28 14:39:41 +11:00
parent 6d5e834857
commit 9ac0cc48b9
12 changed files with 321 additions and 321 deletions

View File

@@ -198,23 +198,23 @@ static short ob_keyframes_loop(KeyframeEditData *ked,
int filter; int filter;
int ret = 0; int ret = 0;
bAnimListElem dummychan = {NULL}; bAnimListElem dummy_chan = {NULL};
Base dummybase = {NULL}; Base dummy_base = {NULL};
if (ob == NULL) { if (ob == NULL) {
return 0; return 0;
} }
/* create a dummy wrapper data to work with */ /* create a dummy wrapper data to work with */
dummybase.object = ob; dummy_base.object = ob;
dummychan.type = ANIMTYPE_OBJECT; dummy_chan.type = ANIMTYPE_OBJECT;
dummychan.data = &dummybase; dummy_chan.data = &dummy_base;
dummychan.id = &ob->id; dummy_chan.id = &ob->id;
dummychan.adt = ob->adt; dummy_chan.adt = ob->adt;
ac.ads = ads; ac.ads = ads;
ac.data = &dummychan; ac.data = &dummy_chan;
ac.datatype = ANIMCONT_CHANNEL; ac.datatype = ANIMCONT_CHANNEL;
/* get F-Curves to take keyframes from */ /* get F-Curves to take keyframes from */
@@ -250,20 +250,20 @@ static short scene_keyframes_loop(KeyframeEditData *ked,
int filter; int filter;
int ret = 0; int ret = 0;
bAnimListElem dummychan = {NULL}; bAnimListElem dummy_chan = {NULL};
if (sce == NULL) { if (sce == NULL) {
return 0; return 0;
} }
/* create a dummy wrapper data to work with */ /* create a dummy wrapper data to work with */
dummychan.type = ANIMTYPE_SCENE; dummy_chan.type = ANIMTYPE_SCENE;
dummychan.data = sce; dummy_chan.data = sce;
dummychan.id = &sce->id; dummy_chan.id = &sce->id;
dummychan.adt = sce->adt; dummy_chan.adt = sce->adt;
ac.ads = ads; ac.ads = ads;
ac.data = &dummychan; ac.data = &dummy_chan;
ac.datatype = ANIMCONT_CHANNEL; ac.datatype = ANIMCONT_CHANNEL;
/* get F-Curves to take keyframes from */ /* get F-Curves to take keyframes from */

View File

@@ -926,20 +926,20 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, AnimKeylist *keylist, const i
bAnimContext ac = {nullptr}; bAnimContext ac = {nullptr};
ListBase anim_data = {nullptr, nullptr}; ListBase anim_data = {nullptr, nullptr};
bAnimListElem dummychan = {nullptr}; bAnimListElem dummy_chan = {nullptr};
if (sce == nullptr) { if (sce == nullptr) {
return; return;
} }
/* create a dummy wrapper data to work with */ /* create a dummy wrapper data to work with */
dummychan.type = ANIMTYPE_SCENE; dummy_chan.type = ANIMTYPE_SCENE;
dummychan.data = sce; dummy_chan.data = sce;
dummychan.id = &sce->id; dummy_chan.id = &sce->id;
dummychan.adt = sce->adt; dummy_chan.adt = sce->adt;
ac.ads = ads; ac.ads = ads;
ac.data = &dummychan; ac.data = &dummy_chan;
ac.datatype = ANIMCONT_CHANNEL; ac.datatype = ANIMCONT_CHANNEL;
/* get F-Curves to take keyframes from */ /* get F-Curves to take keyframes from */
@@ -961,23 +961,23 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, AnimKeylist *keylist, const int
bAnimContext ac = {nullptr}; bAnimContext ac = {nullptr};
ListBase anim_data = {nullptr, nullptr}; ListBase anim_data = {nullptr, nullptr};
bAnimListElem dummychan = {nullptr}; bAnimListElem dummy_chan = {nullptr};
Base dummybase = {nullptr}; Base dummy_base = {nullptr};
if (ob == nullptr) { if (ob == nullptr) {
return; return;
} }
/* create a dummy wrapper data to work with */ /* create a dummy wrapper data to work with */
dummybase.object = ob; dummy_base.object = ob;
dummychan.type = ANIMTYPE_OBJECT; dummy_chan.type = ANIMTYPE_OBJECT;
dummychan.data = &dummybase; dummy_chan.data = &dummy_base;
dummychan.id = &ob->id; dummy_chan.id = &ob->id;
dummychan.adt = ob->adt; dummy_chan.adt = ob->adt;
ac.ads = ads; ac.ads = ads;
ac.data = &dummychan; ac.data = &dummy_chan;
ac.datatype = ANIMCONT_CHANNEL; ac.datatype = ANIMCONT_CHANNEL;
/* get F-Curves to take keyframes from */ /* get F-Curves to take keyframes from */
@@ -1003,15 +1003,15 @@ void cachefile_to_keylist(bDopeSheet *ads,
} }
/* create a dummy wrapper data to work with */ /* create a dummy wrapper data to work with */
bAnimListElem dummychan = {nullptr}; bAnimListElem dummy_chan = {nullptr};
dummychan.type = ANIMTYPE_DSCACHEFILE; dummy_chan.type = ANIMTYPE_DSCACHEFILE;
dummychan.data = cache_file; dummy_chan.data = cache_file;
dummychan.id = &cache_file->id; dummy_chan.id = &cache_file->id;
dummychan.adt = cache_file->adt; dummy_chan.adt = cache_file->adt;
bAnimContext ac = {nullptr}; bAnimContext ac = {nullptr};
ac.ads = ads; ac.ads = ads;
ac.data = &dummychan; ac.data = &dummy_chan;
ac.datatype = ANIMCONT_CHANNEL; ac.datatype = ANIMCONT_CHANNEL;
/* get F-Curves to take keyframes from */ /* get F-Curves to take keyframes from */

View File

@@ -784,8 +784,8 @@ static Object *object_preview_camera_create(Main *preview_main,
Object *camera = BKE_object_add(preview_main, scene, view_layer, OB_CAMERA, "Preview Camera"); Object *camera = BKE_object_add(preview_main, scene, view_layer, OB_CAMERA, "Preview Camera");
float rotmat[3][3]; float rotmat[3][3];
float dummyscale[3]; float dummy_scale[3];
mat4_to_loc_rot_size(camera->loc, rotmat, dummyscale, preview_object->object_to_world); mat4_to_loc_rot_size(camera->loc, rotmat, dummy_scale, preview_object->object_to_world);
/* Camera is Y up, so needs additional rotations to obliquely face the front. */ /* Camera is Y up, so needs additional rotations to obliquely face the front. */
float drotmat[3][3]; float drotmat[3][3];

View File

@@ -644,13 +644,13 @@ StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain),
StructCallbackFunc UNUSED(call), StructCallbackFunc UNUSED(call),
StructFreeFunc UNUSED(free)) StructFreeFunc UNUSED(free))
{ {
PointerRNA dummyptr; PointerRNA dummy_ptr;
/* create dummy pointer */ /* create dummy pointer */
RNA_pointer_create(NULL, &RNA_PropertyGroup, NULL, &dummyptr); RNA_pointer_create(NULL, &RNA_PropertyGroup, NULL, &dummy_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummyptr, data, NULL) != 0) { if (validate(&dummy_ptr, data, NULL) != 0) {
return NULL; return NULL;
} }

View File

@@ -283,33 +283,33 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
StructFreeFunc free) StructFreeFunc free)
{ {
const char *error_prefix = "Registering keying set info class:"; const char *error_prefix = "Registering keying set info class:";
KeyingSetInfo dummyksi = {NULL}; KeyingSetInfo dummy_ksi = {NULL};
KeyingSetInfo *ksi; KeyingSetInfo *ksi;
PointerRNA dummyptr = {NULL}; PointerRNA dummy_ksi_ptr = {NULL};
int have_function[3]; int have_function[3];
/* setup dummy type info to store static properties in */ /* setup dummy type info to store static properties in */
/* TODO: perhaps we want to get users to register /* TODO: perhaps we want to get users to register
* as if they're using 'KeyingSet' directly instead? */ * as if they're using 'KeyingSet' directly instead? */
RNA_pointer_create(NULL, &RNA_KeyingSetInfo, &dummyksi, &dummyptr); RNA_pointer_create(NULL, &RNA_KeyingSetInfo, &dummy_ksi, &dummy_ksi_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummyptr, data, have_function) != 0) { if (validate(&dummy_ksi_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (strlen(identifier) >= sizeof(dummyksi.idname)) { if (strlen(identifier) >= sizeof(dummy_ksi.idname)) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s '%s' is too long, maximum length is %d", "%s '%s' is too long, maximum length is %d",
error_prefix, error_prefix,
identifier, identifier,
(int)sizeof(dummyksi.idname)); (int)sizeof(dummy_ksi.idname));
return NULL; return NULL;
} }
/* check if we have registered this info before, and remove it */ /* check if we have registered this info before, and remove it */
ksi = ANIM_keyingset_info_find_name(dummyksi.idname); ksi = ANIM_keyingset_info_find_name(dummy_ksi.idname);
if (ksi) { if (ksi) {
StructRNA *srna = ksi->rna_ext.srna; StructRNA *srna = ksi->rna_ext.srna;
if (!(srna && rna_KeyingSetInfo_unregister(bmain, srna))) { if (!(srna && rna_KeyingSetInfo_unregister(bmain, srna))) {
@@ -318,7 +318,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
"%s '%s', bl_idname '%s' %s", "%s '%s', bl_idname '%s' %s",
error_prefix, error_prefix,
identifier, identifier,
dummyksi.idname, dummy_ksi.idname,
srna ? "is built-in" : "could not be unregistered"); srna ? "is built-in" : "could not be unregistered");
return NULL; return NULL;
} }
@@ -326,7 +326,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
/* create a new KeyingSetInfo type */ /* create a new KeyingSetInfo type */
ksi = MEM_mallocN(sizeof(KeyingSetInfo), "python keying set info"); ksi = MEM_mallocN(sizeof(KeyingSetInfo), "python keying set info");
memcpy(ksi, &dummyksi, sizeof(KeyingSetInfo)); memcpy(ksi, &dummy_ksi, sizeof(KeyingSetInfo));
/* set RNA-extensions info */ /* set RNA-extensions info */
ksi->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ksi->idname, &RNA_KeyingSetInfo); ksi->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ksi->idname, &RNA_KeyingSetInfo);

View File

@@ -1073,34 +1073,34 @@ static StructRNA *rna_NodeTree_register(Main *bmain,
StructFreeFunc free) StructFreeFunc free)
{ {
const char *error_prefix = "Registering node tree class:"; const char *error_prefix = "Registering node tree class:";
bNodeTreeType *nt, dummynt; bNodeTreeType *nt, dummy_nt;
bNodeTree dummyntree; bNodeTree dummy_ntree;
PointerRNA dummyptr; PointerRNA dummy_ntree_ptr;
int have_function[4]; int have_function[4];
/* setup dummy tree & tree type to store static properties in */ /* setup dummy tree & tree type to store static properties in */
memset(&dummynt, 0, sizeof(bNodeTreeType)); memset(&dummy_nt, 0, sizeof(bNodeTreeType));
memset(&dummyntree, 0, sizeof(bNodeTree)); memset(&dummy_ntree, 0, sizeof(bNodeTree));
dummyntree.typeinfo = &dummynt; dummy_ntree.typeinfo = &dummy_nt;
RNA_pointer_create(NULL, &RNA_NodeTree, &dummyntree, &dummyptr); RNA_pointer_create(NULL, &RNA_NodeTree, &dummy_ntree, &dummy_ntree_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummyptr, data, have_function) != 0) { if (validate(&dummy_ntree_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (strlen(identifier) >= sizeof(dummynt.idname)) { if (strlen(identifier) >= sizeof(dummy_nt.idname)) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s '%s' is too long, maximum length is %d", "%s '%s' is too long, maximum length is %d",
error_prefix, error_prefix,
identifier, identifier,
(int)sizeof(dummynt.idname)); (int)sizeof(dummy_nt.idname));
return NULL; return NULL;
} }
/* check if we have registered this tree type before, and remove it */ /* check if we have registered this tree type before, and remove it */
nt = ntreeTypeFind(dummynt.idname); nt = ntreeTypeFind(dummy_nt.idname);
if (nt) { if (nt) {
/* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for NULL. */ /* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for NULL. */
if (!rna_NodeTree_unregister(bmain, nt->rna_ext.srna)) { if (!rna_NodeTree_unregister(bmain, nt->rna_ext.srna)) {
@@ -1109,14 +1109,14 @@ static StructRNA *rna_NodeTree_register(Main *bmain,
"%s '%s', bl_idname '%s' could not be unregistered", "%s '%s', bl_idname '%s' could not be unregistered",
error_prefix, error_prefix,
identifier, identifier,
dummynt.idname); dummy_nt.idname);
return NULL; return NULL;
} }
} }
/* create a new node tree type */ /* create a new node tree type */
nt = MEM_mallocN(sizeof(bNodeTreeType), "node tree type"); nt = MEM_mallocN(sizeof(bNodeTreeType), "node tree type");
memcpy(nt, &dummynt, sizeof(dummynt)); memcpy(nt, &dummy_nt, sizeof(dummy_nt));
nt->type = NTREE_CUSTOM; nt->type = NTREE_CUSTOM;
@@ -1928,39 +1928,39 @@ static bNodeType *rna_Node_register_base(Main *bmain,
StructFreeFunc free) StructFreeFunc free)
{ {
const char *error_prefix = "Registering node class:"; const char *error_prefix = "Registering node class:";
bNodeType *nt, dummynt; bNodeType *nt, dummy_nt;
bNode dummynode; bNode dummy_node;
PointerRNA dummyptr; PointerRNA dummy_node_ptr;
FunctionRNA *func; FunctionRNA *func;
PropertyRNA *parm; PropertyRNA *parm;
int have_function[10]; int have_function[10];
/* setup dummy node & node type to store static properties in */ /* setup dummy node & node type to store static properties in */
memset(&dummynt, 0, sizeof(bNodeType)); memset(&dummy_nt, 0, sizeof(bNodeType));
/* this does some additional initialization of default values */ /* this does some additional initialization of default values */
node_type_base_custom(&dummynt, identifier, "", 0); node_type_base_custom(&dummy_nt, identifier, "", 0);
memset(&dummynode, 0, sizeof(bNode)); memset(&dummy_node, 0, sizeof(bNode));
dummynode.typeinfo = &dummynt; dummy_node.typeinfo = &dummy_nt;
RNA_pointer_create(NULL, basetype, &dummynode, &dummyptr); RNA_pointer_create(NULL, basetype, &dummy_node, &dummy_node_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummyptr, data, have_function) != 0) { if (validate(&dummy_node_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (strlen(identifier) >= sizeof(dummynt.idname)) { if (strlen(identifier) >= sizeof(dummy_nt.idname)) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s '%s' is too long, maximum length is %d", "%s '%s' is too long, maximum length is %d",
error_prefix, error_prefix,
identifier, identifier,
(int)sizeof(dummynt.idname)); (int)sizeof(dummy_nt.idname));
return NULL; return NULL;
} }
/* check if we have registered this node type before, and remove it */ /* check if we have registered this node type before, and remove it */
nt = nodeTypeFind(dummynt.idname); nt = nodeTypeFind(dummy_nt.idname);
if (nt) { if (nt) {
/* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for NULL. */ /* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for NULL. */
if (!rna_Node_unregister(bmain, nt->rna_ext.srna)) { if (!rna_Node_unregister(bmain, nt->rna_ext.srna)) {
@@ -1969,14 +1969,14 @@ static bNodeType *rna_Node_register_base(Main *bmain,
"%s '%s', bl_idname '%s' could not be unregistered", "%s '%s', bl_idname '%s' could not be unregistered",
error_prefix, error_prefix,
identifier, identifier,
dummynt.idname); dummy_nt.idname);
return NULL; return NULL;
} }
} }
/* create a new node type */ /* create a new node type */
nt = MEM_mallocN(sizeof(bNodeType), "node type"); nt = MEM_mallocN(sizeof(bNodeType), "node type");
memcpy(nt, &dummynt, sizeof(dummynt)); memcpy(nt, &dummy_nt, sizeof(dummy_nt));
nt->free_self = (void (*)(bNodeType *))MEM_freeN; nt->free_self = (void (*)(bNodeType *))MEM_freeN;
nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, basetype); nt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, basetype);
@@ -2774,39 +2774,39 @@ static StructRNA *rna_NodeSocket_register(Main *UNUSED(bmain),
StructCallbackFunc call, StructCallbackFunc call,
StructFreeFunc free) StructFreeFunc free)
{ {
bNodeSocketType *st, dummyst; bNodeSocketType *st, dummy_st;
bNodeSocket dummysock; bNodeSocket dummy_sock;
PointerRNA dummyptr; PointerRNA dummy_sock_ptr;
int have_function[2]; int have_function[2];
/* setup dummy socket & socket type to store static properties in */ /* setup dummy socket & socket type to store static properties in */
memset(&dummyst, 0, sizeof(bNodeSocketType)); memset(&dummy_st, 0, sizeof(bNodeSocketType));
dummyst.type = SOCK_CUSTOM; dummy_st.type = SOCK_CUSTOM;
memset(&dummysock, 0, sizeof(bNodeSocket)); memset(&dummy_sock, 0, sizeof(bNodeSocket));
dummysock.typeinfo = &dummyst; dummy_sock.typeinfo = &dummy_st;
RNA_pointer_create(NULL, &RNA_NodeSocket, &dummysock, &dummyptr); RNA_pointer_create(NULL, &RNA_NodeSocket, &dummy_sock, &dummy_sock_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummyptr, data, have_function) != 0) { if (validate(&dummy_sock_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (strlen(identifier) >= sizeof(dummyst.idname)) { if (strlen(identifier) >= sizeof(dummy_st.idname)) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"Registering node socket class: '%s' is too long, maximum length is %d", "Registering node socket class: '%s' is too long, maximum length is %d",
identifier, identifier,
(int)sizeof(dummyst.idname)); (int)sizeof(dummy_st.idname));
return NULL; return NULL;
} }
/* check if we have registered this socket type before */ /* check if we have registered this socket type before */
st = nodeSocketTypeFind(dummyst.idname); st = nodeSocketTypeFind(dummy_st.idname);
if (!st) { if (!st) {
/* create a new node socket type */ /* create a new node socket type */
st = MEM_mallocN(sizeof(bNodeSocketType), "node socket type"); st = MEM_mallocN(sizeof(bNodeSocketType), "node socket type");
memcpy(st, &dummyst, sizeof(dummyst)); memcpy(st, &dummy_st, sizeof(dummy_st));
nodeRegisterSocketType(st); nodeRegisterSocketType(st);
} }
@@ -3067,32 +3067,32 @@ static StructRNA *rna_NodeSocketInterface_register(Main *UNUSED(bmain),
StructCallbackFunc call, StructCallbackFunc call,
StructFreeFunc free) StructFreeFunc free)
{ {
bNodeSocketType *st, dummyst; bNodeSocketType *st, dummy_st;
bNodeSocket dummysock; bNodeSocket dummy_sock;
PointerRNA dummyptr; PointerRNA dummy_sock_ptr;
int have_function[4]; int have_function[4];
/* setup dummy socket & socket type to store static properties in */ /* setup dummy socket & socket type to store static properties in */
memset(&dummyst, 0, sizeof(bNodeSocketType)); memset(&dummy_st, 0, sizeof(bNodeSocketType));
memset(&dummysock, 0, sizeof(bNodeSocket)); memset(&dummy_sock, 0, sizeof(bNodeSocket));
dummysock.typeinfo = &dummyst; dummy_sock.typeinfo = &dummy_st;
RNA_pointer_create(NULL, &RNA_NodeSocketInterface, &dummysock, &dummyptr); RNA_pointer_create(NULL, &RNA_NodeSocketInterface, &dummy_sock, &dummy_sock_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummyptr, data, have_function) != 0) { if (validate(&dummy_sock_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
/* check if we have registered this socket type before */ /* check if we have registered this socket type before */
st = nodeSocketTypeFind(dummyst.idname); st = nodeSocketTypeFind(dummy_st.idname);
if (st) { if (st) {
/* basic socket type registered by a socket class before. */ /* basic socket type registered by a socket class before. */
} }
else { else {
/* create a new node socket type */ /* create a new node socket type */
st = MEM_mallocN(sizeof(bNodeSocketType), "node socket type"); st = MEM_mallocN(sizeof(bNodeSocketType), "node socket type");
memcpy(st, &dummyst, sizeof(dummyst)); memcpy(st, &dummy_st, sizeof(dummy_st));
nodeRegisterSocketType(st); nodeRegisterSocketType(st);
} }

View File

@@ -334,33 +334,33 @@ static StructRNA *rna_RenderEngine_register(Main *bmain,
StructFreeFunc free) StructFreeFunc free)
{ {
const char *error_prefix = "Registering render engine class:"; const char *error_prefix = "Registering render engine class:";
RenderEngineType *et, dummyet = {NULL}; RenderEngineType *et, dummy_et = {NULL};
RenderEngine dummyengine = {NULL}; RenderEngine dummy_engine = {NULL};
PointerRNA dummyptr; PointerRNA dummy_engine_ptr;
int have_function[9]; int have_function[9];
/* setup dummy engine & engine type to store static properties in */ /* setup dummy engine & engine type to store static properties in */
dummyengine.type = &dummyet; dummy_engine.type = &dummy_et;
dummyet.flag |= RE_USE_SHADING_NODES_CUSTOM; dummy_et.flag |= RE_USE_SHADING_NODES_CUSTOM;
RNA_pointer_create(NULL, &RNA_RenderEngine, &dummyengine, &dummyptr); RNA_pointer_create(NULL, &RNA_RenderEngine, &dummy_engine, &dummy_engine_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummyptr, data, have_function) != 0) { if (validate(&dummy_engine_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (strlen(identifier) >= sizeof(dummyet.idname)) { if (strlen(identifier) >= sizeof(dummy_et.idname)) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s '%s' is too long, maximum length is %d", "%s '%s' is too long, maximum length is %d",
error_prefix, error_prefix,
identifier, identifier,
(int)sizeof(dummyet.idname)); (int)sizeof(dummy_et.idname));
return NULL; return NULL;
} }
/* Check if we have registered this engine type before, and remove it. */ /* Check if we have registered this engine type before, and remove it. */
et = BLI_findstring(&R_engines, dummyet.idname, offsetof(RenderEngineType, idname)); et = BLI_findstring(&R_engines, dummy_et.idname, offsetof(RenderEngineType, idname));
if (et) { if (et) {
StructRNA *srna = et->rna_ext.srna; StructRNA *srna = et->rna_ext.srna;
if (!(srna && rna_RenderEngine_unregister(bmain, srna))) { if (!(srna && rna_RenderEngine_unregister(bmain, srna))) {
@@ -369,7 +369,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain,
"%s '%s', bl_idname '%s' %s", "%s '%s', bl_idname '%s' %s",
error_prefix, error_prefix,
identifier, identifier,
dummyet.idname, dummy_et.idname,
srna ? "is built-in" : "could not be unregistered"); srna ? "is built-in" : "could not be unregistered");
return NULL; return NULL;
} }
@@ -377,7 +377,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain,
/* create a new engine type */ /* create a new engine type */
et = MEM_mallocN(sizeof(RenderEngineType), "python render engine"); et = MEM_mallocN(sizeof(RenderEngineType), "python render engine");
memcpy(et, &dummyet, sizeof(dummyet)); memcpy(et, &dummy_et, sizeof(dummy_et));
et->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, et->idname, &RNA_RenderEngine); et->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, et->idname, &RNA_RenderEngine);
et->rna_ext.data = data; et->rna_ext.data = data;

View File

@@ -245,68 +245,68 @@ static StructRNA *rna_Panel_register(Main *bmain,
{ {
const char *error_prefix = "Registering panel class:"; const char *error_prefix = "Registering panel class:";
ARegionType *art; ARegionType *art;
PanelType *pt, *parent = NULL, dummypt = {NULL}; PanelType *pt, *parent = NULL, dummy_pt = {NULL};
Panel dummypanel = {NULL}; Panel dummy_panel = {NULL};
PointerRNA dummyptr; PointerRNA dummy_panel_ptr;
int have_function[4]; int have_function[4];
size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */ size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */
char _panel_descr[RNA_DYN_DESCR_MAX]; char _panel_descr[RNA_DYN_DESCR_MAX];
size_t description_size = 0; size_t description_size = 0;
/* setup dummy panel & panel type to store static properties in */ /* setup dummy panel & panel type to store static properties in */
dummypanel.type = &dummypt; dummy_panel.type = &dummy_pt;
_panel_descr[0] = '\0'; _panel_descr[0] = '\0';
dummypanel.type->description = _panel_descr; dummy_panel.type->description = _panel_descr;
RNA_pointer_create(NULL, &RNA_Panel, &dummypanel, &dummyptr); RNA_pointer_create(NULL, &RNA_Panel, &dummy_panel, &dummy_panel_ptr);
/* We have to set default context! Else we get a void string... */ /* We have to set default context! Else we get a void string... */
strcpy(dummypt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); strcpy(dummy_pt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
/* validate the python class */ /* validate the python class */
if (validate(&dummyptr, data, have_function) != 0) { if (validate(&dummy_panel_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (strlen(identifier) >= sizeof(dummypt.idname)) { if (strlen(identifier) >= sizeof(dummy_pt.idname)) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s '%s' is too long, maximum length is %d", "%s '%s' is too long, maximum length is %d",
error_prefix, error_prefix,
identifier, identifier,
(int)sizeof(dummypt.idname)); (int)sizeof(dummy_pt.idname));
return NULL; return NULL;
} }
if ((1 << dummypt.region_type) & RGN_TYPE_HAS_CATEGORY_MASK) { if ((1 << dummy_pt.region_type) & RGN_TYPE_HAS_CATEGORY_MASK) {
if (dummypt.category[0] == '\0') { if (dummy_pt.category[0] == '\0') {
/* Use a fallback, otherwise an empty value will draw the panel in every category. */ /* Use a fallback, otherwise an empty value will draw the panel in every category. */
strcpy(dummypt.category, PNL_CATEGORY_FALLBACK); strcpy(dummy_pt.category, PNL_CATEGORY_FALLBACK);
# ifndef NDEBUG # ifndef NDEBUG
printf("%s '%s' misses category, please update the script\n", error_prefix, dummypt.idname); printf("%s '%s' misses category, please update the script\n", error_prefix, dummy_pt.idname);
# endif # endif
} }
} }
else { else {
if (dummypt.category[0] != '\0') { if (dummy_pt.category[0] != '\0') {
if ((1 << dummypt.space_type) & WM_TOOLSYSTEM_SPACE_MASK) { if ((1 << dummy_pt.space_type) & WM_TOOLSYSTEM_SPACE_MASK) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s '%s' has category '%s' ", "%s '%s' has category '%s' ",
error_prefix, error_prefix,
dummypt.idname, dummy_pt.idname,
dummypt.category); dummy_pt.category);
return NULL; return NULL;
} }
} }
} }
if (!(art = region_type_find(reports, dummypt.space_type, dummypt.region_type))) { if (!(art = region_type_find(reports, dummy_pt.space_type, dummy_pt.region_type))) {
return NULL; return NULL;
} }
/* check if we have registered this panel type before, and remove it */ /* check if we have registered this panel type before, and remove it */
for (pt = art->paneltypes.first; pt; pt = pt->next) { for (pt = art->paneltypes.first; pt; pt = pt->next) {
if (STREQ(pt->idname, dummypt.idname)) { if (STREQ(pt->idname, dummy_pt.idname)) {
PanelType *pt_next = pt->next; PanelType *pt_next = pt->next;
StructRNA *srna = pt->rna_ext.srna; StructRNA *srna = pt->rna_ext.srna;
if (srna) { if (srna) {
@@ -316,7 +316,7 @@ static StructRNA *rna_Panel_register(Main *bmain,
"%s '%s', bl_idname '%s' could not be unregistered", "%s '%s', bl_idname '%s' could not be unregistered",
error_prefix, error_prefix,
identifier, identifier,
dummypt.idname); dummy_pt.idname);
} }
} }
else { else {
@@ -324,9 +324,9 @@ static StructRNA *rna_Panel_register(Main *bmain,
} }
/* The order of panel types will be altered on re-registration. */ /* The order of panel types will be altered on re-registration. */
if (dummypt.parent_id[0] && (parent == NULL)) { if (dummy_pt.parent_id[0] && (parent == NULL)) {
for (pt = pt_next; pt; pt = pt->next) { for (pt = pt_next; pt; pt = pt->next) {
if (STREQ(pt->idname, dummypt.parent_id)) { if (STREQ(pt->idname, dummy_pt.parent_id)) {
parent = pt; parent = pt;
break; break;
} }
@@ -336,24 +336,24 @@ static StructRNA *rna_Panel_register(Main *bmain,
break; break;
} }
if (dummypt.parent_id[0] && STREQ(pt->idname, dummypt.parent_id)) { if (dummy_pt.parent_id[0] && STREQ(pt->idname, dummy_pt.parent_id)) {
parent = pt; parent = pt;
} }
} }
if (!RNA_struct_available_or_report(reports, dummypt.idname)) { if (!RNA_struct_available_or_report(reports, dummy_pt.idname)) {
return NULL; return NULL;
} }
if (!RNA_struct_bl_idname_ok_or_report(reports, dummypt.idname, "_PT_")) { if (!RNA_struct_bl_idname_ok_or_report(reports, dummy_pt.idname, "_PT_")) {
return NULL; return NULL;
} }
if (dummypt.parent_id[0] && !parent) { if (dummy_pt.parent_id[0] && !parent) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s parent '%s' for '%s' not found", "%s parent '%s' for '%s' not found",
error_prefix, error_prefix,
dummypt.parent_id, dummy_pt.parent_id,
dummypt.idname); dummy_pt.idname);
return NULL; return NULL;
} }
@@ -363,7 +363,7 @@ static StructRNA *rna_Panel_register(Main *bmain,
over_alloc += description_size; over_alloc += description_size;
} }
pt = MEM_callocN(sizeof(PanelType) + over_alloc, "python buttons panel"); pt = MEM_callocN(sizeof(PanelType) + over_alloc, "python buttons panel");
memcpy(pt, &dummypt, sizeof(dummypt)); memcpy(pt, &dummy_pt, sizeof(dummy_pt));
if (_panel_descr[0]) { if (_panel_descr[0]) {
char *buf = (char *)(pt + 1); char *buf = (char *)(pt + 1);
@@ -686,33 +686,33 @@ static StructRNA *rna_UIList_register(Main *bmain,
StructFreeFunc free) StructFreeFunc free)
{ {
const char *error_prefix = "Registering uilist class:"; const char *error_prefix = "Registering uilist class:";
uiListType *ult, dummyult = {NULL}; uiListType *ult, dummy_ult = {NULL};
uiList dummyuilist = {NULL}; uiList dummy_uilist = {NULL};
PointerRNA dummyul_ptr; PointerRNA dummy_ul_ptr;
int have_function[3]; int have_function[3];
size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */ size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */
/* setup dummy menu & menu type to store static properties in */ /* setup dummy menu & menu type to store static properties in */
dummyuilist.type = &dummyult; dummy_uilist.type = &dummy_ult;
RNA_pointer_create(NULL, &RNA_UIList, &dummyuilist, &dummyul_ptr); RNA_pointer_create(NULL, &RNA_UIList, &dummy_uilist, &dummy_ul_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummyul_ptr, data, have_function) != 0) { if (validate(&dummy_ul_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (strlen(identifier) >= sizeof(dummyult.idname)) { if (strlen(identifier) >= sizeof(dummy_ult.idname)) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s '%s' is too long, maximum length is %d", "%s '%s' is too long, maximum length is %d",
error_prefix, error_prefix,
identifier, identifier,
(int)sizeof(dummyult.idname)); (int)sizeof(dummy_ult.idname));
return NULL; return NULL;
} }
/* Check if we have registered this UI-list type before, and remove it. */ /* Check if we have registered this UI-list type before, and remove it. */
ult = WM_uilisttype_find(dummyult.idname, true); ult = WM_uilisttype_find(dummy_ult.idname, true);
if (ult) { if (ult) {
StructRNA *srna = ult->rna_ext.srna; StructRNA *srna = ult->rna_ext.srna;
if (!(srna && rna_UIList_unregister(bmain, srna))) { if (!(srna && rna_UIList_unregister(bmain, srna))) {
@@ -721,21 +721,21 @@ static StructRNA *rna_UIList_register(Main *bmain,
"%s '%s', bl_idname '%s' %s", "%s '%s', bl_idname '%s' %s",
error_prefix, error_prefix,
identifier, identifier,
dummyult.idname, dummy_ult.idname,
srna ? "is built-in" : "could not be unregistered"); srna ? "is built-in" : "could not be unregistered");
return NULL; return NULL;
} }
} }
if (!RNA_struct_available_or_report(reports, dummyult.idname)) { if (!RNA_struct_available_or_report(reports, dummy_ult.idname)) {
return NULL; return NULL;
} }
if (!RNA_struct_bl_idname_ok_or_report(reports, dummyult.idname, "_UL_")) { if (!RNA_struct_bl_idname_ok_or_report(reports, dummy_ult.idname, "_UL_")) {
return NULL; return NULL;
} }
/* create a new menu type */ /* create a new menu type */
ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist"); ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist");
memcpy(ult, &dummyult, sizeof(dummyult)); memcpy(ult, &dummy_ult, sizeof(dummy_ult));
ult->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ult->idname, &RNA_UIList); ult->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ult->idname, &RNA_UIList);
ult->rna_ext.data = data; ult->rna_ext.data = data;
@@ -814,37 +814,37 @@ static StructRNA *rna_Header_register(Main *bmain,
{ {
const char *error_prefix = "Registering header class:"; const char *error_prefix = "Registering header class:";
ARegionType *art; ARegionType *art;
HeaderType *ht, dummyht = {NULL}; HeaderType *ht, dummy_ht = {NULL};
Header dummyheader = {NULL}; Header dummy_header = {NULL};
PointerRNA dummyhtr; PointerRNA dummy_header_ptr;
int have_function[1]; int have_function[1];
/* setup dummy header & header type to store static properties in */ /* setup dummy header & header type to store static properties in */
dummyheader.type = &dummyht; dummy_header.type = &dummy_ht;
dummyht.region_type = RGN_TYPE_HEADER; /* RGN_TYPE_HEADER by default, may be overridden */ dummy_ht.region_type = RGN_TYPE_HEADER; /* RGN_TYPE_HEADER by default, may be overridden */
RNA_pointer_create(NULL, &RNA_Header, &dummyheader, &dummyhtr); RNA_pointer_create(NULL, &RNA_Header, &dummy_header, &dummy_header_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummyhtr, data, have_function) != 0) { if (validate(&dummy_header_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (strlen(identifier) >= sizeof(dummyht.idname)) { if (strlen(identifier) >= sizeof(dummy_ht.idname)) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s '%s' is too long, maximum length is %d", "%s '%s' is too long, maximum length is %d",
error_prefix, error_prefix,
identifier, identifier,
(int)sizeof(dummyht.idname)); (int)sizeof(dummy_ht.idname));
return NULL; return NULL;
} }
if (!(art = region_type_find(reports, dummyht.space_type, dummyht.region_type))) { if (!(art = region_type_find(reports, dummy_ht.space_type, dummy_ht.region_type))) {
return NULL; return NULL;
} }
/* check if we have registered this header type before, and remove it */ /* check if we have registered this header type before, and remove it */
ht = BLI_findstring(&art->headertypes, dummyht.idname, offsetof(HeaderType, idname)); ht = BLI_findstring(&art->headertypes, dummy_ht.idname, offsetof(HeaderType, idname));
if (ht) { if (ht) {
StructRNA *srna = ht->rna_ext.srna; StructRNA *srna = ht->rna_ext.srna;
if (!(srna && rna_Header_unregister(bmain, srna))) { if (!(srna && rna_Header_unregister(bmain, srna))) {
@@ -853,22 +853,22 @@ static StructRNA *rna_Header_register(Main *bmain,
"%s '%s', bl_idname '%s' %s", "%s '%s', bl_idname '%s' %s",
error_prefix, error_prefix,
identifier, identifier,
dummyht.idname, dummy_ht.idname,
srna ? "is built-in" : "could not be unregistered"); srna ? "is built-in" : "could not be unregistered");
return NULL; return NULL;
} }
} }
if (!RNA_struct_available_or_report(reports, dummyht.idname)) { if (!RNA_struct_available_or_report(reports, dummy_ht.idname)) {
return NULL; return NULL;
} }
if (!RNA_struct_bl_idname_ok_or_report(reports, dummyht.idname, "_HT_")) { if (!RNA_struct_bl_idname_ok_or_report(reports, dummy_ht.idname, "_HT_")) {
return NULL; return NULL;
} }
/* create a new header type */ /* create a new header type */
ht = MEM_mallocN(sizeof(HeaderType), "python buttons header"); ht = MEM_mallocN(sizeof(HeaderType), "python buttons header");
memcpy(ht, &dummyht, sizeof(dummyht)); memcpy(ht, &dummy_ht, sizeof(dummy_ht));
ht->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ht->idname, &RNA_Header); ht->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ht->idname, &RNA_Header);
ht->rna_ext.data = data; ht->rna_ext.data = data;
@@ -964,40 +964,40 @@ static StructRNA *rna_Menu_register(Main *bmain,
StructFreeFunc free) StructFreeFunc free)
{ {
const char *error_prefix = "Registering menu class:"; const char *error_prefix = "Registering menu class:";
MenuType *mt, dummymt = {NULL}; MenuType *mt, dummy_mt = {NULL};
Menu dummymenu = {NULL}; Menu dummy_menu = {NULL};
PointerRNA dummymtr; PointerRNA dummy_menu_ptr;
int have_function[2]; int have_function[2];
size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */ size_t over_alloc = 0; /* Warning, if this becomes a mess, we better do another allocation. */
size_t description_size = 0; size_t description_size = 0;
char _menu_descr[RNA_DYN_DESCR_MAX]; char _menu_descr[RNA_DYN_DESCR_MAX];
/* setup dummy menu & menu type to store static properties in */ /* setup dummy menu & menu type to store static properties in */
dummymenu.type = &dummymt; dummy_menu.type = &dummy_mt;
_menu_descr[0] = '\0'; _menu_descr[0] = '\0';
dummymenu.type->description = _menu_descr; dummy_menu.type->description = _menu_descr;
RNA_pointer_create(NULL, &RNA_Menu, &dummymenu, &dummymtr); RNA_pointer_create(NULL, &RNA_Menu, &dummy_menu, &dummy_menu_ptr);
/* We have to set default context! Else we get a void string... */ /* We have to set default context! Else we get a void string... */
strcpy(dummymt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); strcpy(dummy_mt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
/* validate the python class */ /* validate the python class */
if (validate(&dummymtr, data, have_function) != 0) { if (validate(&dummy_menu_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (strlen(identifier) >= sizeof(dummymt.idname)) { if (strlen(identifier) >= sizeof(dummy_mt.idname)) {
BKE_reportf(reports, BKE_reportf(reports,
RPT_ERROR, RPT_ERROR,
"%s '%s' is too long, maximum length is %d", "%s '%s' is too long, maximum length is %d",
error_prefix, error_prefix,
identifier, identifier,
(int)sizeof(dummymt.idname)); (int)sizeof(dummy_mt.idname));
return NULL; return NULL;
} }
/* check if we have registered this menu type before, and remove it */ /* check if we have registered this menu type before, and remove it */
mt = WM_menutype_find(dummymt.idname, true); mt = WM_menutype_find(dummy_mt.idname, true);
if (mt) { if (mt) {
StructRNA *srna = mt->rna_ext.srna; StructRNA *srna = mt->rna_ext.srna;
if (!(srna && rna_Menu_unregister(bmain, srna))) { if (!(srna && rna_Menu_unregister(bmain, srna))) {
@@ -1006,15 +1006,15 @@ static StructRNA *rna_Menu_register(Main *bmain,
"%s '%s', bl_idname '%s' %s", "%s '%s', bl_idname '%s' %s",
error_prefix, error_prefix,
identifier, identifier,
dummymt.idname, dummy_mt.idname,
srna ? "is built-in" : "could not be unregistered"); srna ? "is built-in" : "could not be unregistered");
return NULL; return NULL;
} }
} }
if (!RNA_struct_available_or_report(reports, dummymt.idname)) { if (!RNA_struct_available_or_report(reports, dummy_mt.idname)) {
return NULL; return NULL;
} }
if (!RNA_struct_bl_idname_ok_or_report(reports, dummymt.idname, "_MT_")) { if (!RNA_struct_bl_idname_ok_or_report(reports, dummy_mt.idname, "_MT_")) {
return NULL; return NULL;
} }
@@ -1025,7 +1025,7 @@ static StructRNA *rna_Menu_register(Main *bmain,
} }
mt = MEM_callocN(sizeof(MenuType) + over_alloc, "python buttons menu"); mt = MEM_callocN(sizeof(MenuType) + over_alloc, "python buttons menu");
memcpy(mt, &dummymt, sizeof(dummymt)); memcpy(mt, &dummy_mt, sizeof(dummy_mt));
if (_menu_descr[0]) { if (_menu_descr[0]) {
char *buf = (char *)(mt + 1); char *buf = (char *)(mt + 1);

View File

@@ -821,14 +821,14 @@ static StructRNA *rna_AddonPref_register(Main *bmain,
const char *error_prefix = "Registering add-on preferences class:"; const char *error_prefix = "Registering add-on preferences class:";
bAddonPrefType *apt, dummy_apt = {{'\0'}}; bAddonPrefType *apt, dummy_apt = {{'\0'}};
bAddon dummy_addon = {NULL}; bAddon dummy_addon = {NULL};
PointerRNA dummy_ptr; PointerRNA dummy_addon_ptr;
// int have_function[1]; // int have_function[1];
/* Setup dummy add-on preference and it's type to store static properties in. */ /* Setup dummy add-on preference and it's type to store static properties in. */
RNA_pointer_create(NULL, &RNA_AddonPreferences, &dummy_addon, &dummy_ptr); RNA_pointer_create(NULL, &RNA_AddonPreferences, &dummy_addon, &dummy_addon_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummy_ptr, data, NULL /* have_function */) != 0) { if (validate(&dummy_addon_ptr, data, NULL /* have_function */) != 0) {
return NULL; return NULL;
} }

View File

@@ -1141,14 +1141,14 @@ static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
const char *error_prefix = "Registering key-config preferences class:"; const char *error_prefix = "Registering key-config preferences class:";
wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}}; wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}};
wmKeyConfigPref dummy_kpt = {NULL}; wmKeyConfigPref dummy_kpt = {NULL};
PointerRNA dummy_ptr; PointerRNA dummy_kpt_ptr;
// int have_function[1]; // int have_function[1];
/* setup dummy keyconf-prefs & keyconf-prefs type to store static properties in */ /* setup dummy keyconf-prefs & keyconf-prefs type to store static properties in */
RNA_pointer_create(NULL, &RNA_KeyConfigPreferences, &dummy_kpt, &dummy_ptr); RNA_pointer_create(NULL, &RNA_KeyConfigPreferences, &dummy_kpt, &dummy_kpt_ptr);
/* validate the python class */ /* validate the python class */
if (validate(&dummy_ptr, data, NULL /* have_function */) != 0) { if (validate(&dummy_kpt_ptr, data, NULL /* have_function */) != 0) {
return NULL; return NULL;
} }
@@ -1485,9 +1485,9 @@ static StructRNA *rna_Operator_register(Main *bmain,
StructFreeFunc free) StructFreeFunc free)
{ {
const char *error_prefix = "Registering operator class:"; const char *error_prefix = "Registering operator class:";
wmOperatorType dummyot = {NULL}; wmOperatorType dummy_ot = {NULL};
wmOperator dummyop = {NULL}; wmOperator dummy_operator = {NULL};
PointerRNA dummyotr; PointerRNA dummy_operator_ptr;
int have_function[8]; int have_function[8];
struct { struct {
@@ -1499,27 +1499,27 @@ static StructRNA *rna_Operator_register(Main *bmain,
} temp_buffers; } temp_buffers;
/* setup dummy operator & operator type to store static properties in */ /* setup dummy operator & operator type to store static properties in */
dummyop.type = &dummyot; dummy_operator.type = &dummy_ot;
dummyot.idname = temp_buffers.idname; /* only assign the pointer, string is NULL'd */ dummy_ot.idname = temp_buffers.idname; /* only assign the pointer, string is NULL'd */
dummyot.name = temp_buffers.name; /* only assign the pointer, string is NULL'd */ dummy_ot.name = temp_buffers.name; /* only assign the pointer, string is NULL'd */
dummyot.description = temp_buffers.description; /* only assign the pointer, string is NULL'd */ dummy_ot.description = temp_buffers.description; /* only assign the pointer, string is NULL'd */
dummyot.translation_context = dummy_ot.translation_context =
temp_buffers.translation_context; /* only assign the pointer, string is NULL'd */ temp_buffers.translation_context; /* only assign the pointer, string is NULL'd */
dummyot.undo_group = temp_buffers.undo_group; /* only assign the pointer, string is NULL'd */ dummy_ot.undo_group = temp_buffers.undo_group; /* only assign the pointer, string is NULL'd */
RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr); RNA_pointer_create(NULL, &RNA_Operator, &dummy_operator, &dummy_operator_ptr);
/* clear in case they are left unset */ /* clear in case they are left unset */
temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] = temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0'; temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0';
/* validate the python class */ /* validate the python class */
if (validate(&dummyotr, data, have_function) != 0) { if (validate(&dummy_operator_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
/* check if we have registered this operator type before, and remove it */ /* check if we have registered this operator type before, and remove it */
{ {
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true); wmOperatorType *ot = WM_operatortype_find(dummy_ot.idname, true);
if (ot) { if (ot) {
StructRNA *srna = ot->rna_ext.srna; StructRNA *srna = ot->rna_ext.srna;
if (!(srna && rna_Operator_unregister(bmain, srna))) { if (!(srna && rna_Operator_unregister(bmain, srna))) {
@@ -1528,19 +1528,19 @@ static StructRNA *rna_Operator_register(Main *bmain,
"%s '%s', bl_idname '%s' %s", "%s '%s', bl_idname '%s' %s",
error_prefix, error_prefix,
identifier, identifier,
dummyot.idname, dummy_ot.idname,
srna ? "is built-in" : "could not be unregistered"); srna ? "is built-in" : "could not be unregistered");
return NULL; return NULL;
} }
} }
} }
if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) { if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummy_ot.idname)) {
return NULL; return NULL;
} }
char idname_conv[sizeof(dummyop.idname)]; char idname_conv[sizeof(dummy_operator.idname)];
WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */ WM_operator_bl_idname(idname_conv, dummy_ot.idname); /* convert the idname from python */
if (!RNA_struct_available_or_report(reports, idname_conv)) { if (!RNA_struct_available_or_report(reports, idname_conv)) {
return NULL; return NULL;
@@ -1565,11 +1565,11 @@ static StructRNA *rna_Operator_register(Main *bmain,
BLI_string_join_array_by_sep_char_with_tableN( BLI_string_join_array_by_sep_char_with_tableN(
'\0', strings_table, strings, ARRAY_SIZE(strings)); '\0', strings_table, strings, ARRAY_SIZE(strings));
dummyot.idname = strings_table[0]; /* allocated string stored here */ dummy_ot.idname = strings_table[0]; /* allocated string stored here */
dummyot.name = strings_table[1]; dummy_ot.name = strings_table[1];
dummyot.description = *strings_table[2] ? strings_table[2] : NULL; dummy_ot.description = *strings_table[2] ? strings_table[2] : NULL;
dummyot.translation_context = strings_table[3]; dummy_ot.translation_context = strings_table[3];
dummyot.undo_group = strings_table[4]; dummy_ot.undo_group = strings_table[4];
BLI_assert(ARRAY_SIZE(strings) == 5); BLI_assert(ARRAY_SIZE(strings) == 5);
} }
@@ -1577,31 +1577,31 @@ static StructRNA *rna_Operator_register(Main *bmain,
* for now just remove from dir(bpy.types) */ * for now just remove from dir(bpy.types) */
/* create a new operator type */ /* create a new operator type */
dummyot.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator); dummy_ot.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummy_ot.idname, &RNA_Operator);
/* Operator properties are registered separately. */ /* Operator properties are registered separately. */
RNA_def_struct_flag(dummyot.rna_ext.srna, STRUCT_NO_IDPROPERTIES); RNA_def_struct_flag(dummy_ot.rna_ext.srna, STRUCT_NO_IDPROPERTIES);
RNA_def_struct_property_tags(dummyot.rna_ext.srna, rna_enum_operator_property_tags); RNA_def_struct_property_tags(dummy_ot.rna_ext.srna, rna_enum_operator_property_tags);
RNA_def_struct_translation_context(dummyot.rna_ext.srna, dummyot.translation_context); RNA_def_struct_translation_context(dummy_ot.rna_ext.srna, dummy_ot.translation_context);
dummyot.rna_ext.data = data; dummy_ot.rna_ext.data = data;
dummyot.rna_ext.call = call; dummy_ot.rna_ext.call = call;
dummyot.rna_ext.free = free; dummy_ot.rna_ext.free = free;
dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL; dummy_ot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
dummyot.exec = (have_function[1]) ? rna_operator_execute_cb : NULL; dummy_ot.exec = (have_function[1]) ? rna_operator_execute_cb : NULL;
dummyot.check = (have_function[2]) ? rna_operator_check_cb : NULL; dummy_ot.check = (have_function[2]) ? rna_operator_check_cb : NULL;
dummyot.invoke = (have_function[3]) ? rna_operator_invoke_cb : NULL; dummy_ot.invoke = (have_function[3]) ? rna_operator_invoke_cb : NULL;
dummyot.modal = (have_function[4]) ? rna_operator_modal_cb : NULL; dummy_ot.modal = (have_function[4]) ? rna_operator_modal_cb : NULL;
dummyot.ui = (have_function[5]) ? rna_operator_draw_cb : NULL; dummy_ot.ui = (have_function[5]) ? rna_operator_draw_cb : NULL;
dummyot.cancel = (have_function[6]) ? rna_operator_cancel_cb : NULL; dummy_ot.cancel = (have_function[6]) ? rna_operator_cancel_cb : NULL;
dummyot.get_description = (have_function[7]) ? rna_operator_description_cb : NULL; dummy_ot.get_description = (have_function[7]) ? rna_operator_description_cb : NULL;
WM_operatortype_append_ptr(BPY_RNA_operator_wrapper, (void *)&dummyot); WM_operatortype_append_ptr(BPY_RNA_operator_wrapper, (void *)&dummy_ot);
/* update while blender is running */ /* update while blender is running */
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
return dummyot.rna_ext.srna; return dummy_ot.rna_ext.srna;
} }
static bool rna_Operator_unregister(struct Main *bmain, StructRNA *type) static bool rna_Operator_unregister(struct Main *bmain, StructRNA *type)
@@ -1651,9 +1651,9 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
StructFreeFunc free) StructFreeFunc free)
{ {
const char *error_prefix = "Registering operator macro class:"; const char *error_prefix = "Registering operator macro class:";
wmOperatorType dummyot = {NULL}; wmOperatorType dummy_ot = {NULL};
wmOperator dummyop = {NULL}; wmOperator dummy_operator = {NULL};
PointerRNA dummyotr; PointerRNA dummy_operator_ptr;
int have_function[4]; int have_function[4];
struct { struct {
@@ -1665,31 +1665,31 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
} temp_buffers; } temp_buffers;
/* setup dummy operator & operator type to store static properties in */ /* setup dummy operator & operator type to store static properties in */
dummyop.type = &dummyot; dummy_operator.type = &dummy_ot;
dummyot.idname = temp_buffers.idname; /* only assign the pointer, string is NULL'd */ dummy_ot.idname = temp_buffers.idname; /* only assign the pointer, string is NULL'd */
dummyot.name = temp_buffers.name; /* only assign the pointer, string is NULL'd */ dummy_ot.name = temp_buffers.name; /* only assign the pointer, string is NULL'd */
dummyot.description = temp_buffers.description; /* only assign the pointer, string is NULL'd */ dummy_ot.description = temp_buffers.description; /* only assign the pointer, string is NULL'd */
dummyot.translation_context = dummy_ot.translation_context =
temp_buffers.translation_context; /* only assign the pointer, string is NULL'd */ temp_buffers.translation_context; /* only assign the pointer, string is NULL'd */
dummyot.undo_group = temp_buffers.undo_group; /* only assign the pointer, string is NULL'd */ dummy_ot.undo_group = temp_buffers.undo_group; /* only assign the pointer, string is NULL'd */
RNA_pointer_create(NULL, &RNA_Macro, &dummyop, &dummyotr); RNA_pointer_create(NULL, &RNA_Macro, &dummy_operator, &dummy_operator_ptr);
/* clear in case they are left unset */ /* clear in case they are left unset */
temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] = temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0'; temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0';
/* validate the python class */ /* validate the python class */
if (validate(&dummyotr, data, have_function) != 0) { if (validate(&dummy_operator_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) { if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummy_ot.idname)) {
return NULL; return NULL;
} }
/* check if we have registered this operator type before, and remove it */ /* check if we have registered this operator type before, and remove it */
{ {
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true); wmOperatorType *ot = WM_operatortype_find(dummy_ot.idname, true);
if (ot) { if (ot) {
StructRNA *srna = ot->rna_ext.srna; StructRNA *srna = ot->rna_ext.srna;
if (!(srna && rna_Operator_unregister(bmain, srna))) { if (!(srna && rna_Operator_unregister(bmain, srna))) {
@@ -1698,15 +1698,15 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
"%s '%s', bl_idname '%s' %s", "%s '%s', bl_idname '%s' %s",
error_prefix, error_prefix,
identifier, identifier,
dummyot.idname, dummy_ot.idname,
srna ? "is built-in" : "could not be unregistered"); srna ? "is built-in" : "could not be unregistered");
return NULL; return NULL;
} }
} }
} }
char idname_conv[sizeof(dummyop.idname)]; char idname_conv[sizeof(dummy_operator.idname)];
WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */ WM_operator_bl_idname(idname_conv, dummy_ot.idname); /* convert the idname from python */
if (!RNA_struct_available_or_report(reports, idname_conv)) { if (!RNA_struct_available_or_report(reports, idname_conv)) {
return NULL; return NULL;
@@ -1731,11 +1731,11 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
BLI_string_join_array_by_sep_char_with_tableN( BLI_string_join_array_by_sep_char_with_tableN(
'\0', strings_table, strings, ARRAY_SIZE(strings)); '\0', strings_table, strings, ARRAY_SIZE(strings));
dummyot.idname = strings_table[0]; /* allocated string stored here */ dummy_ot.idname = strings_table[0]; /* allocated string stored here */
dummyot.name = strings_table[1]; dummy_ot.name = strings_table[1];
dummyot.description = *strings_table[2] ? strings_table[2] : NULL; dummy_ot.description = *strings_table[2] ? strings_table[2] : NULL;
dummyot.translation_context = strings_table[3]; dummy_ot.translation_context = strings_table[3];
dummyot.undo_group = strings_table[4]; dummy_ot.undo_group = strings_table[4];
BLI_assert(ARRAY_SIZE(strings) == 5); BLI_assert(ARRAY_SIZE(strings) == 5);
} }
@@ -1743,21 +1743,21 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
* for now just remove from dir(bpy.types) */ * for now just remove from dir(bpy.types) */
/* create a new operator type */ /* create a new operator type */
dummyot.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator); dummy_ot.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummy_ot.idname, &RNA_Operator);
RNA_def_struct_translation_context(dummyot.rna_ext.srna, dummyot.translation_context); RNA_def_struct_translation_context(dummy_ot.rna_ext.srna, dummy_ot.translation_context);
dummyot.rna_ext.data = data; dummy_ot.rna_ext.data = data;
dummyot.rna_ext.call = call; dummy_ot.rna_ext.call = call;
dummyot.rna_ext.free = free; dummy_ot.rna_ext.free = free;
dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL; dummy_ot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
dummyot.ui = (have_function[3]) ? rna_operator_draw_cb : NULL; dummy_ot.ui = (have_function[3]) ? rna_operator_draw_cb : NULL;
WM_operatortype_append_macro_ptr(BPY_RNA_operator_macro_wrapper, (void *)&dummyot); WM_operatortype_append_macro_ptr(BPY_RNA_operator_macro_wrapper, (void *)&dummy_ot);
/* update while blender is running */ /* update while blender is running */
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
return dummyot.rna_ext.srna; return dummy_ot.rna_ext.srna;
} }
# endif /* WITH_PYTHON */ # endif /* WITH_PYTHON */

View File

@@ -431,23 +431,23 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
char idname[MAX_NAME]; char idname[MAX_NAME];
} temp_buffers; } temp_buffers;
wmGizmoType dummygt = {NULL}; wmGizmoType dummy_gt = {NULL};
wmGizmo dummymnp = {NULL}; wmGizmo dummy_gizmo = {NULL};
PointerRNA mnp_ptr; PointerRNA dummy_gizmo_ptr;
/* Two sets of functions. */ /* Two sets of functions. */
int have_function[8]; int have_function[8];
/* setup dummy gizmo & gizmo type to store static properties in */ /* setup dummy gizmo & gizmo type to store static properties in */
dummymnp.type = &dummygt; dummy_gizmo.type = &dummy_gt;
dummygt.idname = temp_buffers.idname; dummy_gt.idname = temp_buffers.idname;
RNA_pointer_create(NULL, &RNA_Gizmo, &dummymnp, &mnp_ptr); RNA_pointer_create(NULL, &RNA_Gizmo, &dummy_gizmo, &dummy_gizmo_ptr);
/* Clear so we can detect if it's left unset. */ /* Clear so we can detect if it's left unset. */
temp_buffers.idname[0] = '\0'; temp_buffers.idname[0] = '\0';
/* validate the python class */ /* validate the python class */
if (validate(&mnp_ptr, data, have_function) != 0) { if (validate(&dummy_gizmo_ptr, data, have_function) != 0) {
return NULL; return NULL;
} }
@@ -463,7 +463,7 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
/* check if we have registered this gizmo type before, and remove it */ /* check if we have registered this gizmo type before, and remove it */
{ {
const wmGizmoType *gzt = WM_gizmotype_find(dummygt.idname, true); const wmGizmoType *gzt = WM_gizmotype_find(dummy_gt.idname, true);
if (gzt) { if (gzt) {
StructRNA *srna = gzt->rna_ext.srna; StructRNA *srna = gzt->rna_ext.srna;
if (!(srna && rna_Gizmo_unregister(bmain, srna))) { if (!(srna && rna_Gizmo_unregister(bmain, srna))) {
@@ -472,51 +472,51 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
"%s '%s', bl_idname '%s' %s", "%s '%s', bl_idname '%s' %s",
error_prefix, error_prefix,
identifier, identifier,
dummygt.idname, dummy_gt.idname,
srna ? "is built-in" : "could not be unregistered"); srna ? "is built-in" : "could not be unregistered");
return NULL; return NULL;
} }
} }
} }
if (!RNA_struct_available_or_report(reports, dummygt.idname)) { if (!RNA_struct_available_or_report(reports, dummy_gt.idname)) {
return NULL; return NULL;
} }
{ /* allocate the idname */ { /* allocate the idname */
/* For multiple strings see GizmoGroup. */ /* For multiple strings see GizmoGroup. */
dummygt.idname = BLI_strdup(temp_buffers.idname); dummy_gt.idname = BLI_strdup(temp_buffers.idname);
} }
/* create a new gizmo type */ /* create a new gizmo type */
dummygt.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummygt.idname, &RNA_Gizmo); dummy_gt.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummy_gt.idname, &RNA_Gizmo);
/* gizmo properties are registered separately */ /* gizmo properties are registered separately */
RNA_def_struct_flag(dummygt.rna_ext.srna, STRUCT_NO_IDPROPERTIES); RNA_def_struct_flag(dummy_gt.rna_ext.srna, STRUCT_NO_IDPROPERTIES);
dummygt.rna_ext.data = data; dummy_gt.rna_ext.data = data;
dummygt.rna_ext.call = call; dummy_gt.rna_ext.call = call;
dummygt.rna_ext.free = free; dummy_gt.rna_ext.free = free;
{ {
int i = 0; int i = 0;
dummygt.draw = (have_function[i++]) ? rna_gizmo_draw_cb : NULL; dummy_gt.draw = (have_function[i++]) ? rna_gizmo_draw_cb : NULL;
dummygt.draw_select = (have_function[i++]) ? rna_gizmo_draw_select_cb : NULL; dummy_gt.draw_select = (have_function[i++]) ? rna_gizmo_draw_select_cb : NULL;
dummygt.test_select = (have_function[i++]) ? rna_gizmo_test_select_cb : NULL; dummy_gt.test_select = (have_function[i++]) ? rna_gizmo_test_select_cb : NULL;
dummygt.modal = (have_function[i++]) ? rna_gizmo_modal_cb : NULL; dummy_gt.modal = (have_function[i++]) ? rna_gizmo_modal_cb : NULL;
// dummygt.property_update = (have_function[i++]) ? rna_gizmo_property_update : NULL; // dummy_gt.property_update = (have_function[i++]) ? rna_gizmo_property_update : NULL;
// dummygt.position_get = (have_function[i++]) ? rna_gizmo_position_get : NULL; // dummy_gt.position_get = (have_function[i++]) ? rna_gizmo_position_get : NULL;
dummygt.setup = (have_function[i++]) ? rna_gizmo_setup_cb : NULL; dummy_gt.setup = (have_function[i++]) ? rna_gizmo_setup_cb : NULL;
dummygt.invoke = (have_function[i++]) ? rna_gizmo_invoke_cb : NULL; dummy_gt.invoke = (have_function[i++]) ? rna_gizmo_invoke_cb : NULL;
dummygt.exit = (have_function[i++]) ? rna_gizmo_exit_cb : NULL; dummy_gt.exit = (have_function[i++]) ? rna_gizmo_exit_cb : NULL;
dummygt.select_refresh = (have_function[i++]) ? rna_gizmo_select_refresh_cb : NULL; dummy_gt.select_refresh = (have_function[i++]) ? rna_gizmo_select_refresh_cb : NULL;
BLI_assert(i == ARRAY_SIZE(have_function)); BLI_assert(i == ARRAY_SIZE(have_function));
} }
WM_gizmotype_append_ptr(BPY_RNA_gizmo_wrapper, (void *)&dummygt); WM_gizmotype_append_ptr(BPY_RNA_gizmo_wrapper, (void *)&dummy_gt);
/* update while blender is running */ /* update while blender is running */
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
return dummygt.rna_ext.srna; return dummy_gt.rna_ext.srna;
} }
static bool rna_Gizmo_unregister(struct Main *bmain, StructRNA *type) static bool rna_Gizmo_unregister(struct Main *bmain, StructRNA *type)
@@ -548,9 +548,9 @@ static void **rna_Gizmo_instance(PointerRNA *ptr)
# endif /* WITH_PYTHON */ # endif /* WITH_PYTHON */
static StructRNA *rna_Gizmo_refine(PointerRNA *mnp_ptr) static StructRNA *rna_Gizmo_refine(PointerRNA *gz_ptr)
{ {
wmGizmo *gz = mnp_ptr->data; wmGizmo *gz = gz_ptr->data;
return (gz->type && gz->type->rna_ext.srna) ? gz->type->rna_ext.srna : &RNA_Gizmo; return (gz->type && gz->type->rna_ext.srna) ? gz->type->rna_ext.srna : &RNA_Gizmo;
} }
@@ -813,19 +813,19 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
char idname[MAX_NAME]; char idname[MAX_NAME];
} temp_buffers; } temp_buffers;
wmGizmoGroupType dummywgt = {NULL}; wmGizmoGroupType dummy_wgt = {NULL};
wmGizmoGroup dummywg = {NULL}; wmGizmoGroup dummy_gizmo_group = {NULL};
PointerRNA wgptr; PointerRNA wgptr;
/* Two sets of functions. */ /* Two sets of functions. */
int have_function[6]; int have_function[6];
/* setup dummy gizmogroup & gizmogroup type to store static properties in */ /* setup dummy gizmogroup & gizmogroup type to store static properties in */
dummywg.type = &dummywgt; dummy_gizmo_group.type = &dummy_wgt;
dummywgt.name = temp_buffers.name; dummy_wgt.name = temp_buffers.name;
dummywgt.idname = temp_buffers.idname; dummy_wgt.idname = temp_buffers.idname;
RNA_pointer_create(NULL, &RNA_GizmoGroup, &dummywg, &wgptr); RNA_pointer_create(NULL, &RNA_GizmoGroup, &dummy_gizmo_group, &wgptr);
/* Clear so we can detect if it's left unset. */ /* Clear so we can detect if it's left unset. */
temp_buffers.idname[0] = temp_buffers.name[0] = '\0'; temp_buffers.idname[0] = temp_buffers.name[0] = '\0';
@@ -847,8 +847,8 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
/* check if the area supports widgets */ /* check if the area supports widgets */
const struct wmGizmoMapType_Params wmap_params = { const struct wmGizmoMapType_Params wmap_params = {
.spaceid = dummywgt.gzmap_params.spaceid, .spaceid = dummy_wgt.gzmap_params.spaceid,
.regionid = dummywgt.gzmap_params.regionid, .regionid = dummy_wgt.gzmap_params.regionid,
}; };
wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&wmap_params); wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&wmap_params);
@@ -859,7 +859,7 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
/* check if we have registered this gizmogroup type before, and remove it */ /* check if we have registered this gizmogroup type before, and remove it */
{ {
wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(dummywgt.idname, true); wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(dummy_wgt.idname, true);
if (gzgt) { if (gzgt) {
StructRNA *srna = gzgt->rna_ext.srna; StructRNA *srna = gzgt->rna_ext.srna;
if (!(srna && rna_GizmoGroup_unregister(bmain, srna))) { if (!(srna && rna_GizmoGroup_unregister(bmain, srna))) {
@@ -868,13 +868,13 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
"%s '%s', bl_idname '%s' %s", "%s '%s', bl_idname '%s' %s",
error_prefix, error_prefix,
identifier, identifier,
dummywgt.idname, dummy_wgt.idname,
srna ? "is built-in" : "could not be unregistered"); srna ? "is built-in" : "could not be unregistered");
return NULL; return NULL;
} }
} }
} }
if (!RNA_struct_available_or_report(reports, dummywgt.idname)) { if (!RNA_struct_available_or_report(reports, dummy_wgt.idname)) {
return NULL; return NULL;
} }
@@ -887,32 +887,32 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
BLI_string_join_array_by_sep_char_with_tableN( BLI_string_join_array_by_sep_char_with_tableN(
'\0', strings_table, strings, ARRAY_SIZE(strings)); '\0', strings_table, strings, ARRAY_SIZE(strings));
dummywgt.idname = strings_table[0]; /* allocated string stored here */ dummy_wgt.idname = strings_table[0]; /* allocated string stored here */
dummywgt.name = strings_table[1]; dummy_wgt.name = strings_table[1];
BLI_assert(ARRAY_SIZE(strings) == 2); BLI_assert(ARRAY_SIZE(strings) == 2);
} }
/* create a new gizmogroup type */ /* create a new gizmogroup type */
dummywgt.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywgt.idname, &RNA_GizmoGroup); dummy_wgt.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummy_wgt.idname, &RNA_GizmoGroup);
/* Gizmo group properties are registered separately. */ /* Gizmo group properties are registered separately. */
RNA_def_struct_flag(dummywgt.rna_ext.srna, STRUCT_NO_IDPROPERTIES); RNA_def_struct_flag(dummy_wgt.rna_ext.srna, STRUCT_NO_IDPROPERTIES);
dummywgt.rna_ext.data = data; dummy_wgt.rna_ext.data = data;
dummywgt.rna_ext.call = call; dummy_wgt.rna_ext.call = call;
dummywgt.rna_ext.free = free; dummy_wgt.rna_ext.free = free;
/* We used to register widget group types like this, now we do it similar to /* We used to register widget group types like this, now we do it similar to
* operator types. Thus we should be able to do the same as operator types now. */ * operator types. Thus we should be able to do the same as operator types now. */
dummywgt.poll = (have_function[0]) ? rna_gizmogroup_poll_cb : NULL; dummy_wgt.poll = (have_function[0]) ? rna_gizmogroup_poll_cb : NULL;
dummywgt.setup_keymap = (have_function[1]) ? rna_gizmogroup_setup_keymap_cb : NULL; dummy_wgt.setup_keymap = (have_function[1]) ? rna_gizmogroup_setup_keymap_cb : NULL;
dummywgt.setup = (have_function[2]) ? rna_gizmogroup_setup_cb : NULL; dummy_wgt.setup = (have_function[2]) ? rna_gizmogroup_setup_cb : NULL;
dummywgt.refresh = (have_function[3]) ? rna_gizmogroup_refresh_cb : NULL; dummy_wgt.refresh = (have_function[3]) ? rna_gizmogroup_refresh_cb : NULL;
dummywgt.draw_prepare = (have_function[4]) ? rna_gizmogroup_draw_prepare_cb : NULL; dummy_wgt.draw_prepare = (have_function[4]) ? rna_gizmogroup_draw_prepare_cb : NULL;
dummywgt.invoke_prepare = (have_function[5]) ? rna_gizmogroup_invoke_prepare_cb : NULL; dummy_wgt.invoke_prepare = (have_function[5]) ? rna_gizmogroup_invoke_prepare_cb : NULL;
wmGizmoGroupType *gzgt = WM_gizmogrouptype_append_ptr(BPY_RNA_gizmogroup_wrapper, wmGizmoGroupType *gzgt = WM_gizmogrouptype_append_ptr(BPY_RNA_gizmogroup_wrapper,
(void *)&dummywgt); (void *)&dummy_wgt);
{ {
const char *owner_id = RNA_struct_state_owner_get(); const char *owner_id = RNA_struct_state_owner_get();
@@ -928,7 +928,7 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
} }
return dummywgt.rna_ext.srna; return dummy_wgt.rna_ext.srna;
} }
static bool rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type) static bool rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type)

View File

@@ -8093,7 +8093,7 @@ static int rna_function_arg_count(FunctionRNA *func, int *min_count)
return count; return count;
} }
static int bpy_class_validate_recursive(PointerRNA *dummyptr, static int bpy_class_validate_recursive(PointerRNA *dummy_ptr,
StructRNA *srna, StructRNA *srna,
void *py_data, void *py_data,
int *have_function) int *have_function)
@@ -8109,7 +8109,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr,
const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; /* __name__ */ const char *py_class_name = ((PyTypeObject *)py_class)->tp_name; /* __name__ */
if (srna_base) { if (srna_base) {
if (bpy_class_validate_recursive(dummyptr, srna_base, py_data, have_function) != 0) { if (bpy_class_validate_recursive(dummy_ptr, srna_base, py_data, have_function) != 0) {
return -1; return -1;
} }
} }
@@ -8256,7 +8256,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr,
{ \ { \
if ((item = PyObject_GetAttr(py_class, py_attr))) { \ if ((item = PyObject_GetAttr(py_class, py_attr))) { \
if (item != Py_None) { \ if (item != Py_None) { \
if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) { \ if (pyrna_py_to_prop(dummy_ptr, prop, NULL, item, "validating class:") != 0) { \
Py_DECREF(item); \ Py_DECREF(item); \
return -1; \ return -1; \
} \ } \
@@ -8287,7 +8287,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr,
PyErr_Clear(); PyErr_Clear();
} }
else { else {
if (pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class:") != 0) { if (pyrna_py_to_prop(dummy_ptr, prop, NULL, item, "validating class:") != 0) {
Py_DECREF(item); Py_DECREF(item);
return -1; return -1;
} }
@@ -8298,9 +8298,9 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr,
return 0; return 0;
} }
static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_function) static int bpy_class_validate(PointerRNA *dummy_ptr, void *py_data, int *have_function)
{ {
return bpy_class_validate_recursive(dummyptr, dummyptr->type, py_data, have_function); return bpy_class_validate_recursive(dummy_ptr, dummy_ptr->type, py_data, have_function);
} }
/* TODO: multiple return values like with RNA functions. */ /* TODO: multiple return values like with RNA functions. */