0
$\begingroup$

Thanks in advance for any help :)

Premise: I have three .py files for my blender addon: 1. init.py 2. panel.py 3. quadfaces_op.py

I'm trying to make a float slider that controls the face and shape thresholds. When the code is in one .py file it works well enough. Now that I've split the files I cant figure out the following:

  1. Do I need to register the classes in the init.py and/or in the file from which they originate.
  2. When I create a MyVariables(PropertyGroup) my intuition is that it ought to go into panel but it doesn't seem to work...

I've looked at various bits of answers but I can't seem to shoehorn them into what I'm trying to achieve here.

I if there's some basic premise (what file is inheriting from what) that I can be pointed to for further reading please let me know. The docs have been pretty cryptic so far.

$\endgroup$

1 Answer 1

2
$\begingroup$

A clean approach for registration is to provide a register and unregister function in every file that contains classes that need to be registered. Provide a top level register and unregister function in the __init__.py which calls the respective functions of the imported modules.

You can put the property groups in a separate file, they don't have to be in the same file as the panels.

A good reference for this approach is the Cycles add-on that can be found in your Blender install [version]/scripts/addons/cycles or intern/cycles/blender/addon in the repository.

$\endgroup$

You must log in to answer this question.

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