Per Mestela.
exec(kwargs['node'].parm('Code').eval())
Showing posts with label python. Show all posts
Showing posts with label python. Show all posts
Tuesday, March 29, 2022
Wednesday, October 21, 2020
Building OpenImageIO on Windows
After messing around trying to build OpenImageIO on Windows I found this on Reddit. REDDIT!? That's what the world has come to.
Compiling OpenImageIO for Windows Yeah, use Vcpkg.
It automatically sorts out the dependencies for you and integrates the new library into Visual Studio's environment variables, so they're suddenly just as easy to use as the ol' STL.
If the library you want is in the list of maintained ports for Vcpkg, compiling it correctly is just a matter of entering this in a command prompt:
vcpkg install openimageio:x64-windows vcpkg integrate install
This will work for OpenEXR, OpenVDB, Alembic and a wide range of other essential libraries. You can even update the whole catalog with one command. It's life-changing.
https://www.reddit.com/r/vfx/comments/9jev6b/compiling_openimageio_for_windows/
Compiling OpenImageIO for Windows Yeah, use Vcpkg.
It automatically sorts out the dependencies for you and integrates the new library into Visual Studio's environment variables, so they're suddenly just as easy to use as the ol' STL.
If the library you want is in the list of maintained ports for Vcpkg, compiling it correctly is just a matter of entering this in a command prompt:
vcpkg install openimageio:x64-windows vcpkg integrate install
This will work for OpenEXR, OpenVDB, Alembic and a wide range of other essential libraries. You can even update the whole catalog with one command. It's life-changing.
https://www.reddit.com/r/vfx/comments/9jev6b/compiling_openimageio_for_windows/
Friday, December 14, 2018
Nuke: Cant believe I forgot this... First frame last frame
nuke.knob('root.first_frame') nuke.knob('root.last_frame')yup. I know. Oh and it returns a string btw. I have NO idea why. Like really. Why..?
Sunday, April 15, 2018
Houville :: Get selections from Scene Views
This is one of those obvious needs that ends up being a frustrating "how do you even..?"
In Houdini 16.5 and up it's pretty simple:
However in 16.0 it's a bit more fiddly as currentGeometrySelection doesnt exist. hicon:/SVGIcons.index?book.svg
As is this in the docs: http://www.sidefx.com/docs/houdini/hom/tool_script.html
In Houdini 16.5 and up it's pretty simple:
import toolutils sv = toolutils.sceneView() str(hou.SceneViewer.currentGeometrySelection(sv))
However in 16.0 it's a bit more fiddly as currentGeometrySelection doesnt exist. hicon:/SVGIcons.index?book.svg
import toolutils selection = toolutils.sceneViewer().selectGeometry() ## this annoyingly unselects your selection print selection ## lets also get this in the clipboard so we can past it in a node.Here's a good reference: https://www.sidefx.com/forum/topic/30353/
As is this in the docs: http://www.sidefx.com/docs/houdini/hom/tool_script.html
Labels:
get selections
,
houdini
,
houville
,
python
Friday, June 2, 2017
NukeStudio :: Return the source path for a selected clip
from hiero.core import TrackItem seq = hiero.ui.activeSequence() te = hiero.ui.getTimelineEditor(seq) t =te.selection()[-1] print t.source().mediaSource().fileinfos()[0].filename()
Saturday, March 25, 2017
Python: copy paste buffer
Seems like PyQt4 is the ideal way to go:
Two styles:
In some cases PyQt4 seems to be crippled, so you can also use Tkinter, which seems to work well for extracting from clipboard. Haven't had luck putting stuff in though:
Two styles:
##how to get something into the clipboard / copy/paste buffer from PyQt4 import QtGui QtGui.QApplication.clipboard().setText(textString) ##and to get it back out text = QtGui.QApplication.clipboard().text() ##but it will be a QString so you'll probably want to textString = str(text)
In some cases PyQt4 seems to be crippled, so you can also use Tkinter, which seems to work well for extracting from clipboard. Haven't had luck putting stuff in though:
import Tkinter root = Tkinter.Tk() root.withdraw() # Hide the main window (optional) rawClip = root.clipboard_get()
Sunday, February 19, 2017
Houville :: copying nodes from one part of network to another
Yup, this might come in handy too:
hou.copyNodesTo(hou.node('/obj/mySubnet').glob('*'),hou.node('/obj'))
Houville :: adding params to a obj
Another one I keep forgetting...
Here's how to add params to a node in houdini.
And when you want to delete some parms, remember to get rid of the tuple. You can access that easily like this:
And finally, if you don't want to add params one by one you can make a Parameter Template Group to then add as a lump later.
Not quite sure yet why this is better, but I'll probably find out one day.
n = hou.node('/obj/geo1') n.addSpareParmTuple(hou.IntParmTemplate('intParm','',1, default_value=(10,),min = 0, max = 20)) n.addSpareParmTuple(hou.FloatParmTemplate('floatParm','',1, default_value=(10,),min = 0, max = 20)) #define some multi line code. Like a python script code = """print 'some stuff' print 'more stuffs' print 'an\\\\' ting'""" # is hidden is good for hiding code away n.addSpareParmTuple(hou.StringParmTemplate('stringParm','',1,default_value=(code,), is_hidden=0)) n.addSpareParmTuple(hou.ButtonParmTemplate('Button','', join_with_next=0, script_callback='exec(hou.parm("stringParm").evalAsString())', script_callback_language=hou.scriptLanguage.Python))
And when you want to delete some parms, remember to get rid of the tuple. You can access that easily like this:
n.removeSpareParmTuple(n.parm('stringParm').tuple())
And finally, if you don't want to add params one by one you can make a Parameter Template Group to then add as a lump later.
ptg = n.parmTemplateGroup() ptg.append(hou.IntParmTemplate('intParm','',1, default_value=(10,),min = 0, max = 20)) n.setParmTemplateGroup(ptg)
Not quite sure yet why this is better, but I'll probably find out one day.
Subscribe to:
Posts
(
Atom
)