# Dialog script for ayon::lop_import::1.0 automatically generated

{
    name	ayon::lop_import::1.0
    script	load_asset::1.0
    label	"AYON Load Asset"

    help {
	""
    }

    inputlabel	1	"Input Stage"
    inputlabel	2	"Input 2"
    inputlabel	3	"Input 3"
    inputlabel	4	"Input 4"

    groupsimple {
        name    "info2"
        label   "Info"
        parmtag { "script_callback" "hou.phm().refresh_available_versions(kwargs['node'])" }
        parmtag { "script_callback_language" "python" }

        parm {
            name    "assetinfo_labelparm"
            label   "Heading"
            type    label
            default { "Choose Product" }
            parmtag { "sidefx::look" "heading" }
        }
        parm {
            name    "project_name"
            label   "Project"
            type    string
            default { "$AYON_PROJECT_NAME" }
            parmtag { "script_action" "from ayon_houdini.api.hda_utils import select_folder_path;select_folder_path(kwargs['node'])" }
            parmtag { "script_action_icon" "BUTTONS_reselect" }
            parmtag { "script_callback" "hou.phm().on_representation_parms_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "folder_path"
            label   "Folder Path"
            type    string
            default { "$AYON_FOLDER_PATH" }
            parmtag { "script_action" "from ayon_houdini.api.hda_utils import select_folder_path;select_folder_path(kwargs['node'])" }
            parmtag { "script_action_icon" "BUTTONS_reselect" }
            parmtag { "script_callback" "hou.phm().on_representation_parms_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "folder_name"
            label   "Folder Name"
            type    label
            default { "`strsplit(chs(\"folder_path\"), \"/\", -1)`" }
        }
        parm {
            name    "product_name"
            label   "Product"
            type    string
            default { "usdAsset" }
            parmtag { "script_action" "from ayon_houdini.api.hda_utils import select_product_name;select_product_name(kwargs['node'])" }
            parmtag { "script_action_icon" "BUTTONS_reselect" }
            parmtag { "script_callback" "hou.phm().set_to_latest_version(kwargs['node'])\nhou.phm().on_representation_parms_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "version"
            label   "Version"
            type    string
            default { "" }
            disablewhen "{ representation_old == \"\" }"
            menureplace {
                [ "versions = hou.phm().get_available_versions(kwargs['node'])" ]
                [ "" ]
                [ "result = []" ]
                [ "for version in versions:" ]
                [ "    result.append(str(version))" ]
                [ "    result.append(f\"v{version:03d}\")" ]
                [ "    " ]
                [ "return result" ]
                language python
            }
            parmtag { "script_callback" "hou.phm().on_representation_parms_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "representation_name"
            label   "Representation"
            type    string
            default { "usd" }
            parmtag { "script_callback" "hou.phm().on_representation_parms_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "load_refresh"
            label   "Refresh"
            type    button
            joinnext
            default { "0" }
            help    "Click to refresh and retry applying the product load parameters to load the correct file"
            parmtag { "button_icon" "" }
            parmtag { "script_callback" "hou.phm().on_representation_parms_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "load_message"
            label   "Message"
            type    label
            default { "" }
            hidewhen "{ load_message == \"\" }"
            parmtag { "sidefx::look" "block" }
        }
        parm {
            name    "sepparm"
            label   "Separator"
            type    separator
            default { "" }
        }
        parm {
            name    "reload"
            label   "Reload Files"
            type    button
            default { "0" }
            parmtag { "autoscope" "0000000000000000" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "file"
            label   "File"
            type    string
            default { "" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "primpath1"
            label   "Primitive Root"
            type    string
            joinnext
            default { "`chs(\"folder_path\")`/$OS" }
            menureplace {
                [ "opmenu -l -a reference_character primpath1" ]
            }
            parmtag { "autoscope" "0000000000000000" }
            parmtag { "script_action" "import loputils\nloputils.selectPrimsInParm(kwargs, False)" }
            parmtag { "script_action_help" "Select a primitive in the Scene Viewer or Scene Graph Tree pane.\nCtrl-click to select using the primitive picker dialog.\nAlt-click to toggle movement of the display flag." }
            parmtag { "script_action_icon" "BUTTONS_reselect" }
            parmtag { "sidefx::usdpathtype" "prim" }
        }
        parm {
            name    "primpath_presets"
            label   "Presets"
            type    button
            nolabel
            default { "0" }
            menu {
                "`chs(\"folder_name\")`"        "Folder Name\n    (Use for \"Asset Build\" workflow)"
                "`chs(\"folder_path\")`/$OS"    "Folder Path with Node Name\n    (Use for \"Shot\" or \"Scene Assembly\" workflow)"
            }
            parmtag { "script_callback" "parm = kwargs[\"node\"].parm(\"primpath1\"); parm.revertToDefaults(); parm.set(kwargs[\"script_value0\"])" }
            parmtag { "script_callback_language" "python" }
        }
        groupcollapsible {
            name    "extra_options"
            label   "Load Options"

            parm {
                name    "reftype1"
                label   "Reference Type"
                type    string
                default { "file" }
                menu {
                    "file"      "Reference File"
                    "payload"   "Payload File"
                }
                parmtag { "autoscope" "0000000000000000" }
                parmtag { "script_callback_language" "python" }
            }
            parm {
                name    "instanceable1"
                label   "Make Instanceable"
                type    toggle
                default { "off" }
                parmtag { "autoscope" "0000000000000000" }
                parmtag { "script_callback_language" "python" }
            }
            parm {
                name    "filerefprim1"
                label   "Reference Primitive"
                type    string
                default { "automaticPrim" }
                hidewhen "{ reftype1 == prim } { reftype1 == inherit } { reftype1 == specialize }"
                menu {
                    "automaticPrim" "Reference Automatically Chosen Primitive"
                    "defaultPrim"   "Reference Default Primitive"
                    ""              "Reference Specific Primitive"
                }
                parmtag { "autoscope" "0000000000000000" }
                parmtag { "script_callback_language" "python" }
            }
            parm {
                name    "filerefprimpath1"
                label   "Reference Primitive Path"
                type    string
                default { "" }
                disablewhen "{ filerefprim1 != \"\" reftype1 != prim reftype1 != inherit reftype1 != specialize }"
                parmtag { "autoscope" "0000000000000000" }
                parmtag { "script_action" "import loputils\nnode = kwargs['node']\nparm = kwargs['parmtuple'][0]\nreftype = node.evalParm(parm.name().replace(\n    'filerefprimpath', 'reftype'))\nif reftype in ('prim', 'inherit', 'specialize'):\n    prims = loputils.selectPrimsInParm(kwargs, True)\nelse:\n    parm = node.parm(parm.name().replace(\n       'filerefprimpath', 'filepath'))\n    prims = loputils.selectPrimsInParmFromFile(kwargs, False,\n        parm.evalAsString().strip('\\'\"'))" }
                parmtag { "script_action_help" "Select a primitive from a primitive picker dialog." }
                parmtag { "script_action_icon" "BUTTONS_reselect" }
                parmtag { "sidefx::usdpathinput" "if(index(\"prim inherit specialize\", chs(\"reftype#\")) >= 0, 0, -1)" }
                parmtag { "sidefx::usdpathtype" "prim" }
            }
            parm {
                name    "timeoffset1"
                label   "Time Offset (in Frames)"
                type    float
                default { "0" }
                range   { -100 100 }
                parmtag { "autoscope" "0000000000000000" }
                parmtag { "script_callback_language" "python" }
            }
            parm {
                name    "timescale1"
                label   "Time Scale"
                type    float
                default { "1" }
                range   { 0 5 }
                parmtag { "autoscope" "0000000000000000" }
                parmtag { "script_callback_language" "python" }
            }
        }

    }

    groupcollapsible {
        name    "info_display2"
        label   "Info Display"

        parm {
            name    "show_thumbnail"
            label   "Show Entity Thumbnail"
            type    toggle
            joinnext
            default { "0" }
            parmtag { "script_callback" "hou.phm().on_thumbnail_show_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "thumbnail_size"
            label   "Size"
            type    float
            joinnext
            default { "2" }
            hidewhen "{ show_thumbnail == 0 }"
            range   { 0 10 }
            parmtag { "script_callback" "hou.phm().on_thumbnail_size_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "thumbnail_cache_dir"
            label   "Thumbnail Cache Dir"
            type    directory
            invisible
            default { "$JOB/.houdini_loader_thumbnails" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "thumbnail_padding"
            label   "Padding"
            type    float
            invisible
            default { "1" }
            range   { 0 10 }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "thumbnail_offset"
            label   "Offset"
            type    vector2
            size    2
            default { "0" "0.35" }
            hidewhen "{ show_thumbnail == 0 }"
            range   { -1 1 }
            parmtag { "script_callback" "hou.phm().on_thumbnail_size_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "show_pipeline_parms"
            label   "Show Pipeline Parms"
            type    toggle
            default { "0" }
            parmtag { "script_callback" "hou.phm().on_thumbnail_show_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
    }

    group {
        name    "ayon_folder0"
        label   "Ayon"
        hidewhen "{ show_pipeline_parms == 0 }"

        parm {
            name    "name"
            label   "Name"
            type    label
            default { "$OS" }
        }
        parm {
            name    "namespace"
            label   "Namespace"
            type    label
            default { "`opfullpath(\".\")`" }
        }
        parm {
            name    "loader"
            label   "Loader"
            type    label
            default { "LOPLoadAssetLoader" }
        }
        parm {
            name    "id"
            label   "ID"
            type    label
            default { "pyblish.avalon.container" }
        }
        parm {
            name    "representation"
            label   "Representation ID"
            type    string
            default { "" }
            parmtag { "script_callback" "hou.phm().on_representation_id_changed(kwargs['node'])" }
            parmtag { "script_callback_language" "python" }
        }
        parm {
            name    "version_name"
            label   "Current Version Label"
            type    label
            invisible
            default { "" }
        }
        parm {
            name    "subset_name"
            label   "Subset (backwards compatibility)"
            type    label
            invisible
            default { "`chs(\"product_name\")`" }
        }
    }

}
