Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/scene/3d/convert_transform_modifier_3d.h
9903 views
1
/**************************************************************************/
2
/* convert_transform_modifier_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/bone_constraint_3d.h"
34
35
class ConvertTransformModifier3D : public BoneConstraint3D {
36
GDCLASS(ConvertTransformModifier3D, BoneConstraint3D);
37
38
public:
39
enum TransformMode {
40
TRANSFORM_MODE_POSITION,
41
TRANSFORM_MODE_ROTATION,
42
TRANSFORM_MODE_SCALE,
43
};
44
45
struct ConvertTransform3DSetting : public BoneConstraint3DSetting {
46
TransformMode apply_transform_mode = TRANSFORM_MODE_POSITION;
47
Vector3::Axis apply_axis = Vector3::AXIS_X;
48
float apply_range_min = 0.0;
49
float apply_range_max = 0.0;
50
51
TransformMode reference_transform_mode = TRANSFORM_MODE_POSITION;
52
Vector3::Axis reference_axis = Vector3::AXIS_X;
53
float reference_range_min = 0.0;
54
float reference_range_max = 0.0;
55
56
bool relative = true;
57
bool additive = false;
58
};
59
60
protected:
61
bool _get(const StringName &p_path, Variant &r_ret) const;
62
bool _set(const StringName &p_path, const Variant &p_value);
63
void _get_property_list(List<PropertyInfo> *p_list) const;
64
65
static void _bind_methods();
66
67
virtual void _process_constraint(int p_index, Skeleton3D *p_skeleton, int p_apply_bone, int p_reference_bone, float p_amount) override;
68
virtual void _validate_setting(int p_index) override;
69
70
public:
71
void set_apply_transform_mode(int p_index, TransformMode p_transform_mode);
72
TransformMode get_apply_transform_mode(int p_index) const;
73
void set_apply_axis(int p_index, Vector3::Axis p_axis);
74
Vector3::Axis get_apply_axis(int p_index) const;
75
void set_apply_range_min(int p_index, float p_range_min);
76
float get_apply_range_min(int p_index) const;
77
void set_apply_range_max(int p_index, float p_range_max);
78
float get_apply_range_max(int p_index) const;
79
80
void set_reference_transform_mode(int p_index, TransformMode p_transform_mode);
81
TransformMode get_reference_transform_mode(int p_index) const;
82
void set_reference_axis(int p_index, Vector3::Axis p_axis);
83
Vector3::Axis get_reference_axis(int p_index) const;
84
void set_reference_range_min(int p_index, float p_range_min);
85
float get_reference_range_min(int p_index) const;
86
void set_reference_range_max(int p_index, float p_range_max);
87
float get_reference_range_max(int p_index) const;
88
89
void set_relative(int p_index, bool p_enabled);
90
bool is_relative(int p_index) const;
91
92
void set_additive(int p_index, bool p_enabled);
93
bool is_additive(int p_index) const;
94
95
~ConvertTransformModifier3D();
96
};
97
98
VARIANT_ENUM_CAST(ConvertTransformModifier3D::TransformMode);
99
100