Example #1
0
        static FbxProperty GetDefinitionsProperty(FbxObjectManager ObjectManager)
        {
            var Defs = new FbxProperty("Definitions");

            Defs.AddProperty("Version", 100);

            Defs.AddProperty("Count", ObjectManager.Objects.Count);

            //	get types
            var TypeCounts = new Dictionary <string, int>();

            foreach (var Object in ObjectManager.Objects)
            {
                var TypeName = Object.TypeName;
                if (!TypeCounts.ContainsKey(TypeName))
                {
                    TypeCounts.Add(TypeName, 1);
                }
                else
                {
                    TypeCounts[TypeName]++;
                }
            }

            foreach (var TypeCount in TypeCounts)
            {
                var ot = Defs.AddProperty("ObjectType", TypeCount.Key);
                ot.AddProperty("Count", TypeCount.Value);
            }
            return(Defs);
        }
Example #2
0
        static FbxProperty GetHeaderProperty(string Creator = "Pop FbxAscii Exporter")
        {
            var Root = new FbxProperty("FBXHeaderExtension");

            Root.AddProperty("FBXHeaderVersion", 1003);
            Root.AddProperty("FBXVersion", Version);
            Root.AddProperty("Creator", Creator);

            //	won't load in unity without this comment at the top
            Root.AddComment("FBX " + VersionMajor + "." + VersionMinor + "." + VersionRelease.ToString("D2") + "  project file");
            return(Root);
        }
Example #3
0
        static void Export(System.Action <string> WriteLine, FbxObjectManager ObjectManager)
        {
            var ObjectPropertys = new FbxProperty("Objects");

            foreach (var Object in ObjectManager.Objects)
            {
                ObjectPropertys.AddProperty(Object.Definition);
            }
            Export(WriteLine, ObjectPropertys);
        }
Example #4
0
        static void Export(System.Action <string> WriteLine, FbxConnectionManager ConnectionsManager)
        {
            var ConnectionsProp = new FbxProperty("Connections");

            foreach (var Connection in ConnectionsManager.Connections)
            {
                //	meshes need "Connect", anims need "C"
                //	id vs name?
                var ConnectionProp = ConnectionsProp.AddProperty(Connection.ConnectionType.ToString());

                var Desc = string.Format("{0}::{1} -> {2}::{3}", Connection.type1, Connection.name1, Connection.type2, Connection.name2);
                ConnectionProp.AddComment("");
                ConnectionProp.AddComment(Desc);

                ConnectionProp.AddValue(Connection.Relation.ToString());

                /*
                 * if (Connection.ConnectionType == FbxConnectionType.Connect)
                 * {
                 *      ConnectionProp.AddValue(Connection.name1);
                 *      ConnectionProp.AddValue(Connection.name2);
                 *      //	"Model::" + ((Mesh)Value).name);
                 *      //	"Material::" + ((Material)Value).name);
                 * }
                 * else */if (Connection.ConnectionType == FbxConnectionType.C)
                {
                    ConnectionProp.AddValue(Connection.Object1.Ident);
                    ConnectionProp.AddValue(Connection.Object2.Ident);
                }

                if (Connection.PropertyName != null)
                {
                    ConnectionProp.AddValue(Connection.PropertyName);
                }
            }
            Export(WriteLine, ConnectionsProp);
        }