Reading and Modifying Asset File Paths in the 3ds Max File

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

NEW in 3ds Max 2010: The 3ds Max scene file now provides Asset Metadata in a separate stream which can be accessed and modified by external applications. The Asset data is generated and managed by the AssetManager and AssetUser objects.

What left several people scratching their head and wondering was "how exactly can an external application" access and modify this data?! While the 3ds Max file format is not released to the public, we do publicize the fact that it uses the Microsoft OLE structured storage format. This means that you can browse, and even edit, certain properties of a 3ds Max file by using the IStorage and IPropertyStorage interfaces.

This is especially useful if you want to modify asset file paths in a 3ds Max file, without opening the file. This can be accomplished with MAXScript using the functions: getMAXFileAssetMetadata and setMAXFileAssetMetadata. The MAXScript documentation has several pages that discuss the asset file streams in MAX files, but unfortunately doesn‘t say anything more about 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 cover in the 3ds Max SDK documentation.That said, I can at least provide some tips and pointers that can help you get started if you are determined to edit max files outside of 3ds Max.

First off it is useful to know that the actual C++ implementation of the MAXScript functions for modifying asset file data is released with the 3ds Max SDK and can be 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 is a file in "maxsdksamplesutitliesmaxfindShowPropDlg.cpp" that has an algorithm for opening a Max file using the IPropertySetStorage COM interface.

If you are really motivated, this might be enough to get you started but the documentation is extremely sparse and it is hard 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 while researching this problem which may also prove to be useful: An ATL and MFC wrapper for structured storagehttp://www.codeproject.com/KB/atl/structuredstorage.aspx .

Because I really hate programming OLE in C++, I also did some research on structured file format reading and writing in C#. Again on CodeProject.cp, I found two 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 installed. With it is a .NET assembly "Microsoft.VisualStudio.OLE.Interop.dll". This assembly isn‘t documented at all, but using the Object Browser and the MSDN reference I mentioned above I was 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 that 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.

【转】http://area.autodesk.com/blogs/chris/reading_and_modifying_asset_file_paths_in_the_3ds_max_file

时间: 2024-10-26 11:46:43

Reading and Modifying Asset File Paths in the 3ds Max File的相关文章

3ds Max File Format (Part 1: The outer file format; OLE2)

The 3ds Max file format, not too much documentation to be found about it. There are some hints here and there about how it’s built up, but there exists no central documentation on it. Right now we are in the following situation. A few thousand of max

mysql从库Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'报错处理

年后回来查看mysql运行状况与备份情况,登录mysql从库查看主从同步状态 1 mysql> show slave status\G; 2 *************************** 1. row *************************** 3 Slave_IO_State: 4 Master_Host: 101.200.*.* 5 Master_User: backup 6 Master_Port: 3306 7 Connect_Retry: 60 8 Master_

Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'系列一:

主库添加log-bin-index 参数后,从库报这个错误:Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file' Got fatal error 1236 from master when reading data from binary log: 'could not find next l

Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'系列二:reset slave

reset slave会清除从库的所有复制信息.一般应用场景:如切换为不同的Master, 主从重做等: 1. 命令在slave上执行,执行前一定要stop slave. 2. 执行reset slave后,会清除复制相关的所有信息,包括:master.info, relay-log.info, 及无条件删除所有的中继日志(relay logs). 注意是无条件的,也就是不管理你Slave SQL线程是否把所有的relay log重放完了. 3. 注意,stop slave后,先保存show s

While reading xxx.png pngcrush caught libpng error: Not a PNG file..

While reading /XXX/XXX/XXX/img1.png pngcrush caught libpng error: Not a PNG filCould not find file: /Users/XXX/Library/Developer/Xcode/DerivedData/CookBookDemo-cnttcobrbmvbddeiesgsxnfwihfe/Build/Products/Debug-iphoneos/CookBookDemo.app/img1.pngComman

Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'

mysql> show slave status \G Slave_IO_Running: No Slave_SQL_Running: Yes Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 1236 Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in bi

Java File类学习笔记2:File类对象及常用操作方法

一. 文件.相对路径与绝对路径 1.文件 (1)标准文件:就像图片,音乐文件等. (2)目录文件:也就是平常所说的文件夹. (3)虚拟内存文件:系统在运行程序时生成的临时性文件. 2.文件的路径 (1)相对路径:相对于某一文件的路径,形象地说是把两文件的绝对路径相同的部分砍掉,剩下的就是相对路径 如: A文件是"D:\MyDocuments\StudySample\src\cn\xmh", B文件是"D:\MyDocuments\StudySample\src\netjava

ORA-01665 control file is not a standby control file

ORA-01665错误处理 问题描述: 在备库启动至mount状态时,报如下错误: ORA-01665: control file is not a standby control file 解决办法: 在主库备份一个控制文件 SQL> alter database create standby controlfile as '/home/oracle/bak.ctl'; 然后传到备库,用此控制文件启动数据库即可

snort在使用过程中遇到的问题:ERROR: OpenAlertFile() => fopen() alert file log/alert.ids:No such file or directory

转自:http://www.cnblogs.com/kathmi/archive/2010/08/09/1795405.html Snort是著名的开源入侵检测工具,不仅它的嗅探功能极佳,在服务器安全方面也可提供安全防护. 近期因为涉及此项内容,故记录下来. 使用的软件如下: Snort_2_8_6_Installer.exe(按照默认路进安装即可) WinPcap_4_1_2.exe snortrules-snapshot-2860.tar.gz(规则库,解压到Snort的安装目录,如果提示重