Explorar el Código

Several improvements to editor inspector usability and style

Juan Linietsky hace 7 años
padre
commit
43dc050947

+ 5 - 1
core/object.cpp

@@ -601,8 +601,12 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons
 
 	_get_property_listv(p_list, p_reversed);
 
-	if (!is_class("Script")) // can still be set, but this is for userfriendlyness
+	if (!is_class("Script")) { // can still be set, but this is for userfriendlyness
+#ifdef TOOLS_ENABLED
+		p_list->push_back(PropertyInfo(Variant::NIL, "Script", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_GROUP));
+#endif
 		p_list->push_back(PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_STORE_IF_NONZERO));
+	}
 #ifdef TOOLS_ENABLED
 	if (editor_section_folding.size()) {
 		p_list->push_back(PropertyInfo(Variant::ARRAY, CoreStringNames::get_singleton()->_sections_unfolded, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL));

+ 117 - 16
editor/editor_inspector.cpp

@@ -91,6 +91,9 @@ void EditorProperty::_notification(int p_what) {
 		Rect2 rect;
 		Rect2 bottom_rect;
 
+		right_child_rect = Rect2();
+		bottom_child_rect = Rect2();
+
 		{
 			int child_room = size.width * (1.0 - split_ratio);
 			Ref<Font> font = get_font("font", "Tree");
@@ -118,7 +121,8 @@ void EditorProperty::_notification(int p_what) {
 
 			if (bottom_editor) {
 
-				int m = get_constant("item_margin", "Tree");
+				int m = 0; //get_constant("item_margin", "Tree");
+
 				bottom_rect = Rect2(m, rect.size.height + get_constant("vseparation", "Tree"), size.width - m, bottom_editor->get_combined_minimum_size().height);
 			}
 		}
@@ -147,10 +151,12 @@ void EditorProperty::_notification(int p_what) {
 				continue;
 
 			fit_child_in_rect(c, rect);
+			right_child_rect = rect;
 		}
 
 		if (bottom_editor) {
 			fit_child_in_rect(bottom_editor, bottom_rect);
+			bottom_child_rect = bottom_rect;
 		}
 
 		update(); //need to redraw text
@@ -158,6 +164,7 @@ void EditorProperty::_notification(int p_what) {
 
 	if (p_what == NOTIFICATION_DRAW) {
 		Ref<Font> font = get_font("font", "Tree");
+		Color dark_color = get_color("dark_color_2", "Editor");
 
 		Size2 size = get_size();
 		if (bottom_editor) {
@@ -171,6 +178,13 @@ void EditorProperty::_notification(int p_what) {
 			draw_style_box(sb, Rect2(Vector2(), size));
 		}
 
+		if (right_child_rect != Rect2()) {
+			draw_rect(right_child_rect, dark_color);
+		}
+		if (bottom_child_rect != Rect2()) {
+			draw_rect(bottom_child_rect, dark_color);
+		}
+
 		Color color;
 		if (draw_red) {
 			color = get_color("error_color", "Editor");
@@ -251,7 +265,7 @@ void EditorProperty::_notification(int p_what) {
 		//int vs = get_constant("vseparation", "Tree");
 		Color guide_color = get_color("guide_color", "Tree");
 		int vs_height = get_size().height; // vs / 2;
-		draw_line(Point2(0, vs_height), Point2(get_size().width, vs_height), guide_color);
+		//	draw_line(Point2(0, vs_height), Point2(get_size().width, vs_height), guide_color);
 	}
 }
 
@@ -926,6 +940,14 @@ EditorInspectorCategory::EditorInspectorCategory() {
 ////////////////////////////////////////////////
 ////////////////////////////////////////////////
 
+void EditorInspectorSection::_test_unfold() {
+
+	if (!vbox_added) {
+		add_child(vbox);
+		vbox_added = true;
+	}
+}
+
 void EditorInspectorSection::_notification(int p_what) {
 
 	if (p_what == NOTIFICATION_SORT_CHILDREN) {
@@ -936,9 +958,9 @@ void EditorInspectorSection::_notification(int p_what) {
 #ifdef TOOLS_ENABLED
 		if (foldable) {
 			if (object->editor_is_section_unfolded(section)) {
-				arrow = get_icon("arrow", "Tree");
+				arrow = get_icon("arrow_up", "Tree");
 			} else {
-				arrow = get_icon("arrow_collapsed", "Tree");
+				arrow = get_icon("arrow", "Tree");
 			}
 		}
 #endif
@@ -951,7 +973,7 @@ void EditorInspectorSection::_notification(int p_what) {
 		}
 
 		offset.y += get_constant("vseparation", "Tree");
-		offset.x += get_constant("item_margin", "Tree");
+		offset.x += get_constant("inspector_margin", "Editor");
 
 		Rect2 rect(offset, size - offset);
 
@@ -979,9 +1001,9 @@ void EditorInspectorSection::_notification(int p_what) {
 #ifdef TOOLS_ENABLED
 		if (foldable) {
 			if (object->editor_is_section_unfolded(section)) {
-				arrow = get_icon("arrow", "Tree");
+				arrow = get_icon("arrow_up", "Tree");
 			} else {
-				arrow = get_icon("arrow_collapsed", "Tree");
+				arrow = get_icon("arrow", "Tree");
 			}
 		}
 #endif
@@ -998,14 +1020,14 @@ void EditorInspectorSection::_notification(int p_what) {
 
 		int hs = get_constant("hseparation", "Tree");
 
+		Color color = get_color("font_color", "Tree");
+		draw_string(font, Point2(hs, font->get_ascent() + (h - font->get_height()) / 2).floor(), label, color, get_size().width);
+
 		int ofs = 0;
 		if (arrow.is_valid()) {
-			draw_texture(arrow, Point2(ofs, (h - arrow->get_height()) / 2).floor());
+			draw_texture(arrow, Point2(get_size().width - arrow->get_width(), (h - arrow->get_height()) / 2).floor());
 			ofs += hs + arrow->get_width();
 		}
-
-		Color color = get_color("font_color", "Tree");
-		draw_string(font, Point2(ofs, font->get_ascent() + (h - font->get_height()) / 2).floor(), label, color, get_size().width);
 	}
 }
 
@@ -1027,8 +1049,8 @@ Size2 EditorInspectorSection::get_minimum_size() const {
 	}
 
 	Ref<Font> font = get_font("font", "Tree");
-	ms.height += font->get_ascent() + get_constant("vseparation", "Tree");
-	ms.width += get_constant("item_margin", "Tree");
+	ms.height += font->get_height() + get_constant("vseparation", "Tree");
+	ms.width += get_constant("inspector_margin", "Editor");
 
 	return ms;
 }
@@ -1041,8 +1063,14 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe
 	bg_color = p_bg_color;
 	foldable = p_foldable;
 
+	if (!foldable && !vbox_added) {
+		add_child(vbox);
+		vbox_added = true;
+	}
+
 #ifdef TOOLS_ENABLED
 	if (foldable) {
+		_test_unfold();
 		if (object->editor_is_section_unfolded(section)) {
 			vbox->show();
 		} else {
@@ -1061,6 +1089,9 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
 
 	Ref<InputEventMouseButton> mb = p_event;
 	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+
+		_test_unfold();
+
 		bool unfold = !object->editor_is_section_unfolded(section);
 		object->editor_set_section_unfold(section, unfold);
 		if (unfold) {
@@ -1080,6 +1111,9 @@ void EditorInspectorSection::unfold() {
 
 	if (!foldable)
 		return;
+
+	_test_unfold();
+
 #ifdef TOOLS_ENABLED
 
 	object->editor_set_section_unfold(section, true);
@@ -1092,6 +1126,8 @@ void EditorInspectorSection::fold() {
 	if (!foldable)
 		return;
 
+	if (!vbox_added)
+		return; //kinda pointless
 #ifdef TOOLS_ENABLED
 
 	object->editor_set_section_unfold(section, false);
@@ -1113,7 +1149,14 @@ EditorInspectorSection::EditorInspectorSection() {
 	object = NULL;
 	foldable = false;
 	vbox = memnew(VBoxContainer);
-	add_child(vbox);
+	vbox_added = false;
+	//add_child(vbox);
+}
+
+EditorInspectorSection::~EditorInspectorSection() {
+	if (!vbox_added) {
+		memdelete(vbox);
+	}
 }
 
 ////////////////////////////////////////////////
@@ -1274,8 +1317,10 @@ void EditorInspector::update_tree() {
 	String filter = search_box ? search_box->get_text() : "";
 	String group;
 	String group_base;
+	VBoxContainer *category_vbox = NULL;
 
-	List<PropertyInfo> plist;
+	List<PropertyInfo>
+			plist;
 	object->get_property_list(&plist, true);
 
 	HashMap<String, VBoxContainer *> item_path;
@@ -1327,6 +1372,7 @@ void EditorInspector::update_tree() {
 
 			EditorInspectorCategory *category = memnew(EditorInspectorCategory);
 			main_vbox->add_child(category);
+			category_vbox = NULL; //reset
 
 			String type = p.name;
 			if (has_icon(type, "EditorIcons"))
@@ -1412,6 +1458,11 @@ void EditorInspector::update_tree() {
 				continue;
 		}
 
+		if (category_vbox == NULL) {
+			category_vbox = memnew(VBoxContainer);
+			main_vbox->add_child(category_vbox);
+		}
+
 		VBoxContainer *current_vbox = main_vbox;
 
 		{
@@ -1439,6 +1490,14 @@ void EditorInspector::update_tree() {
 				current_vbox = item_path[acc_path];
 				level = (MIN(level + 1, 4));
 			}
+
+			if (current_vbox == main_vbox) {
+				//do not add directly to the main vbox, given it has no spacing
+				if (category_vbox == NULL) {
+					category_vbox = memnew(VBoxContainer);
+				}
+				current_vbox = category_vbox;
+			}
 		}
 
 		bool checkable = false;
@@ -1625,6 +1684,10 @@ void EditorInspector::edit(Object *p_object) {
 	object = p_object;
 
 	if (object) {
+		update_scroll_request = 0; //reset
+		if (scroll_cache.has(object->get_instance_id())) { //if exists, set something else
+			update_scroll_request = scroll_cache[object->get_instance_id()]; //done this way because wait until full size is accomodated
+		}
 		object->add_change_receptor(this);
 		update_tree();
 	}
@@ -1730,6 +1793,19 @@ int EditorInspector::get_scroll_offset() const {
 	return get_v_scroll();
 }
 
+void EditorInspector::set_use_sub_inspector_bg(bool p_enable) {
+
+	use_sub_inspector_bg = p_enable;
+	if (!is_inside_tree())
+		return;
+
+	if (use_sub_inspector_bg) {
+		add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
+	} else {
+		add_style_override("bg", get_stylebox("bg", "Tree"));
+	}
+}
+
 void EditorInspector::_edit_request_change(Object *p_object, const String &p_property) {
 
 	if (object != p_object) //may be undoing/redoing for a non edited object, so ignore
@@ -1940,7 +2016,11 @@ void EditorInspector::_notification(int p_what) {
 	if (p_what == NOTIFICATION_ENTER_TREE) {
 
 		get_tree()->connect("node_removed", this, "_node_removed");
-		add_style_override("bg", get_stylebox("bg", "Tree"));
+		if (use_sub_inspector_bg) {
+			add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
+		} else if (is_inside_tree()) {
+			add_style_override("bg", get_stylebox("bg", "Tree"));
+		}
 	}
 	if (p_what == NOTIFICATION_EXIT_TREE) {
 
@@ -1950,6 +2030,10 @@ void EditorInspector::_notification(int p_what) {
 
 	if (p_what == NOTIFICATION_PROCESS) {
 
+		if (update_scroll_request >= 0) {
+			get_v_scrollbar()->call_deferred("set_value", update_scroll_request);
+			update_scroll_request = -1;
+		}
 		if (refresh_countdown > 0) {
 			refresh_countdown -= get_process_delta_time();
 			if (refresh_countdown <= 0) {
@@ -1997,6 +2081,16 @@ void EditorInspector::_changed_callback(Object *p_changed, const char *p_prop) {
 	_edit_request_change(p_changed, p_prop);
 }
 
+void EditorInspector::_vscroll_changed(double p_offset) {
+
+	if (update_scroll_request >= 0) //waiting, do nothing
+		return;
+
+	if (object) {
+		scroll_cache[object->get_instance_id()] = p_offset;
+	}
+}
+
 void EditorInspector::_bind_methods() {
 
 	ClassDB::bind_method("_property_changed", &EditorInspector::_property_changed, DEFVAL(false));
@@ -2012,6 +2106,8 @@ void EditorInspector::_bind_methods() {
 	ClassDB::bind_method("_property_selected", &EditorInspector::_property_selected);
 	ClassDB::bind_method("_resource_selected", &EditorInspector::_resource_selected);
 	ClassDB::bind_method("_object_id_selected", &EditorInspector::_object_id_selected);
+	ClassDB::bind_method("_vscroll_changed", &EditorInspector::_vscroll_changed);
+
 	ClassDB::bind_method("refresh", &EditorInspector::refresh);
 
 	ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING, "property")));
@@ -2024,6 +2120,7 @@ EditorInspector::EditorInspector() {
 	undo_redo = NULL;
 	main_vbox = memnew(VBoxContainer);
 	main_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
+	main_vbox->add_constant_override("separation", 0);
 	add_child(main_vbox);
 	set_enable_h_scroll(false);
 	set_enable_v_scroll(true);
@@ -2045,4 +2142,8 @@ EditorInspector::EditorInspector() {
 	_prop_edited = "property_edited";
 	set_process(true);
 	property_focusable = -1;
+	use_sub_inspector_bg = false;
+
+	get_v_scrollbar()->connect("value_changed", this, "_vscroll_changed");
+	update_scroll_request = -1;
 }

+ 15 - 0
editor/editor_inspector.h

@@ -55,6 +55,9 @@ private:
 	bool draw_red;
 	bool keying;
 
+	Rect2 right_child_rect;
+	Rect2 bottom_child_rect;
+
 	Rect2 keying_rect;
 	bool keying_hover;
 	Rect2 revert_rect;
@@ -194,9 +197,12 @@ class EditorInspectorSection : public Container {
 	String section;
 	Object *object;
 	VBoxContainer *vbox;
+	bool vbox_added; //optimization
 	Color bg_color;
 	bool foldable;
 
+	void _test_unfold();
+
 protected:
 	void _notification(int p_what);
 	static void _bind_methods();
@@ -213,6 +219,7 @@ public:
 	Object *get_edited_object();
 
 	EditorInspectorSection();
+	~EditorInspectorSection();
 };
 
 class EditorInspector : public ScrollContainer {
@@ -249,16 +256,20 @@ class EditorInspector : public ScrollContainer {
 	bool update_all_pending;
 	bool read_only;
 	bool keying;
+	bool use_sub_inspector_bg;
 
 	float refresh_countdown;
 	bool update_tree_pending;
 	StringName _prop_edited;
 	StringName property_selected;
 	int property_focusable;
+	int update_scroll_request;
 
 	Map<StringName, Map<StringName, String> > descr_cache;
 	Map<StringName, String> class_descr_cache;
 
+	Map<ObjectID, int> scroll_cache;
+
 	void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field);
 
 	void _property_changed(const String &p_path, const Variant &p_value, bool changing = false);
@@ -281,6 +292,8 @@ class EditorInspector : public ScrollContainer {
 	void _filter_changed(const String &p_text);
 	void _parse_added_editors(VBoxContainer *current_vbox, Ref<EditorInspectorPlugin> ped);
 
+	void _vscroll_changed(double);
+
 protected:
 	static void _bind_methods();
 	void _notification(int p_what);
@@ -330,6 +343,8 @@ public:
 	void set_scroll_offset(int p_offset);
 	int get_scroll_offset() const;
 
+	void set_use_sub_inspector_bg(bool p_enable);
+
 	EditorInspector();
 };
 

+ 1 - 1
editor/editor_node.cpp

@@ -4670,7 +4670,7 @@ EditorNode::EditorNode() {
 	EDITOR_DEF("interface/inspector/capitalize_properties", true);
 	EDITOR_DEF("interface/inspector/disable_folding", false);
 	EDITOR_DEF("interface/inspector/open_resources_in_current_inspector", true);
-	EDITOR_DEF("interface/inspector/resources_types_to_open_in_new_inspector", "Material,Mesh");
+	EDITOR_DEF("interface/inspector/resources_types_to_open_in_new_inspector", "SpatialMaterial");
 	EDITOR_DEF("run/auto_save/save_before_running", true);
 
 	theme_base = memnew(Control);

+ 59 - 65
editor/editor_properties.cpp

@@ -178,6 +178,8 @@ void EditorPropertyTextEnum::_bind_methods() {
 EditorPropertyTextEnum::EditorPropertyTextEnum() {
 	options = memnew(OptionButton);
 	options->set_clip_text(true);
+	options->set_flat(true);
+
 	add_child(options);
 	add_focusable(options);
 	options->connect("item_selected", this, "_option_selected");
@@ -417,6 +419,7 @@ void EditorPropertyEnum::_bind_methods() {
 EditorPropertyEnum::EditorPropertyEnum() {
 	options = memnew(OptionButton);
 	options->set_clip_text(true);
+	options->set_flat(true);
 	add_child(options);
 	add_focusable(options);
 	options->connect("item_selected", this, "_option_selected");
@@ -711,6 +714,7 @@ void EditorPropertyInteger::setup(int p_min, int p_max, bool p_allow_greater, bo
 
 EditorPropertyInteger::EditorPropertyInteger() {
 	spin = memnew(EditorSpinSlider);
+	spin->set_flat(true);
 	add_child(spin);
 	add_focusable(spin);
 	spin->connect("value_changed", this, "_value_changed");
@@ -797,6 +801,7 @@ void EditorPropertyFloat::setup(double p_min, double p_max, double p_step, bool
 
 EditorPropertyFloat::EditorPropertyFloat() {
 	spin = memnew(EditorSpinSlider);
+	spin->set_flat(true);
 	add_child(spin);
 	add_focusable(spin);
 	spin->connect("value_changed", this, "_value_changed");
@@ -807,6 +812,12 @@ EditorPropertyFloat::EditorPropertyFloat() {
 
 void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
 
+	Ref<InputEventMouseButton> mb = p_ev;
+	if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
+		preset->set_global_position(easing_draw->get_global_transform().xform(mb->get_position()));
+		preset->popup();
+	}
+
 	Ref<InputEventMouseMotion> mm = p_ev;
 
 	if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
@@ -844,7 +855,7 @@ void EditorPropertyEasing::_draw_easing() {
 	Size2 s = easing_draw->get_size();
 	Rect2 r(Point2(), s);
 	r = r.grow(3);
-	get_stylebox("normal", "LineEdit")->draw(ci, r);
+	//get_stylebox("normal", "LineEdit")->draw(ci, r);
 
 	int points = 48;
 
@@ -854,6 +865,7 @@ void EditorPropertyEasing::_draw_easing() {
 	Ref<Font> f = get_font("font", "Label");
 	Color color = get_color("font_color", "Label");
 
+	Vector<Point2> lines;
 	for (int i = 1; i <= points; i++) {
 
 		float ifl = i / float(points);
@@ -866,10 +878,12 @@ void EditorPropertyEasing::_draw_easing() {
 			iflp = 1.0 - iflp;
 		}
 
-		VisualServer::get_singleton()->canvas_item_add_line(ci, Point2(iflp * s.width, prev * s.height), Point2(ifl * s.width, h * s.height), color);
+		lines.push_back(Point2(ifl * s.width, h * s.height));
+		lines.push_back(Point2(iflp * s.width, prev * s.height));
 		prev = h;
 	}
 
+	easing_draw->draw_multiline(lines, color, 1.0, true);
 	f->draw(ci, Point2(10, 10 + f->get_ascent()), String::num(exp, 2), color);
 }
 
@@ -877,29 +891,17 @@ void EditorPropertyEasing::update_property() {
 	easing_draw->update();
 }
 
-void EditorPropertyEasing::_set_preset(float p_val) {
-	emit_signal("property_changed", get_edited_property(), p_val);
+void EditorPropertyEasing::_set_preset(int p_preset) {
+	static const float preset_value[EASING_MAX] = { 0.0, 1.0, 2.0, 0.5, -2.0, -0.5 };
+
+	emit_signal("property_changed", get_edited_property(), preset_value[p_preset]);
 	easing_draw->update();
 }
 
 void EditorPropertyEasing::setup(bool p_full, bool p_flip) {
 
 	flip = p_flip;
-	if (p_full) {
-		HBoxContainer *hb2 = memnew(HBoxContainer);
-		vb->add_child(hb2);
-		button_out_in = memnew(ToolButton);
-		button_out_in->set_tooltip(TTR("Out-In"));
-		button_out_in->set_h_size_flags(SIZE_EXPAND_FILL);
-		button_out_in->connect("pressed", this, "_set_preset", varray(-0.5));
-		hb2->add_child(button_out_in);
-
-		button_in_out = memnew(ToolButton);
-		button_in_out->set_tooltip(TTR("In"));
-		button_in_out->set_h_size_flags(SIZE_EXPAND_FILL);
-		button_in_out->connect("pressed", this, "_set_preset", varray(-2));
-		hb2->add_child(button_in_out);
-	}
+	full = p_full;
 }
 
 void EditorPropertyEasing::_notification(int p_what) {
@@ -907,15 +909,19 @@ void EditorPropertyEasing::_notification(int p_what) {
 	switch (p_what) {
 		case NOTIFICATION_THEME_CHANGED:
 		case NOTIFICATION_ENTER_TREE: {
+			preset->clear();
+			preset->add_icon_item(get_icon("CurveConstant", "EditorIcons"), "Zero", EASING_ZERO);
+			preset->add_icon_item(get_icon("CurveLinear", "EditorIcons"), "Linear", EASING_LINEAR);
+			preset->add_icon_item(get_icon("CurveIn", "EditorIcons"), "In", EASING_IN);
+			preset->add_icon_item(get_icon("CurveOut", "EditorIcons"), "Out", EASING_OUT);
+			if (full) {
+				preset->add_icon_item(get_icon("CurveInOut", "EditorIcons"), "In-Out", EASING_IN_OUT);
+				preset->add_icon_item(get_icon("CurveOutIn", "EditorIcons"), "Out-In", EASING_OUT_IN);
+			}
 			easing_draw->set_custom_minimum_size(Size2(0, get_font("font", "Label")->get_height() * 2));
-			button_linear->set_icon(get_icon("CurveLinear", "EditorIcons"));
-			button_out->set_icon(get_icon("CurveOut", "EditorIcons"));
-			button_in->set_icon(get_icon("CurveIn", "EditorIcons"));
-			button_constant->set_icon(get_icon("CurveConstant", "EditorIcons"));
-			if (button_out_in)
-				button_out_in->set_icon(get_icon("CurveOutIn", "EditorIcons"));
-			if (button_in_out)
-				button_in_out->set_icon(get_icon("CurveInOut", "EditorIcons"));
+		} break;
+		case NOTIFICATION_RESIZED: {
+
 		} break;
 	}
 }
@@ -929,47 +935,18 @@ void EditorPropertyEasing::_bind_methods() {
 
 EditorPropertyEasing::EditorPropertyEasing() {
 
-	vb = memnew(VBoxContainer);
-	add_child(vb);
-	HBoxContainer *hb = memnew(HBoxContainer);
-	set_label_reference(hb);
-
-	vb->add_child(hb);
-
-	button_linear = memnew(ToolButton);
-	button_linear->set_tooltip(TTR("Linear"));
-	button_linear->set_h_size_flags(SIZE_EXPAND_FILL);
-	button_linear->connect("pressed", this, "_set_preset", varray(1));
-	hb->add_child(button_linear);
-
-	button_constant = memnew(ToolButton);
-	button_constant->set_tooltip(TTR("Linear"));
-	button_constant->set_h_size_flags(SIZE_EXPAND_FILL);
-	button_constant->connect("pressed", this, "_set_preset", varray(0));
-	hb->add_child(button_constant);
-
-	button_out = memnew(ToolButton);
-	button_out->set_tooltip(TTR("Out"));
-	button_out->set_h_size_flags(SIZE_EXPAND_FILL);
-	button_out->connect("pressed", this, "_set_preset", varray(0.5));
-	hb->add_child(button_out);
-
-	button_in = memnew(ToolButton);
-	button_in->set_tooltip(TTR("In"));
-	button_in->set_h_size_flags(SIZE_EXPAND_FILL);
-	button_in->connect("pressed", this, "_set_preset", varray(2));
-	hb->add_child(button_in);
-
-	button_in_out = NULL;
-	button_out_in = NULL;
-
 	easing_draw = memnew(Control);
 	easing_draw->connect("draw", this, "_draw_easing");
 	easing_draw->connect("gui_input", this, "_drag_easing");
 	easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE);
-	vb->add_child(easing_draw);
+	add_child(easing_draw);
+
+	preset = memnew(PopupMenu);
+	add_child(preset);
+	preset->connect("id_pressed", this, "_set_preset");
 
 	flip = false;
+	full = false;
 }
 
 ///////////////////// VECTOR2 /////////////////////////
@@ -1012,6 +989,7 @@ EditorPropertyVector2::EditorPropertyVector2() {
 	static const char *desc[2] = { "x", "y" };
 	for (int i = 0; i < 2; i++) {
 		spin[i] = memnew(EditorSpinSlider);
+		spin[i]->set_flat(true);
 		spin[i]->set_label(desc[i]);
 		vb->add_child(spin[i]);
 		add_focusable(spin[i]);
@@ -1066,6 +1044,8 @@ EditorPropertyRect2::EditorPropertyRect2() {
 	for (int i = 0; i < 4; i++) {
 		spin[i] = memnew(EditorSpinSlider);
 		spin[i]->set_label(desc[i]);
+		spin[i]->set_flat(true);
+
 		vb->add_child(spin[i]);
 		add_focusable(spin[i]);
 		spin[i]->connect("value_changed", this, "_value_changed");
@@ -1116,6 +1096,8 @@ EditorPropertyVector3::EditorPropertyVector3() {
 	for (int i = 0; i < 3; i++) {
 		spin[i] = memnew(EditorSpinSlider);
 		spin[i]->set_label(desc[i]);
+		spin[i]->set_flat(true);
+
 		vb->add_child(spin[i]);
 		add_focusable(spin[i]);
 		spin[i]->connect("value_changed", this, "_value_changed");
@@ -1168,6 +1150,7 @@ EditorPropertyPlane::EditorPropertyPlane() {
 	for (int i = 0; i < 4; i++) {
 		spin[i] = memnew(EditorSpinSlider);
 		spin[i]->set_label(desc[i]);
+		spin[i]->set_flat(true);
 		vb->add_child(spin[i]);
 		add_focusable(spin[i]);
 		spin[i]->connect("value_changed", this, "_value_changed");
@@ -1221,6 +1204,8 @@ EditorPropertyQuat::EditorPropertyQuat() {
 	for (int i = 0; i < 4; i++) {
 		spin[i] = memnew(EditorSpinSlider);
 		spin[i]->set_label(desc[i]);
+		spin[i]->set_flat(true);
+
 		vb->add_child(spin[i]);
 		add_focusable(spin[i]);
 		spin[i]->connect("value_changed", this, "_value_changed");
@@ -1282,6 +1267,8 @@ EditorPropertyAABB::EditorPropertyAABB() {
 	for (int i = 0; i < 6; i++) {
 		spin[i] = memnew(EditorSpinSlider);
 		spin[i]->set_label(desc[i]);
+		spin[i]->set_flat(true);
+
 		g->add_child(spin[i]);
 		spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
 		add_focusable(spin[i]);
@@ -1340,10 +1327,11 @@ EditorPropertyTransform2D::EditorPropertyTransform2D() {
 	g->set_columns(2);
 	add_child(g);
 
-	static const char *desc[6] = { "xx", "xy", "yx", "yy", "ox", "oy" };
+	static const char *desc[6] = { "x", "y", "x", "y", "x", "y" };
 	for (int i = 0; i < 6; i++) {
 		spin[i] = memnew(EditorSpinSlider);
 		spin[i]->set_label(desc[i]);
+		spin[i]->set_flat(true);
 		g->add_child(spin[i]);
 		spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
 		add_focusable(spin[i]);
@@ -1408,10 +1396,11 @@ EditorPropertyBasis::EditorPropertyBasis() {
 	g->set_columns(3);
 	add_child(g);
 
-	static const char *desc[9] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz" };
+	static const char *desc[9] = { "x", "y", "z", "x", "y", "z", "x", "y", "z" };
 	for (int i = 0; i < 9; i++) {
 		spin[i] = memnew(EditorSpinSlider);
 		spin[i]->set_label(desc[i]);
+		spin[i]->set_flat(true);
 		g->add_child(spin[i]);
 		spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
 		add_focusable(spin[i]);
@@ -1482,10 +1471,11 @@ EditorPropertyTransform::EditorPropertyTransform() {
 	g->set_columns(3);
 	add_child(g);
 
-	static const char *desc[12] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz", "ox", "oy", "oz" };
+	static const char *desc[12] = { "x", "y", "z", "x", "y", "z", "x", "y", "z", "x", "y", "z" };
 	for (int i = 0; i < 12; i++) {
 		spin[i] = memnew(EditorSpinSlider);
 		spin[i]->set_label(desc[i]);
+		spin[i]->set_flat(true);
 		g->add_child(spin[i]);
 		spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
 		add_focusable(spin[i]);
@@ -1844,6 +1834,7 @@ void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<T
 				assign->set_custom_minimum_size(Size2(1, thumbnail_size));
 			}
 			preview->set_texture(p_preview);
+			assign->set_text("");
 		}
 	}
 }
@@ -2037,6 +2028,9 @@ void EditorPropertyResource::update_property() {
 				sub_inspector = memnew(EditorInspector);
 				sub_inspector->set_enable_v_scroll(false);
 
+				sub_inspector->set_use_sub_inspector_bg(true);
+				sub_inspector->set_enable_capitalize_paths(true);
+
 				sub_inspector->connect("property_keyed", this, "_sub_inspector_property_keyed");
 				sub_inspector->connect("resource_selected", this, "_sub_inspector_resource_selected");
 				sub_inspector->connect("object_id_selected", this, "_sub_inspector_object_id_selected");

+ 14 - 4
editor/editor_properties.h

@@ -278,16 +278,26 @@ public:
 class EditorPropertyEasing : public EditorProperty {
 	GDCLASS(EditorPropertyEasing, EditorProperty)
 	Control *easing_draw;
-	ToolButton *button_out, *button_in, *button_linear, *button_constant;
-	ToolButton *button_in_out, *button_out_in;
-	VBoxContainer *vb;
+	PopupMenu *preset;
+	bool full;
+
+	enum {
+		EASING_ZERO,
+		EASING_LINEAR,
+		EASING_IN,
+		EASING_OUT,
+		EASING_IN_OUT,
+		EASING_OUT_IN,
+		EASING_MAX
+
+	};
 
 	bool flip;
 
 	void _drag_easing(const Ref<InputEvent> &p_ev);
 	void _draw_easing();
 	void _notification(int p_what);
-	void _set_preset(float p_val);
+	void _set_preset(int);
 
 protected:
 	static void _bind_methods();

+ 25 - 7
editor/editor_spin_slider.cpp

@@ -161,15 +161,19 @@ void EditorSpinSlider::_notification(int p_what) {
 		updown_offset = -1;
 
 		Ref<StyleBox> sb = get_stylebox("normal", "LineEdit");
-		draw_style_box(sb, Rect2(Vector2(), get_size()));
+		if (!flat) {
+			draw_style_box(sb, Rect2(Vector2(), get_size()));
+		}
 		Ref<Font> font = get_font("font", "LineEdit");
+		int sep = 4 * EDSCALE;
+
+		int string_width = font->get_string_size(label).width;
+		int number_width = get_size().width - sb->get_minimum_size().width - string_width - sep;
 
-		int avail_width = get_size().width - sb->get_minimum_size().width;
-		avail_width -= font->get_string_size(label).width;
 		Ref<Texture> updown = get_icon("updown", "SpinBox");
 
 		if (get_step() == 1) {
-			avail_width -= updown->get_width();
+			number_width -= updown->get_width();
 		}
 
 		if (has_focus()) {
@@ -183,9 +187,8 @@ void EditorSpinSlider::_notification(int p_what) {
 
 		Color fc = get_color("font_color", "LineEdit");
 
-		int label_ofs = sb->get_offset().x + avail_width;
-		draw_string(font, Vector2(label_ofs, vofs), label, fc * Color(1, 1, 1, 0.5));
-		draw_string(font, Vector2(sb->get_offset().x, vofs), numstr, fc, avail_width);
+		draw_string(font, Vector2(sb->get_offset().x, vofs), label, fc * Color(1, 1, 1, 0.5));
+		draw_string(font, Vector2(sb->get_offset().x + string_width + sep, vofs), numstr, fc, number_width);
 
 		if (get_step() == 1) {
 			Ref<Texture> updown = get_icon("updown", "SpinBox");
@@ -336,6 +339,16 @@ bool EditorSpinSlider::is_read_only() const {
 	return read_only;
 }
 
+void EditorSpinSlider::set_flat(bool p_enable) {
+
+	flat = p_enable;
+	update();
+}
+
+bool EditorSpinSlider::is_flat() const {
+	return flat;
+}
+
 void EditorSpinSlider::_focus_entered() {
 	Rect2 gr = get_global_rect();
 	value_input->set_text(get_text_value());
@@ -355,6 +368,9 @@ void EditorSpinSlider::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_read_only", "read_only"), &EditorSpinSlider::set_read_only);
 	ClassDB::bind_method(D_METHOD("is_read_only"), &EditorSpinSlider::is_read_only);
 
+	ClassDB::bind_method(D_METHOD("set_flat", "flat"), &EditorSpinSlider::set_flat);
+	ClassDB::bind_method(D_METHOD("is_flat"), &EditorSpinSlider::is_flat);
+
 	ClassDB::bind_method(D_METHOD("_gui_input"), &EditorSpinSlider::_gui_input);
 	ClassDB::bind_method(D_METHOD("_grabber_mouse_entered"), &EditorSpinSlider::_grabber_mouse_entered);
 	ClassDB::bind_method(D_METHOD("_grabber_mouse_exited"), &EditorSpinSlider::_grabber_mouse_exited);
@@ -365,10 +381,12 @@ void EditorSpinSlider::_bind_methods() {
 
 	ADD_PROPERTY(PropertyInfo(Variant::STRING, "label"), "set_label", "get_label");
 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "read_only"), "set_read_only", "is_read_only");
+	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flat"), "set_flat", "is_flat");
 }
 
 EditorSpinSlider::EditorSpinSlider() {
 
+	flat = false;
 	grabbing_spinner_attempt = false;
 	grabbing_spinner = false;
 	grabbing_spinner_dist_cache = 0;

+ 4 - 0
editor/editor_spin_slider.h

@@ -68,6 +68,7 @@ class EditorSpinSlider : public Range {
 	void _value_input_entered(const String &);
 	void _value_focus_exited();
 	bool hide_slider;
+	bool flat;
 
 protected:
 	void _notification(int p_what);
@@ -88,6 +89,9 @@ public:
 	void set_read_only(bool p_enable);
 	bool is_read_only() const;
 
+	void set_flat(bool p_enable);
+	bool is_flat() const;
+
 	virtual Size2 get_minimum_size() const;
 	EditorSpinSlider();
 };

+ 9 - 0
editor/editor_themes.cpp

@@ -656,6 +656,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
 	theme->set_icon("visibility_xray", "PopupMenu", theme->get_icon("GuiVisibilityXray", "EditorIcons"));
 	theme->set_constant("vseparation", "PopupMenu", (extra_spacing + default_margin_size) * EDSCALE);
 
+	Ref<StyleBoxFlat> sub_inspector_bg = make_flat_stylebox(dark_color_1, 2, 0, 0, 0);
+	sub_inspector_bg->set_border_width(MARGIN_LEFT, 2);
+	sub_inspector_bg->set_border_color(MARGIN_LEFT, accent_color * Color(1, 1, 1, 0.3));
+	sub_inspector_bg->set_draw_center(true);
+
+	theme->set_stylebox("sub_inspector_bg", "Editor", sub_inspector_bg);
+	theme->set_constant("inspector_margin", "Editor", 8 * EDSCALE);
+
 	// Tree & ItemList background
 	Ref<StyleBoxFlat> style_tree_bg = style_default->duplicate();
 	style_tree_bg->set_bg_color(dark_color_1);
@@ -666,6 +674,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
 	// Tree
 	theme->set_icon("checked", "Tree", theme->get_icon("GuiChecked", "EditorIcons"));
 	theme->set_icon("unchecked", "Tree", theme->get_icon("GuiUnchecked", "EditorIcons"));
+	theme->set_icon("arrow_up", "Tree", theme->get_icon("GuiTreeArrowUp", "EditorIcons"));
 	theme->set_icon("arrow", "Tree", theme->get_icon("GuiTreeArrowDown", "EditorIcons"));
 	theme->set_icon("arrow_collapsed", "Tree", theme->get_icon("GuiTreeArrowRight", "EditorIcons"));
 	theme->set_icon("updown", "Tree", theme->get_icon("GuiTreeUpdown", "EditorIcons"));

+ 60 - 0
editor/icons/icon_GUI_tree_arrow_up.svg

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="12"
+   height="12"
+   version="1.1"
+   viewBox="0 0 12 12"
+   id="svg6"
+   sodipodi:docname="icon_GUI_tree_arrow_up.svg"
+   inkscape:version="0.92.3 (2405546, 2018-03-11)">
+  <metadata
+     id="metadata12">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs10" />
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1673"
+     inkscape:window-height="594"
+     id="namedview8"
+     showgrid="false"
+     inkscape:zoom="19.666667"
+     inkscape:cx="-4.3220338"
+     inkscape:cy="6.0000001"
+     inkscape:window-x="67"
+     inkscape:window-y="27"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg6" />
+  <g
+     transform="rotate(180,6,526.08476)"
+     id="g4">
+    <path
+       d="m 3,1045.4 3,3 3,-3"
+       id="path2"
+       inkscape:connector-curvature="0"
+       style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.39216003" />
+  </g>
+</svg>

+ 0 - 1
scene/3d/light.cpp

@@ -307,7 +307,6 @@ Light::Light(VisualServer::LightType p_type) {
 	set_param(PARAM_SHADOW_NORMAL_BIAS, 0.0);
 	set_param(PARAM_SHADOW_BIAS, 0.15);
 	set_disable_scale(true);
-	print_line("disabling light scale?");
 }
 
 Light::Light() {