Look up materials with full path. Revert changes to the Material namespace
This commit is contained in:
@@ -694,27 +694,16 @@ class _ArchMaterialTaskPanel:
|
||||
resources_mat_path_std = os.path.join(resources_mat_path, "Standard")
|
||||
user_mat_path = os.path.join(FreeCAD.ConfigGet("UserAppData"), "Material")
|
||||
|
||||
paths = [resources_mat_path_std]
|
||||
paths = [resources_mat_path_std]
|
||||
if os.path.exists(user_mat_path):
|
||||
paths.append(user_mat_path)
|
||||
self.cards = {}
|
||||
library = None
|
||||
for p in paths:
|
||||
for root, _, f_names in os.walk(p):
|
||||
for f in f_names:
|
||||
b,e = os.path.splitext(f)
|
||||
if e.upper() == ".FCMAT":
|
||||
if p == resources_mat_path_std:
|
||||
root_removed = root.replace(resources_mat_path, '')
|
||||
library = "System"
|
||||
else:
|
||||
root_removed = root.replace(p, '')
|
||||
library = "User"
|
||||
mat_path = os.path.join(root_removed, f)
|
||||
# Material paths follow the OS' filesystem hierarchy but
|
||||
# are stored internally separated by '/', regardless of the platform
|
||||
# E.g. '/Standard/Metal/Steel/CalculiX-Steel.FCMat'
|
||||
self.cards[b] = (mat_path.replace(os.sep, '/'), library)
|
||||
self.cards[b] = os.path.join(root, f)
|
||||
if self.cards:
|
||||
for k in sorted(self.cards):
|
||||
self.form.comboBox_MaterialsInDir.addItem(k)
|
||||
|
||||
@@ -97,9 +97,9 @@ def decode(name):
|
||||
# as we had and we might will have problems again and again
|
||||
# https://github.com/berndhahnebach/FreeCAD_bhb/commits/materialdev
|
||||
|
||||
def read(filename, library):
|
||||
def read(filename):
|
||||
materialManager = Materials.MaterialManager()
|
||||
material = materialManager.getMaterialByPath(filename, library)
|
||||
material = materialManager.getMaterialByPath(filename)
|
||||
return material.Properties
|
||||
|
||||
# Metainformation
|
||||
|
||||
Reference in New Issue
Block a user