[Bf-extensions-cvs] [a173dd41] master: display tools: fix selection menu, selection restrict

meta-androcto noreply at git.blender.org
Wed Jun 21 01:51:47 CEST 2017


Commit: a173dd41c783118c9f8e045ee5006dce82482dd5
Author: meta-androcto
Date:   Wed Jun 21 09:51:23 2017 +1000
Branches: master
https://developer.blender.org/rBAa173dd41c783118c9f8e045ee5006dce82482dd5

display tools: fix selection menu, selection restrict

===================================================================

M	space_view3d_display_tools/__init__.py
M	space_view3d_display_tools/selection_restrictor.py

===================================================================

diff --git a/space_view3d_display_tools/__init__.py b/space_view3d_display_tools/__init__.py
index d76ca8e2..072b6ba4 100644
--- a/space_view3d_display_tools/__init__.py
+++ b/space_view3d_display_tools/__init__.py
@@ -387,23 +387,27 @@ class DisplayToolsPanel(Panel):
         col = box1.column(align=True)
         row = col.row(align=True)
         row.prop(display_tools, "UiTabDrop", index=4, text="Selection", icon=icon_active_4)
-
-        if SELECT2DROP:
+        if not SELECT2DROP:
+            row.operator("view3d.select_border", icon="MESH_PLANE", text="",)
+            row.operator("view3d.select_circle",icon="MESH_CIRCLE", text="")
+        else:
             col = layout.column(align=True)
             if obj and obj.mode == 'OBJECT':
+                col = layout.column(align=True)
+                col.label(text="Render Visibility:")
+                col.operator("op.render_show_all_selected", icon="RESTRICT_VIEW_OFF")
+                col.operator("op.render_hide_all_selected", icon="RESTRICT_VIEW_ON")
+                col.label(text="Show/Hide:")
                 col.operator("opr.show_hide_object", text="Show/Hide", icon="GHOST_ENABLED")
-            col.operator("opr.show_all_objects", text="Show All", icon="RESTRICT_VIEW_OFF")
-            col.operator("opr.hide_all_objects", text="Hide All", icon="RESTRICT_VIEW_ON")
-
-            col = layout.column(align=True)
-            col.operator("op.render_show_all_selected", icon="RESTRICT_VIEW_OFF")
-            col.operator("op.render_hide_all_selected", icon="RESTRICT_VIEW_ON")
+                col.operator("opr.show_all_objects", text="Show All", icon="RESTRICT_VIEW_OFF")
+                col.operator("opr.hide_all_objects", text="Hide All", icon="RESTRICT_VIEW_ON")
 
             if obj:
                 if obj.mode == 'OBJECT':
-                    layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
-                    layout.operator_menu_enum("object.hide_by_type", "type", text="Hide By Type")
                     layout.operator_menu_enum("object.show_by_type", "type", text="Show By Type")
+                    layout.operator_menu_enum("object.hide_by_type", "type", text="Hide By Type")
+                    layout.label(text="Selection:")
+                    layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
                     col = layout.column(align=True)
                     col.operator("opr.select_all", icon="MOD_MESHDEFORM")
                     col.operator("opr.inverse_selection", icon="MOD_REMESH")
@@ -421,9 +425,7 @@ class DisplayToolsPanel(Panel):
                 col.operator("opr.select_all", icon="MOD_MESHDEFORM")
                 col.operator("opr.inverse_selection", icon="MOD_REMESH")
 
-            col = layout.column(align=True)
-            col.operator("view3d.select_border", icon="MESH_PLANE")
-            col.operator("view3d.select_circle", icon="MESH_CIRCLE")
+
 
         # fast nav options
         col.separator()
diff --git a/space_view3d_display_tools/selection_restrictor.py b/space_view3d_display_tools/selection_restrictor.py
index 7f4cde87..feb3b8b8 100644
--- a/space_view3d_display_tools/selection_restrictor.py
+++ b/space_view3d_display_tools/selection_restrictor.py
@@ -20,7 +20,7 @@
 bl_info = {
     "name": "Selection Restrictor",
     "author": "Ales Sidenko",
-    "version": (0, 1),
+    "version": (0, 1, 1),
     "location": "3d viewer header",
     "warning": "",
     "description": "This addon helps to restrict the selection of objects by type. "
@@ -56,9 +56,9 @@ show = 'TRIA_RIGHT'
 show_restrictor = False
 hide = True
 
-# checking properties in scene to update icons when opening file of switching between scenes
-# (executing in end of script)
 
+# checking properties in scene to update icons when opening file
+# or switching between scenes (executing in end of script)
 
 @persistent
 def check_restrictors(dummy):
@@ -181,8 +181,8 @@ def check_restrictors(dummy):
         speak = 'SPEAKER'
     return{'FINISHED'}
 
-# hide or unhide buttons
 
+# Show / Hide buttons
 
 class RestrictorShow(Operator):
     bl_idname = "restrictor.show"
@@ -205,8 +205,8 @@ class RestrictorShow(Operator):
 
         return {'FINISHED'}
 
-# hide or unhide object to restrictor
 
+# Ignore the restrictor for selected objects
 
 class IgnoreRestrictors(Operator):
     bl_idname = "ignore.restrictors"
@@ -227,9 +227,10 @@ class IgnoreRestrictors(Operator):
 
         return{'FINISHED'}
 
-# enable or disable restrictors
-# restrictor for mesh
 
+# Enable or Disable restrictors
+
+# Restrictor Mesh
 
 class RestrictorMesh(Operator):
     bl_idname = "restrictor.mesh"
@@ -263,8 +264,8 @@ class RestrictorMesh(Operator):
 
         return{'FINISHED'}
 
-# restrictor for curves
 
+# Restrictor for Curves
 
 class RestrictorCurve(Operator):
     bl_idname = "restrictor.curve"
@@ -299,7 +300,8 @@ class RestrictorCurve(Operator):
         return{'FINISHED'}
 
 
-# restrictor for armatures
+# Restrictor for Armatures
+
 class RestrictorArm(Operator):
     bl_idname = "restrictor.arm"
     bl_label = "restrictor armatures"
@@ -332,12 +334,12 @@ class RestrictorArm(Operator):
 
         return{'FINISHED'}
 
-# restrictor for epties
 
+# Restrictor for Empties
 
 class RestrictorEmpty(Operator):
     bl_idname = "restrictor.empty"
-    bl_label = "restrictor empties"
+    bl_label = "Restrictor Empties"
     bl_option = {'REGISTER', 'UNDO'}
     bl_description = "Empties selection restrictor"
 
@@ -368,7 +370,8 @@ class RestrictorEmpty(Operator):
         return{'FINISHED'}
 
 
-# restrictor for cameras
+# Restrictor for Cameras
+
 class RestrictorCam(Operator):
     bl_idname = "restrictor.cam"
     bl_label = "restrictor cameras"
@@ -402,10 +405,11 @@ class RestrictorCam(Operator):
         return{'FINISHED'}
 
 
-# restrictor for lamps
+# Restrictor for Lamps
+
 class RestrictorLamp(Operator):
     bl_idname = "restrictor.lamp"
-    bl_label = "restrictor lamps"
+    bl_label = "Restrictor Lamps"
     bl_option = {'REGISTER', 'UNDO'}
     bl_description = "Lamps selection restrictor"
 
@@ -436,10 +440,11 @@ class RestrictorLamp(Operator):
         return{'FINISHED'}
 
 
-# restrictor for lattice
+# Restrictor for Lattice
+
 class RestrictorLat(Operator):
     bl_idname = "restrictor.lat"
-    bl_label = "restrictor lattices"
+    bl_label = "Restrictor Lattices"
     bl_option = {'REGISTER', 'UNDO'}
     bl_description = "Lattices selection restrictor"
 
@@ -468,12 +473,12 @@ class RestrictorLat(Operator):
 
         return{'FINISHED'}
 
-# restrictor for text
 
+# Restrictor Font
 
 class RestrictorFont(Operator):
     bl_idname = "restrictor.font"
-    bl_label = "restrictor font"
+    bl_label = "Restrictor Font"
     bl_option = {'REGISTER', 'UNDO'}
     bl_description = "Text selection restrictor"
 
@@ -502,8 +507,8 @@ class RestrictorFont(Operator):
 
         return{'FINISHED'}
 
-# restrictor for metaballs
 
+# Restrictor for Metaballs
 
 class RestrictorMeta(Operator):
     bl_idname = "restrictor.meta"
@@ -537,10 +542,11 @@ class RestrictorMeta(Operator):
         return{'FINISHED'}
 
 
-# restrictor for surfaces
+# Restrictor for Surfaces
+
 class RestrictorSurf(Operator):
     bl_idname = "restrictor.surf"
-    bl_label = "restrictor surfaces"
+    bl_label = "Restrictor Surfaces"
     bl_option = {'REGISTER', 'UNDO'}
     bl_description = "Surfaces selection restrictor"
 
@@ -570,7 +576,8 @@ class RestrictorSurf(Operator):
         return{'FINISHED'}
 
 
-# restrictor for speaks
+# Restrictor for Speakers
+
 class RestrictorSound(Operator):
     bl_idname = "restrictor.speak"
     bl_label = "Restrictor Speakers"
@@ -605,6 +612,7 @@ class RestrictorSound(Operator):
 
 
 # refresh restrictors for newly created objects
+
 class RefreshRestrictors(Operator):
     bl_idname = "refresh.restrictors"
     bl_label = "Refresh Selection Restrictors"
@@ -612,7 +620,6 @@ class RefreshRestrictors(Operator):
     bl_description = "Refresh restrictors"
 
     def execute(self, context):
-
         global mesh
         global curve
         global arm
@@ -625,167 +632,45 @@ class RefreshRestrictors(Operator):
         global surf
         global speak
 
-        # refresh meshes
-        if bpy.context.scene.get('meshrestrictor') is None:
-            mesh = 'OBJECT_DATA'
-            for ob in bpy.context.scene.objects:
-                if ob.type == 'MESH':
-                    if ob.get('ignore_restrictors') is None:
-                        ob.hide_select = False
-        else:
-            mesh = 'MESH_CUBE'
-            for ob in bpy.context.scene.objects:
-                if ob.type == 'MESH':
-                    if ob.get('ignore_restrictors') is None:
-                        ob.hide_select = True
-                        ob.select = False
-
-        # refresh curves
-        if bpy.context.scene.get('curverestrictor') is None:
-            curve = 'OUTLINER_OB_CURVE'
-            for ob in bpy.context.scene.objects:
-                if ob.type == 'CURVE':
-                    if ob.get('ignore_restrictors') is None:
-                        ob.hide_select = False
-        else:
-            curve = 'CURVE_DATA'
-            for ob in bpy.context.scene.objects:
-                if ob.type == 'CURVE':
-                    if ob.get('ignore_restrictors') is None:
-                        ob.hide_select = True
-                        ob.select = False
-        # refresh armatures
-        if bpy.context.scene.get('armrestrictor') is None:
-            arm = 'OUTLINER_OB_ARMATURE'
-            for ob in bpy.context.scene.objects:
-                if ob.type == 'ARMATURE':
-                    if ob.get('ignore_restrictors') is None:
-                        ob.hide_select = False
-        else:
-            arm = 'ARMATURE_DATA'
-            for ob in bpy.context.scene.objects:
-                if ob.type == 'ARMATURE':
-                    if ob.get('ignore_restrictors') is None:
-                        ob.hide_select = True
-                        ob.select = False
-        # refresh empties
-        if bpy.context.scene.get('emptyrestrictor') is None:
-            empty = 'OUTLIN

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list