2
$\begingroup$

I'm trying to create a multi-file package for my Blender addon. But when I click install addon, the addon doesn't show up in the user preferences.

I have two files:

  1. __init__.py
  2. QuickRenderAddon.py

They are put inside a folder called RenderAddon. When I'm installing the addon, I choose the __init__.py. What am I doing wrong and how can I fix it?

EDIT: I have installed one self-made addon before. This addon shows up as it should. But that was only one script.


__init__.py

bl_info = {
    "name" : "Quick rendering",
    "author" : "Lambi",
    "version" : (1, 0, 0),
    "blender" : (2, 7, 1),
    "location" : "View 3D > Edit Mode > Tool Shelf",
    "description" :
        "Allows for quick rendering",
    "warning" : "",
    "wiki_url" : "",
    "tracker_url" : "",
    "category" : "Add Mesh",
    'support': 'COMMUNITY'
}

if "bpy" in locals():
    import imp
    imp.reload(QuickRenderAddon)
    print("Reloaded multifiles")
else:
    from . import QuickRenderAddon
    print("Imported multifiles")

import bpy
import os

class LayoutDemoPanel(bpy.types.Panel):
    """Creates a Panel for quick rendering options"""
    bl_label = "Quick rendering panel"
    bl_idname = "RENDER_PT_layout"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "render"

    def draw(self, context):
        layout = self.layout
        scene = context.scene

        # Create an row where the buttons are aligned to each other.
        layout.label(text="Quick Rendering:")

        row = layout.row()
        row.scale_y = 2.0
        row.operator("object.custom_rendering")

class CustomRenderOperator(bpy.types.Operator):
    """Render stuff, yee"""
    bl_idname = "object.custom_rendering"
    bl_label = "Preview render"

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

def register():
    bpy.utils.register_module(__name__)

def unregister():
    bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
    register()

QuickRenderAddon.py

#Script to quickly access different render presets, 
#by clicking only one button

import bpy
import os

############# ... a bunch of function def's here, but I've
############# removed them as to not overwhelm you with code...

def set_settings():
    set_output_settings()
    set_sampling_settings()
    set_dimension_settings()

####################     Program:     ####################
render_folder = "Render\\QuickRenderAddon"
project_folder = "F:\\06_MotionPath_Dev"
os.chdir(project_folder)

#set_settings()
#bpy.ops.render.render(animation=True)

print("Program complete 2")
$\endgroup$
4
  • 2
    $\begingroup$ Your bl_info dict looks incomplete. Also, what support level is enabled? Your addon may be in Testing or not show at all until you add the support level to bl_info. $\endgroup$
    – CodeManX
    Nov 24, 2014 at 9:06
  • $\begingroup$ I've updated my bl_info. But it got the same result $\endgroup$
    – Humilton
    Nov 24, 2014 at 14:57
  • $\begingroup$ Is just installing __init__.py enough? Do I have to manually copy the script folder somewhere? $\endgroup$
    – Humilton
    Nov 24, 2014 at 15:07
  • 2
    $\begingroup$ Oh... you should zip the entire addon folder with all your py files inside including __init__.py and install via User Preferences > Addons > Install from File.... Or copy the entire folder with all files to a `scripts\addons` folder which Blender checks. $\endgroup$
    – CodeManX
    Nov 24, 2014 at 17:49

1 Answer 1

4
$\begingroup$

Not all keys in bl_info dict are required, you should fill in as many as you can however: http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons

Don't go to User Preferences > Addons > Install from File... and pick __init__.py, it will install that file only. Either

  • place your entire addon folder in one of Blender's addon directories (e.g. addons folder in bpy.utils.user_resource('SCRIPTS'))
  • or zip up the folder and Install from File... (which will unzip the folder to addons user dir)
$\endgroup$

You must log in to answer this question.

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