Subdescriptions
-
On 25/01/2014 at 07:04, xxxxxxxx wrote:
Howdy,
Have a look at DescLevel() in the SDK Documentation, or do a search for that here on the forum.
Adios,
Cactus Dan -
On 25/01/2014 at 07:45, xxxxxxxx wrote:
Lots of Description examples here: http://www.c4dconnect.com/
-ScottA
-
On 27/01/2014 at 13:08, xxxxxxxx wrote:
Hi guys, thanks for the help. But I think either I'm confused or I poorly explained myself.
`DescID id = DescID(DescLevel(ID_BASEOBJECT_POSITION, 0, 0)); `AutoAlloc<Description> senderdesc; if (!senderdesc) return TRUE; obj->GetDescription(senderdesc, DESCFLAGS_DESC_0) ; const BaseContainer* desccontainer; AtomArray* descarray = AtomArray::Alloc(); desccontainer = senderdesc->GetParameterI(id, descarray); return desccontainer->GetString(DESC_NAME, "No Name Found");
This correctly returns "P" for the name.
`DescID id = DescID(DescLevel(ID_BASEOBJECT_POSITION, 0, 0), DescLevel(VECTOR_X, 0, 0)); `AutoAlloc<Description> senderdesc; if (!senderdesc) return TRUE; obj->GetDescription(senderdesc, DESCFLAGS_DESC_0) ; const BaseContainer* desccontainer; AtomArray* descarray = AtomArray::Alloc(); desccontainer = senderdesc->GetParameterI(id, descarray); return desccontainer->GetString(DESC_NAME, "No Name Found");
This would return "No Name Found".
This is the problem I'm running into, I don't need the id of description elements, but the Description Basecontainer.
I hope that clears up my question. Thanks for the help again.
Dan
-
On 28/01/2014 at 08:40, xxxxxxxx wrote:
The problem is that Vector_X is not a description that belongs to an object.
That's why you can get things like "P" using: DescID id = DescID(DescLevel(ID_BASEOBJECT_REL_POSITION, 0, 0));
That description is in the Obase.res, Obase.h, and Obase.str filesBut things like Vector_X is in a different header file called: lib_description.h
And when an object is created. This is somehow imported from that file using this code in the object's .res file:GROUP { VECTOR ID_BASEOBJECT_REL_POSITION { UNIT METER; CUSTOMGUI SUBDESCRIPTION; }//<--Notice the "CUSTOMGUI SUBDESCRIPTION" }
I don't know how this code causes the VECTOR_X, VECTOR_Y, VECTOR_Z to be imported.
It's still a mystery to me how it's doing that.
The vector gizmos seem to be coming from a custom data type plugin?But your question has actually been asked several times here. Only it was asked differently
The question asked many times here is:
"When we drag an object into the console. How does it know where to grab the subdescriptions stuff like the Vector_X description?"Maxon has never answered this question for some reason. And I don't know why.
But think the answer to that question holds the answer you're looking for.-ScottA
-
On 28/01/2014 at 08:57, xxxxxxxx wrote:
Howdy,
OK, maybe I'm not understand what you're trying to get. Are you simply trying to retrieve the value stored in the sub description?
Adios,
Cactus Dan -
On 28/01/2014 at 09:18, xxxxxxxx wrote:
I'm not sure if he's trying to get the values or not Dan.
But his code seems to be looking for their text values.The values inside the gizmos are easy to get using Get() & Set() parameters.
The hard part (for me at least) is returning the text values for those VECTOR_X, etc.. sub descriptions.-ScottA
-
On 28/01/2014 at 14:14, xxxxxxxx wrote:
I figured out how to get the ID numbers for those position descriptions. But I still cannot get the string values for them!
BaseObject *obj = doc->GetActiveObject(); if (!obj) return FALSE; DescID posXid = DescID(DescLevel(ID_BASEOBJECT_REL_POSITION, DTYPE_VECTOR,0), DescLevel(VECTOR_X, DTYPE_REAL,0)); DescID posYid = DescID(DescLevel(ID_BASEOBJECT_REL_POSITION, DTYPE_VECTOR,0), DescLevel(VECTOR_Y, DTYPE_REAL,0)); DescID posZid = DescID(DescLevel(ID_BASEOBJECT_REL_POSITION, DTYPE_VECTOR,0), DescLevel(VECTOR_Z, DTYPE_REAL,0)); DescLevel dscLevel_0 = posXid.operator[](0); //Results in 903 which is the ID# for ID_BASEOBJECT_REL_POSITION DescLevel dscLevel_X = posXid.operator[](1); //Results in 1000 which is the ID# for VECTOR_X DescLevel dscLevel_Y = posYid.operator[](1); //Results in 1001 which is the ID# for VECTOR_Y DescLevel dscLevel_Z = posZid.operator[](1); //Results in 1002 which is the ID# for VECTOR_Z GePrint(LongToString(dscLevel_0.id)); GePrint(LongToString(dscLevel_X.id)); GePrint(LongToString(dscLevel_Y.id)); GePrint(LongToString(dscLevel_Z.id)); //Now that I have the correct ID numbers for the VECTOR_X, VECTOR_Y, VECTOR_Z descriptions //How do I get the String values for them...instead of their numbers? AutoAlloc<Description> desc; if (!desc) return FALSE; obj->GetDescription(desc, DESCFLAGS_DESC_0); const BaseContainer *bc = desc->GetParameterI(posXid, NULL); //<--OUCH! crashes C4D!! String name = bc->GetString(DESC_NAME); GePrint(name);
I feel like I'm very, very close.
-ScottA
-
On 29/01/2014 at 04:10, xxxxxxxx wrote:
Are you sure that it is not crashing on the bc->GetString()? If there is no matching description container for the DescID, GetParameterI() may return NULL into bc.
It also appears that GetParameterI() has issues with 'nested' DescLevels. Check out the thread "Description ID to String" for a way around this (although burdensome using a while loop). Also do a forum search for GetParameterI. There are exactly four uses of this method in the entire cinema4dsdk source (go figure), none which is useful for your purposes.
-
On 29/01/2014 at 07:55, xxxxxxxx wrote:
Hi Robert!
I have that while loop that Matthias posted. It's one of the first things I tried.
But unfortunately it doesn't print the subdescriptions (VECTOR_X, VECTOR_Y, VECTOR_Z).When a decription is LMB dragged into the console. The text for those subdescriptions shows up.
So there must be a way to get them somehow. But Maxon won't tell us how they're doing it.-ScottA
-
On 29/01/2014 at 08:11, xxxxxxxx wrote:
Hi,
I've asked the developers if there's a way to access these subdescriptions or subchannels
dynamically added by custom data types in CustomDataTypeClass::_GetDescription(). -
On 29/01/2014 at 08:43, xxxxxxxx wrote:
^Thank You.
-ScottA
-
On 29/01/2014 at 13:59, xxxxxxxx wrote:
Thanks everyone for looking into this.
I feel better about not being able to figure this out now on my own now.
Dan
-
On 05/02/2014 at 09:23, xxxxxxxx wrote:
Check this out guys.
I discovered something interesting about this.The Vector_X, Vector_Y, Vector_Z text that we see when we drag from the AM into the Console is coming from this file:
C:\Program Files\MAXON\YOUR VERSION\resource\res\description\dvector.resIf you change the IDs in this .res file and it's accompanying .h file to something else. You will see the new names show up in the Console when you do the Drag&Drop with them to the Console.
Cube[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X] <--- original Cube[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X1] <--- After we change the dvector.h & dvector.res files
So what this means is that when we Drag & Drop from the AM to the Console. Maxon is somehow reading these .res & .h files found in the C:\Program Files\MAXON\YOUR VERSION\resource\res\description **** folder. **** And then converting the IDs in them to text.
Then displaying the text from them in the Console. ****I Still don't know how we (the users) can do this same thing yet in our own code.
But I thought it was an interesting discovery. ****-ScottA