Material: mat card template for material editor, move to a much more pythonic one

This commit is contained in:
Bernd Hahnebach
2019-04-25 19:47:08 +02:00
parent eb21144c4b
commit f69537ed30
7 changed files with 313 additions and 188 deletions

View File

@@ -122,26 +122,23 @@ class MaterialEditor:
treeView.setColumnWidth(1, 250)
treeView.setColumnHidden(2, True)
from Material import getMaterialAttributeStructure
tree = getMaterialAttributeStructure(True)
MatPropDict = tree.getroot()
from materialtools.cardutils import get_material_template
template_data = get_material_template(True)
for group in MatPropDict.getchildren():
gg = group.attrib['Name']
for group in template_data:
gg = list(group.keys())[0] # group dict has only one key
top = QtGui.QStandardItem(gg)
model.appendRow([top])
self.groups.append(gg)
for proper in group.getchildren():
properDict = proper.attrib
pp = properDict['Name']
for properName in group[gg]:
pp = properName # property name
item = QtGui.QStandardItem(pp)
self.internalprops.append(pp)
it = QtGui.QStandardItem()
tt = properDict['Type']
tt = group[gg][properName]['Type']
itType = QtGui.QStandardItem(tt)
top.appendRow([item, it, itType])