0
$\begingroup$

Currently I am updating an add-on to work in Blender 3.4. It is a pretty simple scripting system that imports 3d bug assets from a source blendfile (Packed within the add-on) and then attaches those assets to a particle system with various customizable settings.

The issue I am having is with the former part...actually appending the collection of bugs into the scene.

On former versions of Blender I used the following code to append the collection of bugs into the scene.

The Blendfile variable where the 3d assets are stored is defined earlier in the add-on code. Shown below.

blend_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'spyderfyassets', 'spyderfymodels.blend')

Then the below script runs if a checkbox is selected on the panel UI.

#If the Locusts checkbox aka my_boollocusts is checked the following code should run
    if (context.scene.spyderfy_tool.my_boollocusts == True):
            
        #First we run the code to append the Locust collection from our custom blendfile directory
        section = "\\Collection\\"
        objects = ["FlyingLocusts"] #name of group inside of blendfile directory
    
        directory = blend_file + section
    
        for obj in objects:
            filename = obj
            bpy.ops.wm.append(filename=filename, directory=directory)
            
            #hide the group for cleaner look below
            bpy.ops.object.hide_view_set(unselected=False)
            
            

When I manually append the collection into the scene and run the rest of the script(not shown here) everything seems to work. Which leads me to believe the append function is the one that isn't working.

Any help or explanation is greatly appreciated!

Best, Brad

$\endgroup$
1
  • $\begingroup$ Hello, could you add a bit of information, regarding how you create blend_file ? $\endgroup$
    – Gorgious
    Jan 2, 2023 at 8:19

1 Answer 1

1
$\begingroup$

It seems a problem with the way that blender deals with "\"

Since version 3.4 I was getting errors on Blender if I use "\Collection\. To fix it, just rename to "/Collection/"

PS.: is a problem happening on linux based systems, on windows I didnt have this problem.

$\endgroup$

You must log in to answer this question.

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