2
$\begingroup$

I'm creating a panel with several buttons that start modal operators. I'm finding the default UI layout creates very small icons that are hard to see, even if the source image is rather large. Is there any way to make things larger or include spacers and images?

class NormalToolPropsPanel(bpy.types.Panel):

    """Properties Panel for the Normal Tool on tool shelf"""
    bl_label = "Normal Brush"
    bl_idname = "OBJECT_PT_normal_tool_props"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_context = "objectmode"
    bl_category = "Kitfox"


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

        scene = context.scene
        settings = scene.normal_brush_props
        
        pcoll = preview_collections["main"]
        
        
        col = layout.column();
        col.operator("kitfox.normal_tool", text="Start Normal Tool", icon_value = pcoll["normalTool"].icon_id)

...

#---------------------------

preview_collections = {}

def register():

    bpy.utils.register_class(NormalToolSettings)
    bpy.utils.register_class(NormalPickerOperator)
    bpy.utils.register_class(ModalDrawOperator)
    bpy.utils.register_class(NormalToolPropsPanel)

    bpy.types.Scene.normal_brush_props = bpy.props.PointerProperty(type=NormalToolSettings)

    #Load icons
    icon_path = "../icons"
    if __name__ == "__main__":
        icon_path = "../../source/icons"
        
    icons_dir = os.path.join(os.path.dirname(__file__), icon_path)
    
    print("icons dir: " + str(icons_dir))
    
    pcoll = bpy.utils.previews.new()
    pcoll.load("normalTool", os.path.join(icons_dir, "normalTool.png"), 'IMAGE')
    preview_collections["main"] = pcoll


def unregister():
    bpy.utils.unregister_class(NormalToolSettings)
    bpy.utils.unregister_class(NormalPickerOperator)
    bpy.utils.unregister_class(ModalDrawOperator)
    bpy.utils.unregister_class(NormalToolPropsPanel)
$\endgroup$
1
  • $\begingroup$ I don't want to increase the size of the entire panel, just a few of the images. I'd like to have more control over layout that just adding rows and columns of properties. $\endgroup$
    – kitfox
    Commented Mar 3, 2021 at 10:19

0

You must log in to answer this question.

Browse other questions tagged .