You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
@@ -43,7 +43,6 @@
|
||||
#include "scene/main/viewport.h"
|
||||
|
||||
void AnimationNodeBlendTreeEditor::add_custom_type(const String &p_name, const Ref<Script> &p_script) {
|
||||
|
||||
for (int i = 0; i < add_options.size(); i++) {
|
||||
ERR_FAIL_COND(add_options[i].script == p_script);
|
||||
}
|
||||
@@ -57,7 +56,6 @@ void AnimationNodeBlendTreeEditor::add_custom_type(const String &p_name, const R
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::remove_custom_type(const Ref<Script> &p_script) {
|
||||
|
||||
for (int i = 0; i < add_options.size(); i++) {
|
||||
if (add_options[i].script == p_script) {
|
||||
add_options.remove(i);
|
||||
@@ -69,7 +67,6 @@ void AnimationNodeBlendTreeEditor::remove_custom_type(const Ref<Script> &p_scrip
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_update_options_menu() {
|
||||
|
||||
add_node->get_popup()->clear();
|
||||
for (int i = 0; i < add_options.size(); i++) {
|
||||
add_node->get_popup()->add_item(add_options[i].name, i);
|
||||
@@ -86,12 +83,10 @@ void AnimationNodeBlendTreeEditor::_update_options_menu() {
|
||||
}
|
||||
|
||||
Size2 AnimationNodeBlendTreeEditor::get_minimum_size() const {
|
||||
|
||||
return Size2(10, 200);
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_property_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing) {
|
||||
|
||||
AnimationTree *tree = AnimationTreeEditor::get_singleton()->get_tree();
|
||||
updating = true;
|
||||
undo_redo->create_action(TTR("Parameter Changed") + ": " + String(p_property), UndoRedo::MERGE_ENDS);
|
||||
@@ -104,7 +99,6 @@ void AnimationNodeBlendTreeEditor::_property_changed(const StringName &p_propert
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_update_graph() {
|
||||
|
||||
if (updating)
|
||||
return;
|
||||
|
||||
@@ -115,7 +109,6 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
||||
graph->clear_connections();
|
||||
//erase all nodes
|
||||
for (int i = 0; i < graph->get_child_count(); i++) {
|
||||
|
||||
if (Object::cast_to<GraphNode>(graph->get_child(i))) {
|
||||
memdelete(graph->get_child(i));
|
||||
i--;
|
||||
@@ -128,7 +121,6 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
||||
blend_tree->get_node_list(&nodes);
|
||||
|
||||
for (List<StringName>::Element *E = nodes.front(); E; E = E->next()) {
|
||||
|
||||
GraphNode *node = memnew(GraphNode);
|
||||
graph->add_child(node);
|
||||
|
||||
@@ -163,7 +155,6 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
||||
List<PropertyInfo> pinfo;
|
||||
agnode->get_parameter_list(&pinfo);
|
||||
for (List<PropertyInfo>::Element *F = pinfo.front(); F; F = F->next()) {
|
||||
|
||||
if (!(F->get().usage & PROPERTY_USAGE_EDITOR)) {
|
||||
continue;
|
||||
}
|
||||
@@ -192,7 +183,6 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
||||
}
|
||||
|
||||
if (agnode->has_filter()) {
|
||||
|
||||
node->add_child(memnew(HSeparator));
|
||||
Button *edit_filters = memnew(Button);
|
||||
edit_filters->set_text(TTR("Edit Filters"));
|
||||
@@ -204,7 +194,6 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
||||
|
||||
Ref<AnimationNodeAnimation> anim = agnode;
|
||||
if (anim.is_valid()) {
|
||||
|
||||
MenuButton *mb = memnew(MenuButton);
|
||||
mb->set_text(anim->get_animation());
|
||||
mb->set_icon(get_icon("Animation", "EditorIcons"));
|
||||
@@ -259,7 +248,6 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
||||
blend_tree->get_node_connections(&connections);
|
||||
|
||||
for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = connections.front(); E; E = E->next()) {
|
||||
|
||||
StringName from = E->get().output_node;
|
||||
StringName to = E->get().input_node;
|
||||
int to_idx = E->get().input_index;
|
||||
@@ -272,7 +260,6 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_file_opened(const String &p_file) {
|
||||
|
||||
file_loaded = ResourceLoader::load(p_file);
|
||||
if (file_loaded.is_valid()) {
|
||||
_add_node(MENU_LOAD_FILE_CONFIRM);
|
||||
@@ -280,13 +267,11 @@ void AnimationNodeBlendTreeEditor::_file_opened(const String &p_file) {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
|
||||
|
||||
Ref<AnimationNode> anode;
|
||||
|
||||
String base_name;
|
||||
|
||||
if (p_idx == MENU_LOAD_FILE) {
|
||||
|
||||
open_file->clear_filters();
|
||||
List<String> filters;
|
||||
ResourceLoader::get_recognized_extensions_for_type("AnimationNode", &filters);
|
||||
@@ -300,7 +285,6 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
|
||||
file_loaded.unref();
|
||||
base_name = anode->get_class();
|
||||
} else if (p_idx == MENU_PASTE) {
|
||||
|
||||
anode = EditorSettings::get_singleton()->get_resource_clipboard();
|
||||
ERR_FAIL_COND(!anode.is_valid());
|
||||
base_name = anode->get_class();
|
||||
@@ -350,7 +334,6 @@ void AnimationNodeBlendTreeEditor::_add_node(int p_idx) {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_node_dragged(const Vector2 &p_from, const Vector2 &p_to, const StringName &p_which) {
|
||||
|
||||
updating = true;
|
||||
undo_redo->create_action(TTR("Node Moved"));
|
||||
undo_redo->add_do_method(blend_tree.ptr(), "set_node_position", p_which, p_to / EDSCALE);
|
||||
@@ -362,7 +345,6 @@ void AnimationNodeBlendTreeEditor::_node_dragged(const Vector2 &p_from, const Ve
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_connection_request(const String &p_from, int p_from_index, const String &p_to, int p_to_index) {
|
||||
|
||||
AnimationNodeBlendTree::ConnectionError err = blend_tree->can_connect_node(p_to, p_to_index, p_from);
|
||||
|
||||
if (err != AnimationNodeBlendTree::CONNECTION_OK) {
|
||||
@@ -379,7 +361,6 @@ void AnimationNodeBlendTreeEditor::_connection_request(const String &p_from, int
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_disconnection_request(const String &p_from, int p_from_index, const String &p_to, int p_to_index) {
|
||||
|
||||
graph->disconnect_node(p_from, p_from_index, p_to, p_to_index);
|
||||
|
||||
updating = true;
|
||||
@@ -393,7 +374,6 @@ void AnimationNodeBlendTreeEditor::_disconnection_request(const String &p_from,
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_anim_selected(int p_index, Array p_options, const String &p_node) {
|
||||
|
||||
String option = p_options[p_index];
|
||||
|
||||
Ref<AnimationNodeAnimation> anim = blend_tree->get_node(p_node);
|
||||
@@ -408,7 +388,6 @@ void AnimationNodeBlendTreeEditor::_anim_selected(int p_index, Array p_options,
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_delete_request(const String &p_which) {
|
||||
|
||||
undo_redo->create_action(TTR("Delete Node"));
|
||||
undo_redo->add_do_method(blend_tree.ptr(), "remove_node", p_which);
|
||||
undo_redo->add_undo_method(blend_tree.ptr(), "add_node", p_which, blend_tree->get_node(p_which), blend_tree.ptr()->get_node_position(p_which));
|
||||
@@ -428,7 +407,6 @@ void AnimationNodeBlendTreeEditor::_delete_request(const String &p_which) {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_delete_nodes_request() {
|
||||
|
||||
List<StringName> to_erase;
|
||||
|
||||
for (int i = 0; i < graph->get_child_count(); i++) {
|
||||
@@ -453,7 +431,6 @@ void AnimationNodeBlendTreeEditor::_delete_nodes_request() {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_popup_request(const Vector2 &p_position) {
|
||||
|
||||
_update_options_menu();
|
||||
use_popup_menu_position = true;
|
||||
popup_menu_position = graph->get_local_mouse_position();
|
||||
@@ -462,7 +439,6 @@ void AnimationNodeBlendTreeEditor::_popup_request(const Vector2 &p_position) {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_node_selected(Object *p_node) {
|
||||
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(p_node);
|
||||
ERR_FAIL_COND(!gn);
|
||||
|
||||
@@ -475,14 +451,12 @@ void AnimationNodeBlendTreeEditor::_node_selected(Object *p_node) {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_open_in_editor(const String &p_which) {
|
||||
|
||||
Ref<AnimationNode> an = blend_tree->get_node(p_which);
|
||||
ERR_FAIL_COND(!an.is_valid());
|
||||
AnimationTreeEditor::get_singleton()->enter_editor(p_which);
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_filter_toggled() {
|
||||
|
||||
updating = true;
|
||||
undo_redo->create_action(TTR("Toggle Filter On/Off"));
|
||||
undo_redo->add_do_method(_filter_edit.ptr(), "set_filter_enabled", filter_enabled->is_pressed());
|
||||
@@ -494,7 +468,6 @@ void AnimationNodeBlendTreeEditor::_filter_toggled() {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_filter_edited() {
|
||||
|
||||
TreeItem *edited = filters->get_edited();
|
||||
ERR_FAIL_COND(!edited);
|
||||
|
||||
@@ -512,7 +485,6 @@ void AnimationNodeBlendTreeEditor::_filter_edited() {
|
||||
}
|
||||
|
||||
bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &anode) {
|
||||
|
||||
if (updating || _filter_edit != anode)
|
||||
return false;
|
||||
|
||||
@@ -545,7 +517,6 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
|
||||
player->get_animation_list(&animations);
|
||||
|
||||
for (List<StringName>::Element *E = animations.front(); E; E = E->next()) {
|
||||
|
||||
Ref<Animation> anim = player->get_animation(E->get());
|
||||
for (int i = 0; i < anim->get_track_count(); i++) {
|
||||
String track_path = anim->track_get_path(i);
|
||||
@@ -580,7 +551,6 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
|
||||
Map<String, TreeItem *> parenthood;
|
||||
|
||||
for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
|
||||
|
||||
NodePath path = E->get();
|
||||
TreeItem *ti = NULL;
|
||||
String accum;
|
||||
@@ -619,7 +589,6 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
|
||||
continue; //no node, can't edit
|
||||
|
||||
if (path.get_subname_count()) {
|
||||
|
||||
String concat = path.get_concatenated_subnames();
|
||||
|
||||
Skeleton *skeleton = Object::cast_to<Skeleton>(node);
|
||||
@@ -700,7 +669,6 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_edit_filters(const String &p_which) {
|
||||
|
||||
Ref<AnimationNode> anode = blend_tree->get_node(p_which);
|
||||
ERR_FAIL_COND(!anode.is_valid());
|
||||
|
||||
@@ -718,9 +686,7 @@ void AnimationNodeBlendTreeEditor::_removed_from_graph() {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_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"));
|
||||
error_label->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
|
||||
@@ -729,7 +695,6 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_PROCESS) {
|
||||
|
||||
String error;
|
||||
|
||||
if (!AnimationTreeEditor::get_singleton()->get_tree()->is_active()) {
|
||||
@@ -800,7 +765,6 @@ void AnimationNodeBlendTreeEditor::_scroll_changed(const Vector2 &p_scroll) {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method("_update_graph", &AnimationNodeBlendTreeEditor::_update_graph);
|
||||
ClassDB::bind_method("_add_node", &AnimationNodeBlendTreeEditor::_add_node);
|
||||
ClassDB::bind_method("_node_dragged", &AnimationNodeBlendTreeEditor::_node_dragged);
|
||||
@@ -829,7 +793,6 @@ void AnimationNodeBlendTreeEditor::_bind_methods() {
|
||||
AnimationNodeBlendTreeEditor *AnimationNodeBlendTreeEditor::singleton = NULL;
|
||||
|
||||
void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<AnimationNode> p_node) {
|
||||
|
||||
String prev_name = blend_tree->get_node_name(p_node);
|
||||
ERR_FAIL_COND(prev_name == String());
|
||||
GraphNode *gn = Object::cast_to<GraphNode>(graph->get_node(prev_name));
|
||||
@@ -882,7 +845,6 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
|
||||
blend_tree->get_node_connections(&connections);
|
||||
|
||||
for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = connections.front(); E; E = E->next()) {
|
||||
|
||||
StringName from = E->get().output_node;
|
||||
StringName to = E->get().input_node;
|
||||
int to_idx = E->get().input_index;
|
||||
@@ -912,7 +874,6 @@ bool AnimationNodeBlendTreeEditor::can_edit(const Ref<AnimationNode> &p_node) {
|
||||
}
|
||||
|
||||
void AnimationNodeBlendTreeEditor::edit(const Ref<AnimationNode> &p_node) {
|
||||
|
||||
if (blend_tree.is_valid()) {
|
||||
blend_tree->disconnect("removed_from_graph", this, "_removed_from_graph");
|
||||
}
|
||||
@@ -929,7 +890,6 @@ void AnimationNodeBlendTreeEditor::edit(const Ref<AnimationNode> &p_node) {
|
||||
}
|
||||
|
||||
AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {
|
||||
|
||||
singleton = this;
|
||||
updating = false;
|
||||
use_popup_menu_position = false;
|
||||
|
||||
Reference in New Issue
Block a user