Material property in CSGPrimitive3D

So, CSGPrimitive3D is a base class for CSGBox3D, CSGCylinder3D, CSGMesh3D, CSGPolygon3D, CSGSphere3D and CSGTorus3D: CSGPrimitive3D — Godot Engine (stable) documentation in English and every one of these classes has a property material of type Material, i.e. CSGBox3D — Godot Engine (stable) documentation in English

My question is, if anyone knows, is there any particular reason why this property is not in the CSGPrimitive3D instead of having it repeat in every class that inherits from CSGPrimitive3D?

It seems a very trivial change in Godot source to move material to CSGPrimitive3D, basically moving Ref<Material> material; from all of these extending classes to CSGPrimitive3D class: godot/modules/csg/csg_shape.h at 084d5d407e62efcd5be9de44148c5dedce3b9386 · godotengine/godot · GitHub, and if there are no obvious downsides I’m thinking to submit PR for it.

Thanks!

The only downside I can imagine is if there were a subclass that does not contain that value. I am not aware of any, and I cannot see why there would be. So it makes sense to me for Material to be inherited.

Have you checked the source to confirm it is not? It might simply be missing from the docs because you cannot interact with the primitive directly.

Yes, a subclass with no material might be an issue, but it seems that these are the only classes that extend CSGPrimitive3D


so in this case it might be ok.
One thing I saw is that only CSGPolygoin3D has the material property set as private, but all sub-classes have get/set_material methods so I don’t think it matters much that the property itself is private or not (I’m not fluent in all thins C++, I might be wrong).
I’ll see if my (rudimentary) understanding of C++ allows me to move material to CSGPolygon3D and submit a PR.

Thanks for the comment!