• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Reloading a resource material

New Here ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

Hello,

 

I am trying to reload a material via the python API, and got an error I don't quite understand. For context the material is applied to a texture set in the scene, and it is a sbsar.

 

I am using the url of the applied material to get the old ID, import the new material to get the new resource, and then call

substance_painter.resource.update_layer_stack_resource(old_resource_id, resource)

However, in the python console, it reads out a RuntimeError: 

RuntimeError: Unable to update Resource. Resource type not supported. Only images, particles and substances are supported.

In the API docs, some limitations are called out:

The new resource must be of the same type as the resources it replaces. For example a base material resource cannot be updated with a smart material resource.

Moreover:

  • If the resource is a Substance material, it must have the same number and names of outputs.

  • If the resource is a Substance filter, it must have the same number and names of inputs and outputs.

But to test my code, I have not changed anything about the material to make sure what is being called out couldn't be what is happening.
Long story short, are SBSAR materials not able to reload?

Thank you for any insights.

TOPICS
Scripting

Views

236

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

Does it work if you use the resource updater plugin to update your material ?

Part of the limitations when updating resources is that Substance Materials need to have the same amount of inputs/outpus (or at least the same minimum, if the configuration change the update function will fail because of missing information).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

Yes, the Resource Updater does work.

I get warnings that an output isn't recognized like: [Substance Effect Presenter] Output fresnelior was not recognized
But it is successful in reloading. 

I am not sure what is happening that is different when run programatically. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

LATEST

If you can share some sample code/plugin or project to investigate this would be helpful at this point.

I gave a try at both the Resource Updater and the Python API to update/replace materials and they seem to be working as ecpected for me.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources