[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4204] contrib/py/scripts/addons/ oscurart_tools.py: clear comments
Eugenio Pignataro
info at oscurart.com.ar
Fri Jan 25 15:27:01 CET 2013
Revision: 4204
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4204
Author: oscurart
Date: 2013-01-25 14:27:00 +0000 (Fri, 25 Jan 2013)
Log Message:
-----------
clear comments
Modified Paths:
--------------
contrib/py/scripts/addons/oscurart_tools.py
Modified: contrib/py/scripts/addons/oscurart_tools.py
===================================================================
--- contrib/py/scripts/addons/oscurart_tools.py 2013-01-25 02:09:09 UTC (rev 4203)
+++ contrib/py/scripts/addons/oscurart_tools.py 2013-01-25 14:27:00 UTC (rev 4204)
@@ -36,19 +36,14 @@
import bmesh
import time
import random
-
#r08
-
## CREA PANELES EN TOOLS
-
-# VARIABLES DE ENTORNO
bpy.types.Scene.osc_object_tools = bpy.props.BoolProperty(default=False)
bpy.types.Scene.osc_mesh_tools = bpy.props.BoolProperty(default=False)
bpy.types.Scene.osc_shapes_tools = bpy.props.BoolProperty(default=False)
bpy.types.Scene.osc_render_tools = bpy.props.BoolProperty(default=False)
bpy.types.Scene.osc_files_tools = bpy.props.BoolProperty(default=False)
bpy.types.Scene.osc_overrides_tools = bpy.props.BoolProperty(default=False)
-
# PANEL DE CONTROL
class OscPanelControl(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
@@ -67,8 +62,6 @@
col.prop(bpy.context.scene, "osc_render_tools", text="Render", icon="SCENE")
col.prop(bpy.context.scene, "osc_files_tools", text="Files", icon="IMASEL")
col.prop(bpy.context.scene, "osc_overrides_tools", text="Overrides", icon="GREASEPENCIL")
-
-
# POLLS
class OscPollObject():
bl_space_type = 'VIEW_3D'
@@ -170,7 +163,6 @@
colrow.operator("file.export_groups_osc", icon='GROUP_VCOL')
colrow.operator("file.import_groups_osc", icon='GROUP_VCOL')
-
class OscPanelShapes(OscPollShapes, bpy.types.Panel):
bl_idname = "Oscurart Shapes Tools"
bl_label = "Shapes Tools"
@@ -218,9 +210,7 @@
colrow.prop(bpy.context.scene, "use_render_scene", text="")
colrow.operator("render.render_selected_scenes_osc", icon="RENDER_STILL", text="Selected Scenes").frametype=False
colrow.operator("render.render_selected_scenes_osc", icon="RENDER_STILL", text="> Fame").frametype=True
-
-
class OscPanelFiles(OscPollFiles, bpy.types.Panel):
bl_idname = "Oscurart Files Tools"
bl_label = "Files Tools"
@@ -229,7 +219,6 @@
active_obj = context.active_object
layout = self.layout
col = layout.column(align=1)
-
colrow = col.row()
colrow.operator("file.save_incremental_osc", icon="NEW")
colrow.operator("image.reload_images_osc", icon="IMAGE_COL")
@@ -239,18 +228,14 @@
colrow.prop(bpy.context.scene, "oscReplaceText", text="")
col.operator("file.replace_file_path_osc", icon="SHORTDISPLAY")
-
class OscPanelOverrides(OscPollOverrides, bpy.types.Panel):
bl_idname = "Oscurart Overrides"
bl_label = "Overrides Tools"
def draw(self, context):
layout = self.layout
-
obj = context.object
-
col = layout.box().column(align=1)
-
colrow = col.row()
col.operator("render.overrides_set_list", text="Create Override List", icon="GREASEPENCIL")
col.label(text="Active Scene: " + bpy.context.scene.name)
@@ -266,9 +251,6 @@
boxcolrow.operator("render.restore_overrides", text="Restore Overrides", icon="ERROR")
-
-
-
##---------------------------RELOAD IMAGES------------------
class reloadImages (bpy.types.Operator):
@@ -284,59 +266,42 @@
def defReconst(self, OFFSET):
- ##EDIT
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
-
- ##SETEO VERTEX MODE
bpy.context.tool_settings.mesh_select_mode = (True, False, False)
OBJETO = bpy.context.active_object
OBDATA = bmesh.from_edit_mesh(OBJETO.data)
OBDATA.select_flush(False)
- ## IGUALO VERTICES CERCANOS A CERO
for vertice in OBDATA.verts[:]:
if abs(vertice.co[0]) < OFFSET:
vertice.co[0] = 0
- ##BORRA IZQUIERDA
bpy.ops.mesh.select_all(action="DESELECT")
for vertices in OBDATA.verts[:]:
if vertices.co[0] < 0:
vertices.select = 1
- ## BORRA COMPONENTES
+
bpy.ops.mesh.delete()
- ## SUMA MIRROR
bpy.ops.object.modifier_add(type='MIRROR')
- ## SELECCIONO TODOS LOS COMPONENTES
bpy.ops.mesh.select_all(action="SELECT")
- ## CREO UV TEXTURE DEL SIMETRICO
bpy.ops.mesh.uv_texture_add()
- ## SETEO VARIABLE CON LA CANTIDAD DE UVS, RESTO UNO Y LE DOY UN NOMBRE
LENUVLISTSIM = len(bpy.data.objects[OBJETO.name].data.uv_textures)
LENUVLISTSIM = LENUVLISTSIM - 1
OBJETO.data.uv_textures[LENUVLISTSIM:][0].name = "SYMMETRICAL"
- ## UNWRAP
bpy.ops.uv.unwrap(method='ANGLE_BASED', fill_holes=True, correct_aspect=False, use_subsurf_data=0)
- ## MODO OBJETO
bpy.ops.object.mode_set(mode="OBJECT", toggle= False)
- ## APLICO MIRROR
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Mirror")
- ## VUELVO A EDIT MODE
bpy.ops.object.mode_set(mode="EDIT", toggle= False)
OBDATA = bmesh.from_edit_mesh(OBJETO.data)
OBDATA.select_flush(0)
- ## CREO UV TEXTURE DEL ASIMETRICO
bpy.ops.mesh.uv_texture_add()
- ## SETEO VARIABLE CON LA CANTIDAD DE UVS, RESTO UNO Y LE DOY UN NOMBRE
LENUVLISTASIM = len(OBJETO.data.uv_textures)
LENUVLISTASIM = LENUVLISTASIM - 1
OBJETO.data.uv_textures[LENUVLISTASIM:][0].name = "ASYMMETRICAL"
- ## SETEO UV ACTIVO
OBJETO.data.uv_textures.active = OBJETO.data.uv_textures["ASYMMETRICAL"]
- ## UNWRAP
bpy.ops.uv.unwrap(method='ANGLE_BASED', fill_holes=True, correct_aspect=False, use_subsurf_data=0)
@@ -358,29 +323,21 @@
OBJECT = bpy.context.active_object
ODATA = bmesh.from_edit_mesh(OBJECT.data)
MODE = bpy.context.mode
-
-
- ##SETEO VERTEX MODE
-
bpy.context.tool_settings.mesh_select_mode = (True, False, False)
- ## DESELECCIONA TODO
for VERTICE in ODATA.verts[:]:
VERTICE.select = False
if nombre == False:
- ## CONDICION QUE SI EL VERTICE ES MENOR A 0 LO SELECCIONA
for VERTICES in ODATA.verts[:]:
if VERTICES.co[0] < (offset):
VERTICES.select = 1
else:
- ## CONDICION QUE SI EL VERTICE ES MENOR A 0 LO SELECCIONA
for VERTICES in ODATA.verts[:]:
if VERTICES.co[0] > (offset):
VERTICES.select = 1
ODATA.select_flush(False)
-
bpy.ops.object.mode_set(mode="EDIT", toggle=0)
@@ -401,15 +358,12 @@
##-----------------------------------CREATE SHAPES----------------
def DefSplitShapes(self,ACTIVESHAPE,LAYOUTCOMPAT):
- #PASO A OBJECT MODE
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
- ## VARIABLES
ACTOBJ=bpy.context.active_object
LENKB=len(ACTOBJ.data.shape_keys.key_blocks)
INDEX=ACTOBJ.active_shape_key_index
- ## RECORTO NOMBRES
if not LAYOUTCOMPAT:
for SHAPE in ACTOBJ.data.shape_keys.key_blocks:
if len(SHAPE.name) > 7:
@@ -429,7 +383,6 @@
bpy.ops.object.shape_key_clear()
else:
- ## DUPLICO SHAPES Y CONECTO GRUPO
for SHAPE in ACTOBJ.data.shape_keys.key_blocks[1:]:
SHAPE.value=1
bpy.ops.object.shape_key_add(from_mix=True)
@@ -470,28 +423,20 @@
SEL_OBJ= bpy.context.active_object
LISTA_KEYS = bpy.context.active_object.data.shape_keys.key_blocks[1:]
-
-
- ##MODOS
+
EDITMODE = "bpy.ops.object.mode_set(mode='EDIT')"
OBJECTMODE = "bpy.ops.object.mode_set(mode='OBJECT')"
POSEMODE = "bpy.ops.object.mode_set(mode='POSE')"
- ##INDICE DE DRIVERS
varindex = 0
-
- ##CREA NOMBRES A LA ARMATURE
amt = bpy.data.armatures.new("ArmatureData")
ob = bpy.data.objects.new("RIG_LAYOUT_"+SEL_OBJ.name, amt)
- ##LINK A LA ESCENA
scn = bpy.context.scene
scn.objects.link(ob)
scn.objects.active = ob
ob.select = True
-
- ## CREO DATA PARA SLIDERS
- ## creo data para los contenedores
+
verticess = [(-1,1,0),(1,1,0),(1,-1,0),(-1,-1,0)]
edgess = [(0,1),(1,2),(2,3),(3,0)]
mesh = bpy.data.meshes.new("%s_data_container" % (SEL_OBJ))
@@ -507,11 +452,9 @@
if keyblock.name[-2:] != "_L":
if keyblock.name[-2:] != "_R":
- ## OBJETO ACTIVO
scn.objects.active = ob
eval(EDITMODE)
-
- ##CREA HUESOS
+
bone = amt.edit_bones.new(keyblock.name)
bone.head = (gx,0,0)
bone.tail = (gx,0,1)
@@ -519,14 +462,11 @@
bonectrl = amt.edit_bones.new(keyblock.name+"_CTRL")
bonectrl.head = (gy,0,0)
bonectrl.tail = (gy,0,0.2)
-
- ##EMPARENTA HUESOS
- ## EMPARENTO
+
ob.data.edit_bones[bonectrl.name].parent = ob.data.edit_bones[bone.name]
bpy.context.scene.objects.active = ob
for SIDE in ["L","R"]:
- ##LE HAGO UNA VARIABLE
DR = SEL_OBJ.data.shape_keys.key_blocks[keyblock.name+"_"+SIDE].driver_add("value")
if SIDE == "L":
DR.driver.expression = "var+var_001"
@@ -548,7 +488,6 @@
eval(POSEMODE)
- ## SETEO ICONOS
ob.pose.bones[keyblock.name].custom_shape = object
ob.pose.bones[keyblock.name+"_CTRL"].custom_shape = object
CNS = ob.pose.bones[keyblock.name+"_CTRL"].constraints.new(type='LIMIT_LOCATION')
@@ -568,7 +507,7 @@
CNS.use_transform_limit = True
eval(OBJECTMODE)
- ## creo tipografias
+
bpy.ops.object.text_add(location=(gx,0,0))
gx = gx+2.2
gy = gy+2.2
@@ -593,10 +532,8 @@
##----------------------------CREATE LMR GROUPS-------------------
def createLMRGroups(self, FACTORVG, ADDVG):
- ## SETEO VERTEX MODE EDIT
bpy.context.window.screen.scene.tool_settings.mesh_select_mode = (True, False, False)
- ## VARIABLES
ACTOBJ=bpy.context.active_object
bpy.ops.object.mode_set(mode="EDIT", toggle=False)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list