1
$\begingroup$

In fact I want to pack many add-ons.

I was using some "standard" __init__.py check

but in reality this does not work, then I tried the example of wiki blender changing the deprecated import imp toof importlib import reload but this example does not work either!

I looked for some reference in manual but I do not get anything

also the CoDEManX code from link is not avalaible,... then ...

what is the current way of packaging multiple files?

$\endgroup$
  • $\begingroup$ Do you mean in 2.8. Pretty sure I read that bpy.utils.unregister_module(__name__) is getting ditched. As for how to handle multifile addons, blender ships with a number of them, checkout their source. Here's something I was looking at a while back to package addons gist.github.com/batFINGER/4eee7c1a03746c65f2611c70a9f2e2ba $\endgroup$ – batFINGER Nov 12 '17 at 10:18
  • $\begingroup$ @batFINGER thanks for sharing. But how use that with custom icons?... $\endgroup$ – yhoyo Nov 12 '17 at 15:47
  • $\begingroup$ Please update the question to be either about "packed data" (i.e. images and other assets being packed inside the blend file) or about "multi-file packages" (i.e. Python packages that consist of a directory with multiple .py files in them). $\endgroup$ – dr. Sybren Dec 31 '17 at 9:51
1
$\begingroup$

I made the example of wiki blender with a little change. It seems to work well.
Version 2.79

# To support reload properly, try to access a package var, 
# if it's there, reload everything
if "bpy" in locals():
    import importlib
    if 'simple_obj_import' in locals():
        importlib.reload(simple_obj_import)
    if 'simple_obj_export' in locals():
        importlib.reload(simple_obj_export)

import bpy
from bpy.props import *
#from io_utils import ExportHelper, ImportHelper
from bpy_extras.io_utils import ExportHelper, ImportHelper

enter image description here

$\endgroup$
  • $\begingroup$ thanks for answer. I didn't use that wiki. I will try. Can you extend the answer using custom icons? $\endgroup$ – yhoyo Nov 12 '17 at 15:49
  • $\begingroup$ Be sure to also assign the returned value, so simple_obj_import = importlib.reload(simple_obj_import); without that you could still have a reference to the old import. $\endgroup$ – dr. Sybren Dec 31 '17 at 9:50

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.