[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3698] contrib/py/scripts/addons/ oscurart_tools.py: Improves in Automatic Overrides Layout

Eugenio Pignataro info at oscurart.com.ar
Mon Sep 3 14:08:15 CEST 2012


Revision: 3698
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3698
Author:   oscurart
Date:     2012-09-03 12:08:15 +0000 (Mon, 03 Sep 2012)
Log Message:
-----------
Improves in Automatic Overrides Layout

Modified Paths:
--------------
    contrib/py/scripts/addons/oscurart_tools.py

Modified: contrib/py/scripts/addons/oscurart_tools.py
===================================================================
--- contrib/py/scripts/addons/oscurart_tools.py	2012-09-02 02:06:58 UTC (rev 3697)
+++ contrib/py/scripts/addons/oscurart_tools.py	2012-09-03 12:08:15 UTC (rev 3698)
@@ -247,18 +247,18 @@
         col.label(text="Example: [[Group,Material]]")
         col.prop(bpy.context.scene, '["OVERRIDE"]', text="")
         col.operator("render.check_overrides", text="Check List", icon="ZOOM_ALL")
+        col.operator("render.overrides_on", text="On / Off", icon="QUIT")        
 
         boxcol=layout.box().column(align=1)
         boxcol.label(text="Danger Zone")
         boxcolrow=boxcol.row()
         boxcolrow.operator("render.apply_overrides", text="Apply Overrides", icon="ERROR")
         boxcolrow.operator("render.restore_overrides", text="Restore Overrides", icon="ERROR")
-        boxcol.label(text="Automatic Overrides")
-        boxcolrow=boxcol.row()
-        boxcolrow.operator("render.overrides_on", text="On", icon="ERROR")
-        boxcolrow.operator("render.overrides_off", text="Off", icon="ERROR")        
 
 
+    
+
+
 ##---------------------------RELOAD IMAGES------------------
 
 class reloadImages (bpy.types.Operator):
@@ -2044,6 +2044,8 @@
     def execute (self, context):
         DefOscRestoreOverrides(self)        
         return {'FINISHED'}
+
+OVERRIDESSTATUS = False
     
 class OscOverridesOn(bpy.types.Operator):
     bl_idname = "render.overrides_on"
@@ -2051,19 +2053,22 @@
     bl_options = {"REGISTER", "UNDO"}
 
     def execute (self, context):
-        bpy.app.handlers.render_pre.append(DefOscApplyOverrides)
-        bpy.app.handlers.render_post.append(DefOscRestoreOverrides)      
+        
+        global OVERRIDESSTATUS
+        
+        if OVERRIDESSTATUS == False:
+            bpy.app.handlers.render_pre.append(DefOscApplyOverrides)
+            bpy.app.handlers.render_post.append(DefOscRestoreOverrides)  
+            OVERRIDESSTATUS = True
+            print("Overrides on!")
+        else:    
+            bpy.app.handlers.render_pre.remove(DefOscApplyOverrides)
+            bpy.app.handlers.render_post.remove(DefOscRestoreOverrides)    
+            OVERRIDESSTATUS = False
+            print("Overrides off!")           
         return {'FINISHED'}    
 
-class OscOverridesOff(bpy.types.Operator):
-    bl_idname = "render.overrides_off"
-    bl_label = "Turn Off Overrides"
-    bl_options = {"REGISTER", "UNDO"}
 
-    def execute (self, context):
-        bpy.app.handlers.render_pre.remove(DefOscApplyOverrides)
-        bpy.app.handlers.render_post.remove(DefOscRestoreOverrides)      
-        return {'FINISHED'}    
 
 
 
@@ -2343,8 +2348,8 @@
     bpy.utils.register_class(OscResymMesh)
     bpy.utils.register_class(DialogDistributeOsc)
     bpy.utils.register_class(OscOverridesOn)
-    bpy.utils.register_class(OscOverridesOff)
 
+
 def unregister():
     bpy.utils.unregister_class(OscPanelControl)
     bpy.utils.unregister_class(OscPanelObject)
@@ -2391,7 +2396,7 @@
     bpy.utils.unregister_class(OscResymMesh)
     bpy.utils.unregister_class(DialogDistributeOsc)
     bpy.utils.unregister_class(OscOverridesOn)
-    bpy.utils.unregister_class(OscOverridesOff)
 
+
 if __name__ == "__main__":
     register()



More information about the Bf-extensions-cvs mailing list