Juan Linietsky vor 11 Jahren
Ursprung
Commit
a4c1fa12a5

Datei-Diff unterdrückt, da er zu groß ist
+ 196 - 195
demos/3d/platformer/player.xml


+ 19 - 18
demos/3d/platformer/stage.xml

@@ -1,14 +1,15 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <resource_file type="PackedScene" subresource_count="7" version="1.0" version_name="Godot Engine v1.0.3917-beta1">
-	<ext_resource path="res://sb.*" type="CubeMap"></ext_resource>
-	<ext_resource path="res://tiles.*" type="MeshLibrary"></ext_resource>
-	<ext_resource path="res://enemy.*" type="PackedScene"></ext_resource>
-	<ext_resource path="res://player.*" type="PackedScene"></ext_resource>
-	<ext_resource path="res://coin.*" type="PackedScene"></ext_resource>
+	<ext_resource path="res://sb.cube" type="CubeMap"></ext_resource>
+	<ext_resource path="res://tiles.res" type="MeshLibrary"></ext_resource>
+	<ext_resource path="res://coin.scn" type="PackedScene"></ext_resource>
+	<ext_resource path="res://player.xml" type="PackedScene"></ext_resource>
+	<ext_resource path="res://enemy.scn" type="PackedScene"></ext_resource>
 	<resource type="Environment" path="local://1">
 		<int name="background/mode"> 4 </int>
 		<color name="background/color"> 0, 0, 0, 1 </color>
-		<resource name="background/texture"></resource>		<resource name="background/cubemap" resource_type="CubeMap" path="res://sb.*">  </resource>
+		<nil name="background/texture">  </nil>
+		<resource name="background/cubemap" resource_type="CubeMap" path="res://sb.cube">  </resource>
 		<real name="background/energy"> 1 </real>
 		<real name="background/scale"> 1 </real>
 		<bool name="glow/enabled"> True </bool>
@@ -77,8 +78,6 @@
 				<string> "shadow/zoffset_scale" </string>
 				<string> "environment" </string>
 				<string> "WorldEnvironment" </string>
-				<string> "player" </string>
-				<string> "RigidBody" </string>
 				<string> "coins" </string>
 				<string> "Node" </string>
 				<string> "coin" </string>
@@ -128,9 +127,11 @@
 				<string> "coin 4 5 4 4" </string>
 				<string> "enemies" </string>
 				<string> "enemy" </string>
+				<string> "RigidBody" </string>
 				<string> "enemy 2" </string>
 				<string> "enemy 3" </string>
 				<string> "enemy 4" </string>
+				<string> "player" </string>
 			</string_array>
 			<string> "version" </string>
 			<int> 1 </int>
@@ -162,17 +163,17 @@
 							<array  len="4" shared="false">
 								<dictionary  shared="false">
 									<string> "distance" </string>
-									<real> 12.257931 </real>
+									<real> 6.622579 </real>
 									<string> "x_rot" </string>
-									<real> 0.383296 </real>
+									<real> 1.570796 </real>
 									<string> "y_rot" </string>
-									<real> 13.787448 </real>
+									<real> 0 </real>
 									<string> "use_orthogonal" </string>
 									<bool> False </bool>
 									<string> "use_environment" </string>
 									<bool> False </bool>
 									<string> "pos" </string>
-									<vector3> 13.9419, 0.878091, 12.8933 </vector3>
+									<vector3> 8.30511, 0.427271, 15.7846 </vector3>
 								</dictionary>
 								<dictionary  shared="false">
 									<string> "distance" </string>
@@ -239,7 +240,7 @@
 					<string> "__editor_plugin_screen__" </string>
 					<string> "3D" </string>
 				</dictionary>
-				<resource  resource_type="MeshLibrary" path="res://tiles.*">  </resource>
+				<resource  resource_type="MeshLibrary" path="res://tiles.res">  </resource>
 				<bool> False </bool>
 				<real> 2 </real>
 				<int> 4 </int>
@@ -268,13 +269,11 @@
 				<real> 40 </real>
 				<real> 0.410558 </real>
 				<resource  resource_type="Environment" path="local://1">  </resource>
-				<resource  resource_type="PackedScene" path="res://player.*">  </resource>
-				<transform> -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 9.3857, 3.99107, 14.8105 </transform>
 				<dictionary  shared="false">
 					<string> "_editor_collapsed" </string>
 					<bool> True </bool>
 				</dictionary>
-				<resource  resource_type="PackedScene" path="res://coin.*">  </resource>
+				<resource  resource_type="PackedScene" path="res://coin.scn">  </resource>
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 18.5311, 2.85075, 5.24675 </transform>
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 18.5311, 2.85075, 7.24675 </transform>
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 20.5311, 2.85075, 5.24675 </transform>
@@ -319,14 +318,16 @@
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 51.5614, 4.60515, 23.1836 </transform>
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 53.5614, 2.98252, 25.1775 </transform>
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 51.5614, 4.60515, 25.1836 </transform>
-				<resource  resource_type="PackedScene" path="res://enemy.*">  </resource>
+				<resource  resource_type="PackedScene" path="res://enemy.scn">  </resource>
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 18.3062, 5.40827, 5.96938 </transform>
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 64.1292, 5.40827, 17.1396 </transform>
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 64.1292, 5.40827, 32.6128 </transform>
 				<transform> 1, 0, 0, 0, 1, 0, 0, 0, 1, 55.5702, 5.40827, 32.6128 </transform>
+				<resource  resource_type="PackedScene" path="res://player.xml">  </resource>
+				<transform> 0.0160676, 0, -0.999871, 0, 1, 0, 0.999871, 0, 0.0160676, 8.50167, 4.15811, 15.9334 </transform>
 			</array>
 			<string> "nodes" </string>
-			<int_array  len="541"> 				-1, -1, 1, 0, -1, 1, 2, 0, 0, 0, 0, 3, 3, -1, 10, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 9, 5, 10, 5, 11, 6, 12, 7, 2, 8, 0, 0, 0, 13, 13, -1, 16, 14, 9, 15, 10, 16, 11, 17, 12, 18, 13, 19, 13, 20, 5, 21, 14, 22, 15, 23, 16, 24, 17, 25, 18, 26, 19, 27, 20, 28, 21, 29, 3, 0, 0, 0, 31, 30, -1, 1, 30, 22, 0, 0, 0, 33, 32, 23, 1, 14, 24, 0, 0, 0, 35, 34, -1, 1, 2, 25, 0, 5, 0, 37, 36, 26, 1, 14, 27, 0, 5, 0, 37, 38, 26, 1, 14, 28, 0, 5, 0, 37, 39, 26, 1, 14, 29, 0, 5, 0, 37, 40, 26, 1, 14, 30, 0, 5, 0, 37, 41, 26, 1, 14, 31, 0, 5, 0, 37, 42, 26, 1, 14, 32, 0, 5, 0, 37, 43, 26, 1, 14, 33, 0, 5, 0, 37, 44, 26, 1, 14, 34, 0, 5, 0, 37, 45, 26, 1, 14, 35, 0, 5, 0, 37, 46, 26, 1, 14, 36, 0, 5, 0, 37, 47, 26, 1, 14, 37, 0, 5, 0, 37, 48, 26, 1, 14, 38, 0, 5, 0, 37, 49, 26, 1, 14, 39, 0, 5, 0, 37, 50, 26, 1, 14, 40, 0, 5, 0, 37, 51, 26, 1, 14, 41, 0, 5, 0, 37, 52, 26, 1, 14, 42, 0, 5, 0, 37, 53, 26, 1, 14, 43, 0, 5, 0, 37, 54, 26, 1, 14, 44, 0, 5, 0, 37, 55, 26, 1, 14, 45, 0, 5, 0, 37, 56, 26, 1, 14, 46, 0, 5, 0, 37, 57, 26, 1, 14, 47, 0, 5, 0, 37, 58, 26, 1, 14, 48, 0, 5, 0, 37, 59, 26, 1, 14, 49, 0, 5, 0, 37, 60, 26, 1, 14, 50, 0, 5, 0, 37, 61, 26, 1, 14, 51, 0, 5, 0, 37, 62, 26, 1, 14, 52, 0, 5, 0, 37, 63, 26, 1, 14, 53, 0, 5, 0, 37, 64, 26, 1, 14, 54, 0, 5, 0, 37, 65, 26, 1, 14, 55, 0, 5, 0, 37, 66, 26, 1, 14, 56, 0, 5, 0, 37, 67, 26, 1, 14, 57, 0, 5, 0, 37, 68, 26, 1, 14, 58, 0, 5, 0, 37, 69, 26, 1, 14, 59, 0, 5, 0, 37, 70, 26, 1, 14, 60, 0, 5, 0, 37, 71, 26, 1, 14, 61, 0, 5, 0, 37, 72, 26, 1, 14, 62, 0, 5, 0, 37, 73, 26, 1, 14, 63, 0, 5, 0, 37, 74, 26, 1, 14, 64, 0, 5, 0, 37, 75, 26, 1, 14, 65, 0, 5, 0, 37, 76, 26, 1, 14, 66, 0, 5, 0, 37, 77, 26, 1, 14, 67, 0, 5, 0, 37, 78, 26, 1, 14, 68, 0, 5, 0, 37, 79, 26, 1, 14, 69, 0, 5, 0, 37, 80, 26, 1, 14, 70, 0, 0, 0, 35, 81, -1, 0, 0, 50, 0, 33, 82, 71, 1, 14, 72, 0, 50, 0, 33, 83, 71, 1, 14, 73, 0, 50, 0, 33, 84, 71, 1, 14, 74, 0, 50, 0, 33, 85, 71, 1, 14, 75, 0 </int_array>
+			<int_array  len="541"> 				-1, -1, 1, 0, -1, 1, 2, 0, 0, 0, 0, 3, 3, -1, 10, 4, 1, 5, 2, 6, 3, 7, 4, 8, 5, 9, 5, 10, 5, 11, 6, 12, 7, 2, 8, 0, 0, 0, 13, 13, -1, 16, 14, 9, 15, 10, 16, 11, 17, 12, 18, 13, 19, 13, 20, 5, 21, 14, 22, 15, 23, 16, 24, 17, 25, 18, 26, 19, 27, 20, 28, 21, 29, 3, 0, 0, 0, 31, 30, -1, 1, 30, 22, 0, 0, 0, 33, 32, -1, 1, 2, 23, 0, 4, 0, 35, 34, 24, 1, 14, 25, 0, 4, 0, 35, 36, 24, 1, 14, 26, 0, 4, 0, 35, 37, 24, 1, 14, 27, 0, 4, 0, 35, 38, 24, 1, 14, 28, 0, 4, 0, 35, 39, 24, 1, 14, 29, 0, 4, 0, 35, 40, 24, 1, 14, 30, 0, 4, 0, 35, 41, 24, 1, 14, 31, 0, 4, 0, 35, 42, 24, 1, 14, 32, 0, 4, 0, 35, 43, 24, 1, 14, 33, 0, 4, 0, 35, 44, 24, 1, 14, 34, 0, 4, 0, 35, 45, 24, 1, 14, 35, 0, 4, 0, 35, 46, 24, 1, 14, 36, 0, 4, 0, 35, 47, 24, 1, 14, 37, 0, 4, 0, 35, 48, 24, 1, 14, 38, 0, 4, 0, 35, 49, 24, 1, 14, 39, 0, 4, 0, 35, 50, 24, 1, 14, 40, 0, 4, 0, 35, 51, 24, 1, 14, 41, 0, 4, 0, 35, 52, 24, 1, 14, 42, 0, 4, 0, 35, 53, 24, 1, 14, 43, 0, 4, 0, 35, 54, 24, 1, 14, 44, 0, 4, 0, 35, 55, 24, 1, 14, 45, 0, 4, 0, 35, 56, 24, 1, 14, 46, 0, 4, 0, 35, 57, 24, 1, 14, 47, 0, 4, 0, 35, 58, 24, 1, 14, 48, 0, 4, 0, 35, 59, 24, 1, 14, 49, 0, 4, 0, 35, 60, 24, 1, 14, 50, 0, 4, 0, 35, 61, 24, 1, 14, 51, 0, 4, 0, 35, 62, 24, 1, 14, 52, 0, 4, 0, 35, 63, 24, 1, 14, 53, 0, 4, 0, 35, 64, 24, 1, 14, 54, 0, 4, 0, 35, 65, 24, 1, 14, 55, 0, 4, 0, 35, 66, 24, 1, 14, 56, 0, 4, 0, 35, 67, 24, 1, 14, 57, 0, 4, 0, 35, 68, 24, 1, 14, 58, 0, 4, 0, 35, 69, 24, 1, 14, 59, 0, 4, 0, 35, 70, 24, 1, 14, 60, 0, 4, 0, 35, 71, 24, 1, 14, 61, 0, 4, 0, 35, 72, 24, 1, 14, 62, 0, 4, 0, 35, 73, 24, 1, 14, 63, 0, 4, 0, 35, 74, 24, 1, 14, 64, 0, 4, 0, 35, 75, 24, 1, 14, 65, 0, 4, 0, 35, 76, 24, 1, 14, 66, 0, 4, 0, 35, 77, 24, 1, 14, 67, 0, 4, 0, 35, 78, 24, 1, 14, 68, 0, 0, 0, 33, 79, -1, 0, 0, 49, 0, 81, 80, 69, 1, 14, 70, 0, 49, 0, 81, 82, 69, 1, 14, 71, 0, 49, 0, 81, 83, 69, 1, 14, 72, 0, 49, 0, 81, 84, 69, 1, 14, 73, 0, 0, 0, 81, 85, 74, 1, 14, 75, 0 </int_array>
 			<string> "conns" </string>
 			<int_array  len="0"> 				 </int_array>
 		</dictionary>

BIN
demos/3d/platformer/tiles.res


+ 4 - 0
drivers/gles2/rasterizer_gles2.cpp

@@ -3290,6 +3290,7 @@ RID RasterizerGLES2::render_target_create(){
 	texture->active=false;
 	texture->total_data_size=0;
 	texture->render_target=rt;
+	texture->ignore_mipmaps=true;
 	rt->texture_ptr=texture;
 	rt->texture=texture_owner.make_rid( texture );
 	rt->texture_ptr->active=false;
@@ -5911,6 +5912,7 @@ void RasterizerGLES2::end_scene() {
 		copy_shader.set_conditional(CopyShaderGLES2::USE_GAMMA,current_env && current_env->fx_enabled[VS::ENV_FX_GAMMA]);
 		copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW,current_env && current_env->fx_enabled[VS::ENV_FX_GLOW]);
 		copy_shader.set_conditional(CopyShaderGLES2::USE_HDR,current_env && current_env->fx_enabled[VS::ENV_FX_HDR]);
+		copy_shader.set_conditional(CopyShaderGLES2::USE_NO_ALPHA,true);
 
 		copy_shader.bind();
 		//copy_shader.set_uniform(CopyShaderGLES2::SOURCE,0);
@@ -5954,6 +5956,8 @@ void RasterizerGLES2::end_scene() {
 		copy_shader.set_conditional(CopyShaderGLES2::USE_GAMMA,false);
 		copy_shader.set_conditional(CopyShaderGLES2::USE_GLOW,false);
 		copy_shader.set_conditional(CopyShaderGLES2::USE_HDR,false);
+		copy_shader.set_conditional(CopyShaderGLES2::USE_NO_ALPHA,false);
+
 		material_shader.set_conditional(MaterialShaderGLES2::USE_HDR,false);
 
 

+ 6 - 1
drivers/gles2/shaders/copy.glsl

@@ -248,6 +248,11 @@ void main() {
 #ifdef USE_ENERGY
 	color.rgb*=energy;
 #endif
-	gl_FragColor = color;
+
+#ifdef USE_NO_ALPHA
+        color.a=1.0;
+#endif
+
+        gl_FragColor = color;
 }
 

+ 1 - 1
platform/windows/detect.py

@@ -116,7 +116,7 @@ def configure(env):
 		env.Append(CCFLAGS=['/DGLES2_ENABLED'])
 		env.Append(CCFLAGS=['/DGLES1_ENABLED'])
 		env.Append(CCFLAGS=['/DGLEW_ENABLED'])
-		env.Append(LIBS=['winmm','opengl32','dsound','kernel32','ole32','user32','gdi32','wsock32'])
+		env.Append(LIBS=['winmm','opengl32','dsound','kernel32','ole32','user32','gdi32','wsock32', 'shell32'])
 		
 		env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
                 if (os.getenv("DXSDK_DIR")):

+ 20 - 5
scene/2d/tile_map.cpp

@@ -97,6 +97,7 @@ void TileMap::set_tileset(const Ref<TileSet>& p_tileset) {
 		clear();
 
 	_recreate_quadrants();
+	emit_signal("settings_changed");
 
 }
 
@@ -112,6 +113,7 @@ void TileMap::set_cell_size(int p_size) {
 	_clear_quadrants();
 	cell_size=p_size;
 	_recreate_quadrants();
+	emit_signal("settings_changed");
 
 
 }
@@ -126,6 +128,7 @@ void TileMap::set_quadrant_size(int p_size) {
 	_clear_quadrants();
 	quadrant_size=p_size;
 	_recreate_quadrants();
+	emit_signal("settings_changed");
 
 }
 int TileMap::get_quadrant_size() const {
@@ -137,6 +140,8 @@ void TileMap::set_center_x(bool p_enable) {
 
 	center_x=p_enable;
 	_recreate_quadrants();
+	emit_signal("settings_changed");
+
 
 }
 bool TileMap::get_center_x() const {
@@ -147,6 +152,7 @@ void TileMap::set_center_y(bool p_enable) {
 
 	center_y=p_enable;
 	_recreate_quadrants();
+	emit_signal("settings_changed");
 
 }
 bool TileMap::get_center_y() const {
@@ -234,14 +240,20 @@ void TileMap::_update_dirty_quadrants() {
 
 					Vector2 shape_ofs = tile_set->tile_get_shape_offset(c.id);
 					Matrix32 xform;
-					xform.set_origin(offset.floor()+shape_ofs);
+					xform.set_origin(offset.floor());
 					if (c.flip_h) {
 						xform.elements[0]=-xform.elements[0];
-						xform.elements[2].x+=s.x;
+						xform.elements[2].x+=s.x-shape_ofs.x;
+					} else {
+
+						xform.elements[2].x+=shape_ofs.x;
 					}
 					if (c.flip_v) {
 						xform.elements[1]=-xform.elements[1];
-						xform.elements[2].y+=s.y;
+						xform.elements[2].y+=s.y-shape_ofs.y;
+					} else {
+
+						xform.elements[2].y+=shape_ofs.y;
 					}
 
 
@@ -483,8 +495,9 @@ void TileMap::_set_tile_data(const DVector<int>& p_data) {
 		SWAP(local[4],local[7]);
 		SWAP(local[5],local[6]);
 #endif
-		int x = decode_uint16(&local[0]);
-		int y = decode_uint16(&local[2]);
+
+		int16_t x = decode_uint16(&local[0]);
+		int16_t y = decode_uint16(&local[2]);
 		uint32_t v = decode_uint32(&local[4]);
 		bool flip_h = v&(1<<29);
 		bool flip_v = v&(1<<30);
@@ -571,6 +584,8 @@ void TileMap::_bind_methods() {
 	ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"tile_set",PROPERTY_HINT_RESOURCE_TYPE,"TileSet"),_SCS("set_tileset"),_SCS("get_tileset"));
 	ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"tile_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_tile_data"),_SCS("_get_tile_data"));
 
+	ADD_SIGNAL(MethodInfo("settings_changed"));
+
 	BIND_CONSTANT( INVALID_CELL );
 }
 

+ 10 - 1
scene/main/viewport.cpp

@@ -67,16 +67,25 @@ bool RenderTargetTexture::has_alpha() const{
 
 void RenderTargetTexture::set_flags(uint32_t p_flags){
 
+	ERR_FAIL_COND(!vp);
+	if (p_flags&FLAG_FILTER)
+		flags=FLAG_FILTER;
+	else
+		flags=0;
+
+	VS::get_singleton()->texture_set_flags(vp->render_target_texture_rid,flags);
 
 }
+
 uint32_t RenderTargetTexture::get_flags() const{
 
-	return 0;
+	return flags;
 }
 
 RenderTargetTexture::RenderTargetTexture(Viewport *p_vp){
 
 	vp=p_vp;
+	flags=0;
 }
 
 

+ 1 - 0
scene/main/viewport.h

@@ -45,6 +45,7 @@ class RenderTargetTexture : public Texture {
 
 	OBJ_TYPE( RenderTargetTexture, Texture );
 
+	int flags;
 friend class Viewport;
 	Viewport *vp;
 

+ 2 - 2
servers/visual/visual_server_raster.cpp

@@ -1111,12 +1111,12 @@ void VisualServerRaster::viewport_set_render_target_update_mode(RID p_viewport,R
 	Viewport *viewport = viewport_owner.get( p_viewport );
 	ERR_FAIL_COND(!viewport);
 
-	if (viewport->update_list.in_list())
+	if (viewport->render_target.is_valid() && viewport->update_list.in_list())
 		viewport_update_list.remove(&viewport->update_list);
 
 	viewport->render_target_update_mode=p_mode;
 
-	if (viewport->render_target_update_mode!=RENDER_TARGET_UPDATE_DISABLED)
+	if (viewport->render_target.is_valid() &&viewport->render_target_update_mode!=RENDER_TARGET_UPDATE_DISABLED)
 		viewport_update_list.add(&viewport->update_list);
 
 }

+ 4 - 0
tools/editor/plugins/canvas_item_editor_plugin.cpp

@@ -2142,18 +2142,22 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
 	hb->add_child(lock_button);
 
 	lock_button->connect("pressed",this,"_popup_callback",varray(LOCK_SELECTED));
+	lock_button->set_tooltip("Lock the selected object in-place (can't be moved).");
 
 	unlock_button = memnew( ToolButton );
 	hb->add_child(unlock_button);
 	unlock_button->connect("pressed",this,"_popup_callback",varray(UNLOCK_SELECTED));
+	unlock_button->set_tooltip("Unlock the selected object (can be moved).");
 
 	group_button = memnew( ToolButton );
 	hb->add_child(group_button);
 	group_button->connect("pressed",this,"_popup_callback",varray(GROUP_SELECTED));
+	group_button->set_tooltip("Makes sure the object's' children are not selectable.");
 
 	ungroup_button = memnew( ToolButton );
 	hb->add_child(ungroup_button);
 	ungroup_button->connect("pressed",this,"_popup_callback",varray(UNGROUP_SELECTED));
+	ungroup_button->set_tooltip("Restores the object's' children ability to be selected.");
 
 	hb->add_child(memnew(VSeparator));
 

+ 12 - 10
tools/editor/plugins/collision_polygon_editor_plugin.cpp

@@ -120,7 +120,9 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
 
 
 			Vector2 gpoint = Point2(mb.x,mb.y);
-			Vector2 cpoint = xform.affine_inverse().xform(gpoint);
+			Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+			cpoint=snap_point(cpoint);
+			cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
 
 			Vector<Vector2> poly = node->get_polygon();
 
@@ -138,9 +140,9 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
 						if (!wip_active) {
 
 							wip.clear();
-							wip.push_back( snap_point(cpoint) );
+							wip.push_back( cpoint );
 							wip_active=true;
-							edited_point_pos=snap_point(cpoint);
+							edited_point_pos=cpoint;
 							canvas_item_editor->get_viewport_control()->update();
 							edited_point=1;
 							return true;
@@ -154,7 +156,7 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
 								return true;
 							} else {
 
-								wip.push_back( snap_point(cpoint) );
+								wip.push_back( cpoint );
 								edited_point=wip.size();
 								canvas_item_editor->get_viewport_control()->update();
 								return true;
@@ -216,9 +218,9 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
 								if (closest_idx>=0) {
 
 									pre_move_edit=poly;
-									poly.insert(closest_idx+1,snap_point(xform.affine_inverse().xform(closest_pos)));
+									poly.insert(closest_idx+1,xform.affine_inverse().xform(closest_pos));
 									edited_point=closest_idx+1;
-									edited_point_pos=snap_point(xform.affine_inverse().xform(closest_pos));
+									edited_point_pos=xform.affine_inverse().xform(closest_pos);
 									node->set_polygon(poly);
 									canvas_item_editor->get_viewport_control()->update();
 									return true;
@@ -320,11 +322,11 @@ bool CollisionPolygonEditor::forward_input_event(const InputEvent& p_event) {
 
 			if (edited_point!=-1 && (wip_active || mm.button_mask&BUTTON_MASK_LEFT)) {
 
-
-				Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
-
 				Vector2 gpoint = Point2(mm.x,mm.y);
-				edited_point_pos = snap_point(xform.affine_inverse().xform(gpoint));
+				Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
+				cpoint=snap_point(cpoint);
+				edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
+
 				canvas_item_editor->get_viewport_control()->update();
 
 			}

+ 70 - 13
tools/editor/plugins/tile_map_editor_plugin.cpp

@@ -74,7 +74,7 @@ int TileMapEditor::get_selected_tile() const {
 	return item->get_metadata(0);
 }
 
-void TileMapEditor::_set_cell(const Point2i& p_pos,int p_value,bool p_flip_h, bool p_flip_v) {
+void TileMapEditor::_set_cell(const Point2i& p_pos,int p_value,bool p_flip_h, bool p_flip_v,bool p_with_undo) {
 
 	ERR_FAIL_COND(!node);
 
@@ -85,15 +85,15 @@ void TileMapEditor::_set_cell(const Point2i& p_pos,int p_value,bool p_flip_h, bo
 	if (p_value==prev_val && p_flip_h==prev_flip_h && p_flip_v==prev_flip_v)
 		return; //check that it's actually different
 
-	node->set_cell(p_pos.x,p_pos.y,p_value,p_flip_h,p_flip_v);
 
-#if 0
-//not yet
-	undo_redo->create_action("Set Tile");
-	undo_redo->add_do_method(node,"set_cell",p_pos.x,p_pos.y,p_value,p_flip_h,p_flip_v);
-	undo_redo->add_undo_method(node,"set_cell",p_pos.x,p_pos.y,prev_val,prev_flip_h,prev_flip_v);
-	undo_redo->commit_action();
-#endif
+	if (p_with_undo) {
+		undo_redo->add_do_method(node,"set_cell",p_pos.x,p_pos.y,p_value,p_flip_h,p_flip_v);
+		undo_redo->add_undo_method(node,"set_cell",p_pos.x,p_pos.y,prev_val,prev_flip_h,prev_flip_v);
+	} else {
+
+		node->set_cell(p_pos.x,p_pos.y,p_value,p_flip_h,p_flip_v);
+
+	}
 
 }
 
@@ -199,11 +199,13 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) {
 						}
 					}
 
+					undo_redo->create_action("Duplicate");
 					for (List<_TileMapEditorCopyData>::Element *E=dupdata.front();E;E=E->next()) {
 
 
-						_set_cell(E->get().pos+ofs,E->get().cell,E->get().flip_h,E->get().flip_v);
+						_set_cell(E->get().pos+ofs,E->get().cell,E->get().flip_h,E->get().flip_v,true);
 					}
+					undo_redo->commit_action();
 
 					tool=TOOL_NONE;
 					canvas_item_editor->update();
@@ -258,6 +260,7 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) {
 								}
 
 								undo_redo->commit_action();
+								paint_undo.clear();
 							}
 						}
 						tool=TOOL_NONE;
@@ -276,12 +279,38 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) {
 
 					tool=TOOL_ERASING;
 					Point2i local =(xform_inv.xform(Point2(mb.x,mb.y))/snap).floor();
+					paint_undo.clear();
+					CellOp op;
+					op.idx = node->get_cell(local.x,local.y);
+					if (op.idx>=0) {
+						if (node->is_cell_x_flipped(local.x,local.y))
+							op.xf=true;
+						if (node->is_cell_y_flipped(local.x,local.y))
+							op.yf=true;
+					}
+					paint_undo[local]=op;
+					//node->set_cell(local.x,local.y,id,mirror_x->is_pressed(),mirror_y->is_pressed());
+					//return true;
 					_set_cell(local,TileMap::INVALID_CELL);
 					return true;
 				} else {
 
 					if (tool==TOOL_ERASING) {
 
+						if (paint_undo.size()) {
+							undo_redo->create_action("Erase TileMap");
+							for(Map<Point2i,CellOp>::Element *E=paint_undo.front();E;E=E->next()) {
+
+								Point2i p=E->key();
+								//undo_redo->add_do_method(node,"set_cell",p.x,p.y,node->get_cell(p.x,p.y),node->is_cell_x_flipped(p.x,p.y),node->is_cell_y_flipped(p.x,p.y));
+								_set_cell(p,TileMap::INVALID_CELL,false,false,true);
+								undo_redo->add_undo_method(node,"set_cell",p.x,p.y,E->get().idx,E->get().xf,E->get().yf);
+							}
+
+							undo_redo->commit_action();
+							paint_undo.clear();
+
+						}
 						tool=TOOL_NONE;
 						return true;
 					}
@@ -347,7 +376,20 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) {
 
 			}
 			if (tool==TOOL_ERASING) {
-				Point2i local =over_tile;
+				Point2i local =over_tile;				
+				if (!paint_undo.has(over_tile)) {
+
+					CellOp op;
+					op.idx = node->get_cell(over_tile.x,over_tile.y);
+					if (op.idx>=0) {
+						if (node->is_cell_x_flipped(over_tile.x,over_tile.y))
+							op.xf=true;
+						if (node->is_cell_y_flipped(over_tile.x,over_tile.y))
+							op.yf=true;
+					}
+					paint_undo[over_tile]=op;
+				}
+				//node->set_cell(over_tile.x,over_tile.y,id,mirror_x->is_pressed(),mirror_y->is_pressed());
 				_set_cell(local,TileMap::INVALID_CELL);
 				return true;
 			}
@@ -362,6 +404,7 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) {
 
 			if (k.pressed && k.scancode==KEY_DELETE && selection_active && tool==TOOL_NONE) {
 
+				undo_redo->create_action("Delete");
 				for(int i=selection.pos.y;i<=selection.pos.y+selection.size.y;i++) {
 
 					for(int j=selection.pos.x;j<=selection.pos.x+selection.size.x;j++) {
@@ -370,13 +413,14 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) {
 						_set_cell(Point2i(j,i),TileMap::INVALID_CELL);
 					}
 				}
+				undo_redo->commit_action();
 
 				selection_active=false;
 				canvas_item_editor->update();
 				return true;
 			}
 
-			if (mouse_over && k.pressed && k.scancode==KEY_A  && tool==TOOL_NONE) {
+			if (mouse_over && k.pressed && k.scancode==KEY_A  && tool==TOOL_NONE && !k.mod.command) {
 
 				/*int cell = node->get_cell(over_tile.x,over_tile.y);
 				if (cell!=TileMap::INVALID_CELL) {
@@ -389,7 +433,7 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) {
 				canvas_item_editor->update();
 				return true;
 			}
-			if (mouse_over && k.pressed && k.scancode==KEY_S  && tool==TOOL_NONE) {
+			if (mouse_over && k.pressed && k.scancode==KEY_S  && tool==TOOL_NONE && !k.mod.command) {
 
 
 				/*
@@ -550,6 +594,8 @@ void TileMapEditor::edit(Node *p_tile_map) {
 		canvas_item_editor=CanvasItemEditor::get_singleton()->get_viewport_control();
 	}
 
+	if (node)
+		node->disconnect("settings_changed",this,"_tileset_settings_changed");
 	if (p_tile_map) {
 
 		node=p_tile_map->cast_to<TileMap>();
@@ -575,7 +621,16 @@ void TileMapEditor::edit(Node *p_tile_map) {
 		_update_palette();
 	}
 
+	if (node)
+		node->connect("settings_changed",this,"_tileset_settings_changed");
+
+}
+
+void TileMapEditor::_tileset_settings_changed() {
 
+	_update_palette();
+	if (canvas_item_editor)
+		canvas_item_editor->update();
 }
 
 void TileMapEditor::_pane_drag(const Point2& p_to) {
@@ -597,11 +652,13 @@ void TileMapEditor::_bind_methods() {
 	ObjectTypeDB::bind_method(_MD("_pane_drag"),&TileMapEditor::_pane_drag);
 	ObjectTypeDB::bind_method(_MD("_canvas_mouse_enter"),&TileMapEditor::_canvas_mouse_enter);
 	ObjectTypeDB::bind_method(_MD("_canvas_mouse_exit"),&TileMapEditor::_canvas_mouse_exit);
+	ObjectTypeDB::bind_method(_MD("_tileset_settings_changed"),&TileMapEditor::_tileset_settings_changed);
 
 }
 
 TileMapEditor::TileMapEditor(EditorNode *p_editor) {
 
+	node=NULL;
 	canvas_item_editor=NULL;
 	editor=p_editor;
 	undo_redo = editor->get_undo_redo();

+ 2 - 1
tools/editor/plugins/tile_map_editor_plugin.h

@@ -92,10 +92,11 @@ class TileMapEditor : public HBoxContainer {
 	void _canvas_draw();
 	void _menu_option(int p_option);
 
-	void _set_cell(const Point2i& p_pos,int p_value,bool p_flip_h=false, bool p_flip_v=false);
+	void _set_cell(const Point2i& p_pos, int p_value, bool p_flip_h=false, bool p_flip_v=false, bool p_with_undo=false);
 
 	void _canvas_mouse_enter();
 	void _canvas_mouse_exit();
+	void _tileset_settings_changed();
 
 
 friend class TileMapEditorPlugin;

+ 16 - 2
tools/editor/plugins/tile_set_editor_plugin.cpp

@@ -72,8 +72,16 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me
 
 
 	       p_library->tile_set_texture(id,texture);
+	       Vector2 phys_offset = mi->get_offset();
+
 	       if (mi->is_centered()) {
-		       p_library->tile_set_texture_offset(id,texture->get_size()/2);
+		       Size2 s;
+		       if (mi->is_region()) {
+			       s=mi->get_region_rect().size;
+		       } else {
+			       s=texture->get_size();
+		       }
+		       phys_offset+=-s/2;
 	       }
 	       if (mi->is_region()) {
 		       p_library->tile_set_region(id,mi->get_region_rect());
@@ -90,15 +98,21 @@ void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_me
 		       if (sb->get_shape_count()==0)
 			       continue;
 		       Ref<Shape2D> collision=sb->get_shape(0);
-		       if (collision.is_valid())
+		       if (collision.is_valid()) {
 			       collisions.push_back(collision);
+			}
 	       }
 
 	       if (collisions.size()) {
 
 		       p_library->tile_set_shapes(id,collisions);
+		       p_library->tile_set_shape_offset(id,-phys_offset);
+	       } else {
+		       p_library->tile_set_shape_offset(id,Vector2());
+
 	       }
 
+	       p_library->tile_set_texture_offset(id,Vector2());
 	}
 }
 

+ 5 - 2
tools/editor/scene_tree_editor.cpp

@@ -398,6 +398,7 @@ void SceneTreeEditor::_notification(int p_what) {
 		get_scene()->disconnect("node_removed",this,"_node_removed");
 		_update_tree();
 	}
+
 }
 
 
@@ -699,10 +700,12 @@ void SceneTreeDialog::_notification(int p_what) {
 		get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
 	}
 
-	if (p_what==NOTIFICATION_POST_POPUP) {
-
+	if (p_what==NOTIFICATION_VISIBILITY_CHANGED && is_visible()) {
 
+		tree->update_tree();
 	}
+
+
 }
 
 void SceneTreeDialog::_cancel() {

+ 2 - 0
tools/editor/scene_tree_editor.h

@@ -110,6 +110,8 @@ public:
 	void set_can_rename(bool p_can_rename) { can_rename=p_can_rename; }
 	void set_editor_selection(EditorSelection *p_selection);
 
+	void update_tree() { _update_tree(); }
+
 	SceneTreeEditor(bool p_label=true,bool p_can_rename=false, bool p_can_open_instance=false);
 	~SceneTreeEditor();
 

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.