Blender  V3.3
usd_reader_xform.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Adapted from the Blender Alembic importer implementation.
3  * Modifications Copyright 2021 Tangent Animation. All rights reserved. */
4 #pragma once
5 
6 #include "usd.h"
7 #include "usd_reader_prim.h"
8 
9 namespace blender::io::usd {
10 
11 class USDXformReader : public USDPrimReader {
12  private:
13  bool use_parent_xform_;
14 
15  /* Indicates if the created object is the root of a
16  * transform hierarchy. */
17  bool is_root_xform_;
18 
19  public:
20  USDXformReader(const pxr::UsdPrim &prim,
21  const USDImportParams &import_params,
22  const ImportSettings &settings)
23  : USDPrimReader(prim, import_params, settings),
24  use_parent_xform_(false),
25  is_root_xform_(is_root_xform_prim())
26  {
27  }
28 
29  void create_object(Main *bmain, double motionSampleTime) override;
30  void read_object_data(Main *bmain, double motionSampleTime) override;
31 
32  void read_matrix(float r_mat[4][4], float time, float scale, bool *r_is_constant);
33 
34  bool use_parent_xform() const
35  {
36  return use_parent_xform_;
37  }
38  void set_use_parent_xform(bool flag)
39  {
40  use_parent_xform_ = flag;
41  is_root_xform_ = is_root_xform_prim();
42  }
43 
44  bool prim_has_xform_ops() const;
45 
46  protected:
47  /* Returns true if the contained USD prim is the root of a transform hierarchy. */
48  bool is_root_xform_prim() const;
49 };
50 
51 } // namespace blender::io::usd
const pxr::UsdPrim & prim() const
void create_object(Main *bmain, double motionSampleTime) override
USDXformReader(const pxr::UsdPrim &prim, const USDImportParams &import_params, const ImportSettings &settings)
void read_object_data(Main *bmain, double motionSampleTime) override
void read_matrix(float r_mat[4][4], float time, float scale, bool *r_is_constant)
double time
Definition: BKE_main.h:121