Blender V4.3
id.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/tf/token.h>
8#include <pxr/base/vt/value.h>
9#include <pxr/usd/sdf/path.h>
10
11#include "DNA_ID.h"
12
13#include "BLI_hash.hh"
14
15template<> struct blender::DefaultHash<pxr::SdfPath> {
16 uint64_t operator()(const pxr::SdfPath &value) const
17 {
18 return (uint64_t)value.GetHash();
19 }
20};
21
22template<> struct blender::DefaultHash<pxr::TfToken> {
23 uint64_t operator()(const pxr::TfToken &value) const
24 {
25 return (uint64_t)value.Hash();
26 }
27};
28
29namespace blender::io::hydra {
30
31class HydraSceneDelegate;
32
33class IdData {
34 public:
35 const ID *id;
36 pxr::SdfPath prim_id;
37
38 protected:
40
41 public:
42 IdData(HydraSceneDelegate *scene_delegate, const ID *id, pxr::SdfPath const &prim_id);
43 virtual ~IdData() = default;
44
45 virtual void init() = 0;
46 virtual void insert() = 0;
47 virtual void remove() = 0;
48 virtual void update() = 0;
49
50 virtual pxr::VtValue get_data(pxr::TfToken const &key) const = 0;
51};
52
53#define ID_LOG(level, msg, ...) \
54 CLOG_INFO(LOG_HYDRA_SCENE, level, "%s: " msg, prim_id.GetText(), ##__VA_ARGS__);
55
56#define ID_LOGN(level, msg, ...) \
57 CLOG_INFO(LOG_HYDRA_SCENE, \
58 level, \
59 "%s (%s): " msg, \
60 prim_id.GetText(), \
61 id ? id->name : "", \
62 ##__VA_ARGS__);
63
64} // namespace blender::io::hydra
ID and Library types, which are fundamental for SDNA.
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:11
pxr::SdfPath prim_id
Definition id.hh:36
HydraSceneDelegate * scene_delegate_
Definition id.hh:39
virtual ~IdData()=default
virtual void insert()=0
virtual void remove()=0
virtual void update()=0
unsigned __int64 uint64_t
Definition stdint.h:90
Definition DNA_ID.h:413
uint64_t operator()(const pxr::SdfPath &value) const
Definition id.hh:16
uint64_t operator()(const pxr::TfToken &value) const
Definition id.hh:23