Search the Community
Showing results for tags 'callback'.
-
I have an HDA with a parameter that allows users to return a selection from the viewport (same type of parameter used on blast nodes etc.). I have a callback script that I want to run whenever the artist makes a selection, however, the script only seems to execute when the string portion of the parameter is edited. For example if I manually type the name of an object into the parameter the callback script executes as expected, but if I use the arrow button to select the objects in the viewport and hit enter to confirm my selection the callback script is not executed. This obviously isn't very useful or intuitive for artists. Does anyone have any workarounds or suggestions on how to get this functioning the way one would expect it to?
-
Hi. I am trying to implement a function that will set "on parameter" to false, and set "opacity parameter" to 0 on a Octane light node, when it's display flag is turned off. I would like to implement it in "pythonrc.py" or another similar structure, to keep it global, instead of implementing it into the light asset, but what event function can I use to get calls whenever display flags are changed?
-
I been coding the callback event in a HDA with Python, the goal is to call every time the node is cooked(after the cook); But it seem not such event type in hou.nodeEventType and hou.hdaEventType. I was write the hou.Node.addEventCallback() in OnCreate event handler section to setup different event type callback. Is there any way to write a callback in HDA for something like "OnCook" event?
-
Hi Houdini People ! i have a question : I have a Multiparm who's updating number by Python Script (Basically : It get the input value of an attribute ) Once my Multiparm is set to the right number , i want to add some scipting on the hda. The problem is, if i update manually the number of multiparm instance, the callback is called ? But with my python script nothing happend. Any idear ? to be clear in the step i used : Plug a node with an attribute in my HDA ( the node is a connectivity who give me attribute pieces "name" ) On my HDA, the multiparm number is updated with python (it give me 3 different attribute pieces ( Pieces_0 , Pieces_1, Pieces_2) Now i call a function with callback on the multiparm to updates dymanically values nothing happend if i create a new multiparm with no Python on the number of instances i plug a node i update the values to 3 the callback is working fine any idears ?
-
Hey Guys, Still quite new to Python, hoping someone can help point me in the right direction on this that I've been grappling with for a while now. I have a simple filecache .hda that I'd like to change color if it can/can't find the cache on disk. I've been able to use hou.ui.addEventLoopCallback() to continuously track and check the file parameter to see if the cache exists, and the color changing now works as expected. Where I'm having trouble is removing the event loop when the .hda is deleted from the node graph. An error pops up because Houdini is still trying to access the deleted node. I've been trying to look for a way to use the OnDeleted event handler, or hou.nodeEventType.BeingDeleted, but no luck yet and I feel out of my depth with my limited python experience. The .hda is attached, and there's a preview of the code below. Any help would be appreciated! custom_filecache.hda ####PythonModule#### import os import hou def nodeColor(kwargs): node = kwargs["node"] def colorCallback(): filepath = node.evalParm("file") if(os.path.exists(filepath)): node.setColor(hou.Color((0.0, 0.8, 0.0))) node.setComment(filepath) node.setGenericFlag(hou.nodeFlag.DisplayComment,True) else: node.setColor(hou.Color((0.8, 0.0, 0.0))) node.setComment("File not found") node.setGenericFlag(hou.nodeFlag.DisplayComment,True) startCallback(colorCallback) #adding this code below crashes Houdini when hda is deleted #node.addEventCallback([hou.nodeEventType.BeingDeleted], endCallback(colorCallback)) def startCallback(callback): hou.ui.addEventLoopCallback(callback) def endCallback(callback): hou.ui.removeEventLoopCallback(callback) ####OnCreated#### kwargs["node"].hdaModule().nodeColor(kwargs)
-
Hey guys I have an HDA with 2 python SOPs inside. I need a button on the HDA that would trigger a function in one of the python SOPs. I looked at how callback scripts work but it was too confusing. Appreciate it if someone could help me out. Thanks! Cheers defc0n1
-
A python newbie here... I'm working on a small script to make a certain workflow of swapping operator paths for filters a bit less clunky in the context of rendering (with Renderman in this case). The idea: 1. Click a button (New Filter) to create a new filter node in the shop context - I got this working. 2. That will add a multiparm toggle+operator path. Set the operator path to the newly created filter. - Also done and working. 3. Use toggles to set (and swap) Display Filter operator path parm on the ROP node (ris1) - Far from working I suspect this will have to do with ParmTupleChanged events? and here things become very fuzzy... how do I match the toggle to the operator path to evaluate the correct parm (Filter 1/2/3...)? From a tupple? I guess I need to def a function for that. But how do I prevent more tan 1 toggle be on at a time... I'm totally stuck. I hope that makes sence and if anyone could point me in the right direction, that'd be awesome!
-
Hi. I tried that way but got an error. error - 'NoneType' object has no attribute 'hdaModule" I created a new edit in the shelf tool and entered in, but it doesn't run. Why is that? (I want to load dop io preset. I want to change the preset when I click the shelf tool.) Thank you.
-
Hey, So I frequently make otls where I change what is being displayed based on what folder the user is looking at. I object merge different sections of the otl into a switch that has an output sop set to the 0th output underneath (since the display flag on the otl always shows the 0th output). A callback on the folder parm sets the input parameter of the switch, so as you change folders to edit different parameters, what is being displayed is changed. Then I use a second output sop to be the proper output of the otl, the finished product. I would love to be able to do this with only one output for my otl though. I think it would be nice to have an option on the output sop that doesn't just say ‘this node is output 0, this one is output 1’. It would be really handy if you could setup one output node that is the otls ‘display’ output, and a second that is the otls ‘output’ output if you will. I'm wondering if there is already a way to do this that I don't know about perhaps? Thanks! James C
-
- callback
- display flag
-
(and 5 more)
Tagged with:
-
There are various event handlers you can use with HDA's (like onCreated, onInputChanged etc.) but I can't seem to find one that can be used as a callback for when the output connection of the HDA changes.. Basically i'm trying to create a custom version of the gas disturbance, part of which has the option to visualise the block size of the disturbance (just with coloured points on a grid). So I was thinking I would use an event handler on the HDA to know when it was connected and then in python traverse down the children to find the solver then traverse back up to find the smoke object so I can get the size and center to position the grid correctly. Is this possible? Is this a stupid idea?
-
Heya peoples, I'm going round in circles on this one and it might just be down to my poor understanding of python and/or houdini. I've managed to get 90% of what I want for this tool complete but the final piece evades me. I've got a python tempfile.TemporaryFile being created when 456.py is triggered - it works perfectly - i.e. created upon opening a hip and deleted once the hip is closed I think what I want to do is trigger the 456.py from within a shelf tool (which is a custom saver script) I mean this is essentially the age-old quest for an "onSave" callback but sadly I have no understanding of C++ or the HDK so this solution is totally lost on me. Any pointers appreciated Cheers
-
Hi guys. I want to create an asset for copystamping which will allow to connect or disconnect SOP inputs. Would be nice if asset allow to use different input numbers of instance at a time (connect/disconnect necessary objects) and switch between instances. I can manually create a CopyStamping asset if I have a static number of inputs and if I know a number of input objects which switch operator will use (basic copystamping technic). I've dug out some info and looks like it's best way to create the asset with a callback scripts. But I'm not familiar with callback scripts and python enough. May be some body can help me with that or have a links for similar solution. Thank you.
-
I know basic python scripting in houdini so this question is easy one. I have a shelf tool, when clicked runs a python code. I want that tool to ask for a number when clicked and use it in the script. basically, I want to select a node and click that shelf tool to ask for a number, when given that code should copy and paste (duplicate) that node the number of times which is entered. i know i will have to use copyNodeTo function in python, just want to know about getting user input. Thanks!
-
Please forgive the x-post from the sideFX forums, maybe the ODForce scripting gurus can help me out - Im having trouble using python in an HDA that I'm sending over to Maya. I've attached a simple example HDA to set parameters using a callback script (button). Works like a charm in Houdini, but on the Maya side I need to hit my 'Execute' button, reset simulation, reload asset, sync asset until eventually the field updates to the correct value. Sometimes it works, other times it bugs out, and other times still it seems like it works but has a refresh issue. Any thoughts? Maya 2014 Houdini Engine 14.0.430 Callback Script: hou.pwd().hdaModule().setInitFrame() Script: import hou def setInitFrame(): me = hou.pwd() me.setParms({"initFrame": 736}) mrhoneSetparmExample.hda
-
- houdini engine
- Maya
-
(and 3 more)
Tagged with:
-
I want to have possibility to list point or primitive attributes in my menu according to type user will pick. Lets say that my operator default state for attribute type is Point attrbute which I got covered by PRM_Template(PRM_STRING, 1, &attributeParm_Name, PRMzeroDefaults, &SOP_Mantragora::pointAttribMenu); and user switched type to Primitive. Should I update the menu with PRM_Template::setChoiceListPtr(&SOP_Mantragora::primAttribMenu) ? If so, where I should do this? Putting it in cook() method didn't worked. EDIT: The same case is for groups. There is SOP_Mantragora::groupMenu But it lists all group types at once. And I want to have listed only those specified by user and switch between SOP_Mantragora::pointGroupMenu and SOP_Mantragora::primGroupMenu Thanks