def do_update_general(node_list, nodes, procesed_nodes=set()):
    """
    General update function for node set
    """
    global graphs
    timings = []
    graph = []
    gather = graph.append

    total_time = 0
    done_nodes = set(procesed_nodes)

    # this is a no-op if no bgl being drawn.
    clear_exception_drawing_with_bgl(nodes)

    for node_name in node_list:
        if node_name in done_nodes:
            continue
        try:
            node = nodes[node_name]
            start = time.perf_counter()
            if hasattr(node, "process"):
                node.process()

            delta = time.perf_counter() - start
            total_time += delta

            if data_structure.DEBUG_MODE:
                debug("Processed  %s in: %.4f", node_name, delta)

            timings.append(delta)
            gather({
                "name": node_name,
                "bl_idname": node.bl_idname,
                "start": start,
                "duration": delta
            })

        except Exception as err:
            ng = nodes.id_data
            update_error_nodes(ng, node_name, err)
            #traceback.print_tb(err.__traceback__)
            exception("Node %s had exception: %s", node_name, err)

            if hasattr(ng, "sv_show_error_in_tree"):
                # not yet supported in monad trees..
                if ng.sv_show_error_in_tree:
                    error_text = traceback.format_exc()
                    start_exception_drawing_with_bgl(ng, node_name, error_text,
                                                     err)

            return None

    graphs.append(graph)
    if data_structure.DEBUG_MODE:
        debug("Node set updated in: %.4f seconds", total_time)

    return timings
Exemple #2
0
    def update(self):
        """
        This method is called if collection of nodes or links of the tree was changed
        First of all it checks is it worth bothering and then gives initiative to `update system`
        """
        # this is a no-op if there's no drawing
        clear_exception_drawing_with_bgl(self.nodes)
        if is_first_run():
            return
        if self.skip_tree_update or not self.sv_process:
            return

        self.sv_update()
        self.has_changed = False
Exemple #3
0
    def update(self):
        '''
        Tags tree for update for handle
        get update list for debug info, tuple (fulllist, dictofpartiallists)
        '''

        # this is a no-op if there's no drawing
        clear_exception_drawing_with_bgl(self.nodes)

        if self.skip_tree_update:
            # print('throttled update from context manager')
            return

        # print('svtree update', self.timestamp)
        self.has_changed = True
        # self.has_link_count_changed
        self.process()
Exemple #4
0
    def update(self):
        '''
        Tags tree for update for handle
        get update list for debug info, tuple (fulllist, dictofpartiallists)
        '''

        CurrentEvents.new_event(BlenderEventsTypes.tree_update, self)

        # this is a no-op if there's no drawing
        clear_exception_drawing_with_bgl(self.nodes)
        if is_first_run():
            return
        if self.skip_tree_update:
            # print('throttled update from context manager')
            return
        if self.configuring_new_node or self.is_frozen() or not self.sv_process:
            return

        self.sv_update()
        self.has_changed = False