"Convert Material To:" is just a template import?

I’m looking for confirmation here.

As documented here: Blender — Omniverse Connect documentation (nvidia.com)

Blender with omniverse integration:

Most materials can be converted using direct mapping to OmniPBR or OmniGlass as a base:

However, it never seemed to try and convert anything about the material so much as replace it with a template shader.

I dove into the source code. Because I wanted to understand the depth of the conversion. Perhaps it would allow me to understand how to get it to recognize textures and move them into the new template. There’s a lot of code in there that seems to want to do such a thing. However…

I have found two pieces of code in the ui:



        layout.operator('universalmaterialmap.create_template_omnipbr', text='Replace with OmniPBR graph template')
        layout.operator('universalmaterialmap.create_template_omniglass', text='Replace with OmniGlass graph template')

        if developer_mode:
            layout.operator('universalmaterialmap.generator', text='DEV: Generate Targets')
            layout.operator('universalmaterialmap.instance_to_data_converter', text='DEV: Convert Instance to Data')
            layout.operator('universalmaterialmap.data_to_instance_converter', text='DEV: Convert Data to Instance')
            layout.operator('universalmaterialmap.data_to_data_converter', text='DEV: Convert Data to Data')
            layout.operator('universalmaterialmap.apply_data_to_instance', text='DEV: Apply Data to Instance')
            layout.operator('universalmaterialmap.describe_shader_graph', text='DEV: Describe Shader Graph')

I’m not sure which is actually active. It seems like the former?

However, both pieces suggest what I suspected. That actually, those buttons don’t convert. They just import a template. Most of the functionality seems to be in the init.py file.

Further, the second code snippet suggests there’s a super secret “developer_mode” which is where a lot of the functionality that you can see in the addon is actually hooked.

First I’d like to confirm that indeed, the way its deployed via the launcher, those buttons don’t “convert” anything. They literally just stamp down a template. And further, this isn’t listed in the known limitations nor really the release notes. Effectively, the documentation is wrong and suggests the buttons do a thing that they don’t do.

Second, I’d like to confirm that I’m really seeing extensive usage of a weird “developer_mode” switch in the module. Not simply as some kind of “debug print” switch, but as an actual runtime switch of functionality. Which… to me seems to be horrible coding practice (I can’t sugar-coat that). And should be actively stripped from the codebase. Keeping track of a “development feature version” versus a “release version” of code is a source control/branch thing. It’s not something that belongs hidden behind secret module level boolean switches.

I’d highly recommend refactoring that “developer_mode” switch that’s all over the place, to a “verbosity” switch. And also, it should be surfaced to the UI so the user can make use of it.

1 Like

That actually, those buttons don’t convert. They just import a template.

If you mean the “Replace with…” menu items then yes they do not convert - they replace the nodes in the graph with a “template-graph”.


usage of a weird “developer_mode” switch

Yeah - could have been done better. Will improve on that.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.