Открыть боковую панель
nikitronn
sverchok
Коммиты
f5ce786f
Не подтверждена
Коммит
f5ce786f
создал
Июн 06, 2022
по автору
Sergey
Зафиксировано автором
GitHub
Июн 06, 2022
Просмотр файлов
Merge pull request #4508 from nortikin/objects_number
Optimization of objects number updating
владельцы
fa455c1e
6fec6c26
Изменения
2
Скрыть пробелы
Построчно
Рядом
core/sockets.py
Просмотр файла @
f5ce786f
...
...
@@ -438,6 +438,10 @@ class SvSocketCommon(SvSocketProcessing):
"""Set data, provide context in case the node can be evaluated several times in different context"""
if
self
.
is_output
:
data
=
self
.
postprocess_output
(
data
)
# it's expensive to call sv_get method to update the number in other places
self
.
objects_number
=
len
(
data
)
sv_set_socket
(
self
,
data
)
def
sv_forget
(
self
):
...
...
@@ -548,21 +552,6 @@ class SvSocketCommon(SvSocketProcessing):
def
draw_color
(
self
,
context
,
node
):
return
self
.
color
def
update_objects_number
(
self
):
# todo should be the method here?
"""
Should be called each time after process method of the socket owner
It will update number of objects to show in socket labels
"""
try
:
self
.
objects_number
=
len
(
self
.
sv_get
(
deepcopy
=
False
,
default
=
[]))
except
LookupError
:
self
.
objects_number
=
0
except
Exception
as
e
:
warning
(
f
"Socket='
{
self
.
name
}
' of node='
{
self
.
node
.
name
}
' can't update number of objects on the label. "
f
"Cause is '
{
e
}
'"
)
self
.
objects_number
=
0
raise
e
class
SvObjectSocket
(
NodeSocket
,
SvSocketCommon
):
bl_idname
=
"SvObjectSocket"
...
...
node_tree.py
Просмотр файла @
f5ce786f
...
...
@@ -315,11 +315,6 @@ class UpdateNodes:
else
:
sv_bgl
.
callback_disable
(
update_pref
+
self
.
node_id
)
# update object numbers
for
s
in
chain
(
self
.
inputs
,
self
.
outputs
):
if
hasattr
(
s
,
'update_objects_number'
):
s
.
update_objects_number
()
def
insert_link
(
self
,
link
):
"""It will be triggered only if one socket is connected with another by user"""
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать