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 scene
This commit is contained in:
+29
-2
@@ -1,4 +1,5 @@
|
||||
import bpy
|
||||
from pathlib import Path
|
||||
from . import gen_vlayer, fn
|
||||
|
||||
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...)
|
||||
## 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
|
||||
bpy.ops.gp.lower_layers_name()
|
||||
@@ -52,13 +57,35 @@ class GPEXP_OT_render_auto_build(bpy.types.Operator):
|
||||
## Trigger renumber by distance
|
||||
bpy.ops.gp.auto_number_object()
|
||||
|
||||
## Export layer infos ?
|
||||
bpy.ops.gp.export_infos_for_compo()
|
||||
## Export layer infos ? (skip if json already exists)
|
||||
bpy.ops.gp.export_infos_for_compo('INVOKE_DEFAULT', skip_check=True)
|
||||
|
||||
## Send all GP to render scene
|
||||
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
|
||||
|
||||
|
||||
|
||||
## Renumber File outputs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user