[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3864] contrib/py/scripts/addons/ ui_layer_manager.py: clean up: removed large blocks of empty lines
Brendon Murphy
meta.androcto1 at gmail.com
Wed Oct 17 00:20:53 CEST 2012
Revision: 3864
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3864
Author: meta-androcto
Date: 2012-10-16 22:20:49 +0000 (Tue, 16 Oct 2012)
Log Message:
-----------
clean up: removed large blocks of empty lines
Modified Paths:
--------------
contrib/py/scripts/addons/ui_layer_manager.py
Modified: contrib/py/scripts/addons/ui_layer_manager.py
===================================================================
--- contrib/py/scripts/addons/ui_layer_manager.py 2012-10-16 05:49:46 UTC (rev 3863)
+++ contrib/py/scripts/addons/ui_layer_manager.py 2012-10-16 22:20:49 UTC (rev 3864)
@@ -37,14 +37,12 @@
EDIT = ["EDIT_MESH", "EDIT_CURVE", "EDIT_SURFACE", "EDIT_METABALL", "EDIT_TEXT", "EDIT_ARMATURE"]
-
class LayerGroups(bpy.types.PropertyGroup):
toggle = BoolProperty(name="",default=False)
lock = BoolProperty(name="",default=False)
-
-
+
layer_groups = BoolVectorProperty(name="Layer Groups", default = ([False]*20), size=20, subtype='LAYER')
# A list of identifiers (colon-separated strings) which property’s controls should be displayed
@@ -58,7 +56,6 @@
# Unused, but this is needed for the TemplateList to work…
bpy.types.Scene.layergroups_index = IntProperty(default=-1)
-
class RemoveLayerGroup(bpy.types.Operator):
'''Tooltip'''
bl_idname = "object.layergroup_remove"
@@ -81,7 +78,6 @@
return {'FINISHED'}
-
class AddLayerGroup(bpy.types.Operator):
'''Tooltip'''
bl_idname = "object.layergroup_add"
@@ -104,9 +100,7 @@
item = layergroups.add()
index_number= str(index)
-
-
-
+
if len(index_number)==2:
index_number = "0"+index_number
if len(index_number)==3:
@@ -120,7 +114,6 @@
return {'FINISHED'}
-
class LayerToggle(bpy.types.Operator):
'''Visualize this Layer, Shift-Click to select multiple layers'''
bl_idname = "object.layertoggle"
@@ -137,28 +130,20 @@
def poll(cls, context):
return context.scene
-
-
+
def execute(self, context):
-
-
+
spacecheck = self.spacecheck
scene = context.scene
layerN = self.layerN
-
-
-
-
-
-
+
if spacecheck:
space = context.area.spaces.active
else:
space = context.scene
-
-
+
if layerN==-1:
index = self.index_group
groups = scene.layergroups[index].layer_groups
@@ -171,16 +156,14 @@
for i in range(0,20):
union[i]= groups[i] or layers[i]
-
-
+
space.layers=union
layergroups.toggle=True
else:
for i in range(0,20):
union[i]= not groups[i] and layers[i]
-
-
+
space.layers=union
layergroups.toggle=False
@@ -191,32 +174,25 @@
if space.layers[layerN]:
toggle = False
else:
-
-
+
toggle= True
space.layers[layerN]=toggle
else:
-
-
+
layer = [False]*20
layer[layerN]=True
space.layers=layer
- #
-
+
if space.layers[layerN]:
toggle = False
-
-
-
+
return {'FINISHED'}
def invoke(self, context, event):
self.shift = event.shift
return self.execute(context)
-
-
class MergeSelected(bpy.types.Operator):
'''Move Selected Objects in this Layer Shift-Click to select multiple layers'''
bl_idname = "object.mergeselected"
@@ -226,14 +202,12 @@
#layer number
layerN = bpy.props.IntProperty()
-
@classmethod
def poll(cls, context):
return context.scene
-
-
+
def execute(self, context):
layerN = self.layerN
@@ -258,24 +232,19 @@
if obj.layers[layerN]:
toggle = False
else:
-
-
+
toggle= True
obj.layers[layerN]=toggle
else:
-
-
+
layer = [False]*20
layer[layerN]=True
obj.layers=layer
- #
-
+
if obj.layers[layerN]:
toggle = False
-
-
-
+
return {'FINISHED'}
def invoke(self, context, event):
@@ -294,8 +263,7 @@
#lock status
lock = bpy.props.BoolProperty()
-
-
+
index_group = bpy.props.IntProperty()
@classmethod
@@ -303,8 +271,7 @@
def poll(cls, context):
return context.scene
-
-
+
def execute(self, context):
scene = context.scene
@@ -326,33 +293,23 @@
layers = obj.layers
layergroup=[False]*20
-
-
-
+
for i in range (0,20):
layergroup[i]= layers[i] and groups[i]
if True in layergroup:
obj.hide_select=not lock
obj.select=False
-
-
+
scene.layergroups[index].lock=not lock
-
-
-
+
else:
if obj.layers[layerN]:
obj.hide_select=not lock
obj.select=False
-
-
+
scene.LockLayer[layerN]= not lock
-
-
-
-
-
+
return {'FINISHED'}
class SelectObjectsLayer(bpy.types.Operator):
@@ -362,8 +319,7 @@
select_obj = bpy.props.BoolProperty()
layerN = bpy.props.IntProperty()
-
-
+
@classmethod
def poll(cls, context):
return context.scene
@@ -380,45 +336,23 @@
if view_3d.layers_used[layerN]:
for obj in context.scene.objects:
-
-
+
if obj.layers[layerN]:
i = i+1
if obj.layers[layerN] and obj.select:
s = s+1
-
-
+
if s==i:
for obj in context.scene.objects:
if obj.layers[layerN]:
obj.select=False
-
-
-
-
-
+
else:
bpy.ops.object.select_by_layer(extend=True, layers=layerN+1)
-
-
-
-
-
-
-
-
return {'FINISHED'}
-
-
-
-
-
-
-
-
class AllLayersSelect(bpy.types.Operator):
'''Active all Layer in scene'''
bl_idname = "scene.layersselect"
@@ -426,7 +360,6 @@
vis = bpy.props.BoolProperty()
-
@classmethod
def poll(cls, context):
return context.scene
@@ -442,12 +375,10 @@
#check for lock camera and layer is active
if view_3d.lock_camera_and_layers is True:
space= scene
-
-
+
else:
space= view_3d
-
-
+
if not vis:
for i in range (0,20):
@@ -458,8 +389,7 @@
#deselect the other...
else:
space.layers[i]= False
-
-
+
else:
for i in range (0,20):
#select all layer
@@ -470,9 +400,6 @@
space.layers[active]=True
return {'FINISHED'}
-
-
-
class LayerName(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
@@ -510,8 +437,7 @@
#lock layer status
bpy.types.Scene.LockLayer = bpy.props.BoolVectorProperty(name="Lock Layer", default = ([False]*20), size=20)
-
-
+
#prop for show index
bpy.types.Scene.LayerIndex = bpy.props.BoolProperty(name="Show Index", default=False)
@@ -523,7 +449,6 @@
#toggle for merge
#bpy.types.Scene.MergeToggle = bpy.props.BoolVectorProperty(name="Merge Toggle", default = (False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False), size=20)
-
@classmethod
def poll(self, context):
try:
@@ -532,16 +457,9 @@
return False
def draw(self, context):
-
-
-
+
scene = context.scene
-
-
-
-
-
-
+
view_3d = context.area.spaces.active
#check for lock camera and layer is active
if view_3d.lock_camera_and_layers is True:
@@ -553,15 +471,11 @@
spacecheck=True
#row = layout.row(align=True)
-
-
-
-
+
vis=False
allIcon='RESTRICT_VIEW_OFF'
allText="Isolate active"
-
-
+
#check if there is a layer off
for layer in space.layers:
@@ -570,14 +484,9 @@
allIcon='RESTRICT_VIEW_ON'
allText="All Visible"
-
-
layout = self.layout
column = layout.column()
row = column.row()
-
-
-
col2= row.column()
#lock camera and layers button
@@ -598,55 +507,23 @@
col.alignment='RIGHT'
col.prop(scene, "ExtraOptions", text="Options")
-
-
-
+
col1= row.column()
-
-
+
#show index
col1.prop(scene, "LayerIndex", text="Index")
# hide empty
-
-
+
if context.object:
col1.alignment='RIGHT'
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list