Blender V5.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
10namespace blender {
11
12struct Volume;
13
14namespace io::usd {
15
16/* Writer for writing OpenVDB assets to UsdVolVolume. Volume data is stored in separate `.vdb`
17 * files which are referenced in USD file. */
19 public:
21
22 protected:
23 bool check_is_animated(const HierarchyContext &context) const override;
24 void do_write(HierarchyContext &context) override;
25
26 private:
27 /* Try to ensure that external `.vdb` file is available for USD to be referenced. Blender can
28 * either reference external OpenVDB data or generate such data internally. Latter option will
29 * mean that `resolve_vdb_file` method will try to export volume data to a new `.vdb` file.
30 * If successful, this method returns absolute file path to the resolved `.vdb` file, if not,
31 * returns `std::nullopt`. */
32 std::optional<std::string> resolve_vdb_file(const Volume *volume, bool has_modifiers) const;
33
34 std::optional<std::string> construct_vdb_file_path(const Volume *volume) const;
35 std::optional<std::string> construct_vdb_relative_file_path(
36 const std::string &vdb_file_path) const;
37};
38
39} // namespace io::usd
40} // namespace blender
USDAbstractWriter(const USDExporterContext &usd_export_context)
bool check_is_animated(const HierarchyContext &context) const override
void do_write(HierarchyContext &context) override
USDVolumeWriter(const USDExporterContext &ctx)
BMesh Iterators.