DESC_REMOVABLE not working
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/05/2012 at 11:49, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;---------
Hey guys,I'm having trouble getting my tag's GUI's to delete using the right click menu.
Nothing happens when I select "Remove Entry".Here's an updated version(R12++) of an old example that Matthias posted using the LookAt Camera SDK tag example:
#include "c4d.h" #include "c4d_symbols.h" #include "tlookatcameraexp.h" #include "lib_noise.h" // be sure to use a unique ID obtained from www.plugincafe.com #define ID_LOOKATCAMERATAG 1001165 enum { MY_NOISE = 6000 }; class LookAtCamera : public TagData { public: virtual Bool Init(GeListNode *node); virtual EXECUTIONRESULT Execute(BaseTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags); virtual Bool GetDDescription(GeListNode *node, Description *description, DESCFLAGS_DESC &flags); static NodeData *Alloc(void) { return gNew LookAtCamera; } }; Bool LookAtCamera::Init(GeListNode *node) { BaseTag *tag = (BaseTag* )node; BaseContainer *data = tag->GetDataInstance(); data->SetLong(MY_NOISE, NOISE_BOX_NOISE); return TRUE; } Bool LookAtCamera::GetDDescription(GeListNode *node, Description *description,DESCFLAGS_DESC &flags) { if (!description->LoadDescription(ID_LOOKATCAMERATAG)) return FALSE; const DescID *singleid = description->GetSingleDescID(); DescID cid = DescLevel(MY_NOISE,DTYPE_LONG,0); if (!singleid || cid.IsPartOf(*singleid,NULL)) // important to check for speedup c4d! { BaseContainer bc = GetCustomDataTypeDefault(DTYPE_LONG); bc.SetContainer(DESC_CYCLE,C4DNoise::CreateMenuContainer(FALSE)); bc.SetLong(DESC_ANIMATE,DESC_ANIMATE_ON); bc.SetBool(DESC_REMOVEABLE,TRUE); //<-------------This entry will not delete itself when right clicking it!!? bc.SetString(DESC_NAME,"Noises"); bc.SetString(DESC_SHORT_NAME,"Noises"); if (!description->SetParameter(cid,bc,DescLevel(ID_TAGPROPERTIES))) return TRUE; } flags |= DESCFLAGS_DESC_LOADED; return TRUE; } EXECUTIONRESULT LookAtCamera::Execute(BaseTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags) { return EXECUTIONRESULT_OK; } Bool RegisterLookAtCamera(void) { // decide by name if the plugin shall be registered - just for user convenience String name=GeLoadString(IDS_LOOKATCAMERA); if (!name.Content()) return TRUE; return RegisterTagPlugin(ID_LOOKATCAMERATAG,GeLoadString(IDS_LOOKATCAMERA),TAG_EXPRESSION|TAG_VISIBLE,LookAtCamera::Alloc,"Tlookatcameraexp",AutoBitmap("lookatcamera.tif"),0); }
The plugin itself works fine.
But the "Noises" gui won't remove itself like it supposed to.
What am I doing wrong?-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/05/2012 at 02:14, xxxxxxxx wrote:
It would seem that trying to do this using a dynamic description (with GetDDescription()) won't work - it will always be added back in GetDDescription(), no?
You would need to somehow get a notification that the description is being removed and exclude it on that condition in GetDDescription(). Implement the Message() method (NodeData) and check for
MSG_DESCRIPTION_REMOVE_ENTRY. This message comes with a DescriptionCommand structure (you need to cast it from void\* ) that includes the DescID.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/05/2012 at 07:43, xxxxxxxx wrote:
What you're saying makes sense Robert.
I just wanted to make sure I wasn't missing something stupid and simple.I only used the GetDDescription()/DESC_ method because that's what I've seen people post here the most. But now I'm wondering if the dynamic description method that uses UserData ( lib_description.h ) would be a better choice for me to use? Since it has a Remove() function built into it.
I have some notes on using the DynamicDescription class. And I think I might eventually be able to figure out how to spawn GUI's using that class.
But the first problem I can see having is trying to layout the dynamic UserData horizontally using that method!I hate it when you invest the time to use a specific method..Then you find out at the end it has a major gottcha you wished you knew about before you started.
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/05/2012 at 08:54, xxxxxxxx wrote:
GetDDescription() is pretty much a necessity whenever you have a dynamic interface in the Attributes Manager. But it does require much more work (and code, as we know so well) to make it work since it is not as clean and cut as the static interface you can create with a .res file.
I have not used the UserData approach for adding dynamic elements to the A.M. but it may be more versatile for what you are trying. Experiment with it and see if it provides better support for your interface requirements.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/05/2012 at 10:32, xxxxxxxx wrote:
My biggest concern with the UserData approach(aside from being a newbie with it) was being able to format the layout results.
But it looks like I can create groups with columns with it the same way as the DESC method. So this indeed seems like a better way to make dynamic GUI's.
I'll have to give a try and see how it goes.I think I'll keep my existing plugin the way it is for now. Even though I can't delete the GUI's. Just so I have a working example of using the DESC to create a dynamic GUI's in my collection.
I'm planning on giving it away with the source code. So people don't have to learn how to do it the hard way like I did.Here's the plugin if you want to take a peek at it:https://sites.google.com/site/scottayersmedia/QuickStepsC%2B%2B.zip
Thanks lot for your help Robert
-ScottA