Load string from description?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/08/2012 at 01:04, xxxxxxxx wrote:
Hello,
I can load a string from the plugins resource using c4d.plugins.GeLoadString(). But this function
does not work for description-elements. I want to get the string associated with the ID Tphong or
PRIM_CUBE_LEN, just for example. How can I get it?Thanks in advance,
Niklas -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/08/2012 at 01:41, xxxxxxxx wrote:
Originally posted by xxxxxxxx
I can load a string from the plugins resource using c4d.plugins.GeLoadString(). But this function
does not work for description-elements. I want to get the string associated with the ID Tphong or
PRIM_CUBE_LEN, just for example. How can I get it?To get the name of a tag type you can call c4d.GetTagName() function that was added in R13:
c4d.GetTagName(c4d.Tphong)
Also another function to get an object type's name was added, c4d.GetObjectName() :
c4d.GetObjectName(c4d.Ocube)
And it's currently not possible to access the description parameters of objects. So we cannot get the name of PRIM_CUBE_LEN parameter (would be the id c4d.DESC_NAME in the description container for the parameter). But it's possible to access dynamic descriptions with BaseList2D.GetUserDataContainer().
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/08/2012 at 01:54, xxxxxxxx wrote:
Thanks for your answer Yannick.The GetTagName() function is what I searched for, thanks.
> (would be the id c4d.DESC_NAME in the description container for the parameter).
Wouldn't that require an instance of the actual object/tag so that we can obtain the description? (As you said, it's not possible Python anyway..)Regards,
Niklas -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/08/2012 at 02:03, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Wouldn't that require an instance of the actual object/tag so that we can obtain the description?
Yes, but that's not a big deal because the object doesn't need to be present in a document but in memory. Here's an handy function that returns the name of an object's parameter:
String GetObjectParameterName(LONG type, LONG id) { BaseObject *op = BaseObject::Alloc(type); if (op->GetType()==type) { AutoAlloc<Description> desc; if (!desc) return String(); if (!op->GetDescription(desc,DESCFLAGS_DESC_0)) return String(); const BaseContainer *bc = desc->GetParameterI(id,NULL); if (bc) return bc->GetString(DESC_NAME); } return String(); }
So for PRIM_CUBE_LEN we would call it like this:
GetObjectParameterName(Ocube, PRIM_CUBE_LEN)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/08/2012 at 02:06, xxxxxxxx wrote:
Haha, ok! I just thought that would be kind of a large overhead. But thanks for pointing it out.
-Nik