0
$\begingroup$

Is it possible to add the colour picker in the texture paint panel to a pie menu ?

enter image description here

$\endgroup$
3
  • $\begingroup$ Do you already have a pie menu script working tha tyou need to add it to, or are you asking if there is a pie menu out there that does this? $\endgroup$ Jul 1, 2017 at 23:55
  • $\begingroup$ No I don't have it, I read the source code for the paint panel and can't figure anything out. I need the color picker in the custom pie menu. $\endgroup$
    – Retrax
    Jul 1, 2017 at 23:59
  • $\begingroup$ Not a complete answer, so I will just leave as a comment - you can use Texture Paint Plus and check out how the BrushPopup operator works, and see if you can get the code figured out in a pie menu instead. github.com/artistCDMJ/texture_paint_plus/blob/master/… $\endgroup$ Jul 2, 2017 at 0:22

1 Answer 1

1
$\begingroup$

Panels and Menus use the same methods to display properties and operators, the main difference is that a pie menu will show properties floating by themselves unless you create a box as a background for them.

To make your own pie menu start with the pie menu template that is included with blender.

To show a colour swatch that will pop-up a colour picker when clicked you use layout.prop() to display the colour property. To show the colour picker itself you can use layout.template_color_picker().

An example pie menu that shows both -

example pie menu for colour picking

class ColourPie(bpy.types.Menu):
    bl_label = 'Set Colours'
    bl_idname = 'OBJECT_MT_colour_pie'

    def draw(self, context):
        ts = context.tool_settings
        ups = ts.unified_paint_settings
        ptr = ups if ups.use_unified_color else ts.image_paint.brush

        pie = self.layout.menu_pie()
        row = pie.row()
        # add a colour swatch that can popup a colour picker
        row.prop(ptr, 'color')
        box = pie.box()
        #show the colour picker directly
        box.template_color_picker(ptr, 'color', value_slider=True)
$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .