Size of object



  • How to get the size of a parametric object? As with BaseObject::GetRad()



  • Hi Passion3D thanks for reaching out us.

    With regard to your question I confirm that at the time of writing neither BaseObject::GetRad() nor BaseObject::GetMp() are exposed in Melange API.
    The way to go is to loop through all the points of the BaseObject instance using PointObject::GetPointR() and identify those two that represent the two extremes of the BBox. Then by computing the center of the BBox you can derive the corresponding radius.

    Best, Riccardo



  • For a polygonal object, I have no problem calculating the BBox.
    My question concerns PARAMETRIC objects, which do not have points.
    The information must exist in the.c4d file. Otherwise, how would Cinema4D find the size of a sphere or other parametric object?

    So, unless I get a description of the structure of a.c4d file, I must be able to find the size somewhere!



  • Hi Passion3D,

    even if there would already been the BaseObject::GetRad and BaseObject::GetMp methods in the Melange API, they would have been meaningful only for those items whose cache was been provided at the time of saving. Definitively providing a radius information for a parametric primitive without cache would result in a rather useless information being lacking the actual data relevant to the bounding box itself.

    Best, Riccardo



  • But how does Cinema4D know the size of a parametric sphere when loading a scene?
    There's got to be a way to find that information somewhere, no?

    Otherwise, can I get from Maxon, the specifications of the .c4d file format?



  • Hi,

    Riccardo has a day off today. So, I will fill in for him here.

    The thing is, the bounding box is not stored in the scene file. If we were to open our file specification, it wouldn't help here. Melange SDK on the other hand enables you to access our scene files and only the information stored therein. Melange has no means to evaluate a parametric object. Instead you need to make sure, the information needed by your target application can either be calculated there (e.g. having the concept of a parametric sphere, too) or got stored in the scene beforehand. For the sphere example you'd need your project to be "Saved for Melange", including all caches into the scene file. Then in Melange you can access the cache of the parametric sphere, thus getting hold of the actual polygon representation.

    But how does Cinema4D know the size of a parametric sphere when loading a scene?

    It doesn't. The bounding box gets calculated as needed.

    Cheers,
    Andreas



  • Hi Andreas

    Okay, thank you for these explanations ;)

    At the moment, the only solution is to limit the import to polygonal objects and exclude all parametrics objects.
    I hope that Melange will evolve to allow a total import of a c4d scene. This caching principle is not really practical:(



  • Sorry but I remain convinced that there is, somewhere in the scene file, an information that allows you to reconstruct a parametric sphere!
    Without this information, how does Cinema4D rebuild the sphere? With a session of spiritualism?
    A normal user will not always think to activate the options of the Mix SDK.
    I think I'll drop the c4d scene import.



  • Hi,

    of course there is information how to reconstruct a parametric sphere. It is actually the set of parameters needed by the "sphere generator". Check out for example our rounded tube example (here the Python example). For this rounded tube also only the parameters described in the resource files are saved in the scene file. And with these parameters the "generator module" is able to reconstruct everything needed. Everything else we consider baking (basically converting parametric objects into polygonal version) and roughly this is how "Save for Melange" works. Melange SDK itself, it contains no code to evaluate the scene (in the end it would involve having a complete C4D in there), only to access data stored in the scene files.

    There are by the way a bunch of applications, which have no issues with this approach. Also our own bridge to After Effects can work quite effectively.

    In your situation, I could imagine, maybe a small CommandData plugin customizing and doing the scene export for your needs could simplify the workflow for your users. Or, but that's certainly the more complex approach, you could work around file formats altogether and connect the applications via a "live bridge", where you then have full and direct access to C4D and can then access for example the generated caches as needed.

    Cheers,
    Andreas



  • Hi Andreas

    It is an external application, and therefore does not require the ownership of Cinema4D. It's not a plugin. Which means, no connection to C4D.
    This application also imports OBJ, FBX, 3DS...etc formats and it is not necessary to have the original applications of these formats!
    The SDK therefore does not seem to allow a total independent import of .c4d scenes.
    There will therefore be no Cinema4D import/export.

    Unless I can get the description on the structure of a .c4d file. In this case, I would write my own import/export library ;)
    Of course, the information received will remain confidential.


Log in to reply