Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change Shape Extrusion of Generator by code
#1
Hello,

[Image: IFdjWaGoi5k_shape.PNG]

I Would Like from an editor script, to access this 2 property and modify it, and then Update the CurvyGenerator.

My goal is: I have 2 custom SPlineController on the road, and depending of their percent on the road, create a mesh from the start of it to the end, like that:
[Image: IFdke2HQW6k_curvy.PNG]
(For now, I have set this value from your CurvyGenerator editor)

So now from code: I have in my script the CurvyGenerator reference.

1) First, I would like to Set the Spline of the curvyGenegator dynamically.
I Guess I have to search for
Code:
curvyGenerator.InputSplinePath.Spline = mySpline
.
But I don't find how to get it.

2) Next, I would like to do something like:
Code:
curvyGenerator.BuildShapeExtrusion.Range = 0.02f;

curvyGenerator.BuildShapeExtrusion.Lenght = 0.001f;

3) And then:
Code:
curvyGenerator.Refresh()
-> will it refresh the mesh ?
Reply
#2
1) curvyGenerator.Modules.OfType<InputSplinePath>() will give you the modules of said type.Then select the module you want, and assign its spline through the Spline property
2) same method as before to get the BuildShapeExtrusion module, than use the From, To, and Length properties, depending on your preferences
3) Calling Refresh will refresh the mesh. Be aware of the existence of its optional parameter
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
(06-03-2019, 02:00 PM)_Aka_ Wrote: 1) curvyGenerator.Modules.OfType<InputSplinePath>() will give you the modules of said type.Then select the module you want, and assign its spline through the Spline property
2) same method as before to get the BuildShapeExtrusion module, than use the From, To, and Length properties, depending on your preferences
3) Calling Refresh will refresh the mesh. Be aware of the existence of its optional parameter

Hello

i didnt get ur answer and i try to do similar thing. I want to change Generator>ShapeExtrusion>Path>Range on runtime. Is this possible?
Reply
#4
Hi,
In your code, given a curvyGenerator reference, call curvyGenerator.Modules.OfType<BuildShapeExtrusion >() to get all the "Shape Extrusion" modules. Then iterate through that list, and modify their From and To properties to modify their Range.
For performance reasons, you might want to cache the result of curvyGenerator.Modules.OfType<BuildShapeExtrusion >()
Have a nice day
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#5
(09-16-2019, 01:41 PM)_Aka_ Wrote: Hi,
In your code, given a curvyGenerator reference, call curvyGenerator.Modules.OfType<BuildShapeExtrusion >() to get all the "Shape Extrusion" modules. Then find suitable rangefinders for hunting here and iterate through that list, and modify their From and To properties to modify their Range.
For performance reasons, you might want to cache the result of  curvyGenerator.Modules.OfType<BuildShapeExtrusion >()
Have a nice day

Does performance take a huge hit if you don't do that?
Reply
#6
Not for for most usages.
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I have to refresh generator manualy :( GameDeveloperek4123 4 13 10-07-2024, 05:36 PM
Last Post: _Aka_
  Bug: Save Generator Outputs still saves outputs if object is disabled curvymesher 1 3 08-30-2024, 09:19 AM
Last Post: _Aka_
  How can I set the generator to stop updating? emerrryjones 1 10 07-26-2024, 10:07 AM
Last Post: _Aka_
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 10 22 04-17-2024, 10:57 AM
Last Post: _Aka_

Forum Jump: