[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3398] contrib/py/scripts/addons/ oscurart_futurism.py: Bug Fix in drivers

Eugenio Pignataro info at oscurart.com.ar
Sat May 26 02:28:08 CEST 2012


Revision: 3398
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3398
Author:   oscurart
Date:     2012-05-26 00:28:06 +0000 (Sat, 26 May 2012)
Log Message:
-----------
Bug Fix in drivers

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

Modified: contrib/py/scripts/addons/oscurart_futurism.py
===================================================================
--- contrib/py/scripts/addons/oscurart_futurism.py	2012-05-25 23:58:06 UTC (rev 3397)
+++ contrib/py/scripts/addons/oscurart_futurism.py	2012-05-26 00:28:06 UTC (rev 3398)
@@ -38,25 +38,20 @@
     OBJLIST=[] # LISTA PARA OBJETOS ????
     FC=FS # FRAME CURRENT
     OBJNUMBER=1 # SUFIJO DE NUMERO PARA OBJETOS
-    STEPINC=0 # NUMERO PARA EVALUAR LOS PASOS    
-    # SETEO EL FRAME CURRENT
-    bpy.context.scene.frame_set(FS)  
+    STEPINC=0 # NUMERO PARA EVALUAR LOS PASOS        
+    bpy.context.scene.frame_set(FS)  # SETEO EL FRAME CURRENT    
+    OBACT = bpy.context.active_object # SETEO EL OBJETO ACTIVO
     
-    OBACT = bpy.context.active_object
-    
-
-    
     ## CREO EMPTY
     bpy.ops.object.add()
     bpy.context.active_object.name = "FuturismContainer"
-    EMPTY = bpy.context.active_object
+    EMPTY = bpy.context.active_object   
     
-    
-    # SUMO PARAMETERS AL OBJECT
+    # SUMO PARAMETERS AL EMPTY
     EMPTY["FUTURISM_HOLDIN"] = 0
     EMPTY["FUTURISM_HOLDOUT"] = 0    
     
-    bpy.context.scene.objects.active = OBACT  
+    bpy.context.scene.objects.active = OBACT  # RECUPERO OBJETO ACTIVO 
     
     for OBJETO in range((FE+1)-FS):
         if STEPINC == STEP:
@@ -84,22 +79,21 @@
             OBJECT.animation_data.drivers[0].driver.variables[2].targets[0].id= EMPTY
             OBJECT.animation_data.drivers[0].driver.variables[2].targets[0].data_path = '["FUTURISM_HOLDOUT"]'     
             
-            # MARCO EXPRESIONES PARA RENDER
-            OBJECT.animation_data.drivers[0].driver.variables.new()
-            OBJECT.animation_data.drivers[0].driver.variables.new()
-            OBJECT.animation_data.drivers[0].driver.variables.new()            
+            # MARCO EXPRESIONES PARA RENDER           
             OBJECT.driver_add("hide_render")
             OBJECT.animation_data.drivers[1].driver.variables.new()
+            OBJECT.animation_data.drivers[1].driver.variables.new()
+            OBJECT.animation_data.drivers[1].driver.variables.new()         
             OBJECT.animation_data.drivers[1].driver.expression= "False if frame >= %s+5 and frame <= %s else True" % (str(FC),str(FC+HOLD))
             OBJECT.animation_data.drivers[1].driver.variables[0].targets[0].id_type = 'SCENE'
             OBJECT.animation_data.drivers[1].driver.variables[0].targets[0].id= bpy.context.scene
             OBJECT.animation_data.drivers[1].driver.variables[0].targets[0].data_path = "current_frame"   
-            OBJECT.animation_data.drivers[0].driver.variables[1].targets[0].id_type = 'OBJECT'
-            OBJECT.animation_data.drivers[0].driver.variables[1].targets[0].id= EMPTY
-            OBJECT.animation_data.drivers[0].driver.variables[1].targets[0].data_path = '["FUTURISM_HOLDIN"]'  
-            OBJECT.animation_data.drivers[0].driver.variables[2].targets[0].id_type = 'OBJECT'
-            OBJECT.animation_data.drivers[0].driver.variables[2].targets[0].id= EMPTY
-            OBJECT.animation_data.drivers[0].driver.variables[2].targets[0].data_path = '["FUTURISM_HOLDOUT"]'                       
+            OBJECT.animation_data.drivers[1].driver.variables[1].targets[0].id_type = 'OBJECT'
+            OBJECT.animation_data.drivers[1].driver.variables[1].targets[0].id= EMPTY
+            OBJECT.animation_data.drivers[1].driver.variables[1].targets[0].data_path = '["FUTURISM_HOLDIN"]'  
+            OBJECT.animation_data.drivers[1].driver.variables[2].targets[0].id_type = 'OBJECT'
+            OBJECT.animation_data.drivers[1].driver.variables[2].targets[0].id= EMPTY
+            OBJECT.animation_data.drivers[1].driver.variables[2].targets[0].data_path = '["FUTURISM_HOLDOUT"]'                       
             # RESETEO STEPINC
             STEPINC=0
             # COPIAMOS S R T
@@ -108,9 +102,7 @@
             OBJECT.parent=EMPTY
         # AVANZO STEP Y FRAME
         FC+=1
-        STEPINC+=1
-        
-    
+        STEPINC+=1    
 
 # CLASE PARA OPERADOR
 class Oscurart_futurism (bpy.types.Operator):
@@ -123,6 +115,10 @@
     
     hold = bpy.props.IntProperty(name='Hold', default=0, min=0)
 
+    @classmethod
+    def poll(cls, context):
+        return(bpy.context.active_object.type == "MESH" ) 
+
     def execute(self, context):
         object_osc_futurism(self, context, self.scale, self.hold)
 
@@ -149,4 +145,4 @@
 
 
 if __name__ == '__main__':
-    register()
+    register()
\ No newline at end of file



More information about the Bf-extensions-cvs mailing list