Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/12/2008 at 08:58, xxxxxxxx wrote:
User Information: Cinema 4D Version: 11 Platform: Language(s) : C++ ;
--------- Hi!
How do I receive the values of userdatas. I found some snippets here in the forum, but the most code snippets iterates through the user datas, but thats not what I want.
I know the exact id of the element and want to receive the value. Can anyone of you check my code?
> \> DynamicDescription\* dd = ot->GetDynamicDescription(); #ot is the BaseList2D object \> DescID id(DescLevel(first_id)), DescLevel(second_id)); \> const BaseContainer \*t = dd->Find(id); \> if(t) #is TRUE \> { \> if(!ot->GetParameter(id, data, 0)) #GetParameter returns False... Why? \> GePrint("failed"); \> } \>
\> DynamicDescription\* dd = ot->GetDynamicDescription(); #ot is the BaseList2D object \> DescID id(DescLevel(first_id)), DescLevel(second_id)); \> const BaseContainer \*t = dd->Find(id); \> if(t) #is TRUE \> { \> if(!ot->GetParameter(id, data, 0)) #GetParameter returns False... Why? \> GePrint("failed"); \> } \>
Thank you very much
bye.
On 05/01/2009 at 08:08, xxxxxxxx wrote:
The creation of your DescID is wrong. You have to make sure the type of the DescLevel is set correctly. Here an example for a Real type userdata with the ID of 1:
> \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \> BaseObject \*op = NULL; \> op = doc->GetActiveObject(); \> if(!op) return TRUE; \> \> DynamicDescription \*dd = NULL; \> dd = op->GetDynamicDescription(); \> \> if(dd) \> { \> const DescID id(DescLevel(ID_USERDATA, DTYPE_SUBCONTAINER, 0), DescLevel(1, DTYPE_REAL, 0)); \> \> GeData d; \> \> if(op->GetParameter(id, d, 0)) \> { \> GePrint("success "+RealToString(d.GetReal())); \> } \> } \> \> return TRUE; \> } \>
\> Bool MenuTest::Execute(BaseDocument \*doc) \> { \> BaseObject \*op = NULL; \> op = doc->GetActiveObject(); \> if(!op) return TRUE; \> \> DynamicDescription \*dd = NULL; \> dd = op->GetDynamicDescription(); \> \> if(dd) \> { \> const DescID id(DescLevel(ID_USERDATA, DTYPE_SUBCONTAINER, 0), DescLevel(1, DTYPE_REAL, 0)); \> \> GeData d; \> \> if(op->GetParameter(id, d, 0)) \> { \> GePrint("success "+RealToString(d.GetReal())); \> } \> } \> \> return TRUE; \> } \>
cheers, Matthias
On 05/01/2009 at 08:21, xxxxxxxx wrote:
Thank you, Matthias. That will help me.
bye
On 19/01/2009 at 00:53, xxxxxxxx wrote:
Matthias, you wrote:
const DescID id(DescLevel(ID_userdata, DTYPE_SUBCONTAINER, 0), DescLevel(1, DTYPE_REAL, 0));
But what if I don't know that the element is of type Real? I just tried '0' but that did not work.
Any suggestions? Thanks.
On 19/01/2009 at 02:21, xxxxxxxx wrote:
You can browse the Userdata:
> \> void \*handle; \> if (dd) handle = dd->BrowseInit(); \> if (handle) \> { \> DescID descId; \> const BaseContainer\* bc; \> \> while (dd->BrowseGetNext(handle, &descId;, &bc;)) \> { \> GeData data; \> op->GetParameter(descId, data, 0); \> GeDataType type = data->GetType(); //retrieving the type \> } \> dd->BrowseFree(handle); \> \> \> } \> \>
\> void \*handle; \> if (dd) handle = dd->BrowseInit(); \> if (handle) \> { \> DescID descId; \> const BaseContainer\* bc; \> \> while (dd->BrowseGetNext(handle, &descId;, &bc;)) \> { \> GeData data; \> op->GetParameter(descId, data, 0); \> GeDataType type = data->GetType(); //retrieving the type \> } \> dd->BrowseFree(handle); \> \> \> } \> \>
On 19/01/2009 at 05:45, xxxxxxxx wrote:
Hi!
A combination of your solution and the solution of Matthias would be cool.
Not to browse through the userdatas and the condition I don't know the type of the element.