Improve behavior of Setup Tracking Scene when default nodes exists in the tree
This commit is contained in:
@@ -527,6 +527,17 @@ class CLIP_OT_setup_tracking_scene(Operator):
|
||||
bg.use_pass_ambient_occlusion = True
|
||||
bg.layers = [False] * 10 + [True] + [False] * 9
|
||||
|
||||
@staticmethod
|
||||
def _wipeDefaultNodes(tree):
|
||||
if len(tree.nodes) != 2:
|
||||
return False
|
||||
types = [node.type for node in tree.nodes]
|
||||
types.sort()
|
||||
|
||||
if types[0] == 'COMPOSITE' and types[1] == 'R_LAYERS':
|
||||
while tree.nodes:
|
||||
tree.nodes.remove(tree.nodes[0])
|
||||
|
||||
@staticmethod
|
||||
def _findNode(tree, type):
|
||||
for node in tree.nodes:
|
||||
@@ -587,6 +598,11 @@ class CLIP_OT_setup_tracking_scene(Operator):
|
||||
|
||||
need_stabilization = False
|
||||
|
||||
# Remove all the nodes if they came from default node setup.
|
||||
# This is simplest way to make it so final node setup is
|
||||
# is correct.
|
||||
self._wipeDefaultNodes(tree)
|
||||
|
||||
# create nodes
|
||||
rlayer_fg = self._findOrCreateNode(tree, 'CompositorNodeRLayers')
|
||||
rlayer_bg = tree.nodes.new(type='CompositorNodeRLayers')
|
||||
|
||||
Reference in New Issue
Block a user