0

When making a Custom panel in the UI for Blender, is there any way to make it easier to navigate?

for example making the background color in a "Drop down menu" a bit darker. or maybe borders around the buttons that are meant to be used together.

Like in this picture it is obvious that these settings are for Locking because it has a darker background.

In this picture you can see the slightly darker background i want to use

thank you

edit: another image for clarity

enter image description here

  • That is mostly taken care of automatically when you categorize your panel hierarchy and properties layout, and usually responds to user Blender theme set in user preferences. Not something that would generally need much manual crafting. What is missing in your case? – Duarte Farrajota Ramos Jul 18 '22 at 14:52
  • Hello I added another picture so you can more clearly see what I am trying to do – Pontus Brylander Jul 18 '22 at 15:06

1 Answers1

1

View Lock is darker because it is a child of the View Panel.

API - https://docs.blender.org/api/current/bpy.types.Panel.html

To make to a layout similar to the blender layout use

import bpy

class LayoutDemoPanel(bpy.types.Panel): """Creates a Panel in the scene context of the properties editor""" bl_label = "Layout Parent" bl_idname = "SCENE_PT_layout" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = "Demo"

def draw(self, context):
    layout = self.layout
    layout.use_property_split = True
    layout.use_property_decorate = False

    layout.label(text='Parent')


class LayoutDemoPanelChild(bpy.types.Panel): """Creates a Panel in the scene context of the properties editor""" bl_label = "Layout Child" bl_idname = "SCENE_PT_layout_child" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = "Demo" bl_parent_id = "SCENE_PT_layout"

def draw(self, context):
    layout = self.layout
    layout.use_property_split = True
    layout.use_property_decorate = False

    layout.label(text='Child')


def register(): bpy.utils.register_class(LayoutDemoPanel) bpy.utils.register_class(LayoutDemoPanelChild)

def unregister(): bpy.utils.unregister_class(LayoutDemoPanel) bpy.utils.unregister_class(LayoutDemoPanelChild)

if name == "main": register()

Karan
  • 1,984
  • 5
  • 21