Открыть боковую панель
nikitronn
sverchok
Коммиты
ff52da00
Коммит
ff52da00
создал
Июн 01, 2022
по автору
Durman
Просмотр файлов
fix handling undo event
владелец
5b198c89
Изменения
2
Скрыть пробелы
Построчно
Рядом
core/handlers.py
Просмотр файла @
ff52da00
...
...
@@ -84,14 +84,6 @@ def sv_handler_undo_post(scene):
undo_handler_node_count
[
'sv_groups'
]
=
0
# ideally we would like to recalculate all from scratch
# but with heavy trees user can be scared of pressing undo button
# I consider changes in tree topology as most common case
# but if properties or work of some viewer node (removing generated objects) was effected by undo
# only recalculating of all can restore the adequate state of a tree
for
tree
in
BlTrees
().
sv_main_trees
:
tree
.
update
()
# the tree could changed by undo event
@
persistent
def
sv_update_handler
(
scene
):
...
...
core/update_system.py
Просмотр файла @
ff52da00
...
...
@@ -58,6 +58,9 @@ def control_center(event):
ts
.
tasks
.
add
(
ts
.
Task
(
event
.
tree
,
UpdateTree
.
main_update
(
event
.
tree
)))
# mark that the tree topology has changed
# also this can be called (by Blender) during undo event in this case all
# nodes will have another hash id and the comparison method will decide that
# all nodes are new, and won't be able to detect changes, and will update all
elif
type
(
event
)
is
ev
.
TreeEvent
:
UpdateTree
.
get
(
event
.
tree
).
is_updated
=
False
if
event
.
tree
.
sv_process
:
...
...
@@ -279,7 +282,7 @@ class UpdateTree(SearchTree):
# update topology
if
not
_tree
.
is_updated
:
old
=
_tree
_tree
=
old
.
copy
()
_tree
=
old
.
copy
(
tree
)
# update outdated nodes list
if
_tree
.
_outdated_nodes
is
not
None
:
...
...
@@ -343,10 +346,12 @@ class UpdateTree(SearchTree):
else
:
cls
.
_tree_catch
.
clear
()
def
copy
(
self
)
->
'UpdateTree'
:
def
copy
(
self
,
new_tree
:
NodeTree
)
->
'UpdateTree'
:
"""They copy will be with new topology if original tree was changed
since instancing of the first tree. Other attributes copied as is."""
copy_
=
type
(
self
)(
self
.
_tree
)
since instancing of the first tree. Other attributes copied as is.
:new_tree: it's import to pass fresh tree object because during undo
events all previous tree objects invalidates"""
copy_
=
type
(
self
)(
new_tree
)
for
attr
in
self
.
_copy_attrs
:
setattr
(
copy_
,
attr
,
copy
(
getattr
(
self
,
attr
)))
return
copy_
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать