UI: some API functions don't require explicit context passing anymore.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 23 Jun 2009 00:19:10 +0000 (00:19 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 23 Jun 2009 00:19:10 +0000 (00:19 +0000)
17 files changed:
release/ui/buttons_data_armature.py
release/ui/buttons_data_camera.py
release/ui/buttons_data_curve.py
release/ui/buttons_data_lamp.py
release/ui/buttons_data_lattice.py
release/ui/buttons_data_mesh.py
release/ui/buttons_data_text.py
release/ui/buttons_material.py
release/ui/buttons_particle.py
release/ui/buttons_texture.py
release/ui/buttons_world.py
release/ui/space_buttons.py
release/ui/space_image.py
release/ui/space_outliner.py
release/ui/space_sequencer.py
release/ui/space_text.py
source/blender/makesrna/intern/rna_ui_api.c

index c536f6bb87d481fd69ae81a125bdf3c0bd593cb2..112724bea911fc5cc3fe82bc9133164fb7c70d4f 100644 (file)
@@ -26,10 +26,10 @@ class DATA_PT_skeleton(DataButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if ob:
-                       split.template_ID(context, ob, "data")
+                       split.template_ID(ob, "data")
                        split.itemS()
                elif arm:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
                        split.itemS()
 
                if arm:
index db2a1f9db25c60e149d2d8df3c08e5e07d9b3278..9f3a062b4299e03bfabda9d26485281e9322b288 100644 (file)
@@ -26,10 +26,10 @@ class DATA_PT_camera(DataButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if ob:
-                       split.template_ID(context, ob, "data")
+                       split.template_ID(ob, "data")
                        split.itemS()
                elif arm:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
                        split.itemS()
 
                if cam:
index 869d29802e1d8e8ce1020790511bf717eefe7a2b..e60f9591d2907fe13629cc4bd3f26247bbaa412b 100644 (file)
@@ -26,10 +26,10 @@ class DATA_PT_shape_curve(DataButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if ob:
-                       split.template_ID(context, ob, "data")
+                       split.template_ID(ob, "data")
                        split.itemS()
                elif curve:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
                        split.itemS()
 
                if curve:
index 52a60ce617e99c7a4a035b96122ad2ee00f53171..a556aceb98dd67319fd1ded437ab7c990e5a35a6 100644 (file)
@@ -36,10 +36,10 @@ class DATA_PT_lamp(DataButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if ob:
-                       split.template_ID(context, ob, "data")
+                       split.template_ID(ob, "data")
                        split.itemS()
                elif lamp:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
                        split.itemS()
 
                layout.itemS()
index ad9b1b518b8eafea8c96e1d200ce020e29883be1..bf2aaad5a97865e79177947a649c32df4bc86686 100644 (file)
@@ -26,10 +26,10 @@ class DATA_PT_lattice(DataButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if ob:
-                       split.template_ID(context, ob, "data")
+                       split.template_ID(ob, "data")
                        split.itemS()
                elif lat:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
                        split.itemS()
 
                if lat:
index c103a0f70557cbb2e028ac222620b25aa4da6a2d..fb64f42c24a3d09b78076f969771fa2478d0e293 100644 (file)
@@ -26,10 +26,10 @@ class DATA_PT_mesh(DataButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if ob:
-                       split.template_ID(context, ob, "data")
+                       split.template_ID(ob, "data")
                        split.itemS()
                elif mesh:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
                        split.itemS()
 
                if mesh:
index bce16e78a40a59d834834f0089523c5e88268b62..5f4cdd3f8389ca7e9e218e57be37c3e7532c2bff 100644 (file)
@@ -27,10 +27,10 @@ class DATA_PT_shape_text(DataButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if ob:
-                       split.template_ID(context, ob, "data")
+                       split.template_ID(ob, "data")
                        split.itemS()
                elif curve:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
                        split.itemS()
 
                if curve:
index 124fba83608c9ea136fa9292200eda4ac92463c3..8b0ef82b62822c645dcb92e953293259c7e623f8 100644 (file)
@@ -40,10 +40,10 @@ class MATERIAL_PT_material(MaterialButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if ob and slot:
-                       split.template_ID(context, slot, "material", new="MATERIAL_OT_new")
+                       split.template_ID(slot, "material", new="MATERIAL_OT_new")
                        split.itemR(ob, "active_material_index", text="Active")
                elif mat:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
                        split.itemS()
 
                if mat:
index e03db78b7e44c44dda959c135e4ec74e7e8ee977..f82324db9d8e14341f74004292dd9d7643fa142c 100644 (file)
@@ -32,7 +32,7 @@ class PARTICLE_PT_particles(ParticleButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if psys:
-                       split.template_ID(context, psys, "settings")
+                       split.template_ID(psys, "settings")
 
                if psys:
                        #row = layout.row()
index de166cef796b880e64a765aa1253a13d038ae232..31908d5ec9c72b6c14a0e29165eda0fec132d20a 100644 (file)
@@ -43,7 +43,7 @@ class TEXTURE_PT_texture(TextureButtonsPanel):
 
                if ma or la or wo:
                        if slot:
-                               split.template_ID(context, slot, "texture", new="TEXTURE_OT_new")
+                               split.template_ID(slot, "texture", new="TEXTURE_OT_new")
                        else:
                                split.itemS()
 
@@ -54,7 +54,7 @@ class TEXTURE_PT_texture(TextureButtonsPanel):
                        elif wo:
                                split.itemR(wo, "active_texture_index", text="Active")
                elif tex:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
                        split.itemS()
 
                layout.itemS()
index d9516cb7900519979ad48e4131d9c6887b3b7705..39b5eca04ff284dbe028f716c7c2cb93061a6167 100644 (file)
@@ -37,9 +37,9 @@ class WORLD_PT_world(WorldButtonsPanel):
                split = layout.split(percentage=0.65)
 
                if scene:
-                       split.template_ID(context, scene, "world", new="WORLD_OT_new")
+                       split.template_ID(scene, "world", new="WORLD_OT_new")
                elif world:
-                       split.template_ID(context, space, "pin_id")
+                       split.template_ID(space, "pin_id")
 
                split.itemS()
 
index 7686304647067d3d8a0ee55506553c7989966c29..a669690b8bc18060beb831b9d517b33f97ccc4af 100644 (file)
@@ -15,7 +15,7 @@ class Buttons_HT_header(bpy.types.Header):
 
                if context.area.show_menus:
                        row = layout.row(align=True)
-                       row.itemM(context, "Buttons_MT_view", text="View")
+                       row.itemM("Buttons_MT_view", text="View")
                        
                row = layout.row()
                row.itemR(so, "buttons_context", expand=True, text="")
@@ -33,4 +33,4 @@ class Buttons_MT_view(bpy.types.Menu):
                col.itemR(so, "panel_alignment", expand=True)
 
 bpy.types.register(Buttons_HT_header)
-bpy.types.register(Buttons_MT_view)
\ No newline at end of file
+bpy.types.register(Buttons_MT_view)
index 3623b914942dc274bdd6595e6807b3c5a5db3afb..dc20ee2d6cd62ff499443c6d1c94b4b2d5c1a05a 100644 (file)
@@ -177,9 +177,9 @@ class IMAGE_MT_uvs(bpy.types.Menu):
 
                layout.itemS()
 
-               layout.itemM(context, "IMAGE_MT_uvs_transform")
-               layout.itemM(context, "IMAGE_MT_uvs_mirror")
-               layout.itemM(context, "IMAGE_MT_uvs_weldalign")
+               layout.itemM("IMAGE_MT_uvs_transform")
+               layout.itemM("IMAGE_MT_uvs_mirror")
+               layout.itemM("IMAGE_MT_uvs_weldalign")
 
                layout.itemS()
 
@@ -188,7 +188,7 @@ class IMAGE_MT_uvs(bpy.types.Menu):
 
                layout.itemS()
 
-               layout.itemM(context, "IMAGE_MT_uvs_showhide")
+               layout.itemM("IMAGE_MT_uvs_showhide")
 
 class IMAGE_HT_header(bpy.types.Header):
        __space_type__ = "IMAGE_EDITOR"
@@ -202,23 +202,23 @@ class IMAGE_HT_header(bpy.types.Header):
                show_paint = sima.show_paint
                show_uvedit = sima.show_uvedit
 
-               layout.template_header(context)
+               layout.template_header()
 
                # menus
                if context.area.show_menus:
                        row = layout.row()
-                       row.itemM(context, "IMAGE_MT_view")
+                       row.itemM("IMAGE_MT_view")
 
                        if show_uvedit:
-                               row.itemM(context, "IMAGE_MT_select")
+                               row.itemM("IMAGE_MT_select")
 
                        # XXX menuname= (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))? "Image*": "Image";
-                       row.itemM(context, "IMAGE_MT_image")
+                       row.itemM("IMAGE_MT_image")
 
                        if show_uvedit:
-                               row.itemM(context, "IMAGE_MT_uvs")
+                               row.itemM("IMAGE_MT_uvs")
 
-               layout.template_ID(context, sima, "image", new="IMAGE_OT_new", open="IMAGE_OT_open")
+               layout.template_ID(sima, "image", new="IMAGE_OT_new", open="IMAGE_OT_open")
 
                """
                /* image select */
@@ -595,9 +595,9 @@ class IMAGE_MT_uvs(bpy.types.Menu):
 
                layout.itemS()
 
-               layout.itemM(context, "IMAGE_MT_uvs_transform")
-               layout.itemM(context, "IMAGE_MT_uvs_mirror")
-               layout.itemM(context, "IMAGE_MT_uvs_weldalign")
+               layout.itemM("IMAGE_MT_uvs_transform")
+               layout.itemM("IMAGE_MT_uvs_mirror")
+               layout.itemM("IMAGE_MT_uvs_weldalign")
 
                layout.itemS()
 
@@ -606,7 +606,7 @@ class IMAGE_MT_uvs(bpy.types.Menu):
 
                layout.itemS()
 
-               layout.itemM(context, "IMAGE_MT_uvs_showhide")
+               layout.itemM("IMAGE_MT_uvs_showhide")
 
 class IMAGE_HT_header(bpy.types.Header):
        __space_type__ = "IMAGE_EDITOR"
@@ -620,23 +620,23 @@ class IMAGE_HT_header(bpy.types.Header):
                show_paint = sima.show_paint
                show_uvedit = sima.show_uvedit
 
-               layout.template_header(context)
+               layout.template_header()
 
                # menus
                if context.area.show_menus:
                        row = layout.row()
-                       row.itemM(context, "IMAGE_MT_view")
+                       row.itemM("IMAGE_MT_view")
 
                        if show_uvedit:
-                               row.itemM(context, "IMAGE_MT_select")
+                               row.itemM("IMAGE_MT_select")
 
                        # XXX menuname= (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))? "Image*": "Image";
-                       row.itemM(context, "IMAGE_MT_image")
+                       row.itemM("IMAGE_MT_image")
 
                        if show_uvedit:
-                               row.itemM(context, "IMAGE_MT_uvs")
+                               row.itemM("IMAGE_MT_uvs")
 
-               layout.template_ID(context, sima, "image", new="IMAGE_OT_new", open="IMAGE_OT_open")
+               layout.template_ID(sima, "image", new="IMAGE_OT_new", open="IMAGE_OT_open")
 
                """
                /* image select */
index f039eb3f7c3d5f6a579142a3cdc2a70d3be7b386..5a6ee5ea2aa43d82ced312fb876dde4c0b32084d 100644 (file)
@@ -10,11 +10,11 @@ class OUTLINER_HT_header(bpy.types.Header):
                sce = context.scene
                layout = self.layout
 
-               layout.template_header(context)
+               layout.template_header()
 
                if context.area.show_menus:
                        row = layout.row(align=True)
-                       row.itemM(context, "OUTLINER_MT_view")
+                       row.itemM("OUTLINER_MT_view")
                        
                row = layout.row()
                row.itemR(so, "display_mode", text="")
index 94858db81ad3e6f447905118e4e9d8a6f4b435ca..b64e7d8e0c439269540cf1b1275307ad9c6253cd 100644 (file)
@@ -15,21 +15,21 @@ class SEQUENCER_HT_header(bpy.types.Header):
                st = context.space_data
                layout = self.layout
 
-               layout.template_header(context)
+               layout.template_header()
                
                if context.area.show_menus:
                        row = layout.row()
-                       row.itemM(context, "SEQUENCER_MT_view")
+                       row.itemM("SEQUENCER_MT_view")
                        
                        row.itemR(st, "display_mode")
                        
                        layout.itemS()
                        
                        if st.display_mode == 'SEQUENCER':
-                               row.itemM(context, "SEQUENCER_MT_select")
-                               row.itemM(context, "SEQUENCER_MT_marker")
-                               row.itemM(context, "SEQUENCER_MT_add")
-                               row.itemM(context, "SEQUENCER_MT_strip")
+                               row.itemM("SEQUENCER_MT_select")
+                               row.itemM("SEQUENCER_MT_marker")
+                               row.itemM("SEQUENCER_MT_add")
+                               row.itemM("SEQUENCER_MT_strip")
                                layout.itemS()
                                row.itemO("SEQUENCER_OT_reload")
                        else:
@@ -151,7 +151,7 @@ class SEQUENCER_MT_add(bpy.types.Menu):
                layout.itemO("SEQUENCER_OT_sound_strip_add", text="Sound (Ram)")
                layout.item_booleanO("SEQUENCER_OT_sound_strip_add", "hd", True, text="Sound (Streaming)") # FFMPEG ONLY
                
-               layout.itemM(context, "SEQUENCER_MT_add_effect")
+               layout.itemM("SEQUENCER_MT_add_effect")
 
 
 class SEQUENCER_MT_add_effect(bpy.types.Menu):
index 42e5347ce6a652b69ecbbeac7f58520feb06603f..92e7639553f726c8a8c0d4d66f6ac72a42eb8a45 100644 (file)
@@ -14,14 +14,14 @@ class TEXT_HT_header(bpy.types.Header):
                text = st.text
                layout = self.layout
 
-               layout.template_header(context)
+               layout.template_header()
 
                if context.area.show_menus:
                        row = layout.row()
-                       row.itemM(context, "TEXT_MT_text")
+                       row.itemM("TEXT_MT_text")
                        if text:
-                               row.itemM(context, "TEXT_MT_edit")
-                               row.itemM(context, "TEXT_MT_format")
+                               row.itemM("TEXT_MT_edit")
+                               row.itemM("TEXT_MT_format")
 
                if text and text.modified:
                        row = layout.row()
@@ -33,7 +33,7 @@ class TEXT_HT_header(bpy.types.Header):
                row.itemR(st, "word_wrap", text="")
                row.itemR(st, "syntax_highlight", text="")
 
-               layout.template_ID(context, st, "text", new="TEXT_OT_new", open="TEXT_OT_open", unlink="TEXT_OT_unlink")
+               layout.template_ID(st, "text", new="TEXT_OT_new", open="TEXT_OT_open", unlink="TEXT_OT_unlink")
 
                if text:
                        row = layout.row()
@@ -217,9 +217,9 @@ class TEXT_MT_edit(bpy.types.Menu):
 
                layout.itemS()
 
-               layout.itemM(context, "TEXT_MT_edit_view")
-               layout.itemM(context, "TEXT_MT_edit_select")
-               layout.itemM(context, "TEXT_MT_edit_markers")
+               layout.itemM("TEXT_MT_edit_view")
+               layout.itemM("TEXT_MT_edit_select")
+               layout.itemM("TEXT_MT_edit_markers")
 
                layout.itemS()
 
@@ -228,7 +228,7 @@ class TEXT_MT_edit(bpy.types.Menu):
 
                layout.itemS()
 
-               layout.itemM(context, "TEXT_MT_edit_to3d")
+               layout.itemM("TEXT_MT_edit_to3d")
 
 bpy.types.register(TEXT_HT_header)
 bpy.types.register(TEXT_PT_properties)
index d06d4d4406ddff7ab45097086f6e056ff45d18df..c1c2f9a100ac2877b4e46510b4649b50c9348ec6 100644 (file)
@@ -189,8 +189,7 @@ void RNA_api_ui_layout(StructRNA *srna)
        api_ui_item_common(func);
 
        func= RNA_def_function(srna, "itemM", "uiItemM");
-       parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
-       RNA_def_property_flag(parm, PROP_REQUIRED);
+       RNA_def_function_flag(func, FUNC_USE_CONTEXT);
        api_ui_item_common(func);
        parm= RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu.");
        RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -206,12 +205,10 @@ void RNA_api_ui_layout(StructRNA *srna)
 
        /* templates */
        func= RNA_def_function(srna, "template_header", "uiTemplateHeader");
-       parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
-       RNA_def_property_flag(parm, PROP_REQUIRED);
+       RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
        func= RNA_def_function(srna, "template_ID", "uiTemplateID");
-       parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
-       RNA_def_property_flag(parm, PROP_REQUIRED);
+       RNA_def_function_flag(func, FUNC_USE_CONTEXT);
        api_ui_item_rna_common(func);
        RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block.");
        RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a new ID block.");