partial autobuild
1.1.0 - added: `autobuild` button (partial auto-buildfor now) - added: make sent object selectedmain
parent
e086eb4050
commit
10c279c315
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- TODO
|
<!-- TODO
|
||||||
- need to let use choose output settings
|
- need to let user choose output settings
|
||||||
|
|
||||||
if objects has multiple user without being linked in render scene :
|
if objects has multiple user without being linked in render scene :
|
||||||
duplicate the object insteat of linking
|
duplicate the object insteat of linking
|
||||||
|
@ -14,6 +14,11 @@ Activate / deactivate layer opacity according to prefix
|
||||||
Activate / deactivate all masks using MA layers
|
Activate / deactivate all masks using MA layers
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
1.1.0
|
||||||
|
|
||||||
|
- added: `autobuild` button (partial auto-buildfor now)
|
||||||
|
- added: make sent object selected
|
||||||
|
|
||||||
1.0.3
|
1.0.3
|
||||||
|
|
||||||
- fixed: Send to render layer compatibility with blender 3.4
|
- fixed: Send to render layer compatibility with blender 3.4
|
||||||
|
|
|
@ -75,18 +75,20 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
if (render_wkspace := bpy.data.workspaces.get('GP Render')):
|
if (render_wkspace := bpy.data.workspaces.get('GP Render')):
|
||||||
context.window.workspace = render_wkspace
|
context.window.workspace = render_wkspace
|
||||||
else:
|
else:
|
||||||
render_wkspace_filepath = Path(bpy.utils.user_resource('SCRIPTS'), 'startup', 'GP', 'startup.blend')
|
render_wkspace_filepath = Path(bpy.utils.user_resource('SCRIPTS'), 'startup', 'bl_app_templates_user', 'GP', 'startup.blend')
|
||||||
|
print('render workspace', render_wkspace_filepath.exists())
|
||||||
ret = bpy.ops.workspace.append_activate(idname='GP Render', filepath=str(render_wkspace_filepath))
|
ret = bpy.ops.workspace.append_activate(idname='GP Render', filepath=str(render_wkspace_filepath))
|
||||||
|
print('ret: ', ret)
|
||||||
if ret != {'FINISHED'}:
|
if ret != {'FINISHED'}:
|
||||||
# Fallback to workspace template shipped with addon (TODO : add template blend file in addon)
|
# Fallback to workspace template shipped with addon (TODO : add template blend file in addon)
|
||||||
render_wkspace_filepath = Path(__file__).parent / 'workspaces' / 'startup.blend'
|
render_wkspace_filepath = Path(__file__).parent / 'workspaces' / 'startup.blend'
|
||||||
ret = bpy.ops.workspace.append_activate(idname='GP Render', filepath=str(render_wkspace_filepath))
|
ret = bpy.ops.workspace.append_activate(idname='GP Render', filepath=str(render_wkspace_filepath))
|
||||||
|
if ret != {'FINISHED'}:
|
||||||
|
print('No GP render workspace available')
|
||||||
|
|
||||||
## Group all adjacent layer type
|
## Group all adjacent layer type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Renumber File outputs
|
## Renumber File outputs
|
||||||
|
|
||||||
## Trigger check file before finishing ?
|
## Trigger check file before finishing ?
|
||||||
|
|
|
@ -114,30 +114,18 @@ def merge_layers(rlayers, obname=None, active=None, disconnect=True, color=None)
|
||||||
|
|
||||||
return ng, out
|
return ng, out
|
||||||
|
|
||||||
class GPEXP_OT_merge_viewlayers_to_active(bpy.types.Operator):
|
def merge_gplayer_viewlayers(ob, act=None, layers=None):
|
||||||
bl_idname = "gp.merge_viewlayers_to_active"
|
if act is None:
|
||||||
bl_label = "Merge selected layers view_layers"
|
|
||||||
bl_description = "Merge view layers of selected gp layers to on the active one"
|
|
||||||
bl_options = {"REGISTER"}
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def poll(cls, context):
|
|
||||||
return context.object and context.object.type == 'GPENCIL'
|
|
||||||
|
|
||||||
def execute(self, context):
|
|
||||||
ob = bpy.context.object
|
|
||||||
# layers = [l for l in ob.data.layers if l.select and not l.hide]
|
|
||||||
act = ob.data.layers.active
|
act = ob.data.layers.active
|
||||||
|
if layers is None:
|
||||||
layers = [l for l in ob.data.layers if l.select and l != act]
|
layers = [l for l in ob.data.layers if l.select and l != act]
|
||||||
|
|
||||||
if not act.viewlayer_render:
|
|
||||||
self.report({'ERROR'}, f'Active layer {act.info} has no viewlayer assigned')
|
|
||||||
return {'CANCELLED'}
|
|
||||||
|
|
||||||
rd_scn = bpy.data.scenes.get('Render')
|
rd_scn = bpy.data.scenes.get('Render')
|
||||||
if not rd_scn:
|
if not rd_scn:
|
||||||
self.report({'ERROR'}, 'Viewlayers needs to be generated first!')
|
return ({'ERROR'}, 'Viewlayers needs to be generated first!')
|
||||||
return {'CANCELLED'}
|
|
||||||
|
if not act.viewlayer_render:
|
||||||
|
return ({'ERROR'}, f'Active layer {act.info} has no viewlayer assigned')
|
||||||
|
|
||||||
# list layers and viewlayers
|
# list layers and viewlayers
|
||||||
vls = [rd_scn.view_layers.get(l.viewlayer_render) for l in layers
|
vls = [rd_scn.view_layers.get(l.viewlayer_render) for l in layers
|
||||||
|
@ -193,6 +181,35 @@ class GPEXP_OT_merge_viewlayers_to_active(bpy.types.Operator):
|
||||||
# if not vl.name in used_vl_name:
|
# if not vl.name in used_vl_name:
|
||||||
# rd_scn.view_layers.remove(vl)
|
# rd_scn.view_layers.remove(vl)
|
||||||
|
|
||||||
|
class GPEXP_OT_merge_viewlayers_to_active(bpy.types.Operator):
|
||||||
|
bl_idname = "gp.merge_viewlayers_to_active"
|
||||||
|
bl_label = "Merge selected layers view_layers"
|
||||||
|
bl_description = "Merge view layers of selected gp layers to on the active one"
|
||||||
|
bl_options = {"REGISTER"}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.object and context.object.type == 'GPENCIL'
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
ob = bpy.context.object
|
||||||
|
# layers = [l for l in ob.data.layers if l.select and not l.hide]
|
||||||
|
act = ob.data.layers.active
|
||||||
|
layers = [l for l in ob.data.layers if l.select and l != act]
|
||||||
|
|
||||||
|
## Tested in func
|
||||||
|
# rd_scn = bpy.data.scenes.get('Render')
|
||||||
|
# if not rd_scn:
|
||||||
|
# self.report({'ERROR'}, 'Viewlayers needs to be generated first!')
|
||||||
|
# return {'CANCELLED'}
|
||||||
|
|
||||||
|
# if not act.viewlayer_render:
|
||||||
|
# self.report({'ERROR'}, f'Active layer {act.info} has no viewlayer assigned')
|
||||||
|
# return {'CANCELLED'}
|
||||||
|
|
||||||
|
ret = merge_gplayer_viewlayers(ob, act=act, layers=layers)
|
||||||
|
if isinstance(ret, tuple):
|
||||||
|
self.report(*ret)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
class GPEXP_OT_merge_selected_dopesheet_layers(bpy.types.Operator):
|
class GPEXP_OT_merge_selected_dopesheet_layers(bpy.types.Operator):
|
||||||
|
|
|
@ -2,7 +2,7 @@ bl_info = {
|
||||||
"name": "GP Render",
|
"name": "GP Render",
|
||||||
"description": "Organise export of gp layers through compositor output",
|
"description": "Organise export of gp layers through compositor output",
|
||||||
"author": "Samuel Bernou",
|
"author": "Samuel Bernou",
|
||||||
"version": (1, 0, 2),
|
"version": (1, 1, 0),
|
||||||
"blender": (2, 93, 0),
|
"blender": (2, 93, 0),
|
||||||
"location": "View3D",
|
"location": "View3D",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
|
|
@ -235,6 +235,16 @@ def get_set_viewlayer_from_gp(ob, l, scene=None):
|
||||||
scene.collection.objects.link(ob)
|
scene.collection.objects.link(ob)
|
||||||
ob.hide_viewport = ob.hide_render = False
|
ob.hide_viewport = ob.hide_render = False
|
||||||
|
|
||||||
|
## set object active in default viewlayer
|
||||||
|
|
||||||
|
# if (avl := scene.view_layers.get('ViewLayer')):
|
||||||
|
# # This select the object in source scene
|
||||||
|
# avl.objects.active = ob
|
||||||
|
# # avl.objects.active.select_set(True)
|
||||||
|
nob = scene.collection.objects.get(ob.name)
|
||||||
|
if nob:
|
||||||
|
nob.select_set(True)
|
||||||
|
|
||||||
# create viewlayer
|
# create viewlayer
|
||||||
vl_name = f'{ob.name} / {l.info}'
|
vl_name = f'{ob.name} / {l.info}'
|
||||||
vl = fn.get_view_layer(vl_name, scene=scene)
|
vl = fn.get_view_layer(vl_name, scene=scene)
|
||||||
|
|
3
ui.py
3
ui.py
|
@ -174,8 +174,7 @@ class GPEXP_PT_gp_dopesheet_ui(Panel):
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
## TODO: add auto-build
|
layout.operator('gp_export.render_auto_build')
|
||||||
# layout.operator('gp_export.render_auto_build')
|
|
||||||
if context.object:
|
if context.object:
|
||||||
layout.label(text=f'Object: {context.object.name}')
|
layout.label(text=f'Object: {context.object.name}')
|
||||||
if context.object.data.users > 1:
|
if context.object.data.users > 1:
|
||||||
|
|
Loading…
Reference in New Issue