Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/scene/resources/2d/skeleton/skeleton_modification_stack_2d.h
9904 views
1
/**************************************************************************/
2
/* skeleton_modification_stack_2d.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/io/resource.h"
34
35
///////////////////////////////////////
36
// SkeletonModificationStack2D
37
///////////////////////////////////////
38
39
class Skeleton2D;
40
class SkeletonModification2D;
41
class Bone2D;
42
43
class SkeletonModificationStack2D : public Resource {
44
GDCLASS(SkeletonModificationStack2D, Resource);
45
friend class Skeleton2D;
46
friend class SkeletonModification2D;
47
48
protected:
49
static void _bind_methods();
50
void _get_property_list(List<PropertyInfo> *p_list) const;
51
bool _set(const StringName &p_path, const Variant &p_value);
52
bool _get(const StringName &p_path, Variant &r_ret) const;
53
54
public:
55
Skeleton2D *skeleton = nullptr;
56
bool is_setup = false;
57
bool enabled = false;
58
float strength = 1.0;
59
60
enum EXECUTION_MODE {
61
execution_mode_process,
62
execution_mode_physics_process
63
};
64
65
Vector<Ref<SkeletonModification2D>> modifications;
66
67
void setup();
68
void execute(float p_delta, int p_execution_mode);
69
70
bool editor_gizmo_dirty = false;
71
void draw_editor_gizmos();
72
void set_editor_gizmos_dirty(bool p_dirty);
73
74
void enable_all_modifications(bool p_enable);
75
Ref<SkeletonModification2D> get_modification(int p_mod_idx) const;
76
void add_modification(Ref<SkeletonModification2D> p_mod);
77
void delete_modification(int p_mod_idx);
78
void set_modification(int p_mod_idx, Ref<SkeletonModification2D> p_mod);
79
80
void set_modification_count(int p_count);
81
int get_modification_count() const;
82
83
void set_skeleton(Skeleton2D *p_skeleton);
84
Skeleton2D *get_skeleton() const;
85
86
bool get_is_setup() const;
87
88
void set_enabled(bool p_enabled);
89
bool get_enabled() const;
90
91
void set_strength(float p_strength);
92
float get_strength() const;
93
94
SkeletonModificationStack2D();
95
};
96
97