Skip to content
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

ArrayMesh surface_remove() missing in 4.0 #67181

Closed
Xyotic opened this issue Oct 10, 2022 · 9 comments · Fixed by #76371
Closed

ArrayMesh surface_remove() missing in 4.0 #67181

Xyotic opened this issue Oct 10, 2022 · 9 comments · Fixed by #76371

Comments

@Xyotic
Copy link

Xyotic commented Oct 10, 2022

Godot version

4.0 beta 1

System information

Windows 10, Nvidia RTX2080

Issue description

In 4.0, ArrayMesh is missing the 'surface_remove' method and there doenst seem to be an alternative.
Accessing the surface array directly and removing an entry also doesnt seem to work.
Currently the only way is to use 'clear_surfaces'. Which I think would have a negative performance impact if you'd always clear all surfaces and set new ones.
In 3.x 'surface_remove' is still present.

Steps to reproduce

Add a surface to an ArrayMesh via 'add_surface_from_arrays' and try to remove it.

Minimal reproduction project

No response

@Calinou
Copy link
Member

Calinou commented Oct 10, 2022

See #41767.

@Xyotic
Copy link
Author

Xyotic commented Oct 10, 2022

Is there a workaround for now that doesnt include the use of 'clear_surfaces'? @Calinou

@Zireael07
Copy link
Contributor

Seconding, I was using this for some very simple deformations and had to give up on those in 4.0

@Xyotic
Copy link
Author

Xyotic commented Oct 13, 2022

Removing surfaces also seems to be missing from RenderingServer3D. So this server cant be used as a workaround.

@clayjohn clayjohn modified the milestones: 4.0, 4.x Jan 12, 2023
@prominentdetail
Copy link
Contributor

prominentdetail commented Mar 1, 2023

This makes it difficult to add surfaces to a mesh without it. Sure you can clear all the surfaces, but if you are relying on the previous surfaces to generate new surfaces, you don't want to clear them all when you need to add each one separately.. :(
I'm using MeshDataTool's create_from_surface(mesh, 0).. then commit the surface back into the mesh(while removing the original). So I need to do each surface at a time and I can't do it if I clear the surfaces, because then it just clears ones that I've added.

Edit: Okay, so a workaround I found., I am duplicating the mesh, and refering to the duplicated mesh's surfaces while I clear the original mesh's surfaces. This makes things more bearable. I just clear all the surfaces once, and then create the new surfaces from the duplicated mesh that I've stored at the start.

@ze2j
Copy link
Contributor

ze2j commented Apr 21, 2023

I don't know if someone started some work on it, but I started to (re)implement this function and I should be able to make a PR next week for both OpenGL and Vulkan renderers.

@Chaosus Chaosus added the bug label Apr 23, 2023
@Chaosus Chaosus modified the milestones: 4.x, 4.1 Apr 23, 2023
@nvanfleet

This comment has been minimized.

@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 23, 2023
@AThousandShips AThousandShips modified the milestones: 4.2, 4.3 Oct 30, 2023
@KoBeWi KoBeWi modified the milestones: 4.3, 4.x Aug 3, 2024
@EsotericDude
Copy link

Any updates? This would be a very useful function.

@Calinou
Copy link
Member

Calinou commented Nov 23, 2024

@EsotericDude #76371 implements this feature but it needs to be rebased before I can review it.

@clayjohn clayjohn moved this from For team assessment to In progress / Assigned in Rendering Issue Triage Dec 11, 2024
@github-project-automation github-project-automation bot moved this from In progress / Assigned to Done in Rendering Issue Triage Dec 20, 2024
@Repiteo Repiteo modified the milestones: 4.x, 4.4 Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.