Esempio n. 1
0
        public static bool IsHighlight(this IBiaNodeLink self)
        {
            var item1 = self.SourceSlot.Item ?? throw new NullReferenceException();
            var item2 = self.TargetSlot.Item ?? throw new NullReferenceException();

            return(item1.IsSelected || item1.IsPreSelected || item1.IsMouseOver ||
                   item2.IsSelected || item2.IsPreSelected || item2.IsMouseOver);
        }
Esempio n. 2
0
        public static void MakeBezierCurve(this IBiaNodeLink self, Span <ImmutableVec2_float> result)
        {
            var item1 = self.ItemSlot1.Item ?? throw new NullReferenceException();
            var item2 = self.ItemSlot2.Item ?? throw new NullReferenceException();

            var pos1  = item1.MakeSlotPosDefault(self.InternalData().Slot1 !);
            var pos2  = item2.MakeSlotPosDefault(self.InternalData().Slot2 !);
            var pos1C = BiaNodeEditorHelper.MakeBezierControlPoint(pos1, self.InternalData().Slot1 !.Dir);
            var pos2C = BiaNodeEditorHelper.MakeBezierControlPoint(pos2, self.InternalData().Slot2 !.Dir);

            result[0] = new ImmutableVec2_float((float)pos1.X, (float)pos1.Y);
            result[1] = new ImmutableVec2_float((float)pos1C.X, (float)pos1C.Y);
            result[2] = new ImmutableVec2_float((float)pos2C.X, (float)pos2C.Y);
            result[3] = new ImmutableVec2_float((float)pos2.X, (float)pos2.Y);
        }
Esempio n. 3
0
        internal static InternalBiaNodeLinkData InternalData(this IBiaNodeLink self)
        {
            InternalBiaNodeLinkData internalData;

            if (self.InternalData == null)
            {
                internalData = new InternalBiaNodeLinkData
                {
                    Slot1 = self.ItemSlot1.FindSlot(),
                    Slot2 = self.ItemSlot2.FindSlot()
                };
                self.InternalData = internalData;
            }
            else
            {
                internalData = (InternalBiaNodeLinkData)self.InternalData;
            }

            return(internalData);
        }
Esempio n. 4
0
        internal static InternalBiaNodeLinkData InternalData(this IBiaNodeLink self)
        {
            InternalBiaNodeLinkData internalData;

            if (self.InternalData is null)
            {
                internalData = new InternalBiaNodeLinkData
                {
                    Slot1 = self.SourceSlot.FindSlot(),
                    Slot2 = self.TargetSlot.FindSlot()
                };
                self.InternalData = internalData;
            }
            else
            {
                internalData = (InternalBiaNodeLinkData)self.InternalData;
            }

            return(internalData);
        }
Esempio n. 5
0
 public static void Reset(this IBiaNodeLink self)
 {
     self.InternalData = null;
 }
Esempio n. 6
0
 public static bool IsLinked(this IBiaNodeLink self)
 {
     return(self.InternalData().Slot1 != null &&
            self.InternalData().Slot2 != null);
 }
Esempio n. 7
0
        public static ValueTuple <ImmutableVec2_double, ImmutableVec2_double, ImmutableVec2_double, ImmutableVec2_double> MakeBezierCurve(this IBiaNodeLink self)
        {
            var item1 = self.ItemSlot1.Item ?? throw new NullReferenceException();
            var item2 = self.ItemSlot2.Item ?? throw new NullReferenceException();

            var pos1  = item1.MakeSlotPosDefault(self.InternalData().Slot1 !);
            var pos2  = item2.MakeSlotPosDefault(self.InternalData().Slot2 !);
            var pos1C = BiaNodeEditorHelper.MakeBezierControlPoint(pos1, self.InternalData().Slot1 !.Dir);
            var pos2C = BiaNodeEditorHelper.MakeBezierControlPoint(pos2, self.InternalData().Slot2 !.Dir);

            return(pos1, pos1C, pos2C, pos2);
        }