Blender V5.0
object.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <pxr/base/gf/matrix4d.h>
8#include <pxr/base/tf/hashmap.h>
9
10#include "DNA_object_types.h"
11
12#include "BLI_map.hh"
13#include "BLI_set.hh"
14
15#include "BKE_object.hh"
16
17#include "id.hh"
18#include "material.hh"
19
20namespace blender::io::hydra {
21
22class ObjectData : public IdData {
23 public:
24 pxr::GfMatrix4d transform;
25 bool visible = true;
26
27 ObjectData(HydraSceneDelegate *scene_delegate,
28 const Object *object,
29 pxr::SdfPath const &prim_id);
30
31 static std::unique_ptr<ObjectData> create(HydraSceneDelegate *scene_delegate,
32 const Object *object,
33 pxr::SdfPath const &prim_id);
34 static bool is_supported(const Object *object);
35 static bool is_mesh(const Object *object);
36 static bool is_visible(HydraSceneDelegate *scene_delegate,
37 const Object *object,
38 int mode = OB_VISIBLE_SELF);
39
40 using IdData::get_data;
41 virtual pxr::VtValue get_data(pxr::SdfPath const &id, pxr::TfToken const &key) const;
42 virtual pxr::SdfPath material_id() const;
43 virtual pxr::SdfPath material_id(pxr::SdfPath const &id) const;
44 virtual void available_materials(Set<pxr::SdfPath> &paths) const;
45
46 protected:
47 virtual void write_transform();
48 virtual void write_materials();
50};
51
53
54pxr::GfMatrix4d gf_matrix_from_transform(const float m[4][4]);
55
56} // namespace blender::io::hydra
General operations, lookup, etc. for blender objects.
@ OB_VISIBLE_SELF
Object is a sort of wrapper for general info.
virtual pxr::VtValue get_data(pxr::TfToken const &key) const =0
IdData(HydraSceneDelegate *scene_delegate, const ID *id, pxr::SdfPath const &prim_id)
Definition id.cc:9
pxr::SdfPath prim_id
Definition id.hh:36
pxr::GfMatrix4d transform
Definition object.hh:24
virtual void available_materials(Set< pxr::SdfPath > &paths) const
virtual pxr::SdfPath material_id() const
static bool is_mesh(const Object *object)
MaterialData * get_or_create_material(const Material *mat)
static bool is_visible(HydraSceneDelegate *scene_delegate, const Object *object, int mode=OB_VISIBLE_SELF)
static std::unique_ptr< ObjectData > create(HydraSceneDelegate *scene_delegate, const Object *object, pxr::SdfPath const &prim_id)
static bool is_supported(const Object *object)
virtual pxr::VtValue get_data(pxr::SdfPath const &id, pxr::TfToken const &key) const
ObjectData(HydraSceneDelegate *scene_delegate, const Object *object, pxr::SdfPath const &prim_id)
pxr::GfMatrix4d gf_matrix_from_transform(const float m[4][4])
Map< pxr::SdfPath, std::unique_ptr< ObjectData > > ObjectDataMap
Definition object.hh:52