2
$\begingroup$

I am currently trying to create a panel blender addon with more than one python script (init.py, data.py) . However when I try to test out the code by installing the addon through zip then enabling it, it does not show up in the panel section. Nothing shows up in the system console, and no errors are seen. From what I can see, there isn't a problem with the code itself, which is confusing. What should I do?

here is the example code.

bl_info = {
    "name": "example_addon",
    "author": "KripC",
    "version": (0, 1),
    "location": "View3D > UI > example_addon",
    "category": "Animation", 
    "bl_space_type": "VIEW_3D",
    "bl_region_type": "UI",
}

import bpy
from . import data
from bpy.props import (FloatProperty,
                       IntProperty, 
                       BoolProperty,
                       EnumProperty)

class addonPref(bpy.types.PropertyGroup):

    oneHand: BoolProperty(
        name = "One Hand",
        description = "Animation only applies to one hand",
        default = False
    )

class addonfunc(bpy.types.Operator):
    bl_idname = "addon.func"
    bl_label = "addonfunc"
    def execute(self, context):
        print("hello")
        return {'FINISHED'}

class addonpanel(bpy.types.Panel):
    bl_label = "exampleaddon"
    bl_idname = "exampleaddon_PT_Panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "example_addon"

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        mytool = scene.my_tools
        layout.operator(addonfunc.bl_idname, text="FUNCTION")

classes = (
    addonPref,
    addonfunc,
    addonpanel,
)

def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.my_tools = bpy.props.PointerProperty(type=addonPref)

def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)
    del bpy.types.Scene.my_tools

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

1 Answer 1

4
$\begingroup$

add this

"blender": (2, 80, 0),

to bl_info and it should work.

Unfortunately you did not provide running code, so i had to comment out this line:

from . import data

it worked on my machine then.

$\endgroup$
2
  • 1
    $\begingroup$ Jeez I didn't expect the solution to be this easy thank you so much! $\endgroup$
    – KripC2160
    Mar 26 at 8:21
  • 1
    $\begingroup$ you are welcome. The problem with Blender (and most other things): if you know it - it is easy ;) But learning isn't that easy.... :D $\endgroup$
    – Chris
    Mar 26 at 10:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .