[Bf-extensions-cvs] [dcaf576] master: Code Cleanup

Eugenio Pignataro noreply at git.blender.org
Tue Mar 25 19:12:28 CET 2014


Commit: dcaf57606c99c89aba95442a01366e2b298c1785
Author: Eugenio Pignataro
Date:   Tue Mar 25 15:12:17 2014 -0300
https://developer.blender.org/rBACdcaf57606c99c89aba95442a01366e2b298c1785

Code Cleanup

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

M	oscurart_tools/__init__.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 2012244..5a734cc 100644
--- a/oscurart_tools/__init__.py
+++ b/oscurart_tools/__init__.py
@@ -269,10 +269,10 @@ class OscPanelOverrides(OscPollOverrides, bpy.types.Panel):
         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.operator("render.overrides_set_list", text="Create Override List", icon="GREASEPENCIL")
         col.label(text="Active Scene: " + bpy.context.scene.name)
         col.label(text="Example: [[Group,Material]]")
-        col.prop(bpy.context.scene, '["OVERRIDE"]', text="")
+        col.prop(bpy.context.scene, "overrides", text="")
         col.operator("render.check_overrides", text="Check List", icon="ZOOM_ALL")
         col.operator("render.overrides_on", text="On / Off", icon="QUIT")   
         col.label(text=str("OVERRIDES: ON" if bpy.use_overrides else "OVERRIDES: OFF"))             
diff --git a/oscurart_tools/oscurart_overrides.py b/oscurart_tools/oscurart_overrides.py
index cf42e69..8f71ddb 100644
--- a/oscurart_tools/oscurart_overrides.py
+++ b/oscurart_tools/oscurart_overrides.py
@@ -8,18 +8,7 @@ import time
 ##--------------------------OVERRIDES-----------------------------
 
 ## PARA ESCENAS NUEVAS
-
-class OverridesOp (bpy.types.Operator):
-    bl_idname = "render.overrides_set_list"
-    bl_label = "Overrides set list"
-    bl_options = {"REGISTER", "UNDO"}
-    def execute(self,context):
-        for scene in bpy.data.scenes[:]:
-            try:
-                scene['OVERRIDE']
-            except:
-                scene['OVERRIDE']="[]"
-        return {'FINISHED'}
+bpy.types.Scene.overrides = bpy.props.StringProperty(default="[]")
 
 ## ------------------------------------ APPLY AND RESTORE OVERRIDES --------------------------------------
 
@@ -33,7 +22,7 @@ def DefOscApplyOverrides(self):
     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']))   
+    proptolist = list(eval(scene.overrides))   
     for group, material in proptolist:
         for object in bpy.data.groups[group].objects:
             if object.type in types:
@@ -120,7 +109,7 @@ class OscCheckOverrides (bpy.types.Operator):
 
             print("   %s Scene is checking" % (SCENE.name))
 
-            for OVERRIDE in list(eval(SCENE['OVERRIDE'])):
+            for OVERRIDE in list(eval(SCENE.overrides)):
                 # REVISO OVERRIDES EN GRUPOS
                 if OVERRIDE[0] in GROUPLIST:
                     pass
@@ -249,7 +238,7 @@ class OscTransferOverrides (bpy.types.Operator):
         # CREO LISTA
         OSCOV = [[OVERRIDE.grooverride,OVERRIDE.matoverride]for OVERRIDE in bpy.context.scene.ovlist[:] if OVERRIDE.matoverride != "" if OVERRIDE.grooverride != ""]
 
-        bpy.context.scene["OVERRIDE"] = str(OSCOV)
+        bpy.context.scene.overrides = str(OSCOV)
         return {'FINISHED'}   
     
 class OscAddOverridesSlot (bpy.types.Operator):    
diff --git a/oscurart_tools/oscurart_render.py b/oscurart_tools/oscurart_render.py
index 39e02ff..4737faa 100644
--- a/oscurart_tools/oscurart_render.py
+++ b/oscurart_tools/oscurart_render.py
@@ -3,22 +3,11 @@ import math
 import os
 
 
-## ------------- CHECK OVERRIDE LIST EXIST -----------------
-
-def checkOverridesExist():
-    for scene in bpy.data.scenes[:]:
-        try:
-            scene["OVERRIDE"]
-        except:
-            scene["OVERRIDE"] = "[]"
-
-
 ##-------------------------------- RENDER ALL SCENES ----------------------------
 
 
 def defRenderAll (frametype, scenes):
 
-    checkOverridesExist()
     
     activescene = bpy.context.scene
     FC = bpy.context.scene.frame_current
@@ -129,7 +118,6 @@ bpy.types.Scene.rcPARTS = bpy.props.IntProperty(default=0, min=2, max=50, step=1
 
 def OscRenderCropFunc():
     
-    checkOverridesExist()
     
     SCENENAME = os.path.split(bpy.data.filepath)[-1].partition(".")[0]
     PARTS = bpy.context.scene.rcPARTS
@@ -155,7 +143,6 @@ class renderCrop (bpy.types.Operator):
 ##---------------------------BATCH MAKER------------------
 def defoscBatchMaker(TYPE):
     
-    checkOverridesExist() # overrides list exist
     
     if os.sys.platform.startswith("w"):
         print("PLATFORM: WINDOWS")
@@ -231,7 +218,6 @@ class oscBatchMaker (bpy.types.Operator):
 ## --------------------------------------PYTHON BATCH--------------------------------------------------------
 def defoscPythonBatchMaker(BATCHTYPE,SIZE):
     
-    checkOverridesExist() # overrides list exist
     
     # REVISO SISTEMA
     if os.sys.platform.startswith("w"):



More information about the Bf-extensions-cvs mailing list