compatibility with newer Blender

1.3.2

- fixed: compatibility with blender 3.5 (nodegroup socket API change)
This commit is contained in:
pullusb
2023-04-04 15:51:41 +02:00
parent b19f9d9473
commit 556f767f3b
5 changed files with 29 additions and 12 deletions
+17 -7
View File
@@ -63,6 +63,10 @@ def create_aa_nodegroup(tree):
sep = create_node('CompositorNodeSepRGBA', tree=ngroup, location=(-150,0))
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
# ngroup.links.new(comb.outputs[0], ng_out.inputs[0]) # <- connect without out AA
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))
def nodegroup_merge_inputs(ngroup):
def nodegroup_merge_inputs(ngroup, aa=True):
'''Get a nodegroup
merge every group inputs with alpha over
then connect to antialias and a new output
@@ -801,14 +805,20 @@ def nodegroup_merge_inputs(ngroup):
y += offset_y
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
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