Blender
V5.0
source
blender
blenloader_core
BLO_core_bhead.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2025 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#pragma once
6
7
#include <optional>
8
9
#include "
BLI_endian_switch.h
"
10
#include "
BLI_sys_types.h
"
11
12
struct
FileReader
;
13
14
struct
BHead
{
16
int
code
;
18
int
SDNAnr
;
25
const
void
*
old
;
27
int64_t
len
;
29
int64_t
nr
;
30
};
31
32
struct
BHead4
{
33
int
code
,
len
;
34
uint
old
;
35
int
SDNAnr
,
nr
;
36
};
37
38
struct
SmallBHead8
{
39
int
code
,
len
;
40
uint64_t
old
;
41
int
SDNAnr
,
nr
;
42
};
43
44
struct
LargeBHead8
{
45
int
code
;
46
int
SDNAnr
;
47
uint64_t
old
;
48
int64_t
len
;
49
int64_t
nr
;
50
};
51
52
enum class
BHeadType
{
53
BHead4
,
54
SmallBHead8
,
55
LargeBHead8
,
56
};
57
59
#ifdef __BIG_ENDIAN__
60
/* Big Endian */
61
# define BLEND_MAKE_ID(a, b, c, d) ((int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d))
62
#else
63
/* Little Endian */
64
# define BLEND_MAKE_ID(a, b, c, d) ((int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a))
65
#endif
66
72
enum
{
77
BLO_CODE_DATA
=
BLEND_MAKE_ID
(
'D'
,
'A'
,
'T'
,
'A'
),
81
BLO_CODE_GLOB
=
BLEND_MAKE_ID
(
'G'
,
'L'
,
'O'
,
'B'
),
86
BLO_CODE_DNA1
=
BLEND_MAKE_ID
(
'D'
,
'N'
,
'A'
,
'1'
),
91
BLO_CODE_TEST
=
BLEND_MAKE_ID
(
'T'
,
'E'
,
'S'
,
'T'
),
96
BLO_CODE_REND
=
BLEND_MAKE_ID
(
'R'
,
'E'
,
'N'
,
'D'
),
101
BLO_CODE_USER
=
BLEND_MAKE_ID
(
'U'
,
'S'
,
'E'
,
'R'
),
105
BLO_CODE_ENDB
=
BLEND_MAKE_ID
(
'E'
,
'N'
,
'D'
,
'B'
),
106
};
107
114
std::optional<BHead>
BLO_readfile_read_bhead
(
FileReader
*file,
BHeadType
type);
115
122
inline
uint32_t
uint32_from_uint64_ptr
(
uint64_t
ptr
)
123
{
124
/* NOTE: this is endianness-sensitive. */
125
/* Switching endianness would be required to reduce the risk of two different 64bits pointers
126
* generating the same 32bits value. */
127
/* Behavior has to match #cast_pointer_64_to_32. */
128
ptr
>>= 3;
129
return
uint32_t(
ptr
);
130
}
BLI_endian_switch.h
BLI_sys_types.h
uint
unsigned int uint
Definition
BLI_sys_types.h:64
uint32_from_uint64_ptr
uint32_t uint32_from_uint64_ptr(uint64_t ptr)
Definition
BLO_core_bhead.hh:122
BHeadType
BHeadType
Definition
BLO_core_bhead.hh:52
BLO_CODE_ENDB
@ BLO_CODE_ENDB
Definition
BLO_core_bhead.hh:105
BLO_CODE_REND
@ BLO_CODE_REND
Definition
BLO_core_bhead.hh:96
BLO_CODE_TEST
@ BLO_CODE_TEST
Definition
BLO_core_bhead.hh:91
BLO_CODE_GLOB
@ BLO_CODE_GLOB
Definition
BLO_core_bhead.hh:81
BLO_CODE_DATA
@ BLO_CODE_DATA
Definition
BLO_core_bhead.hh:77
BLO_CODE_DNA1
@ BLO_CODE_DNA1
Definition
BLO_core_bhead.hh:86
BLO_CODE_USER
@ BLO_CODE_USER
Definition
BLO_core_bhead.hh:101
BLO_readfile_read_bhead
std::optional< BHead > BLO_readfile_read_bhead(FileReader *file, BHeadType type)
Definition
blo_core_bhead.cc:52
BLEND_MAKE_ID
#define BLEND_MAKE_ID(a, b, c, d)
Definition
BLO_core_bhead.hh:64
int64_t
long long int int64_t
Definition
btConvexHullComputer.cpp:31
uint64_t
unsigned long long int uint64_t
Definition
btConvexHullComputer.cpp:33
BHead4
Definition
BLO_core_bhead.hh:32
BHead4::SDNAnr
int SDNAnr
Definition
BLO_core_bhead.hh:35
BHead4::len
int len
Definition
BLO_core_bhead.hh:33
BHead4::nr
int nr
Definition
BLO_core_bhead.hh:35
BHead4::old
uint old
Definition
BLO_core_bhead.hh:34
BHead4::code
int code
Definition
BLO_core_bhead.hh:33
BHead
Definition
BLO_core_bhead.hh:14
BHead::SDNAnr
int SDNAnr
Definition
BLO_core_bhead.hh:18
BHead::len
int64_t len
Definition
BLO_core_bhead.hh:27
BHead::code
int code
Definition
BLO_core_bhead.hh:16
BHead::nr
int64_t nr
Definition
BLO_core_bhead.hh:29
BHead::old
const void * old
Definition
BLO_core_bhead.hh:25
FileReader
Definition
BLI_filereader.h:33
LargeBHead8
Definition
BLO_core_bhead.hh:44
LargeBHead8::code
int code
Definition
BLO_core_bhead.hh:45
LargeBHead8::SDNAnr
int SDNAnr
Definition
BLO_core_bhead.hh:46
LargeBHead8::nr
int64_t nr
Definition
BLO_core_bhead.hh:49
LargeBHead8::old
uint64_t old
Definition
BLO_core_bhead.hh:47
LargeBHead8::len
int64_t len
Definition
BLO_core_bhead.hh:48
SmallBHead8
Definition
BLO_core_bhead.hh:38
SmallBHead8::len
int len
Definition
BLO_core_bhead.hh:39
SmallBHead8::nr
int nr
Definition
BLO_core_bhead.hh:41
SmallBHead8::SDNAnr
int SDNAnr
Definition
BLO_core_bhead.hh:41
SmallBHead8::code
int code
Definition
BLO_core_bhead.hh:39
SmallBHead8::old
uint64_t old
Definition
BLO_core_bhead.hh:40
ptr
PointerRNA * ptr
Definition
wm_files.cc:4238
Generated on
for Blender by
doxygen
1.16.1