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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    port->SetData

    SDK Help
    0
    7
    1.8k
    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
      Helper
      last edited by

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

      On 11/11/2002 at 19:10, xxxxxxxx wrote:

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

      ---------
      Tring to figure out how to use the GvPort->SetData command without crashing C4D. I want to pass a BaseLink and or our own custom datatypes.
      Regards,
      darf - bhodiNUT

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

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

        On 12/11/2002 at 00:09, xxxxxxxx wrote:

        Sorry, I am still investigating this and the corresponding GetData() issue. Will report back as soon as I hear anything.

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

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

          On 12/11/2002 at 10:39, xxxxxxxx wrote:

          First, I guess this cannot be repeated too often:
          > GV disclaimer: The GV API (everything in c4d_gv) is currently unsupported and might change in the future.
          In other words, don't rely on the current GV or TP system to be either predictable, stable or consistent. I know I've told you this privately, but it deserved to be said in public as well.
          That being said, I found some more information about allocating Dynamic Data within Xpresso. From studying the functions in c4d_graphview.h some things can be learned. To use GetData() you must first call GvAllocDynamicData(), then you can use data.data as d. (I couldn't get this to work though.) For GeData-Gv conversion, see the GvSetDataInContainer() implementation.

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

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

            On 12/11/2002 at 10:46, xxxxxxxx wrote:

            Quote: Originally posted by Mikael Sterner on 12  November 2002
            >
            > * * *
            >
            > That being said, I found some more information about allocating Dynamic Data within Xpresso. From studying the functions in c4d_graphview.h some things can be learned. To use GetData() you must first call GvAllocDynamicData(), then you can use data.data as d. (I couldn't get this to work though.) For GeData-Gv conversion, see the GvSetDataInContainer() implementation.
            >
            > * * *
            OK, where is the GvSetDataInContainer() implementation?

            Thanks, darf

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

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

              On 12/11/2002 at 11:38, xxxxxxxx wrote:

              Quote: Originally posted by darf on 12  November 2002
              >
              > * * *
              >
              > OK, where is the GvSetDataInContainer() implementation?
              In other news: find-in-files useful for finding stuff in files... 😉

                  
                  
                  //c4d_graphview.h  
                    
                  inline Bool GvSetDataInContainer(const void* const data, GvValueID value_id, BaseContainer &bc, LONG container_id, LONG cpu_id = 0)  
                  {  
                   CUSTOMDATATYPEPLUGIN* pl = FindCustomDataTypePlugin(value_id); if (!pl) return FALSE;  
                   GeData ge_data; CallCustomDataType(pl,ConvertGvToGeData)(data,cpu_id,ge_data);  
                   bc.SetData(container_id,ge_data);  
                   return TRUE;  
                  }
              

              I.e. it calls a function pointer function in the CUSTOMDATATYPEPLUGIN. I don't really know what value_id to use here for BaseLink. Perhaps something interesting can be found if browsig the Registry for e.g. C4DPL_CUSTOMDATATYPE items. (Haven't tried myself, don't have the time at the moment.)

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

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

                On 13/11/2002 at 01:27, xxxxxxxx wrote:

                Breakthrough. Here are functions for getting and setting arbitrary value types:
                >

                \>     
                \>     
                \>     GeData GvGetPortGeData(GvNode* node, GvPort* port, GvRun* run)  
                \>     > {   
                \>     >   if (!node || !port) return GeData();
                \>     
                \>     
                \>     
                \>     
                \>       GvDataInfo* info = GvGetWorld()->GetDataTypeInfo(port->GetValueType());  
                \>     >   if (!info) return GeData();
                \>     
                \>     
                \>     
                \>     
                \>       GvDynamicData data;  
                \>     >   GvAllocDynamicData(node, data, info);
                \>     
                \>     
                \>     
                \>     
                \>       if (!port->GetData(data.data, data.info->value_handler->value_id, run)) return GeData();
                \>     
                \>     
                \>     
                \>     
                \>       CUSTOMDATATYPEPLUGIN* pl =   
                \>     >     FindCustomDataTypePlugin(data.info->value_handler->value_id);   
                \>     >   if (!pl) return GeData();
                \>     
                \>     
                \>     
                \>     
                \>       GeData ge_data;   
                \>     >   if (!CallCustomDataType(pl, ConvertGvToGeData)(data.data, 0, ge_data)) return GeData();
                \>     
                \>     
                \>     
                \>     
                \>       return ge_data;  
                \>     > }
                \>     
                \>     
                \>     
                \>     
                \>     Bool GvSetPortGeData(const GeData& ge_data, GvNode* node, GvPort* port, GvRun* run)  
                \>     > {   
                \>     >   if (!node || !port || !run) return FALSE;
                \>     
                \>     
                \>     
                \>     
                \>       GvDataInfo* info = GvGetWorld()->GetDataTypeInfo(port->GetValueType());  
                \>     >   if (!info) return FALSE;
                \>     
                \>     
                \>     
                \>     
                \>       GvDynamicData data;  
                \>     >   GvAllocDynamicData(node, data, info);
                \>     
                \>     
                \>     
                \>     
                \>       CUSTOMDATATYPEPLUGIN* pl =   
                \>     >     FindCustomDataTypePlugin(data.info->value_handler->value_id);   
                \>     >   if (!pl) return FALSE;
                \>     
                \>     
                \>     
                \>     
                \>       if (!CallCustomDataType(pl, ConvertGeDataToGv)(ge_data, data.data, 0)) return FALSE;
                \>     
                \>     
                \>     
                \>     
                \>       if (!port->SetData(data.data, data.info->value_handler->value_id, run)) return FALSE;
                \>     
                \>     
                \>     
                \>     
                \>       return TRUE;  
                \>     > }
                \> 
                \> 
                

                Usage for the former function:
                >

                \>     
                \>     
                \>     GvValue* vlink = NULL;  
                \>     >   
                \>     > vlink = ports.in_values[GVTEST_LINK_INDEX];
                \>     
                \>     
                \>     
                \>     
                \>     GvPort* linkport = vlink->GetPort();  
                \>     > GeData linkdata = GvGetPortGeData(bn, linkport, run);
                \>     
                \>     
                \>     
                \>     
                \>     BaseLink* test = linkdata.GetBaseLink();  
                \>     > if (test && test->GetLink(bn->GetNodeMaster()->GetDocument()))  
                \>     >  GePrint(test->GetLink(bn->GetNodeMaster()->GetDocument())->GetName());
                \> 
                \> 
                

                Usage for the latter function:
                >

                \>     
                \>     
                \>     BaseDocument* doc = bn->GetNodeMaster()->GetDocument();  
                \>     > if (!doc) return FALSE;
                \>     
                \>     
                \>     
                \>     
                \>     BaseObject* obj = doc->GetFirstObject();  
                \>     > if (!obj) return FALSE;
                \>     
                \>     
                \>     
                \>     
                \>     AutoAlloc<BaseLink> bl;  
                \>     > bl->SetLink(obj);
                \>     
                \>     
                \>     
                \>     
                \>     return GvSetPortGeData(GeData(bl), bn, port, run);
                \> 
                \> 
                
                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

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

                  On 13/11/2002 at 08:32, xxxxxxxx wrote:

                  Quote: Originally posted by Mikael Sterner on 12  November 2002
                  >
                  > * * *
                  >
                  > In other news: find-in-files useful for finding stuff in files... 😉
                  >
                  >

                  \> 
                  \> 
                  

                  >
                  > * * *

                  !@#$ My apologies, DOH!!!
                  darf

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