def node_tree(self, node_tree, interface_map): prev_mod_map = self.mod_map prev_socket_map = self.socket_map prev_interface_map = self.interface_map self.mod_map = {} self.socket_map = {} self.interface_map = interface_map # nodes = node_tree.nodes # NB: sort by node name to ensure a somewhat stable order of nodes. # Otherwise simply selecting nodes might require full rebuild of the modifier stack nodes = sorted(node_tree.nodes, key=lambda node: node.name) for node in nodes: self.mod_inst = None prev_scope_id = self.scope_id self.scope_id = strhash16(node.name, self.scope_id) node.compile(self) self.scope_id = prev_scope_id for link in node_tree.links: from_mod, from_param = self.socket_map.get(link.from_socket, (None, None)) to_mod, to_param = self.socket_map.get(link.to_socket, (None, None)) if from_mod and to_mod: assert(to_param not in to_mod.param_value or not isinstance(to_mod.param_value[to_param], ModifierLink)) to_mod.param_value[to_param] = ModifierLink(from_mod, from_param) self.mod_map = prev_mod_map self.socket_map = prev_socket_map self.interface_map = prev_interface_map
def __init__(self, modifier, name, scope_id): self.modifier = modifier key = strhash16(name, scope_id) self.name = "%s%d" % (modifier.name, key) self.param_value = {}
def __init__(self): self.mod_map = None self.socket_map = None self.interface_map = None self.scope_id = strhash16("")