Skip to main content
Participant
Dec 14, 2022 1:56 PM UTC
Answered

Substance to blender plugin error when loading material

 

I just installed the plugin from substance 3D to blender. I loaded a material, but then it says "(error)", I can't apply it to any object.

 

The object is UV-unwrapped, but the way it looks is like it doesn't matter what the object looks like, it's an error from loading the material.

 

Does anyone know what could be the problem?

This topic is closed to new replies. Start a new post to keep the conversation going.
k30n1Correct answer
Participating Frequently
Jan 16, 2023 5:17 PM UTC

and 2nd one in line 473-476


Here's the updated manager.py from this morning, that includes the second fix for the Duplicate button (lines 473 area), it is the same as the one posted in this thread. Apologies for the confusing interplay between threads.

 

If you do not use the Duplicate button in the plugin then there is no need to use this version, as I understand it. 

 

Glad to hear the patch is working for people!

 

 

21 replies

Community Manager
Jan 12, 2023 6:41 PM UTC

Hi,

What version of Blender are you using? Also, is there any information on the Blender console/terminal that you could share with us? 

To view the console, go to the Windows menu -> Click on Toggle system console
For Mac: https://blender.stackexchange.com/questions/2078/how-to-use-blender-command-lines-in-osx 

Translate
Community Expert
Jan 15, 2023 6:40 PM UTC

Hi Shwetha,

I can confirm this bug on both machines Win10 and macOS 12.6.2 an error appears when trying to load any material into the Substance Panel.

Blender add-on is working well with Blender 3.3 but thows back an error in 3.4 (win & mac).

Actual workaround is reinstalling Blender 3.3 or using the code change mentioned above.

 

 

 

Translate
Participant
Dec 18, 2022 11:12 PM UTC

Thank you so much. Saved me from near madness with this!

Translate
Community Manager
Jan 12, 2023 6:38 PM UTC

Hi,

We will be pushing an official update soon on the Substance website for this issue.

Translate
Participating Frequently
Dec 17, 2022 4:13 PM UTC

Blender changed an internal Python API - here's what I edited to get the plugin v1.0.1 working with Blender 3.4.

 

In the addon file 3.4/scripts/addons/Substance3DInBlender/material.py use a plain text editor to comment out these lines (prefix with '#') a couple lines after "Initialize shader sockets" to disable the crashing code, as shown:

 

                    # if _socket["source"] == "input" and _socket["name"] not in _items[_socket["id"]].inputs:
                    #     _items[_socket["id"]].inputs.new(_socket["type"], _socket["name"])
                    # elif _socket["source"] == "output" and _socket["name"] not in _items[_socket["id"]].outputs:
                    #     _items[_socket["id"]].outputs.new(_socket["type"], _socket["name"])

 

 

After those lines, put this alternate code that uses the preferred method from the developer site:

 

                    grptree = _sbs_group.node_tree
                    if _socket["source"] == "input" and _socket["name"] not in grptree.inputs:
                        grptree.inputs.new(_socket["type"], _socket["name"])
                    elif _socket["source"] == "output" and _socket["name"] not in grptree.outputs:
                        grptree.outputs.new(_socket["type"], _socket["name"])

 

 

Note that python is very sensitive to indentation! The new code should be very similar in indentation to the original version of the old code.

 

Your mileage may vary and this may not be a fully correct solution, but this seems to have fixed the plugin crash for me that started with Blender 3.4. Hope it helps!

 

Translate
Participating Frequently
Dec 17, 2022 4:16 PM UTC

Correction! this is in the file

 

3.4/scripts/addons/Substance3DInBlender/material/manager.py

 

Translate
Participating Frequently
Dec 17, 2022 10:47 PM UTC

Given the indentation sensitivity and that a user who attempted the patch likely caused a broken plugin after editing the code, I'm attaching the modified manager.py from plugin version 1.0.1 as a text file. Move the original file aside to a backup location, and rename this one from manager.py.txt to manager.py as its replacement. Changes are at lines 191-201, per the above recipe. As I understand it, offering this alternate edited file is consistent with GPL license - if not, I will take it down or forum managers are welcome to.

Translate