示例#1
0
def get_parms_commandline(node: hou.Node) -> list[str]:
    parms_multiparm: hou.Parm = node.parm("params")

    start_index = parms_multiparm.multiParmStartOffset()
    num_parms = parms_multiparm.evalAsInt()

    value_command = []

    for i in range(start_index, start_index + num_parms):
        parm_type = node.parm(f"graph_parm_type{i}").evalAsString()
        parm_name = node.parm(f"graph_parm_name{i}").evalAsString()
        parm_value_name = value_map[parm_type].format(i)
        use_color = node.parm(f"use_color_editor{i}").evalAsInt()

        if parm_type == "FLOAT3" and use_color:
            parm_value_name = f"rgb_value{i}"

        if parm_type == "FLOAT4" and use_color:
            parm_value_name = f"rgba_value{i}"

        value_parm: hou.ParmTuple = node.parmTuple(parm_value_name)

        value = value_parm.eval()
        value_command += [
            "--set-value", f"{parm_name}@{','.join((str(v) for v in value))}"
        ]

    return value_command
示例#2
0
def get_time_commandline(node: hou.Node):
    time_type = node.parm("time_type").evalAsString()

    time = 0.0
    (frame_start, frame_end, _) = node.parmTuple("f").eval()
    frame = hou.frame()

    if time_type == "range":
        time = (frame - frame_start) / (frame_end - frame_start)
    elif time_type == "range_loop":
        time = (frame - frame_start) / (frame_end - frame_start + 1.0)
    elif time_type == "custom":
        time = node.evalParm("time")

    return ["--set-value", f"$time@{time}"]