Ejemplo n.º 1
0
        public void OnAfterDeserialize()
        {
            if (surfaceInputSlot.generator == null)
            {
                surfaceInputSlot = InputSlot.CreateRequired <Surface>(this);
            }

            InputSlot.ResetAssetTypeIfNull <Surface>(surfaceInputSlot);
            InputSlot.ResetAssetTypeIfNull <Topology>(topologyInputSlot);
            InputSlot.ResetAssetTypeIfNull <IEdgeAttribute <Vector3> >(vertexPositionsInputSlot);
            InputSlot.ResetAssetTypeIfNull <IFaceAttribute <Vector3> >(facePositionsInputSlot);

            OutputSlot.ResetAssetTypeIfNull <IEdgeAttribute <Vector3> >(bisectorsOutputSlot);
        }
Ejemplo n.º 2
0
        private void UpdateVertexAttributeInputSlots <TAttributeValue>(bool use, ref InputSlot[] ringVertexAttributesInputSlots, ref InputSlot[] centerVertexAttributesInputSlots)
        {
            if (use == false)
            {
                if (ringVertexAttributesInputSlots.Length > 0)
                {
                    for (int i = 0; i < ringVertexAttributesInputSlots.Length; ++i)
                    {
                        ringVertexAttributesInputSlots[i].Disconnect();
                    }
                    ringVertexAttributesInputSlots = new InputSlot[0];
                }
            }
            else
            {
                if (ringVertexAttributesInputSlots.Length != ringDepth)
                {
                    var newArray = new InputSlot[ringDepth];
                    System.Array.Copy(ringVertexAttributesInputSlots, newArray, Mathf.Min(ringVertexAttributesInputSlots.Length, ringDepth));
                    for (int i = ringVertexAttributesInputSlots.Length; i < ringDepth; ++i)
                    {
                        newArray[i] = InputSlot.CreateRequired <IEdgeAttribute <TAttributeValue> >(this);
                    }
                    for (int i = ringDepth; i < ringVertexAttributesInputSlots.Length; ++i)
                    {
                        ringVertexAttributesInputSlots[i].Disconnect();
                    }
                    ringVertexAttributesInputSlots = newArray;
                }
            }

            if (use == false || triangulation != Triangulation.Umbrella)
            {
                if (centerVertexAttributesInputSlots.Length > 0)
                {
                    centerVertexAttributesInputSlots[0].Disconnect();
                    centerVertexAttributesInputSlots = new InputSlot[0];
                }
            }
            else
            {
                if (centerVertexAttributesInputSlots.Length == 0)
                {
                    centerVertexAttributesInputSlots = new InputSlot[] { InputSlot.CreateRequired <IFaceAttribute <TAttributeValue> >(this) };
                }
            }
        }