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

推荐订阅源

Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
About on SuperTechFans
Apple Machine Learning Research
Apple Machine Learning Research
The Register - Security
The Register - Security
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
人人都是产品经理
人人都是产品经理
MyScale Blog
MyScale Blog
云风的 BLOG
云风的 BLOG
博客园_首页
U
Unit 42
T
Tailwind CSS Blog
G
GRAHAM CLULEY
F
Full Disclosure
V
Vulnerabilities – Threatpost
T
Tenable Blog
月光博客
月光博客
P
Privacy & Cybersecurity Law Blog
P
Privacy International News Feed
K
Kaspersky official blog
Scott Helme
Scott Helme
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News and Events Feed by Topic
T
The Exploit Database - CXSecurity.com
N
News and Events Feed by Topic
有赞技术团队
有赞技术团队
Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
LINUX DO - 最新话题
Recorded Future
Recorded Future
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Help Net Security
Help Net Security
The GitHub Blog
The GitHub Blog
Cisco Talos Blog
Cisco Talos Blog
SecWiki News
SecWiki News
P
Proofpoint News Feed
Security Latest
Security Latest
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
罗磊的独立博客
S
Security Affairs
M
MIT News - Artificial intelligence
L
LINUX DO - 热门话题
美团技术团队
Simon Willison's Weblog
Simon Willison's Weblog
T
Threat Research - Cisco Blogs
Stack Overflow Blog
Stack Overflow Blog
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
博客园 - Franky
V
Visual Studio Blog

博客园 - 千里马肝

模型数据作渲染优化时遇到的问题 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!