2
$\begingroup$

I'm trying to add a new panel to show up in the particles section of the Properties Editor.

class CudaParticlePanel(bpy.types.Panel):
    bl_idname = "CudaParticle_Panel"
    bl_label = "CudaParticle"
    bl_category = "SYSTEM"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "PARTICLES"

    def draw(self, context):    
        layout = self.layout
        layout.label(text= "CudaParticals Properties:")
        self.layout.label(text="CudaParticle")

I don't get any errors or warnings when running the code but my panel does not show up. Can anyone please explain different locations of the UI and how to put a panel there?

$\endgroup$
2
$\begingroup$

You need to register the class to use it.

Also bl_context = "PARTICLES" should be replaced by bl_context = "particle"

Here's the complete script

import bpy


class CudaParticlePanel(bpy.types.Panel):
    bl_idname = "CudaParticle_Panel"
    bl_label = "CudaParticle"
    bl_category = "SYSTEM"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "particle"

    def draw(self, context):    
        layout = self.layout
        layout.label(text= "CudaParticals Properties:")
        self.layout.label(text="CudaParticle")


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


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


if __name__ == "__main__":
    register()
$\endgroup$

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.