- remove WM_operatortype_exists since its almost the same as WM_operatortype_find
authorCampbell Barton <ideasman42@gmail.com>
Fri, 13 Aug 2010 14:42:45 +0000 (14:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 13 Aug 2010 14:42:45 +0000 (14:42 +0000)
- hopefully fix reported problem with MSVC.

source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_wm.c
source/blender/python/intern/bpy_operator.c
source/blender/python/intern/bpy_operator_wrap.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c

index 8e7a2a8..050f00b 100644 (file)
@@ -574,7 +574,7 @@ FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier)
        FunctionRNA *func;
        StructRNA *type;
        for(type= ptr->type; type; type= type->base) {
-               func= BLI_findstring_ptr(&type->functions, identifier, offsetof(FunctionRNA, identifier));
+               func= (FunctionRNA *)BLI_findstring_ptr(&type->functions, identifier, offsetof(FunctionRNA, identifier));
                if(func) {
                        return func;
                }
index cdab225..b6563ec 100644 (file)
@@ -57,22 +57,29 @@ static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        ID *id= ptr->id.data;
 
-       DAG_id_flush_update(id, OB_RECALC_DATA);
-       WM_main_add_notifier(NC_GEOM|ND_DATA, id);
+       /* cheating way for importers to avoid slow updates */
+       if(id->us > 0) {
+               DAG_id_flush_update(id, OB_RECALC_DATA);
+               WM_main_add_notifier(NC_GEOM|ND_DATA, id);
+       }
 }
 
 static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        ID *id= ptr->id.data;
-
-       WM_main_add_notifier(NC_GEOM|ND_SELECT, id);
+       /* cheating way for importers to avoid slow updates */
+       if(id->us > 0) {
+               WM_main_add_notifier(NC_GEOM|ND_SELECT, id);
+       }
 }
 
 void rna_Mesh_update_draw(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        ID *id= ptr->id.data;
-
-       WM_main_add_notifier(NC_GEOM|ND_DATA, id);
+       /* cheating way for importers to avoid slow updates */
+       if(id->us > 0) {
+               WM_main_add_notifier(NC_GEOM|ND_DATA, id);
+       }
 }
 
 static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value)
index 700b817..1ed3adb 100644 (file)
@@ -1059,13 +1059,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
        };
 
        //TODO: names, tooltips
+#if 0
        static EnumPropertyItem rot_from_items[] = {
                {PART_ROT_KEYS, "KEYS", 0, "keys", ""},
                {PART_ROT_ZINCR, "ZINCR", 0, "zincr", ""},
                {PART_ROT_IINCR, "IINCR", 0, "iincr", ""},
                {0, NULL, 0, NULL, NULL}
        };
-
+#endif
        static EnumPropertyItem integrator_type_items[] = {
                {PART_INT_EULER, "EULER", 0, "Euler", ""},
                {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
@@ -1433,11 +1434,13 @@ static void rna_def_particle_settings(BlenderRNA *brna)
        RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
 
-       //TODO: is this read only/internal?
+       // not used anywhere, why is this in DNA???
+#if 0
        prop= RNA_def_property(srna, "rotate_from", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "rotfrom");
        RNA_def_property_enum_items(prop, rot_from_items);
        RNA_def_property_ui_text(prop, "Rotate From", "");
+#endif
 
        prop= RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_items(prop, integrator_type_items);
index eeac681..7bf2db4 100644 (file)
@@ -361,7 +361,7 @@ static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
 static PointerRNA rna_OperatorTypeMacro_properties_get(PointerRNA *ptr)
 {
        wmOperatorTypeMacro *otmacro= (wmOperatorTypeMacro*)ptr->data;
-       wmOperatorType *ot = WM_operatortype_exists(otmacro->idname);
+       wmOperatorType *ot = WM_operatortype_find(otmacro->idname, TRUE);
        return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties);
 }
 
@@ -796,7 +796,7 @@ static StructRNA *rna_Operator_register(const bContext *C, ReportList *reports,
 
        /* check if we have registered this operator type before, and remove it */
        {
-               wmOperatorType *ot= WM_operatortype_exists(dummyot.idname);
+               wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE);
                if(ot && ot->ext.srna)
                        rna_Operator_unregister(C, ot->ext.srna);
        }
@@ -865,7 +865,7 @@ static StructRNA *rna_MacroOperator_register(const bContext *C, ReportList *repo
 
        /* check if we have registered this operator type before, and remove it */
        {
-               wmOperatorType *ot= WM_operatortype_exists(dummyot.idname);
+               wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE);
                if(ot && ot->ext.srna)
                        rna_Operator_unregister(C, ot->ext.srna);
        }
index 0e54f15..d92044b 100644 (file)
@@ -63,7 +63,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args)
        if (!PyArg_ParseTuple(args, "sO|O!s:_bpy.ops.call", &opname, &context_dict, &PyDict_Type, &kw, &context_str))
                return NULL;
 
-       ot= WM_operatortype_exists(opname);
+       ot= WM_operatortype_find(opname, TRUE);
 
        if (ot == NULL) {
                PyErr_Format( PyExc_SystemError, "Calling operator \"bpy.ops.%s\" error, could not be found", opname);
index 0c1eafb..1e521ae 100644 (file)
@@ -105,7 +105,7 @@ PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args)
        if (!PyArg_ParseTuple(args, "Os:_bpy.ops.macro_define", &macro, &opname))
                return NULL;
 
-       if (WM_operatortype_exists(opname) == NULL) {
+       if (WM_operatortype_find(opname, TRUE) == NULL) {
                PyErr_Format(PyExc_ValueError, "Macro Define: '%s' is not a valid operator id", opname);
                return NULL;
        }
@@ -114,7 +114,7 @@ PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args)
        srna= srna_from_self(macro, "Macro Define:");
        macroname = RNA_struct_identifier(srna);
 
-       ot = WM_operatortype_exists(macroname);
+       ot = WM_operatortype_find(macroname, TRUE);
 
        if (!ot) {
                PyErr_Format(PyExc_ValueError, "Macro Define: '%s' is not a valid macro or hasn't been registered yet", macroname);
index 46d42b3..c562d7a 100644 (file)
@@ -201,7 +201,6 @@ void                WM_operator_free                (struct wmOperator *op);
 void           WM_operator_stack_clear(struct bContext *C);
 
 struct wmOperatorType *WM_operatortype_find(const char *idnamem, int quiet);
-struct wmOperatorType *WM_operatortype_exists(const char *idname);
 struct wmOperatorType *WM_operatortype_first(void);
 void           WM_operatortype_append  (void (*opfunc)(struct wmOperatorType*));
 void           WM_operatortype_append_ptr      (void (*opfunc)(struct wmOperatorType*, void *), void *userdata);
index 2399490..414db3a 100644 (file)
@@ -105,7 +105,7 @@ wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
        WM_operator_bl_idname(idname_bl, idname);
 
        if (idname_bl[0]) {
-               ot= BLI_findstring_ptr(&global_ops, idname_bl, offsetof(wmOperatorType, idname));
+               ot= (wmOperatorType *)BLI_findstring_ptr(&global_ops, idname_bl, offsetof(wmOperatorType, idname));
                if(ot) {
                        return ot;
                }
@@ -117,22 +117,6 @@ wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
        return NULL;
 }
 
-wmOperatorType *WM_operatortype_exists(const char *idname)
-{
-       wmOperatorType *ot;
-       
-       char idname_bl[OP_MAX_TYPENAME]; // XXX, needed to support python style names without the _OT_ syntax
-       WM_operator_bl_idname(idname_bl, idname);
-       
-       if(idname_bl[0]) {
-               for(ot= global_ops.first; ot; ot= ot->next) {
-                       if(strncmp(ot->idname, idname_bl, OP_MAX_TYPENAME)==0)
-                          return ot;
-               }
-       }
-       return NULL;
-}
-
 wmOperatorType *WM_operatortype_first(void)
 {
        return global_ops.first;
@@ -333,7 +317,7 @@ wmOperatorType *WM_operatortype_append_macro(char *idname, char *name, int flag)
 {
        wmOperatorType *ot;
        
-       if(WM_operatortype_exists(idname)) {
+       if(WM_operatortype_find(idname, TRUE)) {
                printf("Macro error: operator %s exists\n", idname);
                return NULL;
        }