Python callback script from button parameter not executing in UE4

   231   2   1
User Avatar
Member
2 posts
Joined: April 2019
Offline
Hello,

In our digital asset which we export to UE4, I wanted to add a button that runs some python code.
After discovering that it doesn't work, I tried to move a box using Python for testing, but couldn't get it to work.

I tried the following:
The button has
hou.phm().MovePython()
as its callback script.

This function is defined in a PythonModule in the Scripts tab of the Asset properties as
def MovePython():
    print "Move called"
    exec(hou.node('/obj/geo1/python1').parm('python').eval())
    MoveBox()
and refers to a python node with the following code:
def MoveBox():
    objPath = "/obj/geo1/box1/tx"
    parm = hou.parm(objPath)
    origVal = parm.eval()
    parm.set(origVal + 0.1)

I also tried a more direct approach by defining the following function in the same PythonModule:
def MoveGraph():
    print "MoveGraph called"
    objPath = "/obj/geo1/box1/tx"
    parm = hou.parm(objPath)
    origVal = parm.eval()
    parm.set(origVal + 0.1)
which we call in a similar way using a button.

When pressing either of the buttons in the Houdini Editor, the box moves as expected, however, when doing the same in the Unreal Editor, the box does not move.

Is there a solution to this problem, or is this a limitation of the way Houdini interacts with Unreal Engine?


Thanks in advance!
User Avatar
Staff
367 posts
Joined: Sept. 2016
Offline
Hi,
I haven't tried to reproduce your issue yet, but have you tried marking your Python SOP as editable in the HDA?
User Avatar
Member
2 posts
Joined: April 2019
Offline
Hi,

I had already set both ‘python1’ and ‘box1’ as editable nodes in the Node tab of the Asset Properties.
However, should this be visible within the engine, since it is not? Maybe I am missing something when exposing these parameters.
  • Quick Links