From b587794ac5b6fe3d418c1e699dce71ff526daa69 Mon Sep 17 00:00:00 2001 From: Pullusb Date: Fri, 5 Nov 2021 11:00:22 +0100 Subject: [PATCH] fix crop json export and add extra ui 0.6.6 - fix: problem when creating Json - ui: add gp render extras panel in scene prop (closed by default) --- CHANGELOG.md | 4 ++++ OP_export_to_ae.py | 37 ++++++++++++++++++++++++++++++------- __init__.py | 2 +- fn.py | 2 ++ 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bd1d26..ed562f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ Activate / deactivate layer opaticty according to prefix Activate / deactivate all masks using MA layers --> +0.6.6 + +- fix: problem when creating Json +- ui: add gp render extras panel in scene prop (closed by default) 0.6.5 diff --git a/OP_export_to_ae.py b/OP_export_to_ae.py index 5e8173c..575bd8f 100644 --- a/OP_export_to_ae.py +++ b/OP_export_to_ae.py @@ -80,6 +80,7 @@ def export_AE_objects_position_keys(): blend = Path(bpy.data.filepath) keyfile = blend.parent / 'render' / f'pos_{name}.txt' + keyfile.parent.mkdir(parents=False, exist_ok=True) print(f'exporting keys for {name}') with open(keyfile, 'w') as fd: @@ -179,27 +180,49 @@ class GPEXP_OT_fix_overscan_shift(bpy.types.Operator): return {"FINISHED"} -def overcan_shift_fix_ui(self, context): - layout = self.layout - layout.operator("gp.fix_overscan_shift") +# ui panel +class GPEXP_PT_extra_gprender_func(bpy.types.Panel): + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "output" + bl_label = "GP Render Extras" + bl_parent_id = "RENDER_PT_format" if (3, 0, 0) <= bpy.app.version else "RENDER_PT_dimensions" + bl_options = {'DEFAULT_CLOSED'} + # COMPAT_ENGINES = {'CYCLES', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} + + # def draw_header(self, context): + # overscan = context.scene.camera_overscan + # self.layout.prop(overscan, "RO_Activate", text="") + + def draw(self, context): + layout = self.layout + layout.operator("gp.fix_overscan_shift") + layout.operator("gp.export_keys_to_ae") + + + +# def overcan_shift_fix_ui(self, context): +# layout = self.layout +# layout.operator("gp.fix_overscan_shift") classes=( GPEXP_OT_export_keys_to_ae, GPEXP_OT_fix_overscan_shift, +GPEXP_PT_extra_gprender_func ) def register(): for cls in classes: bpy.utils.register_class(cls) - if hasattr(bpy.types, 'RENDER_PT_overscan'): - bpy.types.RENDER_PT_overscan.append(overcan_shift_fix_ui) + # if hasattr(bpy.types, 'RENDER_PT_overscan'): + # bpy.types.RENDER_PT_overscan.append(overcan_shift_fix_ui) def unregister(): - if hasattr(bpy.types, 'RENDER_PT_overscan'): - bpy.types.RENDER_PT_overscan.remove(overcan_shift_fix_ui) + # if hasattr(bpy.types, 'RENDER_PT_overscan'): + # bpy.types.RENDER_PT_overscan.remove(overcan_shift_fix_ui) for cls in reversed(classes): bpy.utils.unregister_class(cls) diff --git a/__init__.py b/__init__.py index 0f02356..b4d69c0 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": (0, 6, 5), + "version": (0, 6, 6), "blender": (2, 93, 0), "location": "View3D", "warning": "", diff --git a/fn.py b/fn.py index 101298e..0550689 100644 --- a/fn.py +++ b/fn.py @@ -813,6 +813,7 @@ def export_crop_to_json(): blend = Path(bpy.data.filepath) json_path = blend.parent / 'render' / f'{blend.stem}.json' #f'{ob.name}.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' @@ -829,6 +830,7 @@ def export_crop_to_json(): coord_dic[ob.name] = scn_border if coord_dic: + json_path.parent.mkdir(parents=False, exist_ok=True) # save bbox with json_path.open('w') as fd: json.dump(coord_dic, fd, indent='\t')