ReparentDialog::ReparentDialog() { set_title(TTR("Reparent Node")); VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); tree = memnew( SceneTreeEditor(false) ); tree->set_show_enabled_subscene(true); vbc->add_margin_child(TTR("Reparent Location (Select new Parent):"),tree,true); tree->get_scene_tree()->connect("item_activated",this,"_reparent"); //Label *label = memnew( Label ); //label->set_pos( Point2( 15,8) ); //label->set_text("Reparent Location (Select new Parent):"); keep_transform = memnew( CheckBox ); keep_transform->set_text(TTR("Keep Global Transform")); keep_transform->set_pressed(true); vbc->add_child(keep_transform); //vbc->add_margin_child("Options:",node_only);; //cancel->connect("pressed", this,"_cancel"); get_ok()->set_text(TTR("Reparent")); }
SceneTreeDialog::SceneTreeDialog() { set_title(TTR("Select a Node")); tree = memnew(SceneTreeEditor(false, false, true)); add_child(tree); tree->get_scene_tree()->connect("item_activated", this, "_select"); }
SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelection *p_editor_selection,EditorData &p_editor_data) { editor=p_editor; edited_scene=NULL; editor_data=&p_editor_data; editor_selection=p_editor_selection; scene_root=p_scene_root; VBoxContainer *vbc = this; HBoxContainer *hbc_top = memnew( HBoxContainer ); vbc->add_child(hbc_top); ToolButton *tb; tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_NEW, false)); tb->set_tooltip("Add/Create a New Node\n("+keycode_get_string(KEY_MASK_CMD|KEY_A)+")"); hbc_top->add_child(tb); tool_buttons[TOOL_NEW]=tb; tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_INSTANCE, false)); tb->set_tooltip("Instance a Node from scene file."); hbc_top->add_child(tb); tool_buttons[TOOL_INSTANCE]=tb; tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPLACE, false)); tb->set_tooltip("Replace a Node by Another Node Type"); hbc_top->add_child(tb); tool_buttons[TOOL_REPLACE]=tb; hbc_top->add_spacer(); tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_CONNECT, false)); tb->set_tooltip("Edit the Node Connections"); hbc_top->add_child(tb); tool_buttons[TOOL_CONNECT]=tb; tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_GROUP, false)); tb->set_tooltip("Edit the Node Groups"); hbc_top->add_child(tb); tool_buttons[TOOL_GROUP]=tb; tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_SCRIPT, false)); tb->set_tooltip("Edit/Create the Node Script"); hbc_top->add_child(tb); tool_buttons[TOOL_SCRIPT]=tb; scene_tree = memnew( SceneTreeEditor(false,true,true )); vbc->add_child(scene_tree); scene_tree->set_v_size_flags(SIZE_EXPAND|SIZE_FILL); scene_tree->connect("node_selected", this,"_node_selected",varray(),CONNECT_DEFERRED); scene_tree->connect("node_renamed", this,"_node_renamed",varray(),CONNECT_DEFERRED); scene_tree->connect("node_prerename", this,"_node_prerenamed"); scene_tree->connect("open",this,"_load_request"); scene_tree->connect("open_script",this,"_script_open_request"); scene_tree->set_undo_redo(&editor_data->get_undo_redo()); scene_tree->set_editor_selection(editor_selection); HBoxContainer *hbc_bottom = memnew( HBoxContainer ); vbc->add_child(hbc_bottom); tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_UP, false)); tb->set_tooltip("Move Node Up\n("+keycode_get_string(KEY_MASK_CMD|KEY_UP)+")"); hbc_bottom->add_child(tb); tool_buttons[TOOL_MOVE_UP]=tb; tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_DOWN, false)); tb->set_tooltip("Move Node Down\n("+keycode_get_string(KEY_MASK_CMD|KEY_DOWN)+")"); hbc_bottom->add_child(tb); tool_buttons[TOOL_MOVE_DOWN]=tb; tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_DUPLICATE, false)); tb->set_tooltip("Duplicate Selected Node(s)\n("+keycode_get_string(KEY_MASK_CMD|KEY_D)+")"); hbc_bottom->add_child(tb); tool_buttons[TOOL_DUPLICATE]=tb; tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPARENT, false)); tb->set_tooltip("Reparent Selected Node(s)"); hbc_bottom->add_child(tb); tool_buttons[TOOL_REPARENT]=tb; hbc_bottom->add_spacer(); tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_ERASE, false)); tb->set_tooltip("Erase Selected Node(s)"); hbc_bottom->add_child(tb); tool_buttons[TOOL_ERASE]=tb; create_dialog = memnew( CreateDialog ); create_dialog->set_base_type("Node"); add_child(create_dialog); create_dialog->connect("create",this,"_create"); groups_editor = memnew( GroupsEditor ); add_child(groups_editor); groups_editor->set_undo_redo(&editor_data->get_undo_redo()); connect_dialog = memnew( ConnectionsDialog(p_editor) ); add_child(connect_dialog); connect_dialog->set_undoredo(&editor_data->get_undo_redo()); script_create_dialog = memnew( ScriptCreateDialog ); add_child(script_create_dialog); script_create_dialog->connect("script_created",this,"_script_created"); reparent_dialog = memnew( ReparentDialog ); add_child(reparent_dialog); reparent_dialog->connect("reparent",this,"_node_reparent"); accept = memnew( AcceptDialog ); add_child(accept); file = memnew( FileDialog ); add_child(file); file->connect("file_selected",this,"instance"); set_process_unhandled_key_input(true); delete_dialog = memnew( ConfirmationDialog ); add_child(delete_dialog); delete_dialog->connect("confirmed",this,"_delete_confirm"); import_subscene_dialog = memnew( EditorSubScene ); add_child(import_subscene_dialog); import_subscene_dialog->connect("subscene_selected",this,"_import_subscene"); }
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); label = memnew( Label ); label->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); label->set_pos( Point2( 0.5,11) ); label->set_text("Binds (Extra Params):"); add_child(label); tree = memnew(SceneTreeEditor(false)); tree->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO ); tree->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); tree->set_begin( Point2( 15,32) ); tree->set_end( Point2( 0.5,127 ) ); add_child(tree); bind_editor = memnew( PropertyEditor ); bind_editor->set_anchor( MARGIN_RIGHT, ANCHOR_END ); bind_editor->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); bind_editor->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); bind_editor->set_begin( Point2( 0.51,42) ); bind_editor->set_end( Point2( 15,127 ) ); bind_editor->get_top_label()->hide(); add_child(bind_editor); type_list = memnew( OptionButton ); type_list->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO ); type_list->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); type_list->set_begin( Point2( 0.51,32) ); type_list->set_end( Point2( 0.75,33 ) ); add_child(type_list); type_list->add_item("bool",Variant::BOOL); type_list->add_item("int",Variant::INT); type_list->add_item("real",Variant::REAL); type_list->add_item("string",Variant::STRING); //type_list->add_separator(); type_list->add_item("Vector2",Variant::VECTOR2); type_list->add_item("Rect2",Variant::RECT2); type_list->add_item("Vector3",Variant::VECTOR3); type_list->add_item("Plane",Variant::PLANE); type_list->add_item("Quat",Variant::QUAT); type_list->add_item("AABB",Variant::_AABB); type_list->add_item("Matrix3",Variant::MATRIX3); type_list->add_item("Transform",Variant::TRANSFORM); //type_list->add_separator(); type_list->add_item("Color",Variant::COLOR); type_list->add_item("Image",Variant::IMAGE); type_list->select(0); Button *add_bind = memnew( Button ); add_bind->set_anchor( MARGIN_RIGHT, ANCHOR_RATIO ); add_bind->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); add_bind->set_begin( Point2( 0.76,32) ); add_bind->set_end( Point2( 0.84,33 ) ); add_bind->set_text("Add"); add_child(add_bind); add_bind->connect("pressed",this,"_add_bind"); Button *del_bind = memnew( Button ); del_bind->set_anchor( MARGIN_RIGHT, ANCHOR_END ); del_bind->set_anchor( MARGIN_LEFT, ANCHOR_RATIO ); del_bind->set_begin( Point2( 0.85,32) ); del_bind->set_end( Point2( 15,33 ) ); del_bind->set_text("Remove"); add_child(del_bind); del_bind->connect("pressed",this,"_remove_bind"); label = memnew( Label ); label->set_anchor( MARGIN_TOP, ANCHOR_END ); 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); dst_path->set_anchor( MARGIN_TOP, ANCHOR_END ); dst_path->set_anchor( MARGIN_RIGHT, ANCHOR_END ); dst_path->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); dst_path->set_begin( Point2( 15,105) ); 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_begin( Point2( 8,78 ) ); label->set_end( Point2( 15,52 ) ); label->set_text("Method In Node:"); add_child(label); HBoxContainer *dstm_hb = memnew( HBoxContainer ); dstm_hb->set_anchor( MARGIN_TOP, ANCHOR_END ); dstm_hb->set_anchor( MARGIN_RIGHT, ANCHOR_END ); dstm_hb->set_anchor( MARGIN_BOTTOM, ANCHOR_END ); dstm_hb->set_begin( Point2( 15,59) ); dstm_hb->set_end( Point2( 15,39 ) ); add_child(dstm_hb); dst_method = memnew(LineEdit); dst_method->set_h_size_flags(SIZE_EXPAND_FILL); dstm_hb->add_child(dst_method); /*dst_method_list = memnew( MenuButton ); dst_method_list->set_text("List.."); 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_begin( Point2( 70,59) ); dst_method_list->set_end( Point2( 15,39 ) ); */ //add_child(dst_method_list); make_callback = memnew( CheckButton ); make_callback->set_toggle_mode(true); make_callback->set_pressed( EDITOR_DEF("text_editor/create_signal_callbacks",true)); make_callback->set_text("Make Function "); dstm_hb->add_child(make_callback); deferred = memnew( CheckButton ); deferred->set_toggle_mode(true); deferred->set_pressed(true); deferred->set_text("Deferred"); dstm_hb->add_child(deferred); /* realtime = memnew( CheckButton ); realtime->set_anchor( MARGIN_TOP, ANCHOR_END ); 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_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"); set_as_toplevel(true); cdbinds = memnew( ConnectDialogBinds ); bind_editor->edit(cdbinds); error = memnew( ConfirmationDialog ); add_child(error); error->get_ok()->set_text("Close"); get_ok()->set_text("Connect"); // error->get_cancel()->set_text("Close"); }
ConnectDialog::ConnectDialog() { VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); HBoxContainer *main_hb = memnew(HBoxContainer); vbc->add_child(main_hb); main_hb->set_v_size_flags(SIZE_EXPAND_FILL); VBoxContainer *vbc_left = memnew(VBoxContainer); main_hb->add_child(vbc_left); vbc_left->set_h_size_flags(SIZE_EXPAND_FILL); tree = memnew(SceneTreeEditor(false)); tree->get_scene_tree()->connect("item_activated", this, "_ok"); tree->connect("node_selected", this, "_tree_node_selected"); vbc_left->add_margin_child(TTR("Connect To Node:"), tree, true); VBoxContainer *vbc_right = memnew(VBoxContainer); main_hb->add_child(vbc_right); vbc_right->set_h_size_flags(SIZE_EXPAND_FILL); HBoxContainer *add_bind_hb = memnew(HBoxContainer); type_list = memnew(OptionButton); type_list->set_h_size_flags(SIZE_EXPAND_FILL); add_bind_hb->add_child(type_list); type_list->add_item("bool", Variant::BOOL); type_list->add_item("int", Variant::INT); type_list->add_item("real", Variant::REAL); type_list->add_item("string", Variant::STRING); type_list->add_item("Vector2", Variant::VECTOR2); type_list->add_item("Rect2", Variant::RECT2); type_list->add_item("Vector3", Variant::VECTOR3); type_list->add_item("Plane", Variant::PLANE); type_list->add_item("Quat", Variant::QUAT); type_list->add_item("AABB", Variant::AABB); type_list->add_item("Basis", Variant::BASIS); type_list->add_item("Transform", Variant::TRANSFORM); type_list->add_item("Color", Variant::COLOR); type_list->select(0); Button *add_bind = memnew(Button); add_bind->set_text(TTR("Add")); add_bind_hb->add_child(add_bind); add_bind->connect("pressed", this, "_add_bind"); Button *del_bind = memnew(Button); del_bind->set_text(TTR("Remove")); add_bind_hb->add_child(del_bind); del_bind->connect("pressed", this, "_remove_bind"); vbc_right->add_margin_child(TTR("Add Extra Call Argument:"), add_bind_hb); bind_editor = memnew(EditorInspector); vbc_right->add_margin_child(TTR("Extra Call Arguments:"), bind_editor, true); dst_path = memnew(LineEdit); vbc->add_margin_child(TTR("Path to Node:"), dst_path); HBoxContainer *dstm_hb = memnew(HBoxContainer); vbc->add_margin_child("Method In Node:", dstm_hb); dst_method = memnew(LineEdit); dst_method->set_h_size_flags(SIZE_EXPAND_FILL); dstm_hb->add_child(dst_method); /* dst_method_list = memnew( MenuButton ); dst_method_list->set_text("List..."); 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_begin( Point2( 70,59) ); dst_method_list->set_end( Point2( 15,39 ) ); */ make_callback = memnew(CheckButton); make_callback->set_toggle_mode(true); make_callback->set_pressed(EDITOR_DEF("text_editor/tools/create_signal_callbacks", true)); make_callback->set_text(TTR("Make Function")); dstm_hb->add_child(make_callback); deferred = memnew(CheckButton); deferred->set_text(TTR("Deferred")); dstm_hb->add_child(deferred); oneshot = memnew(CheckButton); oneshot->set_text(TTR("Oneshot")); dstm_hb->add_child(oneshot); set_as_toplevel(true); cdbinds = memnew(ConnectDialogBinds); error = memnew(ConfirmationDialog); add_child(error); error->get_ok()->set_text(TTR("Close")); get_ok()->set_text(TTR("Connect")); }
ConnectDialog::ConnectDialog() { VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); HBoxContainer *main_hb = memnew(HBoxContainer); vbc->add_child(main_hb); main_hb->set_v_size_flags(SIZE_EXPAND_FILL); VBoxContainer *vbc_left = memnew(VBoxContainer); main_hb->add_child(vbc_left); vbc_left->set_h_size_flags(SIZE_EXPAND_FILL); from_signal = memnew(LineEdit); from_signal->set_editable(false); vbc_left->add_margin_child(TTR("From Signal:"), from_signal); tree = memnew(SceneTreeEditor(false)); tree->get_scene_tree()->connect("item_activated", this, "_ok"); tree->connect("node_selected", this, "_tree_node_selected"); tree->set_connect_to_script_mode(true); Node *mc = vbc_left->add_margin_child(TTR("Connect To Script:"), tree, true); connect_to_label = Object::cast_to<Label>(vbc_left->get_child(mc->get_index() - 1)); error_label = memnew(Label); error_label->set_text(TTR("Scene does not contain any script.")); vbc_left->add_child(error_label); error_label->hide(); vbc_right = memnew(VBoxContainer); main_hb->add_child(vbc_right); vbc_right->set_h_size_flags(SIZE_EXPAND_FILL); vbc_right->hide(); HBoxContainer *add_bind_hb = memnew(HBoxContainer); type_list = memnew(OptionButton); type_list->set_h_size_flags(SIZE_EXPAND_FILL); add_bind_hb->add_child(type_list); type_list->add_item("bool", Variant::BOOL); type_list->add_item("int", Variant::INT); type_list->add_item("real", Variant::REAL); type_list->add_item("string", Variant::STRING); type_list->add_item("Vector2", Variant::VECTOR2); type_list->add_item("Rect2", Variant::RECT2); type_list->add_item("Vector3", Variant::VECTOR3); type_list->add_item("Plane", Variant::PLANE); type_list->add_item("Quat", Variant::QUAT); type_list->add_item("AABB", Variant::AABB); type_list->add_item("Basis", Variant::BASIS); type_list->add_item("Transform", Variant::TRANSFORM); type_list->add_item("Color", Variant::COLOR); type_list->select(0); Button *add_bind = memnew(Button); add_bind->set_text(TTR("Add")); add_bind_hb->add_child(add_bind); add_bind->connect("pressed", this, "_add_bind"); Button *del_bind = memnew(Button); del_bind->set_text(TTR("Remove")); add_bind_hb->add_child(del_bind); del_bind->connect("pressed", this, "_remove_bind"); vbc_right->add_margin_child(TTR("Add Extra Call Argument:"), add_bind_hb); bind_editor = memnew(EditorInspector); vbc_right->add_margin_child(TTR("Extra Call Arguments:"), bind_editor, true); HBoxContainer *dstm_hb = memnew(HBoxContainer); vbc_left->add_margin_child("Method to Create:", dstm_hb); dst_method = memnew(LineEdit); dst_method->set_h_size_flags(SIZE_EXPAND_FILL); dstm_hb->add_child(dst_method); advanced = memnew(CheckBox); dstm_hb->add_child(advanced); advanced->set_text(TTR("Advanced...")); advanced->connect("pressed", this, "_advanced_pressed"); /* dst_method_list = memnew( MenuButton ); dst_method_list->set_text("List..."); 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_begin( Point2( 70,59) ); dst_method_list->set_end( Point2( 15,39 ) ); */ deferred = memnew(CheckButton); deferred->set_text(TTR("Deferred")); vbc_right->add_child(deferred); oneshot = memnew(CheckButton); oneshot->set_text(TTR("Oneshot")); vbc_right->add_child(oneshot); set_as_toplevel(true); cdbinds = memnew(ConnectDialogBinds); error = memnew(ConfirmationDialog); add_child(error); error->get_ok()->set_text(TTR("Close")); get_ok()->set_text(TTR("Connect")); }