Reading and modifying Asset file Paths in the 3DS Max file

Source: Internet
Author: User
Tags ole

Some people found the following information in the MAXScript reference for 2010:

NEW in 3ds Max: the 3ds max scene file Now provides Asset Metadata in a separate stream which can is accessed and modified by external applications. T He Asset data is generated and managed by the assetmanager and assetuser objec Ts.

What left several people scratching their head and wondering is "how exactly can an external application" Access and Modi FY this data?! While the 3DS Max file format was not released to the public, we did publicize the fact that it uses the Microsoft OLE Struc tured storage format. This means so can browse, and even edit, certain properties of a 3DS Max file by using the IStorage and Ipropertysto Rage interfaces.

This is especially useful if you want to modify asset file paths in a 3DS Max file, without opening the file. This can is accomplished with MAXScript using the Functions:getmaxfileassetmetadata and Setmaxfileassetmetadata. The MAXScript documentation have several pages that discuss the asset file streams in MAX files, but unfortunately doesn ' t Say anything more on how an external application can access these streams.

Unfortunately reading and writing of structured storage files is far from trivial, and out of the scope of what we can cov Er in the 3DS Max SDK documentation. That's said, I can at least provide some tips and pointers so can help you get started if you is determined to edit Max F Iles outside of 3DS Max.

First off it is useful to know the actual C + + implementation of the MAXScript functions for modifying asset file data Is released with the 3DS Max SDK and can found in the file "Maxsdksamplesmaxscriptmxsagniavg_dlx.cpp" at around line 7600. Search for "GET_MAX_FILE_ASSET_METADATA_CF" and "SET_MAX_FILE_ASSET_METADATA_CF". Also in the SDK are a file in "MaxsdksamplesutitliesmaxfindShowPropDlg.cpp" that have a algorithm for opening a Max file us ing the IPropertySetStorage COM interface.

If you were really motivated, this might was enough to get you started but the documentation was extremely sparse and it is H ard to follow. OLE Programming in C + + is not for the faint-hearted. I strongly suggest looking at the structured storage documentation on MSDN for some help (http://msdn.microsoft.com/en-us/ library/aa380365 (vs.85). aspx).

I did find a C + + project on CodeProject.com when researching this problem which could also prove to be Useful:an ATL and M FC wrapper for structured storagehttp://www.codeproject.com/kb/atl/structuredstorage.aspx.

Because I really hate programming OLE in C + +, I also did some, the structured file format reading and writing in C # . Again on CODEPROJECT.CP, I found II project which were helpful:

    1. An MS Word file viewer-http://www.codeproject.com/kb/cs/getwordtext.aspx
    2. An HTML file reader-http://www.codeproject.com/kb/cs/htmlcb.aspx

After all of this I found that rolling my own C # reader isn ' t too hard if you have the Microsoft Visual Studio SDK Install Ed. With it is a. NET assembly "Microsoft.VisualStudio.OLE.Interop.dll". This assembly isn ' t documented @ all, but using the Object Browser and the MSDN reference I mentioned above I were able to Roll a quick and dirty MAX file Reader in a couple of hours.

Apart from adding a reference to the DLL, the only tricky things this I had to do were:

    1. Define My Own constants
    2. Use "DllImport" to import the API Stgopenstg.

I hope that you find this information at least helpful enough to get you started down the path of reading and writing 3DS Max files.

"Turn" http://area.autodesk.com/blogs/chris/reading_and_modifying_asset_file_paths_in_the_3ds_max_file

Reading and modifying Asset file Paths in the 3DS Max file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.