Forráskód Böngészése

Small fixes in some editor dialogs

Franklin Sobrinho 10 éve
szülő
commit
abde648e68

+ 1 - 0
tools/editor/plugins/animation_player_editor_plugin.cpp

@@ -1279,6 +1279,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
 	add_child(file);
 
 	name_dialog = memnew( ConfirmationDialog );
+	name_dialog->set_title("Create New Animation");
 	name_dialog->set_hide_on_ok(false);
 	add_child(name_dialog);
 	name = memnew( LineEdit );

+ 36 - 24
tools/editor/plugins/canvas_item_editor_plugin.cpp

@@ -41,9 +41,9 @@
 class SnapDialog : public ConfirmationDialog {
 
 	OBJ_TYPE(SnapDialog,ConfirmationDialog);
-	
-protected:
-	friend class CanvasItemEditor;
+
+friend class CanvasItemEditor;
+
 	SpinBox *grid_offset_x;
 	SpinBox *grid_offset_y;
 	SpinBox *grid_step_x;
@@ -58,63 +58,75 @@ public:
 		Label *label;
 		VBoxContainer *container;
 		GridContainer *child_container;
-		
+
 		set_title("Configure Snap");
 		get_ok()->set_text("Close");
-		container = memnew(VBoxContainer);
+
+		container = memnew( VBoxContainer );
 		add_child(container);
-		
-		child_container = memnew(GridContainer);
+		set_child_rect(container);
+
+		child_container = memnew( GridContainer );
 		child_container->set_columns(3);
 		container->add_child(child_container);
-		
-		label = memnew(Label);
+
+		label = memnew( Label );
 		label->set_text("Grid Offset:");
 		child_container->add_child(label);
-		grid_offset_x=memnew(SpinBox);
+		label->set_h_size_flags(SIZE_EXPAND_FILL);
+
+		grid_offset_x = memnew( SpinBox );
 		grid_offset_x->set_min(-SPIN_BOX_GRID_RANGE);
 		grid_offset_x->set_max(SPIN_BOX_GRID_RANGE);
 		grid_offset_x->set_suffix("px");
 		child_container->add_child(grid_offset_x);
-		grid_offset_y=memnew(SpinBox);
+
+		grid_offset_y = memnew( SpinBox );
 		grid_offset_y->set_min(-SPIN_BOX_GRID_RANGE);
 		grid_offset_y->set_max(SPIN_BOX_GRID_RANGE);
 		grid_offset_y->set_suffix("px");
 		child_container->add_child(grid_offset_y);
 
-		label = memnew(Label);
+		label = memnew( Label );
 		label->set_text("Grid Step:");
 		child_container->add_child(label);
-		grid_step_x=memnew(SpinBox);
+		label->set_h_size_flags(SIZE_EXPAND_FILL);
+
+		grid_step_x = memnew( SpinBox );
 		grid_step_x->set_min(-SPIN_BOX_GRID_RANGE);
 		grid_step_x->set_max(SPIN_BOX_GRID_RANGE);
 		grid_step_x->set_suffix("px");
 		child_container->add_child(grid_step_x);
-		grid_step_y=memnew(SpinBox);
+
+		grid_step_y = memnew( SpinBox );
 		grid_step_y->set_min(-SPIN_BOX_GRID_RANGE);
 		grid_step_y->set_max(SPIN_BOX_GRID_RANGE);
 		grid_step_y->set_suffix("px");
 		child_container->add_child(grid_step_y);
-		
-		container->add_child(memnew(HSeparator));
 
-		child_container = memnew(GridContainer);
+		container->add_child( memnew( HSeparator ) );
+
+		child_container = memnew( GridContainer );
 		child_container->set_columns(2);
 		container->add_child(child_container);
 
-		label = memnew(Label);
+		label = memnew( Label );
 		label->set_text("Rotation Offset:");
 		child_container->add_child(label);
-		rotation_offset=memnew(SpinBox);
+		label->set_h_size_flags(SIZE_EXPAND_FILL);
+
+		rotation_offset = memnew( SpinBox );
 		rotation_offset->set_min(-SPIN_BOX_ROTATION_RANGE);
 		rotation_offset->set_max(SPIN_BOX_ROTATION_RANGE);
 		rotation_offset->set_suffix("deg");
 		child_container->add_child(rotation_offset);
-		
-		label = memnew(Label);
+
+		label = memnew( Label );
 		label->set_text("Rotation Step:");
 		child_container->add_child(label);
-		rotation_step=memnew(SpinBox);
+		label->set_h_size_flags(SIZE_EXPAND_FILL);
+
+		rotation_step = memnew( SpinBox );
 		rotation_step->set_min(-SPIN_BOX_ROTATION_RANGE);
 		rotation_step->set_max(SPIN_BOX_ROTATION_RANGE);
 		rotation_step->set_suffix("deg");
@@ -2278,7 +2290,7 @@ void CanvasItemEditor::_popup_callback(int p_op) {
 		} break;
 		case SNAP_CONFIGURE: {
 			((SnapDialog *)snap_dialog)->set_fields(snap_offset, snap_step, snap_rotation_offset, snap_rotation_step);
-			snap_dialog->popup_centered(Size2(200,160));
+			snap_dialog->popup_centered(Size2(220,160));
 		} break;
 		case ZOOM_IN: {
 			zoom=zoom*(1.0/0.5);
@@ -3173,7 +3185,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	p->add_item("Paste Pose",ANIM_PASTE_POSE);
 	p->add_item("Clear Pose",ANIM_CLEAR_POSE,KEY_MASK_SHIFT|KEY_K);
 
-	snap_dialog = memnew(SnapDialog);
+	snap_dialog = memnew( SnapDialog );
 	snap_dialog->connect("confirmed",this,"_snap_changed");
 	add_child(snap_dialog);
 

+ 9 - 4
tools/editor/plugins/mesh_editor_plugin.cpp

@@ -160,7 +160,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
 		} break;
 		case MENU_OPTION_CREATE_OUTLINE_MESH: {
 
-			outline_dialog->popup_centered_minsize();
+			outline_dialog->popup_centered(Vector2(200, 90));
 		} break;
 	}
 
@@ -231,14 +231,19 @@ MeshInstanceEditor::MeshInstanceEditor() {
 	options->get_popup()->connect("item_pressed", this,"_menu_option");
 
 	outline_dialog = memnew( ConfirmationDialog );
-	outline_dialog->set_title("Outline Size: ");
+	outline_dialog->set_title("Create Outline Mesh");
+
+	VBoxContainer *outline_dialog_vbc = memnew( VBoxContainer );
+	outline_dialog->add_child(outline_dialog_vbc);
+	outline_dialog->set_child_rect(outline_dialog_vbc);
+
 	outline_size = memnew( SpinBox );
 	outline_size->set_min(0.001);
 	outline_size->set_max(1024);
 	outline_size->set_step(0.001);
 	outline_size->set_val(0.05);
-	outline_dialog->add_child(outline_size);
-	outline_dialog->set_child_rect(outline_size);
+	outline_dialog_vbc->add_margin_child("Outline Size:",outline_size);
+
 	add_child(outline_dialog);
 	outline_dialog->connect("confirmed",this,"_create_outline_mesh");
 

+ 5 - 15
tools/editor/plugins/multimesh_editor_plugin.cpp

@@ -289,7 +289,7 @@ void MultiMeshEditor::_menu_option(int p_option) {
 
 				_last_pp_node=node;
 			}
-			populate_dialog->popup_centered(Size2(250,395));
+			populate_dialog->popup_centered(Size2(250,380));
 
 		} break;
 	}
@@ -325,10 +325,8 @@ MultiMeshEditor::MultiMeshEditor() {
 
 
 	options = memnew( MenuButton );
-	//add_child(options);
 	SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
-	options->set_area_as_parent_rect();
-
+	
 	options->set_text("MultiMesh");
 	options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MultiMeshInstance","EditorIcons"));
 
@@ -373,12 +371,12 @@ MultiMeshEditor::MultiMeshEditor() {
 	populate_axis->select(2);
 	vbc->add_margin_child("Mesh Up Axis:",populate_axis);
 
-	populate_rotate_random = memnew( HScrollBar );
+	populate_rotate_random = memnew( HSlider );
 	populate_rotate_random->set_max(1);
 	populate_rotate_random->set_step(0.01);
 	vbc->add_margin_child("Random Rotation:",populate_rotate_random);
 
-	populate_tilt_random = memnew( HScrollBar );
+	populate_tilt_random = memnew( HSlider );
 	populate_tilt_random->set_max(1);
 	populate_tilt_random->set_step(0.01);
 	vbc->add_margin_child("Random Tilt:",populate_tilt_random);
@@ -416,8 +414,7 @@ MultiMeshEditor::MultiMeshEditor() {
 	std->connect("selected",this,"_browsed");
 
 	_last_pp_node=NULL;
-	//options->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
-	//options->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
+
 	err_dialog = memnew( AcceptDialog );
 	add_child(err_dialog);
 }
@@ -451,13 +448,6 @@ MultiMeshEditorPlugin::MultiMeshEditorPlugin(EditorNode *p_node) {
 	multimesh_editor = memnew( MultiMeshEditor );
 	editor->get_viewport()->add_child(multimesh_editor);
 
-//	multimesh_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
-//	multimesh_editor->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
-	multimesh_editor->set_margin(MARGIN_LEFT,253);
-	multimesh_editor->set_margin(MARGIN_RIGHT,310);
-	multimesh_editor->set_margin(MARGIN_TOP,0);
-	multimesh_editor->set_margin(MARGIN_BOTTOM,10);
-
 	multimesh_editor->options->hide();
 }
 

+ 4 - 4
tools/editor/plugins/multimesh_editor_plugin.h

@@ -42,10 +42,10 @@ class MultiMeshEditor : public Control {
 
 	OBJ_TYPE(MultiMeshEditor, Control );
 
-        friend class MultiMeshEditorPlugin;
+friend class MultiMeshEditorPlugin;
 
 	AcceptDialog *err_dialog;
-        MenuButton * options;
+	MenuButton * options;
 	MultiMeshInstance *_last_pp_node;
 	bool browsing_source;
 
@@ -59,8 +59,8 @@ class MultiMeshEditor : public Control {
 
 	ConfirmationDialog *populate_dialog;
 	OptionButton *populate_axis;
-	HScrollBar *populate_rotate_random;
-	HScrollBar *populate_tilt_random;
+	HSlider *populate_rotate_random;
+	HSlider *populate_tilt_random;
 	SpinBox *populate_scale_random;
 	SpinBox *populate_scale;
 	SpinBox *populate_amount;

+ 10 - 32
tools/editor/plugins/spatial_editor_plugin.cpp

@@ -2725,7 +2725,7 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
 		} break;
 		case MENU_TRANSFORM_CONFIGURE_SNAP: {
 
-			snap_dialog->popup_centered(Size2(200,160));
+			snap_dialog->popup_centered(Size2(200,180));
 		} break;
 		case MENU_TRANSFORM_LOCAL_COORDS: {
 
@@ -3793,46 +3793,24 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
 	snap_dialog = memnew( ConfirmationDialog );
 	snap_dialog->set_title("Snap Settings");
 	add_child(snap_dialog);
-	Label *l = memnew(Label);
-	l->set_text("Translate Snap:");
-	l->set_pos(Point2(5,5));
-	snap_dialog->add_child(l);
+
+	VBoxContainer *snap_dialog_vbc = memnew( VBoxContainer );
+	snap_dialog->add_child(snap_dialog_vbc);
+	snap_dialog->set_child_rect(snap_dialog_vbc);
 
 	snap_translate = memnew( LineEdit );
-	snap_translate->set_anchor( MARGIN_RIGHT, ANCHOR_END );
-	snap_translate->set_begin( Point2(15,22) );
-	snap_translate->set_end( Point2(15,35) );
 	snap_translate->set_text("1");
-	snap_dialog->add_child(snap_translate);
-
-	l = memnew(Label);
-	l->set_text("Rotate Snap (deg.):");
-	l->set_pos(Point2(5,45));
-	snap_dialog->add_child(l);
+	snap_dialog_vbc->add_margin_child("Translate Snap:",snap_translate);
 
 	snap_rotate = memnew( LineEdit );
-	snap_rotate->set_anchor( MARGIN_RIGHT, ANCHOR_END );
-	snap_rotate->set_begin( Point2(15,62) );
-	snap_rotate->set_end( Point2(15,75) );
 	snap_rotate->set_text("5");
-	snap_dialog->add_child(snap_rotate);
-
-
-	l = memnew(Label);
-	l->set_text("Scale Snap (%):");
-	l->set_pos(Point2(5,85));
-	snap_dialog->add_child(l);
+	snap_dialog_vbc->add_margin_child("Rotate Snap (deg.):",snap_rotate);
 
 	snap_scale = memnew( LineEdit );
-	snap_scale->set_anchor( MARGIN_RIGHT, ANCHOR_END );
-	snap_scale->set_begin( Point2(15,102) );
-	snap_scale->set_end( Point2(15,115) );
 	snap_scale->set_text("5");
-	snap_dialog->add_child(snap_scale);
+	snap_dialog_vbc->add_margin_child("Scale Snap (%):",snap_scale);
 
-	//snap_dialog->get_cancel()->hide();
-
-	/* SNAP DIALOG */
+	/* SETTINGS DIALOG */
 
 	settings_dialog = memnew( ConfirmationDialog );
 	settings_dialog->set_title("Viewport Settings");
@@ -3906,7 +3884,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
 	xform_dialog = memnew( ConfirmationDialog );
 	xform_dialog->set_title("Transform Change");
 	add_child(xform_dialog);
-	l = memnew(Label);
+	Label *l = memnew(Label);
 	l->set_text("Translate:");
 	l->set_pos(Point2(5,5));
 	xform_dialog->add_child(l);