mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
Cut/Copy/Paste fix
Fixed cut, copy and paste behavior when Material is selected (that node should not be deleted or copied, but connections should be pasted).
This commit is contained in:
parent
0d2225d997
commit
5184f6375e
@ -134,7 +134,7 @@ func create_nodes(data, position = null):
|
||||
names[c.name] = node.name
|
||||
node.selected = true
|
||||
for c in data.connections:
|
||||
connect_node(names[c.from], c.from_port, names[c.to], c.to_port)
|
||||
connect_node(names[c.from], c.from_port, "Material" if c.to == "Material" else names[c.to], c.to_port)
|
||||
return null
|
||||
|
||||
func load_file():
|
||||
@ -202,14 +202,14 @@ func export_textures(size = null):
|
||||
|
||||
func remove_selection():
|
||||
for c in get_children():
|
||||
if c is GraphNode and c.selected:
|
||||
if c is GraphNode and c.selected && c.name != "Material":
|
||||
remove_node(c)
|
||||
|
||||
func serialize_selection():
|
||||
var data = { nodes = [], connections = [] }
|
||||
var nodes = []
|
||||
for c in get_children():
|
||||
if c is GraphNode and c.selected:
|
||||
if c is GraphNode and c.selected && c.name != "Material":
|
||||
nodes.append(c)
|
||||
if nodes.empty():
|
||||
return null
|
||||
@ -229,6 +229,12 @@ func serialize_selection():
|
||||
data.connections.append(c)
|
||||
return data
|
||||
|
||||
func can_copy():
|
||||
for c in get_children():
|
||||
if c is GraphNode and c.selected && c.name != "Material":
|
||||
return true
|
||||
return false
|
||||
|
||||
func cut():
|
||||
copy()
|
||||
remove_selection()
|
||||
|
Loading…
Reference in New Issue
Block a user