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 24/03/2010 at 04:53, xxxxxxxx wrote:
User Information: Cinema 4D Version: 11 Platform: Mac OSX ; Language(s) : C++ ;
--------- I'm using GetDDescription to show/hide interface element. This works fine when loading the tag and accessing it the very first time. After that, everything stays visible, although the command flow seem to work correctly.
The method is obviously called twice on each user interaction, once with flags = 0 and one with flags = 17... this seems to be a side effect of the fact that init() is invoked on each parameter change.
Any pointer where to look?
Thanks
Kabe
Bool MyTagDataPlugin::GetDDescription(GeListNode *node, Description *description,LONG &flags;) { //Load Description if (!description->LoadDescription(node->GetType())) return FALSE; //Load BaseContainer BaseContainer *opBC = ((PluginTag* )node)->GetDataInstance(); //Read controlling param LONG param1 = opBC->GetLong(MYPARAM1, -1); //Compare with global var if (param1 !=currentParam1) { BaseContainer *dir2_BC = description->GetParameterI(DescLevel(MYPARAM2), NULL); BaseContainer *dir3_BC = description->GetParameterI(DescLevel(MYPARAM3), NULL); //SET HIDE STATUS if (dirH_BC&&dirP;_BC) { if (param1==VAL1) { dir2_BC->SetBool(DESC_HIDE, FALSE); dir2_BC->SetBool(DESC_HIDE, TRUE); } if (rotaxis==VAL2) { dir2_BC->SetBool(DESC_HIDE, TRUE); dir3_BC->SetBool(DESC_HIDE, FALSE); } } //Copy current value to global currentParam1 = param1; } //Works, but only on the very first time flags |= DESCFLAGS_DESC_LOADED; //call super return SUPER::GetDDescription(node, description, flags); }
Bool MyTagDataPlugin::GetDDescription(GeListNode *node, Description *description,LONG &flags;) {
//Load Description if (!description->LoadDescription(node->GetType())) return FALSE;
//Load BaseContainer BaseContainer *opBC = ((PluginTag* )node)->GetDataInstance(); //Read controlling param LONG param1 = opBC->GetLong(MYPARAM1, -1); //Compare with global var if (param1 !=currentParam1) { BaseContainer *dir2_BC = description->GetParameterI(DescLevel(MYPARAM2), NULL); BaseContainer *dir3_BC = description->GetParameterI(DescLevel(MYPARAM3), NULL); //SET HIDE STATUS if (dirH_BC&&dirP;_BC) { if (param1==VAL1) { dir2_BC->SetBool(DESC_HIDE, FALSE); dir2_BC->SetBool(DESC_HIDE, TRUE); } if (rotaxis==VAL2) { dir2_BC->SetBool(DESC_HIDE, TRUE); dir3_BC->SetBool(DESC_HIDE, FALSE); } }
//Copy current value to global currentParam1 = param1; } //Works, but only on the very first time flags |= DESCFLAGS_DESC_LOADED; //call super return SUPER::GetDDescription(node, description, flags); }
BTW: This stuff is so fundamental, that the lack of proper examples is a crying shame.
P.S.: This is how it looks like when I format it as CODE - double lines
Bool MyTagDataPlugin::GetDDescription(GeListNode *node, Description *description,LONG &flags;) { //Load Description if (!description->LoadDescription(node->GetType())) return FALSE;
On 24/03/2010 at 08:32, xxxxxxxx wrote:
This is a simple example which hides/unhides an existing LONG description element depending on the value of a Bool description element.
Bool LookAtCamera::GetDDescription(GeListNode *node, Description *description, LONG &flags) { if (!description->LoadDescription(node->GetType())) return FALSE; BaseTag *tag = (BaseTag* )node; BaseContainer *data = tag->GetDataInstance(); // important to check for speedup c4d! const DescID *singleid = description->GetSingleDescID(); //MY_LONG is a LONG desc element I want to hide/unhide depending on a Bool desc element MY_BOOL DescID cid = DescLevel(MY_LONG,DTYPE_LONG,0); if (!singleid || cid.IsPartOf(*singleid,NULL)) // important to check for speedup c4d! { BaseContainer *bc = description->GetParameterI(cid,NULL); if (data->GetBool(MY_BOOL, TRUE)) //MY_BOOL hides/unhides MY_LONG { bc->SetBool(DESC_HIDE,TRUE); } else bc->SetBool(DESC_HIDE, FALSE); } flags |= DESCFLAGS_DESC_LOADED; return TRUE; }
cheers, Matthias
On 24/03/2010 at 10:55, xxxxxxxx wrote:
description->GetSingleDescID(); is marked as private in the SDK. What is it doing? How we are suppose to realize that we need it here?
Apart from that, it seems that you suggest quite what I'm doing.
What I'm missing is a level of comments in these code snippets that make it easier to understand the background. The SDK makes it very hard to enter new ground, because a lot of fundamentals can only be grasped over time while wading though the code examples.
Have a look at the very fundamentals BaseObject, BaseContainer, BaseTags, etc. at all the base classes the level of documentation is simply insufficient. We all basically travel on safe ground and tend to avoid new stuff because it costs an awful lot of time.
It shouldn't take more than 15 minutes to find a clean and documented code snipped that explains how to change the view status of an attribute.