Using Cache in SplineObject generators?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/02/2009 at 08:36, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.1 
    Platform:   Windows  ; Mac  ;  
    Language(s) :     C++  ;

    ---------
    Hi,

    in the Circle example in the SDK, I saw the following function:

    > void OSurfaceWire::CheckDirty(PluginObject\* op, BaseDocument\* doc) \> { \>      if (doc->GetDirty(DIRTY_DATA)) op->SetDirty(DIRTY_DATA); \> }

    But this sets the object dirty as soon as anything in the scene is changed. Is there a way to use the cache (last generated) spline, unless one of the generator's children has been changed?

    I would like a solution like the DependenceList and GetCache() as it can be used in GetVirtualObjects(). But in this object (as in the circle example) just the function GetContour() is being used. Dependence list doesn't seem to work fine here.

    Thanks for tips :)

    Cheers,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2009 at 04:16, xxxxxxxx wrote:

    Does anybody have an idea about this? Would be great!
    Thanks in advance!

    Greetings,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2009 at 05:53, xxxxxxxx wrote:

    Why don't you just use GetVirtualObjects() and return your spline there?

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2009 at 10:18, xxxxxxxx wrote:

    I don't know. I thought it would probably be a good idea to do it like it's done in the SDK example ;-)

    If it works with GetVirtualObject, too, thenn I'll use that.

    Thanks Matthias!

    Greetings,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/03/2009 at 08:05, xxxxxxxx wrote:

    I tried to use GetVirtualObjects(), but it doesn't work. A crash occurs when I try to use ->InitLength() on the returned spline. Also, using ->GetRealSpline() on the returned object returns NULL.

    Is there an example how to make a spline generator object using GetVirtualObjects()? As i said, the SDK example also uses GetContour(), but I need to get the Cache working.

    Thanks in advance ;-)

    Greetings,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/03/2009 at 08:54, xxxxxxxx wrote:

    Or maybe I should ask another question:

    If I don't use GetContour() to return my spline, but just GetVirtualObjects(); how can I access the Real Spline from another plugin?

    For example, an ExtrudeNURBS object can work with the spline returned by GetVirtualObject. But my plugin can't work with that spline. What's the trick to make it work?

    Greetings,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/03/2009 at 09:42, xxxxxxxx wrote:

    OK, I have solved the problem, but the solution doesn't look very elegant. Here we go...

    In the plugin that uses the generated spline (not in the spline object plugin itself), I do the following to get access to the spline:

    > \> SplineObject \*sp = (SplineObject\* )bc->GetObjectLink(SURFACESPREAD_LANDSCAPE_NOISE_1\_SPLINE, doc); \> if (!sp) return; // If no spline at all: abort \> if (sp->GetRealSpline()) sp = sp->GetRealSpline(); // If Real Spline available, use it (this does not work with my plugin spline generator, so we need the following code lines, too) \> else \> { \>      if (sp->GetCache()) sp = (SplineObject\* )sp->GetCache(); // Get cache (that's the spline returned by the plugin spline object) \>      if (!sp->GetRealSpline()) sp = sp->GetRealSpline(); // Just for convenience: Get real spline, if available \> } \>

    This can't possibily be the ideal way to do it, right? Anyway, it works...

    Cheers,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/03/2009 at 08:00, xxxxxxxx wrote:

    You should only use GetCache() if you are absolutly sure that the caches are built. In most cases you have to use 'Current State To Object' on your spline generator. If the spline object is a child object of a generator you can use GetAndCheckHierarchyClone() or GetHierarchyClone() in GetVirtualObjects(). With linked objects (through a link field) you have to use CSTO in most cases though.

    Btw. what type is your plugin with the spline link (tag, object etc.)?

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/03/2009 at 05:55, xxxxxxxx wrote:

    It's an object. Creates a mesh and can use splines to determine the shape of the geometry.

    Greetings,
    Jack


Log in to reply