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/namespace_fluffy_underware_1_1_curvy_1_1_generator_1_1_modules.html
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
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 4 Yesterday, 03:23 AM
Last Post: _Aka_
  Generating GO only on CPs in Generator GameDeveloperek4123 1 6 03-04-2024, 11:06 AM
Last Post: _Aka_
Question Generator Canvas workflow issues Sacryn 1 7 02-02-2024, 11:22 PM
Last Post: _Aka_

Forum Jump: