prekabreki Posted September 14, 2017 Share Posted September 14, 2017 I'm just slowly getting into Hscript expressions, especially for outputting files. I got my hand on a scene file that has a very customised way of outputting files and I was wondering if anyone could help me break it down. I obviously know the ones like $HIP and $OS but I'm having trouble making sense of the rest of it. $HIP/cache/$OS/v`padzero(2, ch("ver"))`/path_`ch("../PATH/path")`/cluster_`ch("../CLUSTER/cluster")`/`$OS`_p`ch("../PATH/path")`_c`ch("../CLUSTER/cluster")`_v`padzero(2, ch("ver"))`.$F4.bgeo.sc Quote Link to comment Share on other sites More sharing options...
f1480187 Posted September 14, 2017 Share Posted September 14, 2017 It's very simple, just a bunch of parameter references, mostly. Something close to "project_path/cache/some_node1/v01/path_42/cluster_666/some_node1_p42_c666_v01.0001.bgeo.sc". You can evaluate string by pressing MMB on the parameter's label. If the result is still too complex to understand, create new string parameter via Edit Parameter Interface, then copy different parts of this expression (e.g `padzero(2, ch("ver"))`), and evaluate them one-by-one until it's clear what it is doing. Quote Link to comment Share on other sites More sharing options...
ikoon Posted September 14, 2017 Share Posted September 14, 2017 (edited) I would press Ctrl-E on the expression (opens editor) and separate it to multiple lines. My example, different, but may help you: This expression is to generate the folder and filename (Output Image) e.g.$HIP/render/magnetic_camL/magnetic_camL_$F4.png The brackets are inside of backticks `{ lines of code }` because you want this to be evaluated as a string. If you want number, it would be just { lines of code } EDIT: Notice the lines with output += ... this could help you separate your line and test / debug it `{ string take = chsop("take"); string camera = chsop("camera"); float first = index(take, "_"); float start = 0; float length = first; string takeName = substr(take, start, length); string camName = substr(camera, 5, 5); string takeName += "_" + camName; string output = "$HIP/render/"; string output += takeName + "/" + takeName; string output += "_$F4.png"; return output; }` Edited September 14, 2017 by ikoon 1 Quote Link to comment Share on other sites More sharing options...
prekabreki Posted September 14, 2017 Author Share Posted September 14, 2017 4 hours ago, f1480187 said: It's very simple, just a bunch of parameter references, mostly. Something close to "project_path/cache/some_node1/v01/path_42/cluster_666/some_node1_p42_c666_v01.0001.bgeo.sc". You can evaluate string by pressing MMB on the parameter's label. If the result is still too complex to understand, create new string parameter via Edit Parameter Interface, then copy different parts of this expression (e.g `padzero(2, ch("ver"))`), and evaluate them one-by-one until it's clear what it is doing. Thanks, that actually helps a lot to break it down like that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.