Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Real from inport to outport

    SDK Help
    0
    9
    619
    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 24/03/2008 at 09:41, xxxxxxxx wrote:

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

      ---------
      Hi!

      I have a big problem with the SDK and the documentation to get the following case. I want to create one inport / one outport (Datatype: Real).

      The outport should only forward a number of the inport.

      I created 3 functions / classes.

      > `

        
      \>  GeData GvGetPortGeData(GvNode* node, GvPort* port, GvRun* run)  
      \>  {  
      \>  //and so on...//  
      \>  }  
      \>  
      

      `

      > `

        
      \>  Bool GvSetPortGeData(const GeData& ge_data, GvNode* node, GvPort* port, GvRun* run)  
      \>  {  
      \>  //and so on...//  
      \>  }  
      \>  
      

      `

      > `

        
      \>  class GVIteratorTest : public GvOperatorData  
      \>  {  
      \>  //and so on...//  
      \>    
      \>  Bool Calculate(GvNode *bn, GvPort *port, GvRun *run, GvCalc *calc)  
      \>  {  
      \>    
      \>  GvSetPortGeData(GeData(3000),bn, port, run);  
      \>      return FALSE;  
      \>  }  
      \>    
      \>  //..blabla//  
      \>  }  
      \>  
      

      `

      Alright. It works. With the line GvSetPortGeData(... I am able to set the Real 3000 from the outport. But how do I get the Real from the inport called inport_LINK.

      Thank you very much.

      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 25/03/2008 at 10:39, xxxxxxxx wrote:

        Hi!

        Okay, perhaps I simplify my problem.

        > `

          
        \>            GvValue* vinport = ports.in_values[inport_LINK];   
        \>            GvPort* inport = vinport->GetPort();   
        \>            GeData inportdata = GvGetPortGeData(bn, inport, run);  
        \>            Real normale = inportdata.GetReal();   
        \>            GePrint(RealToString(normale));   
        \>  
        

        `

        This code I paste before I return the value to "set" the outport data. But in the Console (see GePrint) the value is 0. The inportvalue with a constant is 25. I only have 1 inport.

        Whats my mistake?

        Thank you very much 🙂

        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 26/03/2008 at 08:49, xxxxxxxx wrote:

          Sorry for asking again, but did nobody got a node to work, that imports a normal Real number?

          Thanks a lot

          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 26/03/2008 at 09:06, xxxxxxxx wrote:

            I will look into it.

            cheers,
            Matthias

            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 27/03/2008 at 06:56, xxxxxxxx wrote:

              Thanks a lot 🙂

              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 28/03/2008 at 07:37, xxxxxxxx wrote:

                Ok, here is my Calculate function of the node. It outputs the input.

                > \> static LONG input_ids[] = { GV_REAL_INPORT, 0 }; // Use this for the input ports! \> \> Bool MyNode::InitCalculation(GvNode \*bn, GvCalc \*calc, GvRun \*run) \> { \>      return GvBuildInValuesTable(bn, ports, calc, run, input_ids); \> } \> \> void MyNode::FreeCalculation(GvNode \*bn, GvCalc \*calc) \> { \>      GvFreeValuesTable(bn, ports); \> } \> \> Bool MyNode::Calculate(GvNode \*bn, GvPort \*port, GvRun \*run, GvCalc \*calc) \> { \>      if(!port) return FALSE; \> \>      GvValue \*vinport = ports.in_values[0]; \>      if(!vinport) return FALSE; \> \>      if(!vinport->Calculate(bn, GV_PORT_INPUT, run, calc, 0)) return FALSE; \> \>      GvPort \*inport = vinport->GetPort(); \> \>      Real value = 0.0; \> \>      inport->GetReal(&value;,run); \> \>      GePrint(RealToString(value)); \> \>      switch(port->GetMainID()) \>      { \>           case GV_REAL_OUTPORT: \>           { \>                return port->SetReal(value,run); \>           } \>      } \>       \>      return FALSE; \> } \>

                GV_REAL_INPORT and GV_REAL_OUTPORT are from my ressource file

                > \> CONTAINER GVmynode \> { \>      NAME          GVmynode; \>      INCLUDE GVbase; \> \>      GROUP          ID_GVPORTS \>      { \>           REAL     GV_REAL_INPORT \>           { \>                INPORT; \>                STATICPORT; \>                CREATEPORT; \>           } \>           REAL     GV_REAL_OUTPORT \>           { \>                OUTPORT; \>                STATICPORT; \>                CREATEPORT; \>           } \>      } \> } \>

                cheers,
                Matthias

                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 28/03/2008 at 08:28, xxxxxxxx wrote:

                  Hi!

                  Amazing. Thanks for great Work. Now, i see my mistake.

                  May the force be with you 😘

                  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 28/03/2008 at 12:43, xxxxxxxx wrote:

                    Hi!

                    I have a short question again.
                    I tried to get several inports. I am confused a little bit. If I input some vectors via the attributemanager (about the port-inputs) the node add the two vectors.

                    But when I connect to vectors via two other nodes, the node adds ValueA with the vector (0;0;0)... Does someone find the mistake?

                    I am confused a lot. Thanks for help..

                    GvValue* vinport = ports.in_values[0];
                         if (!vinport) return FALSE;   
                         if (!vinport->Calculate(bn, GV_PORT_INPUT_OR_GEDATA, run, calc, 0)) return FALSE;
                       
                            GvValue* vinportA = ports.in_values[1];
                         if (!vinportA) return FALSE;   
                         if (!vinportA->Calculate(bn, GV_PORT_INPUT_OR_GEDATA, run, calc, 0)) return FALSE;
                       
                         GvPort* ipt = bn->GetInPort(0);
                         GeData iptdata = GvGetPortGeData(bn, ipt, run);
                         Vector valueA = iptdata.GetVector();

                    GvPort* iptA = bn->GetInPort(1);
                         GeData iptdataA = GvGetPortGeData(bn, iptA, run);
                         Vector valueB = iptdataA.GetVector();
                         
                         Vector valueC;

                    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 28/03/2008 at 17:02, xxxxxxxx wrote:

                      sry, problem solved...thanks

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