add connections in NAT playground
This commit is contained in:
@@ -336,8 +336,11 @@
|
||||
(archive.changePlaygrounds ->:Void [:DynamicAccess<Dynamic> p] (dictSet p "default" name))
|
||||
(when playgroundSystem (playgroundSystem.switchPlaygroundKey name)))
|
||||
|
||||
(defCommand RemoveFromPlayground [entries (SelectedEntries 1 null)]
|
||||
(defCommand AddConnections [entries (SelectedEntries 1 null) entriesToConnect (Entries 1 null)]
|
||||
(for e entries
|
||||
(when (hasComponent e Positions)
|
||||
(withWritableComponents archive e [positions Positions]
|
||||
(positions.remove (dictGet archive.playgrounds "default")))) e)))
|
||||
(addConnections archive e entriesToConnect)))
|
||||
|
||||
(defCommand RemoveConnections [entries (SelectedEntries 1 null) entriesToRemove (Entries 1 null)]
|
||||
(for e entries
|
||||
(addConnections archive e entriesToRemove)))
|
||||
)
|
||||
|
||||
@@ -130,4 +130,15 @@
|
||||
(nth i2.imageScales i2.pinnedImageIndex))
|
||||
(if (hasComponent e Scale)
|
||||
(readComponent e Scale)
|
||||
1.0)))
|
||||
1.0)))
|
||||
|
||||
(function addConnections [:nat.Archive archive :nat.Entry e :Array<Entry> entriesToConnect]
|
||||
(if (hasComponent e Connections)
|
||||
(withWritableComponents archive e [conn Connections]
|
||||
(doFor e2 entriesToConnect (dictSet conn e2.id 1)))
|
||||
(addComponent archive e Connections (for e2 entriesToConnect =>e2.id 1))))
|
||||
|
||||
(function removeConnections [:nat.Archive archive :nat.Entry e :Array<Entry> entriesToRemove]
|
||||
(when (hasComponent e Connections)
|
||||
(withWritableComponents archive e [conn Connections]
|
||||
(doFor e2 entriesToRemove (conn.remove e2.id)))))
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package nat.components;
|
||||
|
||||
typedef Connections = Map<EntryRef,Int>;
|
||||
Reference in New Issue
Block a user