Serializing a spline, how?



  • On 21/08/2013 at 09:07, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R13-R14 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    How would you go about to serialize a spline? That is get hold of all the data needed in order to recreate it? No cloning / copying here. I might want to store the data in a disc file, and read this file later, in order to create an exact copy. I am just after what data to collect and how.
    This is an example:

    Edited:
    To sum it up: What spline properties do I need to know, in order to create an identical spline programmatically?



  • On 21/08/2013 at 15:47, xxxxxxxx wrote:

    its pretty straight forward you you just need three vector arrays - one for the control point vectors 
    in local spline space and two for the left and right tangent in the local control point space. you can 
    also store the spline type and the spline closed state if you do want to support closed splines and 
    other interpolations than the bezier interpolation.

    i did something like that some time ago in python ( i do not have the code here). i did use a
    base container hierarchy to store the splines in a hyperfile.

    bc spline
    	bc data
    		bc sgement0
    			bc point0
    				int point id
    				vector p
    				vector t0
    				vector t1
    			bc point1
    			bc point2
    			...
    		bc sgement1
    		bc sgement2
    		...
    	int type
    	bool closed
    


  • On 22/08/2013 at 03:00, xxxxxxxx wrote:

    Thanks,
    I will try to understand it. I also found this:
    http://www.microbion.co.uk/graphics/c4d/create_plugins4b.htm
    which is about creating a spline. Knowing that, I might probably learn how to read out the data from a spline too.


Log in to reply