Skip to content
Permalink
Browse files

Fix asset selector component.

  • Loading branch information
Shinmera committed Jan 10, 2020
1 parent 8e46a04 commit 00990b2f311742805158b3d243b87b254888af1c
Showing with 25 additions and 3 deletions.
  1. +25 −3 alloy/components.lisp
@@ -57,11 +57,33 @@

(defmethod alloy:component-class-for-object ((_ 3d-vectors:vec4)) (find-class 'vec4))

(defclass asset (alloy:button)
(defclass asset-item (alloy:combo-item)
())

(defmethod activate :after ((asset asset))
(defmethod alloy:text ((asset asset-item))
(format NIL "~a / ~a"
(trial:name (trial:pool (alloy:value asset)))
(trial:name (alloy:value asset))))

(defclass asset (alloy:combo)
())

(defmethod alloy:component-class-for-object ((_ trial:asset)) (find-class 'asset))
(defmethod (setf alloy:value) :before ((value trial:asset) (asset asset))
(trial:load value))

(defmethod alloy:value-set ((asset asset))
(let ((type (if (alloy:value asset) (type-of (alloy:value asset)) 'trial:asset)))
(loop for pool in (trial:list-pools)
nconc (loop for asset in (trial:list-assets pool)
when (typep asset type)
collect asset))))

(defmethod alloy:text ((asset asset))
(format NIL "~a / ~a"
(trial:name (trial:pool (alloy:value asset)))
(trial:name (alloy:value asset))))

(defmethod alloy:combo-item (item (asset asset))
(make-instance 'asset-item :value item))

(defmethod alloy:component-class-for-object ((_ trial:asset)) (find-class 'asset))

0 comments on commit 00990b2

Please sign in to comment.
You can’t perform that action at this time.