Coverage Report

Created: 2025-06-22 07:30

/src/assimp/code/AssetLib/FBX/FBXNodeAttribute.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
Open Asset Import Library (assimp)
3
----------------------------------------------------------------------
4
5
Copyright (c) 2006-2025, assimp team
6
7
All rights reserved.
8
9
Redistribution and use of this software in source and binary forms,
10
with or without modification, are permitted provided that the
11
following conditions are met:
12
13
* Redistributions of source code must retain the above
14
  copyright notice, this list of conditions and the
15
  following disclaimer.
16
17
* Redistributions in binary form must reproduce the above
18
  copyright notice, this list of conditions and the
19
  following disclaimer in the documentation and/or other
20
  materials provided with the distribution.
21
22
* Neither the name of the assimp team, nor the names of its
23
  contributors may be used to endorse or promote products
24
  derived from this software without specific prior
25
  written permission of the assimp team.
26
27
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
39
----------------------------------------------------------------------
40
*/
41
42
/** @file  FBXNoteAttribute.cpp
43
 *  @brief Assimp::FBX::NodeAttribute (and subclasses) implementation
44
 */
45
46
#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
47
48
#include "FBXParser.h"
49
#include "FBXDocument.h"
50
#include "FBXImporter.h"
51
#include "FBXDocumentUtil.h"
52
53
namespace Assimp {
54
namespace FBX {
55
56
using namespace Util;
57
58
// ------------------------------------------------------------------------------------------------
59
NodeAttribute::NodeAttribute(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
60
0
        Object(id, element, name), props() {
61
0
    const Scope &sc = GetRequiredScope(element);
62
63
0
    const std::string &classname = ParseTokenAsString(GetRequiredToken(element, 2));
64
65
    // hack on the deriving type but Null/LimbNode attributes are the only case in which
66
    // the property table is by design absent and no warning should be generated
67
    // for it.
68
0
    const bool is_null_or_limb = !strcmp(classname.c_str(), "Null") || !strcmp(classname.c_str(), "LimbNode");
69
0
    props = GetPropertyTable(doc, "NodeAttribute.Fbx" + classname, element, sc, is_null_or_limb);
70
0
}
71
72
// ------------------------------------------------------------------------------------------------
73
CameraSwitcher::CameraSwitcher(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
74
0
        NodeAttribute(id, element, doc, name) {
75
0
    const Scope &sc = GetRequiredScope(element);
76
0
    const Element *const CameraId = sc["CameraId"];
77
0
    const Element *const CameraName = sc["CameraName"];
78
0
    const Element *const CameraIndexName = sc["CameraIndexName"];
79
80
0
    if (CameraId) {
81
0
        cameraId = ParseTokenAsInt(GetRequiredToken(*CameraId, 0));
82
0
    }
83
84
0
    if (CameraName) {
85
0
        cameraName = GetRequiredToken(*CameraName, 0).StringContents();
86
0
    }
87
88
0
    if (CameraIndexName && CameraIndexName->Tokens().size()) {
89
0
        cameraIndexName = GetRequiredToken(*CameraIndexName, 0).StringContents();
90
0
    }
91
0
}
92
93
// ------------------------------------------------------------------------------------------------
94
Camera::Camera(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
95
0
        NodeAttribute(id, element, doc, name) {
96
    // empty
97
0
}
98
99
// ------------------------------------------------------------------------------------------------
100
Light::Light(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
101
0
        NodeAttribute(id, element, doc, name) {
102
    // empty
103
0
}
104
105
// ------------------------------------------------------------------------------------------------
106
Null::Null(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
107
0
        NodeAttribute(id, element, doc, name) {
108
    // empty
109
0
}
110
111
// ------------------------------------------------------------------------------------------------
112
LimbNode::LimbNode(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
113
0
        NodeAttribute(id, element, doc, name) {
114
    // empty
115
0
}
116
117
} // namespace FBX
118
} // namespace Assimp
119
120
#endif // ASSIMP_BUILD_NO_FBX_IMPORTER