|
Author
|
Message
|
|
animagic
|
animagic
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: Last Month
Posts: 15.8K,
Visits: 31.4K
|
Thanks for the File Dialog question and solutions. I was looking for this as well and was surprised that it isn't more straightforward. If RL ever fixes the API for visemes (GetVisemeKey() function), I would like to add the capability to select a file from a dialog for the Papagayo script.
|
|
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: Last Year
Posts: 9.2K,
Visits: 22.1K
|
Ah, okay, got multiple files returned. Even as doped up as I am, I seem to be making lots of progress. But now I'm really hungry. REALLY hungry. Need to eat.
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
|
|
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: Last Year
Posts: 9.2K,
Visits: 22.1K
|
The filter seems to work just fine, as does the rest, so I'm not sure why I need anything else. However -- there IS one thing I would like, and it's to be able to select multiple files (as you can in any normal file explorer window). I don't see a way for Pyside to allow that but, again, I suspect I'm going to need to learn all of it as soon as I heal up.
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
|
|
|
|
|
The-any-Key
|
The-any-Key
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: Last Year
Posts: 356,
Visits: 1.9K
|
Kelleytoons (6/15/2019)
This is what I did: def get_load_filename_dialog(title, filter, default_filename,dir): return PySide2.QtWidgets.QFileDialog.getOpenFileName(None,str(title),str(dir),str(default_filename),str(filter))
And then this call: loadDir = "V:\\exports" load_file=get_load_filename_dialog("Legs Diffuse","","*.jpg",loadDir)
sets the directory. Now, in my drug-addled state, I'm not sure why this works (indeed it appears as if it should NOT work) but it works for me just fine. Again, I'm going to need to learn Pyside I can see, just not right now. It works because the dir is in the filename argument spot. You will notice that your filter in the dialog now got the filename as filter. Proboply not what you want. But I updated the script so you can provide a default folder: def get_save_filename_dialog(title, filter, default_filename, default_folder=None): # Filter example: "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)" fileDialog=PySide2.QtWidgets.QFileDialog() if default_folder: # Check if default folder end with \\ if default_folder.endswith("\\"): default_filename=default_folder+default_filename else: default_filename=default_folder+"\\"+default_filename return fileDialog.getSaveFileName(None,str(title),str(default_filename),str(filter)) def get_load_filename_dialog(title, filter, default_filename, default_folder=None): # Filter example: "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)" fileDialog=PySide2.QtWidgets.QFileDialog() if default_folder: # Check if default folder end with \\ if default_folder.endswith("\\"): default_filename=default_folder+default_filename else: default_filename=default_folder+"\\"+default_filename return fileDialog.getOpenFileName(None,str(title),str(default_filename),str(filter))
iClone 7, 3DXchange 7 Pipeline, CC3 Pipeline, CT8 Pipeline, Iray, Live Face, iPhone Xr, Win 10, i9 9900K ~5GHz, Nvidia RTX 2080 8GB, 16GB Ram, M.2 SSD
|
|
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: Last Year
Posts: 9.2K,
Visits: 22.1K
|
This is what I did: def get_load_filename_dialog(title, filter, default_filename,dir): return PySide2.QtWidgets.QFileDialog.getOpenFileName(None,str(title),str(dir),str(default_filename),str(filter))
And then this call: loadDir = "V:\\exports" load_file=get_load_filename_dialog("Legs Diffuse","","*.jpg",loadDir)
sets the directory. Now, in my drug-addled state, I'm not sure why this works (indeed it appears as if it should NOT work) but it works for me just fine. Again, I'm going to need to learn Pyside I can see, just not right now.
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
|
|
|
|
|
The-any-Key
|
The-any-Key
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: Last Year
Posts: 356,
Visits: 1.9K
|
Tested to set a default folder and I can't seem to get it to work. You use setDirectory but it seems I only get an error when trying to set the folder.
EDIT: But it seems you only need to add the path in the default filename: ex "C:\\Windows\\test.txt"
iClone 7, 3DXchange 7 Pipeline, CC3 Pipeline, CT8 Pipeline, Iray, Live Face, iPhone Xr, Win 10, i9 9900K ~5GHz, Nvidia RTX 2080 8GB, 16GB Ram, M.2 SSD
|
|
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: Last Year
Posts: 9.2K,
Visits: 22.1K
|
Okay, so thanks for all the help, Chris and Any. I think I have it working for what I want (I added the Dir to the example Any posted). I suspect I will have to learn Pyside if nothing more than to do some UI for things (there was a reason I ALWAYS left the UI and the print functions to my staff, as I hate that part of programming). But I at least have something workable for now.
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
|
|
|
|
|
videodv
|
videodv
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: 2 Years Ago
Posts: 342,
Visits: 12.0K
|
Hi Mike
The filename returned if you look at the example is fname
Chris
|
|
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: Last Year
Posts: 9.2K,
Visits: 22.1K
|
I may have to wait until the drugs wear off. I can get it to work... after a fashion. I cannot discern how it's choosing the directory to start in, which is Bad. I thought maybe I could do this by specifying a file pattern in the default file but this doesn't appear to do anything useful (using another drive letter just got me to my Dropbox and not even on that drive, which is really, really weird -- prior to that it just appeared to pick the Python directory I was running in iClone). I'll have to most likely learn Pyside, I see, but this drug-addled brain ain't gonna do that right now.
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
|
|
|
|
|
Kelleytoons
|
Kelleytoons
Posted 6 Years Ago
|
|
Group: Forum Members
Last Active: Last Year
Posts: 9.2K,
Visits: 22.1K
|
Sorry, Any -- after my surgery the drugs I'm taking are clouding my mind. For some reason all I could see was the file reading and writing you were doing. Let me play a bit -- I only have a limited amount of time I can sit upright but it would be nice to get this working.
Alienware Aurora R16, Win 11, i9-149000KF, 3.20GHz CPU, 64GB RAM, RTX 4090 (24GB), Samsung 870 Pro 8TB, Gen3 MVNe M-2 SSD, 4TBx2, 39" Alienware Widescreen Monitor Mike "ex-genius" Kelley
|
|
|
|