How to add a toggle button to the publisher

Hi!

Hopefully its not a to stupid question. But is there a simple way add a toggle button to the interface.

I adjusted the extract_blend.py from the blender addon to not pack any textures, but I’d like to make it optional. I was facing the issue decribed here, were each publish packs all textures which bloats our files. Like discribed in this issue

for now I just commented out the part that packs the textures, but I would like to make it optional in the publisher.

Thanks!

To add a toggle setting.
The issue refers to ExtractBlend. and since this one already exists then you only need to:

  1. Add the toggle directly here

    pack_textures: bool = SettingsField(True)
    
  2. Add a default value for the setting here

    "pack_textures": True
    
  3. In the plugin here, you will be able to use self.pack_textures.


Make any plugin optional

Sorry, I thought you have created a new plugin and was wondering how to make that plugin optional.

To make any plugin optional, you’d need to add some code blocks as follows:

  1. In the plugin, Add OptionalPyblishPluginMixin interface.
  2. If the plugin has get_attribute_defs, don’t forget to add super().get_attribute_defs() to its return value.
  3. In publish plugin settings, add a setting for it that inherits ValidatePluginModel.
  4. Create and upload the addon.

e.g. you can check extract blend plugin and extract blend setting.

1 Like

Now that we talk about textures, why are materials published along with the modeling ?
I thought Ayon’s scheme was that publishing a model product should only contain a mesh, nothing else (even materials).

Let me summon @BigRoy.

So, yes. But :face_in_clouds: … I blame “community”. Hehe.

Basically, the model product type is intended to be purely geometrical data and a strictly validated clean geometry meeting production requirements, like naming conventions, topology validations, uvs, etc. But there have been many cases where users wanted to bring along the materials for whatever reason.

And since the model was intended to be the model product type for your production there are ways to allow shaders/looks to come along in certain integrations, just because there was a request for it.

I’m not pushing hard against it, I’m just not using it. To everyone their own (to the extent it makes sense as a studio/production-specific toggle).

In Maya for example it can publish a ‘look’-like representation with model products to easily build a look dev scene from any temp materials applied in a model scene.

Maybe @murphy or @milan have a better backstory to this.

1 Like