ShowPopUp with Details? [SOLVED]

On 11/01/2015 at 02:31, xxxxxxxx wrote:

Dear Python Experts.

I´ve made a plugin which execute the GUI ShowPopUpDialog and populate it with all layer names in the current document. When a names is pressed, the selected objects are added to that layer.

This works perfect, but i would like to get the layer color indicator into the popup aswell.

Is this even possible with the gui.showpopupdialog or do i need to go the GeDialog way?

If i have to go the GeDialog way, can someone push me in the right direction to start of such a custom gui? 🙂

Looking forward to hear from you !

Best Regards
Nicolaj

On 12/01/2015 at 10:45, xxxxxxxx wrote:

Hello,

you can use an icon in the popup menu. Using "& i....&" you can define an icon id that is used for that element:

  
menu.SetString(c4d.FIRST_POPUP_ID+99,"&i5119&Something")  

So you could create preview icons and register them using RegisterIcon(). But I'm not sure if this is a good workflow.

If you want to draw something in a GeDialog you may use a GeUserArea. There you can draw whatever you want. You find some code that shows how to use that class in the Py-MemoryViewer.pyp example.

Best wishes,
Sebastian

On 12/01/2015 at 10:56, xxxxxxxx wrote:

Hi Sebastian

Thanks for answer, it seems like a Good solution with the Registericon..
But is it possible to colorize the icons?

I wan't grab to the color from each layer and link it to the icon in the PopUp 🙂

Best Regards
Nicolaj

On 13/01/2015 at 00:06, xxxxxxxx wrote:

Hello,

when you call RegisterIcon() you register a bitmap. You can fill this bitmap any way you like.

best wishes,
Sebastian

On 13/01/2015 at 03:16, xxxxxxxx wrote:

I like to extend the question

I try the code of

menu.SetString(19, '&d&i5119& '+group.GetName());
    menu.SetString(0, "" )
    menu.SetString(31, 'select')

- but I can`t get a disable menu item and a icon

and all following menu item have the same icon

On 13/01/2015 at 05:11, xxxxxxxx wrote:

Hello,

to disable a menu element simply add "&d&":

  
menu.SetString(c4d.FIRST_POPUP_ID+100,"&i5150&Something Else &d&")  

best wishes,
Sebastian

On 17/01/2015 at 03:53, xxxxxxxx wrote:

Hi Sebastian

I´m having trouble finding the right code-snippet for filling a bitmap in python.
So far i managed i attach my custom icon to every entry in my popup dialog, but after looking thru the bitmap class, i can´t seem to find anything useful.

Best Regards
Nicolaj

On 19/01/2015 at 01:06, xxxxxxxx wrote:

Hello,

you can set the data of a bitmap using BaseBitmap.SetPixel(). An example can be found in SculptSaveMask.pyp.

A little more comfortable way of filling a bitmap would be to use the GeClipMap class.

  
geClipMap = c4d.bitmaps.GeClipMap()  
geClipMap.Init(800,600,32)  
  
geClipMap.BeginDraw()  
  
geClipMap.SetColor(255,0,0)  
geClipMap.FillRect(0,0,800,600)  
  
geClipMap.EndDraw()  
  
bitmap = geClipMap.GetBitmap()  
  
filename = c4d.storage.SaveDialog(title="Save image")  
bitmap.Save(filename,c4d.FILTER_TIF)  

For questions no longer related to this thread's original topic please open a new thread. Thanks.

best wishes,
Sebastian

On 30/01/2015 at 10:44, xxxxxxxx wrote:

Hello sortsovs,

was your question answered?

Best wishes,
Sebastian

On 30/01/2015 at 10:52, xxxxxxxx wrote:

Hi Sebastian

Oh Ya, Sorry! How do i close the topic? 🙂

On 02/02/2015 at 03:15, xxxxxxxx wrote:

Hello,

you do not need to close this topic; we will handle this.

Best wishes,
Sebastian