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)
main
Pullusb 2021-11-05 11:00:22 +01:00
parent d080a9cefa
commit b587794ac5
4 changed files with 37 additions and 8 deletions

View File

@ -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

View File

@ -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)

View File

@ -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": "",

2
fn.py
View File

@ -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')