summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--SConstruct23
-rw-r--r--bin/tests/test_string.cpp31
-rw-r--r--core/bind/core_bind.cpp52
-rw-r--r--core/bind/core_bind.h1
-rw-r--r--core/image.cpp17
-rw-r--r--core/image.h3
-rw-r--r--core/io/compression.cpp4
-rw-r--r--core/io/resource_format_binary.cpp9
-rw-r--r--core/io/resource_format_xml.cpp9
-rw-r--r--core/io/resource_loader.cpp2
-rw-r--r--core/os/memory_pool_dynamic_static.h2
-rw-r--r--core/ustring.cpp8
-rw-r--r--core/variant_call.cpp3
-rw-r--r--demos/2d/platformer/engine.cfg4
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp148
-rw-r--r--drivers/gles2/rasterizer_gles2.h3
-rw-r--r--makefile30
-rw-r--r--modules/gdscript/gd_parser.cpp1
-rw-r--r--platform/android/java/src/com/android/godot/Godot.java35
-rw-r--r--platform/android/java/src/com/android/godot/GodotLib.java2
-rw-r--r--platform/android/java_glue.cpp271
-rw-r--r--platform/android/java_glue.h2
-rw-r--r--platform/windows/detect.py4
-rw-r--r--platform/windows/godot_win.cpp30
-rw-r--r--platform/windows/os_windows.cpp22
-rw-r--r--platform/x11/detect.py3
-rw-r--r--platform/x11/os_x11.cpp9
-rw-r--r--platform/x11/platform_config.h6
-rw-r--r--scene/2d/node_2d.cpp4
-rw-r--r--scene/gui/line_edit.cpp7
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--scene/main/node.cpp2
-rw-r--r--scene/main/viewport.cpp27
-rw-r--r--scene/main/viewport.h2
-rw-r--r--servers/physics/space_sw.cpp69
-rw-r--r--servers/physics/space_sw.h64
-rw-r--r--tools/editor/editor_import_export.cpp22
-rw-r--r--tools/editor/editor_import_export.h4
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/editor_node.h2
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp23
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp3
-rw-r--r--tools/editor/project_export.cpp14
-rw-r--r--tools/editor/project_export.h3
-rw-r--r--tools/editor/property_editor.cpp53
-rw-r--r--tools/editor/property_editor.h2
-rw-r--r--tools/editor/scene_tree_editor.cpp3
-rw-r--r--tools/editor/scenes_dock.cpp2
50 files changed, 914 insertions, 141 deletions
diff --git a/.gitignore b/.gitignore
index 96f7a6ea91..9cf3ab38b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -116,6 +116,11 @@ ipch/
*.vsp
*.vspx
+# CodeLite project files
+*.project
+*.workspace
+.codelite/
+
# TFS 2012 Local Workspace
$tf/
@@ -201,6 +206,9 @@ ClientBin/
*.publishsettings
node_modules/
+# KDE
+.directory
+
# RIA/Silverlight projects
Generated_Code/
@@ -236,3 +244,4 @@ Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
+logo.h
diff --git a/SConstruct b/SConstruct
index 93e48a069f..a9739ca604 100644
--- a/SConstruct
+++ b/SConstruct
@@ -6,6 +6,16 @@ import os.path
import glob
import sys
import methods
+import multiprocessing
+
+# Enable aggresive compile mode if building on a multi core box
+# only is we have not set the number of jobs already or we do
+# not want it
+if ARGUMENTS.get('spawn_jobs', 'yes') == 'yes' and \
+ int(GetOption('num_jobs')) <= 1:
+ NUM_JOBS = multiprocessing.cpu_count()
+ if NUM_JOBS > 1:
+ SetOption('num_jobs', NUM_JOBS+1)
methods.update_version()
@@ -88,7 +98,7 @@ if profile:
elif os.path.isfile(profile+".py"):
customs.append(profile+".py")
-opts=Options(customs, ARGUMENTS)
+opts=Variables(customs, ARGUMENTS)
opts.Add('target', 'Compile Target (debug/profile/release).', "debug")
opts.Add('platform','Platform: '+str(platform_list)+'(sfml).',"")
opts.Add('python','Build Python Support: (yes/no)','no')
@@ -173,6 +183,17 @@ for p in platform_list:
env['CCFLAGS'] = ''
env.Append(CCFLAGS=string.split(str(CCFLAGS)))
+
+ CFLAGS = env.get('CFLAGS', '')
+ env['CFLAGS'] = ''
+
+ env.Append(CFLAGS=string.split(str(CFLAGS)))
+
+ LINKFLAGS = env.get('LINKFLAGS', '')
+ env['LINKFLAGS'] = ''
+
+ env.Append(LINKFLAGS=string.split(str(LINKFLAGS)))
+
detect.configure(env)
env['platform'] = p
if not env.has_key('platform_libsuffix'):
diff --git a/bin/tests/test_string.cpp b/bin/tests/test_string.cpp
index 78fb9a9ddb..66238b066d 100644
--- a/bin/tests/test_string.cpp
+++ b/bin/tests/test_string.cpp
@@ -479,6 +479,36 @@ bool test_26() {
return captures.size();
};
+struct test_27_data {
+ char const * data;
+ char const * begin;
+ bool expected;
+};
+
+bool test_27() {
+
+ OS::get_singleton()->print("\n\nTest 26: begins_with\n");
+ test_27_data tc[] = {
+ {"res://foobar", "res://", true},
+ {"res", "res://", false},
+ {"abc", "abc", true}
+ };
+ size_t count = sizeof(tc) / sizeof(tc[0]);
+ bool state = true;
+ for (size_t i = 0;state && i < count; ++i) {
+ String s = tc[i].data;
+ state = s.begins_with(tc[i].begin) == tc[i].expected;
+ if (state) {
+ String sb = tc[i].begin;
+ state = s.begins_with(sb) == tc[i].expected;
+ }
+ if (!state) {
+ OS::get_singleton()->print("\n\t Failure on:\n\t\tstring: ", tc[i].data, "\n\t\tbegin: ", tc[i].begin, "\n\t\texpected: ", tc[i].expected ? "true" : "false", "\n");
+ }
+ };
+ return state;
+};
+
typedef bool (*TestFunc)(void);
TestFunc test_funcs[] = {
@@ -509,6 +539,7 @@ TestFunc test_funcs[] = {
test_24,
test_25,
test_26,
+ test_27,
0
};
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 61209ecb90..73f6f753b9 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -413,6 +413,56 @@ void _OS::dump_memory_to_file(const String& p_file) {
OS::get_singleton()->dump_memory_to_file(p_file.utf8().get_data());
}
+struct _OSCoreBindImg {
+
+ String path;
+ Size2 size;
+ int fmt;
+ ObjectID id;
+ int vram;
+ bool operator<(const _OSCoreBindImg& p_img) const { return vram==p_img.vram ? id<p_img.id : vram > p_img.vram; }
+};
+
+void _OS::print_all_textures_by_size() {
+
+
+ List<_OSCoreBindImg> imgs;
+ int total=0;
+ {
+ List<Ref<Resource> > rsrc;
+ ResourceCache::get_cached_resources(&rsrc);
+
+ for (List<Ref<Resource> >::Element *E=rsrc.front();E;E=E->next()) {
+
+ if (!E->get()->is_type("ImageTexture"))
+ continue;
+
+ Size2 size = E->get()->call("get_size");
+ int fmt = E->get()->call("get_format");
+
+ _OSCoreBindImg img;
+ img.size=size;
+ img.fmt=fmt;
+ img.path=E->get()->get_path();
+ img.vram=Image::get_image_data_size(img.size.width,img.size.height,Image::Format(img.fmt));
+ img.id=E->get()->get_instance_ID();
+ total+=img.vram;
+ imgs.push_back(img);
+ }
+ }
+
+ imgs.sort();
+
+ for(List<_OSCoreBindImg>::Element *E=imgs.front();E;E=E->next()) {
+
+ print_line(E->get().path+" - "+String::humanize_size(E->get().vram)+" ("+E->get().size+") - total:"+String::humanize_size(total) );
+ total-=E->get().vram;
+ }
+
+
+
+}
+
void _OS::print_all_resources(const String& p_to_file ) {
OS::get_singleton()->print_all_resources(p_to_file);
@@ -516,6 +566,8 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second);
+ ObjectTypeDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size);
+
BIND_CONSTANT( DAY_SUNDAY );
BIND_CONSTANT( DAY_MONDAY );
BIND_CONSTANT( DAY_TUESDAY );
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index e47c9c434a..9545fc65fb 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -128,6 +128,7 @@ public:
void print_resources_in_use(bool p_short=false);
void print_all_resources(const String& p_to_file);
+ void print_all_textures_by_size();
bool has_touchscreen_ui_hint() const;
diff --git a/core/image.cpp b/core/image.cpp
index a9485feff2..ccabd04d6f 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -1260,6 +1260,12 @@ int Image::get_format_pixel_size(Format p_format) {
return 1;
} break;
+ case FORMAT_ATC:
+ case FORMAT_ATC_ALPHA_EXPLICIT:
+ case FORMAT_ATC_ALPHA_INTERPOLATED: {
+
+ return 1;
+ } break;
case FORMAT_ETC: {
return 1;
@@ -1323,6 +1329,15 @@ void Image::_get_format_min_data_size(Format p_format,int &r_w, int &r_h) {
r_w=8;
r_h=8;
} break;
+ case FORMAT_ATC:
+ case FORMAT_ATC_ALPHA_EXPLICIT:
+ case FORMAT_ATC_ALPHA_INTERPOLATED: {
+
+ r_w=8;
+ r_h=8;
+
+ } break;
+
case FORMAT_ETC: {
r_w=4;
@@ -1339,7 +1354,7 @@ void Image::_get_format_min_data_size(Format p_format,int &r_w, int &r_h) {
int Image::get_format_pixel_rshift(Format p_format) {
- if (p_format==FORMAT_BC1 || p_format==FORMAT_BC4 || p_format==FORMAT_PVRTC4 || p_format==FORMAT_PVRTC4_ALPHA || p_format==FORMAT_ETC)
+ if (p_format==FORMAT_BC1 || p_format==FORMAT_BC4 || p_format==FORMAT_ATC || p_format==FORMAT_PVRTC4 || p_format==FORMAT_PVRTC4_ALPHA || p_format==FORMAT_ETC)
return 1;
else if (p_format==FORMAT_PVRTC2 || p_format==FORMAT_PVRTC2_ALPHA)
return 2;
diff --git a/core/image.h b/core/image.h
index 4ab2870c23..186aceb1bf 100644
--- a/core/image.h
+++ b/core/image.h
@@ -70,6 +70,9 @@ public:
FORMAT_PVRTC4,
FORMAT_PVRTC4_ALPHA,
FORMAT_ETC, // regular ETC, no transparency
+ FORMAT_ATC,
+ FORMAT_ATC_ALPHA_EXPLICIT,
+ FORMAT_ATC_ALPHA_INTERPOLATED,
/*FORMAT_ETC2_R, for the future..
FORMAT_ETC2_RG,
FORMAT_ETC2_RGB,
diff --git a/core/io/compression.cpp b/core/io/compression.cpp
index 67ba5de0fa..ea2f5d2d9c 100644
--- a/core/io/compression.cpp
+++ b/core/io/compression.cpp
@@ -55,7 +55,7 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,M
strm.zfree = zipio_free;
strm.opaque = Z_NULL;
int err = deflateInit(&strm,Z_DEFAULT_COMPRESSION);
- if (err==Z_OK)
+ if (err!=Z_OK)
return -1;
strm.avail_in=p_src_size;
@@ -93,7 +93,7 @@ int Compression::get_max_compressed_buffer_size(int p_src_size,Mode p_mode){
strm.zfree = zipio_free;
strm.opaque = Z_NULL;
int err = deflateInit(&strm,Z_DEFAULT_COMPRESSION);
- if (err==Z_OK)
+ if (err!=Z_OK)
return -1;
int aout = deflateBound(&strm,p_src_size);
deflateEnd(&strm);
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index d2461498a6..c54398935e 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -90,6 +90,9 @@ enum {
IMAGE_FORMAT_PVRTC4=14,
IMAGE_FORMAT_PVRTC4_ALPHA=15,
IMAGE_FORMAT_ETC=16,
+ IMAGE_FORMAT_ATC=17,
+ IMAGE_FORMAT_ATC_ALPHA_EXPLICIT=18,
+ IMAGE_FORMAT_ATC_ALPHA_INTERPOLATED=19,
IMAGE_FORMAT_CUSTOM=30,
@@ -283,6 +286,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant& r_v) {
case IMAGE_FORMAT_PVRTC4: { fmt=Image::FORMAT_PVRTC4; } break;
case IMAGE_FORMAT_PVRTC4_ALPHA: { fmt=Image::FORMAT_PVRTC4_ALPHA; } break;
case IMAGE_FORMAT_ETC: { fmt=Image::FORMAT_ETC; } break;
+ case IMAGE_FORMAT_ATC: { fmt=Image::FORMAT_ATC; } break;
+ case IMAGE_FORMAT_ATC_ALPHA_EXPLICIT: { fmt=Image::FORMAT_ATC_ALPHA_EXPLICIT; } break;
+ case IMAGE_FORMAT_ATC_ALPHA_INTERPOLATED: { fmt=Image::FORMAT_ATC_ALPHA_INTERPOLATED; } break;
case IMAGE_FORMAT_CUSTOM: { fmt=Image::FORMAT_CUSTOM; } break;
default: {
@@ -1335,6 +1341,9 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
case Image::FORMAT_PVRTC4: f->store_32(IMAGE_FORMAT_PVRTC4 ); break;
case Image::FORMAT_PVRTC4_ALPHA: f->store_32(IMAGE_FORMAT_PVRTC4_ALPHA ); break;
case Image::FORMAT_ETC: f->store_32(IMAGE_FORMAT_ETC); break;
+ case Image::FORMAT_ATC: f->store_32(IMAGE_FORMAT_ATC); break;
+ case Image::FORMAT_ATC_ALPHA_EXPLICIT: f->store_32(IMAGE_FORMAT_ATC_ALPHA_EXPLICIT); break;
+ case Image::FORMAT_ATC_ALPHA_INTERPOLATED: f->store_32(IMAGE_FORMAT_ATC_ALPHA_INTERPOLATED); break;
case Image::FORMAT_CUSTOM: f->store_32(IMAGE_FORMAT_CUSTOM ); break;
default: {}
diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp
index bd8e46556c..fc5aecfd99 100644
--- a/core/io/resource_format_xml.cpp
+++ b/core/io/resource_format_xml.cpp
@@ -551,6 +551,12 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name)
imgformat=Image::FORMAT_PVRTC4_ALPHA;
} else if (format=="etc") {
imgformat=Image::FORMAT_ETC;
+ } else if (format=="atc") {
+ imgformat=Image::FORMAT_ATC;
+ } else if (format=="atcai") {
+ imgformat=Image::FORMAT_ATC_ALPHA_INTERPOLATED;
+ } else if (format=="atcae") {
+ imgformat=Image::FORMAT_ATC_ALPHA_EXPLICIT;
} else if (format=="custom") {
imgformat=Image::FORMAT_CUSTOM;
} else {
@@ -1937,6 +1943,9 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
case Image::FORMAT_PVRTC4: params+=" format=\"pvrtc4\""; break;
case Image::FORMAT_PVRTC4_ALPHA: params+=" format=\"pvrtc4a\""; break;
case Image::FORMAT_ETC: params+=" format=\"etc\""; break;
+ case Image::FORMAT_ATC: params+=" format=\"atc\""; break;
+ case Image::FORMAT_ATC_ALPHA_EXPLICIT: params+=" format=\"atcae\""; break;
+ case Image::FORMAT_ATC_ALPHA_INTERPOLATED: params+=" format=\"atcai\""; break;
case Image::FORMAT_CUSTOM: params+=" format=\"custom\" custom_size=\""+itos(img.get_data().size())+"\""; break;
default: {}
}
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 13dac6ed16..5ee48bae25 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -192,7 +192,7 @@ RES ResourceLoader::load(const String &p_path,const String& p_type_hint,bool p_n
res->set_last_modified_time(mt);
}
#endif
- print_line("LOADED: "+res->get_path());
+
return res;
}
diff --git a/core/os/memory_pool_dynamic_static.h b/core/os/memory_pool_dynamic_static.h
index ce038bc00a..d10cdb3d0a 100644
--- a/core/os/memory_pool_dynamic_static.h
+++ b/core/os/memory_pool_dynamic_static.h
@@ -38,7 +38,7 @@ class MemoryPoolDynamicStatic : public MemoryPoolDynamic {
_THREAD_SAFE_CLASS_
enum {
- MAX_CHUNKS=16384
+ MAX_CHUNKS=65536
};
diff --git a/core/ustring.cpp b/core/ustring.cpp
index b0f06c6ab6..2384ce5bd6 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2491,19 +2491,21 @@ bool String::begins_with(const String& p_string) const {
const CharType *src=&p_string[0];
const CharType *str=&operator[](0);
- for (int i=0;i<l;i++) {
+ int i = 0;
+ for (;i<l;i++) {
if (src[i]!=str[i])
return false;
}
- return true;
+ // only if i == l the p_string matches the beginning
+ return i == l;
}
bool String::begins_with(const char* p_string) const {
int l=length();
- if (l==0)
+ if (l==0||!p_string)
return false;
const CharType *str=&operator[](0);
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 846b924a42..be1b0eb3d3 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1487,6 +1487,9 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
_VariantCall::constant_data[Variant::IMAGE].value["FORMAT_PVRTC4"]=Image::FORMAT_PVRTC4;
_VariantCall::constant_data[Variant::IMAGE].value["FORMAT_PVRTC4_ALPHA"]=Image::FORMAT_PVRTC4_ALPHA;
_VariantCall::constant_data[Variant::IMAGE].value["FORMAT_ETC"]=Image::FORMAT_ETC;
+ _VariantCall::constant_data[Variant::IMAGE].value["FORMAT_ATC"]=Image::FORMAT_ATC;
+ _VariantCall::constant_data[Variant::IMAGE].value["FORMAT_ATC_ALPHA_EXPLICIT"]=Image::FORMAT_ATC_ALPHA_EXPLICIT;
+ _VariantCall::constant_data[Variant::IMAGE].value["FORMAT_ATC_ALPHA_INTERPOLATED"]=Image::FORMAT_ATC_ALPHA_INTERPOLATED;
_VariantCall::constant_data[Variant::IMAGE].value["FORMAT_CUSTOM"]=Image::FORMAT_CUSTOM;
}
diff --git a/demos/2d/platformer/engine.cfg b/demos/2d/platformer/engine.cfg
index 0ca951ed00..5fc2c3b2ba 100644
--- a/demos/2d/platformer/engine.cfg
+++ b/demos/2d/platformer/engine.cfg
@@ -26,3 +26,7 @@ default_gravity=700
[render]
mipmap_policy=1
+
+[texture_import]
+
+filter=false
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index d29ecd64bb..5be6045d50 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -303,6 +303,11 @@ void RasterizerGLES2::_draw_primitive(int p_points, const Vector3 *p_vertices, c
#define _EXT_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
#define _EXT_ETC1_RGB8_OES 0x8D64
+#define _EXT_ATC_RGB_AMD 0x8C92
+#define _EXT_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define _EXT_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+
+
/* TEXTURE API */
Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::Format p_format, uint32_t p_flags,GLenum& r_gl_format,int &r_gl_components,bool &r_has_alpha_cache,bool &r_compressed) {
@@ -394,6 +399,7 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For
} break;
case Image::FORMAT_BC5: {
+
r_gl_format=_EXT_COMPRESSED_RG_RGTC2;
r_gl_components=1; //doesn't matter much
r_compressed=true;
@@ -492,6 +498,63 @@ Image RasterizerGLES2::_get_gl_image_and_format(const Image& p_image, Image::For
}
} break;
+ case Image::FORMAT_ATC: {
+
+ if (!atitc_supported) {
+
+ if (!image.empty()) {
+ image.decompress();
+ }
+ r_gl_components=3;
+ r_gl_format=GL_RGB;
+
+
+ } else {
+
+ r_gl_format=_EXT_ATC_RGB_AMD;
+ r_gl_components=1; //doesn't matter much
+ r_compressed=true;
+ }
+
+ } break;
+ case Image::FORMAT_ATC_ALPHA_EXPLICIT: {
+
+ if (!atitc_supported) {
+
+ if (!image.empty()) {
+ image.decompress();
+ }
+ r_gl_components=4;
+ r_gl_format=GL_RGBA;
+
+
+ } else {
+
+ r_gl_format=_EXT_ATC_RGBA_EXPLICIT_ALPHA_AMD;
+ r_gl_components=1; //doesn't matter much
+ r_compressed=true;
+ }
+
+ } break;
+ case Image::FORMAT_ATC_ALPHA_INTERPOLATED: {
+
+ if (!atitc_supported) {
+
+ if (!image.empty()) {
+ image.decompress();
+ }
+ r_gl_components=4;
+ r_gl_format=GL_RGBA;
+
+
+ } else {
+
+ r_gl_format=_EXT_ATC_RGBA_INTERPOLATED_ALPHA_AMD;
+ r_gl_components=1; //doesn't matter much
+ r_compressed=true;
+ }
+
+ } break;
case Image::FORMAT_YUV_422:
case Image::FORMAT_YUV_444: {
@@ -557,7 +620,9 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I
texture->flags=p_flags;
texture->target = (p_flags & VS::TEXTURE_FLAG_CUBEMAP) ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
- bool scale_textures = !(p_flags&VS::TEXTURE_FLAG_VIDEO_SURFACE) && (!npo2_textures_available || p_flags&VS::TEXTURE_FLAG_MIPMAPS);
+ _get_gl_image_and_format(Image(),texture->format,texture->flags,format,components,has_alpha_cache,compressed);
+
+ bool scale_textures = !compressed && !(p_flags&VS::TEXTURE_FLAG_VIDEO_SURFACE) && (!npo2_textures_available || p_flags&VS::TEXTURE_FLAG_MIPMAPS);
if (scale_textures) {
@@ -570,7 +635,6 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I
texture->alloc_height = texture->height;
};
- _get_gl_image_and_format(Image(),texture->format,texture->flags,format,components,has_alpha_cache,compressed);
texture->gl_components_cache=components;
texture->gl_format_cache=format;
@@ -584,32 +648,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I
glBindTexture(texture->target, texture->tex_id);
- if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS)
- glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR);
- else
- glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
- if (texture->flags&VS::TEXTURE_FLAG_FILTER) {
-
- glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering
-
- } else {
-
- glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_NEAREST); // raw Filtering
- }
-
- bool force_clamp_to_edge = !(p_flags&VS::TEXTURE_FLAG_MIPMAPS) && (nearest_power_of_2(texture->alloc_height)!=texture->alloc_height || nearest_power_of_2(texture->alloc_width)!=texture->alloc_width);
-
- if (!force_clamp_to_edge && texture->flags&VS::TEXTURE_FLAG_REPEAT && texture->target != GL_TEXTURE_CUBE_MAP) {
-
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- } else {
-
- //glTexParameterf( texture->target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE );
- glTexParameterf( texture->target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
- glTexParameterf( texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
- }
if (p_flags&VS::TEXTURE_FLAG_VIDEO_SURFACE) {
//prealloc if video
@@ -652,6 +691,8 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu
texture->has_alpha=true;
}
+
+
GLenum blit_target = (texture->target == GL_TEXTURE_CUBE_MAP)?_cube_side_enum[p_cube_side]:GL_TEXTURE_2D;
texture->data_size=img.get_data().size();
@@ -660,6 +701,35 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu
glActiveTexture(GL_TEXTURE0);
glBindTexture(texture->target, texture->tex_id);
+ texture->ignore_mipmaps = compressed && img.get_mipmaps()==0;
+
+ if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps)
+ glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR);
+ else
+ glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+
+ if (texture->flags&VS::TEXTURE_FLAG_FILTER) {
+
+ glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering
+
+ } else {
+
+ glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_NEAREST); // raw Filtering
+ }
+
+ bool force_clamp_to_edge = !(texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) && (nearest_power_of_2(texture->alloc_height)!=texture->alloc_height || nearest_power_of_2(texture->alloc_width)!=texture->alloc_width);
+
+ if (!force_clamp_to_edge && texture->flags&VS::TEXTURE_FLAG_REPEAT && texture->target != GL_TEXTURE_CUBE_MAP) {
+
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
+ } else {
+
+ //glTexParameterf( texture->target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE );
+ glTexParameterf( texture->target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
+ glTexParameterf( texture->target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
+ }
+
int mipmaps= (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && img.get_mipmaps()>0) ? img.get_mipmaps() +1 : 1;
@@ -699,7 +769,7 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu
//printf("texture: %i x %i - size: %i - total: %i\n",texture->width,texture->height,tsize,_rinfo.texture_mem);
- if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && mipmaps==1) {
+ if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && mipmaps==1 && !texture->ignore_mipmaps) {
//generate mipmaps if they were requested and the image does not contain them
glGenerateMipmap(texture->target);
}
@@ -889,7 +959,7 @@ void RasterizerGLES2::texture_set_flags(RID p_texture,uint32_t p_flags) {
uint32_t cube = texture->flags & VS::TEXTURE_FLAG_CUBEMAP;
texture->flags=p_flags|cube; // can't remove a cube from being a cube
- bool force_clamp_to_edge = !(p_flags&VS::TEXTURE_FLAG_MIPMAPS) && (nearest_power_of_2(texture->alloc_height)!=texture->alloc_height || nearest_power_of_2(texture->alloc_width)!=texture->alloc_width);
+ bool force_clamp_to_edge = !(p_flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps) && (nearest_power_of_2(texture->alloc_height)!=texture->alloc_height || nearest_power_of_2(texture->alloc_width)!=texture->alloc_width);
if (!force_clamp_to_edge && texture->flags&VS::TEXTURE_FLAG_REPEAT && texture->target != GL_TEXTURE_CUBE_MAP) {
@@ -903,17 +973,18 @@ void RasterizerGLES2::texture_set_flags(RID p_texture,uint32_t p_flags) {
}
+ if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps)
+ glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR);
+ else
+ glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+
if (texture->flags&VS::TEXTURE_FLAG_FILTER) {
glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering
- if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS)
- glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR);
- else
- glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear Filtering
} else {
- glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_NEAREST); // nearest
+ glTexParameteri(texture->target,GL_TEXTURE_MAG_FILTER,GL_NEAREST); // raw Filtering
}
}
uint32_t RasterizerGLES2::texture_get_flags(RID p_texture) const {
@@ -7493,6 +7564,7 @@ void RasterizerGLES2::init() {
etc_supported=false;
use_depth24 =true;
s3tc_supported = true;
+ atitc_supported = false;
use_hw_skeleton_xform = false;
// use_texture_instancing=false;
// use_attribute_instancing=true;
@@ -7506,6 +7578,10 @@ void RasterizerGLES2::init() {
use_half_float=true;
#else
+
+ for (Set<String>::Element *E=extensions.front();E;E=E->next()) {
+ print_line(E->get());
+ }
read_depth_supported=extensions.has("GL_OES_depth_texture");
use_rgba_shadowmaps=!read_depth_supported;
pvr_supported=extensions.has("GL_IMG_texture_compression_pvrtc");
@@ -7513,7 +7589,9 @@ void RasterizerGLES2::init() {
use_depth24 = extensions.has("GL_OES_depth24");
s3tc_supported = extensions.has("GL_EXT_texture_compression_dxt1") || extensions.has("GL_EXT_texture_compression_s3tc") || extensions.has("WEBGL_compressed_texture_s3tc");
use_half_float = extensions.has("GL_OES_vertex_half_float");
+ atitc_supported=extensions.has("GL_AMD_compressed_ATC_texture");
+ print_line("S3TC: "+itos(s3tc_supported)+" ATITC: "+itos(atitc_supported));
GLint vtf;
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS,&vtf);
@@ -7885,6 +7963,7 @@ RasterizerGLES2::RasterizerGLES2(bool p_compress_arrays,bool p_keep_ram_copy,boo
use_fast_texture_filter=GLOBAL_DEF("rasterizer/trilinear_mipmap_filter",true);
skel_default.resize(1024*4);
for(int i=0;i<1024/3;i++) {
+
float * ptr = skel_default.ptr();
ptr+=i*4*4;
ptr[0]=1.0;
@@ -7901,7 +7980,6 @@ RasterizerGLES2::RasterizerGLES2(bool p_compress_arrays,bool p_keep_ram_copy,boo
ptr[9]=0.0;
ptr[10]=1.0;
ptr[12]=0.0;
-
}
base_framebuffer=0;
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index bab560dddb..52c4c8d681 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -75,6 +75,7 @@ class RasterizerGLES2 : public Rasterizer {
bool pvr_supported;
bool s3tc_supported;
bool etc_supported;
+ bool atitc_supported;
bool npo2_textures_available;
bool read_depth_supported;
bool use_framebuffers;
@@ -111,6 +112,7 @@ class RasterizerGLES2 : public Rasterizer {
bool compressed;
bool disallow_mipmaps;
int total_data_size;
+ bool ignore_mipmaps;
ObjectID reloader;
StringName reloader_func;
@@ -123,6 +125,7 @@ class RasterizerGLES2 : public Rasterizer {
Texture() {
+ ignore_mipmaps=false;
render_target=NULL;
flags=width=height=0;
tex_id=0;
diff --git a/makefile b/makefile
new file mode 100644
index 0000000000..d24bd0cd32
--- /dev/null
+++ b/makefile
@@ -0,0 +1,30 @@
+#*************************************************************************/
+#* This file is part of: */
+#* GODOT ENGINE */
+#* http://www.godotengine.org */
+#*************************************************************************/
+# Simple makefile to give support for external C/C++ IDEs */
+#*************************************************************************/
+
+# Default build
+all: debug
+
+# Release Build
+release:
+ scons target="release" bin/godot
+
+# Profile Build
+profile:
+ scons target="profile" bin/godot
+
+# Debug Build
+debug:
+ # Debug information (code size gets severely affected):
+ # g: Default (same as g2)
+ # g0: no debug info
+ # g1: minimal info
+ # g3: maximal info
+ scons target="debug" CCFLAGS="-g" bin/godot
+
+clean:
+ scons -c bin/godot
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index fb4f56aa8f..f962f8c5fb 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -215,6 +215,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
String path = tokenizer->get_token_constant();
if (!path.is_abs_path() && base_path!="")
path=base_path+"/"+path;
+ path = path.replace("///","//");
Ref<Resource> res = ResourceLoader::load(path);
if (!res.is_valid()) {
diff --git a/platform/android/java/src/com/android/godot/Godot.java b/platform/android/java/src/com/android/godot/Godot.java
index cf1545df82..5260f6149c 100644
--- a/platform/android/java/src/com/android/godot/Godot.java
+++ b/platform/android/java/src/com/android/godot/Godot.java
@@ -283,13 +283,44 @@ public class Godot extends Activity implements SensorEventListener
return true;
}
+ @Override public boolean onKeyMultiple(final int inKeyCode, int repeatCount, KeyEvent event) {
+ String s = event.getCharacters();
+ if (s == null || s.length() == 0)
+ return super.onKeyMultiple(inKeyCode, repeatCount, event);
+
+ final char[] cc = s.toCharArray();
+ int cnt = 0;
+ for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0);
+ if (cnt == 0) return super.onKeyMultiple(inKeyCode, repeatCount, event);
+ final Activity me = this;
+ queueEvent(new Runnable() {
+ // This method will be called on the rendering thread:
+ public void run() {
+ for (int i = 0, n = cc.length; i < n; i++) {
+ int keyCode;
+ if ((keyCode = cc[i]) != 0) {
+ // Simulate key down and up...
+ GodotLib.key(0, keyCode, true);
+ GodotLib.key(0, keyCode, false);
+ }
+ }
+ }
+ });
+ return true;
+ }
+
+ private void queueEvent(Runnable runnable) {
+ // TODO Auto-generated method stub
+
+ }
+
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
- GodotLib.key(event.getUnicodeChar(0), false);
+ GodotLib.key(keyCode, event.getUnicodeChar(0), false);
return super.onKeyUp(keyCode, event);
};
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
- GodotLib.key(event.getUnicodeChar(0), true);
+ GodotLib.key(keyCode, event.getUnicodeChar(0), true);
return super.onKeyDown(keyCode, event);
};
diff --git a/platform/android/java/src/com/android/godot/GodotLib.java b/platform/android/java/src/com/android/godot/GodotLib.java
index f0ec3e97c6..4e6374ed4f 100644
--- a/platform/android/java/src/com/android/godot/GodotLib.java
+++ b/platform/android/java/src/com/android/godot/GodotLib.java
@@ -51,7 +51,7 @@ public class GodotLib {
public static native void step();
public static native void touch(int what,int pointer,int howmany, int[] arr);
public static native void accelerometer(float x, float y, float z);
- public static native void key(int p_unicode_char, boolean p_pressed);
+ public static native void key(int p_scancode, int p_unicode_char, boolean p_pressed);
public static native void focusin();
public static native void focusout();
public static native void audio();
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index cbe17f2f73..0f05992112 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -38,6 +38,7 @@
#include "globals.h"
#include "thread_jandroid.h"
#include "core/os/keyboard.h"
+
static OS_Android *os_android=NULL;
@@ -924,14 +925,280 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_touch(JNIEnv * env, jobje
}
-JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject obj, jint ev, jint p_unicode_char, jboolean p_pressed) {
+/*
+ * Android Key codes.
+ */
+enum {
+ AKEYCODE_UNKNOWN = 0,
+ AKEYCODE_SOFT_LEFT = 1,
+ AKEYCODE_SOFT_RIGHT = 2,
+ AKEYCODE_HOME = 3,
+ AKEYCODE_BACK = 4,
+ AKEYCODE_CALL = 5,
+ AKEYCODE_ENDCALL = 6,
+ AKEYCODE_0 = 7,
+ AKEYCODE_1 = 8,
+ AKEYCODE_2 = 9,
+ AKEYCODE_3 = 10,
+ AKEYCODE_4 = 11,
+ AKEYCODE_5 = 12,
+ AKEYCODE_6 = 13,
+ AKEYCODE_7 = 14,
+ AKEYCODE_8 = 15,
+ AKEYCODE_9 = 16,
+ AKEYCODE_STAR = 17,
+ AKEYCODE_POUND = 18,
+ AKEYCODE_DPAD_UP = 19,
+ AKEYCODE_DPAD_DOWN = 20,
+ AKEYCODE_DPAD_LEFT = 21,
+ AKEYCODE_DPAD_RIGHT = 22,
+ AKEYCODE_DPAD_CENTER = 23,
+ AKEYCODE_VOLUME_UP = 24,
+ AKEYCODE_VOLUME_DOWN = 25,
+ AKEYCODE_POWER = 26,
+ AKEYCODE_CAMERA = 27,
+ AKEYCODE_CLEAR = 28,
+ AKEYCODE_A = 29,
+ AKEYCODE_B = 30,
+ AKEYCODE_C = 31,
+ AKEYCODE_D = 32,
+ AKEYCODE_E = 33,
+ AKEYCODE_F = 34,
+ AKEYCODE_G = 35,
+ AKEYCODE_H = 36,
+ AKEYCODE_I = 37,
+ AKEYCODE_J = 38,
+ AKEYCODE_K = 39,
+ AKEYCODE_L = 40,
+ AKEYCODE_M = 41,
+ AKEYCODE_N = 42,
+ AKEYCODE_O = 43,
+ AKEYCODE_P = 44,
+ AKEYCODE_Q = 45,
+ AKEYCODE_R = 46,
+ AKEYCODE_S = 47,
+ AKEYCODE_T = 48,
+ AKEYCODE_U = 49,
+ AKEYCODE_V = 50,
+ AKEYCODE_W = 51,
+ AKEYCODE_X = 52,
+ AKEYCODE_Y = 53,
+ AKEYCODE_Z = 54,
+ AKEYCODE_COMMA = 55,
+ AKEYCODE_PERIOD = 56,
+ AKEYCODE_ALT_LEFT = 57,
+ AKEYCODE_ALT_RIGHT = 58,
+ AKEYCODE_SHIFT_LEFT = 59,
+ AKEYCODE_SHIFT_RIGHT = 60,
+ AKEYCODE_TAB = 61,
+ AKEYCODE_SPACE = 62,
+ AKEYCODE_SYM = 63,
+ AKEYCODE_EXPLORER = 64,
+ AKEYCODE_ENVELOPE = 65,
+ AKEYCODE_ENTER = 66,
+ AKEYCODE_DEL = 67,
+ AKEYCODE_GRAVE = 68,
+ AKEYCODE_MINUS = 69,
+ AKEYCODE_EQUALS = 70,
+ AKEYCODE_LEFT_BRACKET = 71,
+ AKEYCODE_RIGHT_BRACKET = 72,
+ AKEYCODE_BACKSLASH = 73,
+ AKEYCODE_SEMICOLON = 74,
+ AKEYCODE_APOSTROPHE = 75,
+ AKEYCODE_SLASH = 76,
+ AKEYCODE_AT = 77,
+ AKEYCODE_NUM = 78,
+ AKEYCODE_HEADSETHOOK = 79,
+ AKEYCODE_FOCUS = 80, // *Camera* focus
+ AKEYCODE_PLUS = 81,
+ AKEYCODE_MENU = 82,
+ AKEYCODE_NOTIFICATION = 83,
+ AKEYCODE_SEARCH = 84,
+ AKEYCODE_MEDIA_PLAY_PAUSE= 85,
+ AKEYCODE_MEDIA_STOP = 86,
+ AKEYCODE_MEDIA_NEXT = 87,
+ AKEYCODE_MEDIA_PREVIOUS = 88,
+ AKEYCODE_MEDIA_REWIND = 89,
+ AKEYCODE_MEDIA_FAST_FORWARD = 90,
+ AKEYCODE_MUTE = 91,
+ AKEYCODE_PAGE_UP = 92,
+ AKEYCODE_PAGE_DOWN = 93,
+ AKEYCODE_PICTSYMBOLS = 94,
+ AKEYCODE_SWITCH_CHARSET = 95,
+ AKEYCODE_BUTTON_A = 96,
+ AKEYCODE_BUTTON_B = 97,
+ AKEYCODE_BUTTON_C = 98,
+ AKEYCODE_BUTTON_X = 99,
+ AKEYCODE_BUTTON_Y = 100,
+ AKEYCODE_BUTTON_Z = 101,
+ AKEYCODE_BUTTON_L1 = 102,
+ AKEYCODE_BUTTON_R1 = 103,
+ AKEYCODE_BUTTON_L2 = 104,
+ AKEYCODE_BUTTON_R2 = 105,
+ AKEYCODE_BUTTON_THUMBL = 106,
+ AKEYCODE_BUTTON_THUMBR = 107,
+ AKEYCODE_BUTTON_START = 108,
+ AKEYCODE_BUTTON_SELECT = 109,
+ AKEYCODE_BUTTON_MODE = 110,
+
+ // NOTE: If you add a new keycode here you must also add it to several other files.
+ // Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
+};
+
+struct _WinTranslatePair {
+
+ unsigned int keysym;
+ unsigned int keycode;
+};
+
+
+static _WinTranslatePair _ak_to_keycode[]={
+{ KEY_TAB, AKEYCODE_TAB },
+{ KEY_ENTER, AKEYCODE_ENTER },
+{ KEY_SHIFT, AKEYCODE_SHIFT_LEFT },
+{ KEY_SHIFT, AKEYCODE_SHIFT_RIGHT },
+{ KEY_ALT, AKEYCODE_ALT_LEFT },
+{ KEY_ALT, AKEYCODE_ALT_RIGHT },
+{ KEY_MENU, AKEYCODE_MENU },
+{ KEY_PAUSE, AKEYCODE_MEDIA_PLAY_PAUSE },
+{ KEY_ESCAPE, AKEYCODE_BACK },
+{ KEY_SPACE, AKEYCODE_SPACE },
+{ KEY_PAGEUP, AKEYCODE_PAGE_UP },
+{ KEY_PAGEDOWN, AKEYCODE_PAGE_DOWN },
+{ KEY_HOME, AKEYCODE_HOME },//(0x24)
+{ KEY_LEFT, AKEYCODE_DPAD_LEFT },
+{ KEY_UP, AKEYCODE_DPAD_UP },
+{ KEY_RIGHT, AKEYCODE_DPAD_RIGHT },
+{ KEY_DOWN, AKEYCODE_DPAD_DOWN},
+{ KEY_PERIODCENTERED, AKEYCODE_DPAD_CENTER },
+{ KEY_BACKSPACE, AKEYCODE_DEL},
+{ KEY_0, AKEYCODE_0 },////0 key
+{ KEY_1, AKEYCODE_1 },////1 key
+{ KEY_2, AKEYCODE_2 },////2 key
+{ KEY_3, AKEYCODE_3 },////3 key
+{ KEY_4, AKEYCODE_4 },////4 key
+{ KEY_5, AKEYCODE_5 },////5 key
+{ KEY_6, AKEYCODE_6 },////6 key
+{ KEY_7, AKEYCODE_7 },////7 key
+{ KEY_8, AKEYCODE_8 },////8 key
+{ KEY_9, AKEYCODE_9 },////9 key
+{ KEY_A, AKEYCODE_A },////A key
+{ KEY_B, AKEYCODE_B },////B key
+{ KEY_C, AKEYCODE_C },////C key
+{ KEY_D, AKEYCODE_D },////D key
+{ KEY_E, AKEYCODE_E },////E key
+{ KEY_F, AKEYCODE_F },////F key
+{ KEY_G, AKEYCODE_G },////G key
+{ KEY_H, AKEYCODE_H },////H key
+{ KEY_I, AKEYCODE_I },////I key
+{ KEY_J, AKEYCODE_J },////J key
+{ KEY_K, AKEYCODE_K },////K key
+{ KEY_L, AKEYCODE_L },////L key
+{ KEY_M, AKEYCODE_M },////M key
+{ KEY_N, AKEYCODE_N },////N key
+{ KEY_O, AKEYCODE_O },////O key
+{ KEY_P, AKEYCODE_P },////P key
+{ KEY_Q, AKEYCODE_Q },////Q key
+{ KEY_R, AKEYCODE_R },////R key
+{ KEY_S, AKEYCODE_S },////S key
+{ KEY_T, AKEYCODE_T },////T key
+{ KEY_U, AKEYCODE_U },////U key
+{ KEY_V, AKEYCODE_V },////V key
+{ KEY_W, AKEYCODE_W },////W key
+{ KEY_X, AKEYCODE_X },////X key
+{ KEY_Y, AKEYCODE_Y },////Y key
+{ KEY_Z, AKEYCODE_Z },////Z key
+{ KEY_HOMEPAGE, AKEYCODE_EXPLORER},
+{ KEY_LAUNCH0, AKEYCODE_BUTTON_A},
+{ KEY_LAUNCH1, AKEYCODE_BUTTON_B},
+{ KEY_LAUNCH2, AKEYCODE_BUTTON_C},
+{ KEY_LAUNCH3, AKEYCODE_BUTTON_X},
+{ KEY_LAUNCH4, AKEYCODE_BUTTON_Y},
+{ KEY_LAUNCH5, AKEYCODE_BUTTON_Z},
+{ KEY_LAUNCH6, AKEYCODE_BUTTON_L1},
+{ KEY_LAUNCH7, AKEYCODE_BUTTON_R1},
+{ KEY_LAUNCH8, AKEYCODE_BUTTON_L2},
+{ KEY_LAUNCH9, AKEYCODE_BUTTON_R2},
+{ KEY_LAUNCHA, AKEYCODE_BUTTON_THUMBL},
+{ KEY_LAUNCHB, AKEYCODE_BUTTON_THUMBR},
+{ KEY_LAUNCHC, AKEYCODE_BUTTON_START},
+{ KEY_LAUNCHD, AKEYCODE_BUTTON_SELECT},
+{ KEY_LAUNCHE, AKEYCODE_BUTTON_MODE},
+{ KEY_VOLUMEMUTE, AKEYCODE_MUTE},
+{ KEY_VOLUMEDOWN, AKEYCODE_VOLUME_DOWN},
+{ KEY_VOLUMEUP, AKEYCODE_VOLUME_UP},
+{ KEY_BACK, AKEYCODE_MEDIA_REWIND },
+{ KEY_FORWARD, AKEYCODE_MEDIA_FAST_FORWARD },
+{ KEY_MEDIANEXT, AKEYCODE_MEDIA_NEXT },
+{ KEY_MEDIAPREVIOUS, AKEYCODE_MEDIA_PREVIOUS },
+{ KEY_MEDIASTOP, AKEYCODE_MEDIA_STOP },
+{ KEY_PLUS, AKEYCODE_PLUS },
+{ KEY_EQUAL, AKEYCODE_EQUALS},// the '+' key
+{ KEY_COMMA, AKEYCODE_COMMA},// the ',' key
+{ KEY_MINUS, AKEYCODE_MINUS},// the '-' key
+{ KEY_SLASH, AKEYCODE_SLASH},// the '/?' key
+{ KEY_BACKSLASH, AKEYCODE_BACKSLASH},
+{ KEY_BRACKETLEFT, AKEYCODE_LEFT_BRACKET},
+{ KEY_BRACKETRIGHT, AKEYCODE_RIGHT_BRACKET},
+{ KEY_UNKNOWN, 0} };
+/*
+TODO: map these android key:
+ AKEYCODE_SOFT_LEFT = 1,
+ AKEYCODE_SOFT_RIGHT = 2,
+ AKEYCODE_CALL = 5,
+ AKEYCODE_ENDCALL = 6,
+ AKEYCODE_STAR = 17,
+ AKEYCODE_POUND = 18,
+ AKEYCODE_POWER = 26,
+ AKEYCODE_CAMERA = 27,
+ AKEYCODE_CLEAR = 28,
+ AKEYCODE_SYM = 63,
+ AKEYCODE_ENVELOPE = 65,
+ AKEYCODE_GRAVE = 68,
+ AKEYCODE_SEMICOLON = 74,
+ AKEYCODE_APOSTROPHE = 75,
+ AKEYCODE_AT = 77,
+ AKEYCODE_NUM = 78,
+ AKEYCODE_HEADSETHOOK = 79,
+ AKEYCODE_FOCUS = 80, // *Camera* focus
+ AKEYCODE_NOTIFICATION = 83,
+ AKEYCODE_SEARCH = 84,
+ AKEYCODE_PICTSYMBOLS = 94,
+ AKEYCODE_SWITCH_CHARSET = 95,
+*/
+
+static unsigned int android_get_keysym(unsigned int p_code) {
+ for(int i=0;_ak_to_keycode[i].keysym!=KEY_UNKNOWN;i++) {
+
+ if (_ak_to_keycode[i].keycode==p_code) {
+ //print_line("outcode: " + _ak_to_keycode[i].keysym);
+
+ return _ak_to_keycode[i].keysym;
+ }
+ }
+
+
+ return KEY_UNKNOWN;
+}
+
+JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed) {
InputEvent ievent;
ievent.type = InputEvent::KEY;
ievent.device = 0;
int val = p_unicode_char;
- ievent.key.scancode = val;
+ int scancode = android_get_keysym(p_scancode);
+ ievent.key.scancode = scancode;
ievent.key.unicode = val;
+ ievent.key.pressed = p_pressed;
+
+ print_line("Scancode: " + String::num(p_scancode) + ":" + String::num(ievent.key.scancode) + " Unicode: " + String::num(val));
+
+ ievent.key.mod.shift=false;
+ ievent.key.mod.alt=false;
+ ievent.key.mod.control=false;
+ ievent.key.echo=false;
+
if (val == 61448) {
ievent.key.scancode = KEY_BACKSPACE;
ievent.key.unicode = KEY_BACKSPACE;
diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h
index 4b3c14d0db..a519122726 100644
--- a/platform/android/java_glue.h
+++ b/platform/android/java_glue.h
@@ -42,7 +42,7 @@ extern "C" {
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_step(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_quit(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_touch(JNIEnv * env, jobject obj, jint ev,jint pointer, jint count, jintArray positions);
- JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject obj, jint ev, jint p_unicode_char, jboolean p_pressed);
+ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_audio(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_accelerometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_focusin(JNIEnv * env, jobject obj);
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index a94e43fc85..89c71418ea 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -129,8 +129,8 @@ def configure(env):
else:
VC_PATH=""
- env.Append(CCFLAGS=["/I"+VC_PATH+"/Include"])
- env.Append(LIBPATH=[VC_PATH+"/Lib"])
+ env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
+ env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
env.Append(CCFLAGS=["/I"+DIRECTX_PATH+"/Include"])
env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"])
env['ENV'] = os.environ;
diff --git a/platform/windows/godot_win.cpp b/platform/windows/godot_win.cpp
index 2999a9beae..fa573b9421 100644
--- a/platform/windows/godot_win.cpp
+++ b/platform/windows/godot_win.cpp
@@ -29,6 +29,7 @@
#include "os_windows.h"
#include "main/main.h"
#include <stdio.h>
+#include <locale.h>
PCHAR*
CommandLineToArgvA(
@@ -114,15 +115,42 @@ PCHAR*
return argv;
}
+char* mb_to_utf8(const char* mbs) {
+
+ int wlen = MultiByteToWideChar(CP_ACP,0,mbs,-1,NULL,0); // returns 0 if failed
+ wchar_t *wbuf = new wchar_t[wlen + 1];
+ MultiByteToWideChar(CP_ACP,0,mbs,-1,wbuf,wlen);
+ wbuf[wlen]=0;
+
+ int ulen = WideCharToMultiByte(CP_UTF8,0,wbuf,-1,NULL,0,NULL,NULL);
+ char * ubuf = new char[ulen + 1];
+ WideCharToMultiByte(CP_UTF8,0,wbuf,-1,ubuf,ulen,NULL,NULL);
+ ubuf[ulen] = 0;
+ return ubuf;
+}
+
int main(int argc, char** argv) {
OS_Windows os(NULL);
- Main::setup(argv[0], argc - 1, &argv[1]);
+ setlocale(LC_CTYPE, "");
+
+ char ** argv_utf8 = new char*[argc];
+ for(int i=0; i<argc; ++i) {
+ argv_utf8[i] = mb_to_utf8(argv[i]);
+ }
+
+ Main::setup(argv_utf8[0], argc - 1, &argv_utf8[1]);
if (Main::start())
os.run();
Main::cleanup();
+
+ for (int i=0; i<argc; ++i) {
+ delete[] argv_utf8[i];
+ }
+ delete[] argv_utf8;
+
return os.get_exit_code();
};
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 090fe64b19..801bb9332a 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -608,6 +608,28 @@ void OS_Windows::process_key_events() {
switch(ke.uMsg) {
case WM_CHAR: {
+ if ((i==0 && ke.uMsg==WM_CHAR) || (i>0 && key_event_buffer[i-1].uMsg==WM_CHAR))
+ {
+ InputEvent event;
+ event.type=InputEvent::KEY;
+ event.ID=++last_id;
+ InputEventKey &k=event.key;
+
+
+ k.mod=ke.mod_state;
+ k.pressed=true;
+ k.scancode=KeyMappingWindows::get_keysym(ke.wParam);
+ k.unicode=ke.wParam;
+ if (k.unicode && gr_mem) {
+ k.mod.alt=false;
+ k.mod.control=false;
+ }
+
+ if (k.unicode<32)
+ k.unicode=0;
+
+ input->parse_input_event(event);
+ }
//do nothing
} break;
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 38f697ef10..80d92fb17c 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -131,6 +131,9 @@ def configure(env):
if (env["force_32_bits"]=="yes"):
env.Append(CPPFLAGS=['-m32'])
env.Append(LINKFLAGS=['-m32','-L/usr/lib/i386-linux-gnu'])
+ env['OBJSUFFIX'] = ".32"+env['OBJSUFFIX']
+ env['LIBSUFFIX'] = ".32"+env['LIBSUFFIX']
+
if (env["CXX"]=="clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index d95818b4a1..a09575bad5 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -45,7 +45,10 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+
+#ifdef __linux__
#include <linux/joystick.h>
+#endif
//stupid linux.h
#ifdef KEY_TAB
@@ -1031,7 +1034,7 @@ void OS_X11::close_joystick(int p_id) {
};
void OS_X11::probe_joystick(int p_id) {
-
+ #ifndef __FreeBSD__
if (p_id == -1) {
for (int i=0; i<JOYSTICKS_MAX; i++) {
@@ -1065,6 +1068,7 @@ void OS_X11::probe_joystick(int p_id) {
++i;
};
+ #endif
};
void OS_X11::move_window_to_foreground() {
@@ -1073,7 +1077,7 @@ void OS_X11::move_window_to_foreground() {
}
void OS_X11::process_joysticks() {
-
+ #ifndef __FreeBSD__
int bytes;
js_event events[32];
InputEvent ievent;
@@ -1172,6 +1176,7 @@ void OS_X11::process_joysticks() {
};
};
};
+ #endif
};
void OS_X11::set_cursor_shape(CursorShape p_shape) {
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index d14f3e3f9a..21703969cc 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -26,7 +26,13 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifdef __linux__
#include <alloca.h>
+#endif
+#ifdef __FreeBSD__
+#include <stdlib.h>
+#endif
+
#define GLES2_INCLUDE_H "gl_context/glew.h"
#define GLES1_INCLUDE_H "gl_context/glew.h"
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 9b2994ef84..a2bee43e58 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -162,6 +162,10 @@ void Node2D::set_scale(const Size2& p_scale) {
if (_xform_dirty)
((Node2D*)this)->_update_xform_values();
scale=p_scale;
+ if (scale.x==0)
+ scale.x=CMP_EPSILON;
+ if (scale.y==0)
+ scale.y=CMP_EPSILON;
_update_transform();
_change_notify("transform/scale");
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index ad1b7fd66b..22316acaba 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -748,6 +748,11 @@ bool LineEdit::is_secret() const {
void LineEdit::select(int p_from, int p_to) {
+ if (p_from==0 && p_to==0) {
+ selection_clear();
+ return;
+ }
+
int len = text.length();
if (p_from<0)
p_from=0;
@@ -786,7 +791,7 @@ void LineEdit::_bind_methods() {
ObjectTypeDB::bind_method(_MD("is_editable"),&LineEdit::is_editable);
ObjectTypeDB::bind_method(_MD("set_secret","enabled"),&LineEdit::set_secret);
ObjectTypeDB::bind_method(_MD("is_secret"),&LineEdit::is_secret);
- ObjectTypeDB::bind_method(_MD("select","from","to"),&LineEdit::is_secret,DEFVAL(0),DEFVAL(-1));
+ ObjectTypeDB::bind_method(_MD("select","from","to"),&LineEdit::select,DEFVAL(0),DEFVAL(-1));
ADD_SIGNAL( MethodInfo("text_changed", PropertyInfo( Variant::STRING, "text" )) );
ADD_SIGNAL( MethodInfo("text_entered", PropertyInfo( Variant::STRING, "text" )) );
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 9be3c97901..fb85f0c6b7 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1591,7 +1591,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
case TreeItem::CELL_MODE_CUSTOM: {
edited_item=p_item;
edited_col=col;
- custom_popup_rect=Rect2i(get_global_pos() + Point2i(col_ofs,_get_title_button_height()+y_ofs+item_h-v_scroll->get_val()), Size2(get_column_width(col),item_h));
+ custom_popup_rect=Rect2i(get_global_pos() + Point2i(col_ofs,_get_title_button_height()+y_ofs+item_h-cache.offset.y), Size2(get_column_width(col),item_h));
emit_signal("custom_popup_edited",((bool)(x >= (col_width-item_h/2))));
bring_up_editor=false;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 5ac09e837f..9b592a77d5 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -552,6 +552,8 @@ void Node::_validate_child_name(Node *p_child) {
int cc = data.children.size();
for(int i=0;i<cc;i++) {
+ if (childs[i]==p_child)
+ continue;
if (childs[i]->data.name==p_child->data.name) {
unique=false;
break;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index ae2b925008..4aed217cef 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -782,16 +782,41 @@ void Viewport::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_as_render_target","enable"), &Viewport::set_as_render_target);
ObjectTypeDB::bind_method(_MD("is_set_as_render_target"), &Viewport::is_set_as_render_target);
+ ObjectTypeDB::bind_method(_MD("set_render_target_update_mode","mode"), &Viewport::set_render_target_update_mode);
+ ObjectTypeDB::bind_method(_MD("get_render_target_update_mode"), &Viewport::get_render_target_update_mode);
+
+ ObjectTypeDB::bind_method(_MD("get_render_target_texture:RenderTargetTexture"), &Viewport::get_render_target_texture);
+
+
ObjectTypeDB::bind_method(_MD("get_viewport"), &Viewport::get_viewport);
+
ObjectTypeDB::bind_method(_MD("update_worlds"), &Viewport::update_worlds);
+
+ ObjectTypeDB::bind_method(_MD("set_as_audio_listener","enable"), &Viewport::set_as_audio_listener);
+ ObjectTypeDB::bind_method(_MD("is_audio_listener","enable"), &Viewport::is_audio_listener);
+
+ ObjectTypeDB::bind_method(_MD("set_as_audio_listener_2d","enable"), &Viewport::set_as_audio_listener_2d);
+ ObjectTypeDB::bind_method(_MD("is_audio_listener_2d","enable"), &Viewport::is_audio_listener_2d);
+
+
+ ADD_PROPERTY( PropertyInfo(Variant::RECT2,"rect"), _SCS("set_rect"), _SCS("get_rect") );
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world",PROPERTY_HINT_RESOURCE_TYPE,"World"), _SCS("set_world"), _SCS("get_world") );
// ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"world_2d",PROPERTY_HINT_RESOURCE_TYPE,"World2D"), _SCS("set_world_2d"), _SCS("get_world_2d") );
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"transparent_bg"), _SCS("set_transparent_background"), _SCS("has_transparent_background") );
- ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target"), _SCS("set_as_render_target"), _SCS("is_set_as_render_target") );
+ ADD_PROPERTY( PropertyInfo(Variant::BOOL,"render_target/enabled"), _SCS("set_as_render_target"), _SCS("is_set_as_render_target") );
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"render_target/update_mode",PROPERTY_HINT_ENUM,"Disabled,Once,When Visible,Always"), _SCS("set_render_target_update_mode"), _SCS("get_render_target_update_mode") );
+ ADD_PROPERTY( PropertyInfo(Variant::BOOL,"audio_listener/enable_2d"), _SCS("set_as_audio_listener_2d"), _SCS("is_audio_listener_2d") );
+ ADD_PROPERTY( PropertyInfo(Variant::BOOL,"audio_listener/enable_3d"), _SCS("set_as_audio_listener"), _SCS("is_audio_listener") );
ADD_SIGNAL(MethodInfo("size_changed"));
+
+ BIND_CONSTANT( RENDER_TARGET_UPDATE_DISABLED );
+ BIND_CONSTANT( RENDER_TARGET_UPDATE_ONCE );
+ BIND_CONSTANT( RENDER_TARGET_UPDATE_WHEN_VISIBLE );
+ BIND_CONSTANT( RENDER_TARGET_UPDATE_ALWAYS );
+
}
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index a35bc51e1e..7fbae20f7d 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -154,11 +154,9 @@ public:
Camera* get_camera() const;
- void set_listener_transform(const Transform& p_xform);
void set_as_audio_listener(bool p_enable);
bool is_audio_listener() const;
- void set_listener_2d_transform(const Matrix32& p_xform);
void set_as_audio_listener_2d(bool p_enable);
bool is_audio_listener_2d() const;
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index ca3aa7e1f5..ad86a62280 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -1,31 +1,32 @@
-/*************************************************************************/
-/* space_sw.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
+/*************************************************************************/
+/* space_sw.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "globals.h"
#include "space_sw.h"
#include "collision_solver_sw.h"
#include "physics_server_sw.h"
@@ -351,8 +352,8 @@ void SpaceSW::set_param(PhysicsServer::SpaceParameter p_param, real_t p_value) {
case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius=p_value; break;
case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration=p_value; break;
- case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: body_linear_velocity_sleep_treshold=p_value; break;
- case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: body_angular_velocity_sleep_treshold=p_value; break;
+ case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: body_linear_velocity_sleep_threshold=p_value; break;
+ case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: body_angular_velocity_sleep_threshold=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: body_angular_velocity_damp_ratio=p_value; break;
case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias=p_value; break;
@@ -366,8 +367,8 @@ real_t SpaceSW::get_param(PhysicsServer::SpaceParameter p_param) const {
case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
- case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: return body_linear_velocity_sleep_treshold;
- case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: return body_angular_velocity_sleep_treshold;
+ case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: return body_linear_velocity_sleep_threshold;
+ case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: return body_angular_velocity_sleep_threshold;
case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: return body_angular_velocity_damp_ratio;
case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
@@ -404,8 +405,8 @@ SpaceSW::SpaceSW() {
contact_max_allowed_penetration= 0.01;
constraint_bias = 0.01;
- body_linear_velocity_sleep_treshold=0.01;
- body_angular_velocity_sleep_treshold=(8.0 / 180.0 * Math_PI);
+ body_linear_velocity_sleep_threshold=GLOBAL_DEF("physics/sleep_threshold_linear",0.1);
+ body_angular_velocity_sleep_threshold=GLOBAL_DEF("physics/sleep_threshold_angular", (8.0 / 180.0 * Math_PI) );
body_time_to_sleep=0.5;
body_angular_velocity_damp_ratio=10;
diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h
index 202c7ccbd2..cec1053400 100644
--- a/servers/physics/space_sw.h
+++ b/servers/physics/space_sw.h
@@ -1,31 +1,31 @@
-/*************************************************************************/
-/* space_sw.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
+/*************************************************************************/
+/* space_sw.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef SPACE_SW_H
#define SPACE_SW_H
@@ -87,8 +87,8 @@ class SpaceSW {
CollisionObjectSW *intersection_query_results[INTERSECTION_QUERY_MAX];
int intersection_query_subindex_results[INTERSECTION_QUERY_MAX];
- float body_linear_velocity_sleep_treshold;
- float body_angular_velocity_sleep_treshold;
+ float body_linear_velocity_sleep_threshold;
+ float body_angular_velocity_sleep_threshold;
float body_time_to_sleep;
float body_angular_velocity_damp_ratio;
@@ -129,8 +129,8 @@ public:
_FORCE_INLINE_ real_t get_contact_max_separation() const { return contact_max_separation; }
_FORCE_INLINE_ real_t get_contact_max_allowed_penetration() const { return contact_max_allowed_penetration; }
_FORCE_INLINE_ real_t get_constraint_bias() const { return constraint_bias; }
- _FORCE_INLINE_ real_t get_body_linear_velocity_sleep_treshold() const { return body_linear_velocity_sleep_treshold; }
- _FORCE_INLINE_ real_t get_body_angular_velocity_sleep_treshold() const { return body_angular_velocity_sleep_treshold; }
+ _FORCE_INLINE_ real_t get_body_linear_velocity_sleep_treshold() const { return body_linear_velocity_sleep_threshold; }
+ _FORCE_INLINE_ real_t get_body_angular_velocity_sleep_treshold() const { return body_angular_velocity_sleep_threshold; }
_FORCE_INLINE_ real_t get_body_time_to_sleep() const { return body_time_to_sleep; }
_FORCE_INLINE_ real_t get_body_angular_velocity_damp_ratio() const { return body_angular_velocity_damp_ratio; }
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index 22b611fdcc..1a5dd73040 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -492,6 +492,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
int group_format=0;
float group_lossy_quality=EditorImportExport::get_singleton()->image_export_group_get_lossy_quality(E->get());
int group_shrink=EditorImportExport::get_singleton()->image_export_group_get_shrink(E->get());
+ group_shrink*=EditorImportExport::get_singleton()->get_export_image_shrink();
switch(EditorImportExport::get_singleton()->image_export_group_get_image_action(E->get())) {
case EditorImportExport::IMAGE_ACTION_NONE: {
@@ -1186,6 +1187,16 @@ EditorImportExport::ImageAction EditorImportExport::get_export_image_action() co
return image_action;
}
+void EditorImportExport::set_export_image_shrink(int p_shrink) {
+
+ image_shrink=p_shrink;
+}
+
+int EditorImportExport::get_export_image_shrink() const{
+
+ return image_shrink;
+}
+
void EditorImportExport::set_export_image_quality(float p_quality){
@@ -1336,6 +1347,10 @@ void EditorImportExport::load_config() {
image_action=IMAGE_ACTION_COMPRESS_DISK;
image_action_compress_quality = cf->get_value(ci,"compress_quality");
+ if (cf->has_section_key(ci,"shrink"))
+ image_shrink = cf->get_value(ci,"shrink");
+ else
+ image_shrink=1;
String formats=cf->get_value(ci,"formats");
Vector<String> f = formats.split(",");
image_formats.clear();
@@ -1382,8 +1397,6 @@ void EditorImportExport::load_config() {
List<String> keys;
cf->get_section_keys(s,&keys);
for(List<String>::Element *F=keys.front();F;F=F->next()) {
- print_line("sk: "+F->get());
-
ep->set(F->get(),cf->get_value(s,F->get()));
}
}
@@ -1494,6 +1507,7 @@ void EditorImportExport::save_config() {
case IMAGE_ACTION_COMPRESS_DISK: cf->set_value("convert_images","action","compress_disk"); break;
}
+ cf->set_value("convert_images","shrink",image_shrink);
cf->set_value("convert_images","compress_quality",image_action_compress_quality);
String formats;
@@ -1562,9 +1576,7 @@ EditorImportExport::EditorImportExport() {
image_action=IMAGE_ACTION_NONE;
image_action_compress_quality=0.7;
image_formats.insert("png");
-
-
-
+ image_shrink=1;
}
diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h
index 17f2592ad5..94fbaba842 100644
--- a/tools/editor/editor_import_export.h
+++ b/tools/editor/editor_import_export.h
@@ -243,6 +243,7 @@ protected:
Map<String,int> by_idx;
ImageAction image_action;
float image_action_compress_quality;
+ int image_shrink;
Set<String> image_formats;
ExportFilter export_filter;
@@ -288,6 +289,9 @@ public:
void set_export_image_action(ImageAction p_action);
ImageAction get_export_image_action() const;
+ void set_export_image_shrink(int p_shrink);
+ int get_export_image_shrink() const;
+
void set_export_image_quality(float p_quality);
float get_export_image_quality() const;
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 2f7b6759b9..d8f9dcc947 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -3458,8 +3458,8 @@ EditorNode::EditorNode() {
p->add_item("Run Script",FILE_RUN_SCRIPT,KEY_MASK_CMD+KEY_R);
p->add_separator();
p->add_item("Project Settings",RUN_SETTINGS);
- p->add_item("Project Manager",RUN_PROJECT_MANAGER);
p->add_separator();
+ p->add_item("Quit to Project List",RUN_PROJECT_MANAGER);
p->add_item("Quit",FILE_QUIT,KEY_MASK_CMD+KEY_Q);
recent_scenes = memnew( PopupMenu );
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 87f17247c3..e35467e788 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -410,6 +410,8 @@ public:
static void add_editor_plugin(EditorPlugin *p_editor);
static void remove_editor_plugin(EditorPlugin *p_editor);
+ static EditorNode * get_singleton() { return singleton; }
+
void edit_node(Node *p_node);
void edit_resource(const Ref<Resource>& p_resource);
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index 067edee5a0..90dcbb97e0 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -610,7 +610,7 @@ String EditorTextureImportPlugin::get_visible_name() const {
} break;
case MODE_ATLAS: {
- return "Atlas Teture";
+ return "Atlas Texture";
} break;
}
@@ -899,6 +899,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
}
}
+
if (format==IMAGE_FORMAT_COMPRESS_DISK_LOSSLESS || format==IMAGE_FORMAT_COMPRESS_DISK_LOSSY) {
Image image=texture->get_data();
@@ -952,6 +953,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
} else {
+ print_line("compress...");
Image image=texture->get_data();
ERR_FAIL_COND_V(image.empty(),ERR_INVALID_DATA);
@@ -988,13 +990,17 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
}
+ print_line("COMPRESSED TO: "+itos(image.get_format()));
texture->create_from_image(image,tex_flags);
+
if (shrink>1) {
texture->set_size_override(Size2(orig_w,orig_h));
}
- Error err = ResourceSaver::save(p_path,texture);
+ uint32_t save_flags=ResourceSaver::FLAG_COMPRESS;
+
+ Error err = ResourceSaver::save(p_path,texture,save_flags);
if (err!=OK) {
EditorNode::add_io_error("Couldn't save converted texture: "+p_path);
return err;
@@ -1021,6 +1027,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
int group_format=0;
float group_lossy_quality=EditorImportExport::get_singleton()->image_export_group_get_lossy_quality(group);
int group_shrink=EditorImportExport::get_singleton()->image_export_group_get_shrink(group);
+ group_shrink*=EditorImportExport::get_singleton()->get_export_image_shrink();
switch(EditorImportExport::get_singleton()->image_export_group_get_image_action(group)) {
case EditorImportExport::IMAGE_ACTION_NONE: {
@@ -1062,6 +1069,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
flags|=IMAGE_FLAG_FIX_BORDER_ALPHA;
+ print_line("group format"+itos(group_format));
rimd->set_option("format",group_format);
rimd->set_option("flags",flags);
rimd->set_option("quality",group_lossy_quality);
@@ -1090,6 +1098,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
flags|=IMAGE_FLAG_FIX_BORDER_ALPHA;
+ rimd->set_option("shrink",EditorImportExport::get_singleton()->get_export_image_shrink());
rimd->set_option("flags",flags);
rimd->set_option("quality",EditorImportExport::get_singleton()->get_export_image_quality());
rimd->set_option("atlas",false);
@@ -1108,18 +1117,21 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
}
uint32_t flags = rimd->get_option("flags");
+ uint8_t shrink = rimd->has_option("shrink") ? rimd->get_option("shrink"): Variant(1);
+ uint8_t format = rimd->get_option("format");
+ uint8_t comp = (format==EditorTextureImportPlugin::IMAGE_FORMAT_COMPRESS_RAM)?uint8_t(p_platform->get_image_compression()):uint8_t(255);
MD5_CTX ctx;
uint8_t f4[4];
encode_uint32(flags,&f4[0]);
- uint8_t ic = p_platform->get_image_compression();
MD5Init(&ctx);
String gp = Globals::get_singleton()->globalize_path(p_path);
CharString cs = gp.utf8();
MD5Update(&ctx,(unsigned char*)cs.get_data(),cs.length());
MD5Update(&ctx,f4,4);
- MD5Update(&ctx,&ic,1);
-
+ MD5Update(&ctx,&format,1);
+ MD5Update(&ctx,&comp,1);
+ MD5Update(&ctx,&shrink,1);
MD5Final(&ctx);
uint64_t sd=0;
@@ -1137,6 +1149,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c
uint64_t d = f->get_line().strip_edges().to_int64();
sd = FileAccess::get_modified_time(p_path);
+
if (d==sd) {
valid=true;
} else {
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 1a17916394..a01565a046 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1507,7 +1507,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("external_editor/use_external_editor",false);
EDITOR_DEF("external_editor/exec_path","");
- EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_FILE));
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_GLOBAL_FILE));
EDITOR_DEF("external_editor/exec_flags","");
}
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index be7214aaa7..0014c5a68a 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -1407,6 +1407,9 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
} break;
+ case KEY_F: {
+ _menu_option(VIEW_CENTER_TO_SELECTION);
+ } break;
}
diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp
index 192fcaa908..eae5dacb27 100644
--- a/tools/editor/project_export.cpp
+++ b/tools/editor/project_export.cpp
@@ -207,6 +207,12 @@ void ProjectExportDialog::_quality_edited(float what) {
_save_export_cfg();
}
+void ProjectExportDialog::_shrink_edited(float what) {
+
+ EditorImportExport::get_singleton()->set_export_image_shrink(what);
+ _save_export_cfg();
+}
+
void ProjectExportDialog::_image_export_edited(int what) {
EditorImportExport::get_singleton()->set_export_image_action(EditorImportExport::ImageAction(what));
@@ -270,7 +276,9 @@ void ProjectExportDialog::_notification(int p_what) {
image_action->select(EditorImportExport::get_singleton()->get_export_image_action());
image_quality->set_val(EditorImportExport::get_singleton()->get_export_image_quality());
+ image_shrink->set_val(EditorImportExport::get_singleton()->get_export_image_quality());
image_quality->connect("value_changed",this,"_quality_edited");
+ image_shrink->connect("value_changed",this,"_shrink_edited");
image_action->connect("item_selected",this,"_image_export_edited");
for(int i=0;i<formats.size();i++) {
@@ -966,6 +974,7 @@ void ProjectExportDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_export_action"),&ProjectExportDialog::_export_action);
ObjectTypeDB::bind_method(_MD("_export_action_pck"),&ProjectExportDialog::_export_action_pck);
ObjectTypeDB::bind_method(_MD("_quality_edited"),&ProjectExportDialog::_quality_edited);
+ ObjectTypeDB::bind_method(_MD("_shrink_edited"),&ProjectExportDialog::_shrink_edited);
ObjectTypeDB::bind_method(_MD("_image_export_edited"),&ProjectExportDialog::_image_export_edited);
ObjectTypeDB::bind_method(_MD("_format_toggled"),&ProjectExportDialog::_format_toggled);
ObjectTypeDB::bind_method(_MD("_group_changed"),&ProjectExportDialog::_group_changed);
@@ -1090,6 +1099,11 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) {
image_quality->set_max(1);
image_quality->set_step(0.01);
image_vb->add_margin_child("Compress for Disk (Lossy) Quality:",qhb);
+ image_shrink = memnew( SpinBox );
+ image_shrink->set_min(1);
+ image_shrink->set_max(8);
+ image_shrink->set_step(1);
+ image_vb->add_margin_child("Shrink All Images:",image_shrink);
sections->add_child(image_vb);
image_formats=memnew(Tree);
diff --git a/tools/editor/project_export.h b/tools/editor/project_export.h
index 25709babb9..6ceffadc62 100644
--- a/tools/editor/project_export.h
+++ b/tools/editor/project_export.h
@@ -110,6 +110,7 @@ private:
VBoxContainer *image_vb;
OptionButton *image_action;
HSlider *image_quality;
+ SpinBox *image_shrink;
Tree *image_formats;
Vector<TreeItem*> formats;
@@ -150,6 +151,8 @@ private:
void _quality_edited(float what);
void _image_export_edited(int what);
+ void _shrink_edited(float what);
+
void _update_group_list();
void _select_group(const String& p_by_name);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 6b34e3f555..1cce161d08 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -51,7 +51,7 @@ void CustomPropertyEditor::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( 10,10,60, get_size().height-20 ), v );
}*/
- }
+ }
}
@@ -1397,6 +1397,53 @@ void CustomPropertyEditor::_modified(String p_string) {
updating=false;
}
+void CustomPropertyEditor::_focus_enter() {
+ switch(type) {
+ case Variant::REAL:
+ case Variant::STRING:
+ case Variant::VECTOR2:
+ case Variant::RECT2:
+ case Variant::VECTOR3:
+ case Variant::PLANE:
+ case Variant::QUAT:
+ case Variant::_AABB:
+ case Variant::MATRIX32:
+ case Variant::MATRIX3:
+ case Variant::TRANSFORM: {
+ for (int i=0;i<MAX_VALUE_EDITORS;++i) {
+ if (value_editor[i]->has_focus()) {
+ value_editor[i]->select_all();
+ break;
+ }
+ }
+ } break;
+ default: {}
+ }
+
+}
+
+void CustomPropertyEditor::_focus_exit() {
+ switch(type) {
+ case Variant::REAL:
+ case Variant::STRING:
+ case Variant::VECTOR2:
+ case Variant::RECT2:
+ case Variant::VECTOR3:
+ case Variant::PLANE:
+ case Variant::QUAT:
+ case Variant::_AABB:
+ case Variant::MATRIX32:
+ case Variant::MATRIX3:
+ case Variant::TRANSFORM: {
+ for (int i=0;i<MAX_VALUE_EDITORS;++i) {
+ value_editor[i]->select(0, 0);
+ }
+ } break;
+ default: {}
+ }
+
+}
+
void CustomPropertyEditor::config_action_buttons(const List<String>& p_strings) {
int w=100;
@@ -1456,6 +1503,8 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns,int
void CustomPropertyEditor::_bind_methods() {
+ ObjectTypeDB::bind_method("_focus_enter", &CustomPropertyEditor::_focus_enter);
+ ObjectTypeDB::bind_method("_focus_exit", &CustomPropertyEditor::_focus_exit);
ObjectTypeDB::bind_method("_modified",&CustomPropertyEditor::_modified);
ObjectTypeDB::bind_method("_scroll_modified",&CustomPropertyEditor::_scroll_modified);
ObjectTypeDB::bind_method("_action_pressed",&CustomPropertyEditor::_action_pressed);
@@ -1487,6 +1536,8 @@ CustomPropertyEditor::CustomPropertyEditor() {
value_editor[i]->hide();
value_label[i]->hide();
value_editor[i]->connect("text_entered", this,"_modified");
+ value_editor[i]->connect("focus_enter", this, "_focus_enter");
+ value_editor[i]->connect("focus_exit", this, "_focus_exit");
}
for(int i=0;i<4;i++) {
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index fc0330c25d..7ee14679c1 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -105,6 +105,8 @@ class CustomPropertyEditor : public Popup {
void _file_selected(String p_file);
void _scroll_modified(double p_value);
void _modified(String p_string);
+ void _focus_enter();
+ void _focus_exit();
void _action_pressed(int p_which);
void _type_create_selected(int p_idx);
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index 89b7e54195..1d2c864c99 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -706,7 +706,8 @@ void SceneTreeDialog::_cancel() {
void SceneTreeDialog::_select() {
if (tree->get_selected()) {
- emit_signal("selected",tree->get_selected()->get_path());
+ Node *scene = EditorNode::get_singleton()->get_edited_scene();
+ emit_signal("selected","/root/" + scene->get_parent()->get_path_to(tree->get_selected()));
hide();
}
}
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp
index 02daa3c245..86331faa1d 100644
--- a/tools/editor/scenes_dock.cpp
+++ b/tools/editor/scenes_dock.cpp
@@ -181,7 +181,7 @@ void ScenesDock::_instance_pressed() {
if (!sel)
return;
String path = sel->get_metadata(0);
- emit_signal("instance","res://"+path);
+ emit_signal("instance",path);
}
void ScenesDock::_open_pressed(){