summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct16
-rw-r--r--doc/base/classes.xml14
-rwxr-xr-xmethods.py2
-rw-r--r--modules/gdscript/gd_compiler.cpp6
-rw-r--r--platform/android/detect.py2
-rw-r--r--platform/osx/detect.py3
-rw-r--r--platform/server/detect.py3
-rw-r--r--platform/windows/os_windows.cpp7
-rw-r--r--platform/x11/detect.py4
-rw-r--r--scene/2d/ray_cast_2d.cpp48
-rw-r--r--scene/2d/ray_cast_2d.h3
-rw-r--r--scene/3d/ray_cast.cpp48
-rw-r--r--scene/3d/ray_cast.h2
-rw-r--r--servers/visual/visual_server_raster.cpp5
-rw-r--r--servers/visual/visual_server_raster.h1
-rw-r--r--servers/visual/visual_server_wrap_mt.h1
-rw-r--r--servers/visual_server.cpp1
-rw-r--r--servers/visual_server.h1
-rw-r--r--tools/editor/editor_settings.cpp28
-rw-r--r--tools/editor/editor_settings.h3
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp1
-rw-r--r--tools/editor/script_create_dialog.cpp14
-rw-r--r--tools/editor/script_create_dialog.h2
23 files changed, 150 insertions, 65 deletions
diff --git a/SConstruct b/SConstruct
index aab605cdcb..c28b40652a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -65,6 +65,8 @@ elif (os.name=="nt"):
custom_tools=['mingw']
env_base=Environment(tools=custom_tools);
+if 'TERM' in os.environ:
+ env_base['ENV']['TERM'] = os.environ['TERM']
env_base.AppendENVPath('PATH', os.getenv('PATH'))
env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH'))
env_base.global_defaults=global_defaults
@@ -143,7 +145,7 @@ opts.Add("LINKFLAGS", "Custom flags for the linker");
opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.','')
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
-opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no')
+opts.Add('verbose', 'Enable verbose output for the compilation (yes/no)', 'yes')
opts.Add('deprecated','Enable deprecated features (yes/no)','yes')
opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
@@ -262,6 +264,8 @@ if selected_platform in platform_list:
sys.exit(255)
suffix+=".opt"
+ env.Append(CCFLAGS=['-DNDEBUG']);
+
elif (env["target"]=="release_debug"):
if (env["tools"]=="yes"):
suffix+=".opt.tools"
@@ -330,8 +334,8 @@ if selected_platform in platform_list:
if (env['xml']=='yes'):
env.Append(CPPFLAGS=['-DXML_ENABLED'])
- if (env['colored']=='yes'):
- methods.colored(sys,env)
+ if (env['verbose']=='no'):
+ methods.no_verbose(sys,env)
Export('env')
@@ -379,9 +383,9 @@ if selected_platform in platform_list:
release_variants = ['release|Win32']+['release|x64']
release_debug_variants = ['release_debug|Win32']+['release_debug|x64']
variants = debug_variants + release_variants + release_debug_variants
- debug_targets = ['Debug']+['Debug']
- release_targets = ['Release']+['Release']
- release_debug_targets = ['ReleaseDebug']+['ReleaseDebug']
+ debug_targets = ['bin\\godot.windows.tools.32.exe']+['bin\\godot.windows.tools.64.exe']
+ release_targets = ['bin\\godot.windows.opt.32.exe']+['bin\\godot.windows.opt.64.exe']
+ release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe']+['bin\\godot.windows.opt.tools.64.exe']
targets = debug_targets + release_targets + release_debug_targets
msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ],
incs = env.vs_incs,
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 4e0ba53f48..5eb021f6c0 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -31871,6 +31871,8 @@
RayCast can ignore some objects by adding them to the exception list via [code]add_exception[/code], setting proper filtering with layers, or by filtering object types with type masks.
Only enabled raycasts will be able to query the space and report collisions!
+
+ RayCast calculates intersection every fixed frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between fixed frames (or during the same frame) use [method force_raycast_update] after adjusting the raycast.
</description>
<methods>
<method name="add_exception">
@@ -31891,6 +31893,11 @@
Removes all collision exception for this ray.
</description>
</method>
+ <method name="force_raycast_update">
+ <description>
+ Updates the collision information in case if this object's properties changed during the current frame (for example position, rotation or the cast_point). Note, [code]set_enabled[/code] is not required for this to work.
+ </description>
+ </method>
<method name="get_cast_to" qualifiers="const">
<return type="Vector3">
</return>
@@ -32009,6 +32016,8 @@
RayCast2D can ignore some objects by adding them to the exception list via [code]add_exception[/code], setting proper filtering with layers, or by filtering object types with type masks.
Only enabled raycasts will be able to query the space and report collisions!
+
+ RayCast2D calculates intersection every fixed frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between fixed frames (or during the same frame) use [method force_raycast_update] after adjusting the raycast.
</description>
<methods>
<method name="add_exception">
@@ -32029,6 +32038,11 @@
Removes all collision exception for this ray.
</description>
</method>
+ <method name="force_raycast_update">
+ <description>
+ Updates the collision information in case if this object's properties changed during the current frame (for example position, rotation or the cast_point). Note, [code]set_enabled[/code] is not required for this to work.
+ </description>
+ </method>
<method name="get_cast_to" qualifiers="const">
<return type="Vector2">
</return>
diff --git a/methods.py b/methods.py
index c4951c69bd..477fe4f12f 100755
--- a/methods.py
+++ b/methods.py
@@ -1416,7 +1416,7 @@ def save_active_platforms(apnames,ap):
logow.write(str)
-def colored(sys,env):
+def no_verbose(sys,env):
#If the output is not a terminal, do nothing
if not sys.stdout.isatty():
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index 2e2cbe7b29..b75b13551e 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1005,12 +1005,12 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo
switch(s->type) {
case GDParser::Node::TYPE_NEWLINE: {
-
+#ifdef DEBUG_ENABLED
const GDParser::NewLineNode *nl = static_cast<const GDParser::NewLineNode*>(s);
codegen.opcodes.push_back(GDFunction::OPCODE_LINE);
codegen.opcodes.push_back(nl->line);
codegen.current_line=nl->line;
-
+#endif
} break;
case GDParser::Node::TYPE_CONTROL_FLOW: {
// try subblocks
@@ -1201,8 +1201,10 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo
codegen.opcodes.push_back(ret);
} break;
case GDParser::Node::TYPE_BREAKPOINT: {
+#ifdef DEBUG_ENABLED
// try subblocks
codegen.opcodes.push_back(GDFunction::OPCODE_BREAKPOINT);
+#endif
} break;
case GDParser::Node::TYPE_LOCAL_VAR: {
diff --git a/platform/android/detect.py b/platform/android/detect.py
index acf4ce412a..842036f986 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -131,7 +131,7 @@ def configure(env):
gcc_path=gcc_path+"/darwin-x86_64/bin"
env['SHLINKFLAGS'][1] = '-shared'
env['SHLIBSUFFIX'] = '.so'
- elif (os.platform.startswith('win')):
+ elif (sys.platform.startswith('win')):
if (platform.machine().endswith('64')):
gcc_path=gcc_path+"/windows-x86_64/bin"
else:
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index f8b2153aee..4e772e37eb 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -91,9 +91,6 @@ def configure(env):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env["CC"]="clang"
env["LD"]="clang++"
- if (env["colored"]=="yes"):
- if sys.stdout.isatty():
- env.Append(CPPFLAGS=["-fcolor-diagnostics"])
import methods
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 2f6fb00e0d..ce14100fd0 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -38,9 +38,6 @@ def configure(env):
env["CC"]="clang"
env["CXX"]="clang++"
env["LD"]="clang++"
- if (env["colored"]=="yes"):
- if sys.stdout.isatty():
- env.Append(CXXFLAGS=["-fcolor-diagnostics"])
is64=sys.maxsize > 2**32
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 38e738a414..286f5fb0b7 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1366,13 +1366,16 @@ void OS_Windows::set_mouse_mode(MouseMode p_mode) {
POINT pos = { (int) center.x, (int) center.y };
ClientToScreen(hWnd, &pos);
SetCursorPos(pos.x, pos.y);
- ShowCursor(false);
} else {
- ShowCursor(true);
ReleaseCapture();
ClipCursor(NULL);
}
+ if (p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_HIDDEN) {
+ hCursor = SetCursor(NULL);
+ } else {
+ SetCursor(hCursor);
+ }
}
OS_Windows::MouseMode OS_Windows::get_mouse_mode() const{
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index eb71ac7409..917a8a27d7 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -94,10 +94,6 @@ def configure(env):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix=".llvm"
- if (env["colored"]=="yes"):
- if sys.stdout.isatty():
- env.Append(CXXFLAGS=["-fcolor-diagnostics"])
-
if (env["use_sanitizer"]=="yes"):
env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index b5d62adfb4..bd7f4faae5 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -187,39 +187,44 @@ void RayCast2D::_notification(int p_what) {
if (!enabled)
break;
+ _update_raycast_state();
- Ref<World2D> w2d = get_world_2d();
- ERR_BREAK( w2d.is_null() );
-
- Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(w2d->get_space());
- ERR_BREAK( !dss );
-
- Matrix32 gt = get_global_transform();
+ } break;
+ }
+}
- Vector2 to = cast_to;
- if (to==Vector2())
- to=Vector2(0,0.01);
+void RayCast2D::_update_raycast_state() {
+ Ref<World2D> w2d = get_world_2d();
+ ERR_FAIL_COND( w2d.is_null() );
- Physics2DDirectSpaceState::RayResult rr;
+ Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(w2d->get_space());
+ ERR_FAIL_COND( !dss );
- if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude,layer_mask,type_mask)) {
+ Matrix32 gt = get_global_transform();
- collided=true;
- against=rr.collider_id;
- collision_point=rr.position;
- collision_normal=rr.normal;
- against_shape=rr.shape;
- } else {
- collided=false;
- }
+ Vector2 to = cast_to;
+ if (to==Vector2())
+ to=Vector2(0,0.01);
+ Physics2DDirectSpaceState::RayResult rr;
+ if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude,layer_mask,type_mask)) {
- } break;
+ collided=true;
+ against=rr.collider_id;
+ collision_point=rr.position;
+ collision_normal=rr.normal;
+ against_shape=rr.shape;
+ } else {
+ collided=false;
}
}
+void RayCast2D::force_raycast_update() {
+ _update_raycast_state();
+}
+
void RayCast2D::add_exception_rid(const RID& p_rid) {
exclude.insert(p_rid);
@@ -265,6 +270,7 @@ void RayCast2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_cast_to"),&RayCast2D::get_cast_to);
ObjectTypeDB::bind_method(_MD("is_colliding"),&RayCast2D::is_colliding);
+ ObjectTypeDB::bind_method(_MD("force_raycast_update"),&RayCast2D::force_raycast_update);
ObjectTypeDB::bind_method(_MD("get_collider"),&RayCast2D::get_collider);
ObjectTypeDB::bind_method(_MD("get_collider_shape"),&RayCast2D::get_collider_shape);
diff --git a/scene/2d/ray_cast_2d.h b/scene/2d/ray_cast_2d.h
index e1caa8b63e..9bdcc2e199 100644
--- a/scene/2d/ray_cast_2d.h
+++ b/scene/2d/ray_cast_2d.h
@@ -52,6 +52,7 @@ class RayCast2D : public Node2D {
protected:
void _notification(int p_what);
+ void _update_raycast_state();
static void _bind_methods();
public:
@@ -70,6 +71,8 @@ public:
void set_exclude_parent_body(bool p_exclude_parent_body);
bool get_exclude_parent_body() const;
+ void force_raycast_update();
+
bool is_colliding() const;
Object *get_collider() const;
int get_collider_shape() const;
diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp
index 1acda8d1f8..2b8df8265e 100644
--- a/scene/3d/ray_cast.cpp
+++ b/scene/3d/ray_cast.cpp
@@ -134,39 +134,44 @@ void RayCast::_notification(int p_what) {
if (!enabled)
break;
+ _update_raycast_state();
- Ref<World> w3d = get_world();
- ERR_BREAK( w3d.is_null() );
-
- PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space());
- ERR_BREAK( !dss );
-
- Transform gt = get_global_transform();
+ } break;
+ }
+}
- Vector3 to = cast_to;
- if (to==Vector3())
- to=Vector3(0,0.01,0);
+void RayCast::_update_raycast_state(){
+ Ref<World> w3d = get_world();
+ ERR_FAIL_COND( w3d.is_null() );
- PhysicsDirectSpaceState::RayResult rr;
+ PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space());
+ ERR_FAIL_COND( !dss );
- if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude, layer_mask, type_mask)) {
+ Transform gt = get_global_transform();
- collided=true;
- against=rr.collider_id;
- collision_point=rr.position;
- collision_normal=rr.normal;
- against_shape=rr.shape;
- } else {
- collided=false;
- }
+ Vector3 to = cast_to;
+ if (to==Vector3())
+ to=Vector3(0,0.01,0);
+ PhysicsDirectSpaceState::RayResult rr;
+ if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude, layer_mask, type_mask)) {
- } break;
+ collided=true;
+ against=rr.collider_id;
+ collision_point=rr.position;
+ collision_normal=rr.normal;
+ against_shape=rr.shape;
+ } else {
+ collided=false;
}
}
+void RayCast::force_raycast_update() {
+ _update_raycast_state();
+}
+
void RayCast::add_exception_rid(const RID& p_rid) {
exclude.insert(p_rid);
@@ -212,6 +217,7 @@ void RayCast::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_cast_to"),&RayCast::get_cast_to);
ObjectTypeDB::bind_method(_MD("is_colliding"),&RayCast::is_colliding);
+ ObjectTypeDB::bind_method(_MD("force_raycast_update"),&RayCast::force_raycast_update);
ObjectTypeDB::bind_method(_MD("get_collider"),&RayCast::get_collider);
ObjectTypeDB::bind_method(_MD("get_collider_shape"),&RayCast::get_collider_shape);
diff --git a/scene/3d/ray_cast.h b/scene/3d/ray_cast.h
index 4f6514e61b..47553f08ed 100644
--- a/scene/3d/ray_cast.h
+++ b/scene/3d/ray_cast.h
@@ -53,6 +53,7 @@ class RayCast : public Spatial {
protected:
void _notification(int p_what);
+ void _update_raycast_state();
static void _bind_methods();
public:
@@ -68,6 +69,7 @@ public:
void set_type_mask(uint32_t p_mask);
uint32_t get_type_mask() const;
+ void force_raycast_update();
bool is_colliding() const;
Object *get_collider() const;
int get_collider_shape() const;
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 8d228ad859..1df0aafb23 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -7612,6 +7612,11 @@ void VisualServerRaster::set_default_clear_color(const Color& p_color) {
clear_color=p_color;
}
+Color VisualServerRaster::get_default_clear_color() const {
+
+ return clear_color;
+}
+
void VisualServerRaster::set_boot_image(const Image& p_image, const Color& p_color,bool p_scale) {
if (p_image.empty())
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 496820f4a8..1f22e31ab0 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -1283,6 +1283,7 @@ public:
virtual void set_boot_image(const Image& p_image, const Color& p_color, bool p_scale);
virtual void set_default_clear_color(const Color& p_color);
+ virtual Color get_default_clear_color() const;
VisualServerRaster(Rasterizer *p_rasterizer);
~VisualServerRaster();
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index b4e374dd6f..f0fe80d100 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -718,6 +718,7 @@ public:
FUNC3(set_boot_image,const Image& , const Color&,bool );
FUNC1(set_default_clear_color,const Color& );
+ FUNC0RC(Color,get_default_clear_color );
FUNC0R(RID,get_test_cube );
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index dfa0c91c7f..6099a86b96 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -564,6 +564,7 @@ void VisualServer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("free_rid"),&VisualServer::free);
ObjectTypeDB::bind_method(_MD("set_default_clear_color"),&VisualServer::set_default_clear_color);
+ ObjectTypeDB::bind_method(_MD("get_default_clear_color"),&VisualServer::get_default_clear_color);
ObjectTypeDB::bind_method(_MD("get_render_info"),&VisualServer::get_render_info);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 2f3d8371f6..844da2d245 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -1181,6 +1181,7 @@ public:
virtual void set_boot_image(const Image& p_image, const Color& p_color,bool p_scale)=0;
virtual void set_default_clear_color(const Color& p_color)=0;
+ virtual Color get_default_clear_color() const=0;
enum Features {
FEATURE_SHADERS,
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index bdbf20e348..f5741c4a9e 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -1026,6 +1026,34 @@ void EditorSettings::set_optimize_save(bool p_optimize) {
optimize_save=p_optimize;
}
+String EditorSettings::get_last_selected_language()
+{
+ Ref<ConfigFile> cf = memnew( ConfigFile );
+ String path = get_project_settings_path().plus_file("project_metadata.cfg");
+ Error err = cf->load(path);
+ if (err != OK) {
+ WARN_PRINTS("Can't load config file: " + path);
+ return "";
+ }
+ Variant last_selected_language = cf->get_value("script_setup", "last_selected_language");
+ if (last_selected_language.get_type() != Variant::STRING)
+ return "";
+ return static_cast<String>(last_selected_language);
+}
+
+void EditorSettings::set_last_selected_language(String p_language)
+{
+ Ref<ConfigFile> cf = memnew( ConfigFile );
+ String path = get_project_settings_path().plus_file("project_metadata.cfg");
+ Error err = cf->load(path);
+ if (err != OK) {
+ WARN_PRINTS("Can't load config file: " + path);
+ return;
+ }
+ cf->set_value("script_setup", "last_selected_language", p_language);
+ cf->save(path);
+}
+
void EditorSettings::_bind_methods() {
ObjectTypeDB::bind_method(_MD("erase","property"),&EditorSettings::erase);
diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h
index 2a7d3bb4f0..a976602304 100644
--- a/tools/editor/editor_settings.h
+++ b/tools/editor/editor_settings.h
@@ -160,6 +160,9 @@ public:
void set_optimize_save(bool p_optimize);
+ String get_last_selected_language();
+ void set_last_selected_language(String p_language);
+
EditorSettings();
~EditorSettings();
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 3cd6d8336a..99c50efd2f 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1620,6 +1620,7 @@ void ScriptEditor::apply_scripts() const {
void ScriptEditor::_editor_play() {
debugger->start();
+ debug_menu->get_popup()->grab_focus();
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_NEXT), true );
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_STEP), true );
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_BREAK), false );
diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp
index 749198314a..62d5c7cd84 100644
--- a/tools/editor/script_create_dialog.cpp
+++ b/tools/editor/script_create_dialog.cpp
@@ -121,6 +121,8 @@ void ScriptCreateDialog::ok_pressed() {
Ref<Script> scr = ScriptServer::get_language( language_menu->get_selected() )->get_template(cname,parent_name->get_text());
//scr->set_source_code(text);
+ String selected_language = language_menu->get_item_text(language_menu->get_selected());
+ editor_settings->set_last_selected_language(selected_language);
if (cname!="")
scr->set_name(cname);
@@ -330,7 +332,17 @@ ScriptCreateDialog::ScriptCreateDialog() {
language_menu->add_item(ScriptServer::get_language(i)->get_name());
}
- language_menu->select(0);
+ editor_settings = EditorSettings::get_singleton();
+ String last_selected_language = editor_settings->get_last_selected_language();
+ if (last_selected_language != "")
+ for (int i = 0; i < language_menu->get_item_count(); i++)
+ if (language_menu->get_item_text(i) == last_selected_language)
+ {
+ language_menu->select(i);
+ break;
+ }
+ else language_menu->select(0);
+
language_menu->connect("item_selected",this,"_lang_changed");
//parent_name->set_text();
diff --git a/tools/editor/script_create_dialog.h b/tools/editor/script_create_dialog.h
index 181989402e..c71ea16d39 100644
--- a/tools/editor/script_create_dialog.h
+++ b/tools/editor/script_create_dialog.h
@@ -33,6 +33,7 @@
#include "scene/gui/line_edit.h"
#include "scene/gui/option_button.h"
#include "tools/editor/editor_file_dialog.h"
+#include "tools/editor/editor_settings.h"
#include "scene/gui/check_button.h"
class ScriptCreateDialog : public ConfirmationDialog {
@@ -50,6 +51,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
AcceptDialog *alert;
bool path_valid;
String initial_bp;
+ EditorSettings *editor_settings;
void _path_changed(const String& p_path=String());