瀏覽代碼

Merge branch 'master' of https://github.com/godotengine/godot

Juan Linietsky 9 年之前
父節點
當前提交
e8a2c767d2

+ 11 - 1
platform/haiku/context_gl_haiku.cpp

@@ -35,6 +35,8 @@ ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow* p_window) {
 
 	uint32 type = BGL_RGB | BGL_DOUBLE | BGL_DEPTH;
 	view = new HaikuGLView(window->Bounds(), type);
+	
+	use_vsync = false;
 }
 
 ContextGL_Haiku::~ContextGL_Haiku() {
@@ -57,7 +59,7 @@ void ContextGL_Haiku::make_current() {
 }
 
 void ContextGL_Haiku::swap_buffers() {
-	view->SwapBuffers();
+	view->SwapBuffers(use_vsync);
 }
 
 int ContextGL_Haiku::get_window_width() {
@@ -68,4 +70,12 @@ int ContextGL_Haiku::get_window_height() {
 	return window->Bounds().IntegerHeight();
 }
 
+void ContextGL_Haiku::set_use_vsync(bool p_use) {
+	use_vsync = p_use;
+}
+
+bool ContextGL_Haiku::is_using_vsync() const {
+	return use_vsync;
+}
+
 #endif

+ 5 - 0
platform/haiku/context_gl_haiku.h

@@ -40,6 +40,8 @@ class ContextGL_Haiku : public ContextGL {
 private:
 	HaikuGLView* view;
 	HaikuDirectWindow* window;
+	
+	bool use_vsync;
 
 public:
 	ContextGL_Haiku(HaikuDirectWindow* p_window);
@@ -51,6 +53,9 @@ public:
 	virtual void swap_buffers();
 	virtual int get_window_width();
 	virtual int get_window_height();
+	
+	virtual void set_use_vsync(bool p_use);
+	virtual bool is_using_vsync() const;
 };
 
 #endif

+ 3 - 3
platform/haiku/detect.py

@@ -24,7 +24,7 @@ def get_opts():
 def get_flags():
 	return [
 		('builtin_zlib', 'no'),
-		#('glew', 'yes'), # TODO: investigate the GLEW situation on Haiku
+		('glew', 'yes'),
 	]
 
 def configure(env):
@@ -38,8 +38,8 @@ def configure(env):
 
 	env.Append(CPPPATH = ['#platform/haiku'])
 
-	env["CC"] = "gcc"
-	env["CXX"] = "g++"
+	env["CC"] = "gcc-x86"
+	env["CXX"] = "g++-x86"
 
 	if (env["target"]=="release"):
 		if (env["debug_release"]=="yes"):

+ 1 - 1
platform/windows/joystick.cpp

@@ -283,7 +283,7 @@ void joystick_windows::close_joystick(int id) {
 	d_joysticks[id].attached = false;
 	attached_joysticks[d_joysticks[id].id] = false;
 	d_joysticks[id].guid.Data1 = d_joysticks[id].guid.Data2 = d_joysticks[id].guid.Data3 = 0;
-	input->joy_connection_changed(id, false, "");
+	input->joy_connection_changed(d_joysticks[id].id, false, "");
 	joystick_count--;
 }
 

+ 3 - 1
platform/x11/detect.py

@@ -209,5 +209,7 @@ def configure(env):
 	if (env["use_static_cpp"]=="yes"):
 		env.Append(LINKFLAGS=['-static-libstdc++'])
 
-	env["x86_opt_gcc"]=True
+	list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
+	if any(platform.machine() in s for s in list_of_x86):
+		env["x86_opt_gcc"]=True
 

+ 40 - 5
scene/gui/line_edit.cpp

@@ -108,7 +108,7 @@ void LineEdit::_input_event(InputEvent p_event) {
 				selection.doubleclick=false;
 
 				if (OS::get_singleton()->has_virtual_keyboard())
-					OS::get_singleton()->show_virtual_keyboard(get_text(),get_global_rect());
+					OS::get_singleton()->show_virtual_keyboard(text,get_global_rect());
 			}
 
 			update();
@@ -634,14 +634,19 @@ void LineEdit::_notification(int p_what) {
 			Color font_color_selected=get_color("font_color_selected");
 			Color cursor_color=get_color("cursor_color");
 
+			const String& t = text.empty() ? placeholder : text;
+			// draw placeholder color
+			if(text.empty())
+				font_color.a *= placeholder_alpha;
+
 			while(true) {
 
 		//end of string, break!
-				if (char_ofs>=text.length())
+				if (char_ofs>=t.length())
 					break;
 
-				CharType cchar=pass?'*':text[char_ofs];
-				CharType next=pass?'*':text[char_ofs+1];
+				CharType cchar=pass?'*':t[char_ofs];
+				CharType next=pass?'*':t[char_ofs+1];
 				int char_width=font->get_char_size( cchar,next ).width;
 
 		// end of widget, break!
@@ -678,7 +683,7 @@ void LineEdit::_notification(int p_what) {
 			}
 
 			if (OS::get_singleton()->has_virtual_keyboard())
-				OS::get_singleton()->show_virtual_keyboard(get_text(),get_global_rect());
+				OS::get_singleton()->show_virtual_keyboard(text,get_global_rect());
 
 		} break;
 		case NOTIFICATION_FOCUS_EXIT: {
@@ -938,6 +943,29 @@ String LineEdit::get_text() const {
 	return text;
 }
 
+void LineEdit::set_placeholder(String p_text) {
+
+	placeholder = p_text;
+	update();
+}
+
+String LineEdit::get_placeholder() const {
+
+	return placeholder;
+}
+
+
+void LineEdit::set_placeholder_alpha(float p_alpha) {
+
+	placeholder_alpha = p_alpha;
+	update();
+}
+
+float LineEdit::get_placeholder_alpha() const {
+
+	return placeholder_alpha;
+}
+
 void LineEdit::set_cursor_pos(int p_pos) {
 
 	if (p_pos>(int)text.length())
@@ -1223,6 +1251,10 @@ void LineEdit::_bind_methods() {
 	ObjectTypeDB::bind_method(_MD("select_all"),&LineEdit::select_all);
 	ObjectTypeDB::bind_method(_MD("set_text","text"),&LineEdit::set_text);
 	ObjectTypeDB::bind_method(_MD("get_text"),&LineEdit::get_text);
+	ObjectTypeDB::bind_method(_MD("set_placeholder","text"),&LineEdit::set_placeholder);
+	ObjectTypeDB::bind_method(_MD("get_placeholder"),&LineEdit::get_placeholder);
+	ObjectTypeDB::bind_method(_MD("set_placeholder_alpha","alpha"),&LineEdit::set_placeholder_alpha);
+	ObjectTypeDB::bind_method(_MD("get_placeholder_alpha"),&LineEdit::get_placeholder_alpha);
 	ObjectTypeDB::bind_method(_MD("set_cursor_pos","pos"),&LineEdit::set_cursor_pos);
 	ObjectTypeDB::bind_method(_MD("get_cursor_pos"),&LineEdit::get_cursor_pos);
 	ObjectTypeDB::bind_method(_MD("cursor_set_blink_enabled", "enable"),&LineEdit::cursor_set_blink_enabled);
@@ -1257,6 +1289,8 @@ void LineEdit::_bind_methods() {
 	BIND_CONSTANT( MENU_MAX );
 
 	ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "text" ), _SCS("set_text"),_SCS("get_text") );
+	ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "placeholder/text" ), _SCS("set_placeholder"),_SCS("get_placeholder") );
+	ADD_PROPERTYNZ( PropertyInfo( Variant::REAL, "placeholder/alpha",PROPERTY_HINT_RANGE,"0,1,0.001" ), _SCS("set_placeholder_alpha"),_SCS("get_placeholder_alpha") );
 	ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), _SCS("set_align"), _SCS("get_align"));
 	ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "max_length" ), _SCS("set_max_length"),_SCS("get_max_length") );
 	ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "editable" ), _SCS("set_editable"),_SCS("is_editable") );
@@ -1275,6 +1309,7 @@ LineEdit::LineEdit() {
 	window_has_focus=true;
 	max_length = 0;
 	pass=false;
+	placeholder_alpha=0.6;
 
 	selection_clear();
 	set_focus_mode( FOCUS_ALL );

+ 6 - 0
scene/gui/line_edit.h

@@ -67,6 +67,8 @@ private:
 
 	String undo_text;
 	String text;
+	String placeholder;
+	float placeholder_alpha;
 
 	PopupMenu *menu;
 
@@ -135,6 +137,10 @@ public:
 	void delete_text(int p_from_column, int p_to_column);
 	void set_text(String p_text);
 	String get_text() const;
+	void set_placeholder(String p_text);
+	String get_placeholder() const;
+	void set_placeholder_alpha(float p_alpha);
+	float get_placeholder_alpha() const;
 	void set_cursor_pos(int p_pos);
 	int get_cursor_pos() const;
 	void set_max_length(int p_max_length);

+ 6 - 0
scene/gui/text_edit.cpp

@@ -852,6 +852,11 @@ void TextEdit::_notification(int p_what) {
 								k++;
 							}
 
+							// check for space between name and bracket
+							while (k < str.length() && (str[k] == '\t' || str[k] == ' ')) {
+								k++;
+							}
+
 							if (str[k] == '(') {
 								in_function_name = true;
 							}
@@ -1973,6 +1978,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
 					}
 				} break;
 				case KEY_TAB: {
+					if (k.mod.command) break; // avoid tab when command
 
 					if (readonly)
 						break;

+ 21 - 1
tools/editor/plugins/script_editor_plugin.cpp

@@ -585,7 +585,6 @@ void ScriptTextEditor::_code_complete_script(const String& p_code, List<String>*
 	Error err = script->get_language()->complete_code(p_code,script->get_path().get_base_dir(),base,r_options,hint);
 	if (hint!="") {
 		get_text_edit()->set_code_hint(hint);
-		print_line("hint: "+hint.replace(String::chr(0xFFFF),"|"));
 	}
 
 }
@@ -2316,6 +2315,22 @@ void ScriptEditor::_script_split_dragged(float) {
 	EditorNode::get_singleton()->save_layout();
 }
 
+void ScriptEditor::_unhandled_input(const InputEvent& p_event) {
+	if (p_event.key.pressed || !is_visible()) return;
+	if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) {
+		int next_tab = script_list->get_current() + 1;
+		next_tab %= script_list->get_item_count();
+		_go_to_tab(script_list->get_item_metadata(next_tab));
+		_update_script_names();
+	}
+	if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) {
+		int next_tab = script_list->get_current() - 1;
+		next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1;
+		_go_to_tab(script_list->get_item_metadata(next_tab));
+		_update_script_names();
+	}
+}
+
 void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) {
 
 	if (!bool(EDITOR_DEF("text_editor/restore_scripts_on_load",true))) {
@@ -2598,6 +2613,7 @@ void ScriptEditor::_bind_methods() {
 	ObjectTypeDB::bind_method("_history_forward",&ScriptEditor::_history_forward);
 	ObjectTypeDB::bind_method("_history_back",&ScriptEditor::_history_back);
 	ObjectTypeDB::bind_method("_live_auto_reload_running_scripts",&ScriptEditor::_live_auto_reload_running_scripts);
+	ObjectTypeDB::bind_method("_unhandled_input",&ScriptEditor::_unhandled_input);
 
 }
 
@@ -2631,6 +2647,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
 
 	tab_container->set_h_size_flags(SIZE_EXPAND_FILL);
 
+	ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_GREATER);
+	ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_LESS);
+	set_process_unhandled_input(true);
+
 	file_menu = memnew( MenuButton );
 	menu_hb->add_child(file_menu);
 	file_menu->set_text(TTR("File"));

+ 2 - 0
tools/editor/plugins/script_editor_plugin.h

@@ -279,6 +279,8 @@ class ScriptEditor : public VBoxContainer {
 
 	void _script_split_dragged(float);
 
+	void _unhandled_input(const InputEvent& p_event);
+
 
 	void _history_forward();
 	void _history_back();

+ 1 - 1
tools/editor/plugins/tile_map_editor_plugin.cpp

@@ -223,7 +223,7 @@ void TileMapEditor::_update_palette() {
 		String name;
 
 		if (tileset->tile_get_name(E->get())!="") {
-			name = tileset->tile_get_name(E->get());
+			name = itos(E->get())+" - "+tileset->tile_get_name(E->get());
 		} else {
 			name = "#"+itos(E->get());
 		}

+ 0 - 3
tools/editor/project_manager.cpp

@@ -871,9 +871,6 @@ ProjectManager::ProjectManager() {
 
 	HBoxContainer *top_hb = memnew( HBoxContainer);
 	vb->add_child(top_hb);
-	TextureFrame *logo = memnew( TextureFrame );
-	logo->set_texture(theme->get_icon("LogoSmall","EditorIcons"));
-	//top_hb->add_child( logo );
 	CenterContainer *ccl = memnew( CenterContainer );
 	Label *l = memnew( Label );
 	l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager"));

+ 2 - 1
tools/editor/scenes_dock.cpp

@@ -164,12 +164,14 @@ void ScenesDock::_notification(int p_what) {
 				if (split_mode) {
 
 					file_list_vb->hide();
+					tree->set_custom_minimum_size(Size2(0,0));
 					tree->set_v_size_flags(SIZE_EXPAND_FILL);
 					button_back->show();
 				} else {
 
 					tree->show();
 					file_list_vb->show();
+					tree->set_custom_minimum_size(Size2(0,200)*EDSCALE);
 					tree->set_v_size_flags(SIZE_FILL);
 					button_back->hide();
 					if (!EditorFileSystem::get_singleton()->is_scanning()) {
@@ -1702,7 +1704,6 @@ ScenesDock::ScenesDock(EditorNode *p_editor) {
 
 	tree->set_hide_root(true);
 	split_box->add_child(tree);
-	tree->set_custom_minimum_size(Size2(0,200)*EDSCALE);
 	tree->set_drag_forwarding(this);