Material: Editor and import, only use mat keys if they have a value
This commit is contained in:
@@ -235,7 +235,11 @@ class MaterialEditor:
|
||||
for i2 in range(w.childCount()):
|
||||
c = w.child(i2)
|
||||
# TODO the following should be translated back to english,since text(0) could be translated
|
||||
d[self.collapseKey(str(c.text(0)))] = unicode(c.text(1))
|
||||
matkey = self.collapseKey(str(c.text(0)))
|
||||
matvalue = unicode(c.text(1))
|
||||
if matvalue or (matkey == 'Name'):
|
||||
# use only keys which are not empty and the name even if empty
|
||||
d[matkey] = matvalue
|
||||
return d
|
||||
|
||||
|
||||
|
||||
@@ -144,7 +144,8 @@ def write(filename,dictionary):
|
||||
# if the section has no contents, we don't write it
|
||||
f.write("[" + s["keyname"] + "]\n")
|
||||
for k,i in s.iteritems():
|
||||
if k != "keyname":
|
||||
if (k != "keyname" and i != '') or k == "Name":
|
||||
# use only keys which are not empty and the name even if empty
|
||||
f.write(k + "=" + i.encode('utf-8') + "\n")
|
||||
f.write("\n")
|
||||
f.close()
|
||||
|
||||
Reference in New Issue
Block a user