-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot change 'primitive_type' member when inheriting 'PrimitiveMesh' #77447
Comments
I'm not sure this is a bug. The PrimitiveMesh is designed around having triangle meshes (except for the PointMesh). I think it would be easier to inherit from Mesh instead. In other words, I don't think you gain much benefit from inheriting from PrimitiveMesh if you want to use a different primitive type |
Well I first though it would better suit my purpose to reuse PrimitiveMesh. I'm looking into the use of a Mesh instead. So far, it looks simpler to use a PrimitiveMesh as one only need to override a function and return an Array. Mesh introduce more complex logic with surface / bones ... and server side calls. I understand that my use-case is not enough to introduce this change. Perhaps the documentation could be updated to clearly state what you explained? Maybe something like:
|
I'm not sure this is warranted, there's plenty of types that aren't intended to be inherited, and I don't really see that people would be likely to do so, and this isn't really not so either, it's just not as flexible as you assumed, clarifying this everywhere it might be relevant would bloat the documentation |
I did not realize it until I dig into the engine's code. I thought I could inherit PrimitiveMesh for my purpose, seeing how it was already inherited / used by the engine.
In deed, well I'll remember to check the engine's code first. |
Godot version
4.0.3-stable (5222a99)
System information
Windows 10
Issue description
Inheriting from
PrimitiveMesh
is limited. I try to create a customBoxMesh
but drawn usingPRIMITIVE_LINES
. However, from the child class, I cannot set theprimitive_type
of the parent class to usePRIMITIVE_LINES
instead of the defaultPRIMITIVE_TRIANGLES
value.Steps to reproduce
test.tscn
to see the TestMesh drawn usingPRIMITIVE_TRIANGLES
.test.gd
to see there is no way to setPRIMITIVE_LINES
.Note: opening the scene in editor will spam an error (related to #59605) in
Output
tab.Minimal reproduction project
2023-05-24_gd_issue_primitivemesh.zip
As a proposal,
PrimitiveMesh
could include a setter/getter on theprimitive_type
member. I'd be happy to contribute a PR if such a solution is accepted.The text was updated successfully, but these errors were encountered: