compatibility with newer Blender
1.3.2 - fixed: compatibility with blender 3.5 (nodegroup socket API change)main
parent
b19f9d9473
commit
556f767f3b
|
@ -14,6 +14,10 @@ Activate / deactivate layer opacity according to prefix
|
||||||
Activate / deactivate all masks using MA layers
|
Activate / deactivate all masks using MA layers
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
1.3.2
|
||||||
|
|
||||||
|
- fixed: compatibility with blender 3.5 (nodegroup socket API change)
|
||||||
|
|
||||||
1.3.1
|
1.3.1
|
||||||
|
|
||||||
- added: preview generation in autobuild
|
- added: preview generation in autobuild
|
||||||
|
|
|
@ -206,15 +206,17 @@ def merge_compositor_preview(scene=None, clear=False):
|
||||||
ng['is_preview'] = 1
|
ng['is_preview'] = 1
|
||||||
fn.create_node('NodeGroupInput', tree=ngroup, location=(-600,0))
|
fn.create_node('NodeGroupInput', tree=ngroup, location=(-600,0))
|
||||||
fn.create_node('NodeGroupOutput', tree=ngroup, location=(1000,0))
|
fn.create_node('NodeGroupOutput', tree=ngroup, location=(1000,0))
|
||||||
|
## ngroup.outputs.new('NodeSocketColor', 'Image') # generated in merge_inputs
|
||||||
|
|
||||||
# Create inputs and links to node_group
|
# Create inputs and links to node_group
|
||||||
for rln in comp_list:
|
for rln in comp_list:
|
||||||
rln.outputs['Image']
|
sockin = ng.node_tree.inputs.new('NodeSocketColor', rln.layer)
|
||||||
sockin = ng.inputs.new('NodeSocketColor', rln.layer)
|
|
||||||
sockin = ng.inputs[-1]
|
sockin = ng.inputs[-1]
|
||||||
|
# sockin = ng.inputs.new('NodeSocketColor', rln.layer)
|
||||||
|
# sockin = ng.inputs[-1]
|
||||||
links.new(rln.outputs['Image'], sockin)
|
links.new(rln.outputs['Image'], sockin)
|
||||||
|
|
||||||
fn.nodegroup_merge_inputs(ng.node_tree)
|
fn.nodegroup_merge_inputs(ng.node_tree, aa=False) # do not create AA node (needed ?)
|
||||||
ng.update()
|
ng.update()
|
||||||
|
|
||||||
# Create composite out (if needed) and connect
|
# Create composite out (if needed) and connect
|
||||||
|
|
|
@ -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, 3, 1),
|
"version": (1, 3, 2),
|
||||||
"blender": (2, 93, 0),
|
"blender": (2, 93, 0),
|
||||||
"location": "View3D",
|
"location": "View3D",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
|
24
fn.py
24
fn.py
|
@ -63,6 +63,10 @@ def create_aa_nodegroup(tree):
|
||||||
sep = create_node('CompositorNodeSepRGBA', tree=ngroup, location=(-150,0))
|
sep = create_node('CompositorNodeSepRGBA', tree=ngroup, location=(-150,0))
|
||||||
comb = create_node('CompositorNodeCombRGBA', tree=ngroup, location=(350,25))
|
comb = create_node('CompositorNodeCombRGBA', tree=ngroup, location=(350,25))
|
||||||
|
|
||||||
|
# if bpy.app.version >= (3,4,0):
|
||||||
|
ngroup.inputs.new('NodeSocketColor', 'Image')
|
||||||
|
ngroup.outputs.new('NodeSocketColor', 'Image')
|
||||||
|
|
||||||
# in AA
|
# in AA
|
||||||
# ngroup.links.new(comb.outputs[0], ng_out.inputs[0]) # <- connect without out AA
|
# ngroup.links.new(comb.outputs[0], ng_out.inputs[0]) # <- connect without out AA
|
||||||
aa = new_aa_node(ngroup, location=(-400, 0))
|
aa = new_aa_node(ngroup, location=(-400, 0))
|
||||||
|
@ -771,7 +775,7 @@ def random_color(alpha=False):
|
||||||
return (random.uniform(0,1), random.uniform(0,1), random.uniform(0,1), 1)
|
return (random.uniform(0,1), random.uniform(0,1), random.uniform(0,1), 1)
|
||||||
return (random.uniform(0,1), random.uniform(0,1), random.uniform(0,1))
|
return (random.uniform(0,1), random.uniform(0,1), random.uniform(0,1))
|
||||||
|
|
||||||
def nodegroup_merge_inputs(ngroup):
|
def nodegroup_merge_inputs(ngroup, aa=True):
|
||||||
'''Get a nodegroup
|
'''Get a nodegroup
|
||||||
merge every group inputs with alpha over
|
merge every group inputs with alpha over
|
||||||
then connect to antialias and a new output
|
then connect to antialias and a new output
|
||||||
|
@ -801,14 +805,20 @@ def nodegroup_merge_inputs(ngroup):
|
||||||
y += offset_y
|
y += offset_y
|
||||||
prev = ao
|
prev = ao
|
||||||
|
|
||||||
## create a merged name as output ??
|
|
||||||
aa = create_aa_nodegroup(ngroup) # new_aa_node(ngroup)
|
|
||||||
aa.location = (ao.location.x + 200, ao.location.y)
|
|
||||||
ngroup.links.new(ao.outputs[0], aa.inputs[0]) # node_tree
|
|
||||||
|
|
||||||
# create one input and link
|
# create one input and link
|
||||||
out = ngroup.outputs.new('NodeSocketColor', ngroup.inputs[0].name)
|
out = ngroup.outputs.new('NodeSocketColor', ngroup.inputs[0].name)
|
||||||
ngroup.links.new(aa.outputs[0], ng_out.inputs[0])
|
|
||||||
|
## create a merged name as output ??
|
||||||
|
if aa:
|
||||||
|
# create AA and link
|
||||||
|
aa = create_aa_nodegroup(ngroup) # new_aa_node(ngroup)
|
||||||
|
aa.location = (ao.location.x + 200, ao.location.y)
|
||||||
|
ngroup.links.new(ao.outputs[0], aa.inputs[0]) # node_tree
|
||||||
|
ngroup.links.new(aa.outputs[0], ng_out.inputs[0])
|
||||||
|
else:
|
||||||
|
# link directly
|
||||||
|
ngroup.links.new(ao.outputs[0], ng_out.inputs[0])
|
||||||
|
|
||||||
|
|
||||||
## -- renumbering funcs
|
## -- renumbering funcs
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,8 @@ def connect_render_layer(rlayer, ng=None, out=None, frame=None):
|
||||||
for s in reversed(ng.inputs):
|
for s in reversed(ng.inputs):
|
||||||
if not s.is_linked: # and not any(x.layer == s.name for x in rl_nodes)
|
if not s.is_linked: # and not any(x.layer == s.name for x in rl_nodes)
|
||||||
print(f'removing grp unlinked input {s.name}')
|
print(f'removing grp unlinked input {s.name}')
|
||||||
ng.inputs.remove(s)
|
# ng.inputs.remove(s)
|
||||||
|
ng.node_tree.inputs.remove(s)
|
||||||
|
|
||||||
## get nodes from linked NG inputs ??? maybe more clear...
|
## get nodes from linked NG inputs ??? maybe more clear...
|
||||||
# rl_nodes = [s.links[0].from_node for s in ng.inputs if s.links and s.links[0].from_node and s.links[0].from_node.type == 'R_LAYERS']
|
# rl_nodes = [s.links[0].from_node for s in ng.inputs if s.links and s.links[0].from_node and s.links[0].from_node.type == 'R_LAYERS']
|
||||||
|
|
Loading…
Reference in New Issue