惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
Arctic Wolf
博客园 - 聂微东
F
Fortinet All Blogs
云风的 BLOG
云风的 BLOG
小众软件
小众软件
V
Visual Studio Blog
博客园 - 三生石上(FineUI控件)
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
L
LangChain Blog
A
About on SuperTechFans
阮一峰的网络日志
阮一峰的网络日志
I
Intezer
T
The Blog of Author Tim Ferriss
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
Know Your Adversary
Know Your Adversary
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Palo Alto Networks Blog
Scott Helme
Scott Helme
S
Secure Thoughts
Spread Privacy
Spread Privacy
T
Threat Research - Cisco Blogs
Attack and Defense Labs
Attack and Defense Labs
P
Privacy & Cybersecurity Law Blog
O
OpenAI News
H
Heimdal Security Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Help Net Security
Help Net Security
C
Cyber Attacks, Cyber Crime and Cyber Security
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
G
Google Developers Blog
博客园 - Franky
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
Kaspersky official blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
Tor Project blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tenable Blog
Google Online Security Blog
Google Online Security Blog
PCI Perspectives
PCI Perspectives

博客园 - 千里马肝

模型数据作渲染优化时遇到的问题 vertex compression所遇到的问题 depth and distance Linear or non-linear shadow maps? 实施vertex compression所遇到的各种问题和解决办法 【转】編譯Ogre1.9 IOS Dependencies及Ogre Source步驟及相關注意事項… 画之国 Le tableau (2011) 关于H.264 x264 h264 AVC1 解决Visual Studio 2010/2012的RC4011 warnings 解决Visual Studio 2010/2012在调试时lock文件的方法 神片和神回复 3DS Max 2014 features revealed 【西川善司】PLAYSTATION4图形讲座(后篇) [ 【西川善司】PLAYSTATION4图形讲座(前篇) 趣文:程序员/开发人员的真实生活 [讣告]“D之食卓”等代表作制作人饭野贤治逝世 楚汉传奇 【翻译】揭晓「Agni's Philosophy」幕后的"技术编" 【PS3/XB360】DEAD OR ALIVE 5 制作采访
【转】25 things you probably didn't know about the 3ds Max SDK
千里马肝 · 2013-02-22 · via 博客园 - 千里马肝

http://area.autodesk.com/blogs/chris/25-things-you-probably-didn039t-know-about-the-3ds-max-sdk

25 things you probably didn't know about the 3ds Max SDK

I've adventured deep into the darkest corners of the 3ds Max SDK to bring you a set of largely unknown but useful tips and tricks.

  1. Use the 3ds Max SDK from MAXScript by loading the Autodesk.Max.dll. Add the following MAXScript to your start-up scripts and you can use the MaxGlobal variable to access the 3ds Max SDK.

    fn loadAutodeskMax = (
      local Assembly = dotNetClass "System.Reflection.Assembly"
      local maxroot = pathConfig.GetDir #maxroot
      Assembly.LoadFile (maxroot + "\Autodesk.Max.dll")
      local GlobalInterface = dotNetClass "Autodesk.Max.GlobalInterface"  
      global MaxGlobal = GlobalInterface.Instance
    )
    loadAutodeskMax ()
    
  2. Execute arbitrary MAXScript code using the ExecuteMAXScriptScript() global function (see the maxscriptmaxscript.h header).
  3. Execute code safely in the main thread in 3ds Max by either creating a Windows timer object using the main 3ds Max window as the window handle, or by using the following function to trigger code as soon as 3ds Max is idle next.
    #define WM_TRIGGER_CALLBACK WM_USER+4764
    void PostCallback( void (*funcPtr)(UINT_PTR), UINT_PTR param )
    {
      PostMessage( GetAppHWnd(), WM_TRIGGER_CALLBACK, 
    (UINT_PTR)funcPtr, (UINT_PTR)param ); }
  4. Work with different types of meshes ( Mesh, MNMesh and PatchMesh) using theObjectWrapper class. This can simplify writing plug-in that have to deal with arbitrary mesh types such as modifiers.
  5. Collect notifications about all nodes in the scene in an efficient way using theISceneEventManager class. It's ideal to use for UI refresh, when you need to monitor the scene for events to trigger a refresh.
  6. Output text to the 3ds Max MAXScript listener window (see the maxscriptmaxscript.h header) as follows:
      the_listener->edit_stream->wputs("Hello") 
      the_listener->edit_stream->flush()
    
  7. Execute a Python script from a .NET assembly with a few lines of code after downloading and installing IronPython
    using IronPython.Hosting;
    using Microsoft.Scripting.Hosting;
    public static void RunPythonFile(string filename) {
      try  {
         var options = new Dictionary<string, object>();
         options["Debug"] = true;
         ScriptEngine se = Python.CreateEngine(options);
         ScriptSource ss = se.CreateScriptSourceFromFile(filename);
         CompiledCode cc = ss.Compile();
         cc.Execute();
       }
      catch (Exception e){
        MessageBox.Show("Error occurred: " + e.Message);
      }
    }
    
  8. Extend 3ds Max with new drag and drop functionality by deriving from theDragAndDropHandler class.
  9. Download a file from an arbitrary URL to disk using:IDragAndDropMgr::DownloadUrlToDisk().
  10. Compress data using the zlip compression library. Check out the zlibdll.h header file in the 3ds Max SDK.
  11. Log messages to the 3ds Max log file and even print out messages to Visual Studio console using LogSys class.
  12. Evaluate mathematical expressions stored as strings using the Expr class.
  13. Generate repeatable sequences of random numbers using the Random class.
  14. Store objects in one of the following container template types:
  15. Read and write Unicode files easily and correctly using the FileReaderWriter class.
  16. Compute the time it takes to complete a task using the Timer class.
  17. Automatically delete objects when you are done with them using the AutoPtrtemplate.
  18. Output unobtrusive status messages to the user using the Interface::PushPrompt()function.
  19. Retrieve the user define UI colors using IColorManager.
  20. Launch a web browser using IBrowserMgr.
  21. Retrieve .MAX file properties using Interface11::OpenMaxStorageFile().
  22. Format a time value as a string using Interface10::FormatRenderTime()
  23. Open the windows explorer using Interface8::RevealInExplorer().
  24. Perform a quick render to a bitmap using Interface8::QuickRender()
  25. Execute code when 3ds Max is fully initialized in C#:
    using ManagedServices;
    public class My3dsMaxAssembly
    {
      public const int StartUpNotification = 0x50;
      public static void AssemblyMain()
      {
        // This causes an event to be raised once the 3ds Max application has been started 
        var m = new MaxNotificationListener(StartUpNotification);
        m.NotificationRaised += new EventHandler<MaxNotificationEventArgs>(AfterStartup); 
      } 
      public static void AfterStartup(object sender, MaxNotificationEventArgs e) { 
        if (e.NotificationCode == StartUpNotification) { 
          // Do whatever 
        } 
      } 
    } 
    

Special thanks to Michaelson Britt, Stephen Taylor, and David Cunningham for several of theses cool tips. Please share in the comments your favorite undocumented or frequently overlooked tips and tricks for using the 3ds Max SDK!