Открыть боковую панель
nikitronn
sverchok
Коммиты
f83aed96
Коммит
f83aed96
создал
Дек 31, 2017
по автору
Ilya Portnov
Просмотр файлов
Add the node file.
владелец
9a90134a
Изменения
1
Скрыть пробелы
Построчно
Рядом
nodes/vector/color_input.py
0 → 100644
Просмотр файла @
f83aed96
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
import
colorsys
import
bpy
from
bpy.props
import
FloatProperty
,
BoolProperty
,
FloatVectorProperty
from
sverchok.node_tree
import
SverchCustomTreeNode
,
StringsSocket
from
sverchok.data_structure
import
updateNode
,
fullList
from
sverchok.utils.sv_itertools
import
sv_zip_longest
class
SvColorInputNode
(
bpy
.
types
.
Node
,
SverchCustomTreeNode
):
"""
Triggers: Color Input
Tooltip: Specify color using color picker
"""
bl_idname
=
"SvColorInputNode"
bl_label
=
"Color Input"
bl_icon
=
"COLOR"
use_alpha
=
BoolProperty
(
name
=
"Use Alpha"
,
default
=
False
,
update
=
updateNode
)
color_data
=
FloatVectorProperty
(
name
=
"Color"
,
description
=
"Color"
,
size
=
4
,
min
=
0.0
,
max
=
1.0
,
subtype
=
'COLOR'
,
update
=
updateNode
)
to3d
=
BoolProperty
(
name
=
"To 3D Panel"
,
description
=
"Show this node in 3D panel"
,
default
=
True
,
update
=
updateNode
)
def
sv_init
(
self
,
context
):
self
.
outputs
.
new
(
"SvColorSocket"
,
"Color"
)
def
draw_buttons
(
self
,
context
,
layout
):
layout
.
template_color_picker
(
self
,
"color_data"
,
value_slider
=
True
)
layout
.
prop
(
self
,
"color_data"
,
text
=
''
)
layout
.
prop
(
self
,
"use_alpha"
)
def
draw_buttons_ext
(
self
,
context
,
layout
):
self
.
draw_buttons
(
context
,
layout
)
layout
.
prop
(
self
,
"to3d"
)
def
process
(
self
):
if
self
.
use_alpha
:
color
=
self
.
color_data
[:]
else
:
color
=
self
.
color_data
[:
3
]
self
.
outputs
[
'Color'
].
sv_set
([
color
])
def
register
():
bpy
.
utils
.
register_class
(
SvColorInputNode
)
def
unregister
():
bpy
.
utils
.
unregister_class
(
SvColorInputNode
)
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать