-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
op_search_select_nodetree.py
46 lines (29 loc) · 1.15 KB
/
op_search_select_nodetree.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
import bpy
from .print_functions import print_and_report
class ANTEMPLATES_OT_search_select_nodetree(bpy.types.Operator):
bl_idname = "antemplates.search_select_nodetree"
bl_label = "Select Nodetree"
bl_description = "Select Nodetree in Templates Panel"
bl_options = {'REGISTER', 'INTERNAL'}
name : bpy.props.StringProperty(default="")
@classmethod
def poll(cls, context):
return True
def execute(self, context):
winman = context.window_manager
properties_coll = winman.an_templates_properties
nodetree_coll = winman.an_templates_nodetrees
try:
nodetree_coll[self.name]
except KeyError:
print_and_report(self, "Unable to Find Nodetree : " + self.from_name, "WARNING") #debug
return {'FINISHED'}
properties_coll.nodetree_search = self.name
idx = 0
for n in nodetree_coll:
if n.name == self.name:
properties_coll.nodetrees_index = idx
break
idx += 1
print_and_report(self, "Nodetree Selected in Templates Panel", "INFO") #debug
return {"FINISHED"}