NAT color component

This commit is contained in:
2022-09-10 23:06:23 +00:00
parent 872d4b5bae
commit 94613ef94a
3 changed files with 15 additions and 0 deletions

View File

@@ -351,4 +351,8 @@
(defCommand RemoveConnections [entries (SelectedEntries 1 null) entriesToRemove (Entries 1 null)]
(for e entries
(addConnections archive e entriesToRemove)))
(defCommand AddColorRGBA [entries (SelectedEntries 1 null) r (Number 0 1 null) g (Number 0 1 null) b (Number 0 1 null) a (Number 0 1 null)]
(for e entries
(addColorRGBA archive e r g b a)))
)

View File

@@ -149,6 +149,9 @@
(doFor e2 entriesToRemove (conn.remove e2.id))))
e)
(function addColorRGBA [:nat.Archive archive :nat.Entry e :Float r :Float g :Float b :Float a]
(addComponent archive e Color (objectWith r g b a)))
(function isEntry [o]
(let [fields (Reflect.fields o)]
(and (= fields.length 3)

View File

@@ -0,0 +1,8 @@
package nat.components;
typedef Color = {
r:Float,
g:Float,
b:Float,
a:Float
};