How to Update Spline Mesh from C++
I am working with splines from a C++ plugin to modify splines with some automation. Everything so far works fine with SplineComponent. However, the same cannot be said for SplineMeshComponent in updating geometry based on a spline modification.
Given a reference to a SplineMeshComponent in C++ code, what methods need to be called (from it or other objects) to trigger an update to the mesh so that it conforms to the updated spline shape?
The spline mesh actor that I use in the editor is created from a simple blueprint construct script, where it adds a SplineMeshComponent per spline segment. The resulting blueprint works fine, and updates as expected when tweaked visually in the editor. Just to be clear, the issue is not with this blueprint or its construction, but rather how to modify it after construction in editor mode from C++ code. The code cannot make assumptions of how a spline mesh is constructed.
The mesh will update if I move or rotate the related actor in the main editor view. I have called various Mark..Dirty methods, but those do not help. I have also looked at other code in the engine that use such a component, but mostly I am finding calls to MarkRenderStateDirty which has not worked for me. Hopefully an engine guru can point me to or provide a code snippet that will update the component properly.
Thank you for any assistance.
asked Feb 26 '16 at 04:07 PM in C++ Programming
The only resolution I could find to this problem is a work around which involves calling PostEditMove on the owner actor of the component. No method on the SplineMeshCompnent directly triggers the component's mesh regeneration. This seems like a bug. Hopefully this will help others who stumble across obscure problems in the C++ API such as this.
answered Feb 29 '16 at 11:36 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here