Skip to content

Commit

Permalink
Fixed f32 property validation so it accepts the default value
Browse files Browse the repository at this point in the history
  • Loading branch information
matgis committed May 28, 2024
1 parent 8e2c51c commit c2d0412
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions defold-simpledata/editor/src/simpledata-ext.clj
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
;; property value and the name of the property. Is expected to test the validity
;; of the property value, and return a string describing the problem in case the
;; value is not valid. For valid values, it should return nil.
(defn- prop-non-empty? [value prop-name]
(defn- prop-empty? [value prop-name]
(when (empty? value)
(format "'%s' must be specified" prop-name)))

;; These all validate a single property and produce a human-readable error
;; message if the value is invalid. They are used for validation in the
;; Property panel, and to produce build errors when building the project.
(defn- validate-name [node-id value]
(validate-property :name prop-non-empty? node-id value))
(validate-property :name prop-empty? node-id value))

(defn- validate-f32 [node-id value]
(validate-property :f32 validation/prop-1-1? node-id value))
(validate-property :f32 (partial validation/prop-outside-range? [0.0 100.0]) node-id value))

(defn- validate-u32 [node-id value]
(validate-property :u32 validation/prop-negative? node-id value))
Expand Down

0 comments on commit c2d0412

Please sign in to comment.