show/hide

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/05/2009 at 13:39, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   r11 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
i searched for show/hide of description elements, but didnt understand what i found.. so i wonder if there is any example how i can show/hide groups of my description, based on selections made?

thanks for your help...

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/05/2009 at 13:55, xxxxxxxx wrote:

You will need to implement GetDDescription() and set it:

BaseConainer bc;
bc.SetBool(DESC_HIDE, FALSE); // or TRUE
description->SetParameter(DescLevel(id,DTYPE_BLAH,0L), bc, DESCID_ROOT);

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/05/2009 at 02:05, xxxxxxxx wrote:

thank you very much!

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/05/2009 at 14:31, xxxxxxxx wrote:

args, i guess i still dont get it... how do i implement that GetDDescription()

and if i have this:
DescLevel(V_COUNT,DTYPE_VECTOR, LONG t_creator )

what is that t_creator about?
and why do i get an error that V_COUNT is not declared? it is an element of my gui..

or is there an example somewhere in the c4dsdk which i could look at?

thanks and cheers,
ello

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/05/2009 at 16:29, xxxxxxxx wrote:

Did you declare V_COUNT in the .h file of your plugin class and include the .h file in the .cpp?

Greetings,
Jack

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/05/2009 at 11:32, xxxxxxxx wrote:

yes, i did and i read its value successfully and use it in the plugin

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/05/2009 at 12:02, xxxxxxxx wrote:

It might be that you aren't loading the static descriptions first in GetDDescription(). Here's an example to help:

// NodeData.GetDDescription - Descriptions and Parameters
//*---------------------------------------------------------------------------*
Bool MyPluginClass::GetDDescription(GeListNode* node, Description* description, LONG& flags)
//*---------------------------------------------------------------------------*
{
     if (!(node && description))               return FALSE;
     if (!description->LoadDescription(node->GetType())) return FALSE;

BaseContainer     bc;
     bc.SetBool(DESC_HIDE, TRUE);
     if (!description->SetParameter(DescLevel(V_COUNT,DTYPE_VECTOR,0L),     bc, DESCID_ROOT))     return FALSE;

flags |=     DESCFLAGS_DESC_LOADED|DESCFLAGS_DESC_RECURSIONLOCK;

return SUPER::GetDDescription(node,description,flags);
}

I don't think you need to worry about LONG t_creator. Simply set it to 0L.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/05/2009 at 01:05, xxxxxxxx wrote:

thank you! now i get an error message:
error C2653: 'SUPER' no class or namespace

btw, what does 0L stand for?
cheers,
ello

(if only i could get my password sent ;) )

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 11/05/2009 at 05:57, xxxxxxxx wrote:

You are not doing something correctly then. This is standard (I use it in about six GetDDescriptions() in one project made of many plugins). You have to have "c4d.h" included somewhere and the api.lib as part of your project. Also, this method is an override from NodeData. Can't be used in any class, only those derived from NodeData at some level.

0L is a LONG 0 value. This avoids the compiler adding conversion code from INT to LONG (as numbers without the 'L' will be considered INT by default).

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 25/06/2009 at 12:15, xxxxxxxx wrote:

hi there.. again i tried to get this working, but failed.
i have this:

> <code>
>
>> `

  
\>  #include "c4d.h"  
\>  ...  
\>  class myPlugin : public ObjectData  
\>  {  
\>  public:  
\>       virtual Bool Init(GeListNode *node);  
\>    
\>       virtual BaseObject* GetVirtualObjects(PluginObject *op, HierarchyHelp *hh);  
\>       virtual Bool Message(GeListNode *node, LONG type, void *t_data);  
\>       virtual Bool GetDDescription(GeListNode* node, Description* description, LONG& flags);  
\>    
\>       static NodeData *Alloc(void) { return gNew myPlugin; }  
\>  };  
\>  

`
>
> </code>

and afterwards your snippet:
> <code>
>
>> `

  
\>    
\>  Bool myPlugin::GetDDescription(GeListNode* node, Description* description, LONG& flags)  
\>  {  
\>       if (!(node && description))               return FALSE;  
\>       if (!description->LoadDescription(node->GetType())) return FALSE;  
\>    
\>       BaseContainer bc;  
\>       bc.SetBool(DESC_HIDE, TRUE);  
\>       if (!description->SetParameter(DescLevel(V_COUNT,DTYPE_VECTOR,0L),     bc, DESCID_ROOT))     return FALSE;  
\>    
\>       flags |=     DESCFLAGS_DESC_LOADED|DESCFLAGS_DESC_RECURSIONLOCK;  
\>    
\>       return SUPER::GetDDescription(node,description,flags);  
\>  }  
\>  

`
>
> </code>

and i still get the same "error C2653"

furthermore i dont even know how to finally call the function to hide my gui element

any help to get this working would be great
thanks and cheers,
ello

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 25/06/2009 at 13:39, xxxxxxxx wrote:

You can't call GetDDescription(). It is called as needed - changes made to Descriptions in SetDParameter() or Message() may trigger it (as well as user changes similarly).

There are several ways to do the hiding as well. I'm using a couple more, like:

BaseContainer* bc = description->GetParameterI(DescLevel(V_COUNT), NULL);
if (bc)     bc->SetBool(DESC_HIDE, !show); // Bool show;

or

BaseContainer bc = GetCustomDataTypeDefault(DTYPE_VECTOR);
bc.SetBool(DESC_HIDE, !show);
if (!description->SetParameter(...))

Make sure that the groupid argument in description->SetParameter() is correct! If the description is under a group, this must be the direct group underwhich it resides.

Not sure why SUPER isn't working for you. To verify that I'm correct (as always ;) ), just go to GetDDescription() in the SDK documentation and there it is - it is required. Do this in your plugin object class header:

class MyPlugin :: public ObjectData
{
INSTANCEOF(MyPlugin,ObjectData)

I think that the line in red is needed for SUPER to work. Because of multiple inheritance, C++ doesn't have a super:: operator to get at the base class of derived classes. This is a workaround in the C4D C++ SDK to do so.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/06/2009 at 00:06, xxxxxxxx wrote:

Thank you Robert,
that line made SUPER work:
INSTANCEOF(MyPlugin,ObjectData)

great.. my first hidden element! now i can go on trying these things out :)

thank you so much!

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/06/2009 at 02:20, xxxxxxxx wrote:

another thing i cannot find.. how can i get the content of an element?

for example how can i get the value of V_COUNT inside the description? or how can i check if the user has dropped something into a link field?

thanks and cheers,
ello

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/06/2009 at 05:00, xxxxxxxx wrote:

ok. i now use private variable to be able to check them in the description. this works.. but the AM doesnt update correctly. i found a thread here which makes me think i have to use:
SendCoreMessage COREMSG_CINEMA_FORCE_AM_UPDATE
but i still need to find out how to use that...

ok..
this is what i have now, it works, but is it the right way to do it?

> `

  
\>  Bool myPlugin::Message(GeListNode *node, LONG type, void *t_data)  
\>  {  
\>    
\>            BaseContainer msg(COREMSG_CINEMA_FORCE_AM_UPDATE);  
\>            msg.SetLong(COREMSG_CINEMA_FORCE_AM_UPDATE, 0);  
\>            SendCoreMessage(COREMSG_CINEMA, msg, 0);  
\>       return TRUE;  
\>  }  
\>  

`

and is tthe following the right way to show/hide a bunch of elements?
> `

  
\>       if (parameters1)  
\>       {  
\>            bc = description->GetParameterI(DescLevel(COUNTALONG), NULL);  
\>            if (bc) bc->SetBool(DESC_HIDE, FALSE);   
\>            bc = description->GetParameterI(DescLevel(USETANGENT), NULL);  
\>            if (bc) bc->SetBool(DESC_HIDE, FALSE);  
\>            bc = description->GetParameterI(DescLevel(ROTALONG), NULL);  
\>            if (bc) bc->SetBool(DESC_HIDE, FALSE);  
\>            bc = description->GetParameterI(DescLevel(ROTTANGENT), NULL);  
\>            if (bc) bc->SetBool(DESC_HIDE, FALSE);  
\>       }  
\>       else  
\>       {  
\>            bc = description->GetParameterI(DescLevel(COUNTALONG), NULL);  
\>            if (bc) bc->SetBool(DESC_HIDE, TRUE);   
\>            bc = description->GetParameterI(DescLevel(USETANGENT), NULL);  
\>            if (bc) bc->SetBool(DESC_HIDE, TRUE);  
\>            bc = description->GetParameterI(DescLevel(ROTALONG), NULL);  
\>            if (bc) bc->SetBool(DESC_HIDE, TRUE);  
\>            bc = description->GetParameterI(DescLevel(ROTTANGENT), NULL);  
\>            if (bc) bc->SetBool(DESC_HIDE, TRUE);  
\>       }  
\>  

`

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/06/2009 at 10:20, xxxxxxxx wrote:

That looks correct on showing/hiding the parameters.

Get at the values of your description parameters using the BaseContainer of your node (which requires casting up since GetDataInstance() is declared in BaseList2D). So you usually get a GeListNode* node in the NodeData methods. Do this:

BaseContainer* bc = static_cast<BaseList2D*>(node)->GetDataInstance();
bc->SetLong(V_COUNT, 1000L);
- or -
LONG vcount = bc->GetLong(V_COUNT);

If you are getting the BaseObject* op in ObjectData, simply call:

BaseContainer* bc = op->GetDataInstance();

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/06/2009 at 13:50, xxxxxxxx wrote:

thanks for the input. i just tried to group all those elements so that i dont need to do such many calls, but strangely the group is hidden but not shown anymore...
in the .res file:

> `

  
\>            GROUP THEGROUP  
\>            {  
\>            BOOL USETANGENT {}             
\>            LONG COUNTALONG {MIN 1; MAX 1000; STEP 1; CUSTOMGUI LONGSLIDER; }  
\>            VECTOR ROTALONG {MIN -360.00; MAX 360.00; STEP 0.01;}                                
\>            VECTOR ROTTANGENT {MIN -360.00; MAX 360.00; STEP 0.01;}          
\>            }  
\>  

`

and in the cpp

  
     if (parameters1)  
     {  
          bc = description->GetParameterI(DescLevel(THEGROUP), NULL);  
          if (bc) bc->SetBool(DESC_HIDE, FALSE);  
     }  
     else  
     {  
          bc = description->GetParameterI(DescLevel(THEGROUP), NULL);  
          if (bc) bc->SetBool(DESC_HIDE, TRUE);  
     }  
[CODE]  
  

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/06/2009 at 05:59, xxxxxxxx wrote:

nevermind, i redefined parameters1 in another function so that it was not holding the right values ;)

thanks for all help in this issue

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 02/08/2009 at 14:27, xxxxxxxx wrote:

i am facing refresh problems again. this time it is when i am showing/hiding a description in a shader plugin. any idea what is causing the not refreshong attribute manager?

thanks for your help,
ello

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/08/2009 at 03:33, xxxxxxxx wrote:

This is working fine for me.

Sample code:

> \> Bool MandelbrotData::GetDDescription(GeListNode \*node, Description \*description, LONG &flags;) \> { \>      if (!description->LoadDescription(node->GetType())) return FALSE; \> \>      BaseContainer \*data = ((PluginShader\* )node)->GetDataInstance(); \> \>      BaseContainer \*hide = description->GetParameterI(DescLevel(MANDELBROTSHADER_VALUE), NULL); \>      if (hide) \>      { \>           if (data->GetBool(MANDELBROTSHADER_HIDE)) //get the state of MANDELBROTSHADER_HIDE (Bool) for hiding/unhiding of MANDELBROTSHADER_VALUE \>                hide->SetBool(DESC_HIDE, TRUE); \>           else \>                hide->SetBool(DESC_HIDE, FALSE); \>      } \> \>      flags |= DESCFLAGS_DESC_LOADED; \> \>      return SUPER::GetDDescription(node, description, flags); \> } \>

cheers,
Matthias