Skip to content

Latest commit

 

History

History
199 lines (123 loc) · 9.82 KB

File metadata and controls

199 lines (123 loc) · 9.82 KB

FEP-0006 Materials Editor

FEP-0006
Type Core Change
Status Active
Author(s) David Carter
Version 1.0
Created 2025-07-04
Updated 2026-01-28
Discussion https://forum.freecad.org/viewtopic.php?t=96071
Implementation

Rework of the materials editor to improve usability.

Motivation

The original material editor was a rush development. A lot had to be in there to achieve what's known as Minimal Viable Product (MVP). I tried to anticipate what people would need as a workflow knowing full well that as people would start to use it issues would arise. Unfortunately it didn't get a lot of use prior to the release of 1.0, but now that people have had the opportunity some of its deficiencies have become apparent.

It's time to address those deficiencies, and to add support for new capabilities.

Current outstanding PRs:

Enhancements

Issues

Rationale

The primary goals of the reworked editor include:

  • Consistency and simplicity of the user interface
  • The tree works like a file tree
    • Right click operations such as create/rename/delete/cut/copy/paste
    • Drag and drop to move materials and folders, including across libraries
  • Search support
  • Support for external libraries (database/web service/etc)
    • Creation of new libraries

Specification

Scope

This proposal covers only the materials editor. It does not cover all things materials such as implementation within the workbenches, assignments of materials or appearances to parts, etc. While important those are separate topics warranting separate discussions. There is a lot of room for improvement across the board.

Limiting the scope is essential for producing deliverable results.

Libraries

Libraries fall into two basic categories: local and remote.

A local library is a folder containing a number of material cards. This is the method used up to FreeCAD V1.0. Specifying the libraries was done using FreeCAD preferences. It allowed for optional inclusion of various system libraries, including a special user library within the user's directory for storing their personal materials. In addition there was an option to add a single custom library folder anywhere on their local system. Add on modules can also specify their own libraries for both models and materials.

Remote libraries use the recently introduced external interface to implement library functionality. These may store materials in a database locally or remotely, use a web service to access libraries, or any of a number of other methods.

Both types are accessed through common interface classes: the MaterialManager for materials, and the ModelManager for models.

Material Tree

The material tree will look similar to that of the current editor, but will be used to drive more editor operations. Libraries and folders will be created and modified in the tree. Material details will still be presented and edited once selected, but new materials will be created, named, or renamed in the tree.

Toolbar

This is a new feature of the editor replacing the push buttons on the right pain. It includes common operations that can be enabled or disabled with context. From left to right, these actions are:

  • New Material
  • New Material From Selected
  • New Library
  • New Folder
  • Cut
  • Copy
  • Paste
  • Add/Remove Favorite

Right Click Menu

This was under development prior to 1.0 but wasn't completed due to resource and time issues.

Right clicking on any item in the tree displays a context sensitive menu with operations available on either the item or the tree in general.

Favorites Menu

Recents Menu

Library Menu

Folder Menu

Material Menu

Drag and Drop Support

Materials and folders can be dragged to new locations within a library, or even across libraries subject to appropriate permissions.

Search Support

Basic search will be a simple substring match on the material folder or name. Selecting advanced search will allow the user to select more parameters for the search. For example, the search can match on property values or material tags depending on what the user selects.

Tag Widget

Tags have been a part of the materials specification as part of the original design, but have not been supported in the materials editor due to time constraints. A generic Tags widget will support tag editing and added as a core widget. multiple tags are entered separated by commas, or singly ended when return is entered. They can be edited, or removed when the cross on the tag is selected.

External Library Support

As mentioned previously, the editor will fully support materials saved in add on modules using either the external module interface, or by providing local libraries using the preferences.

Impact on existing features / subsystems

Local libraries are currently managed through preference pages. This will be removed from the preferences in favor of the updated editor.

Legacy applications are still directed through the model and material managers for material data, so no change should be required to support external interfaces.

Existing consumers of material data should be unaffected by changes in the editor.

Component Source Location
TagWidget Gui
Editor Mod/Maaterial/Gui
External Interface Mod/Material/App

Backwards Compatibility (only for Core Changes)

No backwards compatibility issues are anticipated except as noted in the previous section. There are no changes to the material files or formats.

Open Issues (optional)

(TBD) Discussion of issues that are not yet answered in terms of specification.

Rejected Ideas (optional)

(TBD) List of ideas that were rejected at discussion stage with rationale on why they were rejected.

Alternatives (optional)

(TBD) Discussion about alternative approaches considered during the design or the discussion.

Implementation

The interface to the materials system is through the ModelManager and MaterialManager classes. Operations for local and remote libraries are distributed by the manager classes as appropriate.

FAQ (optional)

(TBD) Frequently Asked Questions ans answers to them, based on author

Further Work (optional)

(TBD) Discussion on further work related to the FEP that can be done.

Changelog (once more versions are released)

(TBD) Any substantial changes to the FEP should be recorded in this section - latest changes should be on top:

References (optional)

https://forum.freecad.org/viewtopic.php?t=96071

Prototype: https://github.com/davesrocketshop/FreeCAD branch editor_tree_functions8

Database external module: https://github.com/davesrocketshop/MaterialDB

License / Copyright

All FEPs are explicitly CC0 1.0 Universal.