Material: Material Preferences

Updates the material preferences including selecting a default material

Preferences adds some options for what gets displayed in the Materials editor.
The option to use the legacy editor is removed in favour of the new
editor.

A new preference page has been added that allows the user to select a
default material. This will then be assigned to any newly created object. In
support of this, a new widget PrefsMaterialTreeWidget has been added as an
extension of the MaterialTreeWidget to automatically save and restore the
selected material.
This commit is contained in:
David Carter
2024-05-12 16:07:30 -04:00
committed by Chris Hennes
parent 6c4f76a8a5
commit 4dcd810ac5
21 changed files with 586 additions and 57 deletions

View File

@@ -944,13 +944,13 @@ def translate(context, text):
def openEditor(obj=None, prop=None):
"""openEditor([obj,prop]): opens the editor, optionally with
an object name and material property name to edit"""
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Material/Cards")
legacy = param.GetBool("LegacyEditor", True)
if legacy:
editor = MaterialEditor(obj, prop)
editor.exec_()
else:
FreeCADGui.runCommand('Materials_Edit',0)
# param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Material/Cards")
# legacy = param.GetBool("LegacyEditor", True)
# if legacy:
# editor = MaterialEditor(obj, prop)
# editor.exec_()
# else:
FreeCADGui.runCommand('Materials_Edit',0)
def editMaterial(material=None, card_path=None, category="Solid"):