Debian Codegraph @

modules/gltf/structures/gltf_object_model_property.h

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