Please use GetParameter/SetParameter
-
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.
-
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 -
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 OMCould 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 -
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.
-
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.
-
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
-
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...
-
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.
-
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] -
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.
- 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!