1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/**************************************************************************/
/* gltf_object_model_property.h */
/**************************************************************************/
/* This file is part of: */
/* REDOT ENGINE */
/* https://redotengine.org */
/**************************************************************************/
/* Copyright (c) 2024-present Redot Engine contributors */
/* (see REDOT_AUTHORS.md) */
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef GLTF_OBJECT_MODEL_PROPERTY_H
#define GLTF_OBJECT_MODEL_PROPERTY_H
#include "core/math/expression.h"
#include "core/variant/typed_array.h"
#include "gltf_accessor.h"
// Object model: https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/ObjectModel.adoc
// KHR_animation_pointer: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_animation_pointer
class GLTFObjectModelProperty : public RefCounted {
GDCLASS(GLTFObjectModelProperty, RefCounted);
public:
enum GLTFObjectModelType {
GLTF_OBJECT_MODEL_TYPE_UNKNOWN,
GLTF_OBJECT_MODEL_TYPE_BOOL,
GLTF_OBJECT_MODEL_TYPE_FLOAT,
GLTF_OBJECT_MODEL_TYPE_FLOAT_ARRAY,
GLTF_OBJECT_MODEL_TYPE_FLOAT2,
GLTF_OBJECT_MODEL_TYPE_FLOAT3,
GLTF_OBJECT_MODEL_TYPE_FLOAT4,
GLTF_OBJECT_MODEL_TYPE_FLOAT2X2,
GLTF_OBJECT_MODEL_TYPE_FLOAT3X3,
GLTF_OBJECT_MODEL_TYPE_FLOAT4X4,
GLTF_OBJECT_MODEL_TYPE_INT,
};
private:
Ref<Expression> gltf_to_godot_expr;
Ref<Expression> godot_to_gltf_expr;
TypedArray<NodePath> node_paths;
GLTFObjectModelType object_model_type = GLTF_OBJECT_MODEL_TYPE_UNKNOWN;
Vector<PackedStringArray> json_pointers;
Variant::Type variant_type = Variant::NIL;
protected:
static void _bind_methods();
public:
void append_node_path(const NodePath &p_node_path);
void append_path_to_property(const NodePath &p_node_path, const StringName &p_prop_name);
GLTFAccessor::GLTFAccessorType get_accessor_type() const;
Ref<Expression> get_gltf_to_godot_expression() const;
void set_gltf_to_godot_expression(Ref<Expression> p_gltf_to_godot_expr);
Ref<Expression> get_godot_to_gltf_expression() const;
void set_godot_to_gltf_expression(Ref<Expression> p_godot_to_gltf_expr);
TypedArray<NodePath> get_node_paths() const;
bool has_node_paths() const;
void set_node_paths(TypedArray<NodePath> p_node_paths);
GLTFObjectModelType get_object_model_type() const;
void set_object_model_type(GLTFObjectModelType p_type);
Vector<PackedStringArray> get_json_pointers() const;
bool has_json_pointers() const;
void set_json_pointers(const Vector<PackedStringArray> &p_json_pointers);
TypedArray<PackedStringArray> get_json_pointers_bind() const;
void set_json_pointers_bind(const TypedArray<PackedStringArray> &p_json_pointers);
Variant::Type get_variant_type() const;
void set_variant_type(Variant::Type p_variant_type);
void set_types(Variant::Type p_variant_type, GLTFObjectModelType p_obj_model_type);
};
VARIANT_ENUM_CAST(GLTFObjectModelProperty::GLTFObjectModelType);
#endif // GLTF_OBJECT_MODEL_PROPERTY_H
|