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

    Range Mapper Node GetInPort [SOLVED]

    SDK Help
    0
    6
    491
    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

      On 20/08/2015 at 06:57, xxxxxxxx wrote:

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

      ---------
      Hi,

      I'm creating an XPresso file with a Range Mapper Node.
      However, getting the Input Inport gives me problems.

      GvPort* rangemapperInputInPort = rangeMapperNode->GetInPort(0);

      This doesn't give me the Inport.
      Yet:

      GvPort* rangeMapperOutputOutPort = rangeMapperNode->GetOutPort(0);

      gives me the Outport.

      How should I get the input port??

      Thanks in advance for your help and time!

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

        On 21/08/2015 at 04:44, xxxxxxxx wrote:

        Hi Casimir,

        I quickly tested this using a Python script and it simply worked as expected. Nothing special needed. As Python in the end makes use of the C++ API, I have no reason to believe it's not working in C++.
        Can you perhaps provide me with some more code, to check what is going on on your side?

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

          On 21/08/2015 at 04:54, xxxxxxxx wrote:

          Hi Andreas,

          Here is some more code:

            
          XPressoTag* footGoalXPressoTag;  
            if (doFrontSide)  
            {  
                if (doLeftGoalSide)  
                {  
                    footGoalXPressoTag = static_cast<XPressoTag*>(frontLeftFootGoal->MakeTag(Texpresso, NULL));  
                    if (!footGoalXPressoTag) return false;  
                    if (doLeftSide)  
                    {  
                        footGoalXPressoTag->SetName("Left_Front_Left_Foot_Goal_XPresso_Tag");  
                    }  
                    else  
                    {  
                        footGoalXPressoTag->SetName("Right_Front_Left_Foot_Goal_XPresso_Tag");  
                    }  
                }  
                else  
                {  
                    footGoalXPressoTag = static_cast<XPressoTag*>(frontRightFootGoal->MakeTag(Texpresso, NULL));  
                    if (!footGoalXPressoTag) return false;  
                    if (doLeftSide)  
                    {  
                        footGoalXPressoTag->SetName("Left_Front_Right_Foot_Goal_XPresso_Tag");  
                    }  
                    else  
                    {  
                        footGoalXPressoTag->SetName("Right_Front_Right_Foot_Goal_XPresso_Tag");  
                    }  
                }  
            }  
            else  
            {  
                if (doLeftGoalSide)  
                {  
                    footGoalXPressoTag = static_cast<XPressoTag*>(backLeftFootGoal->MakeTag(Texpresso, NULL));  
                    if (!footGoalXPressoTag) return false;  
                    if (doLeftSide)  
                    {  
                        footGoalXPressoTag->SetName("Left_Back_Left_Foot_Goal_XPresso_Tag");  
                    }  
                    else  
                    {  
                        footGoalXPressoTag->SetName("Right_Back_Left_Foot_Goal_XPresso_Tag");  
                    }  
                }  
                else  
                {  
                    footGoalXPressoTag = static_cast<XPressoTag*>(backRightFootGoal->MakeTag(Texpresso, NULL));  
                    if (!footGoalXPressoTag) return false;  
                    if (doLeftSide)  
                    {  
                        footGoalXPressoTag->SetName("Left_Back_Right_Foot_Goal_XPresso_Tag");  
                    }  
                    else  
                    {  
                        footGoalXPressoTag->SetName("Right_Back_Right_Foot_Goal_XPresso_Tag");  
                    }  
                }  
            }  
            GeData footGoalXPressoData;  
            if (footGoalXPressoTag->GetParameter(DescLevel(EXPRESSION_PRIORITY), footGoalXPressoData, DESCFLAGS_GET_0))  
            {  
                PriorityData* pd = (PriorityData* )footGoalXPressoData.GetCustomDataType(CUSTOMGUI_PRIORITY_DATA);  
                if (pd)  
                {  
                    pd->SetPriorityValue(PRIORITYVALUE_MODE, CYCLE_GENERATORS);  
                    pd->SetPriorityValue(PRIORITYVALUE_PRIORITY, GeData(4));  
                }  
                footGoalXPressoTag->SetParameter(DescLevel(EXPRESSION_PRIORITY), footGoalXPressoData, DESCFLAGS_SET_0);  
            }  
            GvNodeMaster* footGoalNodeMaster = footGoalXPressoTag->GetNodeMaster();  
            if (footGoalNodeMaster)  
            {  
                // Create the Range Mapper Node  
                GvNode* rangeMapperNode = footGoalNodeMaster->CreateNode(footGoalNodeMaster->GetRoot(), ID_OPERATOR_RANGEMAPPER, nullptr, 130, 0);  
                if (!rangeMapperNode) return false;  
                rangeMapperNode->SetParameter(GV_RANGEMAPPER_CLAMP_UPPER, GeData(true), DESCFLAGS_SET_0);  
                rangeMapperNode->SetParameter(GV_RANGEMAPPER_CLAMP_LOWER, GeData(true), DESCFLAGS_SET_0);  
                GvPort* rangeMapperInputInPort = rangeMapperNode->GetPort(GV_RANGEMAPPER_INPUT_USER); // Doesn't work, regardless if I use GetPort or GetInPort  
                if (rangeMapperInputInPort) return false;  
                GvPort* rangeMapperOutputOutPort = rangeMapperNode->GetOutPort(GV_RANGEMAPPER_OUTPUT_USER);  
                if (!rangeMapperOutputOutPort) return false;  
                GvPort* rangeMapperInputUpperInPort = rangeMapperNode->AddPort(GV_PORT_INPUT, GV_RANGEMAPPER_RANGE12);  
                if (!rangeMapperInputUpperInPort) return false;  
                GvPort* rangeMapperOutputUpperInPort = rangeMapperNode->AddPort(GV_PORT_INPUT, GV_RANGEMAPPER_RANGE22);  
                if (!rangeMapperOutputUpperInPort) return false;  
                GvPort* rangeMapperInputLowerInPort = rangeMapperNode->AddPort(GV_PORT_INPUT, GV_RANGEMAPPER_RANGE11);  
                if (!rangeMapperInputLowerInPort) return false;  
                GvPort* rangeMapperOutputLowerInPort = rangeMapperNode->AddPort(GV_PORT_INPUT, GV_RANGEMAPPER_RANGE21);  
                if (!rangeMapperOutputLowerInPort) return false;  
          

          I hope this helps finding the problem.
          Thanks for your help and time!!

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

            On 21/08/2015 at 08:48, xxxxxxxx wrote:

            Hi Casimir,

            pssst, I won't tell anybody, but please have a look at the error check after GetPort().

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

              On 21/08/2015 at 08:58, xxxxxxxx wrote:

              Hi Andreas,

              Hahahaha, like you said in that post with Dan, I also have my moments 😄

              You can mark this thread as junk 😄

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

                On 21/08/2015 at 09:07, xxxxxxxx wrote:

                No problem 🙂
                Unfortunately we are out of [JUNK] tags, so it is simply solved.
                And I guess, we all have these kind of moments.

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