Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Manipulate Generator properties in c#?
#1
Couldn't find any information on how to do this on the website.

I'm trying to manipulate the Length property of a Shape Extrusion module in a generator.

Thought it would be something like this but it seems the CGShapeExtrusion is not a class - 

Code:
GameObject go = GameObject.Find("Generator");
        CurvyGenerator gen = go.GetComponent<CurvyGenerator>();
        CGShapeExtrusion se = gen.GetModule<CGShapeExtrusion>("Shape Extrusion");


Any help much appreciated!
Reply
#2
Figured it out - 

Code:
        GameObject go = GameObject.Find("Generator");
        CurvyGenerator gen = go.GetComponent<CurvyGenerator>();
        BuildShapeExtrusion module = gen.GetModule<BuildShapeExtrusion>("Shape Extrusion");
        if (module.Length < 1.0f)
            module.Length += 0.01f;
        else
            module.Length = 0;
Reply
#3
Yes, that's the class. Most IDE have auto completion integrated in them. Using that, and by inputting the module's name, you can usually instantly find the class name. Also, the api reference is here for such cases. Here are the classes in the FluffyUnderware.Curvy.Generator.Modules name space: https://api.curvyeditor.com/710/namespac...dules.html
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#4
Great! I'm also trying to manipulate the Width for an Input Spline Shape using a 2D/Rectangle programmatically but I'm not seeing it in intellisense.



Code:
InputSplineShape splineShape = gen.GetModule<InputSplineShape>("Input Spline Shape");

        splineShape.Width

Appreciate the help!


Attached Files Thumbnail(s)
   
Reply
#5
Hi
(yourInputSplineShape.Shape as CSRectangle).Width
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#6
Thank you for the prompt response!
Reply
#7
Doesn't seem to work - 
Code:
InputSplineShape splineShape = gen.GetModule<InputSplineShape>("Input Spline Shape");

        CSRectangle rect = splineShape.Shape as CSRectangle;

Cannot convert type 'FluffyUnderware.Curvy.CurvySpline' to 'FluffyUnderware.Curvy.Shapes.CSRectangle' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion Assembly-CSharp, Assembly-CSharp.Player


Even if I try a cast - 

Cannot convert type 'FluffyUnderware.Curvy.CurvySpline' to 'FluffyUnderware.Curvy.Shapes.CSRectangle'

Thanks!
Reply
#8
ah sorry, my bad
splineShape.Shape.GetComponent<CSRectangle>()
Does this work?
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#9
That did it! Thanks Smile
Reply
#10
You are welcome. If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to rotate generator asteroids patndan74 6 3,629 05-08-2025, 10:07 PM
Last Post: _Aka_
  I have to refresh generator manualy :( GameDeveloperek4123 4 2,811 10-07-2024, 05:36 PM
Last Post: _Aka_
  Bug: Save Generator Outputs still saves outputs if object is disabled curvymesher 1 1,603 08-30-2024, 09:19 AM
Last Post: _Aka_
  How can I set the generator to stop updating? emerrryjones 1 1,467 07-26-2024, 10:07 AM
Last Post: _Aka_

Forum Jump: