zoukankan      html  css  js  c++  java
  • 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()
  • 相关阅读:
    ZJOI2019二轮游记
    Luogu P5284 [十二省联考2019]字符串问题
    Luogu P5309 [Ynoi2012]D1T1
    Luogu P5292 [HNOI2019]校园旅行
    LOJ #6052. 「雅礼集训 2017 Day11」DIV
    Luogu P5279 [ZJOI2019]麻将
    LOJ #6060. 「2017 山东一轮集训 Day1 / SDWC2018 Day1」Set
    Luogu P5283 [十二省联考2019]异或粽子
    Luogu P5290 [十二省联考2019]春节十二响
    Luogu P5285 [十二省联考2019]骗分过样例
  • 原文地址:https://www.cnblogs.com/sitt/p/3105916.html
Copyright © 2011-2022 走看看