Style: Apply clang-format (5.0) to some missed files
This commit is contained in:
parent
e823a366d0
commit
43b7ebf0a0
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
static Map<String, Color> _named_colors;
|
static Map<String, Color> _named_colors;
|
||||||
static void _populate_named_colors() {
|
static void _populate_named_colors() {
|
||||||
if(!_named_colors.empty()) return;
|
if (!_named_colors.empty()) return;
|
||||||
_named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
|
_named_colors.insert("aliceblue", Color(0.94, 0.97, 1.00));
|
||||||
_named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
|
_named_colors.insert("antiquewhite", Color(0.98, 0.92, 0.84));
|
||||||
_named_colors.insert("aqua", Color(0.00, 1.00, 1.00));
|
_named_colors.insert("aqua", Color(0.00, 1.00, 1.00));
|
||||||
|
|
|
@ -311,14 +311,14 @@ extern bool _err_error_exists;
|
||||||
_err_error_exists = false; \
|
_err_error_exists = false; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WARN_DEPRECATED \
|
#define WARN_DEPRECATED \
|
||||||
{ \
|
{ \
|
||||||
static bool warning_shown=false;\
|
static bool warning_shown = false; \
|
||||||
if (!warning_shown) {\
|
if (!warning_shown) { \
|
||||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__,"This method has been deprecated and will be removed in the future", ERR_HANDLER_WARNING); \
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future", ERR_HANDLER_WARNING); \
|
||||||
_err_error_exists = false; \
|
_err_error_exists = false; \
|
||||||
warning_shown=true;\
|
warning_shown = true; \
|
||||||
}\
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -828,7 +828,7 @@ void Basis::set_diagonal(const Vector3 p_diag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Basis Basis::slerp(const Basis &target, const real_t &t) const {
|
Basis Basis::slerp(const Basis &target, const real_t &t) const {
|
||||||
// TODO: implement this directly without using quaternions to make it more efficient
|
// TODO: implement this directly without using quaternions to make it more efficient
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_rotation() == false, Basis());
|
ERR_FAIL_COND_V(is_rotation() == false, Basis());
|
||||||
ERR_FAIL_COND_V(target.is_rotation() == false, Basis());
|
ERR_FAIL_COND_V(target.is_rotation() == false, Basis());
|
||||||
|
|
|
@ -1303,7 +1303,6 @@ Transform2D RasterizerStorageGLES2::skeleton_bone_get_transform_2d(RID p_skeleto
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerStorageGLES2::skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) {
|
void RasterizerStorageGLES2::skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerStorageGLES2::update_dirty_skeletons() {
|
void RasterizerStorageGLES2::update_dirty_skeletons() {
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
|
|
||||||
#include "register_types.h"
|
#include "register_types.h"
|
||||||
|
|
||||||
#include "csg_shape.h"
|
|
||||||
#include "csg_gizmos.h"
|
#include "csg_gizmos.h"
|
||||||
|
#include "csg_shape.h"
|
||||||
|
|
||||||
void register_csg_types() {
|
void register_csg_types() {
|
||||||
|
|
||||||
|
@ -51,9 +51,7 @@ void register_csg_types() {
|
||||||
EditorPlugins::add_by_type<EditorPluginCSG>();
|
EditorPlugins::add_by_type<EditorPluginCSG>();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregister_csg_types() {
|
void unregister_csg_types() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,8 +89,8 @@ void Bone2D::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_default_length", "default_length"), &Bone2D::set_default_length);
|
ClassDB::bind_method(D_METHOD("set_default_length", "default_length"), &Bone2D::set_default_length);
|
||||||
ClassDB::bind_method(D_METHOD("get_default_length"), &Bone2D::get_default_length);
|
ClassDB::bind_method(D_METHOD("get_default_length"), &Bone2D::get_default_length);
|
||||||
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D,"rest"),"set_rest","get_rest");
|
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "rest"), "set_rest", "get_rest");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::REAL,"default_length",PROPERTY_HINT_RANGE,"1,1024,1"),"set_default_length","get_default_length");
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "default_length", PROPERTY_HINT_RANGE, "1,1024,1"), "set_default_length", "get_default_length");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bone2D::set_rest(const Transform2D &p_rest) {
|
void Bone2D::set_rest(const Transform2D &p_rest) {
|
||||||
|
@ -120,8 +120,7 @@ void Bone2D::apply_rest() {
|
||||||
|
|
||||||
void Bone2D::set_default_length(float p_length) {
|
void Bone2D::set_default_length(float p_length) {
|
||||||
|
|
||||||
default_length=p_length;
|
default_length = p_length;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Bone2D::get_default_length() const {
|
float Bone2D::get_default_length() const {
|
||||||
|
@ -129,7 +128,7 @@ float Bone2D::get_default_length() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Bone2D::get_index_in_skeleton() const {
|
int Bone2D::get_index_in_skeleton() const {
|
||||||
ERR_FAIL_COND_V(!skeleton,-1);
|
ERR_FAIL_COND_V(!skeleton, -1);
|
||||||
skeleton->_update_bone_setup();
|
skeleton->_update_bone_setup();
|
||||||
return skeleton_index;
|
return skeleton_index;
|
||||||
}
|
}
|
||||||
|
@ -137,22 +136,21 @@ String Bone2D::get_configuration_warning() const {
|
||||||
|
|
||||||
String warning = Node2D::get_configuration_warning();
|
String warning = Node2D::get_configuration_warning();
|
||||||
if (!skeleton) {
|
if (!skeleton) {
|
||||||
if (warning!=String()) {
|
if (warning != String()) {
|
||||||
warning+="\n";
|
warning += "\n";
|
||||||
}
|
}
|
||||||
if (parent_bone) {
|
if (parent_bone) {
|
||||||
warning+=TTR("This Bone2D chain should end at a Skeleton2D node.");
|
warning += TTR("This Bone2D chain should end at a Skeleton2D node.");
|
||||||
} else {
|
} else {
|
||||||
warning+=TTR("A Bone2D only works with a Skeleton2D or another Bone2D as parent node.");
|
warning += TTR("A Bone2D only works with a Skeleton2D or another Bone2D as parent node.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rest==Transform2D(0,0,0,0,0,0)) {
|
if (rest == Transform2D(0, 0, 0, 0, 0, 0)) {
|
||||||
if (warning!=String()) {
|
if (warning != String()) {
|
||||||
warning+="\n";
|
warning += "\n";
|
||||||
}
|
}
|
||||||
warning+=TTR("This bone lacks a proper REST pose. Go to the Skeleton2D node and set one.");
|
warning += TTR("This bone lacks a proper REST pose. Go to the Skeleton2D node and set one.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return warning;
|
return warning;
|
||||||
|
@ -161,12 +159,12 @@ String Bone2D::get_configuration_warning() const {
|
||||||
Bone2D::Bone2D() {
|
Bone2D::Bone2D() {
|
||||||
skeleton = NULL;
|
skeleton = NULL;
|
||||||
parent_bone = NULL;
|
parent_bone = NULL;
|
||||||
skeleton_index=-1;
|
skeleton_index = -1;
|
||||||
default_length=16;
|
default_length = 16;
|
||||||
set_notify_local_transform(true);
|
set_notify_local_transform(true);
|
||||||
//this is a clever hack so the bone knows no rest has been set yet, allowing to show an error.
|
//this is a clever hack so the bone knows no rest has been set yet, allowing to show an error.
|
||||||
for(int i=0;i<3;i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
rest[i]=Vector2(0,0);
|
rest[i] = Vector2(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,12 +192,12 @@ void Skeleton2D::_update_bone_setup() {
|
||||||
|
|
||||||
for (int i = 0; i < bones.size(); i++) {
|
for (int i = 0; i < bones.size(); i++) {
|
||||||
bones[i].rest_inverse = bones[i].bone->get_skeleton_rest().affine_inverse(); //bind pose
|
bones[i].rest_inverse = bones[i].bone->get_skeleton_rest().affine_inverse(); //bind pose
|
||||||
bones[i].bone->skeleton_index=i;
|
bones[i].bone->skeleton_index = i;
|
||||||
Bone2D *parent_bone = Object::cast_to<Bone2D>(bones[i].bone->get_parent());
|
Bone2D *parent_bone = Object::cast_to<Bone2D>(bones[i].bone->get_parent());
|
||||||
if (parent_bone) {
|
if (parent_bone) {
|
||||||
bones[i].parent_index=parent_bone->skeleton_index;
|
bones[i].parent_index = parent_bone->skeleton_index;
|
||||||
} else {
|
} else {
|
||||||
bones[i].parent_index=-1;
|
bones[i].parent_index = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,8 +228,8 @@ void Skeleton2D::_update_transform() {
|
||||||
|
|
||||||
for (int i = 0; i < bones.size(); i++) {
|
for (int i = 0; i < bones.size(); i++) {
|
||||||
|
|
||||||
ERR_CONTINUE(bones[i].parent_index>=i);
|
ERR_CONTINUE(bones[i].parent_index >= i);
|
||||||
if (bones[i].parent_index>=0) {
|
if (bones[i].parent_index >= 0) {
|
||||||
bones[i].accum_transform = bones[bones[i].parent_index].accum_transform * bones[i].bone->get_transform();
|
bones[i].accum_transform = bones[bones[i].parent_index].accum_transform * bones[i].bone->get_transform();
|
||||||
} else {
|
} else {
|
||||||
bones[i].accum_transform = bones[i].bone->get_transform();
|
bones[i].accum_transform = bones[i].bone->get_transform();
|
||||||
|
@ -277,7 +275,7 @@ void Skeleton2D::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
if (p_what == NOTIFICATION_TRANSFORM_CHANGED) {
|
||||||
VS::get_singleton()->skeleton_set_base_transform_2d(skeleton,get_global_transform());
|
VS::get_singleton()->skeleton_set_base_transform_2d(skeleton, get_global_transform());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,13 @@ class Skeleton2D;
|
||||||
class Bone2D : public Node2D {
|
class Bone2D : public Node2D {
|
||||||
GDCLASS(Bone2D, Node2D)
|
GDCLASS(Bone2D, Node2D)
|
||||||
|
|
||||||
|
friend class Skeleton2D;
|
||||||
|
|
||||||
Bone2D *parent_bone;
|
Bone2D *parent_bone;
|
||||||
Skeleton2D *skeleton;
|
Skeleton2D *skeleton;
|
||||||
Transform2D rest;
|
Transform2D rest;
|
||||||
float default_length;
|
float default_length;
|
||||||
|
|
||||||
friend class Skeleton2D;
|
|
||||||
int skeleton_index;
|
int skeleton_index;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue