Promote Material Parameters

   3103   4   1
User Avatar
Member
71 posts
Joined: June 2008
Offline
Hi all!

When using “Promote Material Parameters” on already existing material with promoted parameters then all expressions and relative texture paths expands to absolute values.

Is there any way to override this behavior?

Problem is that if working with my shader e.g. version 1.0.0, than making next version 1.0.1 with some new parameters added which I want to use in existing previous version of shader. So, if I do "Promote Material Parameters” then I have to do some kind of unnecessary work by returning back expressions and relative paths.
Alexey Mazurenko
User Avatar
Member
7025 posts
Joined: July 2005
Offline
Hi Archie,

Right now the Promote Material Parameters is a “use once” option. For subsequent changes, you really can't use it for the reasons you've discovered. SESI is aware of this issue, and hopefully it will be addressed in a future version.

For now, if you make changes, use the Edit Parm Interface option in the Gear menu, and drag in your new shader parms to make connections and re-order/label parms.

Cheers,

Peter B
User Avatar
Member
71 posts
Joined: June 2008
Offline
Hi, Pbowmar!

Unfortunately, using gear menu is not the most effective way when shader has lots of parameters. Tried to create my own promote but faced the following issue: when creating parameter I cannot know if such parameter already exists or not. For example:


import os
import glob

def getListParam(path):
path = os.path.abspath(unicode(path))
if os.path.exists (path):
return glob.glob (path+'/*.py')

# Simple export
node = hou.node(“/shop/testShader”)
paramList = node.spareParms()
for param in paramList:
pt = param.parmTemplate()
script = pt.asCode()
f = open(“CTemp/%s.py”%(param.name()), “w”)
f.write(script)
f.close()

# Simple import
listPathParam = getListParam('CTemp')
for path in listPathParam:
execfile(path)
node.addSpareParmTuple(hou_parm_template)

In case of exporting color parameter an error appears. Thats because initially a value for red channel is created, next when creating value for green channel there is an error telling that such parameter already exists. I don’t know how to get around of that without parameters existence check.
Alexey Mazurenko
User Avatar
Member
7025 posts
Joined: July 2005
Offline
Hi Archie,

Yup, this is a problem right now.

One thing you might consider, but I want to warn it's not necessarily easy/workable, is direct Dialog Script manipulation. You don't seem to be adverse to coding so it might work for you

Basically, you can RMB on a Parm Folder (sadly, not the whole UI though, you have to do it folder by folder) and Save Parameters to File.

This creates a .ds (Dialog Script) on disk. You then parse it as you need to.

I don't know if there is any way to save this out via scripting though, scripting of Optype Properties stuff is very incomplete right now

Cheers,

Peter B
User Avatar
Member
71 posts
Joined: June 2008
Offline
Thanks, I'll try.
Alexey Mazurenko
  • Quick Links