diff options
Diffstat (limited to 'tools/editor')
58 files changed, 572 insertions, 514 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 668a135bc8..091bc701cc 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -479,7 +479,7 @@ public: } break; } - + return false; @@ -2207,7 +2207,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { if (ofsx < add_key_icon->get_width()) { - Animation::TrackType tt = animation->track_get_type(idx); + Animation::TrackType tt = animation->track_get_type(idx); float pos = timeline_pos; int existing = animation->track_find_key(idx,pos,true); @@ -3111,7 +3111,7 @@ void AnimationKeyEditor::_query_insert(const InsertData& p_id) { if (p_id.track_idx==-1) { if (bool(EDITOR_DEF("animation/confirm_insert_track",true))) { - //potential new key, does not exist + //potential new key, does not exist if (insert_data.size()==1) insert_confirm->set_text("Create NEW track for "+p_id.query+" and insert key?"); else @@ -3744,7 +3744,7 @@ void AnimationKeyEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_animation_loop_changed"),&AnimationKeyEditor::_animation_loop_changed); - ObjectTypeDB::bind_method(_MD("_animation_len_changed"),&AnimationKeyEditor::_animation_len_changed); + ObjectTypeDB::bind_method(_MD("_animation_len_changed"),&AnimationKeyEditor::_animation_len_changed); ObjectTypeDB::bind_method(_MD("_create_value_item"),&AnimationKeyEditor::_create_value_item); ObjectTypeDB::bind_method(_MD("_pane_drag"),&AnimationKeyEditor::_pane_drag); diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h index cd22dc3106..413c73b4b9 100644 --- a/tools/editor/animation_editor.h +++ b/tools/editor/animation_editor.h @@ -212,7 +212,7 @@ class AnimationKeyEditor : public VBoxContainer { ConfirmationDialog *scale_dialog; SpinBox *scale; - PropertyEditor *key_editor; + PropertyEditor *key_editor; SceneTreeDialog *call_select; diff --git a/tools/editor/call_dialog.cpp b/tools/editor/call_dialog.cpp index edcd7371f2..c5e9cdfa0d 100644 --- a/tools/editor/call_dialog.cpp +++ b/tools/editor/call_dialog.cpp @@ -39,22 +39,22 @@ class CallDialogParams : public Object { public: bool _set(const StringName& p_name, const Variant& p_value) { - + values[p_name]=p_value; return true; } - + bool _get(const StringName& p_name,Variant &r_ret) const { - + if (values.has(p_name)) { r_ret=values[p_name]; return true; } return false; } - + void _get_property_list( List<PropertyInfo> *p_list) const { - + for(int i=0;i<method.arguments.size();i++) p_list->push_back(method.arguments[i]); } @@ -67,9 +67,9 @@ public: void CallDialog::_notification(int p_what) { - + if (p_what==NOTIFICATION_READY) { - + call->connect("pressed", this,"_call"); cancel->connect("pressed", this,"_cancel"); //filter->get_path()->connect("text_changed", this,"_text_changed"); @@ -86,35 +86,35 @@ void CallDialog::_notification(int p_what) { } if (p_what==NOTIFICATION_DRAW) { - + RID ci = get_canvas_item(); - get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); - } + get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); + } } void CallDialog::_call() { - + if (!tree->get_selected()) return; - + TreeItem* item=tree->get_selected(); ERR_FAIL_COND(!item); int idx=item->get_metadata(0); ERR_FAIL_INDEX(idx,methods.size()); MethodInfo &m = methods[idx]; - + Variant args[VARIANT_ARG_MAX]; - + for(int i=0;i<VARIANT_ARG_MAX;i++) { - + if (i>=m.arguments.size()) continue; - + if (call_params->values.has(m.arguments[i].name)) args[i]=call_params->values[m.arguments[i].name]; } - + Variant ret = object->call(m.name,args[0],args[1],args[2],args[3],args[4]); if (ret.get_type()!=Variant::NIL) return_value->set_text(ret); @@ -123,7 +123,7 @@ void CallDialog::_call() { } void CallDialog::_cancel() { - + hide(); } @@ -132,23 +132,23 @@ void CallDialog::_item_selected() { TreeItem* item=tree->get_selected(); ERR_FAIL_COND(!item); - + if (item->get_metadata(0).get_type()==Variant::NIL) { - + call->set_disabled(true); return; } - + call->set_disabled(false); - + int idx=item->get_metadata(0); ERR_FAIL_INDEX(idx,methods.size()); - + MethodInfo &m = methods[idx]; call_params->values.clear(); call_params->method=m; - + property_editor->edit(call_params); property_editor->update_tree(); @@ -156,38 +156,38 @@ void CallDialog::_item_selected() { } void CallDialog::_update_method_list() { - + tree->clear(); if (!object) return; - + TreeItem *root = tree->create_item(); - + List<MethodInfo> method_list; object->get_method_list(&method_list); method_list.sort(); methods.clear(); - + List<String> inheritance_list; - + String type = object->get_type(); - - while(type!="") { + + while(type!="") { inheritance_list.push_back( type ); type=ObjectTypeDB::type_inherits_from(type); } - + TreeItem *selected_item=NULL; - + for(int i=0;i<inheritance_list.size();i++) { - + String type=inheritance_list[i]; String parent_type=ObjectTypeDB::type_inherits_from(type); TreeItem *type_item=NULL; - + List<MethodInfo>::Element *N,*E=method_list.front(); - + while(E) { N=E->next(); @@ -196,38 +196,38 @@ void CallDialog::_update_method_list() { E=N; continue; } - + if (!type_item) { type_item=tree->create_item(root); type_item->set_text(0,type); if (has_icon(type,"EditorIcons")) type_item->set_icon(0,get_icon(type,"EditorIcons")); } - + TreeItem *method_item = tree->create_item(type_item); method_item->set_text(0,E->get().name); method_item->set_metadata(0,methods.size()); if (E->get().name==selected) selected_item=method_item; methods.push_back( E->get() ); - + method_list.erase(E); E=N; } } - - - + + + if (selected_item) selected_item->select(0); } void CallDialog::_bind_methods() { - + ObjectTypeDB::bind_method("_call",&CallDialog::_call); ObjectTypeDB::bind_method("_cancel",&CallDialog::_cancel); ObjectTypeDB::bind_method("_item_selected", &CallDialog::_item_selected); - + } void CallDialog::set_object(Object *p_object,StringName p_selected) { @@ -252,22 +252,22 @@ CallDialog::CallDialog() { call->set_anchor( MARGIN_RIGHT, ANCHOR_END ); call->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); call->set_begin( Point2( 70, 29 ) ); - call->set_end( Point2( 15, 15 ) ); + call->set_end( Point2( 15, 15 ) ); call->set_text("Call"); - + add_child(call); - + cancel = memnew( Button ); cancel->set_anchor( MARGIN_TOP, ANCHOR_END ); cancel->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); cancel->set_begin( Point2( 15, 29 ) ); - cancel->set_end( Point2( 70, 15 ) ); + cancel->set_end( Point2( 70, 15 ) ); cancel->set_text("Close"); - + add_child(cancel); - + tree = memnew( Tree ); - + tree->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO ); tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); tree->set_begin( Point2( 20,50 ) ); @@ -275,60 +275,60 @@ CallDialog::CallDialog() { tree->set_margin(MARGIN_RIGHT, 0.5 ); tree->set_select_mode( Tree::SELECT_ROW ); add_child(tree); - + tree->connect("item_selected", this,"_item_selected"); tree->set_hide_root(true); - + property_editor = memnew( PropertyEditor ); - + property_editor->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 ); property_editor->set_anchor_and_margin( MARGIN_TOP, ANCHOR_BEGIN, 50 ); property_editor->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 ); property_editor->set_anchor_and_margin( MARGIN_BOTTOM, ANCHOR_END, 90 ); property_editor->get_scene_tree()->set_hide_root( true ); property_editor->hide_top_label(); - + add_child(property_editor); method_label = memnew( Label ); method_label->set_pos( Point2( 15,25) ); method_label->set_text("Method List:"); - + add_child(method_label); - + Label *label = memnew( Label ); label->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.53 ); label->set_anchor_and_margin( MARGIN_TOP, ANCHOR_BEGIN, 25 ); label->set_text("Arguments:"); - + add_child(label); - + return_label = memnew( Label ); return_label->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.53 ); return_label->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, 85 ); return_label->set_text("Return:"); - + add_child(return_label); - + return_value = memnew( LineEdit ); return_value->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_RATIO, 0.55 ); - return_value->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 ); + return_value->set_anchor_and_margin( MARGIN_RIGHT, ANCHOR_END, 15 ); return_value->set_anchor_and_margin( MARGIN_TOP, ANCHOR_END, 65 ); - + add_child(return_value); - + /* label = memnew( Label ); label->set_anchor( MARGIN_TOP, ANCHOR_END ); label->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); - + label->set_begin( Point2( 15,54) ); label->set_end( Point2( 16,44) ); label->set_text("Parameters:"); - + add_child(label); */ - + call_params = memnew( CallDialogParams ); set_as_toplevel(true); } diff --git a/tools/editor/call_dialog.h b/tools/editor/call_dialog.h index 2d04e7b6cd..a2ca925ff1 100644 --- a/tools/editor/call_dialog.h +++ b/tools/editor/call_dialog.h @@ -43,39 +43,39 @@ class CallDialogParams; class CallDialog : public Popup { - + OBJ_TYPE( CallDialog, Popup ); - + Label* method_label; Tree *tree; Button *call; Button *cancel; - + CallDialogParams *call_params; PropertyEditor *property_editor; - + Label *return_label; LineEdit *return_value; - Object *object; + Object *object; StringName selected; - + Vector<MethodInfo> methods; - - + + void _item_selected(); void _update_method_list(); void _call(); void _cancel(); - + protected: - static void _bind_methods(); + static void _bind_methods(); void _notification(int p_what); public: - + void set_object(Object *p_object,StringName p_selected=""); - - CallDialog(); + + CallDialog(); ~CallDialog(); }; diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index f7d335fba3..968d02dfa5 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -85,7 +85,7 @@ void FindReplaceDialog::popup_search() { skip->hide(); popup_centered(Point2(300,190)); get_ok()->set_text("Find"); - search_text->grab_focus(); + search_text->grab_focus(); if (text_edit->is_selection_active() && ( text_edit->get_selection_from_line() == text_edit->get_selection_to_line())) { search_text->set_text( text_edit->get_selection_text() ); @@ -544,7 +544,7 @@ void CodeTextEditor::set_error(const String& p_error) { } void CodeTextEditor::_on_settings_change() { - + // FONTS String editor_font = EDITOR_DEF("text_editor/font", ""); bool font_overrode = false; @@ -557,8 +557,8 @@ void CodeTextEditor::_on_settings_change() { } if(!font_overrode) text_editor->add_font_override("font",get_font("source","Fonts")); - - // AUTO BRACE COMPLETION + + // AUTO BRACE COMPLETION text_editor->set_auto_brace_completion( EDITOR_DEF("text_editor/auto_brace_complete", true) ); diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index 5ed7ce9052..e28517c601 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -55,7 +55,7 @@ public: void set_text_editor(TextEdit *p_text_editor); - GotoLineDialog(); + GotoLineDialog(); }; diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index 1e530b21c2..962062ae01 100644 --- a/tools/editor/connections_dialog.cpp +++ b/tools/editor/connections_dialog.cpp @@ -30,7 +30,7 @@ #include "scene/gui/label.h" - + #include "print_string.h" #include "editor_settings.h" @@ -91,11 +91,11 @@ public: }; void ConnectDialog::_notification(int p_what) { - + if (p_what==NOTIFICATION_DRAW) { - + RID ci = get_canvas_item(); - get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); + get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); } if (p_what==NOTIFICATION_ENTER_TREE) { @@ -104,7 +104,7 @@ void ConnectDialog::_notification(int p_what) { } void ConnectDialog::_tree_node_selected() { - + //dst_method_list->get_popup()->clear(); Node *current=tree->get_selected(); @@ -151,17 +151,17 @@ void ConnectDialog::_tree_node_selected() { } void ConnectDialog::_dst_method_list_selected(int p_idx) { - + //dst_method->set_text( dst_method_list->get_popup()->get_item_text(p_idx)); } void ConnectDialog::edit(Node *p_node) { - + node=p_node; - + //dst_method_list->get_popup()->clear(); - - + + tree->set_selected(NULL); tree->set_marked(node,true); dst_path->set_text(""); @@ -173,7 +173,7 @@ void ConnectDialog::edit(Node *p_node) { } void ConnectDialog::ok_pressed() { - + if (dst_method->get_text()=="") { error->set_text("Method in target Node must be specified!"); @@ -185,13 +185,13 @@ void ConnectDialog::ok_pressed() { } void ConnectDialog::_cancel_pressed() { - + hide(); } NodePath ConnectDialog::get_dst_path() const { - + return dst_path->get_text(); } @@ -207,11 +207,11 @@ bool ConnectDialog::get_oneshot() const { } StringName ConnectDialog::get_dst_method() const { - + String txt=dst_method->get_text(); if (txt.find("(")!=-1) txt=txt.left( txt.find("(")).strip_edges(); - return txt; + return txt; } @@ -280,7 +280,7 @@ void ConnectDialog::set_dst_method(const StringName& p_method) { } void ConnectDialog::_bind_methods() { - + //ObjectTypeDB::bind_method("_ok",&ConnectDialog::_ok_pressed); ObjectTypeDB::bind_method("_cancel",&ConnectDialog::_cancel_pressed); //ObjectTypeDB::bind_method("_dst_method_list_selected",&ConnectDialog::_dst_method_list_selected); @@ -293,17 +293,17 @@ void ConnectDialog::_bind_methods() { } ConnectDialog::ConnectDialog() { - + int margin = get_constant("margin","Dialogs"); int button_margin = get_constant("button_margin","Dialogs"); - - + + Label * label = memnew( Label ); label->set_pos( Point2( 8,11) ); label->set_text("Connect To Node:"); - - add_child(label); + + add_child(label); label = memnew( Label ); label->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); label->set_pos( Point2( 0.5,11) ); @@ -379,7 +379,7 @@ ConnectDialog::ConnectDialog() { label->set_begin( Point2( 8,124) ); label->set_end( Point2( 15,99) ); label->set_text("Path To Node:"); - + add_child(label); dst_path = memnew(LineEdit); @@ -390,11 +390,11 @@ ConnectDialog::ConnectDialog() { dst_path->set_end( Point2( 15,80 ) ); add_child(dst_path); - + label = memnew( Label ); label->set_anchor( MARGIN_TOP, ANCHOR_END ); label->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - label->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); + label->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); label->set_begin( Point2( 8,78 ) ); label->set_end( Point2( 15,52 ) ); label->set_text("Method In Node:"); @@ -420,7 +420,7 @@ ConnectDialog::ConnectDialog() { dst_method_list->set_anchor( MARGIN_RIGHT, ANCHOR_END ); dst_method_list->set_anchor( MARGIN_LEFT, ANCHOR_END ); dst_method_list->set_anchor( MARGIN_TOP, ANCHOR_END ); - dst_method_list->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); + dst_method_list->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); dst_method_list->set_begin( Point2( 70,59) ); dst_method_list->set_end( Point2( 15,39 ) ); */ @@ -446,14 +446,14 @@ ConnectDialog::ConnectDialog() { realtime->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); realtime->set_anchor( MARGIN_RIGHT, ANCHOR_END ); realtime->set_begin( Point2( 120, button_margin-10 ) ); - realtime->set_end( Point2( 80, margin ) ); + realtime->set_end( Point2( 80, margin ) ); realtime->set_text("Realtime"); add_child(realtime); */ - - + + // dst_method_list->get_popup()->connect("item_pressed", this,"_dst_method_list_selected"); tree->connect("node_selected", this,"_tree_node_selected"); @@ -468,8 +468,8 @@ ConnectDialog::ConnectDialog() { // error->get_cancel()->set_text("Close"); - - + + } @@ -481,21 +481,21 @@ ConnectDialog::~ConnectDialog() void ConnectionsDialog::_notification(int p_what) { - + if (p_what==NOTIFICATION_DRAW) { - + RID ci = get_canvas_item(); - get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); - } + get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); + } } void ConnectionsDialog::_close() { - - hide(); + + hide(); } void ConnectionsDialog::_connect() { - + TreeItem *it = tree->get_selected(); ERR_FAIL_COND(!it); String signal=it->get_metadata(0).operator Dictionary()["name"]; @@ -534,7 +534,7 @@ void ConnectionsDialog::_connect() { void ConnectionsDialog::ok_pressed() { - + TreeItem *item = tree->get_selected(); if (!item) { @@ -585,31 +585,31 @@ void ConnectionsDialog::ok_pressed() { } /* void ConnectionsDialog::_remove() { - + if (!tree->get_selected()) return; - + TreeItem *selected=tree->get_selected(); if (!selected) return; - + Dictionary meta=selected->get_metadata(0); - + remove_confirm->set_text(String()+"Remove Connection \""+meta["from_event"].operator String()+"\" ?"); remove_confirm->popup_centered(Size2(340,80)); } */ /* void ConnectionsDialog::_remove_confirm() { - + if (!tree->get_selected()) return; TreeItem *selected=tree->get_selected(); if (!selected) return; - + Dictionary meta=selected->get_metadata(0); - + undo_redo->create_action("Remove Subscription"); undo_redo->add_do_method(node,"unsubscribe_path_event",meta["from_event"].operator String(),meta["from_path"].operator NodePath(),meta["to_method"].operator String()); undo_redo->add_undo_method(node,"subscribe_path_event_persist",meta["from_event"].operator String(),meta["from_path"].operator NodePath(),meta["to_method"].operator String(),Array(),false); @@ -628,14 +628,14 @@ struct _ConnectionsDialogMethodInfoSort { }; void ConnectionsDialog::update_tree() { - + if (!is_visible()) return; //don't update if not visible, of course tree->clear(); - + if (!node) return; - + TreeItem *root=tree->create_item(); @@ -779,7 +779,7 @@ void ConnectionsDialog::update_tree() { } void ConnectionsDialog::set_node(Node* p_node) { - + node=p_node; update_tree(); } @@ -806,7 +806,7 @@ void ConnectionsDialog::_something_selected() { } void ConnectionsDialog::_bind_methods() { - + ObjectTypeDB::bind_method("_connect",&ConnectionsDialog::_connect); ObjectTypeDB::bind_method("_something_selected",&ConnectionsDialog::_something_selected); @@ -814,11 +814,11 @@ void ConnectionsDialog::_bind_methods() { // ObjectTypeDB::bind_method("_remove_confirm",&ConnectionsDialog::_remove_confirm); ObjectTypeDB::bind_method("update_tree",&ConnectionsDialog::update_tree); - + } ConnectionsDialog::ConnectionsDialog(EditorNode *p_editor) { - + editor=p_editor; set_title("Edit Connections.."); set_hide_on_ok(false); @@ -828,28 +828,28 @@ ConnectionsDialog::ConnectionsDialog(EditorNode *p_editor) { set_child_rect(vbc); - + tree = memnew( Tree ); tree->set_columns(1); tree->set_select_mode(Tree::SELECT_ROW); tree->set_hide_root(true); vbc->add_margin_child("Connections:",tree,true); - + // add_child(tree); - + connect_dialog = memnew( ConnectDialog ); connect_dialog->set_as_toplevel(true); add_child(connect_dialog); - + remove_confirm = memnew( ConfirmationDialog ); remove_confirm->set_as_toplevel(true); add_child(remove_confirm); - - /* + + /* node_only->set_anchor( MARGIN_TOP, ANCHOR_END ); node_only->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); node_only->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - + node_only->set_begin( Point2( 20,51) ); node_only->set_end( Point2( 10,44) ); */ @@ -859,7 +859,7 @@ ConnectionsDialog::ConnectionsDialog(EditorNode *p_editor) { connect_dialog->connect("connected", this,"_connect"); tree->connect("item_selected", this,"_something_selected"); get_cancel()->set_text("Close"); - + } diff --git a/tools/editor/connections_dialog.h b/tools/editor/connections_dialog.h index d5e228e799..575bcf54d7 100644 --- a/tools/editor/connections_dialog.h +++ b/tools/editor/connections_dialog.h @@ -47,9 +47,9 @@ class ConnectDialogBinds; class ConnectDialog : public ConfirmationDialog { - + OBJ_TYPE( ConnectDialog, ConfirmationDialog ); - + ConfirmationDialog *error; LineEdit *dst_path; @@ -69,34 +69,34 @@ class ConnectDialog : public ConfirmationDialog { void _dst_method_list_selected(int p_idx); void _add_bind(); void _remove_bind(); - + protected: void _notification(int p_what); - static void _bind_methods(); + static void _bind_methods(); public: - + bool get_make_callback() { return !make_callback->is_hidden() && make_callback->is_pressed(); } NodePath get_dst_path() const; - StringName get_dst_method() const; + StringName get_dst_method() const; bool get_deferred() const; bool get_oneshot() const; Vector<Variant> get_binds() const; void set_dst_method(const StringName& p_method); void set_dst_node(Node* p_node); - + // Button *get_ok() { return ok; } // Button *get_cancel() { return cancel; } void edit(Node *p_node); - + ConnectDialog(); ~ConnectDialog(); - + }; class ConnectionsDialog : public ConfirmationDialog { - + OBJ_TYPE( ConnectionsDialog , ConfirmationDialog ); EditorNode *editor; @@ -104,7 +104,7 @@ class ConnectionsDialog : public ConfirmationDialog { Tree *tree; ConfirmationDialog *remove_confirm; ConnectDialog *connect_dialog; - + void update_tree(); void _close(); @@ -113,20 +113,20 @@ class ConnectionsDialog : public ConfirmationDialog { UndoRedo *undo_redo; protected: - + virtual void ok_pressed(); void _notification(int p_what); static void _bind_methods(); public: - + void set_undoredo(UndoRedo *p_undo_redo) { undo_redo=p_undo_redo; } void set_node(Node* p_node); String get_selected_type(); - + ConnectionsDialog(EditorNode *p_editor=NULL); ~ConnectionsDialog(); - + }; #endif diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index 23b8cad9ce..35688917fb 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -337,116 +337,116 @@ CreateDialog::CreateDialog() { //old create dialog, disabled void CreateDialog::_notification(int p_what) { - + if (p_what==NOTIFICATION_READY) { connect("confirmed",this,"_create"); update_tree(); } if (p_what==NOTIFICATION_DRAW) { - + //RID ci = get_canvas_item(); //get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); - } + } } void CreateDialog::_create() { - + if (tree->get_selected()) emit_signal("create"); hide(); } void CreateDialog::_cancel() { - + hide(); } void CreateDialog::_text_changed(String p_text) { - + update_tree(); } void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root) { - + if (p_types.has(p_type)) return; if (!ObjectTypeDB::is_type(p_type,base) || p_type==base) return; - + String inherits=ObjectTypeDB::type_inherits_from(p_type); - + TreeItem *parent=p_root; - + if (inherits.length()) { - + if (!p_types.has(inherits)) { - + add_type(inherits,p_types,p_root); } - + if (p_types.has(inherits) ) - parent=p_types[inherits]; - } - + parent=p_types[inherits]; + } + TreeItem *item = tree->create_item(parent); item->set_text(0,p_type); if (!ObjectTypeDB::can_instance(p_type)) { item->set_custom_color(0, Color(0.5,0.5,0.5) ); item->set_selectable(0,false); } - - + + if (has_icon(p_type,"EditorIcons")) { - + item->set_icon(0, get_icon(p_type,"EditorIcons")); } - + p_types[p_type]=item; } void CreateDialog::update_tree() { tree->clear(); - + List<String> type_list; - ObjectTypeDB::get_type_list(&type_list); - + ObjectTypeDB::get_type_list(&type_list); + HashMap<String,TreeItem*> types; - + TreeItem *root = tree->create_item(); - + root->set_text(0,base); List<String>::Element *I=type_list.front(); - + for(;I;I=I->next()) { - - + + String type=I->get(); - + if (!ObjectTypeDB::can_instance(type)) continue; // cant create what can't be instanced if (filter->get_text()=="") add_type(type,types,root); else { - + bool found=false; String type=I->get(); - while(type!="" && ObjectTypeDB::is_type(type,base) && type!=base) { + while(type!="" && ObjectTypeDB::is_type(type,base) && type!=base) { if (type.findn(filter->get_text())!=-1) { - + found=true; break; } - + type=ObjectTypeDB::type_inherits_from(type); } - + if (found) add_type(I->get(),types,root); @@ -528,12 +528,12 @@ Object *CreateDialog::instance_selected() { void CreateDialog::_bind_methods() { - + ObjectTypeDB::bind_method("_create",&CreateDialog::_create); ObjectTypeDB::bind_method("_cancel",&CreateDialog::_cancel); ObjectTypeDB::bind_method("_text_changed", &CreateDialog::_text_changed); ADD_SIGNAL( MethodInfo("create")); - + } @@ -547,7 +547,7 @@ void CreateDialog::set_base_type(const String& p_base) { return; base=p_base; if (is_inside_scene()) - update_tree(); + update_tree(); } String CreateDialog::get_base_type() const { @@ -563,14 +563,14 @@ CreateDialog::CreateDialog() { set_child_rect(vbc); get_ok()->set_text("Create"); - + tree = memnew( Tree ); vbc->add_margin_child("Type:",tree,true); //tree->set_hide_root(true); - - filter = memnew( LineEdit ); + + filter = memnew( LineEdit ); vbc->add_margin_child("Filter:",filter); - + base="Node"; set_as_toplevel(true); diff --git a/tools/editor/create_dialog.h b/tools/editor/create_dialog.h index 6f959fd467..a46ff5ae06 100644 --- a/tools/editor/create_dialog.h +++ b/tools/editor/create_dialog.h @@ -82,37 +82,37 @@ public: //old create dialog, disabled class CreateDialog : public ConfirmationDialog { - + OBJ_TYPE( CreateDialog, ConfirmationDialog ); - + Tree *tree; Button *create; Button *cancel; LineEdit *filter; - + void update_tree(); void _create(); void _cancel(); - void add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem + void add_type(const String& p_type,HashMap<String,TreeItem*>& p_types,TreeItem *p_root); - + String base; void _text_changed(String p_text); virtual void _post_popup() { tree->grab_focus();} protected: - static void _bind_methods(); + static void _bind_methods(); void _notification(int p_what); public: - + Object *instance_selected(); - + void set_base_type(const String& p_base); String get_base_type() const; - CreateDialog(); + CreateDialog(); ~CreateDialog(); }; diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 6c1fc2ef05..f78ab93c30 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -261,13 +261,13 @@ EditorPlugin* EditorData::get_subeditor(Object *p_object) { } EditorPlugin* EditorData::get_editor(String p_name) { - + for(int i=0;i<editor_plugins.size();i++) { - + if (editor_plugins[i]->get_name()==p_name) return editor_plugins[i]; } - + return NULL; } diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index a9b23767f1..0e6cf3277a 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -590,7 +590,7 @@ void EditorFileDialog::update_file_list() { if (get_icon_func) { - + Ref<Texture> icon = get_icon_func(base_dir.plus_file(files.front()->get())); //ti->set_icon(0,icon); if (display_mode==DISPLAY_THUMBNAILS) { diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index ad59efc46f..05e8a559b7 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -463,7 +463,7 @@ void EditorFileSystem::scan() { filesystem=new_filesystem; new_filesystem=NULL; _update_scan_actions(); - scanning=false; + scanning=false; emit_signal("filesystem_changed"); emit_signal("sources_changed",sources_changed.size()>0); diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 39182bfd69..e02ffd337b 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -281,6 +281,7 @@ static void _edit_filter_list(Set<StringName>& r_list,const String& p_filter,boo } DirAccess *da = DirAccess::open("res://"); + ERR_FAIL_NULL(da); _edit_files_with_filter(da,filters,r_list,exclude); memdelete(da); } @@ -671,7 +672,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func } break; //use default case EditorImportExport::IMAGE_ACTION_COMPRESS_RAM: { group_format=EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM; - } break; //use default + } break; //use default } String image_list_md5; @@ -2217,5 +2218,3 @@ EditorImportExport::~EditorImportExport() { } - - diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index c36d285e78..dfc1c7455c 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -205,8 +205,8 @@ void EditorNode::_notification(int p_what) { log->deinit(); // do not get messages anymore } if (p_what==NOTIFICATION_PROCESS) { - - //force the whole tree viewport + + //force the whole tree viewport #if 0 { Rect2 grect = scene_root_base->get_global_rect(); @@ -275,13 +275,13 @@ void EditorNode::_notification(int p_what) { } } - + } if (p_what==NOTIFICATION_ENTER_TREE) { //MessageQueue::get_singleton()->push_call(this,"_get_scene_metadata"); - get_tree()->set_editor_hint(true); + get_tree()->set_editor_hint(true); get_tree()->get_root()->set_as_audio_listener(false); get_tree()->get_root()->set_as_audio_listener_2d(false); get_tree()->set_auto_accept_quit(false); @@ -569,12 +569,12 @@ void EditorNode::save_resource_as(const Ref<Resource>& p_resource) { void EditorNode::_menu_option(int p_option) { - + _menu_option_confirm(p_option,false); } void EditorNode::_menu_confirm_current() { - + _menu_option_confirm(current_option,true); } @@ -583,27 +583,27 @@ void EditorNode::_dialog_display_file_error(String p_file,Error p_error) { if (p_error) { - + current_option=-1; //accept->"()->hide(); accept->get_ok()->set_text("I see.."); - + switch(p_error) { - + case ERR_FILE_CANT_WRITE: { accept->set_text("Can't open file for writing: "+p_file.extension()); } break; case ERR_FILE_UNRECOGNIZED: { - + accept->set_text("File format requested unknown: "+p_file.extension()); } break; default: { - + accept->set_text("Error Saving."); }break; } - + accept->popup_centered_minsize(); } @@ -1144,10 +1144,10 @@ void EditorNode::_import(const String &p_file) { } void EditorNode::_dialog_action(String p_file) { - + switch(current_option) { - + case RESOURCE_LOAD: { RES res = ResourceLoader::load(p_file); @@ -1162,7 +1162,7 @@ void EditorNode::_dialog_action(String p_file) { push_item(res.operator->() ); - } break; + } break; case FILE_NEW_INHERITED_SCENE: { @@ -1445,13 +1445,13 @@ void EditorNode::_dialog_action(String p_file) { } break; default: { //save scene? - + if (file->get_mode()==FileDialog::MODE_SAVE_FILE) { //_save_scene(p_file); _save_scene_with_preview(p_file); } - + } break; } } @@ -1545,13 +1545,13 @@ void EditorNode::_property_editor_forward() { if (editor_history.next()) _edit_current(); - + } void EditorNode::_property_editor_back() { - + if (editor_history.previous()) _edit_current(); - + } @@ -1581,7 +1581,7 @@ void EditorNode::_hide_top_editors() { } void EditorNode::_edit_current() { - + uint32_t current = editor_history.get_current(); Object *current_obj = current>0 ? ObjectDB::get_instance(current) : NULL; @@ -1593,7 +1593,7 @@ void EditorNode::_edit_current() { if (!current_obj) { - + scene_tree_dock->set_selected(NULL); property_editor->edit( NULL ); object_menu->set_disabled(true); @@ -1767,7 +1767,7 @@ void EditorNode::_resource_created() { } void EditorNode::_resource_selected(const RES& p_res,const String& p_property) { - + if (p_res.is_null()) return; @@ -1960,13 +1960,13 @@ void EditorNode::_cleanup_scene() { } } - + _update_title(); #endif } void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { - + //print_line("option "+itos(p_option)+" confirm "+itos(p_confirmed)); if (!p_confirmed) //this may be a hack.. current_option=(MenuOptions)p_option; @@ -1991,12 +1991,12 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { //_cleanup_scene(); - + } break; case FILE_NEW_INHERITED_SCENE: case FILE_OPEN_SCENE: { - - + + //print_tree(); file->set_mode(EditorFileDialog::MODE_OPEN_FILE); //not for now? @@ -2004,10 +2004,10 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions); file->clear_filters(); for(int i=0;i<extensions.size();i++) { - + file->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper()); } - + //file->set_current_path(current_path); Node *scene = editor_data.get_edited_scene_root(); @@ -2016,7 +2016,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { }; file->set_title(p_option==FILE_OPEN_SCENE?"Open Scene":"Open Base Scene"); file->popup_centered_ratio(); - + } break; case FILE_QUICK_OPEN_SCENE: { @@ -2083,19 +2083,19 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { // fallthrough to save_as }; case FILE_SAVE_AS_SCENE: { - + Node *scene = editor_data.get_edited_scene_root(); - + if (!scene) { - + current_option=-1; //confirmation->get_cancel()->hide(); accept->get_ok()->set_text("I see.."); accept->set_text("This operation can't be done without a tree root."); accept->popup_centered_minsize(); - break; + break; } - + file->set_mode(EditorFileDialog::MODE_SAVE_FILE); bool relpaths = (scene->has_meta("__editor_relpaths__") && scene->get_meta("__editor_relpaths__").operator bool()); @@ -2108,7 +2108,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { file->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper()); } - + //file->set_current_path(current_path); if (scene->get_filename()!="") { file->set_current_path(scene->get_filename()); @@ -2129,7 +2129,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } file->popup_centered_ratio(); file->set_title("Save Scene As.."); - + } break; case FILE_SAVE_BEFORE_RUN: { @@ -2309,7 +2309,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case FILE_QUIT: { - + if (!p_confirmed) { @@ -2323,7 +2323,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { _menu_option_confirm(RUN_STOP,true); get_tree()->quit(); - + } break; case FILE_EXTERNAL_OPEN_SCENE: { @@ -2532,13 +2532,13 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case OBJECT_COPY_PARAMS: { - + editor_data.apply_changes_in_editors();; if (current) editor_data.copy_object_params(current); } break; case OBJECT_PASTE_PARAMS: { - + editor_data.apply_changes_in_editors();; if (current) editor_data.paste_object_params(current); @@ -2586,7 +2586,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case OBJECT_CALL_METHOD: { - + editor_data.apply_changes_in_editors();; call_dialog->set_object(current); call_dialog->popup_centered_ratio(); @@ -2831,7 +2831,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; default: { - + if (p_option>=OBJECT_METHOD_BASE) { ERR_FAIL_COND(!current); @@ -2855,12 +2855,12 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } } - } + } } Control* EditorNode::get_viewport() { - + return viewport; } @@ -2905,7 +2905,7 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor) { if (p_editor->has_main_screen()) { - + ToolButton *tb = memnew( ToolButton ); tb->set_toggle_mode(true); tb->connect("pressed",singleton,"_editor_select",varray(singleton->main_editor_buttons.size())); @@ -3093,9 +3093,9 @@ void EditorNode::set_edited_scene(Node *p_scene) { if (get_editor_data().get_edited_scene_root()->get_parent()==scene_root) scene_root->remove_child(get_editor_data().get_edited_scene_root()); - } + } get_editor_data().set_edited_scene_root(p_scene); - + if (p_scene && p_scene->cast_to<Popup>()) p_scene->cast_to<Popup>()->show(); //show popups scene_tree_dock->set_edited_scene(p_scene); @@ -3664,7 +3664,7 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo if (p_set_inherited) { Ref<SceneState> state = sdata->get_state(); - state->set_path(lpath); + state->set_path(lpath); new_scene->set_scene_inherited_state(state); new_scene->set_filename(String()); //if (new_scene->get_scene_instance_state().is_valid()) @@ -3801,7 +3801,7 @@ void EditorNode::animation_editor_make_visible(bool p_visible) { if (p_visible) { - animation_editor->show(); + animation_editor->show(); animation_vb->get_parent_control()->minimum_size_changed(); //pd_anim->show(); top_split->set_collapsed(false); @@ -4223,7 +4223,7 @@ void EditorNode::_dock_popup_exit() { } void EditorNode::_dock_pre_popup(int p_which) { - + dock_popup_selected=p_which; } @@ -5863,7 +5863,7 @@ EditorNode::EditorNode() { - + call_dialog = memnew( CallDialog ); call_dialog->hide(); gui_base->add_child( call_dialog ); @@ -5916,7 +5916,7 @@ EditorNode::EditorNode() { dependency_fixer = memnew( DependencyEditor ); gui_base->add_child( dependency_fixer ); - + settings_config_dialog = memnew( EditorSettingsDialog ); gui_base->add_child(settings_config_dialog); @@ -6026,7 +6026,7 @@ EditorNode::EditorNode() { property_forward->connect("pressed", this,"_property_editor_forward"); property_back->connect("pressed", this,"_property_editor_back"); - + file_menu->get_popup()->connect("item_pressed", this,"_menu_option"); @@ -6263,7 +6263,7 @@ EditorNode::EditorNode() { } -EditorNode::~EditorNode() { +EditorNode::~EditorNode() { memdelete( EditorHelp::get_doc_data() ); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 9fd8d07aef..5d26bae369 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -402,13 +402,13 @@ private: String external_file; List<String> previous_scenes; bool opening_prev; - + void _dialog_action(String p_file); void _edit_current(); void _dialog_display_file_error(String p_file,Error p_error); - + int current_option; //void _animation_visibility_toggle(); void _resource_created(); @@ -423,7 +423,7 @@ private: void _select_history(int p_idx); void _prepare_history(); - + void _fs_changed(); void _sources_changed(bool p_exist); void _imported(Node *p_node); @@ -693,7 +693,7 @@ public: void hide_bottom_panel(); void remove_bottom_panel_item(Control *p_item); - EditorNode(); + EditorNode(); ~EditorNode(); void get_singleton(const char* arg1, bool arg2); diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index a7460d7fde..c572ab210e 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -48,7 +48,7 @@ class EditorImportPlugin; class EditorExportPlugin; class EditorPlugin : public Node { - + OBJ_TYPE( EditorPlugin, Node ); friend class EditorData; UndoRedo *undo_redo; diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 47ef87cfb1..fda51423d2 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -404,6 +404,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("text_editor/brace_mismatch_color",Color(1,0.2,0.2)); set("text_editor/current_line_color",Color(0.3,0.5,0.8,0.15)); + set("text_editor/scroll_past_end_of_file", false); + set("text_editor/idle_parse_delay",2); set("text_editor/create_signal_callbacks",true); set("text_editor/autosave_interval_secs",0); diff --git a/tools/editor/editor_sub_scene.cpp b/tools/editor/editor_sub_scene.cpp index e58e2c1351..a1a881bec5 100644 --- a/tools/editor/editor_sub_scene.cpp +++ b/tools/editor/editor_sub_scene.cpp @@ -147,7 +147,7 @@ void EditorSubScene::move(Node* p_new_parent, Node* p_new_owner) { } TreeItem *s = tree->get_selected(); if (!s) { - return; + return; } Node *selnode = s->get_metadata(0); diff --git a/tools/editor/groups_editor.h b/tools/editor/groups_editor.h index b5bccb2766..6a897d0cbb 100644 --- a/tools/editor/groups_editor.h +++ b/tools/editor/groups_editor.h @@ -63,7 +63,7 @@ public: void set_undo_redo(UndoRedo *p_undoredo) { undo_redo=p_undoredo; } void set_current(Node* p_node); - GroupsEditor(); + GroupsEditor(); ~GroupsEditor(); }; diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 7de9d978f2..f008c4a736 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -1372,7 +1372,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con DVector<float> tangents; print_line("vertex source id: "+vertex_src_id); if(md.vertices[vertex_src_id].sources.has("NORMAL")){ - //has normals + //has normals normals.resize(vlen); //std::cout << "has normals" << std::endl; String normal_src_id = md.vertices[vertex_src_id].sources["NORMAL"]; @@ -1386,7 +1386,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con if (stride==0) stride=3; - + //read normals from morph target DVector<Vector3>::Write vertw = normals.write(); @@ -1421,7 +1421,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con } } } - + print_line("using built-in normals"); }else{ print_line("generating normals"); @@ -2070,7 +2070,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones animation->add_track(Animation::TYPE_TRANSFORM); - int track = animation->get_track_count() -1; + int track = animation->get_track_count() -1; animation->track_set_path( track , path ); Vector<float> snapshots = base_snapshots; diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 322320780d..15e7a70111 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -462,7 +462,7 @@ EditorImportAnimationOptions::EditorImportAnimationOptions() { items.push_back(ti); fname++; fdescr++; - } + } TreeItem *fps_base = flags->create_item(root); diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 29273ebd06..ea7242c185 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -1549,7 +1549,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c } uint32_t flags = rimd->get_option("flags"); - uint8_t shrink = rimd->has_option("shrink") ? rimd->get_option("shrink"): Variant(1); + uint8_t shrink = rimd->has_option("shrink") ? rimd->get_option("shrink"): Variant(1); uint8_t format = rimd->get_option("format"); uint8_t comp = (format==EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM)?uint8_t(p_platform->get_image_compression()):uint8_t(255); @@ -1633,7 +1633,7 @@ EditorTextureImportPlugin::EditorTextureImportPlugin(EditorNode *p_editor, Mode singleton[p_mode]=this; editor=p_editor; - mode=p_mode; + mode=p_mode; dialog = memnew( EditorTextureImportDialog(this,p_mode==MODE_TEXTURE_2D || p_mode==MODE_ATLAS || p_mode==MODE_LARGE,p_mode==MODE_ATLAS,p_mode==MODE_LARGE) ); editor->get_gui_base()->add_child(dialog); diff --git a/tools/editor/output_strings.cpp b/tools/editor/output_strings.cpp index a19352f4ec..f1b49d2326 100644 --- a/tools/editor/output_strings.cpp +++ b/tools/editor/output_strings.cpp @@ -84,7 +84,7 @@ void OutputStrings::_notification(int p_what) { Ref<Texture> icon_warning = get_icon("Warning","EditorIcons"); // int lines = (size_height-(int)margin.y) / font_height; - Point2 ofs=tree_st->get_offset(); + Point2 ofs=tree_st->get_offset(); LineMap::Element *E = line_map.find(v_scroll->get_val()); float h_ofs = (int)h_scroll->get_val(); diff --git a/tools/editor/output_strings.h b/tools/editor/output_strings.h index 3d5deb1646..29c6ea799f 100644 --- a/tools/editor/output_strings.h +++ b/tools/editor/output_strings.h @@ -81,7 +81,7 @@ protected: public: - void add_line(const String& p_text, const Variant& p_meta=Variant(), const LineType p_type=LINE_NORMAL); + void add_line(const String& p_text, const Variant& p_meta=Variant(), const LineType p_type=LINE_NORMAL); OutputStrings(); }; diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 010753e88c..0b06aab447 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -731,7 +731,7 @@ void AnimationPlayerEditor::_dialog_action(String p_file) { String current = animation->get_item_text(animation->get_selected()); if (current != "") { Ref<Animation> anim = player->get_animation(current); - + ERR_FAIL_COND(!anim->cast_to<Resource>()) RES current_res = RES(anim->cast_to<Resource>()); @@ -1424,7 +1424,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { add_child(error_dialog); name_dialog->connect("confirmed", this,"_animation_name_edited"); - + blend_editor.dialog = memnew( AcceptDialog ); add_child(blend_editor.dialog); blend_editor.dialog->get_ok()->set_text("Close"); @@ -1441,7 +1441,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { updating_blends=false; blend_editor.tree->connect("item_edited",this,"_blend_edited"); - + autoplay->connect("pressed", this,"_autoplay_pressed"); autoplay->set_toggle_mode(true); diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index d85553b4db..08c2a1c3ae 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -593,7 +593,7 @@ void AnimationTreeEditor::_draw_node(const StringName& p_node) { } break; case AnimationTreePlayer::NODE_ONESHOT: - case AnimationTreePlayer::NODE_MIX: + case AnimationTreePlayer::NODE_MIX: case AnimationTreePlayer::NODE_BLEND2: case AnimationTreePlayer::NODE_BLEND3: case AnimationTreePlayer::NODE_BLEND4: @@ -1155,7 +1155,7 @@ StringName AnimationTreeEditor::_add_node(int p_item) { anim_tree->node_set_pos(name,Point2(last_x,last_y)); order.push_back(name); last_x+=10; - last_y+=10; + last_y+=10; last_x=last_x % (int)get_size().width; last_y=last_y % (int)get_size().height; update(); diff --git a/tools/editor/plugins/baked_light_baker.h b/tools/editor/plugins/baked_light_baker.h index 8fbeeddc6a..5c172f79c6 100644 --- a/tools/editor/plugins/baked_light_baker.h +++ b/tools/editor/plugins/baked_light_baker.h @@ -96,7 +96,7 @@ public: struct Triangle { - AABB aabb; + AABB aabb; Vector3 vertices[3]; Vector2 uvs[3]; Vector2 bake_uvs[3]; diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp index 22a188bce4..56aabaf6d9 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.cpp +++ b/tools/editor/plugins/baked_light_editor_plugin.cpp @@ -131,7 +131,7 @@ void BakedLightEditor::_notification(int p_option) { last_rays_time=rays_snap; bake_info->set_text("rays/s: "+itos(rays_sec)); - update_timeout=1; + update_timeout=1; print_line("MSUPDATE: "+itos(OS::get_singleton()->get_ticks_msec()-t)); t=OS::get_singleton()->get_ticks_msec(); node->get_baked_light()->set_octree(octree_texture); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index f8bc97a433..6eb26542be 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -49,10 +49,10 @@ friend class CanvasItemEditor; SpinBox *grid_offset_x; SpinBox *grid_offset_y; SpinBox *grid_step_x; - SpinBox *grid_step_y; - SpinBox *rotation_offset; + SpinBox *grid_step_y; + SpinBox *rotation_offset; SpinBox *rotation_step; - + public: SnapDialog() : ConfirmationDialog() { const int SPIN_BOX_GRID_RANGE = 256; @@ -134,7 +134,7 @@ public: rotation_step->set_suffix("deg"); child_container->add_child(rotation_step); } - + void set_fields(const Point2 p_grid_offset, const Size2 p_grid_step, const float p_rotation_offset, const float p_rotation_step) { grid_offset_x->set_val(p_grid_offset.x); grid_offset_y->set_val(p_grid_offset.y); @@ -143,7 +143,7 @@ public: rotation_offset->set_val(p_rotation_offset * (180 / Math_PI)); rotation_step->set_val(p_rotation_step * (180 / Math_PI)); } - + void get_fields(Point2 &p_grid_offset, Size2 &p_grid_step, float &p_rotation_offset, float &p_rotation_step) { p_grid_offset.x = grid_offset_x->get_val(); p_grid_offset.y = grid_offset_y->get_val(); @@ -1328,7 +1328,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { first=false; } - BoneIK bik; + BoneIK bik; bik.node=b; bik.len=len; bik.orig_state=b->edit_get_state(); @@ -2670,7 +2670,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { } #endif } break; - + case SPACE_HORIZONTAL: { //space_selected_items< proj_vector2_x, compare_items_x >(); } break; @@ -3164,7 +3164,7 @@ bool CanvasItemEditor::box_selection_end() { SWAP(bsfrom.x,bsto.x); if (bsfrom.y>bsto.y) SWAP(bsfrom.y,bsto.y); - + if ( bsfrom.distance_to( bsto ) < 3 ) { print_line( "box selection too small" ); box_selecting=false; @@ -3183,7 +3183,7 @@ bool CanvasItemEditor::box_selection_end() { box_selecting=false; viewport->update(); - + return true; } #endif diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h index df24734fd7..301c67756c 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.h +++ b/tools/editor/plugins/canvas_item_editor_plugin.h @@ -302,11 +302,11 @@ class CanvasItemEditor : public VBoxContainer { bool _select(CanvasItem *item, Point2 p_click_pos, bool p_append, bool p_drag=true); ConfirmationDialog *snap_dialog; - + AcceptDialog *value_dialog; Label *dialog_label; SpinBox *dialog_val; - + CanvasItem *ref_item; void _edit_set_pivot(const Vector2& mouse_pos); @@ -369,29 +369,29 @@ protected: bool box_selection_end(); HBoxContainer *get_panel_hb() { return hb; } - + struct compare_items_x { bool operator()( const CanvasItem *a, const CanvasItem *b ) const { return a->get_global_transform().elements[2].x < b->get_global_transform().elements[2].x; } }; - + struct compare_items_y { bool operator()( const CanvasItem *a, const CanvasItem *b ) const { return a->get_global_transform().elements[2].y < b->get_global_transform().elements[2].y; } }; - + struct proj_vector2_x { float get( const Vector2 &v ) { return v.x; } void set( Vector2 &v, float f ) { v.x = f; } }; - + struct proj_vector2_y { float get( const Vector2 &v ) { return v.y; } void set( Vector2 &v, float f ) { v.y = f; } }; - + template< class P, class C > void space_selected_items(); static CanvasItemEditor *singleton; diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index d4198f3166..44854e655f 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -40,7 +40,7 @@ void CollisionPolygonEditor::_notification(int p_what) { case NOTIFICATION_READY: { button_create->set_icon( get_icon("Edit","EditorIcons")); - button_edit->set_icon( get_icon("MovePoint","EditorIcons")); + button_edit->set_icon( get_icon("MovePoint","EditorIcons")); button_edit->set_pressed(true); get_tree()->connect("node_removed",this,"_node_removed"); diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp index 7e5d52d17d..1916d55ee1 100644 --- a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -451,11 +451,11 @@ void CollisionShape2DEditor::_canvas_draw() { case LINE_SHAPE: { Ref<LineShape2D> shape = node->get_shape(); - + handles.resize(2); handles[0] = shape->get_normal() * shape->get_d(); handles[1] = shape->get_normal() * (shape->get_d() + 30.0); - + c->draw_texture(h,gt.xform(handles[0])-size); c->draw_texture(h,gt.xform(handles[1])-size); diff --git a/tools/editor/plugins/control_editor_plugin.cpp b/tools/editor/plugins/control_editor_plugin.cpp index 375622a89c..9dff5e6ce4 100644 --- a/tools/editor/plugins/control_editor_plugin.cpp +++ b/tools/editor/plugins/control_editor_plugin.cpp @@ -80,16 +80,16 @@ void ControlEditor::_node_removed(Node *p_node) { // slow as hell Control* ControlEditor::_select_control_at_pos(const Point2& p_pos,Node* p_node) { - + for (int i=p_node->get_child_count()-1;i>=0;i--) { - + Control *r=_select_control_at_pos(p_pos,p_node->get_child(i)); if (r) return r; } - + Control *c=p_node->cast_to<Control>(); - + if (c) { Rect2 rect = c->get_window_rect(); if (c->get_window()==current_window) { @@ -123,9 +123,9 @@ void ControlEditor::_key_move(const Vector2& p_dir, bool p_snap) { void ControlEditor::_input_event(InputEvent p_event) { - + if (p_event.type==InputEvent::MOUSE_BUTTON) { - + const InputEventMouseButton &b=p_event.mouse_button; if (b.button_index==BUTTON_RIGHT) { @@ -146,12 +146,12 @@ void ControlEditor::_input_event(InputEvent p_event) { } //if (!controls.size()) // return; - + if (b.button_index!=BUTTON_LEFT) return; if (!b.pressed) { - + if (drag!=DRAG_NONE) { if (undo_redo) { @@ -321,11 +321,11 @@ void ControlEditor::_input_event(InputEvent p_event) { } } - + if (p_event.type==InputEvent::MOUSE_MOTION) { - + const InputEventMouseMotion &m=p_event.mouse_motion; - + if (drag==DRAG_NONE || !current_window) return; @@ -449,7 +449,7 @@ void ControlEditor::_input_event(InputEvent p_event) { } - + } @@ -492,9 +492,9 @@ void ControlEditor::_update_scroll(float) { } void ControlEditor::_notification(int p_what) { - + if (p_what==NOTIFICATION_PROCESS) { - + for(ControlMap::Element *E=controls.front();E;E=E->next()) { Control *control = E->key(); @@ -504,16 +504,16 @@ void ControlEditor::_notification(int p_what) { E->get().last_rect=r; } } - + } - + if (p_what==NOTIFICATION_CHILDREN_CONFIGURED) { - + get_scene()->connect("node_removed",this,"_node_removed"); } - + if (p_what==NOTIFICATION_DRAW) { - + // TODO fetch the viewport? /* if (!control) { @@ -572,11 +572,11 @@ VisualServer::get_singleton()->canvas_item_add_rect(ci,m_rect,m_color); //DRAW_EMPTY_RECT( Rect2( current_window->get_scroll()-Point2(1,1), get_size()+Size2(2,2)), Color(0.8,0.8,1.0,0.8) ); E->get().last_rect = rect; } - } + } } void ControlEditor::edit(Control *p_control) { - + drag=DRAG_NONE; _clear_controls(); @@ -727,9 +727,9 @@ void ControlEditor::_popup_callback(int p_op) { } void ControlEditor::_bind_methods() { - + ObjectTypeDB::bind_method("_input_event",&ControlEditor::_input_event); - ObjectTypeDB::bind_method("_node_removed",&ControlEditor::_node_removed); + ObjectTypeDB::bind_method("_node_removed",&ControlEditor::_node_removed); ObjectTypeDB::bind_method("_update_scroll",&ControlEditor::_update_scroll); ObjectTypeDB::bind_method("_popup_callback",&ControlEditor::_popup_callback); ObjectTypeDB::bind_method("_visibility_changed",&ControlEditor::_visibility_changed); @@ -781,13 +781,13 @@ ControlEditor::ControlEditor(EditorNode *p_editor) { void ControlEditorPlugin::edit(Object *p_object) { - + control_editor->set_undo_redo(&get_undo_redo()); control_editor->edit(p_object->cast_to<Control>()); } bool ControlEditorPlugin::handles(Object *p_object) const { - + return p_object->is_type("Control"); } @@ -797,7 +797,7 @@ void ControlEditorPlugin::make_visible(bool p_visible) { control_editor->show(); control_editor->set_process(true); } else { - + control_editor->hide(); control_editor->set_process(false); } @@ -805,14 +805,14 @@ void ControlEditorPlugin::make_visible(bool p_visible) { } ControlEditorPlugin::ControlEditorPlugin(EditorNode *p_node) { - + editor=p_node; control_editor = memnew( ControlEditor(editor) ); editor->get_viewport()->add_child(control_editor); control_editor->set_area_as_parent_rect(); control_editor->hide(); - + } diff --git a/tools/editor/plugins/control_editor_plugin.h b/tools/editor/plugins/control_editor_plugin.h index 94cffc8d8d..6234698ee8 100644 --- a/tools/editor/plugins/control_editor_plugin.h +++ b/tools/editor/plugins/control_editor_plugin.h @@ -37,9 +37,9 @@ #if 0 class ControlEditor : public Control { - - OBJ_TYPE(ControlEditor, Control ); - + + OBJ_TYPE(ControlEditor, Control ); + EditorNode *editor; enum { @@ -103,13 +103,13 @@ class ControlEditor : public Control { void _find_controls_span(Node *p_node, Rect2& r_rect); -protected: +protected: void _notification(int p_what); - void _input_event(InputEvent p_event); + void _input_event(InputEvent p_event); void _node_removed(Node *p_node); static void _bind_methods(); -public: - +public: + bool get_remove_list(List<Node*> *p_list); void set_undo_redo(UndoRedo *p_undo_redo) {undo_redo=p_undo_redo; } void edit(Control *p_control); @@ -117,14 +117,14 @@ public: }; class ControlEditorPlugin : public EditorPlugin { - + OBJ_TYPE( ControlEditorPlugin, EditorPlugin ); - + ControlEditor *control_editor; EditorNode *editor; - + public: - + virtual String get_name() const { return "GUI"; } bool has_main_screen() const { return true; } virtual void edit(Object *p_object); @@ -132,7 +132,7 @@ public: virtual void make_visible(bool p_visible); virtual bool get_remove_list(List<Node*> *p_list) { return control_editor->get_remove_list(p_list); } - + ControlEditorPlugin(EditorNode *p_node); ~ControlEditorPlugin(); diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp index c861a5841a..ab4f14b806 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -27,7 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "cube_grid_theme_editor_plugin.h" - + #include "scene/3d/mesh_instance.h" #include "scene/3d/physics_body.h" #include "scene/main/viewport.h" @@ -337,7 +337,7 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) { theme_editor->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END ); theme_editor->set_anchor( MARGIN_BOTTOM, Control::ANCHOR_BEGIN ); theme_editor->set_end( Point2(0,22) ); - theme_editor->hide(); + theme_editor->hide(); } diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index f3b5272571..12d50cd4b8 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -725,7 +725,11 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { } else { half=1; ofs=h/2; - v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; + if( (float)(h/2) != 0 ) { + v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; + } else { + v = ((j-(h/2))/(float)(1/2)) * 2.0 - 1.0; + } } uint8_t* imgofs = &imgw[(j*w+i)*3]; diff --git a/tools/editor/plugins/item_list_editor_plugin.cpp b/tools/editor/plugins/item_list_editor_plugin.cpp index 6f0db959ba..08af1a0643 100644 --- a/tools/editor/plugins/item_list_editor_plugin.cpp +++ b/tools/editor/plugins/item_list_editor_plugin.cpp @@ -119,7 +119,7 @@ void ItemListOptionButtonPlugin::set_object(Object *p_object) { bool ItemListOptionButtonPlugin::handles(Object *p_object) const { - return p_object->is_type("OptionButton"); + return p_object->is_type("OptionButton"); } int ItemListOptionButtonPlugin::get_flags() const { @@ -130,23 +130,23 @@ int ItemListOptionButtonPlugin::get_flags() const { void ItemListOptionButtonPlugin::add_item() { ob->add_item( "Item "+itos(ob->get_item_count())); - _change_notify(); + _change_notify(); } int ItemListOptionButtonPlugin::get_item_count() const { - return ob->get_item_count(); + return ob->get_item_count(); } void ItemListOptionButtonPlugin::erase(int p_idx) { - ob->remove_item(p_idx); + ob->remove_item(p_idx); _change_notify(); } ItemListOptionButtonPlugin::ItemListOptionButtonPlugin() { - ob=NULL; + ob=NULL; } /////////////////////////////////////////////////////////////// @@ -259,7 +259,7 @@ void ItemListEditor::edit(Node *p_item_list) { item_plugins[i]->set_object(p_item_list); property_editor->edit(item_plugins[i]); - + if (has_icon(item_list->get_type(), "EditorIcons")) toolbar_button->set_icon(get_icon(item_list->get_type(), "EditorIcons")); else diff --git a/tools/editor/plugins/multimesh_editor_plugin.cpp b/tools/editor/plugins/multimesh_editor_plugin.cpp index 3f63ef706b..15df9a6262 100644 --- a/tools/editor/plugins/multimesh_editor_plugin.cpp +++ b/tools/editor/plugins/multimesh_editor_plugin.cpp @@ -326,7 +326,7 @@ MultiMeshEditor::MultiMeshEditor() { options = memnew( MenuButton ); SpatialEditor::get_singleton()->add_control_to_menu_panel(options); - + options->set_text("MultiMesh"); options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MultiMeshInstance","EditorIcons")); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index 3e9c58d604..849fe82645 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -69,7 +69,7 @@ void Polygon2DEditor::_node_removed(Node *p_node) { if(p_node==node) { edit(NULL); hide(); - + canvas_item_editor->get_viewport_control()->update(); } @@ -760,7 +760,7 @@ void Polygon2DEditor::edit(Node *p_collision_polygon) { node=p_collision_polygon->cast_to<Polygon2D>(); if (!canvas_item_editor->get_viewport_control()->is_connected("draw",this,"_canvas_draw")) canvas_item_editor->get_viewport_control()->connect("draw",this,"_canvas_draw"); - + wip.clear(); wip_active=false; edited_point=-1; diff --git a/tools/editor/plugins/resource_preloader_editor_plugin.cpp b/tools/editor/plugins/resource_preloader_editor_plugin.cpp index 8490f63ff0..442046b069 100644 --- a/tools/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/tools/editor/plugins/resource_preloader_editor_plugin.cpp @@ -46,7 +46,7 @@ void ResourcePreloaderEditor::_notification(int p_what) { } if (p_what==NOTIFICATION_ENTER_TREE) { - load->set_icon( get_icon("Folder","EditorIcons") ); + load->set_icon( get_icon("Folder","EditorIcons") ); _delete->set_icon( get_icon("Del","EditorIcons") ); } diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index e3dce0b36a..76c64beb61 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -711,7 +711,7 @@ void ScriptEditor::_close_current_tab() { int selected = tab_container->get_current_tab(); if (selected<0 || selected>=tab_container->get_child_count()) return; - + Node *tselected = tab_container->get_child(selected); ScriptTextEditor *current = tab_container->get_child(selected)->cast_to<ScriptTextEditor>(); if (current) { @@ -1784,7 +1784,8 @@ void ScriptEditor::_update_script_colors() { if (h>hist_size) { continue; } - float v = Math::ease((edit_pass-pass)/float(hist_size),0.4); + int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; + float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); @@ -1927,6 +1928,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { ScriptTextEditor *ste = memnew( ScriptTextEditor ); ste->set_edited_script(p_script); ste->get_text_edit()->set_tooltip_request_func(this,"_get_debug_tooltip",ste); + ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); ste->get_text_edit()->set_callhint_settings( EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), @@ -2064,6 +2066,7 @@ void ScriptEditor::_editor_settings_changed() { continue; ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); + ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); } } @@ -2702,4 +2705,3 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { ScriptEditorPlugin::~ScriptEditorPlugin() { } - diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 7161033111..2d3100ac0d 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "shader_editor_plugin.h" #include "tools/editor/editor_settings.h" - + #include "spatial_editor_plugin.h" #include "io/resource_loader.h" #include "io/resource_saver.h" @@ -52,7 +52,7 @@ Ref<Shader> ShaderTextEditor::get_edited_shader() const { } void ShaderTextEditor::set_edited_shader(const Ref<Shader>& p_shader,ShaderLanguage::ShaderType p_type) { - shader=p_shader; + shader=p_shader; type=p_type; _load_theme_settings(); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 1f264a2337..79ff78ca0d 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -1265,7 +1265,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } else if (m.button_mask&1) { if (nav_scheme == NAVIGATION_MAYA && m.mod.alt) { - nav_mode = NAVIGATION_ORBIT; + nav_mode = NAVIGATION_ORBIT; } else if (nav_scheme == NAVIGATION_MODO && m.mod.alt && m.mod.shift) { nav_mode = NAVIGATION_PAN; } else if (nav_scheme == NAVIGATION_MODO && m.mod.alt && m.mod.control) { @@ -2084,7 +2084,9 @@ void SpatialEditorViewport::_menu_option(int p_option) { count++; } - center/=float(count); + if( count != 0 ) { + center/=float(count); + } cursor.pos=center; } break; @@ -2196,7 +2198,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { VS::get_singleton()->instance_set_scenario(move_gizmo_instance[i],get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_geometry_set_flag(move_gizmo_instance[i],VS::INSTANCE_FLAG_VISIBLE,false); //VS::get_singleton()->instance_geometry_set_flag(move_gizmo_instance[i],VS::INSTANCE_FLAG_DEPH_SCALE,true); - VS::get_singleton()->instance_geometry_set_flag(move_gizmo_instance[i],VS::INSTANCE_FLAG_CAST_SHADOW,false); + VS::get_singleton()->instance_geometry_set_cast_shadows_setting(move_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF); VS::get_singleton()->instance_set_layer_mask(move_gizmo_instance[i],layer); rotate_gizmo_instance[i]=VS::get_singleton()->instance_create(); @@ -2204,7 +2206,7 @@ void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { VS::get_singleton()->instance_set_scenario(rotate_gizmo_instance[i],get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_VISIBLE,false); //VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_DEPH_SCALE,true); - VS::get_singleton()->instance_geometry_set_flag(rotate_gizmo_instance[i],VS::INSTANCE_FLAG_CAST_SHADOW,false); + VS::get_singleton()->instance_geometry_set_cast_shadows_setting(rotate_gizmo_instance[i], VS::SHADOW_CASTING_SETTING_OFF); VS::get_singleton()->instance_set_layer_mask(rotate_gizmo_instance[i],layer); } @@ -2585,7 +2587,7 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) { si->sp=sp; si->sbox_instance=VisualServer::get_singleton()->instance_create2(selection_box->get_rid(),sp->get_world()->get_scenario()); - VS::get_singleton()->instance_geometry_set_flag(si->sbox_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false); + VS::get_singleton()->instance_geometry_set_cast_shadows_setting(si->sbox_instance, VS::SHADOW_CASTING_SETTING_OFF); RID inst = sp->call("_get_visual_instance_rid"); @@ -2606,15 +2608,15 @@ void SpatialEditor::_generate_selection_box() { aabb.grow_by( aabb.get_longest_axis_size()/20.0 ); Ref<SurfaceTool> st = memnew( SurfaceTool ); - + st->begin(Mesh::PRIMITIVE_LINES); for (int i=0;i<12;i++) { - + Vector3 a,b; - aabb.get_edge(i,a,b); - + aabb.get_edge(i,a,b); + /*Vector<Vector3> points; - Vector<Color> colors; + Vector<Color> colors; points.push_back(a); points.push_back(b);*/ @@ -2804,7 +2806,7 @@ void SpatialEditor::set_state(const Dictionary& p_state) { void SpatialEditor::edit(Spatial *p_spatial) { - + if (p_spatial!=selected) { if (selected) { @@ -2836,8 +2838,8 @@ void SpatialEditor::edit(Spatial *p_spatial) { // should become the selection } - - + + } void SpatialEditor::_xform_dialog_action() { @@ -3272,8 +3274,8 @@ void SpatialEditor::_init_indicators() { grid_visible[i]=false; grid_enable[i]=false; VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,false); - VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_CAST_SHADOW,false); - VS::get_singleton()->instance_set_layer_mask(grid_instance[i],1<<SpatialEditorViewport::GIZMO_GRID_LAYER); + VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(grid_instance[i], VS::SHADOW_CASTING_SETTING_OFF); + VS::get_singleton()->instance_set_layer_mask(grid_instance[i], 1 << SpatialEditorViewport::GIZMO_GRID_LAYER); } @@ -3294,7 +3296,7 @@ void SpatialEditor::_init_indicators() { origin_instance = VisualServer::get_singleton()->instance_create2(origin,get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_set_layer_mask(origin_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER); - VisualServer::get_singleton()->instance_geometry_set_flag(origin_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false); + VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(origin_instance, VS::SHADOW_CASTING_SETTING_OFF); @@ -3331,7 +3333,7 @@ void SpatialEditor::_init_indicators() { cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_tree()->get_root()->get_world()->get_scenario()); VS::get_singleton()->instance_set_layer_mask(cursor_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER); - VisualServer::get_singleton()->instance_geometry_set_flag(cursor_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false); + VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(cursor_instance, VS::SHADOW_CASTING_SETTING_OFF); } @@ -4167,7 +4169,7 @@ SpatialEditor::~SpatialEditor() { void SpatialEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - + spatial_editor->show(); spatial_editor->set_process(true); @@ -4175,7 +4177,7 @@ void SpatialEditorPlugin::make_visible(bool p_visible) { spatial_editor->grab_focus(); } else { - + spatial_editor->hide(); spatial_editor->set_process(false); //VisualServer::get_singleton()->viewport_set_hide_scenario(editor->get_scene_root()->get_viewport(),true); @@ -4189,7 +4191,7 @@ void SpatialEditorPlugin::edit(Object *p_object) { } bool SpatialEditorPlugin::handles(Object *p_object) const { - + return p_object->is_type("Spatial"); } @@ -4223,7 +4225,7 @@ void SpatialEditorPlugin::snap_cursor_to_plane(const Plane& p_plane) { SpatialEditorPlugin::SpatialEditorPlugin(EditorNode *p_node) { - + editor=p_node; spatial_editor = memnew( SpatialEditor(p_node) ); spatial_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); @@ -4238,8 +4240,5 @@ SpatialEditorPlugin::SpatialEditorPlugin(EditorNode *p_node) { SpatialEditorPlugin::~SpatialEditorPlugin() { - -} - - +} diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index af1b6919a2..54086b0031 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -278,7 +278,7 @@ public: }; class SpatialEditor : public VBoxContainer { - + OBJ_TYPE(SpatialEditor, VBoxContainer ); public: @@ -338,7 +338,7 @@ private: Ref<Mesh> selection_box; RID indicators; - RID indicators_instance; + RID indicators_instance; RID cursor_mesh; RID cursor_instance; RID indicator_mat; @@ -352,7 +352,7 @@ private: Spatial *sp; RID poly_instance; }; - + Map<uint32_t,Selected> selected; */ struct Gizmo { @@ -361,8 +361,8 @@ private: float scale; Transform transform; } gizmo; - - + + enum MenuOption { @@ -471,7 +471,7 @@ private: void _update_default_light_angle(); void _default_light_angle_input(const InputEvent& p_event); -protected: +protected: @@ -481,7 +481,7 @@ protected: void _unhandled_key_input(InputEvent p_event); static void _bind_methods(); -public: +public: static SpatialEditor *get_singleton() { return singleton; } @@ -541,9 +541,9 @@ public: }; class SpatialEditorPlugin : public EditorPlugin { - + OBJ_TYPE( SpatialEditorPlugin, EditorPlugin ); - + SpatialEditor *spatial_editor; EditorNode *editor; protected: @@ -555,7 +555,7 @@ public: SpatialEditor *get_spatial_editor() { return spatial_editor; } virtual String get_name() const { return "3D"; } bool has_main_screen() const { return true; } - virtual void make_visible(bool p_visible); + virtual void make_visible(bool p_visible); virtual void edit(Object *p_object); virtual bool handles(Object *p_object) const; diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 69e09d6053..4a7388fd54 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -60,6 +60,8 @@ void ProjectSettings::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { + globals_editor->edit(Globals::get_singleton()); + search_button->set_icon(get_icon("Zoom","EditorIcons")); clear_button->set_icon(get_icon("Close","EditorIcons")); @@ -566,8 +568,7 @@ void ProjectSettings::popup_project_settings() { //popup_centered(Size2(500,400)); popup_centered_ratio(); - globals_editor->edit(NULL); - globals_editor->edit(Globals::get_singleton()); + globals_editor->update_category_list(); _update_translations(); _update_autoload(); plugin_settings->update_plugins(); @@ -605,37 +606,45 @@ void ProjectSettings::_item_add() { case 3: value=""; break; } - String catname = category->get_text(); + String catname = category->get_text().strip_edges(); /*if (!catname.is_valid_identifier()) { message->set_text("Invalid Category.\nValid characters: a-z,A-Z,0-9 or _"); message->popup_centered(Size2(300,100)); return; }*/ - String propname = property->get_text(); + String propname = property->get_text().strip_edges(); /*if (!propname.is_valid_identifier()) { message->set_text("Invalid Property.\nValid characters: a-z,A-Z,0-9 or _"); message->popup_centered(Size2(300,100)); return; }*/ - String name = catname+"/"+propname; + String name = catname!="" ? catname+"/"+propname : propname; + Globals::get_singleton()->set(name,value); - globals_editor->edit(NULL); - globals_editor->edit(Globals::get_singleton()); + + globals_editor->set_current_section(catname); + globals_editor->update_category_list(); + + _settings_changed(); } void ProjectSettings::_item_del() { - String catname = category->get_text(); + String catname = category->get_text().strip_edges(); //ERR_FAIL_COND(!catname.is_valid_identifier()); - String propname = property->get_text(); + String propname = property->get_text().strip_edges(); //ERR_FAIL_COND(!propname.is_valid_identifier()); - String name = catname+"/"+propname; + String name = catname!="" ? catname+"/"+propname : propname; + Globals::get_singleton()->set(name,Variant()); - globals_editor->get_property_editor()->update_tree(); + globals_editor->set_current_section(catname); + globals_editor->update_category_list(); + + _settings_changed(); } void ProjectSettings::_action_adds(String) { @@ -957,7 +966,7 @@ void ProjectSettings::_autoload_delete(Object *p_item,int p_column, int p_button undo_redo->commit_action(); } else { - TreeItem *swap; + TreeItem *swap = NULL; if (p_button==1) { swap=ti->get_prev(); @@ -1003,7 +1012,7 @@ void ProjectSettings::_translation_delete(Object *p_item,int p_column, int p_but undo_redo->create_action("Remove Translation"); undo_redo->add_do_property(Globals::get_singleton(),"locale/translations",translations); - undo_redo->add_undo_property(Globals::get_singleton(),"locale/translations",Globals::get_singleton()->get("locale/translations")); + undo_redo->add_undo_property(Globals::get_singleton(),"locale/translations",Globals::get_singleton()->get("locale/translations")); undo_redo->add_do_method(this,"_update_translations"); undo_redo->add_undo_method(this,"_update_translations"); undo_redo->add_do_method(this,"_settings_changed"); @@ -1117,7 +1126,7 @@ void ProjectSettings::_translation_res_option_changed() { ERR_FAIL_COND(!remaps.has(key)); - StringArray r = remaps[key]; + StringArray r = remaps[key]; ERR_FAIL_INDEX(idx,r.size()); r.set(idx,path+":"+langs[which]); remaps[key]=r; diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 303604c2fc..1340670db1 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -2162,7 +2162,7 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) { //} - } + } } @@ -3840,14 +3840,34 @@ void SectionedPropertyEditor::_section_selected(int p_which) { filter->set_section( sections->get_item_metadata(p_which) ); } +void SectionedPropertyEditor::set_current_section(const String& p_section) { + + int section_idx = sections->find_metadata(p_section); + + if (section_idx==sections->get_current()) + return; + + if (section_idx!=-1) { + sections->select(section_idx); + _section_selected(section_idx); + } else if (sections->get_item_count()) { + sections->select(0); + _section_selected(0); + } +} + String SectionedPropertyEditor::get_current_section() const { - return sections->get_item_metadata( sections->get_current() ); + if (sections->get_current()!=-1) + return sections->get_item_metadata( sections->get_current() ); + else + return ""; } String SectionedPropertyEditor::get_full_item_path(const String& p_item) { - String base = sections->get_item_metadata( sections->get_current() ); + String base = get_current_section(); + if (base!="") return base+"/"+p_item; else @@ -3856,17 +3876,44 @@ String SectionedPropertyEditor::get_full_item_path(const String& p_item) { void SectionedPropertyEditor::edit(Object* p_object) { - List<PropertyInfo> pinfo; - if (p_object) - p_object->get_property_list(&pinfo); + if (p_object) { + obj=p_object->get_instance_ID(); + update_category_list(); + } else { + sections->clear(); + } + + filter->set_edited(p_object); + editor->edit(filter); + + sections->select(0); + _section_selected(0); + +} + +void SectionedPropertyEditor::update_category_list() { + + String selected_category=get_current_section(); sections->clear(); + Object *o = ObjectDB::get_instance(obj); + + if (!o) + return; + + List<PropertyInfo> pinfo; + o->get_property_list(&pinfo); + Set<String> existing_sections; for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) { PropertyInfo pi=E->get(); + if (pi.usage&PROPERTY_USAGE_CATEGORY) continue; + else if ( !(pi.usage&PROPERTY_USAGE_EDITOR) ) + continue; + if (pi.name.find(":")!=-1 || pi.name=="script/script") continue; int sp = pi.name.find("/"); @@ -3885,19 +3932,9 @@ void SectionedPropertyEditor::edit(Object* p_object) { sections->set_item_metadata(sections->get_item_count()-1,""); } } - - } - //sections->sort_items_by_text(); - - - filter->set_edited(p_object); - editor->edit(filter); - - sections->select(0); - _section_selected(0); - + set_current_section(selected_category); } PropertyEditor *SectionedPropertyEditor::get_property_editor() { diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 63ad090901..b870a618e9 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -174,7 +174,7 @@ class PropertyEditor : public Control { Map<StringName,Map<StringName,String> > descr_cache; Map<StringName,String > class_descr_cache; - + CustomPropertyEditor *custom_editor; void _resource_edit_request(); @@ -245,7 +245,7 @@ public: void set_subsection_selectable(bool p_selectable); - PropertyEditor(); + PropertyEditor(); ~PropertyEditor(); }; @@ -257,6 +257,9 @@ class SectionedPropertyEditor : public HBoxContainer { OBJ_TYPE(SectionedPropertyEditor,HBoxContainer); + + ObjectID obj; + ItemList *sections; SectionedPropertyEditorFilter *filter; PropertyEditor *editor; @@ -270,8 +273,12 @@ public: PropertyEditor *get_property_editor(); void edit(Object* p_object); String get_full_item_path(const String& p_item); + + void set_current_section(const String& p_section); String get_current_section() const; + void update_category_list(); + SectionedPropertyEditor(); ~SectionedPropertyEditor(); }; diff --git a/tools/editor/reparent_dialog.cpp b/tools/editor/reparent_dialog.cpp index 97b27603b2..2a886b85fa 100644 --- a/tools/editor/reparent_dialog.cpp +++ b/tools/editor/reparent_dialog.cpp @@ -47,19 +47,19 @@ void ReparentDialog::_notification(int p_what) { } if (p_what==NOTIFICATION_DRAW) { - + //RID ci = get_canvas_item(); //get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); - } + } } void ReparentDialog::_cancel() { - + hide(); - + } void ReparentDialog::_reparent() { - + if (tree->get_selected()) { emit_signal("reparent",tree->get_selected()->get_path(),keep_transform->is_pressed()); @@ -68,14 +68,14 @@ void ReparentDialog::_reparent() { } void ReparentDialog::set_current(const Set<Node*>& p_selection) { - + tree->set_marked(p_selection,false,false); //tree->set_selected(p_node->get_parent()); } void ReparentDialog::_bind_methods() { - - ObjectTypeDB::bind_method("_reparent",&ReparentDialog::_reparent); + + ObjectTypeDB::bind_method("_reparent",&ReparentDialog::_reparent); ObjectTypeDB::bind_method("_cancel",&ReparentDialog::_cancel); ADD_SIGNAL( MethodInfo("reparent",PropertyInfo(Variant::NODE_PATH,"path"),PropertyInfo(Variant::BOOL,"keep_global_xform"))); diff --git a/tools/editor/reparent_dialog.h b/tools/editor/reparent_dialog.h index 296102e4b9..1c0fbd2459 100644 --- a/tools/editor/reparent_dialog.h +++ b/tools/editor/reparent_dialog.h @@ -39,30 +39,30 @@ @author Juan Linietsky <reduzio@gmail.com> */ class ReparentDialog : public ConfirmationDialog { - + OBJ_TYPE( ReparentDialog, ConfirmationDialog ); - + SceneTreeEditor *tree; CheckBox *keep_transform; - + void update_tree(); void _reparent(); void _cancel(); protected: - + void _notification(int p_what); static void _bind_methods(); public: - + void set_current(const Set<Node*>& p_selection); String get_selected_type(); - - ReparentDialog(); + + ReparentDialog(); ~ReparentDialog(); - + }; #endif diff --git a/tools/editor/run_settings_dialog.cpp b/tools/editor/run_settings_dialog.cpp index e8c509d79d..9dc4d703fc 100644 --- a/tools/editor/run_settings_dialog.cpp +++ b/tools/editor/run_settings_dialog.cpp @@ -84,7 +84,7 @@ RunSettingsDialog::RunSettingsDialog() { run_mode->add_item("Main Scene"); run_mode->connect("item_selected",this,"_run_mode_changed"); arguments = memnew( LineEdit ); - vbc->add_margin_child("Main Scene Arguments:",arguments); + vbc->add_margin_child("Main Scene Arguments:",arguments); arguments->set_editable(false); get_ok()->set_text("Close"); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index 45eecacb6b..c16152ae44 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -211,7 +211,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) } void SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { - + if (!p_node) return; @@ -252,7 +252,7 @@ void SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { else icon=get_icon( (has_icon(p_node->get_type(),"EditorIcons")?p_node->get_type():String("Object")),"EditorIcons"); item->set_icon(0, icon ); - item->set_metadata( 0,p_node->get_path() ); + item->set_metadata( 0,p_node->get_path() ); if (part_of_subscene) { @@ -260,7 +260,7 @@ void SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { item->set_custom_color(0,Color(0.8,0.4,0.20)); } else if (marked.has(p_node)) { - + item->set_selectable(0,marked_selectable); item->set_custom_color(0,Color(0.8,0.1,0.10)); } else if (!marked_selectable && !marked_children_selectable) { @@ -344,9 +344,9 @@ void SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { item->select(0); item->set_as_cursor(0); } - + for (int i=0;i<p_node->get_child_count();i++) { - + _add_nodes(p_node->get_child(i),item); } } @@ -406,7 +406,7 @@ void SceneTreeEditor::_node_script_changed(Node *p_node) { } void SceneTreeEditor::_node_removed(Node *p_node) { - + if (p_node->is_connected("script_changed",this,"_node_script_changed")) p_node->disconnect("script_changed",this,"_node_script_changed"); @@ -419,8 +419,8 @@ void SceneTreeEditor::_node_removed(Node *p_node) { selected=NULL; emit_signal("node_selected"); } - - + + } void SceneTreeEditor::_update_tree() { @@ -492,11 +492,11 @@ void SceneTreeEditor::_tree_changed() { void SceneTreeEditor::_selected_changed() { - + TreeItem *s = tree->get_selected(); ERR_FAIL_COND(!s); NodePath np = s->get_metadata(0); - + Node *n=get_node(np); @@ -509,8 +509,8 @@ void SceneTreeEditor::_selected_changed() { blocked++; emit_signal("node_selected"); blocked--; - - + + } @@ -540,7 +540,7 @@ void SceneTreeEditor::_cell_multi_selected(Object *p_object,int p_cell,bool p_se } void SceneTreeEditor::_notification(int p_what) { - + if (p_what==NOTIFICATION_ENTER_TREE) { get_tree()->connect("tree_changed",this,"_tree_changed"); @@ -570,20 +570,20 @@ TreeItem* SceneTreeEditor::_find(TreeItem *p_node,const NodePath& p_path) { if (!p_node) return NULL; - + NodePath np=p_node->get_metadata(0); if (np==p_path) return p_node; - + TreeItem *children=p_node->get_children(); while(children) { - + TreeItem *n=_find(children,p_path); if (n) return n; children=children->get_next(); } - + return NULL; } @@ -598,24 +598,24 @@ void SceneTreeEditor::set_selected(Node *p_node,bool p_emit_selected) { if (selected==p_node) return; - - + + TreeItem* item=p_node?_find(tree->get_root(),p_node->get_path()):NULL; if (item) { item->select(0); item->set_as_cursor(0); - selected=p_node; + selected=p_node; tree->ensure_cursor_is_visible(); } else { if (!p_node) selected=NULL; _update_tree(); - selected=p_node; + selected=p_node; if (p_emit_selected) emit_signal("node_selected"); } - + } void SceneTreeEditor::_rename_node(ObjectID p_node,const String& p_name) { @@ -787,10 +787,10 @@ void SceneTreeEditor::_cell_collapsed(Object *p_obj) { void SceneTreeEditor::_bind_methods() { - + ObjectTypeDB::bind_method("_tree_changed",&SceneTreeEditor::_tree_changed); ObjectTypeDB::bind_method("_update_tree",&SceneTreeEditor::_update_tree); - ObjectTypeDB::bind_method("_node_removed",&SceneTreeEditor::_node_removed); + ObjectTypeDB::bind_method("_node_removed",&SceneTreeEditor::_node_removed); ObjectTypeDB::bind_method("_selected_changed",&SceneTreeEditor::_selected_changed); ObjectTypeDB::bind_method("_renamed",&SceneTreeEditor::_renamed); ObjectTypeDB::bind_method("_rename_node",&SceneTreeEditor::_rename_node); @@ -817,7 +817,7 @@ void SceneTreeEditor::_bind_methods() { SceneTreeEditor::SceneTreeEditor(bool p_label,bool p_can_rename, bool p_can_open_instance) { - + undo_redo=NULL; tree_dirty=true; @@ -829,23 +829,23 @@ SceneTreeEditor::SceneTreeEditor(bool p_label,bool p_can_rename, bool p_can_open can_open_instance=p_can_open_instance; display_foreign=false; editor_selection=NULL; - + if (p_label) { Label *label = memnew( Label ); label->set_pos( Point2(10, 0)); label->set_text("Scene Tree (Nodes):"); - + add_child(label); } - + tree = memnew( Tree ); tree->set_anchor( MARGIN_RIGHT, ANCHOR_END ); - tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); + tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); tree->set_begin( Point2(0,p_label?18:0 )); tree->set_end( Point2(0,0 )); - + add_child( tree ); - + tree->connect("cell_selected", this,"_selected_changed"); tree->connect("item_edited", this,"_renamed",varray(),CONNECT_DEFERRED); tree->connect("multi_selected",this,"_cell_multi_selected"); @@ -889,7 +889,7 @@ SceneTreeEditor::SceneTreeEditor(bool p_label,bool p_can_rename, bool p_can_open SceneTreeEditor::~SceneTreeEditor() { - + } diff --git a/tools/editor/scene_tree_editor.h b/tools/editor/scene_tree_editor.h index 334debc148..27ccaaae01 100644 --- a/tools/editor/scene_tree_editor.h +++ b/tools/editor/scene_tree_editor.h @@ -38,7 +38,7 @@ @author Juan Linietsky <reduzio@gmail.com> */ class SceneTreeEditor : public Control { - + OBJ_TYPE( SceneTreeEditor, Control ); EditorSelection *editor_selection; @@ -70,7 +70,7 @@ class SceneTreeEditor : public Control { ConfirmationDialog *clear_inherit_confirm; int blocked; - + void _compute_hash(Node *p_node,uint64_t &hash); void _add_nodes(Node *p_node,TreeItem *p_parent); @@ -78,7 +78,7 @@ class SceneTreeEditor : public Control { void _update_tree(); void _tree_changed(); void _node_removed(Node *p_node); - + TreeItem* _find(TreeItem *p_node,const NodePath& p_path); void _notification(int p_what); void _selected_changed(); @@ -92,17 +92,17 @@ class SceneTreeEditor : public Control { bool can_open_instance; bool updating_tree; bool show_enabled_subscene; - + void _renamed(); UndoRedo *undo_redo; - + Set<Node*> marked; bool marked_selectable; bool marked_children_selectable; bool display_foreign; bool tree_dirty; bool pending_test_update; - static void _bind_methods(); + static void _bind_methods(); void _cell_button_pressed(Object *p_item,int p_column,int p_id); void _cell_multi_selected(Object *p_object,int p_cel,bool p_selected); @@ -119,7 +119,7 @@ public: void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo=p_undo_redo; }; void set_display_foreign_nodes(bool p_display); bool get_display_foreign_nodes() const; - + void set_marked(const Set<Node*>& p_marked,bool p_selectable=false,bool p_children_selectable=true); void set_marked(Node *p_marked,bool p_selectable=false,bool p_children_selectable=true); void set_selected(Node *p_node,bool p_emit_selected=true); @@ -150,7 +150,7 @@ class SceneTreeDialog : public ConfirmationDialog { void update_tree(); void _select(); - void _cancel(); + void _cancel(); protected: diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp index 5abc4992df..e2b17f5e64 100644 --- a/tools/editor/scenes_dock.cpp +++ b/tools/editor/scenes_dock.cpp @@ -1122,7 +1122,7 @@ ScenesDock::ScenesDock(EditorNode *p_editor) { button_reload = memnew( Button ); button_reload->set_flat(true); - button_reload->connect("pressed",this,"_rescan"); + button_reload->connect("pressed",this,"_rescan"); toolbar_hbc->add_child(button_reload); button_reload->set_focus_mode(FOCUS_NONE); button_reload->set_tooltip("Re-Scan Filesystem"); @@ -1238,10 +1238,10 @@ ScenesDock::ScenesDock(EditorNode *p_editor) { add_child(remove_dialog); move_dialog = memnew( EditorDirDialog ); - add_child(move_dialog); + add_child(move_dialog); move_dialog->connect("dir_selected",this,"_move_operation"); move_dialog->get_ok()->set_text("Move"); - + rename_dialog = memnew( EditorFileDialog ); rename_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); rename_dialog->connect("file_selected",this,"_rename_operation"); diff --git a/tools/editor/scenes_dock.h b/tools/editor/scenes_dock.h index a1978a3ca4..a630d2506d 100644 --- a/tools/editor/scenes_dock.h +++ b/tools/editor/scenes_dock.h @@ -138,7 +138,7 @@ class ScenesDock : public VBoxContainer { void _rescan(); void _set_scannig_mode(); - void _favorites_pressed(); + void _favorites_pressed(); void _instance_pressed(); void _open_pressed(); diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index 409e8be870..34d9204061 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -138,7 +138,7 @@ void ScriptCreateDialog::ok_pressed() { return; } - Error err = ResourceSaver::save(lpath,scr,ResourceSaver::FLAG_CHANGE_PATH); + Error err = ResourceSaver::save(lpath,scr,ResourceSaver::FLAG_CHANGE_PATH); if (err!=OK) { alert->set_text("Could not create script in filesystem: "+String("")); @@ -195,7 +195,7 @@ void ScriptCreateDialog::_browse_path() { file_browse->add_filter("*."+E->get()); } - file_browse->set_current_path(file_path->get_text()); + file_browse->set_current_path(file_path->get_text()); file_browse->popup_centered_ratio(); } diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index de35672278..3414e80482 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -81,7 +81,7 @@ void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base) { VS::get_singleton()->instance_attach_skeleton(instance,skeleton); if (extra_margin) VS::get_singleton()->instance_set_extra_visibility_margin(instance,1); - VS::get_singleton()->instance_geometry_set_flag(instance,VS::INSTANCE_FLAG_CAST_SHADOW,false); + VS::get_singleton()->instance_geometry_set_cast_shadows_setting(instance,VS::SHADOW_CASTING_SETTING_OFF); VS::get_singleton()->instance_geometry_set_flag(instance,VS::INSTANCE_FLAG_RECEIVE_SHADOWS,false); VS::get_singleton()->instance_set_layer_mask(instance,1<<SpatialEditorViewport::GIZMO_EDIT_LAYER); //gizmos are 26 } @@ -708,7 +708,8 @@ void EditorSpatialGizmo::_bind_methods() { EditorSpatialGizmo::EditorSpatialGizmo() { valid=false; billboard_handle=false; - + base=NULL; + spatial_node=NULL; } EditorSpatialGizmo::~EditorSpatialGizmo(){ @@ -3219,4 +3220,3 @@ SpatialEditorGizmos::SpatialEditorGizmos() { } - diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 346e360225..0162bcbf79 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -491,4 +491,3 @@ public: }; #endif // SPATIAL_EDITOR_GIZMOS_H - |