Explorar el Código

Enhance undoredo action name, TTR, cleanup

Poommetee Ketson hace 7 años
padre
commit
24df9f3707

+ 2 - 2
editor/animation_editor.cpp

@@ -324,7 +324,7 @@ public:
 			int existing = animation->track_find_key(track, new_time, true);
 
 			setting = true;
-			undo_redo->create_action(TTR("Move Add Key"), UndoRedo::MERGE_ENDS);
+			undo_redo->create_action(TTR("Anim Change Keyframe Time"), UndoRedo::MERGE_ENDS);
 
 			Variant val = animation->track_get_key_value(track, key);
 			float trans = animation->track_get_key_transition(track, key);
@@ -391,7 +391,7 @@ public:
 					}
 
 					setting = true;
-					undo_redo->create_action(TTR("Anim Change Value"), UndoRedo::MERGE_ENDS);
+					undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS);
 					Variant prev = animation->track_get_key_value(track, key);
 					undo_redo->add_do_method(animation.ptr(), "track_set_key_value", track, key, value);
 					undo_redo->add_undo_method(animation.ptr(), "track_set_key_value", track, key, prev);

+ 1 - 69
editor/connections_dialog.cpp

@@ -88,12 +88,6 @@ 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()));
-	}
-
 	if (p_what == NOTIFICATION_ENTER_TREE) {
 		bind_editor->edit(cdbinds);
 	}
@@ -117,11 +111,6 @@ void ConnectDialog::_tree_node_selected() {
 	dst_path->set_text(node->get_path_to(current));
 }
 
-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;
@@ -247,9 +236,7 @@ void ConnectDialog::set_dst_method(const StringName &p_method) {
 
 void ConnectDialog::_bind_methods() {
 
-	//ClassDB::bind_method("_ok",&ConnectDialog::_ok_pressed);
 	ClassDB::bind_method("_cancel", &ConnectDialog::_cancel_pressed);
-	//ClassDB::bind_method("_dst_method_list_selected",&ConnectDialog::_dst_method_list_selected);
 	ClassDB::bind_method("_tree_node_selected", &ConnectDialog::_tree_node_selected);
 
 	ClassDB::bind_method("_add_bind", &ConnectDialog::_add_bind);
@@ -355,18 +342,6 @@ ConnectDialog::ConnectDialog() {
 	oneshot->set_text(TTR("Oneshot"));
 	dstm_hb->add_child(oneshot);
 
-	/*
-	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("id_pressed", this,"_dst_method_list_selected");
 	tree->connect("node_selected", this, "_tree_node_selected");
 
 	set_as_toplevel(true);
@@ -377,7 +352,6 @@ ConnectDialog::ConnectDialog() {
 	add_child(error);
 	error->get_ok()->set_text(TTR("Close"));
 	get_ok()->set_text(TTR("Connect"));
-	//error->get_cancel()->set_text("Close");
 }
 
 ConnectDialog::~ConnectDialog() {
@@ -386,12 +360,6 @@ ConnectDialog::~ConnectDialog() {
 
 void ConnectionsDock::_notification(int p_what) {
 
-	if (p_what == NOTIFICATION_DRAW) {
-
-		//RID ci = get_canvas_item();
-		//get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
-	}
-
 	if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
 		update_tree();
 	}
@@ -478,7 +446,7 @@ void ConnectionsDock::_connect_pressed() {
 		Connection c = item->get_metadata(0);
 		ERR_FAIL_COND(c.source != node); //shouldn't happen but...bugcheck
 
-		undo_redo->create_action(TTR("Create Subscription"));
+		undo_redo->create_action(vformat(TTR("Disconnect '%s' from '%s'"), c.signal, c.method));
 		undo_redo->add_do_method(node, "disconnect", c.signal, c.target, c.method);
 		undo_redo->add_undo_method(node, "connect", c.signal, c.target, c.method, Vector<Variant>(), c.flags);
 		undo_redo->add_do_method(this, "update_tree");
@@ -491,42 +459,6 @@ void ConnectionsDock::_connect_pressed() {
 		update_tree();
 	}
 }
-/*
-void ConnectionsDock::_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 ConnectionsDock::_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);
-	undo_redo->add_do_method(this,"update_tree");
-	undo_redo->add_undo_method(this,"update_tree");
-	undo_redo->commit_action();
-
-}
-*/
 
 struct _ConnectionsDockMethodInfoSort {
 

+ 0 - 4
editor/connections_dialog.h

@@ -55,7 +55,6 @@ class ConnectDialog : public ConfirmationDialog {
 	LineEdit *dst_path;
 	LineEdit *dst_method;
 	SceneTreeEditor *tree;
-	//MenuButton *dst_method_list;
 	OptionButton *type_list;
 	CheckButton *deferred;
 	CheckButton *oneshot;
@@ -66,7 +65,6 @@ class ConnectDialog : public ConfirmationDialog {
 	void ok_pressed();
 	void _cancel_pressed();
 	void _tree_node_selected();
-	void _dst_method_list_selected(int p_idx);
 	void _add_bind();
 	void _remove_bind();
 
@@ -84,8 +82,6 @@ public:
 	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();

+ 1 - 1
editor/create_dialog.cpp

@@ -370,7 +370,7 @@ void CreateDialog::_notification(int p_what) {
 void CreateDialog::set_base_type(const String &p_base) {
 
 	base_type = p_base;
-	set_title(TTR("Create New") + " " + p_base);
+	set_title(vformat(TTR("Create New %s"), p_base));
 	_update_search();
 }
 

+ 2 - 2
editor/export_template_manager.cpp

@@ -385,7 +385,7 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int
 			template_list_state->set_text(TTR("No response."));
 		} break;
 		case HTTPRequest::RESULT_REQUEST_FAILED: {
-			template_list_state->set_text(TTR("Req. Failed."));
+			template_list_state->set_text(TTR("Request Failed."));
 		} break;
 		case HTTPRequest::RESULT_REDIRECT_LIMIT_REACHED: {
 			template_list_state->set_text(TTR("Redirect Loop."));
@@ -465,7 +465,7 @@ void ExportTemplateManager::_notification(int p_what) {
 				break;
 			case HTTPClient::STATUS_CONNECTING: status = TTR("Connecting.."); break;
 			case HTTPClient::STATUS_CANT_CONNECT:
-				status = TTR("Can't Conect");
+				status = TTR("Can't Connect");
 				errored = true;
 				break;
 			case HTTPClient::STATUS_CONNECTED: status = TTR("Connected"); break;

+ 1 - 1
editor/plugins/asset_library_editor_plugin.cpp

@@ -340,7 +340,7 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
 		} break;
 		case HTTPRequest::RESULT_REQUEST_FAILED: {
 			error_text = TTR("Request failed, return code:") + " " + itos(p_code);
-			status->set_text(TTR("Req. Failed."));
+			status->set_text(TTR("Request Failed."));
 		} break;
 		case HTTPRequest::RESULT_REDIRECT_LIMIT_REACHED: {
 			error_text = TTR("Request failed, too many redirects");

+ 0 - 13
editor/plugins/particles_2d_editor_plugin.cpp

@@ -77,11 +77,6 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
 		case MENU_CLEAR_EMISSION_MASK: {
 
 			emission_mask->popup_centered_minsize();
-
-			/*undo_redo->create_action(TTR("Clear Emission Mask"));
-			undo_redo->add_do_method(particles, "set_emission_points", PoolVector<Vector2>());
-			undo_redo->add_undo_method(particles, "set_emission_points", particles->get_emission_points());
-			undo_redo->commit_action();*/
 		} break;
 	}
 }
@@ -309,14 +304,6 @@ void Particles2DEditorPlugin::_generate_emission_mask() {
 	} else {
 		pm->set_emission_shape(ParticlesMaterial::EMISSION_SHAPE_POINTS);
 	}
-
-	/*undo_redo->create_action(TTR("Set Emission Mask"));
-	undo_redo->add_do_method(particles, "set_emission_points", epoints);
-	undo_redo->add_do_method(particles, "set_emission_half_extents", extents);
-	undo_redo->add_undo_method(particles, "set_emission_points", particles->get_emission_points());
-	undo_redo->add_undo_method(particles, "set_emission_half_extents", particles->get_emission_half_extents());
-	undo_redo->commit_action();
-	*/
 }
 
 void Particles2DEditorPlugin::_notification(int p_what) {

+ 1 - 41
editor/plugins/particles_editor_plugin.cpp

@@ -40,11 +40,6 @@ void ParticlesEditor::_node_removed(Node *p_node) {
 	}
 }
 
-void ParticlesEditor::_resource_seleted(const String &p_res) {
-
-	//print_line("selected resource path: "+p_res);
-}
-
 void ParticlesEditor::_node_selected(const NodePath &p_path) {
 
 	Node *sel = get_node(p_path);
@@ -84,23 +79,6 @@ void ParticlesEditor::_node_selected(const NodePath &p_path) {
 	emission_dialog->popup_centered(Size2(300, 130));
 }
 
-/*
-
-void ParticlesEditor::_populate() {
-
-	if(!node)
-		return;
-
-
-	if (node->get_particles().is_null())
-		return;
-
-	node->get_particles()->set_instance_count(populate_amount->get_text().to_int());
-	node->populate_parent(populate_rotate_random->get_val(),populate_tilt_random->get_val(),populate_scale_random->get_text().to_double(),populate_scale->get_text().to_double());
-
-}
-*/
-
 void ParticlesEditor::_notification(int p_notification) {
 
 	if (p_notification == NOTIFICATION_ENTER_TREE) {
@@ -132,13 +110,7 @@ void ParticlesEditor::_menu_option(int p_option) {
 				EditorNode::get_singleton()->show_warning(TTR("A processor material of type 'ParticlesMaterial' is required."));
 				return;
 			}
-			/*
-			Node *root = get_scene()->get_root_node();
-			ERR_FAIL_COND(!root);
-			EditorNode *en = Object::cast_to<EditorNode>(root);
-			ERR_FAIL_COND(!en);
-			Node * node = en->get_edited_scene();
-*/
+
 			emission_tree_dialog->popup_centered_ratio();
 
 		} break;
@@ -365,20 +337,14 @@ void ParticlesEditor::_generate_emission_points() {
 		material->set_emission_point_count(point_count);
 		material->set_emission_point_texture(tex);
 	}
-
-	//print_line("point count: "+itos(points.size()));
-	//node->set_emission_points(points);
 }
 
 void ParticlesEditor::_bind_methods() {
 
 	ClassDB::bind_method("_menu_option", &ParticlesEditor::_menu_option);
-	ClassDB::bind_method("_resource_seleted", &ParticlesEditor::_resource_seleted);
 	ClassDB::bind_method("_node_selected", &ParticlesEditor::_node_selected);
 	ClassDB::bind_method("_generate_emission_points", &ParticlesEditor::_generate_emission_points);
 	ClassDB::bind_method("_generate_aabb", &ParticlesEditor::_generate_aabb);
-
-	//ClassDB::bind_method("_populate",&ParticlesEditor::_populate);
 }
 
 ParticlesEditor::ParticlesEditor() {
@@ -394,8 +360,6 @@ ParticlesEditor::ParticlesEditor() {
 	options->get_popup()->add_separator();
 	options->get_popup()->add_item(TTR("Create Emission Points From Mesh"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH);
 	options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
-	//	options->get_popup()->add_item(TTR("Clear Emitter"), MENU_OPTION_CLEAR_EMISSION_VOLUME);
-
 	options->get_popup()->connect("id_pressed", this, "_menu_option");
 
 	emission_dialog = memnew(ConfirmationDialog);
@@ -420,7 +384,6 @@ ParticlesEditor::ParticlesEditor() {
 	emission_dialog->connect("confirmed", this, "_generate_emission_points");
 
 	err_dialog = memnew(ConfirmationDialog);
-	//err_dialog->get_cancel()->hide();
 	add_child(err_dialog);
 
 	emission_file_dialog = memnew(EditorFileDialog);
@@ -454,9 +417,6 @@ ParticlesEditor::ParticlesEditor() {
 	add_child(generate_aabb);
 
 	generate_aabb->connect("confirmed", this, "_generate_aabb");
-
-	//options->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
-	//options->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
 }
 
 void ParticlesEditorPlugin::edit(Object *p_object) {

+ 0 - 1
editor/plugins/particles_editor_plugin.h

@@ -73,7 +73,6 @@ class ParticlesEditor : public Control {
 
 	void _generate_aabb();
 	void _generate_emission_points();
-	void _resource_seleted(const String &p_res);
 	void _node_selected(const NodePath &p_path);
 
 	void _menu_option(int);

+ 2 - 2
editor/project_settings_editor.cpp

@@ -531,7 +531,7 @@ void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column,
 			Variant old_val = ProjectSettings::get_singleton()->get(name);
 			int order = ProjectSettings::get_singleton()->get_order(name);
 
-			undo_redo->create_action(TTR("Add Input Action"));
+			undo_redo->create_action(TTR("Erase Input Action"));
 			undo_redo->add_do_method(ProjectSettings::get_singleton(), "clear", name);
 			undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set", name, old_val);
 			undo_redo->add_undo_method(ProjectSettings::get_singleton(), "set_order", name, order);
@@ -852,7 +852,7 @@ void ProjectSettingsEditor::_action_add() {
 
 	Array va;
 	String name = "input/" + action_name->get_text();
-	undo_redo->create_action(TTR("Add Input Action Event"));
+	undo_redo->create_action(TTR("Add Input Action"));
 	undo_redo->add_do_method(ProjectSettings::get_singleton(), "set", name, va);
 	undo_redo->add_undo_method(ProjectSettings::get_singleton(), "clear", name);
 	undo_redo->add_do_method(this, "_update_actions");

+ 4 - 4
editor/property_editor.cpp

@@ -900,10 +900,10 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
 						int id = TYPE_BASE_ID + idx;
 						if (has_icon(t, "EditorIcons")) {
 
-							menu->add_icon_item(get_icon(t, "EditorIcons"), TTR("New") + " " + t, id);
+							menu->add_icon_item(get_icon(t, "EditorIcons"), vformat(TTR("New %s"), t), id);
 						} else {
 
-							menu->add_item(TTR("New") + " " + t, id);
+							menu->add_item(vformat(TTR("New %s"), t), id);
 						}
 
 						idx++;
@@ -2831,7 +2831,7 @@ void PropertyEditor::update_tree() {
 					class_descr_cache[type] = descr.word_wrap(80);
 				}
 
-				sep->set_tooltip(0, TTR("Class:") + " " + p.name + ":\n\n" + class_descr_cache[type]);
+				sep->set_tooltip(0, TTR("Class:") + " " + p.name + (class_descr_cache[type] == "" ? "" : "\n\n" + class_descr_cache[type]));
 			}
 			continue;
 
@@ -2963,7 +2963,7 @@ void PropertyEditor::update_tree() {
 				descr_cache[classname][propname] = descr;
 			}
 
-			item->set_tooltip(0, TTR("Property:") + " " + p.name + "\n\n" + descr);
+			item->set_tooltip(0, TTR("Property:") + " " + p.name + (descr == "" ? "" : "\n\n" + descr));
 		}
 
 		Dictionary d;

+ 4 - 23
scene/2d/animated_sprite.cpp

@@ -355,38 +355,21 @@ void AnimatedSprite::_notification(int p_what) {
 
 		case NOTIFICATION_DRAW: {
 
-			if (frames.is_null()) {
-				print_line("no draw no faemos");
+			if (frames.is_null())
 				return;
-			}
-
-			if (frame < 0) {
-				print_line("no draw frame <0");
+			if (frame < 0)
 				return;
-			}
-
-			if (!frames->has_animation(animation)) {
-				print_line("no draw no anim: " + String(animation));
+			if (!frames->has_animation(animation))
 				return;
-			}
 
 			Ref<Texture> texture = frames->get_frame(animation, frame);
-			if (texture.is_null()) {
-				print_line("no draw texture is null");
+			if (texture.is_null())
 				return;
-			}
 
 			Ref<Texture> normal = frames->get_normal_frame(animation, frame);
 
-			//print_line("DECIDED TO DRAW");
-
 			RID ci = get_canvas_item();
 
-			/*
-			texture->draw(ci,Point2());
-			break;
-			*/
-
 			Size2i s;
 			s = texture->get_size();
 			Point2 ofs = offset;
@@ -403,9 +386,7 @@ void AnimatedSprite::_notification(int p_what) {
 			if (vflip)
 				dst_rect.size.y = -dst_rect.size.y;
 
-			//texture->draw_rect(ci,dst_rect,false,modulate);
 			texture->draw_rect_region(ci, dst_rect, Rect2(Vector2(), texture->get_size()), Color(1, 1, 1), false, normal);
-			//VisualServer::get_singleton()->canvas_item_add_texture_rect_region(ci,dst_rect,texture->get_rid(),src_rect,modulate);
 
 		} break;
 	}