3
$\begingroup$

I am working on a pie menu for texture painting but i've encountered something I do not understand.

The code and image I have presented below shows a pie menu with a prop that enables mirror brush on X axis, what I do not understand is that the UI does not look the same as in the panel.

How can I remove the checkbox that is presented in the pie menu to the right

panel on left, pie on right

import bpy
from bpy.types import Menu

default_keybind = 'W'

# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)

class VIEW3D_PIE_template(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Texture paint"
    bl_idname = "paint.image_paint"

    def draw(self, context):
        layout = self.layout

        toolsettings = context.tool_settings
        #settings = self.paint_settings(context)
        brush = context.tool_settings.image_paint.brush
        ipaint = toolsettings.image_paint

        col = layout.column(align=True)
        row = col.row(align=True)
        #pie = layout.menu_pie()
        row.prop(ipaint, "use_symmetry_x", text="X", toggle=True)


addon_keymaps = []
def register():
    bpy.utils.register_class(VIEW3D_PIE_template)
    wm = bpy.context.window_manager

    km = wm.keyconfigs.addon.keymaps.new(name='Image Paint', space_type='EMPTY')
    kmi = km.keymap_items.new("wm.call_menu_pie", default_keybind, 'PRESS', ctrl=False, shift=False)
    kmi.properties.name = "paint.image_paint"

    addon_keymaps.append(km)

def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_template)

    wm = bpy.context.window_manager
    for km in addon_keymaps:
        wm.keyconfigs.addon.keymaps.remove(km)
    # clear the list
    addon_keymaps.clear()

if __name__ == "__main__":
    register()

    #bpy.ops.wm.call_menu_pie(name="paint.image_paint")
$\endgroup$
0
$\begingroup$

Answer is pretty simple - you can’t.

Pies remain menus, not toolboxes, so they use the same UI conventions as menus (where only widget for booleans toggles are those small checkboxes).

$\endgroup$
  • $\begingroup$ What if I construct my own boolean property, will I then be able to get a similar style? $\endgroup$ – CandyFace Jan 6 '17 at 13:38
  • $\begingroup$ Eh nvm. if it's not possible then fine, I'll get around the problem then XP It may not be possible to remove the checkbox because of the defined UI conventions but it seems to be possible to hide it. using icon_value=100 has made it disappear at least, so that will be the solution for now. Because the icon is essentially still there, i'm there adding a couple of white spaces to align it. row.prop(ipaint, "use_symmetry_x", text="X ", icon_value=100) $\endgroup$ – CandyFace Jan 6 '17 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.