Style: Fix some badly formatted files

This commit is contained in:
Rémi Verschelde 2017-04-08 01:42:41 +02:00
parent e9b045d9e5
commit 2491754de7
7 changed files with 43 additions and 42 deletions

View File

@ -655,10 +655,10 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
menu->clear();
menu->set_size(Size2(1, 1));
if (p_name=="script/script" && hint_text=="Script" && owner->cast_to<Node>()) {
menu->add_icon_item(get_icon("Script","EditorIcons"),TTR("New Script"),OBJ_MENU_NEW_SCRIPT);
if (p_name == "script/script" && hint_text == "Script" && owner->cast_to<Node>()) {
menu->add_icon_item(get_icon("Script", "EditorIcons"), TTR("New Script"), OBJ_MENU_NEW_SCRIPT);
menu->add_separator();
} else if (hint_text!="") {
} else if (hint_text != "") {
int idx = 0;
for (int i = 0; i < hint_text.get_slice_count(","); i++) {

View File

@ -64,7 +64,7 @@ class CustomPropertyEditor : public Popup {
OBJ_MENU_COPY = 4,
OBJ_MENU_PASTE = 5,
OBJ_MENU_REIMPORT = 6,
OBJ_MENU_NEW_SCRIPT=7,
OBJ_MENU_NEW_SCRIPT = 7,
TYPE_BASE_ID = 100
};

View File

@ -60,7 +60,7 @@ void SceneTreeDock::_unhandled_key_input(InputEvent p_event) {
_tool_selected(TOOL_DUPLICATE);
} else if (ED_IS_SHORTCUT("scene_tree/attach_script", p_event)) {
_tool_selected(TOOL_ATTACH_SCRIPT);
} else if(ED_IS_SHORTCUT("scene_tree/clear_script", p_event)) {
} else if (ED_IS_SHORTCUT("scene_tree/clear_script", p_event)) {
_tool_selected(TOOL_CLEAR_SCRIPT);
} else if (ED_IS_SHORTCUT("scene_tree/move_up", p_event)) {
_tool_selected(TOOL_MOVE_UP);
@ -353,11 +353,11 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
} break;
case TOOL_CLEAR_SCRIPT: {
Node *selected = scene_tree->get_selected();
if(!selected)
if (!selected)
break;
Ref<Script> existing = selected->get_script();
if(existing.is_valid()) {
if (existing.is_valid()) {
const RefPtr empty;
selected->set_script(empty);
}
@ -690,7 +690,7 @@ void SceneTreeDock::_notification(int p_what) {
}
button_add->set_icon(get_icon("Add", "EditorIcons"));
button_instance->set_icon(get_icon("Instance", "EditorIcons"));
button_create_script->set_icon(get_icon("ScriptCreate","EditorIcons"));
button_create_script->set_icon(get_icon("ScriptCreate", "EditorIcons"));
button_clear_script->set_icon(get_icon("Remove", "EditorIcons"));
filter_icon->set_texture(get_icon("Zoom", "EditorIcons"));
@ -1262,12 +1262,11 @@ void SceneTreeDock::_selection_changed() {
_tool_selected(TOOL_MULTI_EDIT);
}
if (selection_size==1) {
if(EditorNode::get_singleton()->get_editor_selection()->get_selection().front()->key()->get_script().is_null()) {
if (selection_size == 1) {
if (EditorNode::get_singleton()->get_editor_selection()->get_selection().front()->key()->get_script().is_null()) {
button_create_script->show();
button_clear_script->hide();
}
else {
} else {
button_create_script->hide();
button_clear_script->show();
}
@ -1735,9 +1734,9 @@ void SceneTreeDock::set_filter(const String &p_filter) {
scene_tree->set_filter(p_filter);
}
void SceneTreeDock::open_script_dialog(Node* p_for_node) {
void SceneTreeDock::open_script_dialog(Node *p_for_node) {
scene_tree->set_selected(p_for_node,false);
scene_tree->set_selected(p_for_node, false);
_tool_selected(TOOL_ATTACH_SCRIPT);
}
@ -1820,11 +1819,11 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
filter->connect("text_changed", this, "_filter_changed");
tb = memnew(ToolButton);
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_ATTACH_SCRIPT, false));
tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_ATTACH_SCRIPT, false));
tb->set_tooltip(TTR("Attach a new or existing script for the selected node."));
tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script"));
filter_hbc->add_child(tb);
button_create_script=tb;
button_create_script = tb;
tb = memnew(ToolButton);
tb->connect("pressed", this, "_tool_selected", make_binds(TOOL_CLEAR_SCRIPT, false));

View File

@ -174,7 +174,7 @@ public:
SceneTreeEditor *get_tree_editor() { return scene_tree; }
EditorData *get_editor_data() { return editor_data; }
void open_script_dialog(Node* p_for_node);
void open_script_dialog(Node *p_for_node);
SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSelection *p_editor_selection, EditorData &p_editor_data);
};

View File

@ -95,7 +95,7 @@ void ScriptCreateDialog::_class_name_changed(const String &p_name) {
void ScriptCreateDialog::ok_pressed() {
if (create_new){
if (create_new) {
_create_new();
} else {
_load_exist();
@ -103,7 +103,6 @@ void ScriptCreateDialog::ok_pressed() {
create_new = true;
_update_controls();
}
void ScriptCreateDialog::_create_new() {
@ -179,7 +178,7 @@ void ScriptCreateDialog::_lang_changed(int l) {
class_name->set_editable(false);
}
String selected_ext = "."+ScriptServer::get_language(l)->get_extension();
String selected_ext = "." + ScriptServer::get_language(l)->get_extension();
String path = file_path->get_text();
String extension = "";
if (path.find(".") >= 0) {
@ -194,13 +193,13 @@ void ScriptCreateDialog::_lang_changed(int l) {
// change extension by selected language
List<String> extensions;
// get all possible extensions for script
for (int l = 0; l<language_menu->get_item_count(); l++) {
ScriptServer::get_language( l )->get_recognized_extensions(&extensions);
for (int l = 0; l < language_menu->get_item_count(); l++) {
ScriptServer::get_language(l)->get_recognized_extensions(&extensions);
}
for(List<String>::Element *E = extensions.front(); E; E = E->next()) {
for (List<String>::Element *E = extensions.front(); E; E = E->next()) {
if (E->get().nocasecmp_to(extension) == 0) {
path = path.basename()+selected_ext;
path = path.basename() + selected_ext;
_path_changed(path);
break;
}
@ -289,7 +288,7 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
// get all possible extensions for script
for (int l = 0; l < language_menu->get_item_count(); l++) {
ScriptServer::get_language( l )->get_recognized_extensions(&extensions);
ScriptServer::get_language(l)->get_recognized_extensions(&extensions);
}
bool found = false;

View File

@ -436,7 +436,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev.mouse_button.y = touch[0].pos.y;
ev.mouse_button.global_x = touch[0].pos.x;
ev.mouse_button.global_y = touch[0].pos.y;
input->set_mouse_pos(Point2(touch[0].pos.x,touch[0].pos.y));
input->set_mouse_pos(Point2(touch[0].pos.x, touch[0].pos.y));
last_mouse = touch[0].pos;
input->parse_input_event(ev);
}
@ -519,7 +519,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev.mouse_button.y = touch[0].pos.y;
ev.mouse_button.global_x = touch[0].pos.x;
ev.mouse_button.global_y = touch[0].pos.y;
input->set_mouse_pos(Point2(touch[0].pos.x,touch[0].pos.y));
input->set_mouse_pos(Point2(touch[0].pos.x, touch[0].pos.y));
input->parse_input_event(ev);
for (int i = 0; i < touch.size(); i++) {

View File

@ -207,21 +207,24 @@ struct GJK {
real_t weights[4];
U mask = 0;
switch (cs.rank) {
case 2: sqdist = projectorigin(cs.c[0]->w,
cs.c[1]->w,
weights, mask);
break;
case 3: sqdist = projectorigin(cs.c[0]->w,
cs.c[1]->w,
cs.c[2]->w,
weights, mask);
break;
case 4: sqdist = projectorigin(cs.c[0]->w,
cs.c[1]->w,
cs.c[2]->w,
cs.c[3]->w,
weights, mask);
break;
case 2:
sqdist = projectorigin(cs.c[0]->w,
cs.c[1]->w,
weights, mask);
break;
case 3:
sqdist = projectorigin(cs.c[0]->w,
cs.c[1]->w,
cs.c[2]->w,
weights, mask);
break;
case 4:
sqdist = projectorigin(cs.c[0]->w,
cs.c[1]->w,
cs.c[2]->w,
cs.c[3]->w,
weights, mask);
break;
}
if (sqdist >= 0) { /* Valid */
ns.rank = 0;