Jump to content

Help with breaking down an HScript expression


prekabreki

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by ikoon
  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...