goshone

goshone

About Me

Expertise
Not Specified
Location
Not Specified
Website

Connect

Recent Forum Posts

"Wrapping" a principled shader into a Digital Asset Feb. 5, 2018, 8:14 p.m.

jsmack
For now, the only render property that is automatically propagated is the ‘vm_displacebound’ property.

I have noticed that this has an expression (the exact same expression) in the vm_displacebound field, but it references parms that are on the original shader. So essentially, it appears that the properties node does nothing. There must be a reason for SideFX to create this node, but it escapes me. Can I just delete it, or do I need to reference the original vm_displacebound?

Thanks
Josh

Triggering a python script from a houdini engine interface button. Dec. 8, 2016, 1:25 p.m.

Sure thing Andrew. I have actually added a relevant portion of my script.

import maya.cmds as cmds
import maya.mel as mel
import time
import os

# cmds lines commented out due to incompatability. Using mel.eval instead

def fromSelectedGuides():
#selection = cmds.ls( selection=True )
selection = mel.eval( 'ls -sl' )
guides_sel = selection[ 0:len( selection ) - 1 ]
fursim = selection[ len( selection ) - 1 ]

# make sets for no duplicates
base = set()
guides = set()
#print procs

# get the relevant guide files from each selected fur groom
for patch in guides_sel:
ref_mesh = cmds.getAttr( patch + '.parmrefCache' )
#command1 = ( "getAttr " + patch + "Locator.parmrefCache" )
#print command1
#pcmd = ( "print( \"" + command1 + "\\n\" )" )
#ref_mesh = mel.eval( command1 )
base.add( ref_mesh )
guide_file = cmds.getAttr( patch + '.parmguideCache' )
#command2 = ( "getAttr " + patch + "Locator.parmguideCache" )
#print command2
#pcmd = ( "print( \"" + command2 + "\\n\" )" )
#guide_file = mel.eval( command2 )
guides.add( guide_file )

# clear the fields current contents
c = 1
while c < 21:
command3 = ( "setAttr -type \"string\" " + fursim + ".houdiniAssetParm.houdiniAssetParm_stdswitcher3_2_1__folder.houdiniAssetParm_groom_files_" + str( c ) + " \"\"" )
#cmds.setAttr( fursim + ".houdiniAssetParm.houdiniAssetParm_stdswitcher3_2_1__folder.houdiniAssetParm_groom_files_" + str( c ), "", type='string' )
mel.eval( command3 )
c += 1

# fill in the fursim engine with relevant paths
i = 1
base_list = list( base )
#if len( guides_sel ) > 0:
#if len( base_list ) > 1:
#print 'There are inconsistent base meshes found on the procedurals.'
#else:
#print ( "Ref Mesh: " + base_list[ 0 ] )

guide_list = list( guides )
#print guide_list
#i = 0
for guide in guide_list:
#i += 1
print ( "Guide Curve: " + guide )
command4 = ( "setAttr -type \"string\" " + fursim + ".houdiniAssetParm.houdiniAssetParm_stdswitcher3_2_1__folder.houdiniAssetParm_groom_files_" + str( i ) + " \"" + guide + "\"" )
time.sleep( .2 )
print command4
#cmds.setAttr( fursim + ".houdiniAssetParm.houdiniAssetParm_stdswitcher3_2_1__folder.houdiniAssetParm_groom_files_" + str( i ), guide, type='string' )
mel.eval( command4 )
i += 1

command5 = ( "setAttr " + fursim + ".houdiniAssetParm_num_guide_files " + str(i-1) )
#cmds.setAttr( fursim + ".houdiniAssetParm_num_guide_files", i-1 )
mel.eval( command5 )

There are several lines commented out as I was still in the process of testing things.

So what I am trying to do is get values from selected objects and apply them to fields in the engine asset when pressing a button.

Another approach I tried was to re-write this script in mel, however, I couldn't get it to work. I had problems triggering the script, it simply wouldn't run using the callback script command set in asset type properties in Houdini. The mel script works as expected when run from the MEL command line in Maya.

strange

Triggering a python script from a houdini engine interface button. Dec. 5, 2016, 12:23 p.m.

Thanks for the reply, Andrew.

I guess that explains it a little, and I remember seeing another post on here about threads and how they are problematic with Maya and python.

The real issue I am having isn't even these print statements, which were really just for debugging. I am performing getAttr and setAttr commands in the for loops, but it doesn't seemt to respect the contents and manipulation of those contents while in (or possibly once outside) the loop. The print statements were an attempt to troubleshoot what happens to the data while inside the loop.

Again, the script I am calling from Engine in Maya works perfectly when run from command line. The loops just don't seem to act properly when launched from a button on the Engine UI in Maya.