Guest User

Blender collection exclude and motion blur animation

a guest
Nov 12th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. import bpy
  2.  
  3. def turn_on(view_layer: bpy.types.ViewLayer, collection_include: bpy.types.Collection):
  4.     for layer_collection in view_layer.layer_collection.children['ScriptAnimated'].children:
  5.         if layer_collection.collection == collection_include:
  6.             layer_collection.exclude = False
  7.  
  8. def turn_off(view_layer: bpy.types.ViewLayer, collection_include: bpy.types.Collection):
  9.     for layer_collection in view_layer.layer_collection.children['ScriptAnimated'].children:
  10.         if layer_collection.collection == collection_include:
  11.             layer_collection.exclude = True
  12.  
  13. def every_frame(scene):
  14.     print("Frame Change", scene.frame_current)
  15.     view_layer = bpy.context.scene.view_layers['View Layer']
  16.    
  17.  #collection exclude animation
  18.     if scene.frame_current == 700:
  19.         turn_off(view_layer, bpy.data.collections["Отметки"])
  20.     elif scene.frame_current == 1001:
  21.         turn_on(view_layer, bpy.data.collections["Отметки"])
  22.    
  23.  #motion blur animation
  24.     if scene.frame_current == 2100:
  25.         bpy.context.scene.eevee.use_motion_blur = False
  26.     elif scene.frame_current == 2101:
  27.         bpy.context.scene.eevee.use_motion_blur = True
  28.  
  29. bpy.app.handlers.frame_change_pre.append(every_frame)
Advertisement
Add Comment
Please, Sign In to add comment