Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    TP Group in Link field

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 299 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 15/02/2009 at 04:15, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R10.1 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      I've have a link field that I can drag a particle group into from the XPresso Particle Groups dialog.
      I would like to check if it's a vaild particle group.
      I tried using
      LINK TPID_LINK{ACCEPT{idlist;}}
      in the resource but can't find the right idlist for this to work.
      I tried ID_TP_PGROUP but that didn't work. Empty works but I still have to check if it's a TP group.
      Also I'm trying to get a link to the TP group from the link field.
      Is that possible? Maybe I could compare the name to those in the TPMasterSystem instead?
      I'm playing with this but not sure what I'm looking for or if I'm going about it the right way.
      And I'm not sure what to put in for ? in GetLink().

      Any thoughts or example links?
      if (type == MSG_DESCRIPTION_CHECKDRAGANDDROP)
      {
            DescriptionCheckDragAndDrop *dcu = (DescriptionCheckDragAndDrop* ) data;
        
            if(dcu->id[0].id == TPID_LINK) // my link field
            {
       // get the description of dropped element into desc.
       AutoAlloc<Description> desc;
       if(dcu->element->GetDescription(desc,0))
       {
        //Not sure what to do in here.
        const BaseContainer *data = desc->GetParameterI(DESCID_ROOT,NULL);
        TP_PGroup *TPGroup = (TP_PGroup* )data->GetLink( ? , doc, ID_TP_PGROUP);
        if (TPGroup){MessageDialog("TPGroup found");}
       
       }//desc
       }//id == TPID_LINK
      }//type ==

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 16/02/2009 at 01:23, xxxxxxxx wrote:

        You have to use the direct ID of ID_TP_PGROUP in your resource file.

        > \> LINK MY_LINK { ACCEPT { 1001381; } } \>

        Get the particle group with GetParameter().

        > \> GeData d; \> \> if(tag->GetParameter(DescLevel(MY_LINK),d,0)) \> { \>      TP_PGroup \*tpgroup = NULL; \>      tpgroup = (TP_PGroup\* )d.GetLink(doc, ID_TP_PGROUP); \>      if(tpgroup) GePrint(tpgroup->GetName()); \> } \>

        cheers,
        Matthias

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 16/02/2009 at 06:33, xxxxxxxx wrote:

          That works like a charm.
          I put
          LINK TPID_LINK{ ACCEPT { 1001381; } }//value of ID_TP_PGROUP
          into the resource and here's my working debug code within the Message function:

              
              
              
              
              if (type == MSG_DESCRIPTION_CHECKDRAGANDDROP)  
                  {  
                    DescriptionCheckDragAndDrop *dcu = (DescriptionCheckDragAndDrop* ) data;  
                   
                    if(dcu->id[0].id == TPID_LINK)   
                    {
              
              
              
              
               GeData d;
              
              
              
              
               if(node->GetParameter(DescLevel(TPID_LINK),d,0))  
               {  
                GePrint("have Parameter");  
                TP_PGroup *tpgroup = NULL;  
                tpgroup = (TP_PGroup* )d.GetLink(node->GetDocument(), ID_TP_PGROUP);  
                if(tpgroup){ GePrint(tpgroup->GetName());}  
                     
               }//GetParameter  
                    
                    
                    }//id == TPID_LINK  
                  }//type == MSG_DESCRIPTION
              
              
              
          

          ============
          I did find I had to scrub the time slider a couple times and have the particles on screen before I'd get a valid tpgroup.
          I guess I need to put a call to InitThinkingParticles() as well to fix that up.
          But it works great.
          Thank you.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post