2
$\begingroup$

So I have a panel I want to create a split option for. I experimented with box, row and column but was unable to get anywhere. I basiclly just want (S) and (C) on the same menu without extending the panel to be longer.

else:
                #C/S Sharpen Split Option
                layout = self.layout
                row = layout.row(align=False)
                split = row.split(percentage=0.5)
                col = split.row()

                Ssharpen = icons.get("Ssharpen")
                CSharpen = icons.get("CSharpen")

                col.operator("ssharpen.objects", text = "(S)", icon_value=Ssharpen.icon_id)
                col.operator("csharpen.objects", text = "(C)", icon_value=CSharpen.icon_id)    

this is what the menu looks like normally

this is what the menu looks like normally

this is what it looks like with my attempting to split it

While the extended menu looks cool I would like it more if I was able to lock it to that layout and had guidance text in the blank area. But I would rather it just have both the S and C in a panel thats the same size as normal.

$\endgroup$
4
$\begingroup$

use colum_flow(x) and col.label("for the text") (colum must be equal to get a nice look)

else:
            #C/S Sharpen Split Option
            layout = self.layout
            row = layout.row(align=False)
            split = row.split(percentage=0.5)
            col = split.colum_flow(2)

            Ssharpen = icons.get("Ssharpen")
            CSharpen = icons.get("CSharpen")

            col.operator("ssharpen.objects", text = "(S)", icon_value=Ssharpen.icon_id)
            col.operator("csharpen.objects", text = "(C)", icon_value=CSharpen.icon_id) 

it is not exactly what you want, but near...

import bpy

class SimpleCustomMenu(bpy.types.Menu):
    bl_label = "Simple Custom Menu"
    bl_idname = "OBJECT_MT_simple_custom_menu"

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

        layout.operator("object.duplicate_move", text="Duplicate")
        layout.label("1. use for text")
        layout.label("2. use for text")
        layout.label("3. use for text")


        layout.operator("object.duplicate_move_linked", text="Duplicate Linked")
        layout.operator("object.duplicate_move_linked", text="Duplicate Linked")
        layout.operator("object.duplicate_move_linked", text="Duplicate Linked")
        layout.operator("object.duplicate_move_linked", text="Duplicate Linked")


def register():
    bpy.utils.register_class(SimpleCustomMenu)


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

if __name__ == "__main__":
    register()

    # The menu can also be called from scripts
    bpy.ops.wm.call_menu(name=SimpleCustomMenu.bl_idname)

enter image description here

$\endgroup$
2
  • $\begingroup$ awesome. I am still fairly confused with it but I will continue messing with it. I feel I am missing something with formatting inside of panel boxes. But this answers my question! $\endgroup$ Jan 5 '16 at 21:35
  • 1
    $\begingroup$ Zeffii also posted a good example here: blender.stackexchange.com/questions/44356/… $\endgroup$ Feb 2 '16 at 18:27

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.