diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-01-01 23:44:40 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-01-01 23:44:40 +0300 |
commit | 112385660aeefbd503b128c91a3c7fc09d1e6d5a (patch) | |
tree | 3db61ae0103dab6ba41bdfbf015ccb8b05bba0d6 /source/blender/editors | |
parent | ddabed9c9625f7109b703ed88c88247bfb14aaba (diff) |
RNA
* Object has some more properties wrapped, mostly game related.
* Scene frame changes now send a notifier.
* Added functions to create/free operator properties for calling
operators. This also simplifies some duplicated code that did
this. Ideally though this kind of thing should use the properties
pointer provided by buttons and keymap items. Example code:
PointerRNA ptr;
WM_operator_properties_create(&ptr, "SOME_OT_name");
RNA_int_set(&ptr, "value", 42);
WM_operator_name_call(C, "SOME_OT_name", WM_OP_EXEC_DEFAULT, &ptr);
WM_operator_properties_free(&ptr);
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface.c | 17 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 4 |
3 files changed, 15 insertions, 20 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 51cc89505b9..b72cdb17ec4 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1371,11 +1371,10 @@ static void ui_free_link(uiLink *link) static void ui_free_but(const bContext *C, uiBut *but) { - if(but->opproperties) { - IDP_FreeProperty(but->opproperties); - MEM_freeN(but->opproperties); + if(but->opptr) { + WM_operator_properties_free(but->opptr); + MEM_freeN(but->opptr); } - if(but->opptr) MEM_freeN(but->opptr); if(but->active) ui_button_active_cancel(C, but); if(but->str && but->str != but->strdata) MEM_freeN(but->str); ui_free_link(but->link); @@ -2610,15 +2609,9 @@ int uiButGetRetVal(uiBut *but) PointerRNA *uiButGetOperatorPtrRNA(uiBut *but) { - wmOperatorType *ot; - if(but->opname && !but->opptr) { - ot= WM_operatortype_find(but->opname); - - if(ot) { - but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr"); - RNA_pointer_create(NULL, NULL, ot->srna, &but->opproperties, but->opptr); - } + but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr"); + WM_operator_properties_create(but->opptr, but->opname); } return but->opptr; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c1b795f48f1..55e7e297b3f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -147,7 +147,7 @@ typedef struct uiAfterFunc { const char *opname; int opcontext; - IDProperty *opproperties; + PointerRNA *opptr; PointerRNA rnapoin; PropertyRNA *rnaprop; @@ -190,14 +190,14 @@ static void ui_apply_but_func(bContext *C, uiBut *but) after->opname= but->opname; after->opcontext= but->opcontext; - after->opproperties= but->opproperties; + after->opptr= but->opptr; after->rnapoin= but->rnapoin; after->rnaprop= but->rnaprop; but->opname= NULL; but->opcontext= 0; - but->opproperties= NULL; + but->opptr= NULL; BLI_addtail(&UIAfterFuncs, after); } @@ -222,10 +222,10 @@ static void ui_apply_but_funcs_after(bContext *C) after->butm_func(C, after->butm_func_arg, after->a2); if(after->opname) - WM_operator_name_call(C, after->opname, after->opcontext, after->opproperties); - if(after->opproperties) { - IDP_FreeProperty(after->opproperties); - MEM_freeN(after->opproperties); + WM_operator_name_call(C, after->opname, after->opcontext, after->opptr); + if(after->opptr) { + WM_operator_properties_free(after->opptr); + MEM_freeN(after->opptr); } if(after->rnapoin.data) diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 1e2035906a4..bbf08b6de18 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1096,7 +1096,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->name= coloritem[index]; else { te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName"); - sprintf(te->name, " %d", index); + sprintf(te->name, " %d", index+1); te->flag |= TE_FREE_NAME; } } @@ -3227,6 +3227,8 @@ static int tselem_rna_icon(PointerRNA *ptr) return ICON_RNA; else if(rnatype == &RNA_CollectionProperty) return ICON_RNA; + else if(rnatype == &RNA_ObjectGameSettings) + return ICON_GAME; else return ICON_DOT; } |