Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public void BakeAnimationsFrame(IINode node, BakeAnimationType bakeAnimationType)
        {
            if (bakeAnimationType == BakeAnimationType.DoNotBakeAnimation)
            {
                return;
            }

            IINode hierachyRoot = (node != null) ? node : Loader.Core.RootNode;

#if MAX2020 || MAX2021 || MAX2022
            var tobake = Loader.Global.INodeTab.Create();
#else
            var tobake = Loader.Global.NodeTab.Create();
#endif
            if (bakeAnimationType == BakeAnimationType.BakeSelective)
            {
                foreach (IINode iNode in hierachyRoot.NodeTree())
                {
                    if (iNode.IsMarkedAsObjectToBakeAnimation())
                    {
                        tobake.AppendNode(iNode, false, 0);
                    }
                }
            }


            if (!hierachyRoot.IsRootNode)
            {
                tobake.AppendNode(hierachyRoot, false, 0);
            }

            Loader.Core.SelectNodeTab(tobake, true, false);

            if (bakeAnimationType == BakeAnimationType.BakeAllAnimations)
            {
                foreach (IINode n in tobake.ToIEnumerable())
                {
                    n.SetUserPropBool("babylonjs_BakeAnimation", true);
                }
            }

            ScriptsUtilities.ExecuteMaxScriptCommand(@"
                sel = selection
                selNodeNames = for s in sel collect s.name
                temps = #()

                for objn in selNodeNames do 
                (
	                obj = getNodeByName objn
	
	                tag = getUserProp obj ""babylonjs_BakeAnimation""

                    if tag != true then continue

                    tmp = undefined

                    tmp = Point()

                    tmp.name = obj.name

                    append temps tmp
                    --store anim to a point

                    for t = animationRange.start to animationRange.end do (
                       with animate on at time t tmp.transform = obj.transform
	                   )
                )

                i = 1
                for objn in selNodeNames do
                (
                    obj = getNodeByName objn
                    tag = getUserProp obj ""babylonjs_BakeAnimation""
                    if tag != true then continue

                    --remove constraint on original object
                    if classOf(obj.transform.controller) == IKControl do (
                        refdep = refs.dependents(obj.transform.controller)
                        for rd in refdep do (
                            if classOf(rd) == IK_Chain_Object do (
                                delete rd
                            )
		                )
	                )
	
	                obj.transform.controller = Link_Constraint()
                    obj.transform.controller = prs()
                    obj.transform = temps[i].transform

                    --copy back anim from point
                     for t = animationRange.start to animationRange.end do (
                        with animate on at time t obj.transform = temps[i].transform
                       )
	
	                i += 1
                )

                for t in temps do (
                    delete t
                )
             ");
        }