Changeset 630
- Timestamp:
- 11/08/16 23:53:51 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
blender-povray-animation/frams-pov-import.py
r629 r630 304 304 return [obj.location.x, obj.location.y, obj.location.z, obj.location.x-m[0][2], obj.location.y-m[1][2], obj.location.z-m[2][2]] 305 305 306 def povUpdateScene(obj ):306 def povUpdateScene(obj,writepath): 307 307 global Folder,FirstFrame,FrameCount,Files,FirstPOV 308 308 print("Updating scene %s" % obj.name) … … 311 311 print("No files found for "+obj.name) 312 312 return 313 314 if writepath: 315 f=open(os.path.join(Folder,'camerapath.inc'),'w',encoding='latin-1') 316 f.write("#local CameraPathFirst=1;\n") 317 f.write("#local CameraPath=array["+str(len(Files))+"*2]\n") 318 f.write("{\n") 319 313 320 FirstFrame=obj.framspov_frame 314 321 FrameCount=obj.framspov_count … … 326 333 cam[4]-=obj.location.y 327 334 cam[5]-=obj.location.z 328 povUpdateFile(os.path.join(Folder,Files[k]),cam) 335 if writepath: 336 f.write((" <%g,%g,%g>,<%g,%g,%g>," % tuple(cam))+" //"+Files[k]+"\n") 337 else: 338 povUpdateFile(os.path.join(Folder,Files[k]),cam) 339 340 if writepath: 341 f.write(''' 342 } 343 #if ((AnimFrame>=CameraPathFirst) & ((AnimFrame-CameraPathFirst)<(dimension_size(CameraPath,1)/2))) 344 #local i=2*(AnimFrame-CameraPathFirst); 345 Camera(CameraPath[i],CameraPath[i+1]) 346 #end 347 ''') 348 f.close() 329 349 330 350 #################################### … … 373 393 row = layout.row() 374 394 row.operator("framspov.updatecam",icon='SCRIPT') 395 row = layout.row() 396 row.operator("framspov.writecamerapath",icon='SCRIPT') 375 397 376 398 … … 380 402 381 403 def execute(self, context): 382 povUpdateScene(context.object) 404 povUpdateScene(context.object,False) 405 return{'FINISHED'} 406 407 class VIEW3D_OT_WritePOVCameraPath(bpy.types.Operator): 408 bl_idname = "framspov.writecamerapath" 409 bl_label = "Write camerapath.inc" 410 411 def execute(self, context): 412 povUpdateScene(context.object,True) 383 413 return{'FINISHED'} 384 414 … … 389 419 bpy.utils.register_class(FramsticksPOVImporter) 390 420 bpy.utils.register_class(VIEW3D_OT_UpdatePOVCamera) 421 bpy.utils.register_class(VIEW3D_OT_WritePOVCameraPath) 391 422 bpy.utils.register_class(OBJECT_PT_framspov) 392 423 bpy.types.INFO_MT_file_import.append(menu_func_import) … … 395 426 bpy.utils.unregister_class(FramsticksPOVImporter) 396 427 bpy.utils.unregister_class(VIEW3D_OT_UpdatePOVCamera) 428 bpy.utils.unregister_class(VIEW3D_OT_WritePOVCameraPath) 397 429 bpy.utils.unregister_class(OBJECT_PT_framspov) 398 430 bpy.types.INFO_MT_file_import.remove(menu_func_import)
Note: See TracChangeset
for help on using the changeset viewer.