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:

from aspose.threed import Scene

scene = Scene.from_file("output.fbx")

Decode Watermark

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

from aspose import pycore
from aspose.threed.entities import Mesh
from aspose.threed.utilities import Watermark

text = None
found = False

def decode_watermark(node):
    global text, found
    if found:
        return
    entity = node.entity
    mesh = pycore.as_of(entity, Mesh) if pycore.is_assignable(entity, Mesh) else None
    if mesh:
        # Raises an exception when the password is wrong
        result = Watermark.decode_watermark(mesh, "1234")
        if result:
            text = result
            found = True
    for child in node.child_nodes:
        decode_watermark(child)

decode_watermark(scene.root_node)
print("Watermark:", text)

Document Confirmation

For the returned result, if the returned result is None, 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 raised.