Debian Codegraph @

scene/3d/bone_constraint_3d.h

raw symbols SCIP
1 /**************************************************************************/
2 /* bone_constraint_3d.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 "scene/3d/skeleton_modifier_3d.h"
34
35 class BoneConstraint3D : public SkeletonModifier3D {
36 GDCLASS(BoneConstraint3D, SkeletonModifier3D);
37
38 public:
39 enum ReferenceType {
40 REFERENCE_TYPE_BONE,
41 REFERENCE_TYPE_NODE,
42 };
43
44 struct BoneConstraint3DSetting {
45 float amount = 1.0;
46
47 String apply_bone_name;
48 int apply_bone = -1;
49
50 ReferenceType reference_type = REFERENCE_TYPE_BONE;
51
52 String reference_bone_name;
53 int reference_bone = -1;
54
55 NodePath reference_node;
56 };
57
58 protected:
59 LocalVector<BoneConstraint3DSetting *> settings;
60
61 bool _get(const StringName &p_path, Variant &r_ret) const;
62 bool _set(const StringName &p_path, const Variant &p_value);
63
64 // Define get_property_list() instead of _get_property_list()
65 // to merge child class properties into parent class array inspector.
66 void get_property_list(List<PropertyInfo> *p_list) const; // Will be called by child classes.
67 void _validate_dynamic_prop(PropertyInfo &p_property) const;
68
69 virtual void _validate_bone_names() override;
70 static void _bind_methods();
71
72 virtual void _process_modification(double p_delta) override;
73
74 virtual void _process_constraint_by_bone(int p_index, Skeleton3D *p_skeleton, int p_apply_bone, int p_reference_bone, float p_amount);
75 virtual void _process_constraint_by_node(int p_index, Skeleton3D *p_skeleton, int p_apply_bone, const NodePath &p_reference_node, float p_amount);
76 virtual void _validate_setting(int p_index);
77
78 public:
79 void set_amount(int p_index, float p_amount);
80 float get_amount(int p_index) const;
81
82 void set_apply_bone_name(int p_index, const String &p_bone_name);
83 String get_apply_bone_name(int p_index) const;
84 void set_apply_bone(int p_index, int p_bone);
85 int get_apply_bone(int p_index) const;
86
87 void set_reference_type(int p_index, ReferenceType p_type);
88 ReferenceType get_reference_type(int p_index) const;
89
90 void set_reference_bone_name(int p_index, const String &p_bone_name);
91 String get_reference_bone_name(int p_index) const;
92 void set_reference_bone(int p_index, int p_bone);
93 int get_reference_bone(int p_index) const;
94
95 void set_reference_node(int p_index, const NodePath &p_node);
96 NodePath get_reference_node(int p_index) const;
97
98 void set_setting_count(int p_count);
99 int get_setting_count() const;
100
101 void clear_settings();
102
103 ~BoneConstraint3D();
104 };
105
106 VARIANT_ENUM_CAST(BoneConstraint3D::ReferenceType);