0
$\begingroup$

I decided to restructure this post, since I learned new stuff:

I wrote a script, which I want to use as an addon. I wrote the necessary code for that and it works like a charm...

...until I want to install the .py

Installing works fine, since I can check for it in the scrips\addons dir. It just doesnt show up in the addons menu, where I need to tick the box to activate it.

I tried:

  • removing dots and spaces from the .py name

  • deleting and reinstalling it multiple times

  • moving it in the dir manually

  • changing the .py name to all sorts of stuff

  • changing the "Version" in bl_info to all sorts of stuff

Code, containing the error:

#################################################
# Ive cut all the stuff you guys dont care about.
# The error must be in the remaining code
# since this still does not install
#################################################
bl_info = {
    "name" : "DOM Importer",
    "description" : "Import a STL file and do the DOM Stuff with it",
    "author" : "Alex",
    "version" : (1, 0, 0),
    "blender" : (2, 80, 0),
    "location" : "View3D",
    "warning" : "",
    "support" : "community",
    "doc_url" : "",
    "category" : "3D View"
}


import bpy, sys
from bpy.types import Operator
from bpy.types import Panel
from bpy.props import StringProperty, CollectionProperty
from bpy_extras.io_utils import ImportHelper
from pathlib import Path
from mathutils import Matrix
import math


class DI_OT_domimporter(Operator, ImportHelper):
    """ Import an STL and do things with it"""
    bl_idname = "import.domimporter"
    bl_label = "Import DOM as STL"
    bl_options = {"REGISTER", "UNDO"}

    filter_glob: StringProperty(
        default='*.stl',
        options={'HIDDEN'}
    )

    files: CollectionProperty(type=bpy.types.PropertyGroup)


    @classmethod
    def poll(cls, context):
        return context.mode == "OBJECT"

    def execute(self, context):
        return {'FINISHED'}


class DI_PT_sidebar(Panel):
    """Display Process STL"""
    bl_label = "STL"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "DOM Importer"

    def draw(self, context):
        col = self.layout.column(align=True)
        prop = col.operator(DI_OT_domimporter.bl_idname)

classes = [
    DI_OT_domimporter,
    DI_PT_sidebar,
]

def register():
    for c in classes:
        bpy.utils.register_class(c)

def unregister():
    for c in classes:
        bpy.utils.unregister_class(c)

if __name__ == '__main__':
    register()

    

Old Post:

I wrote an Script, which works fine (thanks to you all btw :D)

Now, I want to use it as an Addon. I have seemingly everything set up.

I have my bl_info and the register and unregister funcs. When I want to install the .py, it looks like its working. When I check my installed addons, however, it does not show up. Same is for the button I want to appear in the 3D View.

Opening the Console, I see the following:

    Modules Installed (my addon 1.0) from 'path\\my addon 1.0.py' into 'path\\Blender Foundation\\Blender\\3.1\\scripts\\addons'

Which is indicating, it worked(?)

The baffling thing is, that it DID work some time ago, but idk what I did -.-

Using Windows, if its gonna be important.

Edit: I watched this Video and I think I did everything he did

https://www.youtube.com/watch?v=Fr1HN0XgB58

Another Edit: Following this post:

Troubleshooting when Addons don't show up

I substituted all dots in the file name (and spaces for good measure) with underscores. The post states, I am not allowed to use dots in the file name, which I hope excludes the .py^^?

$\endgroup$
5
  • $\begingroup$ This is usually a symptom of a problem with the bl_info but it is impossible to diagnose without looking at the script. Can you paste the script into your question? $\endgroup$ Commented May 24, 2022 at 13:40
  • $\begingroup$ @MartyFouts I added the bl_info, hope it helps. $\endgroup$
    – quest-12
    Commented May 24, 2022 at 13:46
  • $\begingroup$ The 8 should be an 80, the 0 matters to Blender, but I don't think that's your problem. Is your script called 'init.py'? (Two underscore characters before and after "init". Another thing to look at is to Window -> Toggle System Console and see if there are error messages on the system console. $\endgroup$ Commented May 24, 2022 at 14:18
  • $\begingroup$ Yeah we need to see the whole script, the whole file name etc. We can't debug just from the bl_info $\endgroup$
    – Jakemoyo
    Commented May 24, 2022 at 14:42
  • $\begingroup$ @Jakemoyo I hope that helps. the whole file name changed alot, just because I was trying alot of stuff. I am pretty sure, its not the file names fault $\endgroup$
    – quest-12
    Commented May 25, 2022 at 9:37

1 Answer 1

0
$\begingroup$

Your problem was the inclusion of this key/value pair in the bl_info dict.

enter image description here

Whenever I get my bl_info i just copy it out of the Templates > Python > Addon Add Object file and fill it with my own info. Which you can see I did to test your script.

I found an old article in a Blender wiki that seemed to be written around 2.65 with the support key and it worked as well, but it seems like the order is important.

enter image description here

Probably has to do with Python dictionaries switching from arbitrary ordering to strict ordering in Python 3.6

$\endgroup$

You must log in to answer this question.

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