View Full Version : Retrieving the 3dsMax File Thumbnail via DotNet
LoneRobot 10-05-2008, 04:56 PM Hello All,
I have just posted an article on my website sharing my research on trying to demonstrate the use of a thumbnail class for 3dsMax applications.
http://www.lonerobot.com/images/thumbclass.jpg
Please bear in mind it's just the solution I have found, and is by no means a perfect one. If you need any help getting it working, please ask, as I have not found it terribly straight forward myself when deploying on different computers. That said, I find the file thumbnail very useful. I have also considered extending it to be able to write summary info to maxfiles. Please let me know if that is something you would need and I can try to add it.
I hope it is of use to someone. I myself am using it in a few products I am hoping to release to the Max community in the near future. Unfortunately It's not x64 compatible yet, but I am hoping to add this functionality very soon and will provide updates when I can. The article explains a bit about this.
read the info here -
http://www.lonerobot.com/Thumb.html
|
|
RobGalanakis
10-05-2008, 05:54 PM
Awesome stuff... I needed a way to do this a while ago for something I can't remember, but I'll keep this in mind if I remember or if I need to do it again.
EDIT: 2 months later, now I remember! Thanks!
Nice Pete, interesting stuff, and not at ALL how I was trying to figure out how to do it. lol.
floopyb
05-14-2009, 04:18 AM
Great work!
I would love to be able to get the thumbnail but without registering external files..
Any way to do it?
LoneRobot
05-14-2009, 06:46 AM
Hi Jordan,
Unfortunately, The thumb is buried into the max file using structured storage, a lower level, unmanaged codebase that has not been granted acces to the dotnet framework currently. Because dsofile is a COM assembly it is unmanaged. The wrapper dll uses an interop assembly to expose the unmanaged resources to it's managed dotnetframework environment. There have been similar issues in using the photoshop object library, another COM assembly.
Even using the interop assembly directly in max, you are forced with the prospect of at some point, it is not going to return the managed object you need and the interop gives you a reference to a system_COMobject.
I assume photoshop registers it's object/type library when you install - it is possible i think to get visual studio to do this with an installer but i dont know how to do it.
I thought the new file menu in 2010 had implemented something to do with this, on perusal it appears it's just caching the viewport to a bitmap and storing it in a folder in the max install folder.
So my wrapper dll is the only way I have seen of doing this with dotnet currently and or with any speed. Unless anyone was a bit nifty with the SDK and OLE structured storage. :cool:
TzMtN
05-14-2009, 04:56 PM
Hi Pete,
I wanted to do this for a long time, thank you.
The problem is, on my computer everything works great
but on other computers I get this error message:
MAXScript Rollout Handler Exception: -- Runtime error: dotNet runtime exception: Could not load file or assembly 'stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. <<
do you have any idea what am I doing wrong?
thanks, Matan.
LoneRobot
05-14-2009, 04:56 PM
Hi Matan,
I had this problem on a few computers - stdole.dll should be on most. Try a search for it an copy it into the folder with the maxfile assembly I made.
They're not x64 OS are they, by any chance?
LoneRobot
05-14-2009, 05:03 PM
actually, i'd just read the article again - it's been a while! you might need to import
visualbasic.compatibility.dll also.
(It's the bit of code in the assembly that converts the StdPicture object into a dotnetbitmap)
LoneRobot
05-14-2009, 05:12 PM
Ouch! Good job I put that disclaimer on eh? :)
I guess if something is going wrong, as the thumbnail is embedded into it, it's creating the issue.
Did the step where you register DSOfile.dll go okay?
TzMtN
05-14-2009, 05:12 PM
That was quick!
I already have stdole.dll in the folder
Some of the computers are x64 and some are not
I get the error on your example script too which has these lines on the top:
dotnet.LoadAssembly @"C:\Documents and Settings\Amir.VFX\Desktop\tset\Interop.DSOFile.dll"
dotnet.LoadAssembly @"C:\Documents and Settings\Amir.VFX\Desktop\tset\MaxFileInfo.dll"
dotnet.LoadAssembly @"C:\Documents and Settings\Amir.VFX\Desktop\tset\Microsoft.VisualBasic.Compatibility.dll"
by the way, after getting this error message, the file is getting corrupted!
LoneRobot
05-14-2009, 05:13 PM
ooh ,my reply went back in time!
LoneRobot
05-14-2009, 05:15 PM
My computer is the only one with MAX SDK installed, could this by the problem?
good point Matan, I hadn't thought of that, the same is true of my computer that I tested this on. Can you try this and verify for me?
TzMtN
05-14-2009, 05:17 PM
My computer is the only one with MAX SDK installed, could this by the problem?
TzMtN
05-14-2009, 05:20 PM
I used the installation from the ms site
LoneRobot
05-14-2009, 05:26 PM
the board is doing funny things with my replies at the mo matan, sorry if it's not making sense, i edited my reply to include your question.
TzMtN
05-14-2009, 05:47 PM
My IT guy has already went home and the only max dvd I could find is 2009 so I installed sdk 2009 and no luck there, still the same problem
LoneRobot
05-15-2009, 07:40 AM
ok matan. Can you confirm if the small utility included in the download (the .net application that runs outside max) will work? This runs in x86 space. You will need a different version of DSOfile that has been compiled for x64 for it to work in a 64bit max environment. This will need to be placed into the system32 folder, which ironically is the folder for 64bit dlls. The systemWOW64 folder is the place for 32bit dlls as WOW64 is the 32bit emulator. attached is DSOfile compiled to 64bit.
CGTalk Moderation
05-15-2009, 07:40 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.