[Bf-extensions-cvs] [c44a33b] master: Rewritten all render tools.

Eugenio Pignataro noreply at git.blender.org
Wed Mar 19 19:46:36 CET 2014


Commit: c44a33be6e23904e641a59863deff9cf5489b422
Author: Eugenio Pignataro
Date:   Wed Mar 19 15:46:05 2014 -0300
https://developer.blender.org/rBACc44a33be6e23904e641a59863deff9cf5489b422

Rewritten all render tools.

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

M	oscurart_tools/__init__.py
M	oscurart_tools/oscurart_meshes.py
M	oscurart_tools/oscurart_objects.py
M	oscurart_tools/oscurart_overrides.py
M	oscurart_tools/oscurart_render.py

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

diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py
index 1eb11e6..643fca6 100644
--- a/oscurart_tools/__init__.py
+++ b/oscurart_tools/__init__.py
@@ -20,7 +20,7 @@ bl_info = {
     "name": "Oscurart Tools",
     "author": "Oscurart, CodemanX",
     "version": (3,1),
-    "blender": (2, 65, 0),
+    "blender": (2, 7, 0),
     "location": "View3D > Tools > Oscurart Tools",
     "description": "Tools for objects, render, shapes, and files.",
     "warning": "",
@@ -152,7 +152,6 @@ class OscPanelObject(OscPollObject, bpy.types.Panel):
         colrow = col.row(align=1)
         colrow.prop(bpy.context.scene, "RenameObjectOt", text="")
         colrow.operator("object.rename_objects_osc", icon="SHORTDISPLAY")
-        col.operator("object.duplicate_object_symmetry_osc", icon="OBJECT_DATAMODE", text="Duplicate Symmetry")
         col.operator("object.distribute_osc", icon="OBJECT_DATAMODE", text="Distribute")
         colrow = col.row(align=1)
         colrow.operator("object.modifiers_remove_osc", icon="MODIFIER", text="Remove Modifiers")
diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py
index f097d02..67e1aa9 100644
--- a/oscurart_tools/oscurart_meshes.py
+++ b/oscurart_tools/oscurart_meshes.py
@@ -277,14 +277,17 @@ def DefOscOverlapUv(valprecision):
     ACTOBJ = bpy.context.object
     inicio= time.time()
     bpy.ops.mesh.faces_mirror_uv(direction='POSITIVE', precision=valprecision)
-    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.mode_set(mode='OBJECT') 
     SELUVVERT = [ver for ver in ACTOBJ.data.uv_layers[ACTOBJ.data.uv_textures.active.name].data[:] if ver.select]
     MAY = [ver for ver in SELUVVERT if ver.uv[0] > .5]
+
     
     for vl in MAY:
         vl.uv = (1-vl.uv[0],vl.uv[1])   
                    
     bpy.ops.object.mode_set(mode='EDIT')
+
+    
     print("Time elapsed: %4s seconds" % (time.time()-inicio))
 
 class OscOverlapUv(bpy.types.Operator):
diff --git a/oscurart_tools/oscurart_objects.py b/oscurart_tools/oscurart_objects.py
index 370a985..602912f 100644
--- a/oscurart_tools/oscurart_objects.py
+++ b/oscurart_tools/oscurart_objects.py
@@ -53,85 +53,6 @@ class renameObjectsOt (bpy.types.Operator):
         return {'FINISHED'}
 
 
-##------------------------ DUPLICATE OBJECTS SYMMETRY ------------------------
-
-def duplicateSymmetrical (self, disconect):
-    for objeto in bpy.context.selected_objects:
-
-        OBSEL = objeto
-        bpy.ops.object.select_all(action='DESELECT')
-        objeto.select = 1
-        bpy.context.scene.objects.active = objeto
-        bpy.ops.object.duplicate(linked=1)
-        OBDUP=bpy.context.active_object
-        print(OBDUP)
-        OBDUP.driver_add("location")
-        OBDUP.animation_data.drivers[0].driver.expression = "-var"
-        OBDUP.animation_data.drivers[0].driver.variables.new()
-        OBDUP.animation_data.drivers[0].driver.variables[0].type = "TRANSFORMS"
-        OBDUP.animation_data.drivers[0].driver.variables[0].targets[0].id = objeto
-        OBDUP.animation_data.drivers[0].driver.variables[0].targets[0].transform_type = 'LOC_X'
-        OBDUP.animation_data.drivers[1].driver.expression = "var"
-        OBDUP.animation_data.drivers[1].driver.variables.new()
-        OBDUP.animation_data.drivers[1].driver.variables[0].type = "TRANSFORMS"
-        OBDUP.animation_data.drivers[1].driver.variables[0].targets[0].id = objeto
-        OBDUP.animation_data.drivers[1].driver.variables[0].targets[0].transform_type = 'LOC_Y'
-        OBDUP.animation_data.drivers[2].driver.expression = "var"
-        OBDUP.animation_data.drivers[2].driver.variables.new()
-        OBDUP.animation_data.drivers[2].driver.variables[0].type = "TRANSFORMS"
-        OBDUP.animation_data.drivers[2].driver.variables[0].targets[0].id = objeto
-        OBDUP.animation_data.drivers[2].driver.variables[0].targets[0].transform_type = 'LOC_Z'
-        OBDUP.driver_add("scale")
-        OBDUP.animation_data.drivers[3].driver.expression = "-var"
-        OBDUP.animation_data.drivers[3].driver.variables.new()
-        OBDUP.animation_data.drivers[3].driver.variables[0].type = "TRANSFORMS"
-        OBDUP.animation_data.drivers[3].driver.variables[0].targets[0].id = objeto
-        OBDUP.animation_data.drivers[3].driver.variables[0].targets[0].transform_type = 'SCALE_X'
-        OBDUP.animation_data.drivers[4].driver.expression = "var"
-        OBDUP.animation_data.drivers[4].driver.variables.new()
-        OBDUP.animation_data.drivers[4].driver.variables[0].type = "TRANSFORMS"
-        OBDUP.animation_data.drivers[4].driver.variables[0].targets[0].id = objeto
-        OBDUP.animation_data.drivers[4].driver.variables[0].targets[0].transform_type = 'SCALE_Y'
-        OBDUP.animation_data.drivers[5].driver.expression = "var"
-        OBDUP.animation_data.drivers[5].driver.variables.new()
-        OBDUP.animation_data.drivers[5].driver.variables[0].type = "TRANSFORMS"
-        OBDUP.animation_data.drivers[5].driver.variables[0].targets[0].id = objeto
-        OBDUP.animation_data.drivers[5].driver.variables[0].targets[0].transform_type = 'SCALE_Z'
-        OBDUP.driver_add("rotation_euler")
-        OBDUP.animation_data.drivers[6].driver.expression = "var"
-        OBDUP.animation_data.drivers[6].driver.variables.new()
-        OBDUP.animation_data.drivers[6].driver.variables[0].type = "TRANSFORMS"
-        OBDUP.animation_data.drivers[6].driver.variables[0].targets[0].id = objeto
-        OBDUP.animation_data.drivers[6].driver.variables[0].targets[0].transform_type = 'ROT_X'
-        OBDUP.animation_data.drivers[7].driver.expression = "-var"
-        OBDUP.animation_data.drivers[7].driver.variables.new()
-        OBDUP.animation_data.drivers[7].driver.variables[0].type = "TRANSFORMS"
-        OBDUP.animation_data.drivers[7].driver.variables[0].targets[0].id = objeto
-        OBDUP.animation_data.drivers[7].driver.variables[0].targets[0].transform_type = 'ROT_Y'
-        OBDUP.animation_data.drivers[8].driver.expression = "-var"
-        OBDUP.animation_data.drivers[8].driver.variables.new()
-        OBDUP.animation_data.drivers[8].driver.variables[0].type = "TRANSFORMS"
-        OBDUP.animation_data.drivers[8].driver.variables[0].targets[0].id = objeto
-        OBDUP.animation_data.drivers[8].driver.variables[0].targets[0].transform_type = 'ROT_Z'
-
-        if disconect != True:
-            bpy.ops.object.make_single_user(obdata=True, object=True)
-            bpy.context.active_object.driver_remove("location")
-            bpy.context.active_object.driver_remove("rotation_euler")
-            bpy.context.active_object.driver_remove("scale")
-
-class oscDuplicateSymmetricalOp (bpy.types.Operator):
-    bl_idname = "object.duplicate_object_symmetry_osc"
-    bl_label = "Oscurart Duplicate Symmetrical"
-    bl_options = {"REGISTER", "UNDO"}
-
-    desconecta = bpy.props.BoolProperty(name="Keep Connection", default=True)
-
-    def execute(self,context):
-
-        duplicateSymmetrical(self, self.desconecta)
-
-        return {'FINISHED'}
 
 ##---------------------------REMOVE MODIFIERS Y APPLY MODIFIERS------------------
 
diff --git a/oscurart_tools/oscurart_overrides.py b/oscurart_tools/oscurart_overrides.py
index 9c702ed..cf42e69 100644
--- a/oscurart_tools/oscurart_overrides.py
+++ b/oscurart_tools/oscurart_overrides.py
@@ -24,49 +24,32 @@ class OverridesOp (bpy.types.Operator):
 ## ------------------------------------ APPLY AND RESTORE OVERRIDES --------------------------------------
 
 def DefOscApplyOverrides(self):
-    LISTMAT = []
-    PROPTOLIST = list(eval(bpy.context.scene['OVERRIDE']))
-    FILEPATH=bpy.data.filepath
-    ACTIVEFOLDER = os.path.split(FILEPATH)[0]
-    ENTFILEPATH= "%s_OVERRIDE.xml" %  (os.path.join(ACTIVEFOLDER, bpy.context.scene.name))    
-    
-    ## GUARDO MATERIALES DE OBJETOS EN GRUPOS        
-    LISTMAT = { OBJ : [SLOT.material for SLOT in OBJ.material_slots] for OBJ in bpy.data.objects if OBJ.type in {'MESH', 'META', 'CURVE'} }        
-    for OVERRIDE in PROPTOLIST:
-        for OBJECT in bpy.data.groups[OVERRIDE[0]].objects:
-            if OBJECT.type in {'MESH', 'META', 'CURVE'}: 
-                LENSLOTS = len(OBJECT.material_slots[:])
-                OBJECT.data.materials.clear()
-                for MATSLOT in range(LENSLOTS):
-                    OBJECT.data.materials.append(bpy.data.materials[OVERRIDE[1]])  
-                
-                #if len(OBJECT.material_slots) > 0:                   
-                #    for SLOT in OBJECT.material_slots[:]:
-                #        SLOT.material = bpy.data.materials[OVERRIDE[1]]                    
-                #else:
-                #    print ("* %s have not Material Slots" % (OBJECT.name))          
-    with open(ENTFILEPATH, mode="w") as file:    
-        file.write(str(LISTMAT))
-    
-    
-def DefOscRestoreOverrides(self):    
-    FILEPATH = bpy.data.filepath
-    ACTIVEFOLDER = os.path.split(FILEPATH)[0]
-    ENTFILEPATH = "%s_OVERRIDE.xml" %  (os.path.join(ACTIVEFOLDER, bpy.context.scene.name))
-        
-    with open(ENTFILEPATH, mode="r") as file:
-        RXML = file.readlines(0)
-    LISTMAT = dict(eval(RXML[0]))
-    # RESTAURO MATERIALES  DE OVERRIDES    
-    for OBJ in LISTMAT:    
-        OBJ.data.materials.clear()        
-        if OBJ.type in {'MESH', 'META', 'CURVE'}:
-            for SLOTIND, SLOT in enumerate(LISTMAT[OBJ]):
-                #OBJ.material_slots[SLOTIND].material = SLOT 
-                OBJ.data.materials.append(SLOT) 
+    types = {'MESH','META','CURVE'}
+    for ob in bpy.data.objects:
+        if ob.type in types:
+            if not len(ob.material_slots):
+                ob.data.materials.append(None)
+    slotlist = { ob : [sl.material for sl in ob.material_slots] for ob in bpy.data.objects if ob.type in types if len (ob.material_slots)} 
+    with open("%s_override.txt" % (os.path.join(os.path.dirname(bpy.data.filepath),bpy.context.scene.name)), mode="w") as file:
+        file.write(str(slotlist))
+    scene = bpy.context.scene    
+    proptolist = list(eval(scene['OVERRIDE']))   
+    for group, material in proptolist:
+        for object in bpy.data.groups[group].objects:
+            i

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list