Skip to content

Commit d4d461a

Browse files
authored
Display all connectable nodes when quick connecting from "any" port type (contributed by williamchange)
Display all connectable nodes when quick connecting from "any" port type
2 parents 3985d36 + 07ad63b commit d4d461a

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

material_maker/windows/add_node_popup/add_node_popup.gd

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ func show_popup(node_name : String = "", slot : int = -1, slot_type : int = -1,
8686
filter.grab_focus()
8787

8888

89-
func check_quick_connect(obj) -> bool:
90-
var ref_obj = obj
89+
func check_quick_connect(obj : Dictionary) -> bool:
90+
var ref_obj : Dictionary = obj
9191
if mm_loader.predefined_generators.has(obj.type):
9292
ref_obj = mm_loader.predefined_generators[obj.type]
9393
# comment and remote nodes have neither input nor output
@@ -100,7 +100,7 @@ func check_quick_connect(obj) -> bool:
100100
else:
101101
var found : bool = false
102102
for outputs in ref_obj.shader_model.outputs.size():
103-
if mm_io_types.types[ref_obj.shader_model.outputs[outputs].type].slot_type == qc_slot_type:
103+
if qc_slot_type == 42 or mm_io_types.types[ref_obj.shader_model.outputs[outputs].type].slot_type == qc_slot_type:
104104
found = true
105105
break
106106
if !found:
@@ -114,16 +114,16 @@ func check_quick_connect(obj) -> bool:
114114
break
115115
var found : bool = false
116116
for outputs in output_ports.size():
117-
if mm_io_types.types[output_ports[outputs].type].slot_type == qc_slot_type:
117+
if qc_slot_type == 42 or mm_io_types.types[output_ports[outputs].type].slot_type == qc_slot_type:
118118
found = true
119119
break
120120
if !found:
121121
return false
122-
if output_ports.is_empty() or mm_io_types.types[output_ports[0].type].slot_type != qc_slot_type:
122+
if output_ports.is_empty() or mm_io_types.types[output_ports[0].type].slot_type != qc_slot_type and qc_slot_type != 42:
123123
return false
124-
elif (ref_obj.type == "image" or ref_obj.type == "text" or ref_obj.type == "buffer" or ref_obj.type == "iterate_buffer") and qc_slot_type != 0:
124+
elif (ref_obj.type == "image" or ref_obj.type == "text" or ref_obj.type == "buffer" or ref_obj.type == "iterate_buffer") and qc_slot_type != 0 and qc_slot_type != 42:
125125
return false
126-
elif (ref_obj.type == "debug" or ref_obj.type == "export" or ref_obj.type == "sdf"):
126+
elif (ref_obj.type == "debug" or ref_obj.type == "export" or ref_obj.type == "sdf") or (ref_obj.type == "portal" and ref_obj.io == MMGenPortal.Portal.IN):
127127
return false
128128
else:
129129
if ref_obj.has("shader_model"):
@@ -132,7 +132,7 @@ func check_quick_connect(obj) -> bool:
132132
else:
133133
var found : bool = false
134134
for input in ref_obj.shader_model.inputs.size():
135-
if mm_io_types.types[ref_obj.shader_model.inputs[input].type].slot_type == qc_slot_type:
135+
if qc_slot_type == 42 or mm_io_types.types[ref_obj.shader_model.inputs[input].type].slot_type == qc_slot_type:
136136
found = true
137137
break
138138
if !found:
@@ -146,16 +146,16 @@ func check_quick_connect(obj) -> bool:
146146
break
147147
var found : bool = false
148148
for input in input_ports.size():
149-
if mm_io_types.types[input_ports[input].type].slot_type == qc_slot_type:
149+
if qc_slot_type == 42 or mm_io_types.types[input_ports[input].type].slot_type == qc_slot_type:
150150
found = true
151151
break
152152
if !found:
153153
return false
154-
if input_ports.is_empty() or mm_io_types.types[input_ports[0].type].slot_type != qc_slot_type:
154+
if input_ports.is_empty() or mm_io_types.types[input_ports[0].type].slot_type != qc_slot_type and qc_slot_type != 42:
155155
return false
156-
elif ref_obj.type == "image" or ref_obj.type == "text" or ref_obj.type == "sdf":
156+
elif ref_obj.type == "image" or ref_obj.type == "text" or ref_obj.type == "sdf" or ref_obj.type == "meshmap" or (ref_obj.type == "portal" and ref_obj.io == MMGenPortal.Portal.OUT):
157157
return false
158-
elif (ref_obj.type == "debug" or ref_obj.type == "buffer" or ref_obj.type == "iterate_buffer" or ref_obj.type == "export") and qc_slot_type != 0:
158+
elif (ref_obj.type == "debug" or ref_obj.type == "buffer" or ref_obj.type == "iterate_buffer" or ref_obj.type == "export") and qc_slot_type != 0 and qc_slot_type != 42:
159159
return false
160160
return true
161161

0 commit comments

Comments
 (0)