godot icon indicating copy to clipboard operation
godot copied to clipboard

It's possible to create abstract resource classes using the inspector (e.g. Mesh or PrimitiveMesh in MeshInstance3D)

Open Calinou opened this issue 3 years ago • 1 comments

Godot version

4.0.alpha (a0071029f2c4ec006d3443f25aa77e2c2c7a1ece)

System information

Fedora 34, GeForce GTX 1080 (NVIDIA 495.46)

Issue description

Since https://github.com/godotengine/godot/pull/58972 was merged, it's now possible to create abstract resource classes using the inspector:

image

These abstract classes should probably be hidden again, as it's confusing (and may cause crashes on instantiation for specific resources).

Steps to reproduce

  • Add a MeshInstance3D node.
  • Add a Mesh or PrimitiveMesh resource to the Mesh property of the MeshInstance3D node.
  • Notice error spam after adding a Mesh or PrimitiveMesh resource:

Example with Mesh

ERROR: Required virtual method: Mesh::_get_surface_count must be overriden before calling.
   at: _gdvirtual__get_surface_count_call (scene/resources/mesh.h:61)
ERROR: Required virtual method: Mesh::_get_blend_shape_count must be overriden before calling.
   at: _gdvirtual__get_blend_shape_count_call (scene/resources/mesh.h:71)
ERROR: Required virtual method: Mesh::_get_aabb must be overriden before calling.
   at: _gdvirtual__get_aabb_call (scene/resources/mesh.h:74)

Example with PrimitiveMesh

ERROR: _create_mesh_array must return at least a vertex array.
   at: _update (scene/resources/primitive_meshes.cpp:48)

Minimal reproduction project

N/A

Calinou avatar Mar 27 '22 22:03 Calinou

This also happens when you create a custom resource class that a bunch of other classes inherit. For example, I have a base ColorSource class inheriting from Resource, and a couple of different child classes that each implements a different way to determine a color (for a shader; but that doesn't matter.)

In another class, I have a @export var color_source : ColorSource, and the resource dropdown in the inspector correctly presents all child classes inheriting from ColorSource, but also ColorSource itself. I'd love to be able to mark it as abstract, or otherwise hide it.

Not the most critical of issues, but maybe it can be re-assigned to one of the upcoming milestones for visibility?

hmans avatar Mar 09 '23 15:03 hmans

In 4.0.3-stable (5222a99), looking at inspector does not show PrimitiveMesh (please ignore WireframeBoxMesh and TestMesh as they are custom implementation): 2023-05-24_godot_issue_abstract-resource-inspector

However, at least the following error is still present in Output (here due to TestMesh GDScript declaration):

ERROR: _create_mesh_array must return at least a vertex array.

poirierlouis avatar May 24 '23 14:05 poirierlouis