diff options
-rw-r--r-- | release/ui/space_logic.py | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 34 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 4 |
4 files changed, 30 insertions, 22 deletions
diff --git a/release/ui/space_logic.py b/release/ui/space_logic.py index 71d94c86bf3..f862f6e2667 100644 --- a/release/ui/space_logic.py +++ b/release/ui/space_logic.py @@ -5,6 +5,10 @@ class LOGIC_PT_physics(bpy.types.Panel): __region_type__ = "UI" __label__ = "Physics" + def poll(self, context): + ob = context.active_object + return ob and ob.game + def draw(self, context): layout = self.layout ob = context.active_object @@ -56,6 +60,10 @@ class LOGIC_PT_collision_bounds(bpy.types.Panel): __space_type__ = "LOGIC_EDITOR" __region_type__ = "UI" __label__ = "Collision Bounds" + + def poll(self, context): + ob = context.active_object + return ob and ob.game def draw_header(self, context): layout = self.layout diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index c806f1885ba..60774c8432c 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -643,25 +643,28 @@ void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPrope if(eprop->itemf) { *item= eprop->itemf(ptr); - for(tot=0; (*item)[tot].identifier; tot++); - *totitem= tot; + if(totitem) { + for(tot=0; (*item)[tot].identifier; tot++); + *totitem= tot; + } } else { *item= eprop->item; - *totitem= eprop->totitem; + if(totitem) + *totitem= eprop->totitem; } } int RNA_property_enum_value(PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value) { const EnumPropertyItem *item; - int totitem, i; + int i; - RNA_property_enum_items(ptr, prop, &item, &totitem); + RNA_property_enum_items(ptr, prop, &item, NULL); - for(i=0; i<totitem; i++) { - if(strcmp(item[i].identifier, identifier)==0) { - *value = item[i].value; + for(; item->identifier; item++) { + if(strcmp(item->identifier, identifier)==0) { + *value = item->value; return 1; } } @@ -693,11 +696,9 @@ int RNA_enum_name(const EnumPropertyItem *item, const int value, const char **na int RNA_property_enum_identifier(PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier) { - const EnumPropertyItem *item; - int totitem; - - RNA_property_enum_items(ptr, prop, &item, &totitem); + const EnumPropertyItem *item= NULL; + RNA_property_enum_items(ptr, prop, &item, NULL); return RNA_enum_identifier(item, value, identifier); } @@ -2067,14 +2068,13 @@ int RNA_enum_is_equal(PointerRNA *ptr, const char *name, const char *enumname) { PropertyRNA *prop= RNA_struct_find_property(ptr, name); const EnumPropertyItem *item; - int a, totitem; if(prop) { - RNA_property_enum_items(ptr, prop, &item, &totitem); + RNA_property_enum_items(ptr, prop, &item, NULL); - for(a=0; a<totitem; a++) - if(strcmp(item[a].identifier, enumname) == 0) - return (item[a].value == RNA_property_enum_get(ptr, prop)); + for(; item->identifier; item++) + if(strcmp(item->identifier, enumname) == 0) + return (item->value == RNA_property_enum_get(ptr, prop)); printf("RNA_enum_is_equal: %s.%s item %s not found.\n", ptr->type->identifier, name, enumname); return 0; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 57c7144f949..93a8af8b177 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -46,9 +46,9 @@ static int mathutils_rna_vector_cb_index= -1; /* index for our callbacks */ -static int mathutils_rna_vector_check(PyObject *user) +static int mathutils_rna_vector_check(BPy_PropertyRNA *self) { - return ((BPy_PropertyRNA *)user)->prop?1:0; + return self->prop?1:0; } static int mathutils_rna_vector_get(BPy_PropertyRNA *self, int subtype, float *vec_from) @@ -190,7 +190,7 @@ static char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop) const EnumPropertyItem *item; int totitem; - RNA_property_enum_items(ptr, prop, &item, &totitem); + RNA_property_enum_items(ptr, prop, &item, NULL); return (char*)BPy_enum_as_string((EnumPropertyItem*)item); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 46e9df10adc..33f4ff11679 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -503,7 +503,7 @@ static void WM_OT_read_homefile(wmOperatorType *ot) static int recentfile_exec(bContext *C, wmOperator *op) { - int event= RNA_enum_get(op->ptr, "nr"); + int event= RNA_int_get(op->ptr, "nr"); // XXX wm in context is not set correctly after WM_read_file -> crash // do it before for now, but is this correct with multiple windows? @@ -557,7 +557,7 @@ static void WM_OT_open_recentfile(wmOperatorType *ot) ot->exec= recentfile_exec; ot->poll= WM_operator_winactive; - RNA_def_property(ot->srna, "nr", PROP_ENUM, PROP_NONE); + RNA_def_property(ot->srna, "nr", PROP_INT, PROP_UNSIGNED); } /* ********* main file *********** */ |