예제 #1
0
        /// <summary>
        /// Retrieve current selected material in slate material editor
        /// </summary>
        /// <returns></returns>
        public static IMtl GetSelectedMaterial()
        {
            string mxs = "viewNode = sme.GetView (sme.activeView)";

            mxs += "\r\n" + "smeSelMats = #()";
            mxs += "\r\n" + "if (trackViewNodes[#sme][(sme.activeView)] != undefined) then(";
            mxs += "\r\n" + "for n = 1 to trackViewNodes[#sme][(sme.activeView)].numSubs do (";
            mxs += "\r\n" + "m = trackViewNodes[#sme][(sme.activeView)][n].reference";
            mxs += "\r\n" + "b = viewNode.GetNodeByRef m";
            mxs += "\r\n" + "if b.selected do append smeSelMats m)";
            mxs += "\r\n" + "smeSelMats[1])";

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

            ScriptsUtilities.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
            IMtl result = null;

            try
            {
                result = mxsRetVal.Mtl;
            }
            catch (Exception e)
            {
                //do nothing ,just retun a null material
            }

            return(result);
        }
예제 #2
0
        public static void ExecuteMAXScriptScript(string mxs, bool quietErrors, IFPValue fpv)
        {
#if MAX2015 || MAX2016 || MAX2017 || MAX2018
            Loader.Global.ExecuteMAXScriptScript(mxs, quietErrors, fpv);
#elif MAX2019 || MAX2020 || MAX2021
            Loader.Global.ExecuteMAXScriptScript(mxs, quietErrors, fpv, true);
#else
            Loader.Global.ExecuteMAXScriptScript(mxs, 0, quietErrors, fpv, true);
#endif
        }
예제 #3
0
        private float GetFlashPhase(IINode node)
        {
            string mxs = String.Empty;

            mxs = $"(maxOps.getNodeByHandle {node.Handle}).FlashPhase";

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

            ScriptsUtilities.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
            var r = mxsRetVal.F;

            return(r);
        }
예제 #4
0
        private bool GetDayNightCycle(IINode node)
        {
            string mxs = String.Empty;

            mxs = $"(maxOps.getNodeByHandle {node.Handle}).ActivationMode";

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

            ScriptsUtilities.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
            bool r = mxsRetVal.I == 1;

            return(r);
        }
예제 #5
0
        private float[] GetColor(IINode node)
        {
            string mxs = String.Empty;

            mxs = $"(maxOps.getNodeByHandle {node.Handle}).Color";

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

            ScriptsUtilities.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
            var r = mxsRetVal.Clr.ToArray();

            return(r);
        }
예제 #6
0
        private bool GetHasSimmetry(IINode node)
        {
            string mxs = String.Empty;

            mxs = $"(maxOps.getNodeByHandle {node.Handle}).HasSimmetry";

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

            ScriptsUtilities.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
            var r = mxsRetVal.B;

            return(r);
        }
예제 #7
0
 public static ITab <string> Excute(string mxsCode)
 {
     try
     {
         IFPValue mxsRetVal = Kernel.Global.FPValue.Create();
         Kernel.Global.ExecuteMAXScriptScript(mxsCode, true, mxsRetVal);
         return(mxsRetVal.STab);
     }
     catch
     {
         OnError("Couldn't Execute Function: " + mxsCode);
         return(null);
     }
 }
예제 #8
0
        private bool GetIsBeacon(IINode node)
        {
            string mxs = String.Empty;

            mxs = $"(maxOps.getNodeByHandle {node.Handle}).IsBeacon";

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

#if MAX2015 || MAX2017 || MAX2018
            Loader.Global.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
#else
            Loader.Global.ExecuteMAXScriptScript(mxs, true, mxsRetVal, true);
#endif
            var r = mxsRetVal.B;
            return(r);
        }
예제 #9
0
        private float[] GetColor(IINode node)
        {
            string mxs = String.Empty;

            mxs = $"(maxOps.getNodeByHandle {node.Handle}).Color";

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

#if MAX2015 || MAX2017 || MAX2018
            Loader.Global.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
#else
            Loader.Global.ExecuteMAXScriptScript(mxs, true, mxsRetVal, true);
#endif
            var r = mxsRetVal.Clr.ToArray();

            return(r);
        }
예제 #10
0
        public bool PreImport()
        {
            IFPValue importQuery = global.FPValue.Create();
            IFPValue errorQuery  = global.FPValue.Create();
            bool     result      = true;

            if (Utility.uniqueParts.Count > 50)
            {
                global.ExecuteMAXScriptScript("qB_LongImport()", false, importQuery);
                result = importQuery.B;
            }

            if (result != false && Utility.missingParts.Count > 0)
            {
                global.ExecuteMAXScriptScript("qB_MissingParts()", false, errorQuery);
                result = errorQuery.B;
            }

            return(result);
        }
예제 #11
0
        public static bool GetGizmoParameterBoolean(IINode node, string gizmoClass, string paramName, bool IsSubClass = true)
        {
            string mxs = String.Empty;

            if (!IsSubClass)
            {
                mxs = $"(maxOps.getNodeByHandle {node.Handle}).{paramName}";
            }
            else
            {
                mxs = $"(maxOps.getNodeByHandle {node.Handle}).{gizmoClass}.{paramName}";
            }

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

            ScriptsUtilities.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
            var r = mxsRetVal.B;

            return(r);
        }
        /// <summary>
        /// Retrieve current selected material in slate material editor
        /// </summary>
        /// <returns></returns>
        public static IMtl GetSelectedMaterial()
        {
            string mxs = "viewNode = sme.GetView (sme.activeView)";

            mxs += "\r\n" + "smeSelMats = #()";
            mxs += "\r\n" + "for n = 1 to trackViewNodes[#sme][(sme.activeView)].numSubs do (";
            mxs += "\r\n" + "m = trackViewNodes[#sme][(sme.activeView)][n].reference";
            mxs += "\r\n" + "b = viewNode.GetNodeByRef m";
            mxs += "\r\n" + "if b.selected do append smeSelMats m)";
            mxs += "\r\n" + "smeSelMats[1]";

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

#if MAX2015 || MAX2017 || MAX2018
            Loader.Global.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
#else
            Loader.Global.ExecuteMAXScriptScript(mxs, true, mxsRetVal, true);
#endif
            return(mxsRetVal.Mtl);
        }
예제 #13
0
        public static float GetGizmoParameterFloat(IINode node, string gizmoClass, string paramName, bool IsSubClass = true)
        {
            string mxs = String.Empty;

            if (!IsSubClass)
            {
                mxs = $"(maxOps.getNodeByHandle {node.Handle}).{paramName}";
            }
            else
            {
                mxs = $"(maxOps.getNodeByHandle {node.Handle}).{gizmoClass}.{paramName}";
            }

            IFPValue mxsRetVal = Loader.Global.FPValue.Create();

#if MAX2015 || MAX2017 || MAX2018
            Loader.Global.ExecuteMAXScriptScript(mxs, true, mxsRetVal);
#else
            Loader.Global.ExecuteMAXScriptScript(mxs, true, mxsRetVal, true);
#endif
            var r = mxsRetVal.F;
            return(r);
        }
예제 #14
0
 public int _DispatchFn(short fid, int t, IFPValue result, IFPParams p)
 {
     throw new NotImplementedException();
 }
예제 #15
0
 public int Invoke(short fid, IFPValue result, IFPParams params_)
 {
     throw new NotImplementedException();
 }
 int IFPInterface.Invoke(short fid, int t, IFPValue result, IFPParams params_)
 {
     throw new NotImplementedException();
 }
 int IFPInterface._DispatchFn(short fid, int t, IFPValue result, IFPParams p)
 {
     throw new NotImplementedException();
 }