Skip to main content
added 36 characters in body
Source Link
Secrop
  • 3.6k
  • 19
  • 21

If your Panel's code is just what you posted, then you're missing some parts of a Panel's requirements.

Here's a small template for 'Shader Editor' to mess around:

import bpy

class SuperSimplePanel(bpy.types.Panel):
    bl_label = "The label of this panel"
    bl_idname = "NODE_PT_ThisSimplePanel" # This is new
    bl_space_type = 'NODE_EDITOR'         # This tells where to show
    bl_region_type = 'UI'
    bl_category = 'OH ANOTHER TAB'     # if it doesn't exist, it will be created

    @classmethod
    def poll(cls, context):         # This tells when to show
        return (context.space_data.type == 'NODE_EDITOR' and
                context.space_data.tree_type == 'ShaderNodeTree')

    def draw(self, context):       # This tells what to show
        layout = self.layout
        layout.label("I'm a label in a Panel")
        

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


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


if __name__ == "__main__":
    register()
```

If your Panel's code is just what you posted, then you're missing some parts of a Panel's requirements.

Here's a small template for 'Shader Editor' to mess around:

import bpy

class SuperSimplePanel(bpy.types.Panel):
    bl_label = "The label of this panel"
    bl_idname = "NODE_PT_ThisSimplePanel" # This is new
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = 'UI'
    bl_category = 'OH ANOTHER TAB'    # if it doesn't exist, it will be created

    @classmethod
    def poll(cls, context):         # This tells when to show
        return (context.space_data.type == 'NODE_EDITOR' and
                context.space_data.tree_type == 'ShaderNodeTree')

    def draw(self, context):       # This tells what to show
        layout = self.layout
        layout.label("I'm a label in a Panel")
        

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


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


if __name__ == "__main__":
    register()
```

If your Panel's code is just what you posted, then you're missing some parts of a Panel's requirements.

Here's a small template for 'Shader Editor' to mess around:

import bpy

class SuperSimplePanel(bpy.types.Panel):
    bl_label = "The label of this panel"
    bl_idname = "NODE_PT_ThisSimplePanel" # This is new
    bl_space_type = 'NODE_EDITOR'         # This tells where to show
    bl_region_type = 'UI'
    bl_category = 'OH ANOTHER TAB'     # if it doesn't exist, it will be created

    @classmethod
    def poll(cls, context):         # This tells when to show
        return (context.space_data.type == 'NODE_EDITOR' and
                context.space_data.tree_type == 'ShaderNodeTree')

    def draw(self, context):       # This tells what to show
        layout = self.layout
        layout.label("I'm a label in a Panel")
        

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


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


if __name__ == "__main__":
    register()
```
added 130 characters in body
Source Link
Secrop
  • 3.6k
  • 19
  • 21

If your Panel's code is just what you posted, then you're missing some parts of a Panel's requirements.

Here's a small template for 'Shader Editor' to mess around:

import bpy

class SuperSimplePanel(bpy.types.Panel):
    bl_label = "The label of this panel"
    bl_idname = "PT_ThisSimplePanel""NODE_PT_ThisSimplePanel" # This is new
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = 'UI'
    bl_category = 'OH ANOTHER TAB'    # if it doesn't exist, it will be created

    @classmethod
    def poll(cls, context):         # This tells when to show
        return (context.space_data.type == 'NODE_EDITOR' and
                context.space_data.tree_type == 'ShaderNodeTree')

    def draw(self, context):       # This tells what to show
        layout = self.layout
        layout.label("I'm a label in a Panel")
        

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


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


if __name__ == "__main__":
    register()
```

If your Panel's code is just what you posted, then you're missing some parts of a Panel's requirements.

Here's a small template for 'Shader Editor' to mess around:

import bpy

class SuperSimplePanel(bpy.types.Panel):
    bl_label = "The label of this panel"
    bl_idname = "PT_ThisSimplePanel"
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = 'UI'
    bl_category = 'OH ANOTHER TAB'

    @classmethod
    def poll(cls, context):
        return (context.space_data.type == 'NODE_EDITOR' and
                context.space_data.tree_type == 'ShaderNodeTree')

    def draw(self, context):
        layout = self.layout
        layout.label("I'm a label in a Panel")
        

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


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


if __name__ == "__main__":
    register()
```

If your Panel's code is just what you posted, then you're missing some parts of a Panel's requirements.

Here's a small template for 'Shader Editor' to mess around:

import bpy

class SuperSimplePanel(bpy.types.Panel):
    bl_label = "The label of this panel"
    bl_idname = "NODE_PT_ThisSimplePanel" # This is new
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = 'UI'
    bl_category = 'OH ANOTHER TAB'    # if it doesn't exist, it will be created

    @classmethod
    def poll(cls, context):         # This tells when to show
        return (context.space_data.type == 'NODE_EDITOR' and
                context.space_data.tree_type == 'ShaderNodeTree')

    def draw(self, context):       # This tells what to show
        layout = self.layout
        layout.label("I'm a label in a Panel")
        

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


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


if __name__ == "__main__":
    register()
```
Source Link
Secrop
  • 3.6k
  • 19
  • 21

If your Panel's code is just what you posted, then you're missing some parts of a Panel's requirements.

Here's a small template for 'Shader Editor' to mess around:

import bpy

class SuperSimplePanel(bpy.types.Panel):
    bl_label = "The label of this panel"
    bl_idname = "PT_ThisSimplePanel"
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = 'UI'
    bl_category = 'OH ANOTHER TAB'

    @classmethod
    def poll(cls, context):
        return (context.space_data.type == 'NODE_EDITOR' and
                context.space_data.tree_type == 'ShaderNodeTree')

    def draw(self, context):
        layout = self.layout
        layout.label("I'm a label in a Panel")
        

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


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


if __name__ == "__main__":
    register()
```