DTYPE_BUTTON not showing in Description
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/11/2004 at 06:33, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.5+
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;---------
Howdy,I'm trying to add a button with GetDDescription() but it does not appear. Here is the code:
Bool TesterPlugin::GetDDescription(GeListNode *node, Description *description, LONG &flags;)
{
BaseTag *tag = (BaseTag* )node;
if (!description->LoadDescription(node->GetType())) return FALSE;LONG i,offsetCount = tag->GetData().GetLong(OFFSET_COUNT);
for (i=1; i<offsetCount; i++)
{
BaseContainer bc2 = GetCustomDataTypeDefault(DTYPE_BUTTON);
bc2.SetString(DESC_NAME," Set Offset ");
if (!description->SetParameter(DescLevel(SET_OFFSET_A+i,DTYPE_BUTTON,0),bc2,DescLevel(ID_OFFSETS)))
{
return FALSE;
GePrint(LongToString(SET_OFFSET_A+i));
}
}flags |= DESCFLAGS_DESC_LOADED;
return TRUE;
}I added the GePrint() to see if it gets created but it doesn't. I've done a search on the forum for DTYPE_BUTTON and only found one example, by Samir using a bitmap button, and the only significant difference I can see is with the DescLevel(). I also tried this: DescLevel(SET_OFFSET_A+i) instead of this: DescLevel(SET_OFFSET_A+i,DTYPE_BUTTON,0) and it made no difference.
What have I done wrong?
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/11/2004 at 11:52, xxxxxxxx wrote:
Hi,
hmm, I am not absolutely sure as it is long time ago I used this, but what kind of ID is ID_OFFSETS in DescLevel(ID_OFFSETS)?
If I remember correctly, passing the Group ID is what is needed there.
On a side note: you should return something like this:
return SUPER::GetDDescription(node, description, flags);Hope that helps
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/11/2004 at 13:39, xxxxxxxx wrote:
Howdy,
The ID_OFFSETS is the main group ID (Basic, Tag, Offsets) in the tag's AM Description. The "offsetCount" variable is increased and decreased with an "Add" and "Sub" button. Those two buttons are in the .res file (no problems there) and are handled in TesterPlugin::Message()
The line:
return SUPER::GetDDescription(node, description, flags);
doesn't seem to work for Tags (undefined identifier error), in fact the new R9 LookAtCamera SDK Tag example uses:
return TRUE;Anyway, I've added more lines:
Bool TesterPlugin::GetDDescription(GeListNode *node, Description *description, LONG &flags;)
{
BaseTag *tag = (BaseTag* )node;
if (!description->LoadDescription(node->GetType())) return FALSE;LONG i,offsetCount = tag->GetData().GetLong(OFFSET_COUNT);
for (i=1; i<offsetCount; i++)
{
BaseContainer bc1 = GetCustomDataTypeDefault(DTYPE_SEPARATOR);
bc1.SetBool(DESC_SEPARATORLINE,TRUE);
if (!description->SetParameter(DescLevel(LINE_ADD+i, DTYPE_SEPARATOR, 0),bc1,DescLevel(ID_OFFSET))) return FALSE;
BaseContainer subgroup1 = GetCustomDataTypeDefault(DTYPE_GROUP);
subgroup1.SetLong(DESC_COLUMNS, 1);
if(!description->SetParameter(DescLevel(GROUP_ADD_A+i, DTYPE_GROUP, 0), subgroup1, DescLevel(ID_OFFSET))) return TRUE;
BaseContainer bc2 = GetCustomDataTypeDefault(DTYPE_BUTTON);
bc2.SetString(DESC_NAME," Set Offset ");
if (!description->SetParameter(DescLevel(SET_OFFSET_A+i,DTYPE_BUTTON,0),bc2,DescLevel(GROUP_ADD_A+i)))
{
GePrint("not created");
return FALSE;
}
GePrint("Created - "+LongToString(i));BaseContainer subgroup2 = GetCustomDataTypeDefault(DTYPE_GROUP);
subgroup2.SetLong(DESC_COLUMNS, 2);
if(!description->SetParameter(DescLevel(GROUP_ADD_B+i, DTYPE_GROUP, 0), subgroup2, DescLevel(ID_OFFSET))) return TRUE;BaseContainer bc4 = GetCustomDataTypeDefault(DTYPE_REAL);
bc4.SetString(DESC_NAME, "Min ");
bc4.SetLong(DESC_UNIT, DESC_UNIT_DEGREE);
bc4.SetLong(DESC_ANIMATE, DESC_ANIMATE_ON);
if (!description->SetParameter(DescLevel(MIN_VALUE+i, DTYPE_REAL, 0), bc4, DescLevel(GROUP_ADD_B+i))) return TRUE;
BaseContainer bc5 = GetCustomDataTypeDefault(DTYPE_REAL);
bc5.SetString(DESC_NAME, "Max ");
bc5.SetLong(DESC_UNIT, DESC_UNIT_DEGREE);
bc5.SetLong(DESC_ANIMATE, DESC_ANIMATE_ON);
if (!description->SetParameter(DescLevel(MAX_VALUE+i, DTYPE_REAL, 0), bc5, DescLevel(GROUP_ADD_B+i))) return TRUE;
}flags |= DESCFLAGS_DESC_LOADED;
return TRUE;
}The "Min" and "Max" Reals show up, but the Separator line and the Button do not, even though the GePrint() line is telling me that the buttons are created.
Any clues?
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/11/2004 at 11:11, xxxxxxxx wrote:
Howdy,
No clues?
Well, I may give up on this anyway. Since the tag will only allow maximum of 4, I may just include them in the .res file and just have all 4 visible with an on/off Bool switch. I sure would have liked to add and subtract them, though.
I wish there were more examples of creating description with GetDDescription(). The AM is the most convenient interface in C4D, IMHO.
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/11/2004 at 11:18, xxxxxxxx wrote:
Quote: Originally posted by Cactus Dan on 12 November 2004
>
> * * *
>
>
> The line:
> return SUPER::GetDDescription(node, description, flags);
> doesn't seem to work for Tags (undefined identifier error), in fact the new R9 LookAtCamera SDK Tag example uses:
> return TRUE;
>
> * * *An excerpt from the SDK docs:
_Called to let you add your own parameters to the description for the node. Just modify the passed description object as you wish, set the appropriate flags and then make sure to include a call to the parent at the end:
return SUPER::GetDDescription(node, description, flags);_
You could also set "TagData::GetDDescription(node,description,flags);
> Quote: Anyway, I've added more lines:
>
> * * *
>
> The "Min" and "Max" Reals show up, but the Separator line and the Button do not, even though the GePrint() line is telling me that the buttons are created.
>
> Any clues?
>
> * * *Have you already tried specifying the customgui? Add it before you set the name of the button.
In the end it should look something like this:
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_BUTTON); bc.SetLong(DESC_CUSTOMGUI,CUSTOMGUI_BUTTON); bc.SetString(DESC_NAME,"Button Name..."); bc.SetString(DESC_SHORT_NAME,"Button"); if(!description->SetParameter(DescLevel(ID_OF_BUTTON,DTYPE_BUTTON,0),bc,DescLevel(GROUP_ID))) return FALSE;
Should work.
Katachi
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/11/2004 at 18:24, xxxxxxxx wrote:
Howdy,
Aha! That works!
I did not realize that a "regular" BUTTON was a CUSTOMGUI_BUTTON. When using BUTTON in a .res file it doesn't appear to be a "custom gui" element. The SDK documentation for BUTTON didn't seem to indicate this, either.
The separator line is also there when I add:
bc1.SetLong(DESC_CUSTOMGUI,CUSTOMGUI_SEPARATOR);Thanks, Samir. Now I won't be giving up on the Add and Sub buttons!
Would it also be wise to use CUSTOMGUI_REAL for the Min and Max elements even though they are appearing in the AM?
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/11/2004 at 20:19, xxxxxxxx wrote:
Yeah, I would suggest so. You never know if those container values can be properly used by C4D if you don´t do so (although once it is there, it shouldn´t make any problems. But it´s the same as pointer checks: always do so!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/11/2004 at 09:44, xxxxxxxx wrote:
Howdy,
Thanks, Samir. I will do that.
Adios,
Cactus Dan