Working with Verify Watermark

Contents
[ ]

Create a 3D Scene

First you need to create a 3d scene from a 3d file.The following code snippet shows how to use this functionality:

var aspose = aspose || {};

aspose.threed = require("aspose.3d");

var scene = aspose.threed.Scene.fromFile("output.fbx");

Decode Watermark

Aspose.3D uses the decodeWatermark method to confirm the watermark for the 3d file after filling in the password. The following code snippet shows how to use this functionality:

var aspose = aspose || {};

aspose.threed = require("aspose.3d");

// Walks the node tree and reads the blind watermark of the first mesh that carries one
function decodeWatermark(node) {
    var entity = node.getEntity();
    if (entity instanceof aspose.threed.Mesh) {
        var text = aspose.threed.Watermark.decodeWatermark(entity, "1234");
        if (text != null) {
            return text;
        }
    }
    var children = node.getChildNodes();
    for (var i = 0; i < children.size(); i++) {
        var text = decodeWatermark(children.get(i));
        if (text != null) {
            return text;
        }
    }
    return null;
}

var text = decodeWatermark(scene.getRootNode());
console.log("Watermark: " + text);

Document Confirmation

For the returned result, if the returned result is null, it means that there is no watermark added to the 3d document. If it returns text information, it is the watermark of the 3d file. If the password is entered incorrectly, an exception is thrown.