From 80cd52edc73f74ac2c257ed2b4785eb2e408ad02 Mon Sep 17 00:00:00 2001 From: zeffii Date: Wed, 24 May 2017 18:00:37 +0200 Subject: [PATCH] add current index and current total --- core/monad.py | 9 +++++++++ nodes/scene/monad.py | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/monad.py b/core/monad.py index a79f390c3..676a5d6e0 100644 --- a/core/monad.py +++ b/core/monad.py @@ -512,6 +512,7 @@ class SvGroupNodeExp: for index, data in enumerate(sockets_data_in): in_node.outputs[index].sv_set(data) + ul = make_tree_from_nodes([out_node.name], monad, down=False) do_update(ul, monad.nodes) @@ -534,10 +535,18 @@ class SvGroupNodeExp: sockets_in = [i.sv_get() for i in self.inputs] monad = self.monad + monad['current_total'] = iterations_remaining + monad['current_index'] = 0 + in_node = monad.input_node out_node = monad.output_node for iteration in range(iterations_remaining): + if 'Monad Info' in monad.nodes: + # info_node = monad.nodes['Monad Info'] + # info_node.outputs[0].sv_set([[iteration]]) + monad["current_index"] = iteration + sockets_in = self.do_process(sockets_in) self.apply_output(sockets_in) diff --git a/nodes/scene/monad.py b/nodes/scene/monad.py index 20e508634..bcd0b992f 100644 --- a/nodes/scene/monad.py +++ b/nodes/scene/monad.py @@ -224,6 +224,8 @@ class SvMonadInfoNode(bpy.types.Node, SverchCustomTreeNode): self.outputs.new('StringsSocket', "Loop Idx") self.outputs.new('StringsSocket', "Loop Total") + self.use_custom_color = True + self.color = monad_def.MONAD_COLOR if self.id_data.bl_idname == "SverchCustomTreeType": self.color = (0.9, 0, 0) @@ -233,7 +235,8 @@ class SvMonadInfoNode(bpy.types.Node, SverchCustomTreeNode): try: idx = monad["current_index"] total = monad["current_total"] - except: + except Exception as err: + print(repr(err)) idx, total = 0 , 0 print("couldn't find monad info") -- GitLab