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()
  • 相关阅读:
    C#中将dll汇入exe,并加壳
    很不错的在线格式转换网站
    Eclipse快捷键大全
    win7休眠的开启与关闭方法
    C#实现注册码
    Microsoft.CSharp.targets不存在解决方法
    数据库>SQL Server2005>第4季SQL从入门到提高>2SQL Server使用
    main函数名字写错,写成mian等等的错误提示
    CSS选择器
    斐波那契数的实现
  • 原文地址:https://www.cnblogs.com/sitt/p/3105916.html
Copyright © 2011-2022 走看看