bridge reconnect nodegroup on clean
0.5.1 - feat: reconnect existing sockets inside nodegroups with clean nodes > re-ordermain
parent
2aa4ecc00e
commit
65c7142786
|
@ -14,6 +14,10 @@ Activate / deactivate layer opaticty according to prefix
|
|||
Activate / deactivate all masks using MA layers
|
||||
-->
|
||||
|
||||
0.5.1
|
||||
|
||||
- feat: reconnect existing sockets inside nodegroups with clean nodes > re-order
|
||||
|
||||
0.5.0
|
||||
|
||||
- feat: add a render operator that render all scene
|
||||
|
|
|
@ -136,6 +136,8 @@ class GPEXP_OT_clean_compo_tree(bpy.types.Operator):
|
|||
|
||||
# Clear input that do not exists
|
||||
fn.clean_nodegroup_inputs(n, skip_existing_pass=True)
|
||||
|
||||
fn.bridge_reconnect_nodegroup(n)
|
||||
|
||||
if self.fo_clear_disconnected:
|
||||
for fo in nodes:
|
||||
|
@ -143,7 +145,6 @@ class GPEXP_OT_clean_compo_tree(bpy.types.Operator):
|
|||
continue
|
||||
fn.clear_disconnected(fo)
|
||||
|
||||
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ bl_info = {
|
|||
"name": "GP Render",
|
||||
"description": "Organise export of gp layers through compositor output",
|
||||
"author": "Samuel Bernou",
|
||||
"version": (0, 5, 0),
|
||||
"version": (0, 5, 1),
|
||||
"blender": (2, 93, 0),
|
||||
"location": "View3D",
|
||||
"warning": "",
|
||||
|
|
25
fn.py
25
fn.py
|
@ -447,6 +447,31 @@ def clean_nodegroup_inputs(ng, skip_existing_pass=True):
|
|||
|
||||
# clear_nodegroup_content_if_disconnected(ngroup)
|
||||
|
||||
def bridge_reconnect_nodegroup(ng, socket_name=None):
|
||||
'''
|
||||
Reconnect group_in and group out that have been disconnected
|
||||
:socket: only use this specific socket type
|
||||
'''
|
||||
ngroup = ng.node_tree
|
||||
ng_in = ngroup.nodes.get('Group Input')
|
||||
ng_out = ngroup.nodes.get('Group Output')
|
||||
for sockin in ng_in.outputs:
|
||||
if socket_name and sockin.name != socket_name:
|
||||
continue
|
||||
if not sockin.name: # last empty output is listed
|
||||
continue
|
||||
sockout = ng_out.inputs.get(sockin.name)
|
||||
if not sockout:
|
||||
continue
|
||||
if len(sockin.links) and connect_to_group_output(sockin.links[0].to_node):
|
||||
continue
|
||||
## need reconnect
|
||||
aa = create_aa_nodegroup(ngroup)
|
||||
ngroup.links.new(sockin, aa.inputs[0])
|
||||
ngroup.links.new(aa.outputs[0], sockout)
|
||||
print(f'{ng.name}: Bridged {sockin.name}')
|
||||
|
||||
|
||||
def random_color(alpha=False):
|
||||
import random
|
||||
if alpha:
|
||||
|
|
Loading…
Reference in New Issue