fix set anim_cam resolution if not there
parent
73e82b1cad
commit
3bd39cbed4
|
@ -10,8 +10,6 @@ from .. import core
|
||||||
|
|
||||||
|
|
||||||
def set_resolution_from_cam_prop(cam=None):
|
def set_resolution_from_cam_prop(cam=None):
|
||||||
rd = bpy.context.scene.render
|
|
||||||
|
|
||||||
if not cam:
|
if not cam:
|
||||||
cam = bpy.context.scene.camera
|
cam = bpy.context.scene.camera
|
||||||
if not cam:
|
if not cam:
|
||||||
|
@ -19,9 +17,9 @@ def set_resolution_from_cam_prop(cam=None):
|
||||||
|
|
||||||
res = cam.get('resolution')
|
res = cam.get('resolution')
|
||||||
if not res:
|
if not res:
|
||||||
cam['resolution'] = [rd.resolution_x, rd.resolution_y]
|
return ('ERROR', 'Cam has no resolution attribute')
|
||||||
return ('INFO', 'Cam resolution set from scene')
|
|
||||||
|
|
||||||
|
rd = bpy.context.scene.render
|
||||||
if rd.resolution_x == res[0] and rd.resolution_y == res[1]:
|
if rd.resolution_x == res[0] and rd.resolution_y == res[1]:
|
||||||
return ('INFO', f'Resolution already at {res[0]}x{res[1]}')
|
return ('INFO', f'Resolution already at {res[0]}x{res[1]}')
|
||||||
else:
|
else:
|
||||||
|
@ -40,6 +38,8 @@ class BPM_OT_swap_cams(Operator):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
rd = bpy.context.scene.render
|
||||||
|
|
||||||
anim_cam = bpy.context.scene.objects.get('anim_cam')
|
anim_cam = bpy.context.scene.objects.get('anim_cam')
|
||||||
bg_cam = bpy.context.scene.objects.get('bg_cam')
|
bg_cam = bpy.context.scene.objects.get('bg_cam')
|
||||||
|
|
||||||
|
@ -47,13 +47,17 @@ class BPM_OT_swap_cams(Operator):
|
||||||
self.report({'ERROR'}, 'anim_cam or bg_cam is missing')
|
self.report({'ERROR'}, 'anim_cam or bg_cam is missing')
|
||||||
return {"CANCELLED"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
|
if anim_cam:
|
||||||
|
res = anim_cam.get('resolution')
|
||||||
|
if not res:
|
||||||
|
anim_cam['resolution'] = [rd.resolution_x, rd.resolution_y]
|
||||||
|
|
||||||
cam = context.scene.camera
|
cam = context.scene.camera
|
||||||
if not cam:
|
if not cam:
|
||||||
context.scene.camera = anim_cam
|
context.scene.camera = anim_cam
|
||||||
set_resolution_from_cam_prop()
|
set_resolution_from_cam_prop()
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
in_draw = False
|
in_draw = False
|
||||||
if cam.parent and cam.name in ('draw_cam', 'action_cam'):
|
if cam.parent and cam.name in ('draw_cam', 'action_cam'):
|
||||||
if cam.name == 'draw_cam':
|
if cam.name == 'draw_cam':
|
||||||
|
|
Loading…
Reference in New Issue