Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search

How does tcaconstraint add/remove groups?

  Topic Search Topic Search
CMPXCHG8B View Drop Down

Joined: 2011 Dec 11
Online Status: Offline
Posts: 95
Direct Link To This Post Topic: How does tcaconstraint add/remove groups?
    Posted: 2018 Mar 04 at 3:07am

User Information:

Cinema 4D Version:   R17 
Platform:    Mac  ;  
Language(s):     C++  ;   


Greetings to all.

I'm trying to write a plugin that needs to be able to add and remove groups of elements on demand (whenever the user presses a button), kinda like the way the character constraint tag works with the PSR and Aim sections.

I know this has something to do with GetDDescription(), but I'm not entirely clear on how. I believe GetDDescription needs to construct the entire "dynamic" portion of the UI every time it's called (as that information isn't saved anywhere), which is fine. However, I'm not clear on a couple of things, and I was hoping someone could help me with.

1) How do you use GetDDescription() with an existing *.res file? The majority of my plugin is defined by the resource file, however I only need to add and remove groups from one specific section of the UI. I'm assuming I need to tell C4D to load the res file contents somehow- but after I do that, how do I specify where my dynamic description stuff should show up? Is that simply a matter of inserting the elements at the right place (after C4D has presumably loaded up my stored descriptions from the res file)?

2) I noticed the tcaconstraint tag seems to store a bunch of "template" widgets in the *.res file that are declared as hidden by default; yet they seem to match the layout of the elements that get cloned when the user clicks the add button. Why is this? Is the tag simply copying those hidden elements, unhiding them, and adding them to the description passed to GetDDescription()?

3) How do I handle the description IDs for dynamically added elements? Should I just start at some base integer (like 2000) and add a specific number to that for each dynamic group? Ie, group 1 would start at 2000, group 2 would start at 2010, group 3 at 2020, etc, etc.

4) How should I be storing the data associated with the dynamic widgets? Normally I just grab a pointer to the base container provided by node->GetDataInstance() and get/set stuff through there. When the user clicks the "add" button, should I just store some arbitrary data in there (presumably matching the IDs of the elements as laid out in #3) and then assume that my code in GetDDescription will automatically retrieve that data and use it to display the relevant data? Or is there some other way I should be saving and loading this stuff to the scene somehow?

Sorry if my terminology is kinda broken here... I have written plugins before, but I've never had a reason to get down and dirty with the description system (all my former plugins have static GUIs). Trying to create a dynamic UI has exposed me to a lot of things I'm not quite familiar with.

Back to Top
MaximeA View Drop Down
Forum Moderator
Forum Moderator

Forum Moderator

Joined: 2018 Jan 04
Location: France - Nantes
Online Status: Offline
Posts: 119
Direct Link To This Post Posted: 2018 Mar 05 at 1:53am

First of all I would like to point you to GetDDescription Manual, Description Manual and objectdata_descriptions example.
Pretty much everything you asked is explain in theses manuals or object_data_example.

If not please do not hesitate to ask more informations.

SDK Specialist
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.063 seconds.