Merge pull request #1563 from MoritzBrueckner/fix-trait-props

Fix bool type trait properties
This commit is contained in:
Lubos Lenco 2020-02-08 17:06:17 +01:00 committed by GitHub
commit 3ef7683dfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -82,7 +82,7 @@ class ArmTraitPropListItem(bpy.types.PropertyGroup):
elif self.type == "Float":
self.value_float = float(val)
elif self.type == "Bool":
self.value_bool = bool(val)
self.value_bool = val == "true"
elif self.type in ("Vec2", "Vec3", "Vec4"):
if isinstance(val, str):
dimensions = int(self.type[-1])

View file

@ -479,7 +479,8 @@ def fetch_prop(o):
prop = item.arm_traitpropslist[found_prop.name]
# Default value added and current value is blank (no override)
if (not found_prop.get_value() and defaults[index]):
if (found_prop.get_value() is None
or found_prop.get_value() == "") and defaults[index]:
prop.set_value(defaults[index])
# Type has changed, update displayed name
if (len(found_prop.name) == 1 or (len(found_prop.name) > 1 and found_prop.name[1] != p[1])):