issues auto generating rna docs
authorCampbell Barton <ideasman42@gmail.com>
Sun, 19 Jul 2009 14:57:20 +0000 (14:57 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 19 Jul 2009 14:57:20 +0000 (14:57 +0000)
- add a warning when an operator name is NULL, set it to a dummy name to prevent crash. POSE_OT_constraints_clear had its name commented (not sure why)
- rna_Object_parent_type_itemf wasnt checking for context being NULL, needed for docs else it crashes.
- bpy.ops.add/remove didnt show up in a dir(bpy.ops)

release/ui/bpy_ops.py
source/blender/editors/object/editconstraint.c
source/blender/makesrna/intern/rna_object.c
source/blender/windowmanager/intern/wm_operators.c

index 084f4c9..aaf9edc 100644 (file)
@@ -26,8 +26,12 @@ class bpy_ops(object):
                
                submodules = set()
                
+               # add this classes functions
+               for id_name in dir(self.__class__):
+                       if not id_name.startswith('__'):
+                               submodules.add(id_name)
+               
                for id_name in op_dir():
-                       
                        id_split = id_name.split('_OT_', 1)
                        
                        if len(id_split) == 2:
@@ -65,10 +69,6 @@ class bpy_ops_submodule(object):
                module_upper = self.module.upper()
                
                for id_name in op_dir():
-                       
-                       if id_name.startswith('__'):
-                               continue
-                       
                        id_split = id_name.split('_OT_', 1)
                        if len(id_split) == 2 and module_upper == id_split[0]:
                                functions.add(id_split[1])
index 6a88fb5..477d04a 100644 (file)
@@ -1011,7 +1011,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *op)
 void POSE_OT_constraints_clear(wmOperatorType *ot)
 {
        /* identifiers */
-       //ot->name = "Clear Constraints";
+       ot->name = "Clear Constraints";
        ot->idname= "POSE_OT_constraints_clear";
        ot->description= "Clear all the constraints for the selected bones.";
        
index 5ec25cf..05a60f3 100644 (file)
@@ -184,13 +184,18 @@ static void rna_Object_track_set(PointerRNA *ptr, PointerRNA value)
 static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *C, PointerRNA *ptr, int *free)
 {
        Object *ob= (Object*)ptr->data;
-       Object *par= ob->parent;
        EnumPropertyItem *item= NULL;
        int totitem= 0;
 
+       if(C==NULL) {
+               return parent_type_items;
+       }
+       
        RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
 
-       if(par) {
+       if(ob->parent) {
+               Object *par= ob->parent;
+               
                if(par->type == OB_CURVE)
                        RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARCURVE);
                else if(par->type == OB_LATTICE)
index 9e8c5dc..5e60207 100644 (file)
@@ -130,6 +130,13 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
        ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
        ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
        opfunc(ot);
+
+       if(ot->name==NULL) {
+               static char dummy_name[] = "Dummy Name";
+               fprintf(stderr, "ERROR: Operator %s has no name property!\n", ot->idname);
+               ot->name= dummy_name;
+       }
+
        RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:""); // XXX All ops should have a description but for now allow them not to.
        RNA_def_struct_identifier(ot->srna, ot->idname);
        BLI_addtail(&global_ops, ot);