RNA: don't pass RNA type in RNA_id_pointer_create, can be found automatically.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 8 Jan 2009 15:33:34 +0000 (15:33 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 8 Jan 2009 15:33:34 +0000 (15:33 +0000)
source/blender/editors/space_outliner/outliner.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_access.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_operators.c

index 743f1edba3e4e49d02a7d87855143304da0a5b76..fad19f6a023879931b7d0333c96b2cebd8b7e0f4 100644 (file)
@@ -1357,7 +1357,7 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
        else if(soops->outlinevis==SO_USERDEF) {
                PointerRNA userdefptr;
 
-               RNA_pointer_create(NULL, NULL, &RNA_UserPreferences, &U, &userdefptr);
+               RNA_pointer_create(NULL, &RNA_UserPreferences, &U, &userdefptr);
 
                ten= outliner_add_element(soops, &soops->tree, (void*)&userdefptr, NULL, TSE_RNA_STRUCT, -1);
 
index 34a26480fe781067b2de66d528e0d816010de93a..f6a568d8e93ed35e4f19ac1d8db2d1fdc84e193d 100644 (file)
@@ -270,8 +270,8 @@ extern StructRNA RNA_XorController;
  */
 
 void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr);
-void RNA_id_pointer_create(StructRNA *idtype, struct ID *id, PointerRNA *r_ptr);
-void RNA_pointer_create(StructRNA *idtype, struct ID *id, StructRNA *type, void *data, PointerRNA *r_ptr);
+void RNA_id_pointer_create(struct ID *id, PointerRNA *r_ptr);
+void RNA_pointer_create(struct ID *id, StructRNA *type, void *data, PointerRNA *r_ptr);
 
 void RNA_blender_rna_pointer_create(PointerRNA *r_ptr);
 
index 55d3cde4af7de13136a5a615ef16aea7b7ab276f..a56980c96b202d9c7dcb406a57284faeaee282c4 100644 (file)
@@ -61,16 +61,34 @@ void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
        r_ptr->data= main;
 }
 
-void RNA_id_pointer_create(StructRNA *idtype, ID *id, PointerRNA *r_ptr)
+void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
 {
+       PointerRNA tmp;
+       StructRNA *idtype= NULL;
+
+       if(id) {
+               memset(&tmp, 0, sizeof(tmp));
+               tmp.data= id;
+               idtype= rna_ID_refine(&tmp);
+       }
+
        r_ptr->id.type= idtype;
        r_ptr->id.data= id;
        r_ptr->type= idtype;
        r_ptr->data= id;
 }
 
-void RNA_pointer_create(StructRNA *idtype, ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
+void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
 {
+       PointerRNA tmp;
+       StructRNA *idtype= NULL;
+
+       if(id) {
+               memset(&tmp, 0, sizeof(tmp));
+               tmp.data= id;
+               idtype= rna_ID_refine(&tmp);
+       }
+
        r_ptr->id.type= idtype;
        r_ptr->id.data= id;
        r_ptr->type= type;
index eb5a1449f3639fc23aed81e5b70beab65a7987eb..046fbdefb646d804c626838bd0926fea0acae897 100644 (file)
@@ -392,7 +392,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
                        IDPropertyTemplate val = {0};
                        op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties");
                }
-               RNA_pointer_create(&RNA_WindowManager, &wm->id, ot->srna, op->properties, op->ptr);
+               RNA_pointer_create(&wm->id, ot->srna, op->properties, op->ptr);
 
                /* initialize error reports */
                if (reports) {
index f79b5a2955d3ac83cdd221c87725e45968ecf15a..afd66652be214efed9e97b73c0883775d578784d 100644 (file)
@@ -172,7 +172,7 @@ void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
        wmOperatorType *ot= WM_operatortype_find(opstring);
 
        if(ot)
-               RNA_pointer_create(NULL, NULL, ot->srna, NULL, ptr);
+               RNA_pointer_create(NULL, ot->srna, NULL, ptr);
        else
                memset(ptr, 0, sizeof(*ptr));
 }