Show/Hide problem in Tag Description
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/10/2004 at 09:12, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.5+
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;---------
Howdy,I've studied the examples found here and in the SDK documentation to set up showing and hiding of object link descriptions in my tag plugin. I've created two buttons for "Add Link" and "Sub Link" to show and hide the descriptions (which are in a .res file). It seems to work, but with one little problem: when I click the buttons, the AM doesn't update unless I deselect the tag and then reselect the tag again. When the tag is reselected, the AM is updated. Here is my code:
Bool MyPlugin::GetDDescription(GeListNode *node, Description *description, LONG &flags;)
{
if (!description->LoadDescription(MY_PLUGIN_ID)) return FALSE;AutoAlloc<AtomArray> ar; if (!ar) return FALSE;
ar->Append(static_cast<Atom*>(node));LONG linkID, i;
for ( i = 2; i <= 20; i++)
{
linkID = GetLinkDescriptionID( i );
if ( i <= linkCount )
{
BaseContainer* bc = description->GetParameterI(DescLevel(linkID), ar);
if (bc)
{
bc->SetBool(DESC_HIDE, FALSE);
}
}
if ( linkCount < i )
{
BaseContainer* bc = description->GetParameterI(DescLevel(linkID), ar);
if (bc)
{
bc->SetBool(DESC_HIDE, TRUE);
}
}
}flags |= DESCFLAGS_DESC_LOADED;
return TagData::GetDDescription(node, description, flags);
}Bool MyPlugin::Message(GeListNode *node, LONG type, void *data)
{
BaseTag *tag = (BaseTag* )node;
BaseContainer *tagData = tag->GetDataInstance();LONG linkID;
switch (type)
{
case MSG_DESCRIPTION_COMMAND:
{
DescriptionCommand *dc = (DescriptionCommand* ) data;
if (dc->id[0].id==ADD_LINK)
{
if (linkCount < 20)
{
linkCount++;
EventAdd();
}
}
else if (dc->id[0].id==SUBTRACT_LINK)
{
if (linkCount > 1)
{
linkID = GetLinkDescriptionID(linkCount);
tagData->SetLink(linkID,NULL);
linkCount--;EventAdd();
}
}
}
}return TRUE;
}It must be something simple that I'm missing, but I just can't see it.
Thanks in advance for any help.
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/10/2004 at 17:56, xxxxxxxx wrote:
Howdy,
Any ideas? Anyone?
The AM will also update the added link elements if I click the "Enable" check box once in the tag's Basic tab. If I click the "Add Link" button 4 times nothing appears to happen, but then if I click the "Enable" check box, 4 new link elements appear in the tag's AM.
I want the Add and Subtract links to work like the AsyncTest example in the SDK, but I'm having trouble figuring out how to apply the Dialog routine examples to AM Descriptions.
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2004 at 10:14, xxxxxxxx wrote:
Howdy,
Well, I found something that sort of works, but I actually stumbled upon it while looking for something else. I added these 3 lines right before the return in the GetDDescription() :
BaseContainer msg(COREMSG_CINEMA_FORCE_AM_UPDATE);
msg.SetLong(COREMSG_CINEMA_FORCE_AM_UPDATE, linkID);
SendCoreMessage(COREMSG_CINEMA, msg, 0);The only problem is that it slows down everything when the tag is selected. Is there a better way to do this or a better place to put the 3 lines of code to where it won't slow things down?
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/09/2007 at 22:03, xxxxxxxx wrote:
I realize that this topic is very old, but just wanted to notify others that the best approach here is calling SendCoreMessage() after making the change in Message(). This will avoid the slow down by only calling SendCoreMessage() when the button is actually clicked and not in GetDDescription() which is called very often.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/09/2007 at 07:10, xxxxxxxx wrote:
Howdy,
Hehe, this IS a very old thread (8.5).
Actually, I found it's better not to have the AM links in the .res file and try to hide and show them in the GetDDescription() function. It seemed to work better if I just created them in the GetDDescription() function according to the count stored when the buttons are clicked.
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/09/2007 at 10:23, xxxxxxxx wrote:
I guess it depends on what you need to happen. In my case, I just wanted a button to change the state of some dynamic checkboxes (the value stored in another tag). This happened, but nothing changed unless another tag was selected and then went back to the tag (force GetDDescription() to redo). Adding core message when the button click was received in Message() (MSG_DESCRIPTION_COMMAND_COMMAND) worked immediately.
As you note, dynamic descriptions may need an index or base-value stored in the res file, but everything else should be done in GetDDescription().