About the max export plug-in

Source: Internet
Author: User

This article describes how to use. net in the max plug-in to create an interface, how to add the maxscript script interface and command line parameters for the plug-in to directly test the export plug-in.

First, enable CLR support in the Project Settings of Visual Studio, add required references, and add

BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved){    if( fdwReason == DLL_PROCESS_ATTACH )    {             hInstance = hinstDLL;        DisableThreadLibraryCalls(hInstance);    } 
  return(TRUE);}

If you use a newer plug-in Wizard to create a project, this is the case. If you use an older version, such as max9, there is no content in this if, if CLR is enabled, Max may crash.

Second, you need to use # pragma unmanaged and # pragma managed in A. Net file to distinguish between hosted code and unmanaged code. The corresponding classdesc of the export plug-in should be changed to the singleton mode. Return the classdesc of the Singleton in the libclassdesc function of the plug-in.

Then add the script interface. In the maxsdk documentation, this part is function Publishing. Here we will introduce the sequence.

First, you must create a class that inherits fpstaticinterface. This class must have functions that need to be opened to the script. If it is an attribute, you must have get and set functions. If it is a read-only attribute, with get, you can configure an enumeration for each function, use in_function_map and end_function_map macros and corresponding function types to write the corresponding functions and the function names and attribute names exposed to the script.

If the CLR is not enabled, you can create an instance of this class in any place. If CLR is enabled, you need to create it in dllmain.

 

It is easy to use scripts to test and export. Max can use parameters to specify the maxscript script to run after startup. You can open a file, specify parameters, and export the file in the script.

3 DSMAX-u maxscript test. Ms

Attach the sample project I wrote

Http://files.cnblogs.com/sitt/SimpleExportMax2014.zip

The plug-in name in maxscript is simpleexporter.

A member has one function and four attributes.

Simpleexporter. Hello ()

Simpleexporter. Char

Simpleexporter.int

Simpleexporter. Float

Simpleexporter. bool

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.