From ba8c2be739877db351f07ac210616bb921194377 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 2 Jun 2014 13:12:01 +0600 Subject: [PATCH] Improve behavior of Setup Tracking Scene when default nodes exists in the tree --- release/scripts/startup/bl_operators/clip.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index 1bd40f163de..e9184771a4b 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -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')