diff --git a/CHANGELOG.md b/CHANGELOG.md index 074ea7a..b0b7dd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ Activate / deactivate layer opacity according to prefix Activate / deactivate all masks using MA layers --> +1.3.6 + +- added: scene resolution in json crop pixels information, per objects +- changed: fixed name `crop_infos.json` for exported crop pixels information + 1.3.5 - added: button to exclude viewlayers and nodes by selection or by hided layers diff --git a/__init__.py b/__init__.py index e5ce3ff..6c12919 100644 --- a/__init__.py +++ b/__init__.py @@ -2,7 +2,7 @@ bl_info = { "name": "GP Render", "description": "Organise export of gp layers through compositor output", "author": "Samuel Bernou", - "version": (1, 3, 5), + "version": (1, 3, 6), "blender": (2, 93, 0), "location": "View3D", "warning": "", diff --git a/fn.py b/fn.py index f2910c4..544904e 100644 --- a/fn.py +++ b/fn.py @@ -1141,11 +1141,11 @@ def show_message_box(_message = "", _title = "Message Box", _icon = 'INFO'): ## -- camera framing and object anim checks -def get_bbox_3d(ob): +def get_bbox_3d(ob) -> list: bbox_coords = ob.bound_box return [ob.matrix_world @ Vector(b) for b in bbox_coords] -def is_render_included(o, scn): +def is_render_included(o, scn) -> bool: '''return True if object is in at least one non-excluded collection in all passed scene viewlayer ''' @@ -1162,7 +1162,7 @@ def is_render_included(o, scn): return False -def get_crop_pixel_coord(scn): +def get_crop_pixel_coord(scn) -> dict: # width height probably not needed. might need px_width = (scn.render.border_max_x - scn.render.border_min_x) * scn.render.resolution_x px_height = (scn.render.border_max_y - scn.render.border_min_y) * scn.render.resolution_y @@ -1180,18 +1180,22 @@ def get_crop_pixel_coord(scn): 'position_y' : round(pos_y), 'width' : round(px_width), 'height' : round(px_height), + 'scene_res_x': scn.render.resolution_x, + 'scene_res_y': scn.render.resolution_y, } return coord -def export_crop_to_json(): - '''Export crop to json coords for AE - ''' +def export_crop_to_json() -> dict: + '''Export crop to json coords for AE''' blend = Path(bpy.data.filepath) - json_path = blend.parent / 'render' / f'{blend.stem}.json' #f'{ob.name}.json' + ## Use a fixed name (easier to load from After effects) + json_path = blend.parent / 'render' / 'crop_infos.json' + ## Use blend name (to support version) + # json_path = blend.parent / 'render' / f'{blend.stem}.json' ## per scene : json_path = Path(bpy.data.filepath).parent / 'render' / f'{scn.name}.json' - # json_path = Path(bpy.data.filepath).parent / 'render' / f'{scn.name}.json' #f'{ob.name}.json' + # json_path = Path(bpy.data.filepath).parent / 'render' / f'{scn.name}.json' # f'{ob.name}.json' coord_dic = {}