-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabel_socket.py
46 lines (36 loc) · 1.51 KB
/
label_socket.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'''
Copyright (C) 2020-2023 Orange Turbine
https://orangeturbine.com
This file is part of Scattershot, created by Jonathan Lampel.
All code distributed with this add-on is open source as described below.
Scattershot 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 3
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, see <https://www.gnu.org/licenses/>.
'''
import bpy
from bpy.types import NodeTree, Node, NodeSocket
# Currently only for reference - the virutal socket type worked just fine here
class LabelSocket(NodeSocket):
'''Socket type for lables where the socket itself is invisible'''
bl_idname: 'LabelSocket'
bl_label = "Label Socket"
def draw(self, context, layout, node, text):
layout.label(text=text)
def draw_color(self, context, node):
return (0.15, 0.15, 0.15, 0.0)
def register():
from bpy.utils import register_class
register_class(LabelSocket)
def unregister():
from bpy.utils import unregister_class
unregister_class(LabelSocket)
if __name__ == "__main__":
register()