Blender V4.3
usd_writer_volume.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
6#include <optional>
7
9
10struct Volume;
11
12namespace blender::io::usd {
13
14/* Writer for writing OpenVDB assets to UsdVolVolume. Volume data is stored in separate `.vdb`
15 * files which are referenced in USD file. */
17 public:
19
20 protected:
21 virtual bool check_is_animated(const HierarchyContext &context) const override;
22 virtual void do_write(HierarchyContext &context) override;
23
24 private:
25 /* Try to ensure that external `.vdb` file is available for USD to be referenced. Blender can
26 * either reference external OpenVDB data or generate such data internally. Latter option will
27 * mean that `resolve_vdb_file` method will try to export volume data to a new `.vdb` file.
28 * If successful, this method returns absolute file path to the resolved `.vdb` file, if not,
29 * returns `std::nullopt`. */
30 std::optional<std::string> resolve_vdb_file(const Volume *volume) const;
31
32 std::optional<std::string> construct_vdb_file_path(const Volume *volume) const;
33 std::optional<std::string> construct_vdb_relative_file_path(
34 const std::string &vdb_file_path) const;
35};
36
37} // namespace blender::io::usd
virtual bool check_is_animated(const HierarchyContext &context) const override
virtual void do_write(HierarchyContext &context) override
USDVolumeWriter(const USDExporterContext &ctx)