Exemplo n.º 1
0
        public override Type GCode_GetType(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (element == mCtrlvalue_VectorOut)
            {
                return(mValueType);
            }
            else
            {
                foreach (var data in mLinkOutDic)
                {
                    if (data.Element == element)
                    {
                        return(typeof(System.Single));
                    }
                }
                foreach (var data in mLinkInDic)
                {
                    if (data.Element == element)
                    {
                        return(typeof(System.Single));
                    }
                }
            }

            return(mValueType);
        }
Exemplo n.º 2
0
        public override string GCode_GetValueName(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            switch (CSParam.ConstructParam)
            {
            case "+":
                return("(" + m_strValueName1 + " + " + m_strValueName2 + ")");

            case "-":
                return("(" + m_strValueName1 + " - " + m_strValueName2 + ")");

            case "×":
                return("(" + m_strValueName1 + " * " + m_strValueName2 + ")");

            case "·":       // 点乘
            case "dot":
                return("dot(" + m_strValueName1 + " ," + m_strValueName2 + ")");

            case "÷":
                return("(" + m_strValueName1 + "/" + m_strValueName2 + ")");

            case "cross":      // 叉乘
            {
                if ((Value1.GetLinkType(0, true) == enLinkType.Float2 && Value2.GetLinkType(0, true) == enLinkType.Float2) ||
                    (Value1.GetLinkType(0, true) == enLinkType.Float3 && Value2.GetLinkType(0, true) == enLinkType.Float3) ||
                    (Value1.GetLinkType(0, true) == enLinkType.Float4 && Value2.GetLinkType(0, true) == enLinkType.Float4))
                {
                    return("cross(" + m_strValueName1 + ", " + m_strValueName2 + ")");
                }

                return("(" + m_strValueName1 + " * " + m_strValueName2 + ")");
            }
            }

            return(base.GCode_GetValueName(element, context));
        }
Exemplo n.º 3
0
        public override CodeExpression GCode_CodeDom_GetValue(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context, CodeGenerateSystem.Base.GenerateCodeContext_PreNode preNodeContext = null)
        {
            string current = "";

            if (preNodeContext?.NeedDereferencePoint == true && ElementType.IsPointer)
            {
                current = $"(*current_{EngineNS.Editor.Assist.GetValuedGUIDString(this.Id)})";
            }
            else
            {
                current = "current_" + EngineNS.Editor.Assist.GetValuedGUIDString(this.Id);
            }
            if (element == mCtrlArrayElement)
            {
                return(new CodeSnippetExpression(current));
            }
            else if (element == mCtrlArrayIndex)
            {
                return(new CodeSnippetExpression($"index_{EngineNS.Editor.Assist.GetValuedGUIDString(this.Id)}"));
            }
            else if (element == mCtrlDicKey)
            {
                current += ".Key";
                return(new CodeSnippetExpression(current));
            }
            else if (element == mCtrlDicValue)
            {
                current += ".Value";
                return(new CodeSnippetExpression(current));
            }
            return(base.GCode_CodeDom_GetValue(element, context));
        }
Exemplo n.º 4
0
        public override string GCode_GetValueName(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (element == TextureLink)
            {
                return(GetTextureSampName());
            }
            else if (element == RGBALink)
            {
                return(GetTextureName() + "_CUBE");
            }
            else if (element == RGBLink)
            {
                return(GetTextureName() + "_CUBE.xyz");
            }
            else if (element == RLink)
            {
                return(GetTextureName() + "_CUBE.x");
            }
            else if (element == GLink)
            {
                return(GetTextureName() + "_CUBE.y");
            }
            else if (element == BLink)
            {
                return(GetTextureName() + "_CUBE.z");
            }
            else if (element == ALink)
            {
                return(GetTextureName() + "_CUBE.w");
            }

            return(base.GCode_GetValueName(element, context));
        }
Exemplo n.º 5
0
        public override string GCode_GetTypeString(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (element == TextureLink)
            {
                return("sampler2D");
            }
            else if (element == RGBALink)
            {
                return("float4");
            }
            else if (element == RGBLink)
            {
                return("float3");
            }
            else if (element == RLink)
            {
                return("float1");
            }
            else if (element == GLink)
            {
                return("float1");
            }
            else if (element == BLink)
            {
                return("float1");
            }
            else if (element == ALink)
            {
                return("float1");
            }

            return(base.GCode_GetTypeString(element, context));
        }
        void InitializeLinkControl(LABlendPosePerBoneControlConstructionParams csParam)
        {
            mSrcPoseLinkHandle              = SrcPoseHandle;
            mDescPoseLinkHandle             = DescPoseHandle;
            mAlphaValueLinkHandle           = AlphaValueHandle;
            mOutLinkHandle                  = OutPoseHandle;
            mSrcPoseLinkHandle.MultiLink    = false;
            mDescPoseLinkHandle.MultiLink   = false;
            mAlphaValueLinkHandle.MultiLink = false;
            mOutLinkHandle.MultiLink        = false;

            mSrcPoseLinkHandle.NameStringVisible  = Visibility.Visible;
            mSrcPoseLinkHandle.NameString         = "SourceePose";
            mDescPoseLinkHandle.NameStringVisible = Visibility.Visible;
            mDescPoseLinkHandle.NameString        = "DestinationPose";
            //mAdditiveLinkHandle.NameStringVisible = Visibility.Visible;
            //mAdditiveLinkHandle.NameString = "AdditivePose";
            mAlphaValueLinkHandle.NameStringVisible = Visibility.Visible;
            mAlphaValueLinkHandle.NameString        = "Alpha";
            AlphaValueTextBlock.Visibility          = Visibility.Visible;
            mAlphaValueLinkHandle.OnAddLinkInfo    += AlphaValueLinkHandle_OnAddLinkInfo;
            mAlphaValueLinkHandle.OnDelLinkInfo    += AlphaValueLinkHandle_OnDelLinkInfo;
            AddLinkPinInfo("SrcPoseLinkHandle", mSrcPoseLinkHandle, null);
            AddLinkPinInfo("DescPoseLinkHandle", mDescPoseLinkHandle, null);
            AddLinkPinInfo("AlphaValueLinkHandle", mAlphaValueLinkHandle, null);
            AddLinkPinInfo("OutLinkHandle", mOutLinkHandle, null);
        }
Exemplo n.º 7
0
        void InitializeLinkControl(LACCDIKControlConstructionParams csParam)
        {
            mActiveValueLinkHandle           = ActiveValueHandle;
            mInPoseLinkHandle                = InPoseHandle;
            mAlphaValueLinkHandle            = AlphaValueHandle;
            mOutLinkHandle                   = OutPoseHandle;
            mActiveValueLinkHandle.MultiLink = false;
            mInPoseLinkHandle.MultiLink      = false;
            mAlphaValueLinkHandle.MultiLink  = false;
            mOutLinkHandle.MultiLink         = false;

            mActiveValueLinkHandle.NameStringVisible = Visibility.Visible;
            mActiveValueLinkHandle.NameString        = "EffectorLocation";
            mActiveValueLinkHandle.OnAddLinkInfo    += ActiveValueLinkHandle_OnAddLinkInfo;
            mActiveValueLinkHandle.OnDelLinkInfo    += ActiveValueLinkHandle_OnDelLinkInfo;

            mInPoseLinkHandle.NameStringVisible = Visibility.Visible;
            mInPoseLinkHandle.NameString        = "Pose";
            //mAdditiveLinkHandle.NameStringVisible = Visibility.Visible;
            //mAdditiveLinkHandle.NameString = "AdditivePose";
            mAlphaValueLinkHandle.NameStringVisible = Visibility.Visible;
            mAlphaValueLinkHandle.NameString        = "Alpha";
            AlphaValueTextBlock.Visibility          = Visibility.Visible;
            mAlphaValueLinkHandle.OnAddLinkInfo    += AlphaValueLinkHandle_OnAddLinkInfo;
            mAlphaValueLinkHandle.OnDelLinkInfo    += AlphaValueLinkHandle_OnDelLinkInfo;
            AddLinkPinInfo("ActiveValueLinkHandle", mActiveValueLinkHandle, null);
            AddLinkPinInfo("InPoseLinkHandle", mInPoseLinkHandle, null);
            AddLinkPinInfo("AlphaValueLinkHandle", mAlphaValueLinkHandle, null);
            AddLinkPinInfo("OutLinkHandle", mOutLinkHandle, null);
        }
Exemplo n.º 8
0
        public override string GCode_GetValueName(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (element == null || element == mReturnValueHandle)
            {
                return("FuncRetValue_" + EngineNS.Editor.Assist.GetValuedGUIDString(Id));
            }
            else
            {
                stParamData valData;
                if (mOutValueDataDictionary.TryGetValue(element, out valData))
                {
                    if (valData.mStrAttribute == "out")
                    {
                        return("FuncTempValue_" + EngineNS.Editor.Assist.GetValuedGUIDString(Id) + "_" + valData.mPos);
                    }
                    else
                    {
                        var lOI = valData.mInElement;
                        if (lOI.HasLink)
                        {
                            return(lOI.GetLinkedObject(0, true).GCode_GetValueName(lOI.GetLinkedPinControl(0, true), context));
                        }
                        else
                        {
                            return("FuncTempValue_" + EngineNS.Editor.Assist.GetValuedGUIDString(Id) + "_" + valData.mPos);
                        }
                    }
                }
            }

            return(base.GCode_GetValueName(element, context));
        }
Exemplo n.º 9
0
        public override string GCode_GetValueName(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            string vecName = "vec_" + EngineNS.Editor.Assist.GetValuedGUIDString(Id);

            if (element == null || element == mCtrlvalue_VectorOut)
            {
                return(vecName);
            }
            else
            {
                foreach (var data in mLinkOutDic)
                {
                    if (data.Element == element)
                    {
                        return(vecName + "." + data.KeyName);
                    }
                }
                foreach (var data in mLinkInDic)
                {
                    if (data.Element == element)
                    {
                        return(vecName + "." + data.KeyName);
                    }
                }
            }

            return(vecName);
        }
Exemplo n.º 10
0
        void AddFloatValue(string keyName)
        {
            var inCtrl  = new CodeGenerateSystem.Base.LinkPinControl();
            var outCtrl = new CodeGenerateSystem.Base.LinkPinControl();

            AddFloatValue_WPF(
                (inC) =>
            {
                inCtrl = inC;
            },
                (outC) =>
            {
                outCtrl = outC;
            },
                keyName);
            AddLinkPinInfo($"{keyName}_in", inCtrl, null);
            var linkData_In = new linkData()
            {
                Element = inCtrl,
                KeyName = keyName,
            };

            mLinkInDic.Add(linkData_In);

            AddLinkPinInfo($"{keyName}_out", outCtrl, null);
            var linkData_Out = new linkData()
            {
                Element = outCtrl,
                KeyName = keyName,
            };

            mLinkOutDic.Add(linkData_Out);
        }
Exemplo n.º 11
0
        void InitializeLinkControl(LAAnimPoseStreamControlConstructionParams csParam)
        {
            mCtrlValueLinkHandle           = ValueLinkHandle;
            mCtrlValueLinkHandle.MultiLink = false;

            AddLinkPinInfo("AnimPoseOutHandle", mCtrlValueLinkHandle, null);
            TitleImage = TryFindResource("AnimationNode_AnimationClip_64x") as ImageSource;
        }
Exemplo n.º 12
0
        public override string GCode_GetTypeString(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (InputLink.HasLink)
            {
                return(InputLink.GetLinkedObject(0, true).GCode_GetTypeString(InputLink.GetLinkedPinControl(0, true), context));
            }

            return(base.GCode_GetTypeString(element, context));
        }
Exemplo n.º 13
0
        public override string GCode_GetValueName(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (InputLink.HasLink)
            {
                string strInputValueName = InputLink.GetLinkedObject(0, true).GCode_GetValueName(InputLink.GetLinkedPinControl(0, true), context);
                return("abs(" + strInputValueName + ")");
            }

            return(base.GCode_GetValueName(element, context));
        }
Exemplo n.º 14
0
        public override string GCode_GetTypeString(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            stParamData valData;

            if (mOutValueDataDictionary.TryGetValue(element, out valData))
            {
                return(valData.mStrType);
            }

            return(base.GCode_GetTypeString(element, context));
        }
Exemplo n.º 15
0
        public override string GCode_GetTypeString(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (element == null || element == ResultLink)
            {
                if (Value1.HasLink)
                {
                    return(Value1.GetLinkedObject(0, true).GCode_GetTypeString(Value1.GetLinkedPinControl(0, true), context));
                }
            }

            return(base.GCode_GetTypeString(element, context));
        }
Exemplo n.º 16
0
 public ClickableLinkInfo(Canvas drawCanvas, LinkPinControl startObj, LinkPinControl endObj) : base(drawCanvas, startObj, endObj)
 {
     if (m_LinkPath != null)
     {
         m_LinkPath.MouseEnter     += LinkPath_MouseEnter;
         m_LinkPath.MouseDown      += LinkPath_MouseDown;
         m_LinkPath.MouseLeave     += LinkPath_MouseLeave;
         m_LinkPath.StrokeThickness = 2;
         m_LinkPath.Stroke          = Brushes.GhostWhite;
         Canvas.SetZIndex(m_LinkPath, 5);
     }
     timer.Elapsed += Timer_Elapsed;
 }
Exemplo n.º 17
0
        public override string GCode_GetTypeString(CodeGenerateSystem.Base.LinkPinControl element, GenerateCodeContext_Method context)
        {
            var param = CSParam as CommonValueConstructionParams;

            if (param.IsCommon)
            {
#warning 通用数值处理
                throw new InvalidOperationException();
            }
            else
            {
                return(EngineNS.Rtti.RttiHelper.GetAppTypeString(param.ValueType));
            }
        }
Exemplo n.º 18
0
 public override void RefreshFromLink(CodeGenerateSystem.Base.LinkPinControl pin, int linkIndex)
 {
     if (ElementType == typeof(object))
     {
         if (pin == mArrayInPin)
         {
             var listType = pin.GetLinkedObject(0, true).GCode_GetType(pin.GetLinkedPinControl(0, true), null);
             ElementType = listType.GetGenericArguments()[0];
         }
         else
         {
             throw new InvalidOperationException();
         }
     }
 }
Exemplo n.º 19
0
        public override Type GCode_GetType(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            var param = CSParam as CommonValueConstructionParams;

            if (param == null)
            {
                throw new InvalidOperationException();
            }
            if (param.IsCommon)
            {
#warning 通用数值处理
                throw new InvalidOperationException();
            }

            return(param.ValueType);
        }
Exemplo n.º 20
0
        public LinkInfo(Canvas drawCanvas, LinkPinControl startObj, LinkPinControl endObj)
        {
            if (startObj == null || endObj == null)
            {
                return;
            }

            m_linkFromObjectInfo = startObj;
            m_linkToObjectInfo   = endObj;

            LinkInfoConstruction(drawCanvas);

            if (CreateLink())
            {
                SetVisible(Visibility.Visible);
            }
        }
Exemplo n.º 21
0
        public override string GCode_GetValueName(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            if (element == TextureLink)
            {
                return(GetTextureSampName());
            }
            else if (element == Tex2DLink)
            {
                string uvName = "input.vUV";
                if (UVLink_2D.HasLink)
                {
                    uvName = UVLink_2D.GetLinkedObject(0, true).GCode_GetValueName(UVLink_2D.GetLinkedPinControl(0, true), context);
                }

                return("vise_tex2D(" + GetTextureName() + "," + GetTextureSampName() + "," + uvName + ")");
            }

            return(base.GCode_GetValueName(element, context));
        }
Exemplo n.º 22
0
        void InitializeLinkControl(LAMakeAdditivePoseControlConstructionParams csParam)
        {
            mRefLinkHandle                = RefPoseHandle;
            mAdditiveLinkHandle           = AdditivePoseHandle;
            mOutLinkHandle                = OutPoseHandle;
            mRefLinkHandle.MultiLink      = false;
            mAdditiveLinkHandle.MultiLink = false;
            mOutLinkHandle.MultiLink      = false;

            mRefLinkHandle.NameStringVisible      = Visibility.Visible;
            mRefLinkHandle.NameString             = "ReferencePose";
            mAdditiveLinkHandle.NameStringVisible = Visibility.Visible;
            mAdditiveLinkHandle.NameString        = "AdditivePose";
            //mAdditiveLinkHandle.NameStringVisible = Visibility.Visible;
            //mAdditiveLinkHandle.NameString = "AdditivePose";
            AddLinkPinInfo("RefLinkHandle", mRefLinkHandle, null);
            AddLinkPinInfo("AdditiveLinkHandle", mAdditiveLinkHandle, null);
            AddLinkPinInfo("OutLinkHandle", mOutLinkHandle, null);
        }
Exemplo n.º 23
0
        public override CodeExpression GCode_CodeDom_GetValue(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context, CodeGenerateSystem.Base.GenerateCodeContext_PreNode preNodeContext = null)
        {
            if (element == mCtrlvalue_VectorOut)
            {
                return(new System.CodeDom.CodeVariableReferenceExpression(GCode_GetValueName(null, context)));
            }
            else
            {
                foreach (var data in mLinkOutDic)
                {
                    if (data.Element == element)
                    {
                        return(new System.CodeDom.CodeVariableReferenceExpression(GCode_GetValueName(null, context) + "." + data.KeyName));
                    }
                }
            }

            return(base.GCode_CodeDom_GetValue(element, context));
        }
Exemplo n.º 24
0
        public override string GCode_GetValueName(CodeGenerateSystem.Base.LinkPinControl element, CodeGenerateSystem.Base.GenerateCodeContext_Method context)
        {
            string strInputValueNameX;
            string strInputValueNameY;
            string strInputValueNameAlpha;
            string strFinalInputValueNameAlpha;

            if (InputLinkX.HasLink && InputLinkY.HasLink && InputLinkAlpha.HasLink)
            {
                strInputValueNameX     = InputLinkX.GetLinkedObject(0, true).GCode_GetValueName(InputLinkX.GetLinkedPinControl(0, true), context);
                strInputValueNameY     = InputLinkY.GetLinkedObject(0, true).GCode_GetValueName(InputLinkY.GetLinkedPinControl(0, true), context);
                strInputValueNameAlpha = InputLinkAlpha.GetLinkedObject(0, true).GCode_GetValueName(InputLinkAlpha.GetLinkedPinControl(0, true), context);

                strFinalInputValueNameAlpha = strInputValueNameAlpha;
                switch (InputLinkX.GetLinkedObject(0, true).GCode_GetTypeString(InputLinkX.GetLinkedPinControl(0, true), context))
                {
                case "float4":
                {
                    strFinalInputValueNameAlpha = "float4(" + strInputValueNameAlpha + "," + strInputValueNameAlpha + "," + strInputValueNameAlpha + "," + strInputValueNameAlpha + ")";
                }
                break;

                case "float3":
                {
                    strFinalInputValueNameAlpha = "float3(" + strInputValueNameAlpha + "," + strInputValueNameAlpha + "," + strInputValueNameAlpha + ")";
                }
                break;

                case "float2":
                {
                    strFinalInputValueNameAlpha = "float2(" + strInputValueNameAlpha + "," + strInputValueNameAlpha + ")";
                }
                break;
                }

                return("lerp(" + strInputValueNameX + "," + strInputValueNameY + "," + strFinalInputValueNameAlpha + ")");
            }

            return(base.GCode_GetValueName(element, context));
        }