Add a material to the Materials Database
-
Hello,
I would like to get some assistance in editting the material database, using python API.
I tried this code, but nothing changed in the database:import XMaterials as xm
import s4l_v1 as s4ldb = s4l.materials.database['User test']
print('#1| number of materials in "test" db: '+ str(len(s4l.materials.database['User test'].AllMaterials)))
mat = [m for m in db.AllMaterials if m.Name == u'test'][0]
new_mat = s4l.materials.database.Edit().CreateMaterial(db._Database__raw,'test3',db._Database__raw.Id)
s4l.materials.database.Edit().UpdateMaterial(new_mat,u'test3',db._Database__raw)
s4l.materials.database.Edit().Commit()
print('#2| number of materials in "test" db: '+ str(len(s4l.materials.database['User test'].AllMaterials)))>>>
#1| number of materials in "test" db: 2
#2| number of materials in "test" db: 2Thanks a lot,
Oshrit