Dynamically fill in a CYCLE item

On 04/05/2014 at 11:56, xxxxxxxx wrote:

Inside my container description I have an item that is supposed to be a list of items. I created it with:

LONG PT_PRESETS { CYCLE { PT_CUSTOM; } }

The PT_CUSTOM is a simple string (in the str file) that holds the word "Custom".

However, I want to be able to populate the dropdown list inside my plugin code, being able to, for example, fill the list with:

Item1
Item2
Item3
Custom

How can I do that, in code?

Rui Batista

On 04/05/2014 at 12:47, xxxxxxxx wrote:

Hi Rui,
something like this:
It´s for a Gui
(PT_CUSTOM or the Id of PT_CUSTOM)

self.GroupBegin(id="the Id of the Gui Group", flags=c4d.BFH_FIT, cols=2, rows=4)
       self.AddComboBox(PT_CUSTOM, flags=c4d.BFH_LEFT, initw=125, inith=12)
       self.AddChild(PT_CUSTOM, "the ID of the item", "Item1" )
       self.AddChild(PT_CUSTOM, "the ID of the item", "Item2" )
       self.AddChild(PT_CUSTOM, "the ID of the item", "Item3" )
       self.AddChild(PT_CUSTOM, "the ID of the item", "Custom" )
      
       self.GroupEnd()

hope this helps?

martin

On 04/05/2014 at 13:16, xxxxxxxx wrote:

I don't want to build my GUI programatically.
I want mu GUI to be defined in a res file.
I just want to be able to fill in the data inside the LONG item, set to CYCLE.

On 04/05/2014 at 13:52, xxxxxxxx wrote:

This is an example of a ComboButton entry in the .res file

  
  LONG MULTIBUTTON  
  {  
      CYCLE  
      {                  
          MULTI_ONE;  
          MULTI_TWO~1234567;    //Uses an Icon ID to show an icon on the button  
          //Etc...  
      }  
  }

This is not dynamic though. It's static.
If you want to dynamically grow & shrink your CB children while C4D is running. Then I'm pretty sure the only way to do that is in the code. And not with a .res file.

-ScottA

On 04/05/2014 at 15:41, xxxxxxxx wrote:

So, we can't add children to a CYCLE?
That is a huge limitation :-(

On 04/05/2014 at 15:47, xxxxxxxx wrote:

Is there any other way to have a type of COMBO defined by a res file that can be dynamically populated with items?

On 04/05/2014 at 17:37, xxxxxxxx wrote:

The way I understand it is that the resource files are meant to be used as constants.
You can make changes to the .res, .str, & .h files. But those changes will not be used until C4D is closed and re-launched.
So I don't think you can dynamically change them while C4D is running. But I could be wrong.

Why is it so important that you do this with the .res file?
Are you trying to use an additional language for your GUI or something like that?

-ScottA

On 04/05/2014 at 18:13, xxxxxxxx wrote:

Yes, I was intending to make it easy to translate the strings.
Also, I find it much more structured and clean to have the interface defined in a description file than "hard coded".

On 05/05/2014 at 01:18, xxxxxxxx wrote:

Download SmartPolyChart

http://www.smart-page.net/blog/2012/06/24/smart-polychart-cinema-4d-plugin-fun-with-the-userarea/
">
http://www.smart-page.net/blog/2012/06/24/smart-polychart-cinema-4d-plugin-fun-with-the-userarea/

It´s res based and has an interactiv Userarea with a mouseevent example
Maybe you can build up your own Cycle area dynamically.
I´m not sure if this helps.

martin

On 05/05/2014 at 13:14, xxxxxxxx wrote:

Thank you for the link, Martin.
It is a bit overkill to what I need but I learned a lot by analyzing the code and it can be handy in the future.
However, I guess I will have to code my own interface.
So, how to I create an interface, with code, for an object plugin?
Can someone help me? Because all object plugin examples that I have in the Python SDK use resources descriptions.