• MaxScript调用IGame


    IGame是MaxSDK中的一个组件,在原生接口上做了封装来方便导出数据,以往在MaxScript中是不能调用IGame的,不过从Max2013开始MaxSDK有了.net版本(Max2012安装了扩展包也可以),MaxScript也可以使用MaxSDK的全部接口了。范例如下

    Fn InitializeMaxSDK = 
    (
        local result = false
        if (MaxVersion())[1] >= 14000 do
        (
            result = (DotNetClass "Autodesk.Max.GlobalInterface") != undefined
            if not result do
            try
            (
                DotNet.LoadAssembly (PathConfig.GetDir #MaxRoot + "\Autodesk.Max.dll")
                result = true
            )
            catch()
        )
        result
    )
    
    Fn GetMaxGlobal = (DotNetClass "Autodesk.Max.GlobalInterface").Instance
    Fn GetMaxCoreInterface = (DotNetClass "Autodesk.Max.GlobalInterface").Instance.CoreInterface
    
    Fn ParseIGameScene argIGameScene = 
    (
        local tempIGameNode,tempNode
        local tempNodeName,tempChildrenNames,tempParentName
        for i = 1 to argIGameScene.TotalNodeCount do
        (
            tempChildrenNames = ""
            tempIGameNode = argIGameScene.GetIGameNode i
            for ci = 0 to tempIGameNode.ChildCount do
            (
                tempNode = tempIGameNode.GetNodeChild ci
                if undefined != tempNode do tempChildrenNames += " " + tempNode.name
            )
            if tempIGameNode.NodeParent != undefined do tempParentName = tempIGameNode.NodeParent.Name
            print ("Name:" + tempIGameNode.Name + "\t\t Parent:" + tempParentName as string + "\t\t Children:" + tempChildrenNames)
        )
    )
    
    Fn SimpleIGameMain = 
    (
        if InitializeMaxSDK() do
        (
            MaxGolbal = GetMaxGlobal()
            MaxCoreInterface = GetMaxCoreInterface()
            theIGameScene = MaxGolbal.IGameInterface
            theIGameScene.InitialiseIGame false
            ParseIGameScene theIGameScene
        )
    )
    SimpleIGameMain()
  • 相关阅读:
    Atitit.安全性方案规划设计4gm  v1 q928
    Atitit ati licenseService    设计原理
    Atitit.js图表控件总结
    Atitit. null错误的设计 使用Optional来处理null
    System.Web.Mvc 命名空间
    provider: SQL Network Interfaces, error: 26 Error Locating Server/Instance Specified
    Visual Studio 2010 实用功能总结
    My First J2ME
    Java开发利器ideaIU最新版本10.5的keygen
    Happy New Year for 2012
  • 原文地址:https://www.cnblogs.com/sitt/p/3105916.html
Copyright © 2020-2023  润新知