[Part] Set App::Part's Material property type to App::PropertyLink (instead of App::PropertyMap)

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
howetuft
Posts: 290
Joined: Tue Sep 10, 2019 8:16 pm

[Part] Set App::Part's Material property type to App::PropertyLink (instead of App::PropertyMap)

Post by howetuft »

Hello all,

This is a proposal I initially made here: https://github.com/FreeCAD/FreeCAD/pull/4503, but I'm now transferring to the forum so that it can be discussed.

App::Part has a Material property which type is currently App::PropertyMap.
However, to be consistent with other domains using materials (like Arch, especially) and with FreeCAD Material system, it should rather be App::PropertyLink.
Indeed, this is required to link a Material card to the object. Such a consistency is expected from workbenches which use the Material system extensively (like Render workbench).

Therefore my proposal is to make the type of App::Part Material property evolve to App::PropertyLink.

For existing documents with objects having a Material property of the old type, 2 cases:
  • If the property is empty, it would be converted to App::PropertyLink.
  • If the property has been filled in, we would transfer its content to a Material_old property and we create a Material property of type App::PropertyLink (with a warning message for the user)
Anyway, my guess is that 2nd case should be rare: property of old type is of limited use, as it prevents using material cards.

Any comments welcome...
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: [Part] Set App::Part's Material property type to App::PropertyLink (instead of App::PropertyMap)

Post by adrianinsaval »

makes sense to me, is there anything that used this property in Parts before?
howetuft
Posts: 290
Joined: Tue Sep 10, 2019 8:16 pm

Re: [Part] Set App::Part's Material property type to App::PropertyLink (instead of App::PropertyMap)

Post by howetuft »

Thank you for your feedback! I've accordingly added a commit to my PR...
And, to answer your question: no, as far as I know.
Post Reply