Skip to content

Commit

Permalink
Style: Fix issues that went past CI
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga committed Aug 21, 2018
1 parent a319d72 commit 404ee1a
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 143 deletions.
25 changes: 7 additions & 18 deletions editor/plugins/animation_blend_space_1d_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
#include "scene/animation/animation_blend_tree.h"

StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const {
StringName path = AnimationTreeEditor::get_singleton()->get_base_path()+"blend_position";
StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + "blend_position";
return path;
}


void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;

Expand Down Expand Up @@ -55,7 +54,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
continue;

int idx = menu->get_item_count();
menu->add_item(vformat("Add %s", name),idx);
menu->add_item(vformat("Add %s", name), idx);
menu->set_item_metadata(idx, E->get());
}

Expand Down Expand Up @@ -136,7 +135,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
blend_pos += blend_space->get_min_space();

AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos);
AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos);
blend_space_draw->update();
}

Expand All @@ -159,7 +158,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
blend_pos += blend_space->get_min_space();

AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos);
AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos);

blend_space_draw->update();
}
Expand Down Expand Up @@ -258,7 +257,6 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() {

float point = AnimationTreeEditor::get_singleton()->get_tree()->get(get_blend_position_path());


point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space());
point *= s.width;

Expand Down Expand Up @@ -501,8 +499,6 @@ void AnimationNodeBlendSpace1DEditor::_open_editor() {
}
}



void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
Expand All @@ -514,7 +510,6 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
tool_erase->set_icon(get_icon("Remove", "EditorIcons"));
snap->set_icon(get_icon("SnapGrid", "EditorIcons"));
open_editor->set_icon(get_icon("Edit", "EditorIcons"));

}

if (p_what == NOTIFICATION_PROCESS) {
Expand All @@ -536,7 +531,7 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) {
}
}

if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
set_process(is_visible_in_tree());
}
}
Expand All @@ -561,22 +556,17 @@ void AnimationNodeBlendSpace1DEditor::_bind_methods() {
ClassDB::bind_method("_open_editor", &AnimationNodeBlendSpace1DEditor::_open_editor);

ClassDB::bind_method("_file_opened", &AnimationNodeBlendSpace1DEditor::_file_opened);



}

bool AnimationNodeBlendSpace1DEditor::can_edit(const Ref<AnimationNode> &p_node) {

Ref<AnimationNodeBlendSpace1D> b1d=p_node;
Ref<AnimationNodeBlendSpace1D> b1d = p_node;
return b1d.is_valid();
}

void AnimationNodeBlendSpace1DEditor::edit(const Ref<AnimationNode> &p_node) {



blend_space=p_node;
blend_space = p_node;

if (!blend_space.is_null()) {
_update_space();
Expand All @@ -595,7 +585,6 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
Ref<ButtonGroup> bg;
bg.instance();


tool_blend = memnew(ToolButton);
tool_blend->set_toggle_mode(true);
tool_blend->set_button_group(bg);
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/animation_blend_space_1d_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/property_editor.h"
#include "scene/animation/animation_blend_space_1d.h"
#include "scene/gui/button.h"
#include "scene/gui/graph_edit.h"
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
#include "editor/plugins/animation_tree_editor_plugin.h"

class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {

Expand Down
16 changes: 6 additions & 10 deletions editor/plugins/animation_blend_space_2d_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

bool AnimationNodeBlendSpace2DEditor::can_edit(const Ref<AnimationNode> &p_node) {

Ref<AnimationNodeBlendSpace2D> bs2d=p_node;
Ref<AnimationNodeBlendSpace2D> bs2d = p_node;
return bs2d.is_valid();
}

Expand All @@ -27,7 +27,7 @@ void AnimationNodeBlendSpace2DEditor::edit(const Ref<AnimationNode> &p_node) {
}

StringName AnimationNodeBlendSpace2DEditor::get_blend_position_path() const {
StringName path = AnimationTreeEditor::get_singleton()->get_base_path()+"blend_position";
StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + "blend_position";
return path;
}

Expand Down Expand Up @@ -73,7 +73,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
if (name == "Animation")
continue; // nope
int idx = menu->get_item_count();
menu->add_item(vformat("Add %s", name),idx);
menu->add_item(vformat("Add %s", name), idx);
menu->set_item_metadata(idx, E->get());
}

Expand All @@ -85,7 +85,6 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
menu->add_separator();
menu->add_item(TTR("Load.."), MENU_LOAD_FILE);


menu->set_global_position(blend_space_draw->get_global_transform().xform(mb->get_position()));
menu->popup();
add_point_pos = (mb->get_position() / blend_space_draw->get_size());
Expand Down Expand Up @@ -211,7 +210,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
blend_pos += blend_space->get_min_space();

AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos);
AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos);

blend_space_draw->update();
}
Expand Down Expand Up @@ -246,7 +245,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
blend_pos += blend_space->get_min_space();

AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos);
AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos);

blend_space_draw->update();
}
Expand Down Expand Up @@ -750,12 +749,11 @@ void AnimationNodeBlendSpace2DEditor::_notification(int p_what) {
}
}

if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
set_process(is_visible_in_tree());
}
}


void AnimationNodeBlendSpace2DEditor::_open_editor() {

if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) {
Expand Down Expand Up @@ -804,7 +802,6 @@ void AnimationNodeBlendSpace2DEditor::_bind_methods() {
ClassDB::bind_method("_auto_triangles_toggled", &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled);

ClassDB::bind_method("_file_opened", &AnimationNodeBlendSpace2DEditor::_file_opened);

}

AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = NULL;
Expand Down Expand Up @@ -1019,4 +1016,3 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() {
dragging_selected = false;
dragging_selected_attempt = false;
}

4 changes: 1 addition & 3 deletions editor/plugins/animation_blend_space_2d_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/property_editor.h"
#include "scene/animation/animation_blend_space_2d.h"
#include "scene/gui/button.h"
#include "scene/gui/graph_edit.h"
#include "scene/gui/popup.h"
#include "scene/gui/tree.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
Expand All @@ -20,7 +20,6 @@ class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin {

Ref<AnimationNodeBlendSpace2D> blend_space;


PanelContainer *panel;
ToolButton *tool_blend;
ToolButton *tool_select;
Expand Down Expand Up @@ -119,5 +118,4 @@ class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin {
AnimationNodeBlendSpace2DEditor();
};


#endif // ANIMATION_BLEND_SPACE_2D_EDITOR_H
2 changes: 1 addition & 1 deletion editor/spatial_editor_gizmos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3655,7 +3655,7 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_collision_segments(lines);
}

//////
//////

#define BODY_A_RADIUS 0.25
#define BODY_B_RADIUS 0.27
Expand Down
4 changes: 2 additions & 2 deletions modules/mono/utils/thread_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct ThreadLocalStorage::Impl {
#define _CALLBACK_FUNC_
#endif

Impl(void (_CALLBACK_FUNC_ *p_destr_callback_func)(void *)) {
Impl(void(_CALLBACK_FUNC_ *p_destr_callback_func)(void *)) {
#ifdef WINDOWS_ENABLED
dwFlsIndex = FlsAlloc(p_destr_callback_func);
ERR_FAIL_COND(dwFlsIndex == FLS_OUT_OF_INDEXES);
Expand All @@ -95,7 +95,7 @@ void ThreadLocalStorage::set_value(void *p_value) const {
pimpl->set_value(p_value);
}

void ThreadLocalStorage::alloc(void (_CALLBACK_FUNC_ *p_destr_callback)(void *)) {
void ThreadLocalStorage::alloc(void(_CALLBACK_FUNC_ *p_destr_callback)(void *)) {
pimpl = memnew(ThreadLocalStorage::Impl(p_destr_callback));
}

Expand Down
3 changes: 1 addition & 2 deletions modules/mono/utils/thread_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct ThreadLocalStorage {
void *get_value() const;
void set_value(void *p_value) const;

void alloc(void (_CALLBACK_FUNC_ *p_dest_callback)(void *));
void alloc(void(_CALLBACK_FUNC_ *p_dest_callback)(void *));
void free();

private:
Expand All @@ -95,7 +95,6 @@ class ThreadLocal {
memdelete(static_cast<T *>(tls_data));
}


T *_tls_get_value() const {
void *tls_data = storage.get_value();

Expand Down
35 changes: 13 additions & 22 deletions scene/animation/animation_blend_space_1d.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "animation_blend_space_1d.h"


void AnimationNodeBlendSpace1D::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::REAL,blend_position));
r_list->push_back(PropertyInfo(Variant::REAL, blend_position));
}
Variant AnimationNodeBlendSpace1D::get_parameter_default_value(const StringName &p_parameter) const {
return 0;
Expand Down Expand Up @@ -64,10 +63,10 @@ void AnimationNodeBlendSpace1D::_bind_methods() {
}

void AnimationNodeBlendSpace1D::get_child_nodes(List<ChildNode> *r_child_nodes) {
for(int i=0;i<blend_points_used;i++) {
for (int i = 0; i < blend_points_used; i++) {
ChildNode cn;
cn.name=itos(i);
cn.node=blend_points[i].node;
cn.name = itos(i);
cn.node = blend_points[i].node;
r_child_nodes->push_back(cn);
}
}
Expand All @@ -89,12 +88,10 @@ void AnimationNodeBlendSpace1D::add_blend_point(const Ref<AnimationRootNode> &p_
blend_points[p_at_index].node = p_node;
blend_points[p_at_index].position = p_position;

blend_points[p_at_index].node->connect("tree_changed",this,"_tree_changed",varray(),CONNECT_REFERENCE_COUNTED);
blend_points[p_at_index].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED);

blend_points_used++;
emit_signal("tree_changed");


}

void AnimationNodeBlendSpace1D::set_blend_point_position(int p_point, float p_position) {
Expand All @@ -108,14 +105,13 @@ void AnimationNodeBlendSpace1D::set_blend_point_node(int p_point, const Ref<Anim
ERR_FAIL_COND(p_node.is_null());

if (blend_points[p_point].node.is_valid()) {
blend_points[p_point].node->disconnect("tree_changed",this,"_tree_changed");
blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed");
}

blend_points[p_point].node = p_node;
blend_points[p_point].node->connect("tree_changed",this,"_tree_changed",varray(),CONNECT_REFERENCE_COUNTED);
blend_points[p_point].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED);

emit_signal("tree_changed");

}

float AnimationNodeBlendSpace1D::get_blend_point_position(int p_point) const {
Expand All @@ -131,16 +127,14 @@ Ref<AnimationRootNode> AnimationNodeBlendSpace1D::get_blend_point_node(int p_poi
void AnimationNodeBlendSpace1D::remove_blend_point(int p_point) {
ERR_FAIL_INDEX(p_point, blend_points_used);

blend_points[p_point].node->disconnect("tree_changed",this,"_tree_changed");
blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed");

for (int i = p_point; i < blend_points_used - 1; i++) {
blend_points[i] = blend_points[i + 1];
}


blend_points_used--;
emit_signal("tree_changed");

}

int AnimationNodeBlendSpace1D::get_blend_point_count() const {
Expand Down Expand Up @@ -180,7 +174,6 @@ float AnimationNodeBlendSpace1D::get_snap() const {
return snap;
}


void AnimationNodeBlendSpace1D::set_value_label(const String &p_label) {
value_label = p_label;
}
Expand All @@ -203,10 +196,9 @@ float AnimationNodeBlendSpace1D::process(float p_time, bool p_seek) {
return 0.0;
}


if (blend_points_used == 1) {
// only one point available, just play that animation
return blend_node(blend_points[0].name,blend_points[0].node, p_time, p_seek, 1.0, FILTER_IGNORE, false);
return blend_node(blend_points[0].name, blend_points[0].node, p_time, p_seek, 1.0, FILTER_IGNORE, false);
}

float blend_pos = get_parameter(blend_position);
Expand Down Expand Up @@ -277,7 +269,7 @@ float AnimationNodeBlendSpace1D::process(float p_time, bool p_seek) {
float max_time_remaining = 0.0;

for (int i = 0; i < blend_points_used; i++) {
float remaining = blend_node(blend_points[i].name,blend_points[i].node, p_time, p_seek, weights[i], FILTER_IGNORE, false);
float remaining = blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, weights[i], FILTER_IGNORE, false);

max_time_remaining = MAX(max_time_remaining, remaining);
}
Expand All @@ -291,8 +283,8 @@ String AnimationNodeBlendSpace1D::get_caption() const {

AnimationNodeBlendSpace1D::AnimationNodeBlendSpace1D() {

for(int i=0;i<MAX_BLEND_POINTS;i++) {
blend_points[i].name=itos(i);
for (int i = 0; i < MAX_BLEND_POINTS; i++) {
blend_points[i].name = itos(i);
}
blend_points_used = 0;
max_space = 1;
Expand All @@ -301,9 +293,8 @@ AnimationNodeBlendSpace1D::AnimationNodeBlendSpace1D() {
snap = 0.1;
value_label = "value";

blend_position="blend_position";
blend_position = "blend_position";
}

AnimationNodeBlendSpace1D::~AnimationNodeBlendSpace1D() {

}
Loading

0 comments on commit 404ee1a

Please sign in to comment.