Example #1
0
 /// <summary>
 /// Create a new Instance
 /// </summary>
 /// <param name="parent">The gmdc that should act as Parent</param>
 public ImportedGroup(GeometryDataContainer parent) : base()
 {
     keeporder  = true;
     group      = new GmdcGroup(parent);
     link       = new GmdcLink(parent);
     elements   = new GmdcElements();
     useinbmesh = false;
 }
Example #2
0
        /// <summary>
        /// Create a clone of this Object
        /// </summary>
        /// <returns>The clone</returns>
        public override object Clone()
        {
            GmdcElements list = new GmdcElements();

            foreach (GmdcElement item in this)
            {
                list.Add(item);
            }

            return(list);
        }
Example #3
0
        /// <summary>
        /// Makes sure that the Aliaslists are not used!
        /// </summary>
        public void Flatten()
        {
            GmdcElement vn = new GmdcElement(this.parent);
            GmdcElement vt = new GmdcElement(this.parent);

            GmdcElement ovn = this.FindElementType(ElementIdentity.Normal);
            GmdcElement ovt = this.FindElementType(ElementIdentity.UVCoordinate);

            //contains a List of all additional Elements assigned to this Link, which
            //are related to the Vertex Element (like BoneWeights)
            GmdcElements ovelements = new GmdcElements();
            GmdcElements velements  = new GmdcElements();

            ovelements.Add(this.FindElementType(ElementIdentity.Vertex));
            velements.Add(new GmdcElement(this.Parent));

            int nv  = this.GetElementNr(ovelements[0]);
            int nvn = this.GetElementNr(ovn);
            int nvt = this.GetElementNr(ovt);

            //add all other Elements
            foreach (int i in this.ReferencedElement)
            {
                if (ovelements.Contains(parent.Elements[i]) || parent.Elements[i] == ovn || parent.Elements[i] == ovt)
                {
                    continue;
                }
                ovelements.Add(parent.Elements[i]);
                velements.Add(new GmdcElement(this.Parent));
            }

            for (int i = 0; i < this.ReferencedSize; i++)
            {
                for (int j = 0; j < velements.Length; j++)
                {
                    velements[j].Values.Add(ovelements[j].Values[this.GetRealIndex(nv, i)]);
                }

                if (ovn != null)
                {
                    vn.Values.Add(ovn.Values[this.GetRealIndex(nvn, i)]);
                }
                if (ovt != null)
                {
                    vt.Values.Add(ovt.Values[this.GetRealIndex(nvt, i)]);
                }
            }

            for (int i = 0; i < velements.Length; i++)
            {
                ovelements[i].Values = velements[i].Values;
                ovelements[i].Number = velements[i].Number;
            }
            if (ovn != null)
            {
                ovn.Values = vn.Values;
                ovn.Number = ReferencedSize;
            }
            if (ovt != null)
            {
                ovt.Values = vt.Values;
                ovt.Number = ReferencedSize;
            }

            for (int i = 0; i < this.AliasValues.Length; i++)
            {
                this.AliasValues[i].Clear();
            }
        }