This commit is contained in:
sliptonic
2021-02-17 09:19:00 -06:00
parent 29e714da02
commit 42c769d635
2 changed files with 18 additions and 2 deletions

View File

@@ -67,6 +67,18 @@ class PropertyBag(object):
def __setstate__(self, state):
return None
def __sanitizePropertyName(self, name):
if(len(name) == 0):
return
clean = name[0].lower()
for i in range(1, len(name)):
if (name[i] == ' '):
clean += name[i + 1].upper()
i += 1
elif(name[i - 1] != ' '):
clean += name[i]
return clean
def onDocumentRestored(self, obj):
self.obj = obj
obj.setEditorMode(self.CustomPropertyGroups, 2) # hide
@@ -82,10 +94,14 @@ class PropertyBag(object):
if group is None:
group = self.CustomPropertyGroupDefault
groups = self.obj.CustomPropertyGroups
name = self.__sanitizePropertyName(name)
if not group in groups:
groups.append(group)
self.obj.CustomPropertyGroups = groups
self.obj.addProperty(propertyType, name, group, desc)
return name
def refreshCustomPropertyGroups(self):
'''refreshCustomPropertyGroups() ... removes empty property groups, should be called after deleting properties.'''

View File

@@ -299,10 +299,10 @@ class TaskPanel(object):
typ = dialog.propertyType()
grp = dialog.propertyGroup()
info = dialog.propertyInfo()
self.obj.Proxy.addCustomProperty(typ, name, grp, info)
propname = self.obj.Proxy.addCustomProperty(typ, name, grp, info)
if dialog.propertyIsEnumeration():
setattr(self.obj, name, dialog.propertyEnumerations())
return (name, info)
return (propname, info)
def propertyAdd(self):
PathLog.track()