Set/GetWorldPluginData and SPLINE



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

    On 13/07/2011 at 06:44, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R10-R12 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    In my plugin, the user can store the current settings to be used as default using SetWorldPluginData().  And they are retrieved for a new instance (in Init()) using GetWorldPluginData().  All of the values are stored and retrieved except for the SPLINE customgui/customdatatype settings.  It comes up empty when the plugin data is retrieved and applied to the plugin container.  How do I do this?

    In Message for MSG_DESCRIPTION_COMMAND, the user can store the current settings:

    DescriptionCommand* dc = static_cast<DescriptionCommand*>(data);  
    BaseObject* op = static_cast<BaseObject*>(node);  
    if (!dc)    return;  
    LONG id =    dc->id[0].id;  
    // Save As User Default Settings  
    if (id == COLLISIONDEFORMER_SETDEFAULT)  
    {  
      // Set a World Preference from this object's BaseContainer settings  
       SetWorldPluginData(ID_COLLISIONDEFORMER_OBJ, op->GetData(), TRUE);  
    }
    

    And when a new plugin object is created, I do this in the Init() :

    BaseContainer*    bc =    ((BaseList2D* )node)->GetDataInstance();  
    if (!bc)                            return FALSE;  
    BaseContainer*    wbc =    GetWorldPluginData(ID_COLLISIONDEFORMER_OBJ);  
    if (!wbc)  
    {  
      FactoryReset(bc);  
      return;  
    }  
    // General  
    // ... Other settings retrieved (and working)  
    // - Bulge Shape (Spline)  
    // ... Doing this to see if it needs initialization before retrieval (?)  
    GeData        d(CUSTOMDATATYPE_SPLINE, DEFAULTVALUE);  
    SplineData*    sd =    (SplineData* )d.GetCustomDataType(CUSTOMDATATYPE_SPLINE);  
    if (sd)  
    {  
      sd->MakeLinearSpline(2L);  
      sd->SetRound(1.0);  
    }  
    bc->SetData(COLLISIONDEFORMER_BSHAPE,        d);  
    bc->SetData(COLLISIONDEFORMER_BSHAPE,        wbc->GetData(COLLISIONDEFORMER_BSHAPE));
    


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

    On 15/07/2011 at 12:41, xxxxxxxx wrote:

    Hello and Bump?

    Really no idea how to do this?  I have not been able to do this successfully yet.  Yeah, it works during the session but if I close and restart C4D, nothing shows up in the SPLINE.  I've even tried breaking down the BaseContainer entries into another container for SetWorldPluginData(). Nothing.  Could be that the information is being saved and it is not being setup or initialized into the SPLINE CustomGui properly.  No idea.  Need help.

    Thanks,



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

    On 22/07/2011 at 04:48, xxxxxxxx wrote:

    I can confirm this strange behaviour. The container itself seems to be saved and there is an entry under the ID of your spline data but it's empty and returns DA_NIL for its data type.

    I will report this.

    cheers,
    Matthias


Log in to reply