File picker parameter is not allowing to pick directories, only files

   1988   3   0
User Avatar
Member
18 posts
Joined: June 2016
Offline
Hello guys,

I'm having a problem to get a StringParmTemplate working.
I would like to create a parameter where the user is able to pick a textures path for further processing.

That is what I have:
parms.addParmTemplate(hou.StringParmTemplate('texpath', 'Texture Path', 1, "", string_type=hou.stringParmType.FileReference, file_type=hou.fileType.Directory))

But unfortunately it not letting me pick a folder and asking for a file instead.
I searched the forum, looked up the documentation and googled with no luck.

Hope someone of you can help me with this issue!

Cheers,
Jakob
Edited by Innehavaren - Oct. 18, 2017 09:08:50
User Avatar
Member
323 posts
Joined: Jan. 2015
Offline
Hi Jakop,
yes it seems to be like that. its a pain…
I would also love to see a solution for this.
Currently i copy paste directories
or select a file and delete it from the string.

Greetings

Olaf
User Avatar
Member
18 posts
Joined: June 2016
Offline
Thank You Olaf,

I already was pretty desperate about this issue.

But it's quite unbelievable. Why isn't something so simple impossible, though it works like a charm with
hou.ui.SelectFile([..]file_type=hou.fileType.Directory[..])

Why isn't SESI implementig it into all file parameters!? Especially, because the file picker button is calling a hou.ui procedure anyway.

Seems to me, that I have to build a workaround with a hou.ui popup myself.

Cheers und viele Grüße!
Edited by Innehavaren - Oct. 18, 2017 10:45:51
User Avatar
Member
18 posts
Joined: June 2016
Offline
Hello everyone,

this is my solution I came up with:

These are the parameters created. The Button is calling the texpath function.

parms.addParmTemplate(hou.StringParmTemplate('texpath', 'Texture Path', 1, join_with_next=True))
parms.addParmTemplate(hou.ButtonParmTemplate('texpath_btn', '...', script_callback="hou.session.texpath(hou.node('.').path())" , script_callback_language=hou.scriptLanguage.Python))

This function is written to the Houdini Source module. Taking the triggered node as a variable and setting the string with the path into the node holding the parameter.

def texpath(node):
    texpath = hou.ui.selectFile( title='Choose texture folder for import...', file_type=hou.fileType.Directory, 
    chooser_mode=hou.fileChooserMode.Read)
    hou.node(node).parm('texpath').set(texpath)
Edited by Innehavaren - Oct. 19, 2017 06:30:08
  • Quick Links