public override void WriteParams(System.Xml.XmlWriter writer, Dictionary <HavokClassNode, int> classNodes)
 {
     if (Children.Count > 0)
     {
         writer.WriteString(HavokXML.GetObjectName(classNodes, Children[0] as HavokClassNode));
     }
 }
Exemplo n.º 2
0
        public void WriteParams(System.Xml.XmlWriter writer, Dictionary <HavokClassNode, int> classNodes)
        {
            writer.WriteStartElement("hkobject");
            {
                writer.WriteStartElement("hkparam");
                writer.WriteAttributeString("name", "name");
                writer.WriteString(Name);
                writer.WriteEndElement();

                HavokClassNode c = string.IsNullOrEmpty(_class) ? null : HavokNode.GetClassNode(_class);
                writer.WriteStartElement("hkparam");
                writer.WriteAttributeString("name", "class");
                writer.WriteString(c != null ? HavokXML.GetObjectName(classNodes, c) : "null");
                writer.WriteEndElement();

                HavokClassNode e = string.IsNullOrEmpty(_enum) ? null : HavokNode.GetClassNode(_enum);
                writer.WriteStartElement("hkparam");
                writer.WriteAttributeString("name", "enum");
                writer.WriteString(e != null ? HavokXML.GetObjectName(classNodes, e) : "null");
                writer.WriteEndElement();

                writer.WriteStartElement("hkparam");
                writer.WriteAttributeString("name", "type");
                string type = Type.ToString();
                if (type == "TYPE_CSTRING")
                {
                    type = "TYPE_STRINGPTR";
                }

                writer.WriteString(type);
                writer.WriteEndElement();

                writer.WriteStartElement("hkparam");
                writer.WriteAttributeString("name", "subtype");
                writer.WriteString(SubType.ToString());
                writer.WriteEndElement();

                writer.WriteStartElement("hkparam");
                writer.WriteAttributeString("name", "cArraySize");
                writer.WriteString(ArraySize.ToString(CultureInfo.InvariantCulture));
                writer.WriteEndElement();

                writer.WriteStartElement("hkparam");
                writer.WriteAttributeString("name", "flags");
                writer.WriteString(((int)Flags).ToString(CultureInfo.InvariantCulture));
                writer.WriteEndElement();

                writer.WriteStartElement("hkparam");
                writer.WriteAttributeString("name", "offset");
                writer.WriteString(OffsetInStruct.ToString(CultureInfo.InvariantCulture));
                writer.WriteEndElement();

                writer.WriteComment(" attributes SERIALIZE_IGNORED ");
            }
            writer.WriteEndElement();
        }
Exemplo n.º 3
0
 public override void Export(string outPath)
 {
     if (outPath.ToUpper().EndsWith(".XML"))
     {
         HavokXML.Serialize(this, outPath);
     }
     //else if (outPath.ToUpper().EndsWith(".PMD"))
     //    PMDModel.Export(this, outPath);
     //else if (outPath.ToUpper().EndsWith(".RMDL"))
     //    XMLExporter.ExportRMDL(this, outPath);
     else
     {
         base.Export(outPath);
     }
 }
 public override void WriteParams(System.Xml.XmlWriter writer, Dictionary <HavokClassNode, int> classNodes)
 {
     if (Children.Count > 0)
     {
         HavokClassNode n = Children[0] as HavokClassNode;
         if (n is HavokMetaObjectNode || n is hkClassNode)
         {
             writer.WriteString(HavokXML.GetObjectName(classNodes, n));
         }
         else
         {
             n.WriteParams(writer, classNodes);
         }
     }
 }
Exemplo n.º 5
0
        public override void WriteParams(System.Xml.XmlWriter writer, Dictionary <HavokClassNode, int> classNodes)
        {
            writer.WriteAttributeString("numelements",
                                        Children.Count.ToString(System.Globalization.CultureInfo.InvariantCulture));

            writer.WriteString(" ");
            foreach (HavokClassNode c in Children)
            {
                //Arrays embed parameters instead of pointing to an object containing them elsewhere

                HavokClassNode c2 = c;
                if (c is cmPointerNode && c.Children.Count > 0)
                {
                    c2 = c.Children[0] as HavokClassNode;
                }

                if (c2 is HavokMetaObjectNode || c2 is hkClassNode)
                {
                    ResourceNode[] nodes = c2.FindChildrenByClassType(null, typeof(HavokMetaObjectNode));
                    if (nodes == null && nodes.Length == 0)
                    {
                        writer.WriteStartElement("hkobject");
                        c2.WriteParams(writer, classNodes);
                        writer.WriteEndElement();
                    }
                    else
                    {
                        writer.WriteString(HavokXML.GetObjectName(classNodes, c2));
                    }
                }
                else if (c2 is cmStringNode)
                {
                    writer.WriteStartElement("hkstring");
                    c2.WriteParams(writer, classNodes);
                    writer.WriteEndElement();
                }
                else
                {
                    c2.WriteParams(writer, classNodes);
                }

                writer.WriteString(" ");
            }
        }
Exemplo n.º 6
0
        public override void WriteParams(System.Xml.XmlWriter writer, Dictionary <HavokClassNode, int> classNodes)
        {
            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "name");
            writer.WriteString(Name);
            writer.WriteEndElement();

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "parent");
            writer.WriteString(_parent is HavokClassNode
                ? HavokXML.GetObjectName(classNodes, _parent as HavokClassNode)
                : "null");
            writer.WriteEndElement();

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "objectSize");
            writer.WriteString(Size.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "numImplementedInterfaces");
            writer.WriteString(InterfaceCount.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            ResourceNode enums = FindChild("Enums", false);

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "declaredEnums");
            writer.WriteAttributeString("numelements", enums == null ? "0" : enums.Children.Count.ToString());
            {
                if (enums != null)
                {
                    foreach (hkClassEnumNode e in enums.Children)
                    {
                        e.WriteParams(writer, classNodes);
                    }
                }
            }
            writer.WriteEndElement();

            ResourceNode members = FindChild("Members", false);

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "declaredMembers");
            writer.WriteAttributeString("numelements", members == null ? "0" : members.Children.Count.ToString());
            {
                if (members != null)
                {
                    foreach (hkClassMemberNode e in members.Children)
                    {
                        e.WriteParams(writer, classNodes);
                    }
                }
            }
            writer.WriteEndElement();

            writer.WriteComment(" defaults SERIALIZE_IGNORED ");
            writer.WriteComment(" attributes SERIALIZE_IGNORED ");

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "flags");
            writer.WriteString(Flags.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            writer.WriteStartElement("hkparam");
            writer.WriteAttributeString("name", "describedVersion");
            writer.WriteString(Version.ToString(CultureInfo.InvariantCulture));
            writer.WriteEndElement();
        }