Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Merge function for two CurvySplines
#1
Hi _AKA_

I saw that you integrated a function to split or create subsplines. What is the best way to merge two splines within a batch script? Maybe you have a good idea? Smile

I tried it with changing the parent of the CPs (controllpoints) and then use the function SyncSplineFromHierarchy ().
Also I tried the function Add() or InsertAfter() but I was not able to "copy" the information of the original CP to the new CP.

Another thing is that I'm not sure if sometimes the Refresh() function for the CurvySpline comes too late and the next operation tries to access wrong data of a curvySpline.

The results I got so far feel a bit random and it is difficult for me to find the origin of my problem.

Background: I imported a lot of OSM data. I extended the data (like position,..) in every CP with OSM data (Street type,...). Sadly the streets consist of a lot of very small pieces and I need to merge them in a batch script. The script is running in [ExecuteInEditMode], so the result will be saved in the scene.

Best Greeting
HatraE
Reply
#2
Hi HatraE

"I tried it with changing the parent of the CPs (controllpoints) and then use the function SyncSplineFromHierarchy ()."
I was believing that this would work. Please send me your splines' merging code and I will see how to make it work.

"Another thing is that I'm not sure if sometimes the Refresh() function for the CurvySpline comes too late and the next operation tries to access wrong data of a curvySpline."
There is a good way to figure this out, which is to set the CURVY_SANITY_CHECKS preprocessor symbols. This will make Curvy log messages if you use its API incorrectly, helping you debug possible issues. These checks cost some additional CPU time. More information here: https://curvyeditor.com/documentation/ap...or_symbols
If you do set that symbol, you might get warnings from Curvy's code.
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
Hi _Aka_,

thanks for your quick response. At the end I just had a general issue. I tried to use a foreach loop to put the child/CP to another Parent/Spline. But in the case of taking children out, the index shifts and the foreach loop did not take every child. Anyway..  changing the parent and then using SyncSplineFromHierachy() worked.

I sometimes got problems when using the flip() function before merging two splines. Then the flip() function had no effect. Finally, I used a workaround to first flip all affected splines and afterwards (so after some more ms) merge them.
So everything is fine now. Thanks again!

HatraE
Reply
#4
Good to know that it is fixed.
About the Flip then merge issue, if you can send me a reproduction case I will debug that and hopefully find you a solution that does not involve waiting between both operations
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
cool! I will send you a reproduction case in the next days.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding function to set GameObjecs in InputGameObject.cs Mos Def 2 111 04-01-2021, 03:43 PM
Last Post: Mos Def
Question IndexOutOfRangeException in CurvySplineSegment.LocalFToDistance function mchangxe 11 505 03-22-2021, 07:07 PM
Last Post: _Aka_
  Some Questions about useful function I need UsernameHed 5 3,435 05-06-2019, 02:22 PM
Last Post: _Aka_
  Merge and Split path with Generator PassivePicasso 1 3,233 11-19-2015, 05:46 PM
Last Post: Jake

Forum Jump: