Skip to content

Commit

Permalink
Material: Editor and import, only use mat keys if they have a value
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Jun 1, 2018
1 parent bf11a5f commit 6ae0aa0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Mod/Material/MaterialEditor.py
Expand Up @@ -235,7 +235,11 @@ def getDict(self):
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


Expand Down
3 changes: 2 additions & 1 deletion src/Mod/Material/importFCMat.py
Expand Up @@ -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()

0 comments on commit 6ae0aa0

Please sign in to comment.