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