minor adjustments to python scripts to make them easier to run outside of blender.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 10 Aug 2010 18:21:33 +0000 (18:21 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 10 Aug 2010 18:21:33 +0000 (18:21 +0000)
release/scripts/ui/properties_data_armature_rigify.py
release/scripts/ui/properties_material.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_render.py
release/scripts/ui/space_info.py
release/scripts/ui/space_view3d_toolbar.py

index 070f1fb76787cc7b26aae3e09c0b78cc13526681..0dbd964acb596c08c2bf27a6e338b0ea11ae5288 100644 (file)
@@ -95,12 +95,13 @@ class DATA_PT_template(bpy.types.Panel):
         subsubrow.operator("pose.metarig_assign", text="Assign")
         subsubrow.operator("pose.metarig_clear", text="Clear")
 
-        subsubrow = subrow.split(percentage=0.8)
-        subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index]
-        subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index]
+        if self.templates:
+            subsubrow = subrow.split(percentage=0.8)
+            subsubrow.operator("pose.metarig_sample_add", text="Sample").metarig_type = self.templates[pose_templates.active_template_index]
+            subsubrow.operator("pose.metarig_sample_add", text="All").metarig_type = "" # self.templates[pose_templates.active_template_index]
 
-        sub = row.column(align=True)
-        sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
+            sub = row.column(align=True)
+            sub.operator("pose.metarig_reload", icon="FILE_REFRESH", text="")
 
 
 # operators
index d14c8c05c637663f420b7f31bfa5f868757dbe91..5034f4f40ae3abb1692e0463f8763bceca3d0d34 100644 (file)
@@ -24,7 +24,7 @@ from rna_prop_ui import PropertyPanel
 def active_node_mat(mat):
     # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
     # which settings from node-materials are used
-    if mat:
+    if mat is not None:
         mat_node = mat.active_node_material
         if mat_node:
             return mat_node
index 6923e60a3df9d280cbd8a33f61b359523a980bf0..3af0cdef1e464aa3afd4fad8aa2f0c312b141b93 100644 (file)
@@ -252,7 +252,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
         col.prop(ob, "time_offset_edit", text="Edit")
         row = col.row()
         row.prop(ob, "time_offset_particle", text="Particle")
-        row.active = len(ob.particle_systems) != 0
+        row.active = bool(ob.particle_systems)
         row = col.row()
         row.prop(ob, "time_offset_parent", text="Parent")
         row.active = (ob.parent is not None)
index cd11179dc2577976be87241a1a6245e801be10a6..6e8ebb1069132a48064b0794175d2f6a437518d7 100644 (file)
@@ -440,7 +440,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
         # Audio:
         sub = layout.column()
 
-        if rd.ffmpeg_format not in ('MP3'):
+        if rd.ffmpeg_format not in ('MP3'):
             sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
 
         sub.separator()
index 618cd3c51c9294a83690c81a48320eafcd83a0ea..db9e4df89673824e676ceec79a2328019534bade 100644 (file)
@@ -27,7 +27,7 @@ class INFO_HT_header(bpy.types.Header):
         layout = self.layout
 
         wm = context.manager
-        if wm and len(wm.operators):
+        if wm and wm.operators:
             last_op = wm.operators[-1]
         else:
             last_op = None
@@ -131,7 +131,7 @@ class INFO_MT_file_import(bpy.types.Menu):
     bl_label = "Import"
 
     def draw(self, context):
-        if "collada_import" in dir(bpy.ops.wm):
+        if hasattr(bpy.types, "WM_OT_collada_import"):
             self.layout.operator("wm.collada_import", text="COLLADA (.dae)")
 
 
@@ -140,7 +140,7 @@ class INFO_MT_file_export(bpy.types.Menu):
     bl_label = "Export"
 
     def draw(self, context):
-        if "collada_export" in dir(bpy.ops.wm):
+        if hasattr(bpy.types, "WM_OT_collada_export"):
             self.layout.operator("wm.collada_export", text="COLLADA (.dae)")
 
 
index 56abbb3cb1406b3ebe22d3b385c5b13743599bab..8981369f3b0901abfe926d9a3d24ce7f7dd3ffe5 100644 (file)
@@ -487,7 +487,7 @@ class PaintPanel():
         elif context.particle_edit_object:
             return ts.particle_edit
 
-        return False
+        return None
 
 
 class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
@@ -753,7 +753,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
             col.separator()
 
             col = layout.column()
-            col.active = tex_slot.map_mode in ('FIXED')
+            col.active = tex_slot.map_mode in ('FIXED')
             col.label(text="Angle:")
             
             col = layout.column()
@@ -963,6 +963,7 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
         layout = self.layout
 
         settings = self.paint_settings(context)
+
         brush = settings.brush
 
         layout.template_curve_mapping(brush, "curve", brush=True)