Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug: Save Generator Outputs still saves outputs if object is disabled
#1
I found an issue with the latest Curvy Splines version.

When Save Generator Outputs is off and we disable the GameObject containing the CurvyGenerator and then save the scene, we can see the scene file size is much bigger. If I set it to active again, scene size goes back to normal.

In my use case, I only use CurvyGenerator to create the mesh and then disable the object since I have the mesh already in the scene. Later if I want to generate again, I just delete the mesh and activate the GameObject.
Reply
#2
Hi,

Thank you for reporting this bug. Indeed, the "Save Generator Outputs" options was not working on disabled generators. I wrote a fix. I will further test it and release it with the next update. Until then, you have two choices, depending on your preferences:

Modifying the code of Curvy Splines to include the fix:
Go to Extensions.cs, then the ObjectExt class. Add to it the following method:

Code:
        /// <summary>
        /// A method compatible with all Unity version, that returns all objects of a given type, unsorted
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static T[] FindUnsortedObjectsOfType<T>(
            bool includeInactive) where T : Object
        {
#if UNITY_6000_0_OR_NEWER
            return Object.FindObjectsByType<T>(
                includeInactive
                    ? FindObjectsInactive.Include
                    : FindObjectsInactive.Exclude,
                FindObjectsSortMode.None
            );
#else
            return Object.FindObjectsOfType<T>(includeInactive);
#endif
        }

Then go to CurvyGenerator.cs, then the OnSceneSaving method. Replace it with the following:
Code:
        private static void OnSceneSaving(
            Scene scene,
            string path)
        {
            if (CurvyGlobalManager.SaveGeneratorOutputs)
                return;

            //clear all output GOs to avoid saving them.
            CurvyGenerator[] generators = ObjectExt.FindUnsortedObjectsOfType<CurvyGenerator>(true);
            foreach (CurvyGenerator generator in generators)
                //only if the generator is supposed to refresh automatically, otherwise the users might not expect their generator to update
                if (generator.AutoRefresh)
                    foreach (CGModule module in generator.Modules)
                        if (module.DeleteAllOutputManagedResources())
                            module.Dirty = true; //to force update once saving is done
        }


Workaround the issue:
You can avoid the issue by clicking on the "Clear Output" button on the generator's toolbar before disabling it.


Please let me know if you still encounter this issue.
Thank you for your bug report, and 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


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_
  Player move with object mcarman 4 8 07-29-2024, 06:49 PM
Last Post: mcarman
  How can I set the generator to stop updating? emerrryjones 1 10 07-26-2024, 10:07 AM
Last Post: _Aka_
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 1 13 04-03-2024, 03:16 PM
Last Post: _Aka_

Forum Jump: