I would like to add a custom colour picker for a custom material section. The colour picker should be below the red line in the image:

Color picker position

I found a code but this make the colour picker on the "tool panel" and not on the "material panel". This is the code:

import bpy

class POSE_PT_test(bpy.types.Panel):
    bl_label = "Test"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = "Testing"

    def poll(self, context):
        return True

    def draw(self, context):
            self.layout.prop(context.scene, "test_color", text='Detail Color')

def register():
    bpy.types.Scene.test_color = bpy.props.FloatVectorProperty(
        default=(1.0, 1.0, 1.0, 1.0)


Hope someone can help me to change this code so that it will be on material panel and below the red line. Thanks in advance.

  • 1
    $\begingroup$ To change your test code to be a panel in materials tab of properties space use bl_space_type = 'PROPERTIES' and bl_region_type = 'WINDOW' and bl_context = "material" . As for adding under red line in image above, (without an ugly hack) would need to edit into the draw code of that panel. $\endgroup$ – batFINGER Jan 31 '18 at 14:54
  • $\begingroup$ Related Rearranging elements of a panel $\endgroup$ – batFINGER Jan 31 '18 at 15:12
  • $\begingroup$ @batFINGER Can you guide me to make it under the red line in the image above? I have tried the code suggested by you but it gives error on line bpy.utils.register_class(POSE_PT_test) $\endgroup$ – Manochvarma Jan 31 '18 at 18:03

Your Answer

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

Browse other questions tagged or ask your own question.