[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56179] trunk/blender/release/scripts/ startup: code cleanup: minor improvements to scripts.

Campbell Barton ideasman42 at gmail.com
Sat Apr 20 15:23:53 CEST 2013


Revision: 56179
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56179
Author:   campbellbarton
Date:     2013-04-20 13:23:53 +0000 (Sat, 20 Apr 2013)
Log Message:
-----------
code cleanup: minor improvements to scripts.
- make wm-property operators use INTERNAL option.
- make console use str.expandtabs() rather then replacing tab->spaces.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/object_quick_effects.py
    trunk/blender/release/scripts/startup/bl_operators/sequencer.py
    trunk/blender/release/scripts/startup/bl_operators/vertexpaint_dirt.py
    trunk/blender/release/scripts/startup/bl_operators/wm.py
    trunk/blender/release/scripts/startup/bl_ui/space_console.py
    trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
    trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py

Modified: trunk/blender/release/scripts/startup/bl_operators/object_quick_effects.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/object_quick_effects.py	2013-04-20 13:22:08 UTC (rev 56178)
+++ trunk/blender/release/scripts/startup/bl_operators/object_quick_effects.py	2013-04-20 13:23:53 UTC (rev 56179)
@@ -435,8 +435,8 @@
         fake_context = context.copy()
         mesh_objects = [obj for obj in context.selected_objects
                         if (obj.type == 'MESH' and not 0.0 in obj.dimensions)]
-        min_co = Vector((100000, 100000, 100000))
-        max_co = Vector((-100000, -100000, -100000))
+        min_co = Vector((100000.0, 100000.0, 100000.0))
+        max_co = -min_co
 
         if not mesh_objects:
             self.report({'ERROR'}, "Select at least one mesh object")

Modified: trunk/blender/release/scripts/startup/bl_operators/sequencer.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/sequencer.py	2013-04-20 13:22:08 UTC (rev 56178)
+++ trunk/blender/release/scripts/startup/bl_operators/sequencer.py	2013-04-20 13:23:53 UTC (rev 56179)
@@ -126,10 +126,7 @@
 
     @classmethod
     def poll(cls, context):
-        if context.scene and context.scene.sequence_editor:
-            return True
-        else:
-            return False
+        return (context.scene and context.scene.sequence_editor)
 
     def execute(self, context):
         for s in context.scene.sequence_editor.sequences_all:

Modified: trunk/blender/release/scripts/startup/bl_operators/vertexpaint_dirt.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/vertexpaint_dirt.py	2013-04-20 13:22:08 UTC (rev 56178)
+++ trunk/blender/release/scripts/startup/bl_operators/vertexpaint_dirt.py	2013-04-20 13:23:53 UTC (rev 56179)
@@ -123,7 +123,7 @@
 
                 if dirt_only:
                     tone = min(tone, 0.5)
-                    tone *= 2
+                    tone *= 2.0
 
                 col[0] = tone * col[0]
                 col[1] = tone * col[1]

Modified: trunk/blender/release/scripts/startup/bl_operators/wm.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/wm.py	2013-04-20 13:22:08 UTC (rev 56178)
+++ trunk/blender/release/scripts/startup/bl_operators/wm.py	2013-04-20 13:23:53 UTC (rev 56179)
@@ -885,13 +885,11 @@
 
     @staticmethod
     def _lookup_rna_url(rna_id, verbose=True):
-        url = None
         for prefix, url_manual_mapping in bpy.utils.manual_map():
             rna_ref = WM_OT_doc_view_manual._find_reference(rna_id, url_manual_mapping, verbose=verbose)
             if rna_ref is not None:
                 url = prefix + rna_ref
-                break
-        return url
+                return url
 
     def execute(self, context):
         rna_id = _wm_doc_get_id(self.doc_id, do_url=False)
@@ -1040,10 +1038,10 @@
 
 
 class WM_OT_properties_edit(Operator):
-    """Internal use (edit a property data_path)"""
     bl_idname = "wm.properties_edit"
     bl_label = "Edit Property"
-    bl_options = {'REGISTER'}  # only because invoke_props_popup requires.
+    # register only because invoke_props_popup requires.
+    bl_options = {'REGISTER', 'INTERNAL'}
 
     data_path = rna_path
     property = rna_property
@@ -1128,10 +1126,9 @@
 
 
 class WM_OT_properties_add(Operator):
-    """Internal use (edit a property data_path)"""
     bl_idname = "wm.properties_add"
     bl_label = "Add Property"
-    bl_options = {'UNDO'}
+    bl_options = {'UNDO', 'INTERNAL'}
 
     data_path = rna_path
 
@@ -1165,6 +1162,7 @@
     "Jump to a different tab inside the properties editor"
     bl_idname = "wm.properties_context_change"
     bl_label = ""
+    bl_options = {'INTERNAL'}
 
     context = StringProperty(
             name="Context",
@@ -1180,7 +1178,7 @@
     """Internal use (edit a property data_path)"""
     bl_idname = "wm.properties_remove"
     bl_label = "Remove Property"
-    bl_options = {'UNDO'}
+    bl_options = {'UNDO', 'INTERNAL'}
 
     data_path = rna_path
     property = rna_property

Modified: trunk/blender/release/scripts/startup/bl_ui/space_console.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_console.py	2013-04-20 13:22:08 UTC (rev 56178)
+++ trunk/blender/release/scripts/startup/bl_ui/space_console.py	2013-04-20 13:23:53 UTC (rev 56179)
@@ -87,7 +87,7 @@
 
 def add_scrollback(text, text_type):
     for l in text.split("\n"):
-        bpy.ops.console.scrollback_append(text=l.replace('\t', '    '),
+        bpy.ops.console.scrollback_append(text=l.expandtabs(4),
                                           type=text_type)
 
 if __name__ == "__main__":  # only for live edit.

Modified: trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2013-04-20 13:22:08 UTC (rev 56178)
+++ trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2013-04-20 13:23:53 UTC (rev 56179)
@@ -555,7 +555,7 @@
 
             row.label("Cut To")
             for i in range(1, strip.channel):
-                row.operator("sequencer.cut_multicam", text=str(i)).camera = i
+                row.operator("sequencer.cut_multicam", text="%d" % i).camera = i
 
         col = layout.column(align=True)
         if strip.type == 'SPEED':

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-04-20 13:22:08 UTC (rev 56178)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-04-20 13:23:53 UTC (rev 56179)
@@ -664,6 +664,7 @@
                 for md in ob.modifiers:
                     if md.type == 'MULTIRES':
                         do_persistent = False
+                        break
 
                 if do_persistent:
                     col.prop(brush, "use_persistent")




More information about the Bf-blender-cvs mailing list