Blender
V4.5
source
blender
blenlib
intern
blenlib/intern/cpp_types.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
9
#include "
BLI_color.hh
"
10
#include "
BLI_cpp_type_make.hh
"
11
#include "
BLI_cpp_types_make.hh
"
12
#include "
BLI_math_matrix_types.hh
"
13
#include "
BLI_math_quaternion_types.hh
"
14
#include "
BLI_math_vector_types.hh
"
15
16
namespace
blender
{
17
18
static
auto
&
get_vector_from_self_map
()
19
{
20
static
Map<const CPPType *, const VectorCPPType *>
map;
21
return
map;
22
}
23
24
static
auto
&
get_vector_from_value_map
()
25
{
26
static
Map<const CPPType *, const VectorCPPType *>
map;
27
return
map;
28
}
29
30
void
VectorCPPType::register_self()
31
{
32
get_vector_from_self_map
().
add_new
(&this->
self
,
this
);
33
get_vector_from_value_map
().add_new(&this->
value
,
this
);
34
}
35
36
const
VectorCPPType
*
VectorCPPType::get_from_self
(
const
CPPType
&
self
)
37
{
38
const
VectorCPPType
*type =
get_vector_from_self_map
().lookup_default(&
self
,
nullptr
);
39
BLI_assert
(type ==
nullptr
|| type->
self
==
self
);
40
return
type;
41
}
42
43
const
VectorCPPType
*
VectorCPPType::get_from_value
(
const
CPPType
&
value
)
44
{
45
const
VectorCPPType
*type =
get_vector_from_value_map
().lookup_default(&
value
,
nullptr
);
46
BLI_assert
(type ==
nullptr
|| type->
value
==
value
);
47
return
type;
48
}
49
50
}
// namespace blender
51
52
BLI_CPP_TYPE_MAKE
(
bool
,
CPPTypeFlags::BasicType
)
53
54
BLI_CPP_TYPE_MAKE
(
float
,
CPPTypeFlags::BasicType
)
55
BLI_CPP_TYPE_MAKE
(
blender::float2
,
CPPTypeFlags::BasicType
)
56
BLI_CPP_TYPE_MAKE
(
blender::float3
,
CPPTypeFlags::BasicType
)
57
BLI_CPP_TYPE_MAKE
(
blender::float4
,
CPPTypeFlags::BasicType
)
58
BLI_CPP_TYPE_MAKE
(
blender::float4x4
,
CPPTypeFlags::BasicType
)
59
60
BLI_CPP_TYPE_MAKE
(
int8_t
,
CPPTypeFlags::BasicType
)
61
BLI_CPP_TYPE_MAKE
(
int16_t
,
CPPTypeFlags::BasicType
)
62
BLI_CPP_TYPE_MAKE
(
int32_t
,
CPPTypeFlags::BasicType
)
63
BLI_CPP_TYPE_MAKE
(
blender::short2
,
CPPTypeFlags::BasicType
)
64
BLI_CPP_TYPE_MAKE
(
blender::int2
,
CPPTypeFlags::BasicType
)
65
BLI_CPP_TYPE_MAKE
(
blender::int3
,
CPPTypeFlags::BasicType
)
66
BLI_CPP_TYPE_MAKE
(
int64_t
,
CPPTypeFlags::BasicType
)
67
68
BLI_CPP_TYPE_MAKE
(
uint8_t
,
CPPTypeFlags::BasicType
)
69
BLI_CPP_TYPE_MAKE
(
uint16_t
,
CPPTypeFlags::BasicType
)
70
BLI_CPP_TYPE_MAKE
(
uint32_t
,
CPPTypeFlags::BasicType
)
71
BLI_CPP_TYPE_MAKE
(
uint64_t
,
CPPTypeFlags::BasicType
)
72
73
BLI_CPP_TYPE_MAKE
(
blender::ColorGeometry4f
,
CPPTypeFlags::BasicType
)
74
BLI_CPP_TYPE_MAKE
(
blender::ColorGeometry4b
,
CPPTypeFlags::BasicType
)
75
76
BLI_CPP_TYPE_MAKE
(
blender
::
math
::Quaternion,
77
CPPTypeFlags
::
BasicType
|
CPPTypeFlags
::
IdentityDefaultValue
)
78
79
BLI_CPP_TYPE_MAKE
(std::
string
,
CPPTypeFlags
::
BasicType
)
80
81
BLI_VECTOR_CPP_TYPE_MAKE
(std::
string
)
82
83
namespace
blender
{
84
85
void
register_cpp_types()
86
{
87
BLI_CPP_TYPE_REGISTER
(
bool
);
88
89
BLI_CPP_TYPE_REGISTER
(
float
);
90
BLI_CPP_TYPE_REGISTER
(
blender::float2
);
91
BLI_CPP_TYPE_REGISTER
(
blender::float3
);
92
BLI_CPP_TYPE_REGISTER
(
blender::float4x4
);
93
94
BLI_CPP_TYPE_REGISTER
(
int8_t
);
95
BLI_CPP_TYPE_REGISTER
(
int16_t
);
96
BLI_CPP_TYPE_REGISTER
(
int32_t
);
97
BLI_CPP_TYPE_REGISTER
(
blender::int2
);
98
BLI_CPP_TYPE_REGISTER
(
blender::int3
);
99
BLI_CPP_TYPE_REGISTER
(
int64_t
);
100
101
BLI_CPP_TYPE_REGISTER
(
uint8_t
);
102
BLI_CPP_TYPE_REGISTER
(
uint16_t
);
103
BLI_CPP_TYPE_REGISTER
(
uint32_t
);
104
BLI_CPP_TYPE_REGISTER
(
uint64_t
);
105
106
BLI_CPP_TYPE_REGISTER
(
blender::ColorGeometry4f
);
107
BLI_CPP_TYPE_REGISTER
(
blender::ColorGeometry4b
);
108
109
BLI_CPP_TYPE_REGISTER
(
math::Quaternion
);
110
111
BLI_CPP_TYPE_REGISTER
(std::string);
112
113
BLI_VECTOR_CPP_TYPE_REGISTER
(std::string);
114
}
115
116
}
// namespace blender
BLI_assert
#define BLI_assert(a)
Definition
BLI_assert.h:46
BLI_color.hh
CPPTypeFlags
CPPTypeFlags
Definition
BLI_cpp_type.hh:87
CPPTypeFlags::IdentityDefaultValue
@ IdentityDefaultValue
CPPTypeFlags::BasicType
@ BasicType
BLI_cpp_type_make.hh
BLI_CPP_TYPE_MAKE
#define BLI_CPP_TYPE_MAKE(TYPE_NAME, FLAGS)
Definition
BLI_cpp_type_make.hh:456
BLI_CPP_TYPE_REGISTER
#define BLI_CPP_TYPE_REGISTER(TYPE_NAME)
Definition
BLI_cpp_type_make.hh:466
BLI_cpp_types_make.hh
BLI_VECTOR_CPP_TYPE_MAKE
#define BLI_VECTOR_CPP_TYPE_MAKE(VALUE_TYPE)
Definition
BLI_cpp_types_make.hh:26
BLI_VECTOR_CPP_TYPE_REGISTER
#define BLI_VECTOR_CPP_TYPE_REGISTER(VALUE_TYPE)
Definition
BLI_cpp_types_make.hh:35
BLI_math_matrix_types.hh
BLI_math_quaternion_types.hh
BLI_math_vector_types.hh
self
PyObject * self
Definition
bpy_driver.cc:172
blender::CPPType
Definition
BLI_cpp_type.hh:100
blender::ColorSceneLinear4f< eAlpha::Premultiplied >
blender::ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied >
blender::Map
Definition
BLI_map.hh:129
blender::Map::add_new
void add_new(const Key &key, const Value &value)
Definition
BLI_map.hh:265
blender::VectorCPPType
Definition
BLI_cpp_types.hh:18
blender::VectorCPPType::self
const CPPType & self
Definition
BLI_cpp_types.hh:21
blender::VectorCPPType::get_from_self
static const VectorCPPType * get_from_self(const CPPType &self)
Definition
blenlib/intern/cpp_types.cc:36
blender::VectorCPPType::value
const CPPType & value
Definition
BLI_cpp_types.hh:23
blender::VectorCPPType::get_from_value
static const VectorCPPType * get_from_value(const CPPType &value)
Definition
blenlib/intern/cpp_types.cc:43
uint32_t
unsigned int uint32_t
Definition
gpu_glsl_cpp_stubs.hh:361
blender::math
Definition
BLI_math_angle_types.hh:25
blender
Definition
ANIM_action.hh:36
blender::get_vector_from_value_map
static auto & get_vector_from_value_map()
Definition
blenlib/intern/cpp_types.cc:24
blender::get_vector_from_self_map
static auto & get_vector_from_self_map()
Definition
blenlib/intern/cpp_types.cc:18
int16_t
signed short int16_t
Definition
stdint.h:76
uint16_t
unsigned short uint16_t
Definition
stdint.h:79
int64_t
__int64 int64_t
Definition
stdint.h:89
int32_t
signed int int32_t
Definition
stdint.h:77
uint8_t
unsigned char uint8_t
Definition
stdint.h:78
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:90
int8_t
signed char int8_t
Definition
stdint.h:75
blender::MatBase< float, 4, 4 >
blender::VecBase< float, 2 >
blender::math::QuaternionBase
Definition
BLI_math_quaternion_types.hh:37
value
T value
Definition
usd_reader_camera.cc:34
Generated on Fri Apr 3 2026 06:33:18 for Blender by
doxygen
1.11.0