MCPcopy Create free account
hub / github.com/BlendingJake/CubeSter / frame_handler

Function frame_handler

cubester.py:150–176  ·  view source on GitHub ↗

Update all image sequence CubeSter objects to have the correct colors for the current frame :param scene: the current scene

(scene)

Source from the content-addressed store, hash-verified

148
149
150def frame_handler(scene):
151 """
152 Update all image sequence CubeSter objects to have the correct colors for the current frame
153 :param scene: the current scene
154 """
155 layer = bpy.context.object.data.vertex_colors[0].data
156
157 for ob in scene.objects:
158 ob_props = ob.cs_properties
159 frame = scene.frame_current
160
161 if ob_props.cs_type == "sequence" and 0 <= frame < len(ob_props.color_data):
162 i = 0
163 if ob_props.mesh_type == "blocks":
164 for row in ob_props.color_data[frame].rows:
165 for color in row.colors:
166 for _ in range(24): # 6 faces, 4 vertices each
167 layer[i].color = color.color
168 i += 1
169 else:
170 # stop one short as there is one less row and column of vertices when the type is plane
171 rows = ob_props.color_data[frame].rows
172 for r in range(len(rows)-1):
173 for c in range(len(rows[0].colors)-1):
174 for _ in range(4):
175 layer[i].color = rows[r].colors[c].color
176 i += 1
177
178
179def image_update(_, context):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected