Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm_gizmo.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo.c107
1 files changed, 54 insertions, 53 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 47d793382a7..826d4039c55 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -26,6 +26,7 @@
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
+#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
@@ -78,12 +79,12 @@ static void rna_gizmo_draw_cb(const struct bContext *C, struct wmGizmo *gz)
PointerRNA gz_ptr;
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ RNA_pointer_create(NULL, gz->type->rna_ext.srna, gz, &gz_ptr);
/* RNA_struct_find_function(&gz_ptr, "draw"); */
func = &rna_Gizmo_draw_func;
RNA_parameter_list_create(&list, &gz_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
RNA_parameter_list_free(&list);
}
@@ -94,13 +95,13 @@ static void rna_gizmo_draw_select_cb(const struct bContext *C, struct wmGizmo *g
PointerRNA gz_ptr;
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ RNA_pointer_create(NULL, gz->type->rna_ext.srna, gz, &gz_ptr);
/* RNA_struct_find_function(&gz_ptr, "draw_select"); */
func = &rna_Gizmo_draw_select_func;
RNA_parameter_list_create(&list, &gz_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
RNA_parameter_set_lookup(&list, "select_id", &select_id);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
RNA_parameter_list_free(&list);
}
@@ -111,13 +112,13 @@ static int rna_gizmo_test_select_cb(struct bContext *C, struct wmGizmo *gz, cons
PointerRNA gz_ptr;
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ RNA_pointer_create(NULL, gz->type->rna_ext.srna, gz, &gz_ptr);
/* RNA_struct_find_function(&gz_ptr, "test_select"); */
func = &rna_Gizmo_test_select_func;
RNA_parameter_list_create(&list, &gz_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
RNA_parameter_set_lookup(&list, "location", location);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
void *ret;
RNA_parameter_get_lookup(&list, "intersect_id", &ret);
@@ -138,14 +139,14 @@ static int rna_gizmo_modal_cb(struct bContext *C,
ParameterList list;
FunctionRNA *func;
const int tweak_flag_int = tweak_flag;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ RNA_pointer_create(NULL, gz->type->rna_ext.srna, gz, &gz_ptr);
/* RNA_struct_find_function(&gz_ptr, "modal"); */
func = &rna_Gizmo_modal_func;
RNA_parameter_list_create(&list, &gz_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
RNA_parameter_set_lookup(&list, "event", &event);
RNA_parameter_set_lookup(&list, "tweak", &tweak_flag_int);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
void *ret;
RNA_parameter_get_lookup(&list, "result", &ret);
@@ -162,11 +163,11 @@ static void rna_gizmo_setup_cb(struct wmGizmo *gz)
PointerRNA gz_ptr;
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ RNA_pointer_create(NULL, gz->type->rna_ext.srna, gz, &gz_ptr);
/* RNA_struct_find_function(&gz_ptr, "setup"); */
func = &rna_Gizmo_setup_func;
RNA_parameter_list_create(&list, &gz_ptr, func);
- gzgroup->type->ext.call((bContext *)NULL, &gz_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)NULL, &gz_ptr, func, &list);
RNA_parameter_list_free(&list);
}
@@ -177,13 +178,13 @@ static int rna_gizmo_invoke_cb(struct bContext *C, struct wmGizmo *gz, const str
PointerRNA gz_ptr;
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ RNA_pointer_create(NULL, gz->type->rna_ext.srna, gz, &gz_ptr);
/* RNA_struct_find_function(&gz_ptr, "invoke"); */
func = &rna_Gizmo_invoke_func;
RNA_parameter_list_create(&list, &gz_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
RNA_parameter_set_lookup(&list, "event", &event);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
void *ret;
RNA_parameter_get_lookup(&list, "result", &ret);
@@ -200,7 +201,7 @@ static void rna_gizmo_exit_cb(struct bContext *C, struct wmGizmo *gz, bool cance
PointerRNA gz_ptr;
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ RNA_pointer_create(NULL, gz->type->rna_ext.srna, gz, &gz_ptr);
/* RNA_struct_find_function(&gz_ptr, "exit"); */
func = &rna_Gizmo_exit_func;
RNA_parameter_list_create(&list, &gz_ptr, func);
@@ -209,7 +210,7 @@ static void rna_gizmo_exit_cb(struct bContext *C, struct wmGizmo *gz, bool cance
int cancel_i = cancel;
RNA_parameter_set_lookup(&list, "cancel", &cancel_i);
}
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gz_ptr, func, &list);
RNA_parameter_list_free(&list);
}
@@ -220,11 +221,11 @@ static void rna_gizmo_select_refresh_cb(struct wmGizmo *gz)
PointerRNA gz_ptr;
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ RNA_pointer_create(NULL, gz->type->rna_ext.srna, gz, &gz_ptr);
/* RNA_struct_find_function(&gz_ptr, "select_refresh"); */
func = &rna_Gizmo_select_refresh_func;
RNA_parameter_list_create(&list, &gz_ptr, func);
- gzgroup->type->ext.call((bContext *)NULL, &gz_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)NULL, &gz_ptr, func, &list);
RNA_parameter_list_free(&list);
}
@@ -258,13 +259,12 @@ static wmGizmo *rna_GizmoProperties_find_operator(PointerRNA *ptr)
/* We could try workaruond this lookup, but not trivial. */
for (bScreen *screen = G_MAIN->screens.first; screen; screen = screen->id.next) {
IDProperty *properties = ptr->data;
- for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (ARegion *region = sa->regionbase.first; region; region = region->next) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
if (region->gizmo_map) {
wmGizmoMap *gzmap = region->gizmo_map;
- for (wmGizmoGroup *gzgroup = WM_gizmomap_group_list(gzmap)->first; gzgroup;
- gzgroup = gzgroup->next) {
- for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
+ LISTBASE_FOREACH (wmGizmoGroup *, gzgroup, WM_gizmomap_group_list(gzmap)) {
+ LISTBASE_FOREACH (wmGizmo *, gz, &gzgroup->gizmos) {
if (gz->properties == properties) {
return gz;
}
@@ -475,8 +475,8 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
/* check if we have registered this gizmo type before, and remove it */
{
const wmGizmoType *gzt = WM_gizmotype_find(dummygt.idname, true);
- if (gzt && gzt->ext.srna) {
- rna_Gizmo_unregister(bmain, gzt->ext.srna);
+ if (gzt && gzt->rna_ext.srna) {
+ rna_Gizmo_unregister(bmain, gzt->rna_ext.srna);
}
}
if (!RNA_struct_available_or_report(reports, dummygt.idname)) {
@@ -489,12 +489,12 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
}
/* create a new gizmo type */
- dummygt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummygt.idname, &RNA_Gizmo);
+ dummygt.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummygt.idname, &RNA_Gizmo);
/* gizmo properties are registered separately */
- RNA_def_struct_flag(dummygt.ext.srna, STRUCT_NO_IDPROPERTIES);
- dummygt.ext.data = data;
- dummygt.ext.call = call;
- dummygt.ext.free = free;
+ RNA_def_struct_flag(dummygt.rna_ext.srna, STRUCT_NO_IDPROPERTIES);
+ dummygt.rna_ext.data = data;
+ dummygt.rna_ext.call = call;
+ dummygt.rna_ext.free = free;
{
int i = 0;
@@ -517,7 +517,7 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
/* update while blender is running */
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
- return dummygt.ext.srna;
+ return dummygt.rna_ext.srna;
}
static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type)
@@ -528,7 +528,7 @@ static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type)
return;
}
- RNA_struct_free_extension(type, &gzt->ext);
+ RNA_struct_free_extension(type, &gzt->rna_ext);
RNA_struct_free(&BLENDER_RNA, type);
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
@@ -547,7 +547,7 @@ static void **rna_Gizmo_instance(PointerRNA *ptr)
static StructRNA *rna_Gizmo_refine(PointerRNA *mnp_ptr)
{
wmGizmo *gz = mnp_ptr->data;
- return (gz->type && gz->type->ext.srna) ? gz->type->ext.srna : &RNA_Gizmo;
+ return (gz->type && gz->type->rna_ext.srna) ? gz->type->rna_ext.srna : &RNA_Gizmo;
}
/** \} */
@@ -665,12 +665,12 @@ static bool rna_gizmogroup_poll_cb(const bContext *C, wmGizmoGroupType *gzgt)
void *ret;
bool visible;
- RNA_pointer_create(NULL, gzgt->ext.srna, NULL, &ptr); /* dummy */
+ RNA_pointer_create(NULL, gzgt->rna_ext.srna, NULL, &ptr); /* dummy */
func = &rna_GizmoGroup_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
RNA_parameter_list_create(&list, &ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
- gzgt->ext.call((bContext *)C, &ptr, func, &list);
+ gzgt->rna_ext.call((bContext *)C, &ptr, func, &list);
RNA_parameter_get_lookup(&list, "visible", &ret);
visible = *(bool *)ret;
@@ -688,12 +688,12 @@ static void rna_gizmogroup_setup_cb(const bContext *C, wmGizmoGroup *gzgroup)
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
+ RNA_pointer_create(NULL, gzgroup->type->rna_ext.srna, gzgroup, &gzgroup_ptr);
func = &rna_GizmoGroup_setup_func; /* RNA_struct_find_function(&wgroupr, "setup"); */
RNA_parameter_list_create(&list, &gzgroup_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
- gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gzgroup_ptr, func, &list);
RNA_parameter_list_free(&list);
}
@@ -707,13 +707,13 @@ static wmKeyMap *rna_gizmogroup_setup_keymap_cb(const wmGizmoGroupType *gzgt, wm
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gzgt->ext.srna, NULL, &ptr); /* dummy */
+ RNA_pointer_create(NULL, gzgt->rna_ext.srna, NULL, &ptr); /* dummy */
func =
&rna_GizmoGroup_setup_keymap_func; /* RNA_struct_find_function(&wgroupr, "setup_keymap"); */
RNA_parameter_list_create(&list, &ptr, func);
RNA_parameter_set_lookup(&list, "keyconfig", &config);
- gzgt->ext.call(NULL, &ptr, func, &list);
+ gzgt->rna_ext.call(NULL, &ptr, func, &list);
RNA_parameter_get_lookup(&list, "keymap", &ret);
wmKeyMap *keymap = *(wmKeyMap **)ret;
@@ -731,12 +731,12 @@ static void rna_gizmogroup_refresh_cb(const bContext *C, wmGizmoGroup *gzgroup)
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
+ RNA_pointer_create(NULL, gzgroup->type->rna_ext.srna, gzgroup, &gzgroup_ptr);
func = &rna_GizmoGroup_refresh_func; /* RNA_struct_find_function(&wgroupr, "refresh"); */
RNA_parameter_list_create(&list, &gzgroup_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
- gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gzgroup_ptr, func, &list);
RNA_parameter_list_free(&list);
}
@@ -749,13 +749,13 @@ static void rna_gizmogroup_draw_prepare_cb(const bContext *C, wmGizmoGroup *gzgr
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
+ RNA_pointer_create(NULL, gzgroup->type->rna_ext.srna, gzgroup, &gzgroup_ptr);
func =
&rna_GizmoGroup_draw_prepare_func; /* RNA_struct_find_function(&wgroupr, "draw_prepare"); */
RNA_parameter_list_create(&list, &gzgroup_ptr, func);
RNA_parameter_set_lookup(&list, "context", &C);
- gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gzgroup_ptr, func, &list);
RNA_parameter_list_free(&list);
}
@@ -771,7 +771,7 @@ static void rna_gizmogroup_invoke_prepare_cb(const bContext *C,
ParameterList list;
FunctionRNA *func;
- RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
+ RNA_pointer_create(NULL, gzgroup->type->rna_ext.srna, gzgroup, &gzgroup_ptr);
/* RNA_struct_find_function(&wgroupr, "invoke_prepare"); */
func = &rna_GizmoGroup_invoke_prepare_func;
@@ -779,7 +779,7 @@ static void rna_gizmogroup_invoke_prepare_cb(const bContext *C,
RNA_parameter_set_lookup(&list, "context", &C);
RNA_parameter_set_lookup(&list, "gizmo", &gz);
RNA_parameter_set_lookup(&list, "event", &event);
- gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
+ gzgroup->type->rna_ext.call((bContext *)C, &gzgroup_ptr, func, &list);
RNA_parameter_list_free(&list);
}
@@ -846,8 +846,8 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
/* check if we have registered this gizmogroup type before, and remove it */
{
wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(dummywgt.idname, true);
- if (gzgt && gzgt->ext.srna) {
- rna_GizmoGroup_unregister(bmain, gzgt->ext.srna);
+ if (gzgt && gzgt->rna_ext.srna) {
+ rna_GizmoGroup_unregister(bmain, gzgt->rna_ext.srna);
}
}
if (!RNA_struct_available_or_report(reports, dummywgt.idname)) {
@@ -869,14 +869,14 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
}
/* create a new gizmogroup type */
- dummywgt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywgt.idname, &RNA_GizmoGroup);
+ dummywgt.rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywgt.idname, &RNA_GizmoGroup);
/* Gizmo group properties are registered separately. */
- RNA_def_struct_flag(dummywgt.ext.srna, STRUCT_NO_IDPROPERTIES);
+ RNA_def_struct_flag(dummywgt.rna_ext.srna, STRUCT_NO_IDPROPERTIES);
- dummywgt.ext.data = data;
- dummywgt.ext.call = call;
- dummywgt.ext.free = free;
+ dummywgt.rna_ext.data = data;
+ dummywgt.rna_ext.call = call;
+ dummywgt.rna_ext.free = free;
/* 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. */
@@ -904,7 +904,7 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
}
- return dummywgt.ext.srna;
+ return dummywgt.rna_ext.srna;
}
static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type)
@@ -915,7 +915,7 @@ static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type)
return;
}
- RNA_struct_free_extension(type, &gzgt->ext);
+ RNA_struct_free_extension(type, &gzgt->rna_ext);
RNA_struct_free(&BLENDER_RNA, type);
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
@@ -934,7 +934,8 @@ static void **rna_GizmoGroup_instance(PointerRNA *ptr)
static StructRNA *rna_GizmoGroup_refine(PointerRNA *gzgroup_ptr)
{
wmGizmoGroup *gzgroup = gzgroup_ptr->data;
- return (gzgroup->type && gzgroup->type->ext.srna) ? gzgroup->type->ext.srna : &RNA_GizmoGroup;
+ return (gzgroup->type && gzgroup->type->rna_ext.srna) ? gzgroup->type->rna_ext.srna :
+ &RNA_GizmoGroup;
}
static void rna_GizmoGroup_gizmos_begin(CollectionPropertyIterator *iter, PointerRNA *gzgroup_ptr)