Open shahriarlabib000 opened 3 weeks ago
I was trying to access a MeshInstance3D's material. It only had one material.
MeshInstance3D
Not really a limitation just for convenience. Same for These https://github.com/godotengine/godot/blob/fd7239cfab228c50777cd54a8bf6eb279a02ef81/scene/3d/mesh_instance_3d.h#L86-#L88
Convenient when you only want to access a single/first material
Something like this maybe Ref<Material> get_active_material(int p_surface=0) const;
Ref<Material> get_active_material(int p_surface=0) const;
Yes,infact you don't even need any extra line just mesh.get_active_material(0)
mesh.get_active_material(0)
I don't know
So I updated the code.But couldn't test it since I'm using Android.But yeah if this gets approved maybe I'll attempt a pull request. Here is the updated branch
Describe the project you are working on
I was trying to access a
MeshInstance3D
's material. It only had one material.Describe the problem or limitation you are having in your project
Not really a limitation just for convenience. Same for These https://github.com/godotengine/godot/blob/fd7239cfab228c50777cd54a8bf6eb279a02ef81/scene/3d/mesh_instance_3d.h#L86-#L88
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Convenient when you only want to access a single/first material
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Something like this maybe
Ref<Material> get_active_material(int p_surface=0) const;
If this enhancement will not be used often, can it be worked around with a few lines of script?
Yes,infact you don't even need any extra line just
mesh.get_active_material(0)
Is there a reason why this should be core and not an add-on in the asset library?
I don't know