概述
将dll作为mse文件
使用filein就能载入dll文件,简化交付、简化调用
同时也是兼容3dmax2026新运行时的方案之一
打包脚本
fn build =
(
global Cmxs6Publisher, Cmxs6SettingsModel
global cmxs6_cli_mode = true
local curDir = getFilenamePath (getThisScriptFilename())
filein cmxsProgramFile
--配置
config = Cmxs6SettingsModel()
config.InputFile = curDir + "YourWrapperScript.ms"
config.AddResourcesFile (curDir + @"your.dll") releaseName:"new_name.dll" compress:true writeToLocal:false
--
global result = Cmxs6Publisher._build config
--ShellLaunch (getFilenamePath result) ""
--
filein result
)
build()
包装脚本 YourWrapperScript.ms
global YourNamespace_YourClassName
fn __load =
(
product = Cmxs6Container.MxsRuntime.Call "LastTool"
bytes = product.Call "GetResources" @"new_name.dll"
asm = (dotnetClass "System.Reflection.Assembly").Load bytes
----
global YourNamespace_YourClassName= asm.createInstance "YourNamespace.YourClassName"
print ("Load Ok")
)
try(
__load()
)catch(print ("Load ERR: " + getCurrentException()))
调用
--将本代码尽量靠前载入
-- 1. 声明需要的变量
global YourNamespace_YourClassName
-- 2. 载入,你需要指定你的文件放置路径
filein (@"YourWrapperScript.mse")
标签:CloseMaxScript6,YourClassName,--,global,dll,filein,mse
From: https://www.cnblogs.com/trykle/p/18687724