Browse our Products

Aspose.3D for .NET 25.5 Release Notes

Improvements and Changes

KeySummaryCategory
THREEDNET-1674Fix EXT_structural_metadata import is not always workingTask
THREEDNET-1678Add enum type support for EXT_structural_metadataTask
THREEDNET-1651Add meta data export using extension EXT_structural_metadata for glTFNew Feature
THREEDNET-1676Link property table to VertexElementUserDataNew Feature

API Changes

Added members to class Aspose.ThreeD.Formats.GLTF.StructuralMetadata:

        public Aspose.ThreeD.Formats.GLTF.StructuralMetadata.ClassType CreateClass(string name)
        public Aspose.ThreeD.Formats.GLTF.StructuralMetadata.EnumType CreateEnum(string name)
        public Aspose.ThreeD.Formats.GLTF.StructuralMetadata.PropertyTable CreatePropertyTable(string name, Aspose.ThreeD.Formats.GLTF.StructuralMetadata.ClassType clazz)
        public void Attach(Aspose.ThreeD.Scene scene)

Sample code

            //This sample will create a glTF file with EXT_mesh_features
            //first we create a mesh
            var mesh = new Mesh();
            mesh.ControlPoints.Add(new Vector4(0, 1, 0));
            mesh.ControlPoints.Add(new Vector4(2, 1, 0));
            mesh.ControlPoints.Add(new Vector4(2, 2, 0));
            mesh.ControlPoints.Add(new Vector4(1, 2, 0));

            mesh.ControlPoints.Add(new Vector4(3, 0, 0));
            mesh.ControlPoints.Add(new Vector4(4, 0, 0));
            mesh.ControlPoints.Add(new Vector4(4, 1, 0));
            mesh.ControlPoints.Add(new Vector4(3, 1, 0));

            mesh.CreatePolygon(0, 1, 2);
            mesh.CreatePolygon(0, 2, 3);
            mesh.CreatePolygon(4, 5, 6);
            mesh.CreatePolygon(4, 6, 7);

            //then we create a user data, this user data will apply feature id to control point
            var featureId = (VertexElementUserData) mesh.CreateElement(VertexElementType.UserData, MappingMode.ControlPoint, ReferenceMode.Direct);
            //the features id
            featureId.Data = new float[] { 0, 0, 0, 0, 1, 1, 1, 1};
            //here we'll provide a EXT_mesh_features compatible attribute name so the glTF exporter can recognize
            featureId.Name = "_FEATURE_ID_0";


            //now create a property table for each features
            var smd = new StructuralMetadata();
            var metaClass = smd.CreateClass("test_class");
            var enumType = smd.CreateEnum("test_enum");
            var ENUM_A = enumType.AddValue("ENUM_A", 0);
            var ENUM_B = enumType.AddValue("ENUM_B", 1);


            metaClass.AddProperty("enum_value", enumType, true);

            var propTable = smd.CreatePropertyTable("example", metaClass);
            // The featureId.Data has only two features, 0 and 1, so here we only need two data for two features.
            propTable.AddValue("enum_value", new [] { 
                new []{ENUM_A, ENUM_A},
                new []{ENUM_A, ENUM_B, ENUM_B },
            });

            //attach metadata to scene and property table to user data to make them exportable
            var scene = new Scene(mesh);

            smd.Attach(scene);
            propTable.Attach(featureId);

	    //Now exports to glTF file
	    scene.Save("test.glb");

Added members to class Aspose.ThreeD.Formats.GLTF.StructuralMetadata.ClassType:

        public Aspose.ThreeD.Formats.GLTF.StructuralMetadata.Property AddProperty(string name, Aspose.ThreeD.Formats.GLTF.StructuralMetadata.EnumType type, bool array, System.Nullable<int> count)

Added members to class Aspose.ThreeD.Formats.GLTF.StructuralMetadata.EnumType:

        public Aspose.ThreeD.Formats.GLTF.StructuralMetadata.EnumValue AddValue(string name, int value)

Added members to class Aspose.ThreeD.Formats.GLTF.StructuralMetadata.Property:

        Aspose.ThreeD.Formats.GLTF.StructuralMetadata.EnumType EnumType{ get;set;}

Added members to class Aspose.ThreeD.Formats.GLTF.StructuralMetadata.PropertyTable:

        public object GetValue(string name)
        public static Aspose.ThreeD.Formats.GLTF.StructuralMetadata.PropertyTable From(Aspose.ThreeD.Entities.VertexElementUserData userData)
        public void Attach(Aspose.ThreeD.Entities.VertexElementUserData userData)