improved class validation, variables defined by the rna interface as non-optional...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 31 Oct 2009 18:48:58 +0000 (18:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 31 Oct 2009 18:48:58 +0000 (18:48 +0000)
last commit broke povray too.

21 files changed:
release/scripts/ui/buttons_data_armature.py
release/scripts/ui/buttons_data_bone.py
release/scripts/ui/buttons_data_camera.py
release/scripts/ui/buttons_data_curve.py
release/scripts/ui/buttons_data_lamp.py
release/scripts/ui/buttons_data_lattice.py
release/scripts/ui/buttons_data_mesh.py
release/scripts/ui/buttons_data_metaball.py
release/scripts/ui/buttons_data_text.py
release/scripts/ui/buttons_game.py
release/scripts/ui/buttons_material.py
release/scripts/ui/buttons_object.py
release/scripts/ui/buttons_particle.py
release/scripts/ui/buttons_texture.py
release/scripts/ui/buttons_world.py
release/scripts/ui/space_info.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_view3d.py
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_ui.c
source/blender/python/intern/bpy_rna.c

index db635be763c94c4a79ae39b53917c4217d1dcf1b..75264f5d7ec94d70b19e40b5051dfc7eb12035e4 100644 (file)
@@ -10,6 +10,7 @@ class DataButtonsPanel(bpy.types.Panel):
                return context.armature
 
 class DATA_PT_context_arm(DataButtonsPanel):
+       bl_label = ""
        bl_show_header = False
        
        def draw(self, context):
index a3ac86fa841b3bd01536934d2f98726724ea78e4..706c418d0ce2ecaaf99b6542d831e316fb33cb7f 100644 (file)
@@ -10,6 +10,7 @@ class BoneButtonsPanel(bpy.types.Panel):
                return (context.bone or context.edit_bone)
 
 class BONE_PT_context_bone(BoneButtonsPanel):
+       bl_label = ""
        bl_show_header = False
 
        def draw(self, context):
index c76d2633a51cc9f6571bde756fc5f0b5f864890c..1321e42b97d5272e824725be669d7b1cd4095bb5 100644 (file)
@@ -10,6 +10,7 @@ class DataButtonsPanel(bpy.types.Panel):
                return context.camera
                
 class DATA_PT_context_camera(DataButtonsPanel):
+       bl_label = ""
        bl_show_header = False
        
        def draw(self, context):
index e86af9bf3ab17ea43e0214adef39a451a80107a7..90d84dc09ed0e5f4b8f2ef6048539af814556f52 100644 (file)
@@ -25,6 +25,7 @@ class DataButtonsPanelActive(DataButtonsPanel):
                return (curve and curve.active_spline)
 
 class DATA_PT_context_curve(DataButtonsPanel):
+       bl_label = ""
        bl_show_header = False
        
        def draw(self, context):
index 74c4ba012dfc7123479ada17db3f277e95944ef4..0d38470102983016fa9d09c44ce6cc91bc6a62f8 100644 (file)
@@ -16,6 +16,7 @@ class DATA_PT_preview(DataButtonsPanel):
                self.layout.template_preview(context.lamp)
        
 class DATA_PT_context_lamp(DataButtonsPanel):
+       bl_label = ""
        bl_show_header = False
        
        def draw(self, context):
index 3272e1ccf5570903c70dff3b4f6496c6e8997708..505ea6e42e9183c78cb576786e589b9ec65c92ef 100644 (file)
@@ -10,6 +10,7 @@ class DataButtonsPanel(bpy.types.Panel):
                return context.lattice
        
 class DATA_PT_context_lattice(DataButtonsPanel):
+       bl_label = ""
        bl_show_header = False
        
        def draw(self, context):
index f0120b58c6deda5e712704373df301afc94ec31d..2ed52206d7e0366c7a4e021eb8538ee9066053b6 100644 (file)
@@ -10,6 +10,7 @@ class DataButtonsPanel(bpy.types.Panel):
                return context.mesh
 
 class DATA_PT_context_mesh(DataButtonsPanel):
+       bl_label = ""
        bl_show_header = False
        
        def draw(self, context):
index bf937f212d923caf663cc9acc888a15c93c91056..ebb5efb40cab459ed99ba8a237d8b01e5d6c63f5 100644 (file)
@@ -9,6 +9,7 @@ class DataButtonsPanel(bpy.types.Panel):
                return context.meta_ball
 
 class DATA_PT_context_metaball(DataButtonsPanel):
+       bl_label = ""
        bl_show_header = False
        
        def draw(self, context):
index 9b8e1e4d9846b2793ef8dc61d40f9b4952ad155c..49847863d7cbbce25b5188d146c75638edd97aa0 100644 (file)
@@ -10,6 +10,7 @@ class DataButtonsPanel(bpy.types.Panel):
                return (context.object and context.object.type == 'TEXT' and context.curve)
 
 class DATA_PT_context_text(DataButtonsPanel):
+       bl_label = ""
        bl_show_header = False
 
        def draw(self, context):
@@ -171,7 +172,7 @@ class DATA_PT_textboxes(DataButtonsPanel):
                        col.itemR(box, "x", text="X")
                        col.itemR(box, "y", text="Y")
 
-bpy.types.register(DATA_PT_context_text)       
+bpy.types.register(DATA_PT_context_text)
 bpy.types.register(DATA_PT_shape_text) 
 bpy.types.register(DATA_PT_geometry_text)
 bpy.types.register(DATA_PT_font)
index 2a1e6adee5b1873a6898c33de1f74fd150a77af6..775818845150e2197d09e78ee9c8e25513f69eb0 100644 (file)
@@ -330,6 +330,7 @@ class WorldButtonsPanel(bpy.types.Panel):
                return (rd.engine == 'BLENDER_GAME')
 
 class WORLD_PT_game_context_world(WorldButtonsPanel):
+       bl_label = ""
        bl_show_header = False
 
        def poll(self, context):
index c83f4a65209dc5cd3889c4f5b1e251d98cecfaff..af95eec9a6848060c581d4ab48237435e35e32c6 100644 (file)
@@ -32,6 +32,7 @@ class MATERIAL_PT_preview(MaterialButtonsPanel):
                self.layout.template_preview(context.material)
                
 class MATERIAL_PT_context_material(MaterialButtonsPanel):
+       bl_label = ""
        bl_show_header = False
        COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
 
index 37ecf83d846cff8eb0ddd83b7954c898ff96d544..213fbf17dd601d6c2a090cf7d86faf340b9f26da 100644 (file)
@@ -7,6 +7,7 @@ class ObjectButtonsPanel(bpy.types.Panel):
        bl_context = "object"
 
 class OBJECT_PT_context_object(ObjectButtonsPanel):
+       bl_label = ""
        bl_show_header = False
 
        def draw(self, context):
index 8ab31df754351762239b22b1ba383a0747f78131..ad9a82c68240e21e1a28b4adba9eaf7b7e747bf8 100644 (file)
@@ -24,6 +24,7 @@ class ParticleButtonsPanel(bpy.types.Panel):
                return particle_panel_poll(context)
 
 class PARTICLE_PT_particles(ParticleButtonsPanel):
+       bl_label = ""
        bl_show_header = False
 
        def poll(self, context):
index cb5bca9e26a0aaeda7975557cd621c3d68731d55..3426a879ccacee44b53a888954261242e48046b6 100644 (file)
@@ -1,4 +1,3 @@
-
 import bpy
 
 def active_node_mat(mat):
@@ -51,6 +50,7 @@ class TEXTURE_PT_preview(TextureButtonsPanel):
                        layout.template_preview(tex, slot=slot)
                        
 class TEXTURE_PT_context_texture(TextureButtonsPanel):
+       bl_label = ""
        bl_show_header = False
 
        def poll(self, context):
index b0bb27518d400083923722e2cbad284400aaab3f..cfe2410595cd6bcf454fe09d735a077e1f98e161 100644 (file)
@@ -19,6 +19,7 @@ class WORLD_PT_preview(WorldButtonsPanel):
                self.layout.template_preview(context.world)
        
 class WORLD_PT_context_world(WorldButtonsPanel):
+       bl_label = ""
        bl_show_header = False
        COMPAT_ENGINES = set(['BLENDER_RENDER'])
 
index 58ba96e01814e8a55b8fd87e2637408a19f8b1ad..bf7d30c461d9542a56bbce43beabf3d92bb8ef59 100644 (file)
@@ -96,12 +96,14 @@ dynamic_menu.setup(INFO_MT_file_more)
 '''
 
 class INFO_MT_file_import(dynamic_menu.DynMenu):
+       bl_idname = "INFO_MT_file_import"
        bl_label = "Import"
 
        def draw(self, context):
                self.layout.itemO("WM_OT_collada_import", text="COLLADA (.dae)...")
 
 class INFO_MT_file_export(dynamic_menu.DynMenu):
+       bl_idname = "INFO_MT_file_export"
        bl_label = "Export"
 
        def draw(self, context):
@@ -124,6 +126,7 @@ class INFO_MT_file_external_data(bpy.types.Menu):
                layout.itemO("file.find_missing_files")
 
 class INFO_MT_mesh_add(dynamic_menu.DynMenu):
+       bl_idname = "INFO_MT_mesh_add"
        bl_label = "Mesh"
        def draw(self, context):
                layout = self.layout
index b5fdf2fcea0b3430da12ff9ceeec6988fd3bac39..ef85a608d1741f926049889d338982c2da3ddd1b 100644 (file)
@@ -24,7 +24,9 @@ class USERPREF_MT_view(bpy.types.Menu):
                layout = self.layout
 
 class USERPREF_PT_tabs(bpy.types.Panel):
+       bl_label = ""
        bl_space_type = 'USER_PREFERENCES'
+       bl_region_type = 'WINDOW'
        bl_show_header = False
 
        def draw(self, context):
@@ -37,6 +39,7 @@ class USERPREF_PT_tabs(bpy.types.Panel):
 class USERPREF_PT_interface(bpy.types.Panel):
        bl_space_type = 'USER_PREFERENCES'
        bl_label = "Interface"
+       bl_region_type = 'WINDOW'
        bl_show_header = False
 
        def poll(self, context):
@@ -121,6 +124,7 @@ class USERPREF_PT_interface(bpy.types.Panel):
 class USERPREF_PT_edit(bpy.types.Panel):
        bl_space_type = 'USER_PREFERENCES'
        bl_label = "Edit"
+       bl_region_type = 'WINDOW'
        bl_show_header = False
 
        def poll(self, context):
@@ -224,6 +228,7 @@ class USERPREF_PT_edit(bpy.types.Panel):
 class USERPREF_PT_system(bpy.types.Panel):
        bl_space_type = 'USER_PREFERENCES'
        bl_label = "System"
+       bl_region_type = 'WINDOW'
        bl_show_header = False
 
        def poll(self, context):
@@ -315,6 +320,7 @@ class USERPREF_PT_system(bpy.types.Panel):
 class USERPREF_PT_file(bpy.types.Panel):
        bl_space_type = 'USER_PREFERENCES'
        bl_label = "Files"
+       bl_region_type = 'WINDOW'
        bl_show_header = False
 
        def poll(self, context):
@@ -381,6 +387,7 @@ class USERPREF_PT_file(bpy.types.Panel):
 class USERPREF_PT_input(bpy.types.Panel):
        bl_space_type = 'USER_PREFERENCES'
        bl_label = "Input"
+       bl_region_type = 'WINDOW'
        bl_show_header = False
 
        def poll(self, context):
index f0d1a0dcc6c2898fc9958f30bbdf92a3cc6c38b1..d0f60c98a1c3cecf3e6dd14b5607cdb5eb2623f3 100644 (file)
@@ -886,6 +886,7 @@ class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
 
 class VIEW3D_MT_edit_mesh_faces(dynamic_menu.DynMenu):
        bl_label = "Faces"
+       bl_idname = "VIEW3D_MT_edit_mesh_faces"
 
        def draw(self, context):
                layout = self.layout
index a67831715a2592d9b236fca77f39868778e0f3c6..3505253b60f00f1146c454c8dcb44b99d50178d6 100644 (file)
@@ -269,11 +269,11 @@ static void rna_def_render_engine(BlenderRNA *brna)
        /* registration */
        RNA_define_verify_sdna(0);
 
-       prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
+       prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "type->idname");
        RNA_def_property_flag(prop, PROP_REGISTER);
 
-       prop= RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
+       prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "type->name");
        RNA_def_property_flag(prop, PROP_REGISTER);
 
index 34b50e1b3ea1bf31d58f5aa982a8552a6bd05ece..1bb7fe720a6b94c1f70226774d3c8329847e962c 100644 (file)
@@ -592,7 +592,6 @@ static void rna_def_panel(BlenderRNA *brna)
 
        /* registration */
        prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
-       RNA_def_property_clear_flag(prop, PROP_REGISTER_OPTIONAL);
        RNA_def_property_string_sdna(prop, NULL, "type->idname");
        RNA_def_property_flag(prop, PROP_REGISTER);
 
@@ -612,15 +611,15 @@ static void rna_def_panel(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "bl_context", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "type->context");
-       RNA_def_property_flag(prop, PROP_REGISTER);
+       RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* should this be optional? - Campbell */
 
        prop= RNA_def_property(srna, "bl_default_closed", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "type->flag", PNL_DEFAULT_CLOSED);
-       RNA_def_property_flag(prop, PROP_REGISTER);
+       RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
 
        prop= RNA_def_property(srna, "bl_show_header", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", PNL_NO_HEADER);
-       RNA_def_property_flag(prop, PROP_REGISTER);
+       RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
 }
 
 static void rna_def_header(BlenderRNA *brna)
@@ -693,7 +692,6 @@ static void rna_def_menu(BlenderRNA *brna)
 
        /* registration */
        prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
-       RNA_def_property_clear_flag(prop, PROP_REGISTER_OPTIONAL);
        RNA_def_property_string_sdna(prop, NULL, "type->idname");
        RNA_def_property_flag(prop, PROP_REGISTER);
 
index f12c7b55b0e0531e6db18df7df4dd3a61352380f..f914c3cacea286e3a48127f7600f1bf52d105da8 100644 (file)
@@ -3194,7 +3194,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
        PyObject *item, *fitem;
        PyObject *py_arg_count;
        int i, flag, arg_count, func_arg_count;
-       char *identifier;
+       const char *identifier;
 
        if (base_class) {
                if (!PyObject_IsSubclass(py_class, base_class)) {
@@ -3269,6 +3269,8 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
                item = PyObject_GetAttrString(py_class, identifier);
 
                if (item==NULL) {
+
+                       /* Sneaky workaround to use the class name as the bl_idname */
                        if(strcmp(identifier, "bl_idname") == 0) {
                                item= PyObject_GetAttrString(py_class, "__name__");
 
@@ -3280,7 +3282,8 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
                                }
                        }
 
-                       if (item==NULL && (flag & PROP_REGISTER_OPTIONAL)==0) {
+
+                       if (item == NULL && (((flag & PROP_REGISTER_OPTIONAL) != PROP_REGISTER_OPTIONAL))) {
                                PyErr_Format( PyExc_AttributeError, "expected %.200s class to have an \"%.200s\" attribute", class_type, identifier);
                                return -1;
                        }