APEX Script: how to debug?

   3690   14   3
User Avatar
Member
373 posts
Joined: 6月 2023
オフライン
Well I think APEX Script is cool, but it doesn't seem to be easier to debug than manipulating a graph with Python...

How do you even print a debug message?

https://www.sidefx.com/docs/houdini/character/kinefx/apexscriptfunctions.html#specialfunctions [www.sidefx.com]

...is the only way creating a sticky note...?
Edited by kodra - 2024年7月13日 04:46:07
User Avatar
スタッフ
45 posts
Joined: 3月 2020
オフライン
Hey Kodra,

In H20.5 there isn't a good way to print debug messages from an APEX graph (or from APEX Script) but we're aware of this gap and we're working on a Logcallback for APEX that could be used to log messages, warnings, and errors as well as throw custom error messages to our nodes which invoke APEX graphs.

Once the design of it is finalized, we'll add printing support to APEX Script.
User Avatar
スタッフ
73 posts
Joined: 5月 2019
オフライン
Hi there, yes we are unfortunately currently missing print and error callbacks in APEX. In the meantime, I find the best way to debug is to format debug log statements as strings using the string::Format callback and associated string formatting syntax in APEX Script, and then wire the debug strings to the output of the graph, or collect the list of all debug prints in a StringArray and wire that to the output of the graph. I also find the "Inspect Line" feature quite useful for finding where in a graph a particular line corresponds to, so that I can directly inspect the graph to find issues there.
User Avatar
Member
151 posts
Joined: 6月 2019
オフライン
in the meantime this stupid trick can work:


I've attached the hip as well. the only thing is connect the output, even void one
not sure how log callback would be different, but this workflow is a bit painful

I personally think apex engine would benefit from any sort of conventional tagging, like if I'm tagging node (function, subnet, whatever) as traceable it just dump it's inputs and outputs. this alone actually would cover a lot of debugging

Attachments:
apex-printf.png (121.8 KB)
apex-debug.hiplc (101.8 KB)

User Avatar
Member
24 posts
Joined: 8月 2017
オフライン
Is there a way to do something like this but get the debug information while in the animation state? I want to debug my rig graph values while animating my character.
User Avatar
Member
696 posts
Joined: 8月 2019
オフライン
cwrenniks
Is there a way to do something like this but get the debug information while in the animation state? I want to debug my rig graph values while animating my character.

The above RunVex trick should work in animation state as well.

But man it's such a hack and extremely painful to debug this way.
User Avatar
Member
24 posts
Joined: 8月 2017
オフライン
I'm not seeing how to get the data in real time, while moving a rig. As an example, imagine outputing the translation vector while manipulating a joint. Is there a way I'm missing to do this? I'm starting to go down a path to figure out how to just log the information to a file, but that is also a pain.
User Avatar
Member
25 posts
Joined: 3月 2015
オンライン
I can confirm that this definitely works. Thanks a lot elovikov
User Avatar
Member
4 posts
Joined: 12月 2024
オフライン
kodra
APEX Script: how to debug?    1225   7   2SUBSCRIBE   REPLY


kodra
Member

373 posts
Joined: June 2023
Offline
 July 13, 2024 4:45 A.M.
Well I think APEX Script is cool, but it doesn't seem to be easier to debug than manipulating a graph with Python...

How do you even print a debug message?

https://www.sidefx.com/docs/houdini/character/kinefx/apexscriptfunctions.html#specialfunctions [www.sidefx.com]

...is the only way creating a sticky note...?

To debug APEX Script, you can use the print() function to output messages in the Houdini console. For more advanced debugging, set breakpoints or use Houdini’s debugger. Sticky notes aren’t necessary for debugging.
User Avatar
Member
25 posts
Joined: 3月 2015
オンライン
There is a Apex-Log-Node (myLogNode = graph.addNode('myLog','Log',formatstring='{}') <- syntax)you can use, which (I find) easier to handle and work with. You will have to activate "APEX" in the log-viewer to see it's output. This also logs in animation-state.
Edited by Fraenk - 2025年1月4日 17:29:38
User Avatar
Member
7 posts
Joined: 6月 2024
オフライン
elovikov
in the meantime this stupid trick can work:
Image Not Found


I've attached the hip as well. the only thing is connect the output, even void one
not sure how log callback would be different, but this workflow is a bit painful

I personally think apex engine would benefit from any sort of conventional tagging, like if I'm tagging node (function, subnet, whatever) as traceable it just dump it's inputs and outputs. this alone actually would cover a lot of debugging


I’m facing an issue with debugging in Apex Script when using the Apex Autorig Component. Here’s the scenario:

I’m using the Use Second Input option in the Apex Autorig Component and connecting an Apex Script to the second input.

However, this approach doesn’t seem to work properly, especially with functions inside the Apex Script.

Specifically, I’ve created a function that I plan to add to the network using addSubnet. The issues I’m encountering are:

The Log inside the function does not work.

I intended for the function to return debug_msg and set it as a detail attribute in base.skel. Unfortunately, this doesn’t work either, and the message can’t be saved.

Does anyone have a good method for debugging the function code inside the Apex Autorig Component? Any tips would be highly appreciated.

Additional Notes:

I’ve attached the .hip file for reference.

Even when connecting a void output, the issue persists.

I’m also wondering if there’s a way to tag nodes (such as functions or subnets) as traceable to automatically dump their inputs and outputs for easier debugging. This could really help streamline the debugging process.

Looking forward to your suggestions!
User Avatar
Member
8108 posts
Joined: 7月 2005
オフライン
No hip file attachment?
User Avatar
Member
7 posts
Joined: 6月 2024
オフライン
edward
No hip file attachment?

https://drive.google.com/file/d/1VaDJB6SGQASa4KIdhbenE3u7K9raADfv/view?usp=sharing [drive.google.com]

Debug method 1 didn't work. I found a solution for debug method 2, and it works, but the feature for automatically moving the index finger control doesn't seem to work
User Avatar
Member
8108 posts
Joined: 7月 2005
オフライン
The problem is that a Log node by itself won't be executed if none of its outputs are evaluated. So you need to combine the debug methods where the Log node is also part of the evaluation path.
So I modified your method 1 to this and it seems to work:
#debug method 1
log_node = graph.addNode("mylog","Log")
log_node.setParms({ "formatstring":"[Debug]{1}" })
log_node.setParms({ "severity":0 })
autoNode.target_out.connect(log_node.args0_in)
autoNode.debug_out.connect(log_node.args_in)
log_node.args0_out.connect(index_l.t_in)
User Avatar
Member
7 posts
Joined: 6月 2024
オフライン
edward
#debug method 1
log_node = graph.addNode("mylog","Log")
log_node.setParms({ "formatstring":"{1}" })
log_node.setParms({ "severity":0 })
autoNode.target_out.connect(log_node.args0_in)
autoNode.debug_out.connect(log_node.args_in)
log_node.args0_out.connect(index_l.t_in)



edward, Thank you very much for your response. However, I tried it and it seems that the Log method still doesn't work. Although I can see the messages in the LogViewer, they don't seem to match the ones I want to print. Please take a look at the debug string returned by the compute function, as it is actually different.


def compute(v1:vector3, target:vector3, threshold:float=0.1, blend:float=1.0):
indexl=target

debug = f"threshold value: {threshold}, blend used: {blend}"
return target,debug

Attachments:
screnshot.jpg (80.6 KB)

  • Quick Links