Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reuse Curvy Generator
#1
Hey,
Is it possible to have one simple generator and create multiple meshes from it by changing the spline by code, setting everything to dirty and calling refresh?
If the spline changes, I could update by removing the mesh, plugging in the spline, and refreshing the generator.

My question is if this would work and if it would be performant.
The created game objects for example, I would need to manually handle the pooling I guess.


Thank you in advance for your help :-)
Reply
#2
Hi,
It is way easier that that: just update the Spline value of the  InputSplinePath module used in your CurvyGenerator, and that's it. Everything else is done automatically

Here is a simple example:
Code:
public class Test: MonoBehaviour
{
   public InputSplinePath InputModule;
   public CurvySpline S1;
   public CurvySpline S2;

   public bool Switch;

   // Update is called once per frame
   void Update()
   {
       if (Switch)
       {
           Switch = !Switch;
           if (InputModule.Spline == S2)
               InputModule.Spline = S1;
           else
           {
               InputModule.Spline = S2;

           }
       }
   }
}
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
The problem with this solution is, that I want to preserve the generated mesh and objects. When I just switch the spline the previous mesh and objects get removed
Reply
#4
The Create Mesh module has a Save To Scene and a Save Mesh Asset(s) actions
https://curvyeditor.com/documentation/generator/modules/createmesh?redirect=1#export
Save To Scene is also available through the API
https://api.curvyeditor.com/600/class_fluffy_underware_1_1_curvy_1_1_generator_1_1_modules_1_1_create_mesh.html#a199bfd2c105f125ab8f63ded7f0e3346
So you have to save your asset to scene first, then replace the extrusion spline
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
perfect, that is exactly what I need :-)
Thanks a lot!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 1 2 48 minutes ago
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 1 1 58 minutes ago
Last Post: _Aka_
Exclamation Extending Curvy Generator for Advanced Lofting - Feasibility Check amutp 2 4 Yesterday, 07:25 AM
Last Post: amutp
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 0 6 Yesterday, 03:23 AM
Last Post: _Aka_

Forum Jump: