Browse our Products

Aspose.3D for Java 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 com.aspose.threed.StructuralMetadata:

        public com.aspose.threed.StructuralMetadata.ClassType createClass(String name)
        public com.aspose.threed.StructuralMetadata.EnumType createEnum(String name)
        public com.aspose.threed.StructuralMetadata.PropertyTable createPropertyTable(String name, com.aspose.threed.StructuralMetadata.ClassType clazz)
        public void attach(com.aspose.threed.Scene scene)

Sample code

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

        mesh.getControlPoints().add(new Vector4(3, 0, 0));
        mesh.getControlPoints().add(new Vector4(4, 0, 0));
        mesh.getControlPoints().add(new Vector4(4, 1, 0));
        mesh.getControlPoints().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.USER_DATA, MappingMode.CONTROL_POINT, ReferenceMode.DIRECT);
        //the features id
        featureId.setData(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.setName("_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 StructuralMetadata.EnumValue[][] {
            new StructuralMetadata.EnumValue[]{ENUM_A, ENUM_A},
            new StructuralMetadata.EnumValue[]{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);
        
        //Save it to glTF that utilized the EXT_mesh_features and EXT_structural_metadata extensions
        scene.save("test.glb");

Added members to class com.aspose.threed.StructuralMetadata.ClassType:

        public com.aspose.threed.StructuralMetadata.Property addProperty(String name, com.aspose.threed.StructuralMetadata.EnumType type, Boolean array, int count)

Added members to class com.aspose.threed.StructuralMetadata.EnumType:

        public com.aspose.threed.StructuralMetadata.EnumValue addValue(String name, int value)

Added members to class com.aspose.threed.StructuralMetadata.Property:

        public com.aspose.threed.StructuralMetadata.EnumType getEnumType()
        public void setEnumType(com.aspose.threed.StructuralMetadata.EnumType value)

Added members to class com.aspose.threed.StructuralMetadata.PropertyTable:

        public Object getValue(String name)
        public static com.aspose.threed.StructuralMetadata.PropertyTable from(com.aspose.threed.VertexElementUserData userData)
        public void attach(com.aspose.threed.VertexElementUserData userData)