fix nodegroup socket error in blender 3.4
1.0.3 - fixed: Send to render layer compatibility with blender 3.4 - added: clear default nodes when creating new render scenemain
parent
8a5654e977
commit
e086eb4050
|
@ -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.0.3
|
||||||
|
|
||||||
|
- fixed: Send to render layer compatibility with blender 3.4
|
||||||
|
- added: clear default nodes when creating new render scene
|
||||||
|
|
||||||
1.0.2
|
1.0.2
|
||||||
|
|
||||||
- added: GP object with name starting with `.` are ignored from "all objects" operation (renaming, numbering, sending to render scene)
|
- added: GP object with name starting with `.` are ignored from "all objects" operation (renaming, numbering, sending to render scene)
|
||||||
|
|
|
@ -64,7 +64,8 @@ def export_gp_objects(oblist, exclude_list=[], scene=None):
|
||||||
class GPEXP_OT_add_objects_to_render(bpy.types.Operator):
|
class GPEXP_OT_add_objects_to_render(bpy.types.Operator):
|
||||||
bl_idname = "gp.add_object_to_render"
|
bl_idname = "gp.add_object_to_render"
|
||||||
bl_label = "Add all Gp Layer of active object as render nodes"
|
bl_label = "Add all Gp Layer of active object as render nodes"
|
||||||
bl_description = "Setup GP object in render scene\nNote: 'send all' mode skip hided objects"
|
bl_description = "Setup GP object in render scene\
|
||||||
|
\nNote: 'send all' mode skip hided objects"
|
||||||
bl_options = {"REGISTER"}
|
bl_options = {"REGISTER"}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import bpy
|
import bpy
|
||||||
|
from pathlib import Path
|
||||||
from . import gen_vlayer, fn
|
from . import gen_vlayer, fn
|
||||||
|
|
||||||
class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
|
@ -45,6 +46,10 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
## TODO: add colors to layers (specified in ENV or hardcoded for now...)
|
## TODO: add colors to layers (specified in ENV or hardcoded for now...)
|
||||||
## Option: Maybe find a way to create a color from prefix hash ? (wlways give unique color with same prefix on other project!)
|
## Option: Maybe find a way to create a color from prefix hash ? (wlways give unique color with same prefix on other project!)
|
||||||
|
|
||||||
|
render_scn = bpy.data.scenes.get('Render')
|
||||||
|
if render_scn:
|
||||||
|
self.report({'ERROR'}, 'A "Render" scene already exists')
|
||||||
|
return {'CANCELLED'}
|
||||||
|
|
||||||
## Trigger rename lowercase
|
## Trigger rename lowercase
|
||||||
bpy.ops.gp.lower_layers_name()
|
bpy.ops.gp.lower_layers_name()
|
||||||
|
@ -52,14 +57,36 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||||
## Trigger renumber by distance
|
## Trigger renumber by distance
|
||||||
bpy.ops.gp.auto_number_object()
|
bpy.ops.gp.auto_number_object()
|
||||||
|
|
||||||
## Export layer infos ?
|
## Export layer infos ? (skip if json already exists)
|
||||||
bpy.ops.gp.export_infos_for_compo()
|
bpy.ops.gp.export_infos_for_compo('INVOKE_DEFAULT', skip_check=True)
|
||||||
|
|
||||||
## Send all GP to render scene
|
## Send all GP to render scene
|
||||||
bpy.ops.gp.add_object_to_render(mode="ALL")
|
bpy.ops.gp.add_object_to_render(mode="ALL")
|
||||||
|
|
||||||
|
## Switch to new Render Scene
|
||||||
|
render_scn = bpy.data.scenes.get('Render')
|
||||||
|
if not render_scn:
|
||||||
|
self.report({'ERROR'}, 'No render scene found')
|
||||||
|
return {'CANCELLED'}
|
||||||
|
context.window.scene = render_scn
|
||||||
|
|
||||||
|
## Change to GP workspace (if needed)
|
||||||
|
if context.window.workspace.name != 'GP Render':
|
||||||
|
if (render_wkspace := bpy.data.workspaces.get('GP Render')):
|
||||||
|
context.window.workspace = render_wkspace
|
||||||
|
else:
|
||||||
|
render_wkspace_filepath = Path(bpy.utils.user_resource('SCRIPTS'), 'startup', 'GP', 'startup.blend')
|
||||||
|
ret = bpy.ops.workspace.append_activate(idname='GP Render', filepath=str(render_wkspace_filepath))
|
||||||
|
if ret != {'FINISHED'}:
|
||||||
|
# Fallback to workspace template shipped with addon (TODO : add template blend file in addon)
|
||||||
|
render_wkspace_filepath = Path(__file__).parent / 'workspaces' / 'startup.blend'
|
||||||
|
ret = bpy.ops.workspace.append_activate(idname='GP Render', filepath=str(render_wkspace_filepath))
|
||||||
|
|
||||||
|
|
||||||
## 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 ?
|
||||||
|
|
|
@ -61,9 +61,16 @@ class GPEXP_OT_export_infos_for_compo(bpy.types.Operator):
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.object and context.object.type == 'GPENCIL'
|
return context.object and context.object.type == 'GPENCIL'
|
||||||
|
|
||||||
def invoke(self, context, event):
|
skip_check : bpy.props.BoolProperty(default=False, options={'SKIP_SAVE'})
|
||||||
|
|
||||||
|
def invoke(self, context, event):
|
||||||
self.l_infos = Path(bpy.data.filepath).parent / 'render' / 'infos.json'
|
self.l_infos = Path(bpy.data.filepath).parent / 'render' / 'infos.json'
|
||||||
|
if self.skip_check:
|
||||||
|
if self.l_infos.exists():
|
||||||
|
# Preferably skip if already user defined ?
|
||||||
|
return {'FINISHED'}
|
||||||
|
return self.execute(context)
|
||||||
|
|
||||||
if self.l_infos.exists():
|
if self.l_infos.exists():
|
||||||
return context.window_manager.invoke_props_dialog(self)
|
return context.window_manager.invoke_props_dialog(self)
|
||||||
return self.execute(context)
|
return self.execute(context)
|
||||||
|
|
5
fn.py
5
fn.py
|
@ -229,7 +229,10 @@ def get_render_scene():
|
||||||
|
|
||||||
render_scn.use_nodes = True
|
render_scn.use_nodes = True
|
||||||
|
|
||||||
# TODO Clear node tree (initial view layer stuff)
|
## Clear node tree (initial view layer stuff)
|
||||||
|
render_scn.node_tree.nodes.clear()
|
||||||
|
# for n in reversed(render_scn.node_tree.nodes):
|
||||||
|
# render_scn.node_tree.nodes.remove(n)
|
||||||
|
|
||||||
set_settings(render_scn)
|
set_settings(render_scn)
|
||||||
render_scn['use_aa'] = True
|
render_scn['use_aa'] = True
|
||||||
|
|
|
@ -106,7 +106,7 @@ def connect_render_layer(rlayer, ng=None, out=None, frame=None):
|
||||||
if not rlayer.outputs['Image'].is_linked:
|
if not rlayer.outputs['Image'].is_linked:
|
||||||
sockin = ng.inputs.get(vl_name)
|
sockin = ng.inputs.get(vl_name)
|
||||||
if not sockin:
|
if not sockin:
|
||||||
sockin = ng.inputs.new('NodeSocketColor', vl_name)
|
sockin = ng.node_tree.inputs.new('NodeSocketColor', vl_name)
|
||||||
sockin = ng.inputs[-1]
|
sockin = ng.inputs[-1]
|
||||||
|
|
||||||
links.new(rlayer.outputs['Image'], sockin)
|
links.new(rlayer.outputs['Image'], sockin)
|
||||||
|
@ -144,7 +144,7 @@ def connect_render_layer(rlayer, ng=None, out=None, frame=None):
|
||||||
aa = fn.create_aa_nodegroup(ngroup)# fn.new_aa_node(ngroup)
|
aa = fn.create_aa_nodegroup(ngroup)# fn.new_aa_node(ngroup)
|
||||||
groupout = ng.outputs.get(vl_name)
|
groupout = ng.outputs.get(vl_name)
|
||||||
if not groupout:
|
if not groupout:
|
||||||
ng.outputs.new('NodeSocketColor', vl_name) # assigning direcly doesn't link well
|
ng.node_tree.outputs.new('NodeSocketColor', vl_name) # assigning direcly doesn't link well
|
||||||
groupout = ng.outputs[-1]
|
groupout = ng.outputs[-1]
|
||||||
|
|
||||||
# print('ng_out.inputs.get(vl_name): ', ng_out.inputs.get(vl_name))
|
# print('ng_out.inputs.get(vl_name): ', ng_out.inputs.get(vl_name))
|
||||||
|
|
Loading…
Reference in New Issue