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

    Please use GetParameter/SetParameter

    SDK Help
    0
    12
    1.4k
    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 05/11/2010 at 09:38, xxxxxxxx wrote:

      sorry, I don't understand. Instead of what should GetParameter be used? What would be the replacement for

      BaseContainer *bc = op->GetDataInstance();
      Bool b = bc->GetBool(ID_MYBOOL);
      LONG l = bc->GetLong(ID_MYLONG);
      ...

      Do you mean, we cannot store and use a pointer to the BaseContainer anymore and have to code

      GeData data;
      op->GetParameter(DescLevel(ID_MYBOOL), data, DESCFLAGS_GET_0);
      Bool b = data.GetBool();
      op->GetParameter(DescLevel(ID_MYLONG), data, DESCFLAGS_GET_0);
      LONG l = data.GetLong();

      for each single parameter? A text replacement wouldn't be possible, so we would have to replace manually hundreds of lines! Additionally, a lot of functions that deal with BaseContainer pointers have to be rewritten.

      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 06/11/2010 at 03:20, xxxxxxxx wrote:

        Klaus, I sympathise with you very much. I was going to post something similar but didn't get round to it. The other questions of course, are does this mean that existing plugins, all using BaseContainers extensively, can be expected to fail at some point in the future with later releases of C4D? And why does the SDK tell us to use them in preference to GeData?

        I too would like some more details about this.

        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 08/11/2010 at 02:16, xxxxxxxx wrote:

          It is still allowed to access the BaseContainer directly. In the long run it is recommended to use Set/GetParameter though. It would allow us to implement some nifty features which are otherwise not possible.

          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 08/01/2011 at 16:29, xxxxxxxx wrote:

            Hey guys.
            I'm new at this C++ API stuff and I just learned how to get at an object's container using the GetDataInstance() function. Only to see it's now being frowned upon.

            This is simple example of using the GetDataInstance() function:

            BaseObject *objCube = BaseObject::Alloc(Ocube);  //Creates a cube primitive
            BaseContainer *bc = objCube->GetDataInstance(); //Get the cube's container
              bc->SetReal(PRIM_CUBE_SUBX,2); // number of segments
              bc->SetReal(PRIM_CUBE_SUBY,5); // number of segments
              bc->SetReal(PRIM_CUBE_SUBZ,2); // number of segments
            doc->InsertObject(objCube, NULL, NULL, 0); // Add it to the OM

            Could someone possibly convert this same code to the Get/SetParameter method so I can see how it's done?
            I don't want to develop bad work habits as a beginner.

            Thanks,
            ScottA

            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 08/01/2011 at 23:12, xxxxxxxx wrote:

              Replace the bc->SetReal() statements with these and remove the GetDataInstance() as no longer needed.

              objCube->SetParameter(DescID(PRIM_CUBE_SUBX), GeData(2.0), DESCFLAGS_SET_0);
              objCube->SetParameter(DescID(PRIM_CUBE_SUBY), GeData(5.0), DESCFLAGS_SET_0);
              objCube->SetParameter(DescID(PRIM_CUBE_SUBZ), GeData(2.0), DESCFLAGS_SET_0);

              ETA: You should be explicit about numeric types whenever possible.  If you specify a 2 for a floating point value, the compiler does a conversion to float or double (which adds instruction calls).  Maybe once or twice isn't bad, but consider when it is being done many times in repetitively called methods.  Still, this also avoids ambiguity as in the case above which may lead to incorrect values being stored.

              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 09/01/2011 at 03:47, xxxxxxxx wrote:

                That's interesting, Robert. Thanks for posting it. It does seem to me though that it's a really long-winded way of going about things. The SetParameter() call involves a constructor for the DescID, and another one for the GeData. Plus it just looks clumsy and inelegant compared to the BaseContainer method.

                I think that if Maxon want us to use this method, they should make GetParameter() and SetParameter() easier to use, even if they just put a wrapper round it to avoid the extra typing. Just IMHO, of course.

                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 09/01/2011 at 07:14, xxxxxxxx wrote:

                  Perfect!
                  Thanks Robert.

                  BTW. I don't know if you remember me or not. But I'm the guy that asked you to create your Split Selection tag maker plugin on Renderosity years ago.
                  That's a great little plugin that speeds up the creation of symmetrical Poser figures. And I got a lot of use out that.

                  -ScottA

                  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 15/01/2011 at 15:55, xxxxxxxx wrote:

                    What is the equivalent in Python? Doesn't appear to be a Get/SetParameter() function. From the documentation, I don't see a way of accessing values not stored in a container - such as certain compositing tag settings...

                    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 15/01/2011 at 16:09, xxxxxxxx wrote:

                      Ah, never mind... I see here:

                      BaseList2D.__getitem__(self, key)
                      BaseList2D.__setitem__(self, key, value)

                      Seems to have replaced GetParameter() and SetParameter() in python.

                      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 21/01/2011 at 09:23, xxxxxxxx wrote:

                        Remember any function surrounded by two underscores in the python api is an internal implementation with a separate syntax. For instance, __eq__(a,b) is simply telling python how to evaluate a=b for a specific class.

                        In this case, __getitem__ and __setitem__ simply refer to the bracket syntax. You're probably doing it right in Python already, because it's easier to do it right in Python.

                        So basically just use:
                        op[c4d.PRIM_CUBE_SUBX] = 5
                        subx = op[c4d.PRIM_CUBE_SUBX]

                        instead of:
                        bc = op.GetDataInstance()
                        bc[c4d.PRIM_CUBE_SUBX] = 5
                        subx = bc[c4d.PRIM_CUBE_SUBX]

                        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 09/01/2012 at 07:08, xxxxxxxx wrote:

                          Hi, i have a question about this GetParameter method.

                          We want to retrieve information of a node from an xpresso connection.

                          So actually i got the node object itself and now i want to get the min and max values for a rangemapper for example. The user can input them in the bottom right corner of the cinema 4d IDE.

                          So i got something like this.

                                      GeData storedData = new GeData(); // This will contain the data
                            
                                      if (node.GetParameter(new DescID(C4dApi.XXX), storedData, C4d.DESCFLAGS_GET.DESCFLAGS_GET_0))
                                      {
                                          int output = storedData.GetLong();
                                          Logger.Debug("Data retrieved: " + output.ToString());
                                      }
                                      else
                                      {
                                          Logger.Debug("Data NOT retrieved!");
                                      }
                          

                          So storedData will be filled with the data required from XXX.

                          1. Where can i find this 'strings' or IDs like you name them (ID_BASEOBJECT_ABS_POSITION e.g.) that have to be inserted instead of XXX? Is there a list to look them up?

                          Please note we are wrapping the API to C# code 😉 ...

                          cheers and thanks!

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