Не подтверждена Коммит 874bb820 создал по автору Sergey's avatar Sergey Зафиксировано автором GitHub
Просмотр файлов

Merge pull request #4586 from nortikin/mute_reroutes

Mute reroutes
владельцы 660d9c79 585a4a93
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
from collections import UserDict from collections import UserDict
from itertools import chain from itertools import chain
from traceback import format_list, extract_stack
from typing import NewType, Optional, Literal from typing import NewType, Optional, Literal
from bpy.types import NodeSocket from bpy.types import NodeSocket
...@@ -34,9 +35,10 @@ SockId = NewType('SockId', str) ...@@ -34,9 +35,10 @@ SockId = NewType('SockId', str)
class DebugMemory(UserDict): class DebugMemory(UserDict):
_last_printed = dict() _last_printed = dict()
def __init__(self, data, print_all=True): def __init__(self, data, print_all=True, print_trace=False):
self.data = data self.data = data
self._print_all = print_all self._print_all = print_all
self._print_trace = print_trace
self._id_sock: dict[SockId, NodeSocket] = dict() self._id_sock: dict[SockId, NodeSocket] = dict()
...@@ -47,6 +49,9 @@ class DebugMemory(UserDict): ...@@ -47,6 +49,9 @@ class DebugMemory(UserDict):
self._data_len = 100 self._data_len = 100
def __setitem__(self, key, value): def __setitem__(self, key, value):
if self._print_trace:
for line in format_list(extract_stack()[4:-3]):
print(line, end='')
if key not in self.data: if key not in self.data:
self.data[key] = value self.data[key] = value
(self._pprint if self._print_all else self._pprint_id)(key, 'NEW') (self._pprint if self._print_all else self._pprint_id)(key, 'NEW')
...@@ -55,6 +60,9 @@ class DebugMemory(UserDict): ...@@ -55,6 +60,9 @@ class DebugMemory(UserDict):
(self._pprint if self._print_all else self._pprint_id)(key, 'VALUE') (self._pprint if self._print_all else self._pprint_id)(key, 'VALUE')
def __delitem__(self, key): def __delitem__(self, key):
if self._print_trace:
for line in format_list(extract_stack()[4:-3]):
print(line, end='')
(self._pprint if self._print_all else self._pprint_id)(key, 'DELETE') (self._pprint if self._print_all else self._pprint_id)(key, 'DELETE')
del self.data[key] del self.data[key]
......
...@@ -253,7 +253,10 @@ class SearchTree: ...@@ -253,7 +253,10 @@ class SearchTree:
del self._to_nodes[in_] del self._to_nodes[in_]
def _remove_muted_nodes(self): def _remove_muted_nodes(self):
util_nodes = {'NodeFrame', 'NodeReroute', 'NodeGroupInput'}
for node in self._tree.nodes: for node in self._tree.nodes:
if node.bl_idname in util_nodes:
continue
if not node.mute: if not node.mute:
continue continue
for in_s, out_s in node.sv_internal_links: for in_s, out_s in node.sv_internal_links:
...@@ -388,9 +391,12 @@ class UpdateTree(SearchTree): ...@@ -388,9 +391,12 @@ class UpdateTree(SearchTree):
# disconnected input sockets can remember previous data # disconnected input sockets can remember previous data
# a node can be laizy and don't recalculate output # a node can be laizy and don't recalculate output
util_nodes = {'NodeGroupInput', 'NodeGroupOutput'}
for node in changed_nodes: for node in changed_nodes:
for in_s in chain(node.inputs, node.outputs): if node.bl_idname in util_nodes:
in_s.sv_forget() continue
for s in chain(node.inputs, node.outputs):
s.sv_forget()
_tree._outdated_nodes.update(changed_nodes) _tree._outdated_nodes.update(changed_nodes)
if not _tree.is_animation_updated: if not _tree.is_animation_updated:
...@@ -663,7 +669,7 @@ class AddStatistic: ...@@ -663,7 +669,7 @@ class AddStatistic:
self._node[ERROR_KEY] = None self._node[ERROR_KEY] = None
self._node[TIME_KEY] = perf_counter() - self._start self._node[TIME_KEY] = perf_counter() - self._start
else: else:
log_error(exc_type) log_error(exc_val)
self._node[UPDATE_KEY] = False self._node[UPDATE_KEY] = False
self._node[ERROR_KEY] = repr(exc_val) self._node[ERROR_KEY] = repr(exc_val)
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать