File Browser Widget with ZIP files

Discussions concerning programming of SOFTIMAGE©
homam
Posts: 50
Joined: 16 Mar 2013, 22:15
Location: Montreal

File Browser Widget with ZIP files

Post by homam » 11 Apr 2013, 22:59

Hello,

I have a tool where the user is requested to browse for a ZIP file. The file browser widget in XSI is treating zip files as folders preventing the user from picking the actual zip file.

This is a sample code (JScript) for testing this behavior:

Code: Select all

var oCustomProperty = ActiveSceneRoot.AddProperty( "CustomProperty", false, "PSet" );
var file = oCustomProperty.AddParameter2( "path", siString);
var oLayout = oCustomProperty.PPGLayout;
var oItem = oLayout.AddItem( "path","path", siControlFilePath);
oItem.SetAttribute(siUIFileFilter, "ZIP files (*.zip)|*.zip|");
oItem.SetAttribute(siUIOpenFile, true);
oItem.SetAttribute(siUIFileMustExist, true);
Is there any special attribute that can override this behavior?

Thanks,
Homam

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 00:41

Re: File Browser Widget with ZIP files

Post by EricTRocks » 13 Apr 2013, 15:37

Unfortunately this looks like a bug / limitation. I've submitted it as a bug.
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken

Letterbox
Posts: 391
Joined: 17 Jun 2009, 12:49

Re: File Browser Widget with ZIP files

Post by Letterbox » 13 Apr 2013, 22:30

You might want to Un-submit it.

Realize that Windows 7 has changed it now looks at ZIP files like normal folders viz that's exactly why they can be show in Windows Explorer with out additional applications. See it, Windows explorer the left pane, select a zip file (note the triangle) and how you can expand it, on the right pane see the contents of the zip.

Change your compression and script to rar/7-Zip types.

Unless you particularly want zip, but then you'd have to go delving into registry data to disable windows using zip compression and it's integration (good luck with that), you'd also have to do that on every single machine that script ever ran on.

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 00:41

Re: File Browser Widget with ZIP files

Post by EricTRocks » 14 Apr 2013, 01:27

I'm going to keep it logged because you don't always hav the option to just change your compression format. it is an actual file so it should be able to be done
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken

homam
Posts: 50
Joined: 16 Mar 2013, 22:15
Location: Montreal

Re: File Browser Widget with ZIP files

Post by homam » 14 Apr 2013, 05:39

Unfortunately in my case it is not possible to use other formats, it is part of the game engine pipeline. As a work around I'll try using an external browser component instead of the native XSI one.

Letterbox
Posts: 391
Joined: 17 Jun 2009, 12:49

Re: File Browser Widget with ZIP files

Post by Letterbox » 14 Apr 2013, 09:34

Maybe your both still not 'getting' this. It goes like this.... Windows intercepts it first. Like it was your postal mail, if it sees a zip envelope (like air mail) it (windows) opens it first (like customs), then sends it's on. That intercept is at an OS level (government), apps (you) get it after the OS (government) does it's thing. Sending in a report is like asking the (air mail) sender not to have customs(windows) open it, they have no control, they just use the service (windows api).

But since we're smarter than the machines (i hope), we rename the file to 'zis' (a plain envelope, customs unaware), so windows (customs) doesn't intercept. After all, its just a file name (an envelope), the message (written contents) remains the same.

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 00:41

Re: File Browser Widget with ZIP files

Post by EricTRocks » 14 Apr 2013, 16:29

No I get it. I am not a simpleton. I do think that Windows and Softimage being rather sophisticated pieces of software, should be able to be manipulated and programmed to compensate for this. If Python or jscript can recognize the path as pointing to a file through the script editor I'm confident something within the internals of the software can be adjusted to do the same. If not I would rather have a dev look into it rather than not even bother trying.
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken

luceric
Posts: 1252
Joined: 21 Jun 2009, 22:08

Re: File Browser Widget with ZIP files

Post by luceric » 14 Apr 2013, 16:43

I think it's pretty broken and fixable

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 00:41

Re: File Browser Widget with ZIP files

Post by EricTRocks » 14 Apr 2013, 16:59

Just to throw more justification onto the pile, I can attach .zip files using a file browser in Chrome on Windows 7 so it has to be possible.
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken

Letterbox
Posts: 391
Joined: 17 Jun 2009, 12:49

Re: File Browser Widget with ZIP files

Post by Letterbox » 14 Apr 2013, 20:05

So you have the 3 options given, or sit and wait it out for a resolution as yet unknown. The route you prefer you choose, but at least I hope I've given you some possibilities that will work, now.

Best of luck.

luceric
Posts: 1252
Joined: 21 Jun 2009, 22:08

Re: File Browser Widget with ZIP files

Post by luceric » 14 Apr 2013, 23:01

the problem is that it doesn't work correctly. working correctly means you should be able to pick the .zip file, or pick a file in the zip file. but neither work. whether these types of virtual folder is enabled or not a flag on the API Softimage calls to get the content of a folder.

homam
Posts: 50
Joined: 16 Mar 2013, 22:15
Location: Montreal

Re: File Browser Widget with ZIP files

Post by homam » 15 Apr 2013, 20:14

I just implemented the workaround I suggested for using Windows dialog instead of XSI's one. It is working perfect except it looks a little bit ugly with the hybrid Soft/Windows UI.
zipPick.jpg
Thanks everyone for your help and ideas :)
You do not have the required permissions to view the files attached to this post.

User avatar
csaez
Posts: 253
Joined: 09 Jul 2012, 13:31
Skype: csaezmargotta
Location: Sydney, Australia

Re: File Browser Widget with ZIP files

Post by csaez » 22 Apr 2013, 19:26

Use this and you should be safe :)

Code: Select all

Application.Desktop.SuspendWin32ControlsHook()
#--
#-- your dialog stuff
#--
Application.Desktop.RestoreWin32ControlsHook()

homam
Posts: 50
Joined: 16 Mar 2013, 22:15
Location: Montreal

Re: File Browser Widget with ZIP files

Post by homam » 23 Apr 2013, 02:38

It looks much better now. Thanks :)

Wondering why this method is not listed under the desktop object in the SDK docs?
http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html