newton.viewer.ViewerFile#
- class newton.viewer.ViewerFile(output_path, auto_save=True, save_interval=100)[source]#
Bases:
ViewerBase
File-based viewer backend for Newton physics simulations.
This backend records simulation data to JSON or binary files using the same ViewerBase API as other viewers. It captures model structure and state data during simulation for later replay or analysis.
Format is determined by file extension: - .json: Human-readable JSON format - .bin: Binary CBOR2 format (more efficient)
- __init__(output_path, auto_save=True, save_interval=100)#
Initialize the File viewer backend for Newton physics simulations.
- close()#
Save final recording and cleanup.
- end_frame()#
No frame rendering needed for file viewer.
- get_frame_count()#
Get the number of recorded frames.
- get_recorder()#
Get access to the underlying recorder for advanced operations.
- load_recording(file_path)#
Load a previously recorded file.
- log_array(name, array)#
File viewer doesn’t log arrays visually, so this is a no-op.
- log_instances(name, mesh, xforms, scales, colors, materials, hidden=False)#
File viewer doesn’t render instances, so this is a no-op.
- log_lines(name, line_begins, line_ends, line_colors, hidden=False)#
File viewer doesn’t render lines, so this is a no-op.
- log_mesh(name, points, indices, normals=None, uvs=None, hidden=False, backface_culling=True)#
File viewer doesn’t render meshes, so this is a no-op.
- log_points(name, points, widths, colors, hidden=False)#
File viewer doesn’t render points, so this is a no-op.
- log_scalar(name, value)#
File viewer doesn’t log scalars visually, so this is a no-op.
- log_state(state)#
Override log_state to record the state in addition to standard processing.
- save_recording()#
Save the recorded data to file.
- set_model(model)#
Override set_model to record the model when it’s set.