[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43481] trunk/blender/release/scripts/ startup/bl_ui: picky cleanup to use of bpy.types

Campbell Barton ideasman42 at gmail.com
Wed Jan 18 07:12:01 CET 2012


Revision: 43481
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43481
Author:   campbellbarton
Date:     2012-01-18 06:11:56 +0000 (Wed, 18 Jan 2012)
Log Message:
-----------
picky cleanup to use of bpy.types

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/__init__.py
    trunk/blender/release/scripts/startup/bl_ui/properties_game.py
    trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
    trunk/blender/release/scripts/startup/bl_ui/space_clip.py
    trunk/blender/release/scripts/startup/bl_ui/space_image.py

Modified: trunk/blender/release/scripts/startup/bl_ui/__init__.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/__init__.py	2012-01-18 05:54:19 UTC (rev 43480)
+++ trunk/blender/release/scripts/startup/bl_ui/__init__.py	2012-01-18 06:11:56 UTC (rev 43481)
@@ -86,7 +86,7 @@
 
     # space_userprefs.py
     from bpy.props import StringProperty, EnumProperty
-    WindowManager = bpy.types.WindowManager
+    from bpy.types import WindowManager
 
     def addon_filter_items(self, context):
         import addon_utils

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_game.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_game.py	2012-01-18 05:54:19 UTC (rev 43480)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_game.py	2012-01-18 06:11:56 UTC (rev 43481)
@@ -244,7 +244,7 @@
         return (rd.engine in cls.COMPAT_ENGINES)
 
 
-class RENDER_PT_embedded(RenderButtonsPanel, bpy.types.Panel):
+class RENDER_PT_embedded(RenderButtonsPanel, Panel):
     bl_label = "Embedded Player"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_texture.py	2012-01-18 05:54:19 UTC (rev 43480)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_texture.py	2012-01-18 06:11:56 UTC (rev 43481)
@@ -19,6 +19,14 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Menu, Panel
+
+from bpy.types import (Brush,
+                       Lamp,
+                       Material,
+                       ParticleSettings,
+                       Texture,
+                       World)
+
 from rna_prop_ui import PropertyPanel
 
 
@@ -91,7 +99,7 @@
         engine = context.scene.render.engine
         if not (hasattr(context, "texture_slot") or hasattr(context, "texture_node")):
             return False
-        return ((context.material or context.world or context.lamp or context.brush or context.texture or context.particle_system or isinstance(context.space_data.pin_id, bpy.types.ParticleSettings))
+        return ((context.material or context.world or context.lamp or context.brush or context.texture or context.particle_system or isinstance(context.space_data.pin_id, ParticleSettings))
             and (engine in cls.COMPAT_ENGINES))
 
     def draw(self, context):
@@ -103,14 +111,14 @@
         idblock = context_tex_datablock(context)
         pin_id = space.pin_id
 
-        if space.use_pin_id and not isinstance(pin_id, bpy.types.Texture):
+        if space.use_pin_id and not isinstance(pin_id, Texture):
             idblock = pin_id
             pin_id = None
 
         if not space.use_pin_id:
             layout.prop(space, "texture_context", expand=True)
 
-        tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, bpy.types.Brush))
+        tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, Brush))
 
         if tex_collection:
             row = layout.row()
@@ -413,7 +421,7 @@
         col = split.column()
 
         #Only for Material based textures, not for Lamp/World...
-        if slot and isinstance(idblock, bpy.types.Material):
+        if slot and isinstance(idblock, Material):
             col.prop(tex, "use_normal_map")
             row = col.row()
             row.active = tex.use_normal_map
@@ -801,7 +809,7 @@
     @classmethod
     def poll(cls, context):
         idblock = context_tex_datablock(context)
-        if isinstance(idblock, bpy.types.Brush) and not context.sculpt_object:
+        if isinstance(idblock, Brush) and not context.sculpt_object:
             return False
 
         if not getattr(context, "texture_slot", None):
@@ -818,7 +826,7 @@
         tex = context.texture_slot
         # textype = context.texture
 
-        if not isinstance(idblock, bpy.types.Brush):
+        if not isinstance(idblock, Brush):
             split = layout.split(percentage=0.3)
             col = split.column()
             col.label(text="Coordinates:")
@@ -847,7 +855,7 @@
                 split.label(text="Object:")
                 split.prop(tex, "object", text="")
 
-        if isinstance(idblock, bpy.types.Brush):
+        if isinstance(idblock, Brush):
             if context.sculpt_object:
                 layout.label(text="Brush Mapping:")
                 layout.prop(tex, "map_mode", expand=True)
@@ -856,7 +864,7 @@
                 row.active = tex.map_mode in {'FIXED', 'TILED'}
                 row.prop(tex, "angle")
         else:
-            if isinstance(idblock, bpy.types.Material):
+            if isinstance(idblock, Material):
                 split = layout.split(percentage=0.3)
                 split.label(text="Projection:")
                 split.prop(tex, "mapping", text="")
@@ -889,7 +897,7 @@
     @classmethod
     def poll(cls, context):
         idblock = context_tex_datablock(context)
-        if isinstance(idblock, bpy.types.Brush):
+        if isinstance(idblock, Brush):
             return False
 
         if not getattr(context, "texture_slot", None):
@@ -915,7 +923,7 @@
             sub.prop(tex, factor, text=name, slider=True)
             return sub  # XXX, temp. use_map_normal needs to override.
 
-        if isinstance(idblock, bpy.types.Material):
+        if isinstance(idblock, Material):
             if idblock.type in {'SURFACE', 'WIRE'}:
                 split = layout.split()
 
@@ -978,7 +986,7 @@
                 factor_but(col, "use_map_color_transmission", "transmission_color_factor", "Transmission Color")
                 factor_but(col, "use_map_color_reflection", "reflection_color_factor", "Reflection Color")
 
-        elif isinstance(idblock, bpy.types.Lamp):
+        elif isinstance(idblock, Lamp):
             split = layout.split()
 
             col = split.column()
@@ -987,7 +995,7 @@
             col = split.column()
             factor_but(col, "use_map_shadow", "shadow_factor", "Shadow")
 
-        elif isinstance(idblock, bpy.types.World):
+        elif isinstance(idblock, World):
             split = layout.split()
 
             col = split.column()
@@ -997,7 +1005,7 @@
             col = split.column()
             factor_but(col, "use_map_zenith_up", "zenith_up_factor", "Zenith Up")
             factor_but(col, "use_map_zenith_down", "zenith_down_factor", "Zenith Down")
-        elif isinstance(idblock, bpy.types.ParticleSettings):
+        elif isinstance(idblock, ParticleSettings):
             split = layout.split()
 
             col = split.column()
@@ -1028,7 +1036,7 @@
 
         layout.separator()
 
-        if not isinstance(idblock, bpy.types.ParticleSettings):
+        if not isinstance(idblock, ParticleSettings):
             split = layout.split()
 
             col = split.column()
@@ -1041,10 +1049,10 @@
             col.prop(tex, "invert", text="Negative")
             col.prop(tex, "use_stencil")
 
-        if isinstance(idblock, bpy.types.Material) or isinstance(idblock, bpy.types.World):
+        if isinstance(idblock, Material) or isinstance(idblock, World):
             col.prop(tex, "default_value", text="DVar", slider=True)
 
-        if isinstance(idblock, bpy.types.Material):
+        if isinstance(idblock, Material):
             layout.label(text="Bump Mapping:")
 
             # only show bump settings if activated but not for normal-map images
@@ -1063,7 +1071,7 @@
 class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
     _context_path = "texture"
-    _property_type = bpy.types.Texture
+    _property_type = Texture
 
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)

Modified: trunk/blender/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-01-18 05:54:19 UTC (rev 43480)
+++ trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-01-18 06:11:56 UTC (rev 43481)
@@ -117,7 +117,7 @@
         if settings.show_default_expanded:
             col = box.column()
             row = col.row(align=True)
-            label = bpy.types.CLIP_MT_tracking_settings_presets.bl_label
+            label = CLIP_MT_tracking_settings_presets.bl_label
             row.menu('CLIP_MT_tracking_settings_presets', text=label)
             row.operator("clip.tracking_settings_preset_add",
                          text="", icon='ZOOMIN')
@@ -999,7 +999,7 @@
     bl_label = "Camera Presets"
     preset_subdir = "tracking_camera"
     preset_operator = "script.execute_preset"
-    draw = bpy.types.Menu.draw_preset
+    draw = Menu.draw_preset
 
 
 class CLIP_MT_track_color_presets(Menu):
@@ -1007,7 +1007,7 @@
     bl_label = "Color Presets"
     preset_subdir = "tracking_track_color"
     preset_operator = "script.execute_preset"
-    draw = bpy.types.Menu.draw_preset
+    draw = Menu.draw_preset
 
 
 class CLIP_MT_tracking_settings_presets(Menu):
@@ -1015,7 +1015,7 @@
     bl_label = "Tracking Presets"
     preset_subdir = "tracking_settings"
     preset_operator = "script.execute_preset"
-    draw = bpy.types.Menu.draw_preset
+    draw = Menu.draw_preset
 
 
 class CLIP_MT_track_color_specials(Menu):

Modified: trunk/blender/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_image.py	2012-01-18 05:54:19 UTC (rev 43480)
+++ trunk/blender/release/scripts/startup/bl_ui/space_image.py	2012-01-18 06:11:56 UTC (rev 43481)
@@ -768,7 +768,7 @@
         row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
 
 
-class IMAGE_UV_sculpt_curve(bpy.types.Panel):
+class IMAGE_UV_sculpt_curve(Panel):
     bl_space_type = 'IMAGE_EDITOR'
     bl_region_type = 'UI'
     bl_label = "UV Sculpt Curve"



More information about the Bf-blender-cvs mailing list