Changeset 578 for blender-povray-animation
- Timestamp:
- 08/09/16 21:29:40 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
blender-povray-animation/frams-pov-import.py
r499 r578 173 173 # build or update blender objects from a POV file 174 174 def updateBlender(SceneParent,num): 175 global Folder, Files, Current 175 global Folder, Files, Current, RecentlyCreated, RecentlyDisappeared 176 176 Incoming=analysePOV(os.path.join(Folder,Files[num])) 177 RecentlyCreated=[] 178 RecentlyDisappeared=[] 177 179 for oname,obj in Incoming.items(): 178 180 if not oname in Current: 179 181 # add object properties 180 182 print('Creature added:',oname) 183 RecentlyCreated.append(oname) 181 184 newobj=[] # will contain: [ parent, joint0, joint1, ... ] 182 185 Current[oname]=newobj … … 216 219 for field in ['location','rotation_euler','scale']: 217 220 bo.keyframe_insert(data_path=field,frame=bpy.context.scene.frame_current) 221 for oname,obj in Current.items(): 222 if not oname in Incoming: 223 RecentlyDisappeared.append(oname) 224 print('Creature disappeared:',oname) 218 225 219 226 # import a sequence of POV files, create object hiererchy, animate … … 222 229 global Folder, FileName 223 230 global Current, FirstFrame, FrameCount 231 global RecentlyCreated, RecentlyDisappeared 224 232 global SceneParent 225 233 global SkipFrames … … 249 257 break 250 258 print("Frame %d - loading POV %s" % (bpy.context.scene.frame_current,Files[k])) 251 updateBlender(SceneParent,k) 259 updateBlender(SceneParent,k) 260 if len(RecentlyDisappeared)>0 or len(RecentlyCreated)>0: 261 bpy.context.scene.frame_set(FirstFrame-FirstPOV+k-1) 262 for oname in RecentlyCreated: 263 obj=Current[oname] 264 for bo in obj: 265 bo.hide=True 266 bo.keyframe_insert(data_path="hide",frame=bpy.context.scene.frame_current) 267 for oname in RecentlyDisappeared: 268 obj=Current[oname] 269 for bo in obj: 270 bo.hide=False 271 bo.keyframe_insert(data_path="hide",frame=bpy.context.scene.frame_current) 272 bpy.context.scene.frame_set(FirstFrame-FirstPOV+k) 273 for oname in RecentlyCreated: 274 obj=Current[oname] 275 for bo in obj: 276 bo.hide=False 277 bo.keyframe_insert(data_path="hide",frame=bpy.context.scene.frame_current) 278 for oname in RecentlyDisappeared: 279 obj=Current[oname] 280 for bo in obj: 281 bo.hide=True 282 bo.keyframe_insert(data_path="hide",frame=bpy.context.scene.frame_current) 283 Current.pop(oname) 284 252 285 253 286 ###############################
Note: See TracChangeset
for help on using the changeset viewer.