Пример #1
0
Popup::Popup() {

	set_as_toplevel(true);
	exclusive = false;
	popped_up = false;
	hide();
}
Пример #2
0
AcceptDialog::AcceptDialog() {

	int margin = get_constant("margin","Dialogs");
	int button_margin = get_constant("button_margin","Dialogs");


	label = memnew( Label );
	label->set_anchor(MARGIN_RIGHT,ANCHOR_END);
	label->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
	label->set_begin( Point2( margin, margin) );
	label->set_end( Point2( margin, button_margin+10) );
	//label->set_autowrap(true);
	add_child(label);

	hbc = memnew( HBoxContainer );
	hbc->set_area_as_parent_rect(margin);
	hbc->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,button_margin);
	add_child(hbc);

	hbc->add_spacer();
	ok = memnew( Button );
	ok->set_text("OK");
	hbc->add_child(ok);
	hbc->add_spacer();
	//add_child(ok);


	ok->connect("pressed", this,"_ok");
	set_as_toplevel(true);

	hide_on_ok=true;
	set_title("Alert!");
}
Пример #3
0
PopupMenu::PopupMenu() {

	idcount=0;
	mouse_over=-1;
	
	set_focus_mode(FOCUS_ALL);
	set_as_toplevel(true);

	submenu_timer = memnew( Timer );
	submenu_timer->set_wait_time(0.3);
	submenu_timer->set_one_shot(true);
	submenu_timer->connect("timeout",this,"_submenu_timeout");
	add_child(submenu_timer);
}
Пример #4
0
PopupMenu::PopupMenu() {

	mouse_over = -1;

	set_focus_mode(FOCUS_ALL);
	set_as_toplevel(true);
	set_hide_on_item_selection(true);
	set_hide_on_checkable_item_selection(true);

	submenu_timer = memnew(Timer);
	submenu_timer->set_wait_time(0.3);
	submenu_timer->set_one_shot(true);
	submenu_timer->connect("timeout", this, "_submenu_timeout");
	add_child(submenu_timer);
}
Пример #5
0
PopupMenu::PopupMenu() {

	mouse_over = -1;
	submenu_over = -1;
	initial_button_mask = 0;
	during_grabbed_click = false;

	set_focus_mode(FOCUS_ALL);
	set_as_toplevel(true);
	set_hide_on_item_selection(true);
	set_hide_on_checkable_item_selection(true);
	set_hide_on_multistate_item_selection(false);

	submenu_timer = memnew(Timer);
	submenu_timer->set_wait_time(0.3);
	submenu_timer->set_one_shot(true);
	submenu_timer->connect("timeout", this, "_submenu_timeout");
	add_child(submenu_timer);
}
Пример #6
0
void Popup::_notification(int p_what) {

	if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
		if (popped_up && !is_visible_in_tree()) {
			popped_up = false;
			notification(NOTIFICATION_POPUP_HIDE);
			emit_signal("popup_hide");
		}

		update_configuration_warning();
	}

	if (p_what == NOTIFICATION_ENTER_TREE) {
//small helper to make editing of these easier in editor
#ifdef TOOLS_ENABLED
		if (get_tree()->is_editor_hint() && get_tree()->get_edited_scene_root() && get_tree()->get_edited_scene_root()->is_a_parent_of(this)) {
			set_as_toplevel(false);
		}
#endif
	}
}
Пример #7
0
CreateDialog::CreateDialog() {

	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);
	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);
	vbc->add_margin_child("Filter:", filter);

	base = "Node";
	set_as_toplevel(true);

	tree->connect("item_activated", this, "_create");
	filter->connect("text_changed", this, "_text_changed");
}
Пример #8
0
void SoftBody::_notification(int p_what) {
	switch (p_what) {
		case NOTIFICATION_ENTER_WORLD: {

			if (Engine::get_singleton()->is_editor_hint()) {

				add_change_receptor(this);
			}

			RID space = get_world()->get_space();
			PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, space);
			update_physics_server();
		} break;
		case NOTIFICATION_READY: {
			if (!parent_collision_ignore.is_empty())
				add_collision_exception_with(get_node(parent_collision_ignore));

		} break;
		case NOTIFICATION_TRANSFORM_CHANGED: {

			if (Engine::get_singleton()->is_editor_hint()) {
				_reset_points_offsets();
				return;
			}

			PhysicsServer::get_singleton()->soft_body_set_transform(physics_rid, get_global_transform());

			set_notify_transform(false);
			// Required to be top level with Transform at center of world in order to modify VisualServer only to support custom Transform
			set_as_toplevel(true);
			set_transform(Transform());
			set_notify_transform(true);

		} break;
		case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {

			if (!simulation_started)
				return;

			_update_cache_pin_points_datas();
			// Submit bone attachment
			const int pinned_points_indices_size = pinned_points.size();
			PoolVector<PinnedPoint>::Read r = pinned_points.read();
			for (int i = 0; i < pinned_points_indices_size; ++i) {
				if (r[i].spatial_attachment) {
					PhysicsServer::get_singleton()->soft_body_move_point(physics_rid, r[i].point_index, r[i].spatial_attachment->get_global_transform().xform(r[i].offset));
				}
			}
		} break;
		case NOTIFICATION_VISIBILITY_CHANGED: {

			_update_pickable();

		} break;
		case NOTIFICATION_EXIT_WORLD: {

			PhysicsServer::get_singleton()->soft_body_set_space(physics_rid, RID());

		} break;
	}

#ifdef TOOLS_ENABLED

	if (p_what == NOTIFICATION_LOCAL_TRANSFORM_CHANGED) {
		if (Engine::get_singleton()->is_editor_hint()) {
			update_configuration_warning();
		}
	}

#endif
}
Пример #9
0
GroupDialog::GroupDialog() {

	scene_tree = SceneTree::get_singleton();

	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);

	HBoxContainer *hbc = memnew(HBoxContainer);
	vbc->add_child(hbc);
	hbc->set_v_size_flags(SIZE_EXPAND_FILL);

	VBoxContainer *vbc_left = memnew(VBoxContainer);
	hbc->add_child(vbc_left);
	vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *group_title = memnew(Label);
	group_title->set_text(TTR("Groups"));
	vbc_left->add_child(group_title);

	groups = memnew(Tree);
	vbc_left->add_child(groups);
	groups->set_hide_root(true);
	groups->set_v_size_flags(SIZE_EXPAND_FILL);
	groups->set_select_mode(Tree::SELECT_SINGLE);
	groups->set_allow_reselect(true);
	groups->set_allow_rmb_select(true);
	groups->connect("item_selected", this, "_group_selected");
	groups->connect("button_pressed", this, "_delete_group_pressed");
	groups->connect("item_edited", this, "_group_renamed");

	HBoxContainer *chbc = memnew(HBoxContainer);
	vbc_left->add_child(chbc);
	chbc->set_h_size_flags(SIZE_EXPAND_FILL);

	add_group_text = memnew(LineEdit);
	chbc->add_child(add_group_text);
	add_group_text->set_h_size_flags(SIZE_EXPAND_FILL);

	Button *add_group_button = memnew(Button);
	add_group_button->set_text("Add");
	chbc->add_child(add_group_button);
	add_group_button->connect("pressed", this, "_add_group_pressed");

	VBoxContainer *vbc_add = memnew(VBoxContainer);
	hbc->add_child(vbc_add);
	vbc_add->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *out_of_group_title = memnew(Label);
	out_of_group_title->set_text(TTR("Nodes not in Group"));
	vbc_add->add_child(out_of_group_title);

	nodes_to_add = memnew(Tree);
	vbc_add->add_child(nodes_to_add);
	nodes_to_add->set_hide_root(true);
	nodes_to_add->set_hide_folding(true);
	nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL);
	nodes_to_add->set_select_mode(Tree::SELECT_MULTI);
	nodes_to_add->connect("item_selected", this, "_nodes_to_add_selected");

	HBoxContainer *add_filter_hbc = memnew(HBoxContainer);
	add_filter_hbc->add_constant_override("separate", 0);
	vbc_add->add_child(add_filter_hbc);

	add_filter = memnew(LineEdit);
	add_filter->set_h_size_flags(SIZE_EXPAND_FILL);
	add_filter->set_placeholder(TTR("Filter nodes"));
	add_filter_hbc->add_child(add_filter);
	add_filter->connect("text_changed", this, "_add_filter_changed");

	VBoxContainer *vbc_buttons = memnew(VBoxContainer);
	hbc->add_child(vbc_buttons);
	vbc_buttons->set_h_size_flags(SIZE_SHRINK_CENTER);
	vbc_buttons->set_v_size_flags(SIZE_SHRINK_CENTER);

	add_button = memnew(ToolButton);
	add_button->set_text(TTR("Add"));
	add_button->connect("pressed", this, "_add_pressed");

	vbc_buttons->add_child(add_button);
	vbc_buttons->add_spacer();
	vbc_buttons->add_spacer();
	vbc_buttons->add_spacer();

	remove_button = memnew(ToolButton);
	remove_button->set_text(TTR("Remove"));
	remove_button->connect("pressed", this, "_removed_pressed");

	vbc_buttons->add_child(remove_button);

	VBoxContainer *vbc_remove = memnew(VBoxContainer);
	hbc->add_child(vbc_remove);
	vbc_remove->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *in_group_title = memnew(Label);
	in_group_title->set_text(TTR("Nodes in Group"));
	vbc_remove->add_child(in_group_title);

	nodes_to_remove = memnew(Tree);
	vbc_remove->add_child(nodes_to_remove);
	nodes_to_remove->set_v_size_flags(SIZE_EXPAND_FILL);
	nodes_to_remove->set_hide_root(true);
	nodes_to_remove->set_hide_folding(true);
	nodes_to_remove->set_select_mode(Tree::SELECT_MULTI);
	nodes_to_remove->connect("item_selected", this, "_node_to_remove_selected");

	HBoxContainer *remove_filter_hbc = memnew(HBoxContainer);
	remove_filter_hbc->add_constant_override("separate", 0);
	vbc_remove->add_child(remove_filter_hbc);

	remove_filter = memnew(LineEdit);
	remove_filter->set_h_size_flags(SIZE_EXPAND_FILL);
	remove_filter->set_placeholder(TTR("Filter nodes"));
	remove_filter_hbc->add_child(remove_filter);
	remove_filter->connect("text_changed", this, "_remove_filter_changed");

	set_title("Group Editor");
	get_cancel()->hide();
	set_as_toplevel(true);

	error = memnew(ConfirmationDialog);
	add_child(error);
	error->get_ok()->set_text(TTR("Close"));
}
Пример #10
0
RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo) {

	scene_tree_editor = p_scene_tree_editor;
	undo_redo = p_undo_redo;
	preview_node = NULL;

	set_title(TTR("Batch Rename"));

	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);

	// -- Search/Replace Area

	GridContainer *grd_main = memnew(GridContainer);
	grd_main->set_columns(2);
	grd_main->set_v_size_flags(SIZE_EXPAND_FILL);
	vbc->add_child(grd_main);

	// ---- 1st & 2nd row

	Label *lbl_search = memnew(Label);
	lbl_search->set_text(TTR("Search"));

	lne_search = memnew(LineEdit);
	lne_search->set_placeholder(TTR("Search"));
	lne_search->set_name("lne_search");
	lne_search->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *lbl_replace = memnew(Label);
	lbl_replace->set_text(TTR("Replace"));

	lne_replace = memnew(LineEdit);
	lne_replace->set_placeholder(TTR("Replace"));
	lne_replace->set_name("lne_replace");
	lne_replace->set_h_size_flags(SIZE_EXPAND_FILL);

	grd_main->add_child(lbl_search);
	grd_main->add_child(lbl_replace);
	grd_main->add_child(lne_search);
	grd_main->add_child(lne_replace);

	// ---- 3rd & 4th row

	Label *lbl_prefix = memnew(Label);
	lbl_prefix->set_text(TTR("Prefix"));

	lne_prefix = memnew(LineEdit);
	lne_prefix->set_placeholder(TTR("Prefix"));
	lne_prefix->set_name("lne_prefix");
	lne_prefix->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *lbl_suffix = memnew(Label);
	lbl_suffix->set_text(TTR("Suffix"));

	lne_suffix = memnew(LineEdit);
	lne_suffix->set_placeholder(TTR("Suffix"));
	lne_suffix->set_name("lne_suffix");
	lne_suffix->set_h_size_flags(SIZE_EXPAND_FILL);

	grd_main->add_child(lbl_prefix);
	grd_main->add_child(lbl_suffix);
	grd_main->add_child(lne_prefix);
	grd_main->add_child(lne_suffix);

	// -- Feature Tabs

	const int feature_min_height = 160;

	Ref<Theme> collapse_theme = create_editor_theme();
	collapse_theme->set_icon("checked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowDown", "EditorIcons"));
	collapse_theme->set_icon("unchecked", "CheckBox", collapse_theme->get_icon("GuiTreeArrowRight", "EditorIcons"));

	CheckBox *chk_collapse_features = memnew(CheckBox);
	chk_collapse_features->set_text(TTR("Advanced options"));
	chk_collapse_features->set_theme(collapse_theme);
	chk_collapse_features->set_focus_mode(FOCUS_NONE);
	vbc->add_child(chk_collapse_features);

	tabc_features = memnew(TabContainer);
	tabc_features->set_tab_align(TabContainer::ALIGN_LEFT);
	vbc->add_child(tabc_features);

	// ---- Tab Substitute

	VBoxContainer *vbc_substitute = memnew(VBoxContainer);
	vbc_substitute->set_h_size_flags(SIZE_EXPAND_FILL);
	vbc_substitute->set_custom_minimum_size(Size2(0, feature_min_height));

	vbc_substitute->set_name(TTR("Substitute"));
	tabc_features->add_child(vbc_substitute);

	cbut_substitute = memnew(CheckButton);
	cbut_substitute->set_text(TTR("Substitute"));
	vbc_substitute->add_child(cbut_substitute);

	GridContainer *grd_substitute = memnew(GridContainer);
	grd_substitute->set_columns(3);
	vbc_substitute->add_child(grd_substitute);

	// Name

	but_insert_name = memnew(Button);
	but_insert_name->set_text("NAME");
	but_insert_name->set_tooltip(String("${NAME}\n") + TTR("Node name"));
	but_insert_name->set_focus_mode(FOCUS_NONE);
	but_insert_name->connect("pressed", this, "_insert_text", make_binds("${NAME}"));
	but_insert_name->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_name);

	// Parent

	but_insert_parent = memnew(Button);
	but_insert_parent->set_text("PARENT");
	but_insert_parent->set_tooltip(String("${PARENT}\n") + TTR("Node's parent name, if available"));
	but_insert_parent->set_focus_mode(FOCUS_NONE);
	but_insert_parent->connect("pressed", this, "_insert_text", make_binds("${PARENT}"));
	but_insert_parent->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_parent);

	// Type

	but_insert_type = memnew(Button);
	but_insert_type->set_text("TYPE");
	but_insert_type->set_tooltip(String("${TYPE}\n") + TTR("Node type"));
	but_insert_type->set_focus_mode(FOCUS_NONE);
	but_insert_type->connect("pressed", this, "_insert_text", make_binds("${TYPE}"));
	but_insert_type->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_type);

	// Scene

	but_insert_scene = memnew(Button);
	but_insert_scene->set_text("SCENE");
	but_insert_scene->set_tooltip(String("${SCENE}\n") + TTR("Current scene name"));
	but_insert_scene->set_focus_mode(FOCUS_NONE);
	but_insert_scene->connect("pressed", this, "_insert_text", make_binds("${SCENE}"));
	but_insert_scene->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_scene);

	// Root

	but_insert_root = memnew(Button);
	but_insert_root->set_text("ROOT");
	but_insert_root->set_tooltip(String("${ROOT}\n") + TTR("Root node name"));
	but_insert_root->set_focus_mode(FOCUS_NONE);
	but_insert_root->connect("pressed", this, "_insert_text", make_binds("${ROOT}"));
	but_insert_root->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_root);

	// Count

	but_insert_count = memnew(Button);
	but_insert_count->set_text("COUNTER");
	but_insert_count->set_tooltip(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options."));
	but_insert_count->set_focus_mode(FOCUS_NONE);
	but_insert_count->connect("pressed", this, "_insert_text", make_binds("${COUNTER}"));
	but_insert_count->set_h_size_flags(SIZE_EXPAND_FILL);
	grd_substitute->add_child(but_insert_count);

	chk_per_level_counter = memnew(CheckBox);
	chk_per_level_counter->set_text(TTR("Per Level counter"));
	chk_per_level_counter->set_tooltip(TTR("If set the counter restarts for each group of child nodes"));
	vbc_substitute->add_child(chk_per_level_counter);

	HBoxContainer *hbc_count_options = memnew(HBoxContainer);
	vbc_substitute->add_child(hbc_count_options);

	Label *lbl_count_start = memnew(Label);
	lbl_count_start->set_text(TTR("Start"));
	lbl_count_start->set_tooltip(TTR("Initial value for the counter"));
	hbc_count_options->add_child(lbl_count_start);

	spn_count_start = memnew(SpinBox);
	spn_count_start->set_tooltip(TTR("Initial value for the counter"));
	spn_count_start->set_step(1);
	spn_count_start->set_min(0);
	hbc_count_options->add_child(spn_count_start);

	Label *lbl_count_step = memnew(Label);
	lbl_count_step->set_text(TTR("Step"));
	lbl_count_step->set_tooltip(TTR("Ammount by which counter is incremented for each node"));
	hbc_count_options->add_child(lbl_count_step);

	spn_count_step = memnew(SpinBox);
	spn_count_step->set_tooltip(TTR("Ammount by which counter is incremented for each node"));
	spn_count_step->set_step(1);
	hbc_count_options->add_child(spn_count_step);

	Label *lbl_count_padding = memnew(Label);
	lbl_count_padding->set_text(TTR("Padding"));
	lbl_count_padding->set_tooltip(TTR("Minium number of digits for the counter.\nMissing digits are padded with leading zeros."));
	hbc_count_options->add_child(lbl_count_padding);

	spn_count_padding = memnew(SpinBox);
	spn_count_padding->set_tooltip(TTR("Minium number of digits for the counter.\nMissing digits are padded with leading zeros."));
	spn_count_padding->set_step(1);
	hbc_count_options->add_child(spn_count_padding);

	// ---- Tab RegEx

	VBoxContainer *vbc_regex = memnew(VBoxContainer);
	vbc_regex->set_h_size_flags(SIZE_EXPAND_FILL);
	vbc_regex->set_name(TTR("Regular Expressions"));
	vbc_regex->set_custom_minimum_size(Size2(0, feature_min_height));
	tabc_features->add_child(vbc_regex);

	cbut_regex = memnew(CheckButton);
	cbut_regex->set_text(TTR("Regular Expressions"));
	vbc_regex->add_child(cbut_regex);

	// ---- Tab Process

	VBoxContainer *vbc_process = memnew(VBoxContainer);
	vbc_process->set_h_size_flags(SIZE_EXPAND_FILL);
	vbc_process->set_name(TTR("Post-Process"));
	vbc_process->set_custom_minimum_size(Size2(0, feature_min_height));
	tabc_features->add_child(vbc_process);

	cbut_process = memnew(CheckButton);
	cbut_process->set_text(TTR("Post-Process"));
	vbc_process->add_child(cbut_process);

	// ------ Style

	HBoxContainer *hbc_style = memnew(HBoxContainer);
	vbc_process->add_child(hbc_style);

	Label *lbl_style = memnew(Label);
	lbl_style->set_text(TTR("Style"));
	hbc_style->add_child(lbl_style);

	opt_style = memnew(OptionButton);
	opt_style->add_item(TTR("Keep"));
	opt_style->add_item(TTR("CamelCase to under_scored"));
	opt_style->add_item(TTR("under_scored to CamelCase"));
	hbc_style->add_child(opt_style);

	// ------ Case

	HBoxContainer *hbc_case = memnew(HBoxContainer);
	vbc_process->add_child(hbc_case);

	Label *lbl_case = memnew(Label);
	lbl_case->set_text(TTR("Case"));
	hbc_case->add_child(lbl_case);

	opt_case = memnew(OptionButton);
	opt_case->add_item(TTR("Keep"));
	opt_case->add_item(TTR("To Lowercase"));
	opt_case->add_item(TTR("To Uppercase"));
	hbc_case->add_child(opt_case);

	// -- Preview

	HSeparator *sep_preview = memnew(HSeparator);
	sep_preview->set_custom_minimum_size(Size2(10, 20));
	vbc->add_child(sep_preview);

	lbl_preview_title = memnew(Label);
	lbl_preview_title->set_text(TTR("Preview"));
	vbc->add_child(lbl_preview_title);

	lbl_preview = memnew(Label);
	lbl_preview->set_text("");
	lbl_preview->add_color_override("font_color", Color(1, 0.5f, 0, 1));
	vbc->add_child(lbl_preview);

	// ---- Dialog related

	set_custom_minimum_size(Size2(383, 0));
	set_as_toplevel(true);
	get_ok()->set_text(TTR("Rename"));
	Button *but_reset = add_button(TTR("Reset"));

	eh.errfunc = _error_handler;
	eh.userdata = this;

	// ---- Connections

	chk_collapse_features->connect("toggled", this, "_features_toggled");

	// Substitite Buttons

	lne_search->connect("focus_entered", this, "_update_substitute");
	lne_search->connect("focus_exited", this, "_update_substitute");
	lne_replace->connect("focus_entered", this, "_update_substitute");
	lne_replace->connect("focus_exited", this, "_update_substitute");
	lne_prefix->connect("focus_entered", this, "_update_substitute");
	lne_prefix->connect("focus_exited", this, "_update_substitute");
	lne_suffix->connect("focus_entered", this, "_update_substitute");
	lne_suffix->connect("focus_exited", this, "_update_substitute");

	// Preview

	lne_prefix->connect("text_changed", this, "_update_preview");
	lne_suffix->connect("text_changed", this, "_update_preview");
	lne_search->connect("text_changed", this, "_update_preview");
	lne_replace->connect("text_changed", this, "_update_preview");
	spn_count_start->connect("value_changed", this, "_update_preview_int");
	spn_count_step->connect("value_changed", this, "_update_preview_int");
	spn_count_padding->connect("value_changed", this, "_update_preview_int");
	opt_style->connect("item_selected", this, "_update_preview_int");
	opt_case->connect("item_selected", this, "_update_preview_int");
	cbut_substitute->connect("pressed", this, "_update_preview", varray(""));
	cbut_regex->connect("pressed", this, "_update_preview", varray(""));
	cbut_process->connect("pressed", this, "_update_preview", varray(""));

	but_reset->connect("pressed", this, "reset");

	reset();
	_features_toggled(false);
}
Пример #11
0
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");


	
	
}
Пример #12
0
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"));
}
Пример #13
0
CallDialog::CallDialog() {

	object=NULL;

	call = memnew( Button );
	call->set_anchor( MARGIN_LEFT, ANCHOR_END );
	call->set_anchor( MARGIN_TOP, ANCHOR_END );
	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_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_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 ) );
	tree->set_margin(MARGIN_BOTTOM, 44 );
	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_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);
}
Пример #14
0
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"));
}