Discussion:
[Bf-python] Including IO in a python script.
Atomic Perception
2014-01-27 13:24:00 UTC
Permalink
Hi All,

I am working on an AddOn that imports OBJ files. I have a standard include
at the top to include the module. However, when I check the console there
are errors that I am including something that has not been enabled. Because
IO are AddOns too it is possible that my AddOn could encounter a state
where the end user has not enabled an AddOn that I am including.

What is the solution in this case?

Overall, my AddOn still seems to function fine but I am concerned about the
error and wonder if there is "correct" way to make use of non-enabled
AddOns from another Addon

Thanks
Atom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-python/attachments/20140127/cdb3a9a2/attachment.htm
Daniel Monteiro Basso
2014-01-27 13:46:45 UTC
Permalink
On Mon, Jan 27, 2014 at 1:24 PM, Atomic Perception <
[...] where the end user has not enabled an AddOn that I am including.
I'm not sure if I've completely understood your question, but for the case
you have a dependency on another addon, I suggest you just display a
message for the user to take action. For instance:

try:
bpy.ops.import_anim.amc(
filepath=self.local_file,
frame_skip=cml.frame_skip)
except AttributeError:
self.report({'ERROR'}, "To use this feature please "
"enable the Acclaim ASF/AMC Importer addon.")


This snippet is from the cmu_mocap_lib addon.

Cheers,

Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-python/attachments/20140127/6b7817d9/attachment.htm
Loading...