Material: mat card template for material editor, move to a much more pythonic one
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
import FreeCAD
|
||||
import Material
|
||||
from materialtools.cardutils import get_material_template
|
||||
import os
|
||||
import sys
|
||||
if sys.version_info.major >= 3:
|
||||
@@ -151,17 +151,15 @@ def write(filename, dictionary, write_group_section=True):
|
||||
|
||||
# sort the data into sections
|
||||
contents = []
|
||||
tree = Material.getMaterialAttributeStructure()
|
||||
MatPropDict = tree.getroot()
|
||||
for group in MatPropDict.getchildren():
|
||||
groupName = group.attrib['Name']
|
||||
template_data = get_material_template()
|
||||
for group in template_data:
|
||||
groupName = list(group.keys())[0] # group dict has only one key
|
||||
contents.append({"keyname": groupName})
|
||||
if groupName == "Meta":
|
||||
header = contents[-1]
|
||||
elif groupName == "User defined":
|
||||
elif groupName == 'UserDefined':
|
||||
user = contents[-1]
|
||||
for proper in group.getchildren():
|
||||
properName = proper.attrib['Name']
|
||||
for properName in group[groupName]:
|
||||
contents[-1][properName] = ''
|
||||
for k, i in dictionary.items():
|
||||
found = False
|
||||
|
||||
Reference in New Issue
Block a user