Justin Keil
jtk700cln
About Me
専門知識
VFX Artist
業界:
Film/TV
Connect
LOCATION
United States
ウェブサイト
Houdini Engine
Availability
Not Specified
Recent Forum Posts
Strip file path, return result as referenceable expression 2024年11月2日21:49
So I figured it out--
I made some changes to the pythons script:
the mains script now saves the value result as a new string parameter
i have this script running as a callback script whenever the user changes the file directory.
The file directory gets stripped. The result is added as the new string value for a parameter, and I can then copy and paste this as a reference where needed!
Woot!
I made some changes to the pythons script:
the mains script now saves the value result as a new string parameter
i have this script running as a callback script whenever the user changes the file directory.
The file directory gets stripped. The result is added as the new string value for a parameter, and I can then copy and paste this as a reference where needed!
Woot!
Strip file path, return result as referenceable expression 2024年11月2日16:57
Trying to set up an interface for a user.
On the parameter interface I have:
1) a parameter set up to retrieve a directory, example:
D:/MEGASCANS_LIBRARY/Downloaded/surface/ground_forest_vlzjadflw/
2) A multi string python expression that strips everything but the last phrase: vlzjadflw, it is a function that can be called via kwargs.
import hou
import os
def strip_dir_call(node):
# Get the current node
node = hou.pwd()
# Get the parameter (channel) object
parm = node.parm("mat_2_dir")
# Get the value of the parameter
value = parm.eval() if parm is not None else ""
# Extract the last folder name from the evaluated value
last_folder = os.path.basename(os.path.normpath(value))
# Split the last folder by underscore and get the last segment
last_phrase = last_folder.split('_')
# Print the last phrase
print(last_phrase)
# Call the function
strip_dir_call(kwargs)
3) This expression is being called on by another parameter celled execute, which is a simple toggle. When I look at the python console I can see the result that I am hoping for.
vlzjadflw
vlzjadflw
vlzjadflw
The issue is, I want to use this returned value elswhere, ideally as a relative reference in a file name path in a separate node. I'm not finding a logical way to do this last step though. H
Any help would be appreciated. Thank you!
On the parameter interface I have:
1) a parameter set up to retrieve a directory, example:
D:/MEGASCANS_LIBRARY/Downloaded/surface/ground_forest_vlzjadflw/
2) A multi string python expression that strips everything but the last phrase: vlzjadflw, it is a function that can be called via kwargs.
import hou
import os
def strip_dir_call(node):
# Get the current node
node = hou.pwd()
# Get the parameter (channel) object
parm = node.parm("mat_2_dir")
# Get the value of the parameter
value = parm.eval() if parm is not None else ""
# Extract the last folder name from the evaluated value
last_folder = os.path.basename(os.path.normpath(value))
# Split the last folder by underscore and get the last segment
last_phrase = last_folder.split('_')
# Print the last phrase
print(last_phrase)
# Call the function
strip_dir_call(kwargs)
3) This expression is being called on by another parameter celled execute, which is a simple toggle. When I look at the python console I can see the result that I am hoping for.
vlzjadflw
vlzjadflw
vlzjadflw
The issue is, I want to use this returned value elswhere, ideally as a relative reference in a file name path in a separate node. I'm not finding a logical way to do this last step though. H
Any help would be appreciated. Thank you!
MTLX to Editmaterial Properties --Losing specified ranges 2024年10月9日15:44
Hey all, working on some procedural material generations.
ive created a paramter node within mtlx using python:
dispoutlow= matsubnet.createNode("parameter", mysel.name() + "_dispoutlow")
dispoutlow.parm("parmname").set("dispoutlow")
dispoutlow.parm("parmlabel").set("dispoutlow")
dispoutlow.parm("floatdef").set(-0.5)
dispoutlow.parm("rangeflt1").set(-1)
dispoutlow.parm("rangeflt2").set(.5)
this is the range I see on the parameter when i look at the python result.
However, if i used a edit material properties lop to expose this parameter downstream or in a different project file,
the parameter is there with the right defined value, but the ranges are 0-10 instead. How do I get this range to flow through properly?
Thank you!
ive created a paramter node within mtlx using python:
dispoutlow= matsubnet.createNode("parameter", mysel.name() + "_dispoutlow")
dispoutlow.parm("parmname").set("dispoutlow")
dispoutlow.parm("parmlabel").set("dispoutlow")
dispoutlow.parm("floatdef").set(-0.5)
dispoutlow.parm("rangeflt1").set(-1)
dispoutlow.parm("rangeflt2").set(.5)
this is the range I see on the parameter when i look at the python result.
However, if i used a edit material properties lop to expose this parameter downstream or in a different project file,
the parameter is there with the right defined value, but the ranges are 0-10 instead. How do I get this range to flow through properly?
Thank you!