summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct5
-rw-r--r--core/io/packet_peer.cpp2
-rw-r--r--core/os/os.h2
-rw-r--r--core/script_language.cpp16
-rw-r--r--core/script_language.h2
-rw-r--r--core/variant_call.cpp14
-rw-r--r--drivers/SCsub2
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp15
-rw-r--r--drivers/png/image_loader_png.cpp7
-rw-r--r--drivers/theora/video_stream_theora.cpp29
-rw-r--r--drivers/theora/video_stream_theora.h2
-rwxr-xr-xmethods.py45
-rw-r--r--modules/gdscript/gd_parser.cpp27
-rw-r--r--modules/gdscript/gd_parser.h1
-rw-r--r--modules/gdscript/gd_script.cpp22
-rw-r--r--platform/android/detect.py2
-rw-r--r--platform/osx/os_osx.mm2
-rw-r--r--platform/windows/detect.py36
-rw-r--r--platform/windows/os_windows.cpp2
-rw-r--r--platform/x11/os_x11.cpp2
-rw-r--r--scene/2d/canvas_item.cpp8
-rw-r--r--scene/2d/canvas_item.h1
-rw-r--r--scene/2d/collision_object_2d.cpp4
-rw-r--r--scene/3d/collision_object.cpp4
-rw-r--r--scene/gui/control.cpp7
-rw-r--r--scene/gui/control.h7
-rw-r--r--scene/gui/graph_edit.cpp7
-rw-r--r--scene/gui/graph_edit.h2
-rw-r--r--scene/gui/graph_node.h1
-rw-r--r--scene/gui/tree.cpp41
-rw-r--r--scene/gui/tree.h6
-rw-r--r--scene/register_scene_types.cpp1
-rw-r--r--scene/resources/packed_scene.cpp69
-rw-r--r--scene/resources/packed_scene.h9
-rw-r--r--scene/resources/scene_format_text.cpp150
-rw-r--r--scene/resources/scene_format_text.h2
-rw-r--r--servers/physics/body_sw.h22
-rw-r--r--servers/physics_2d/body_2d_sw.h22
-rw-r--r--tools/editor/animation_editor.cpp4
-rw-r--r--tools/editor/connections_dialog.cpp7
-rw-r--r--tools/editor/editor_data.cpp10
-rw-r--r--tools/editor/editor_data.h1
-rw-r--r--tools/editor/editor_node.cpp25
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp59
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp4
-rw-r--r--tools/editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/sprite_region_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.cpp19
-rw-r--r--tools/editor/project_settings.cpp77
-rw-r--r--tools/editor/project_settings.h9
-rw-r--r--tools/editor/property_editor.cpp202
-rw-r--r--tools/editor/property_editor.h18
-rw-r--r--tools/editor/scene_tree_editor.cpp3
-rw-r--r--tools/editor/script_editor_debugger.cpp4
-rw-r--r--tools/editor/settings_config_dialog.cpp46
-rw-r--r--tools/editor/settings_config_dialog.h2
57 files changed, 744 insertions, 350 deletions
diff --git a/SConstruct b/SConstruct
index b047e961f2..bbc8c7d587 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,5 +1,6 @@
EnsureSConsVersion(0,14);
+
import string
import os
import os.path
@@ -77,6 +78,9 @@ env_base.android_permission_chunk=""
env_base.android_appattributes_chunk=""
env_base.disabled_modules=[]
+env_base.split_drivers=False
+
+
env_base.__class__.android_add_maven_repository=methods.android_add_maven_repository
env_base.__class__.android_add_dependency=methods.android_add_dependency
@@ -90,6 +94,7 @@ env_base.__class__.android_add_to_attributes = methods.android_add_to_attributes
env_base.__class__.disable_module = methods.disable_module
env_base.__class__.add_source_files = methods.add_source_files
+env_base.__class__.use_windows_spawn_fix = methods.use_windows_spawn_fix
env_base["x86_opt_gcc"]=False
env_base["x86_opt_vc"]=False
diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp
index 6cb3daa7ac..973a2ec9a5 100644
--- a/core/io/packet_peer.cpp
+++ b/core/io/packet_peer.cpp
@@ -243,7 +243,7 @@ int PacketPeerStream::get_max_packet_size() const {
void PacketPeerStream::set_stream_peer(const Ref<StreamPeer> &p_peer) {
- ERR_FAIL_COND(p_peer.is_null());
+ //ERR_FAIL_COND(p_peer.is_null());
if (p_peer.ptr() != peer.ptr()) {
ring_buffer.advance_read(ring_buffer.data_left()); // reset the ring buffer
diff --git a/core/os/os.h b/core/os/os.h
index bc3fad302a..e53980a8fe 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -76,7 +76,7 @@ public:
bool fullscreen;
bool resizable;
float get_aspect() const { return (float)width/(float)height; }
- VideoMode(int p_width=1280,int p_height=720,bool p_fullscreen=false, bool p_resizable = true) {width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; }
+ VideoMode(int p_width=1024,int p_height=600,bool p_fullscreen=false, bool p_resizable = true) {width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; }
};
protected:
friend class Main;
diff --git a/core/script_language.cpp b/core/script_language.cpp
index 2ce3844ba3..0eac39e7d1 100644
--- a/core/script_language.cpp
+++ b/core/script_language.cpp
@@ -92,6 +92,22 @@ void ScriptServer::init_languages() {
}
}
+void ScriptInstance::get_property_state(List<Pair<StringName, Variant> > &state) {
+
+ List<PropertyInfo> pinfo;
+ get_property_list(&pinfo);
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+
+ if (E->get().usage&PROPERTY_USAGE_STORAGE) {
+ Pair<StringName,Variant> p;
+ p.first=E->get().name;
+ if (get(p.first,p.second))
+ state.push_back(p);
+ }
+ }
+}
+
+
Variant ScriptInstance::call(const StringName& p_method,VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS;
diff --git a/core/script_language.h b/core/script_language.h
index 3138c88e8e..7e278b8555 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -113,6 +113,8 @@ public:
virtual void get_property_list(List<PropertyInfo> *p_properties) const=0;
virtual Variant::Type get_property_type(const StringName& p_name,bool *r_is_valid=NULL) const=0;
+ virtual void get_property_state(List<Pair<StringName,Variant> > &state);
+
virtual void get_method_list(List<MethodInfo> *p_list) const=0;
virtual bool has_method(const StringName& p_method) const=0;
virtual Variant call(const StringName& p_method,VARIANT_ARG_LIST);
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 90f868c866..78814c83e2 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1451,7 +1451,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(RAW_ARRAY,INT,ByteArray,size,varray());
ADDFUNC2(RAW_ARRAY,NIL,ByteArray,set,INT,"idx",INT,"byte",varray());
- ADDFUNC1(RAW_ARRAY,INT,ByteArray,get,INT,"idx",varray());
+ //ADDFUNC1(RAW_ARRAY,INT,ByteArray,get,INT,"idx",varray());
ADDFUNC1(RAW_ARRAY,NIL,ByteArray,push_back,INT,"byte",varray());
ADDFUNC1(RAW_ARRAY,NIL,ByteArray,resize,INT,"idx",varray());
@@ -1461,37 +1461,37 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(INT_ARRAY,INT,IntArray,size,varray());
ADDFUNC2(INT_ARRAY,NIL,IntArray,set,INT,"idx",INT,"integer",varray());
- ADDFUNC1(INT_ARRAY,INT,IntArray,get,INT,"idx",varray());
+ //ADDFUNC1(INT_ARRAY,INT,IntArray,get,INT,"idx",varray());
ADDFUNC1(INT_ARRAY,NIL,IntArray,push_back,INT,"integer",varray());
ADDFUNC1(INT_ARRAY,NIL,IntArray,resize,INT,"idx",varray());
ADDFUNC0(REAL_ARRAY,INT,RealArray,size,varray());
ADDFUNC2(REAL_ARRAY,NIL,RealArray,set,INT,"idx",REAL,"value",varray());
- ADDFUNC1(REAL_ARRAY,REAL,RealArray,get,INT,"idx",varray());
+ //ADDFUNC1(REAL_ARRAY,REAL,RealArray,get,INT,"idx",varray());
ADDFUNC1(REAL_ARRAY,NIL,RealArray,push_back,REAL,"value",varray());
ADDFUNC1(REAL_ARRAY,NIL,RealArray,resize,INT,"idx",varray());
ADDFUNC0(STRING_ARRAY,INT,StringArray,size,varray());
ADDFUNC2(STRING_ARRAY,NIL,StringArray,set,INT,"idx",STRING,"string",varray());
- ADDFUNC1(STRING_ARRAY,STRING,StringArray,get,INT,"idx",varray());
+ //ADDFUNC1(STRING_ARRAY,STRING,StringArray,get,INT,"idx",varray());
ADDFUNC1(STRING_ARRAY,NIL,StringArray,push_back,STRING,"string",varray());
ADDFUNC1(STRING_ARRAY,NIL,StringArray,resize,INT,"idx",varray());
ADDFUNC0(VECTOR2_ARRAY,INT,Vector2Array,size,varray());
ADDFUNC2(VECTOR2_ARRAY,NIL,Vector2Array,set,INT,"idx",VECTOR2,"vector2",varray());
- ADDFUNC1(VECTOR2_ARRAY,VECTOR2,Vector2Array,get,INT,"idx",varray());
+ //ADDFUNC1(VECTOR2_ARRAY,VECTOR2,Vector2Array,get,INT,"idx",varray());
ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,push_back,VECTOR2,"vector2",varray());
ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,resize,INT,"idx",varray());
ADDFUNC0(VECTOR3_ARRAY,INT,Vector3Array,size,varray());
ADDFUNC2(VECTOR3_ARRAY,NIL,Vector3Array,set,INT,"idx",VECTOR3,"vector3",varray());
- ADDFUNC1(VECTOR3_ARRAY,VECTOR3,Vector3Array,get,INT,"idx",varray());
+ //ADDFUNC1(VECTOR3_ARRAY,VECTOR3,Vector3Array,get,INT,"idx",varray());
ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,push_back,VECTOR3,"vector3",varray());
ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,resize,INT,"idx",varray());
ADDFUNC0(COLOR_ARRAY,INT,ColorArray,size,varray());
ADDFUNC2(COLOR_ARRAY,NIL,ColorArray,set,INT,"idx",COLOR,"color",varray());
- ADDFUNC1(COLOR_ARRAY,COLOR,ColorArray,get,INT,"idx",varray());
+ //ADDFUNC1(COLOR_ARRAY,COLOR,ColorArray,get,INT,"idx",varray());
ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,push_back,COLOR,"color",varray());
ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,resize,INT,"idx",varray());
diff --git a/drivers/SCsub b/drivers/SCsub
index a00d7fc3f9..701738c9f8 100644
--- a/drivers/SCsub
+++ b/drivers/SCsub
@@ -63,7 +63,7 @@ import string
if env['vsproj']=="yes":
env.AddToVSProject(env.drivers_sources)
-if (False): #split drivers, this used to be needed for windows until separate builders for windows were created
+if (env.split_drivers): #split drivers, this used to be needed for windows until separate builders for windows were created
for f in env.drivers_sources:
fname = ""
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index f0978228ff..e3a3e7def3 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -9260,7 +9260,13 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater
glReadBuffer(GL_BACK);
}
#endif
- glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
+ if (current_rt) {
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height);
+ canvas_shader.set_uniform(CanvasShaderGLES2::TEXSCREEN_SCREEN_CLAMP,Color(float(x)/framebuffer.width,float(viewport.y)/framebuffer.height,float(x+viewport.width)/framebuffer.width,float(y+viewport.height)/framebuffer.height));
+ //window_size.height-(viewport.height+viewport.y)
+ } else {
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
+ }
// if (current_clip) {
// // print_line(" a clip ");
// }
@@ -9457,7 +9463,12 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
glReadBuffer(GL_BACK);
}
#endif
- glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,w,h);
+ if (current_rt) {
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,viewport.x,viewport.y,viewport.x,viewport.y,viewport.width,viewport.height);
+ //window_size.height-(viewport.height+viewport.y)
+ } else {
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
+ }
// if (current_clip) {
// // print_line(" a clip ");
// }
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index a86e747d80..50b26d601a 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -124,6 +124,13 @@ Error ImageLoaderPNG::_load_image(void *rf_up,png_rw_ptr p_func,Image *p_image)
png_read_update_info(png, info);
}
+ if (png_get_valid(png,info,PNG_INFO_tRNS)) {
+// png_set_expand_gray_1_2_4_to_8(png);
+ png_set_tRNS_to_alpha(png);
+ png_read_update_info(png, info);
+ png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL);
+ }
+
int palette_colors = 0;
int palette_components = 0;
int components = 0;
diff --git a/drivers/theora/video_stream_theora.cpp b/drivers/theora/video_stream_theora.cpp
index 0659f007e5..1d2e6b9dda 100644
--- a/drivers/theora/video_stream_theora.cpp
+++ b/drivers/theora/video_stream_theora.cpp
@@ -38,8 +38,16 @@ int VideoStreamPlaybackTheora:: buffer_data() {
}
int VideoStreamPlaybackTheora::queue_page(ogg_page *page){
- if(theora_p)ogg_stream_pagein(&to,page);
- if(vorbis_p)ogg_stream_pagein(&vo,page);
+ if(theora_p) {
+ ogg_stream_pagein(&to,page);
+ if (to.e_o_s)
+ theora_eos=true;
+ }
+ if(vorbis_p) {
+ ogg_stream_pagein(&vo,page);
+ if (vo.e_o_s)
+ vorbis_eos=true;
+ }
return 0;
}
@@ -238,6 +246,8 @@ void VideoStreamPlaybackTheora::clear() {
videobuf_ready = 0;
frames_pending = 0;
videobuf_time = 0;
+ theora_eos=false;
+ vorbis_eos=false;
if (file) {
memdelete(file);
@@ -281,6 +291,9 @@ void VideoStreamPlaybackTheora::set_file(const String& p_file) {
th_comment_init(&tc);
th_info_init(&ti);
+ theora_eos=false;
+ vorbis_eos=false;
+
/* Ogg file open; parse the headers */
/* Only interested in Vorbis/Theora streams */
int stateflag = 0;
@@ -499,7 +512,9 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
bool frame_done=false;
bool audio_done=false;
- while (!frame_done || !audio_done) {
+ bool theora_done=false;
+
+ while (!frame_done || (!audio_done && !vorbis_eos)) {
//a frame needs to be produced
ogg_packet op;
@@ -641,10 +656,14 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
break;
}
}
+
+
+ //print_line("no theora: "+itos(no_theora)+" theora eos: "+itos(theora_eos)+" frame done "+itos(frame_done));
+
#ifdef THEORA_USE_THREAD_STREAMING
- if (file && thread_eof && (no_vorbis || no_theora) && ring_buffer.data_left()==0) {
+ if (file && thread_eof && no_theora && theora_eos && ring_buffer.data_left()==0) {
#else
- if (file && /*!videobuf_ready && */ (no_vorbis || no_theora) && file->eof_reached()) {
+ if (file && /*!videobuf_ready && */ no_theora && theora_eos) {
#endif
printf("video done, stopping\n");
stop();
diff --git a/drivers/theora/video_stream_theora.h b/drivers/theora/video_stream_theora.h
index 3e144c0125..f07acb2935 100644
--- a/drivers/theora/video_stream_theora.h
+++ b/drivers/theora/video_stream_theora.h
@@ -36,6 +36,8 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
void video_write(void);
float get_time() const;
+ bool theora_eos;
+ bool vorbis_eos;
ogg_sync_state oy;
ogg_page og;
diff --git a/methods.py b/methods.py
index e8de4696cd..e3cf51be84 100755
--- a/methods.py
+++ b/methods.py
@@ -1309,7 +1309,50 @@ def android_add_to_attributes(self,file):
def disable_module(self):
self.disabled_modules.append(self.current_module)
-
+
+def use_windows_spawn_fix(self):
+
+ if (os.name!="nt"):
+ return #not needed, only for windows
+
+ self.split_drivers=True
+
+ import subprocess
+
+ def mySubProcess(cmdline,env):
+ #print "SPAWNED : " + cmdline
+ startupinfo = subprocess.STARTUPINFO()
+ startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+ proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
+ data, err = proc.communicate()
+ rv = proc.wait()
+ if rv:
+ print "====="
+ print err
+ print "====="
+ return rv
+
+ def mySpawn(sh, escape, cmd, args, env):
+
+ newargs = ' '.join(args[1:])
+ cmdline = cmd + " " + newargs
+
+ rv=0
+ if len(cmdline) > 32000 and cmd.endswith("ar") :
+ cmdline = cmd + " " + args[1] + " " + args[2] + " "
+ for i in range(3,len(args)) :
+ rv = mySubProcess( cmdline + args[i], env )
+ if rv :
+ break
+ else:
+ rv = mySubProcess( cmdline, env )
+
+ return rv
+
+ self['SPAWN'] = mySpawn
+
+
def save_active_platforms(apnames,ap):
for x in ap:
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index c4175e048d..b6e8478846 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -283,13 +283,23 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
return NULL;
}
tokenizer->advance();
- if (tokenizer->get_token()!=GDTokenizer::TK_CONSTANT || tokenizer->get_token_constant().get_type()!=Variant::STRING) {
- _set_error("Expected string constant as 'preload' argument.");
+
+ String path;
+ bool valid = false;
+ Node *subexpr = _parse_and_reduce_expression(p_parent, p_static);
+ if (subexpr) {
+ if (subexpr->type == Node::TYPE_CONSTANT) {
+ ConstantNode *cn = static_cast<ConstantNode*>(subexpr);
+ if (cn->value.get_type() == Variant::STRING) {
+ valid = true;
+ path = (String) cn->value;
+ }
+ }
+ }
+ if (!valid) {
+ _set_error("expected string constant as 'preload' argument.");
return NULL;
}
-
-
- String path = tokenizer->get_token_constant();
if (!path.is_abs_path() && base_path!="")
path=base_path+"/"+path;
path = path.replace("///","//").simplify_path();
@@ -322,8 +332,6 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
}
}
- tokenizer->advance();
-
if (tokenizer->get_token()!=GDTokenizer::TK_PARENTHESIS_CLOSE) {
_set_error("Expected ')' after 'preload' path");
return NULL;
@@ -3145,6 +3153,11 @@ Error GDParser::parse(const String& p_code, const String& p_base_path, bool p_ju
return ret;
}
+bool GDParser::is_tool_script() const {
+
+ return (head && head->type==Node::TYPE_CLASS && static_cast<const ClassNode*>(head)->tool);
+}
+
const GDParser::Node *GDParser::get_parse_tree() const {
return head;
diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h
index 9ad8633968..6c49c1df52 100644
--- a/modules/gdscript/gd_parser.h
+++ b/modules/gdscript/gd_parser.h
@@ -454,6 +454,7 @@ public:
Error parse(const String& p_code, const String& p_base_path="", bool p_just_validate=false,const String& p_self_path="",bool p_for_completion=false);
Error parse_bytecode(const Vector<uint8_t> &p_bytecode,const String& p_base_path="",const String& p_self_path="");
+ bool is_tool_script() const;
const Node *get_parse_tree() const;
//completion info
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 9a3f50d3b8..62c5eb735a 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -1874,19 +1874,27 @@ Error GDScript::reload() {
if (ScriptDebugger::get_singleton()) {
GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),parser.get_error_line(),"Parser Error: "+parser.get_error());
}
- _err_print_error("GDScript::reload",path.empty()?"built-in":(const char*)path.utf8().get_data(),parser.get_error_line(),("Parse Error: "+parser.get_error()).utf8().get_data());
+ _err_print_error("GDScript::reload",path.empty()?"built-in":(const char*)path.utf8().get_data(),parser.get_error_line(),("Parse Error: "+parser.get_error()).utf8().get_data(),ERR_HANDLER_SCRIPT);
ERR_FAIL_V(ERR_PARSE_ERROR);
}
+
+ bool can_run = ScriptServer::is_scripting_enabled() || parser.is_tool_script();
+
GDCompiler compiler;
err = compiler.compile(&parser,this);
if (err) {
- if (ScriptDebugger::get_singleton()) {
- GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),compiler.get_error_line(),"Parser Error: "+compiler.get_error());
+
+ if (can_run) {
+ if (ScriptDebugger::get_singleton()) {
+ GDScriptLanguage::get_singleton()->debug_break_parse(get_path(),compiler.get_error_line(),"Parser Error: "+compiler.get_error());
+ }
+ _err_print_error("GDScript::reload",path.empty()?"built-in":(const char*)path.utf8().get_data(),compiler.get_error_line(),("Compile Error: "+compiler.get_error()).utf8().get_data(),ERR_HANDLER_SCRIPT);
+ ERR_FAIL_V(ERR_COMPILATION_FAILED);
+ } else {
+ return err;
}
- _err_print_error("GDScript::reload",path.empty()?"built-in":(const char*)path.utf8().get_data(),compiler.get_error_line(),("Compile Error: "+compiler.get_error()).utf8().get_data());
- ERR_FAIL_V(ERR_COMPILATION_FAILED);
}
valid=true;
@@ -2053,7 +2061,7 @@ Error GDScript::load_byte_code(const String& p_path) {
GDParser parser;
Error err = parser.parse_bytecode(bytecode,basedir,get_path());
if (err) {
- _err_print_error("GDScript::load_byte_code",path.empty()?"built-in":(const char*)path.utf8().get_data(),parser.get_error_line(),("Parse Error: "+parser.get_error()).utf8().get_data());
+ _err_print_error("GDScript::load_byte_code",path.empty()?"built-in":(const char*)path.utf8().get_data(),parser.get_error_line(),("Parse Error: "+parser.get_error()).utf8().get_data(),ERR_HANDLER_SCRIPT);
ERR_FAIL_V(ERR_PARSE_ERROR);
}
@@ -2061,7 +2069,7 @@ Error GDScript::load_byte_code(const String& p_path) {
err = compiler.compile(&parser,this);
if (err) {
- _err_print_error("GDScript::load_byte_code",path.empty()?"built-in":(const char*)path.utf8().get_data(),compiler.get_error_line(),("Compile Error: "+compiler.get_error()).utf8().get_data());
+ _err_print_error("GDScript::load_byte_code",path.empty()?"built-in":(const char*)path.utf8().get_data(),compiler.get_error_line(),("Compile Error: "+compiler.get_error()).utf8().get_data(),ERR_HANDLER_SCRIPT);
ERR_FAIL_V(ERR_COMPILATION_FAILED);
}
diff --git a/platform/android/detect.py b/platform/android/detect.py
index ee3dc119c2..15ef478e19 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -247,3 +247,5 @@ def configure(env):
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+
+ env.use_windows_spawn_fix()
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 2690ee3ba9..2bb35fdc60 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -839,7 +839,7 @@ const char * OS_OSX::get_video_driver_name(int p_driver) const {
OS::VideoMode OS_OSX::get_default_video_mode() const {
VideoMode vm;
- vm.width=800;
+ vm.width=1024;
vm.height=600;
vm.fullscreen=false;
vm.resizable=true;
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 81247db388..0d7ee64d80 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -267,41 +267,7 @@ def configure(env):
# Workaround for MinGW. See:
# http://www.scons.org/wiki/LongCmdLinesOnWin32
- if (os.name=="nt"):
- import subprocess
-
- def mySubProcess(cmdline,env):
- #print "SPAWNED : " + cmdline
- startupinfo = subprocess.STARTUPINFO()
- startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
- proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
- data, err = proc.communicate()
- rv = proc.wait()
- if rv:
- print "====="
- print err
- print "====="
- return rv
-
- def mySpawn(sh, escape, cmd, args, env):
-
- newargs = ' '.join(args[1:])
- cmdline = cmd + " " + newargs
-
- rv=0
- if len(cmdline) > 32000 and cmd.endswith("ar") :
- cmdline = cmd + " " + args[1] + " " + args[2] + " "
- for i in range(3,len(args)) :
- rv = mySubProcess( cmdline + args[i], env )
- if rv :
- break
- else:
- rv = mySubProcess( cmdline, env )
-
- return rv
-
- env['SPAWN'] = mySpawn
+ env.use_windows_spawn_fix()
#build using mingw
if (os.name=="nt"):
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 6f19f8bdfe..886c43d116 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -149,7 +149,7 @@ const char * OS_Windows::get_video_driver_name(int p_driver) const {
OS::VideoMode OS_Windows::get_default_video_mode() const {
- return VideoMode(1280,720,false);
+ return VideoMode(1024,600,false);
}
int OS_Windows::get_audio_driver_count() const {
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 82df8dff60..f42e93b93f 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -78,7 +78,7 @@ const char * OS_X11::get_video_driver_name(int p_driver) const {
}
OS::VideoMode OS_X11::get_default_video_mode() const {
- return OS::VideoMode(1280,720,false);
+ return OS::VideoMode(1024,600,false);
}
int OS_X11::get_audio_driver_count() const {
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 35b453d71d..316097fbcf 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -1193,6 +1193,14 @@ bool CanvasItem::is_local_transform_notification_enabled() const {
return notify_local_transform;
}
+int CanvasItem::get_canvas_layer() const {
+
+ if (canvas_layer)
+ return canvas_layer->get_layer();
+ else
+ return 0;
+}
+
CanvasItem::CanvasItem() : xform_change(this) {
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 5d10523261..05a2e725e9 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -268,6 +268,7 @@ public:
void set_notify_local_transform(bool p_enable);
bool is_local_transform_notification_enabled() const;
+ int get_canvas_layer() const;
CanvasItem();
~CanvasItem();
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 9b0c24ffd6..3a45b0c84e 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -32,14 +32,14 @@
void CollisionObject2D::_update_shapes_from_children() {
- shapes.resize(0);
+ shapes.clear();
for(int i=0;i<get_child_count();i++) {
Node* n = get_child(i);
n->call("_add_to_collision_object",this);
}
-// _update_shapes();
+ _update_shapes();
}
void CollisionObject2D::_notification(int p_what) {
diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp
index b50878da07..373c356a45 100644
--- a/scene/3d/collision_object.cpp
+++ b/scene/3d/collision_object.cpp
@@ -31,14 +31,14 @@
#include "scene/scene_string_names.h"
void CollisionObject::_update_shapes_from_children() {
- shapes.resize(0);
+ shapes.clear();
for(int i=0;i<get_child_count();i++) {
Node* n = get_child(i);
n->call("_add_to_collision_object",this);
}
-// _update_shapes();
+ _update_shapes();
}
void CollisionObject::_notification(int p_what) {
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 8f6a0b4d53..71a0f50240 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -509,6 +509,10 @@ void Control::_notification(int p_notification) {
update();
} break;
+ case NOTIFICATION_MODAL_CLOSE: {
+
+ emit_signal("modal_close");
+ } break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (!is_visible()) {
@@ -2067,6 +2071,8 @@ Control *Control::get_root_parent_control() const {
return const_cast<Control*>(root);
}
+
+
void Control::_bind_methods() {
@@ -2246,6 +2252,7 @@ void Control::_bind_methods() {
ADD_SIGNAL( MethodInfo("focus_exit") );
ADD_SIGNAL( MethodInfo("size_flags_changed") );
ADD_SIGNAL( MethodInfo("minimum_size_changed") );
+ ADD_SIGNAL( MethodInfo("modal_close") );
}
diff --git a/scene/gui/control.h b/scene/gui/control.h
index a16d88a6df..74d40b7579 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -97,7 +97,12 @@ private:
struct CComparator {
- bool operator()(const Control* p_a, const Control* p_b) const { return p_b->is_greater_than(p_a); }
+ bool operator()(const Control* p_a, const Control* p_b) const {
+ if (p_a->get_canvas_layer()==p_b->get_canvas_layer())
+ return p_b->is_greater_than(p_a);
+ else
+ return p_a->get_canvas_layer() < p_b->get_canvas_layer();
+ }
};
struct Data {
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index d0c82c15b8..9472c589ca 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -2,6 +2,8 @@
#include "os/input.h"
#include "os/keyboard.h"
#include "scene/gui/box_container.h"
+
+
bool GraphEditFilter::has_point(const Point2& p_point) const {
return ge->_filter_input(p_point);
@@ -54,6 +56,11 @@ void GraphEdit::disconnect_node(const StringName& p_from, int p_from_port,const
}
}
+bool GraphEdit::clips_input() const {
+
+ return true;
+}
+
void GraphEdit::get_connection_list(List<Connection> *r_connections) const {
*r_connections=connections;
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index ec278827b1..fe9c36cee4 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -93,7 +93,7 @@ protected:
virtual void add_child_notify(Node *p_child);
virtual void remove_child_notify(Node *p_child);
void _notification(int p_what);
-
+ virtual bool clips_input() const;
public:
Error connect_node(const StringName& p_from, int p_from_port,const StringName& p_to,int p_to_port);
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index 201529380d..dc407a6809 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -49,6 +49,7 @@ class GraphNode : public Container {
bool selected;
protected:
+
void _input_event(const InputEvent& p_ev);
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 66ce117c9d..e81c08dbea 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1721,9 +1721,22 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
}
+void Tree::_text_editor_modal_close() {
+
+ if ( Input::get_singleton()->is_key_pressed(KEY_ESCAPE) ||
+ Input::get_singleton()->is_key_pressed(KEY_ENTER) ||
+ Input::get_singleton()->is_key_pressed(KEY_RETURN) ) {
+
+ return;
+ }
+
+
+ text_editor_enter(text_editor->get_text());
+}
+
+
void Tree::text_editor_enter(String p_text) {
- text_changed=false;
text_editor->hide();
value_editor->hide();
@@ -1762,22 +1775,6 @@ void Tree::text_editor_enter(String p_text) {
}
-void Tree::text_editor_changed(String p_text) {
-
- text_changed=true;
-}
-
-void Tree::text_editor_hide() {
-
- if (!text_changed)
- return;
-
- if (Input::get_singleton()->is_key_pressed(KEY_ESCAPE))
- return;
-
- text_editor_enter(text_editor->get_text());
-}
-
void Tree::value_editor_changed(double p_value) {
if (updating_value_editor) {
@@ -2367,8 +2364,6 @@ bool Tree::edit_selected() {
} else if (c.mode==TreeItem::CELL_MODE_STRING || c.mode==TreeItem::CELL_MODE_RANGE) {
- text_changed=false;
-
Point2i textedpos=get_global_pos() + rect.pos;
text_editor->set_pos( textedpos );
text_editor->set_size( rect.size);
@@ -3204,8 +3199,7 @@ void Tree::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_input_event"),&Tree::_input_event);
ObjectTypeDB::bind_method(_MD("_popup_select"),&Tree::popup_select);
ObjectTypeDB::bind_method(_MD("_text_editor_enter"),&Tree::text_editor_enter);
- ObjectTypeDB::bind_method(_MD("_text_editor_changed"),&Tree::text_editor_changed);
- ObjectTypeDB::bind_method(_MD("_text_editor_hide"),&Tree::text_editor_hide);
+ ObjectTypeDB::bind_method(_MD("_text_editor_modal_close"),&Tree::_text_editor_modal_close);
ObjectTypeDB::bind_method(_MD("_value_editor_changed"),&Tree::value_editor_changed);
ObjectTypeDB::bind_method(_MD("_scroll_moved"),&Tree::_scroll_moved);
@@ -3304,8 +3298,7 @@ Tree::Tree() {
h_scroll->connect("value_changed", this,"_scroll_moved");
v_scroll->connect("value_changed", this,"_scroll_moved");
text_editor->connect("text_entered", this,"_text_editor_enter");
- text_editor->connect("text_changed",this,"_text_editor_changed");
- text_editor->connect("hide",this,"_text_editor_hide");
+ text_editor->connect("modal_close", this,"_text_editor_modal_close");
popup_menu->connect("item_pressed", this,"_popup_select");
value_editor->connect("value_changed", this,"_value_editor_changed");
@@ -3339,8 +3332,6 @@ Tree::Tree() {
hide_folding=false;
- text_changed=false;
-
}
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index 2562e6aaef..e4d349978c 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -271,6 +271,7 @@ friend class TreeItem;
bool range_drag_enabled;
Vector2 range_drag_capture_pos;
+
//TreeItem *cursor_item;
//int cursor_column;
@@ -313,8 +314,7 @@ friend class TreeItem;
void select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col,TreeItem *p_prev=NULL,bool *r_in_range=NULL);
int propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_doubleclick,TreeItem *p_item,int p_button,const InputModifierState& p_mod);
void text_editor_enter(String p_text);
- void text_editor_changed(String p_text);
- void text_editor_hide();
+ void _text_editor_modal_close();
void value_editor_changed(double p_value);
void popup_select(int p_option);
@@ -419,8 +419,6 @@ friend class TreeItem;
bool hide_folding;
- bool text_changed;
-
protected:
static void _bind_methods();
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 6c4fe1be79..3c1b5268fc 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -608,6 +608,7 @@ void register_scene_types() {
OS::get_singleton()->yield(); //may take time to init
+ ObjectTypeDB::register_virtual_type<SceneState>();
ObjectTypeDB::register_type<PackedScene>();
ObjectTypeDB::register_type<SceneTree>();
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 03127620f7..43196a43d4 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -33,7 +33,7 @@
#include "scene/gui/control.h"
#include "scene/2d/node_2d.h"
#include "scene/main/instance_placeholder.h"
-
+#include "core/core_string_names.h"
#define PACK_VERSION 2
bool SceneState::can_instance() const {
@@ -99,6 +99,7 @@ Node *SceneState::instance(bool p_gen_edit_state) const {
Node *node=NULL;
+
if (i==0 && base_scene_idx>=0) {
//scene inheritance on root node
//print_line("scene inherit");
@@ -193,7 +194,26 @@ Node *SceneState::instance(bool p_gen_edit_state) const {
ERR_FAIL_INDEX_V( nprops[j].name, sname_count, NULL );
ERR_FAIL_INDEX_V( nprops[j].value, prop_count, NULL );
- node->set(snames[ nprops[j].name ],props[ nprops[j].value ],&valid);
+ if (snames[ nprops[j].name ]==CoreStringNames::get_singleton()->_script) {
+ //work around to avoid old script variables from disappearing, should be the proper fix to:
+ //https://github.com/godotengine/godot/issues/2958
+
+ //store old state
+ List<Pair<StringName,Variant> > old_state;
+ if (node->get_script_instance()) {
+ node->get_script_instance()->get_property_state(old_state);
+ }
+
+ node->set(snames[ nprops[j].name ],props[ nprops[j].value ],&valid);
+
+ //restore old state for new script, if exists
+ for (List<Pair<StringName,Variant> >::Element *E=old_state.front();E;E=E->next()) {
+ node->set(E->get().first,E->get().second);
+ }
+ } else {
+
+ node->set(snames[ nprops[j].name ],props[ nprops[j].value ],&valid);
+ }
}
}
@@ -460,6 +480,7 @@ Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<S
List<PropertyInfo> plist;
p_node->get_property_list(&plist);
+ bool saved_script=false;
for (List<PropertyInfo>::Element *E=plist.front();E;E=E->next()) {
@@ -508,8 +529,10 @@ Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<S
break;
}
}
-
- if (exists && p_node->get_script_instance()) {
+#if 0
+// this workaround ended up causing problems:
+https://github.com/godotengine/godot/issues/3127
+ if (saved_script && exists && p_node->get_script_instance()) {
//if this is an overriden value by another script, save it anyway
//as the script change will erase it
//https://github.com/godotengine/godot/issues/2958
@@ -522,7 +545,7 @@ Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<S
}
}
-
+#endif
if (exists && bool(Variant::evaluate(Variant::OP_EQUAL,value,original))) {
//exists and did not change
continue;
@@ -543,6 +566,9 @@ Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<S
}
}
+ if (name=="script/script")
+ saved_script=true;
+
NodeData::Property prop;
prop.name=_nm_get_string( name,name_map);
prop.value=_vm_get_variant( value, variant_map);
@@ -1532,7 +1558,39 @@ void SceneState::add_editable_instance(const NodePath& p_path){
editable_instances.push_back(p_path);
}
+DVector<String> SceneState::_get_node_groups(int p_idx) const {
+ Vector<StringName> groups = get_node_groups(p_idx);
+ DVector<String> ret;
+
+ for(int i=0;i<groups.size();i++)
+ ret.push_back(groups[i]);
+
+ return ret;
+}
+
+void SceneState::_bind_methods() {
+
+ //unbuild API
+
+ ObjectTypeDB::bind_method(_MD("get_node_count"),&SceneState::get_node_count);
+ ObjectTypeDB::bind_method(_MD("get_node_type","idx"),&SceneState::get_node_type);
+ ObjectTypeDB::bind_method(_MD("get_node_name","idx"),&SceneState::get_node_name);
+ ObjectTypeDB::bind_method(_MD("get_node_path","idx","for_parent"),&SceneState::get_node_path,DEFVAL(false));
+ ObjectTypeDB::bind_method(_MD("get_node_owner_path","idx"),&SceneState::get_node_owner_path);
+ ObjectTypeDB::bind_method(_MD("get_node_instance:PackedScene","idx"),&SceneState::get_node_instance);
+ ObjectTypeDB::bind_method(_MD("get_node_groups","idx"),&SceneState::_get_node_groups);
+ ObjectTypeDB::bind_method(_MD("get_node_property_count","idx"),&SceneState::get_node_property_count);
+ ObjectTypeDB::bind_method(_MD("get_node_property_name","idx","prop_idx"),&SceneState::get_node_property_name);
+ ObjectTypeDB::bind_method(_MD("get_node_property_value","idx","prop_idx"),&SceneState::get_node_property_value);
+ ObjectTypeDB::bind_method(_MD("get_connection_count"),&SceneState::get_connection_count);
+ ObjectTypeDB::bind_method(_MD("get_connection_source","idx"),&SceneState::get_connection_source);
+ ObjectTypeDB::bind_method(_MD("get_connection_signal","idx"),&SceneState::get_connection_signal);
+ ObjectTypeDB::bind_method(_MD("get_connection_target","idx"),&SceneState::get_connection_target);
+ ObjectTypeDB::bind_method(_MD("get_connection_method","idx"),&SceneState::get_connection_method);
+ ObjectTypeDB::bind_method(_MD("get_connection_flags","idx"),&SceneState::get_connection_flags);
+ ObjectTypeDB::bind_method(_MD("get_connection_binds","idx"),&SceneState::get_connection_binds);
+}
SceneState::SceneState() {
@@ -1635,6 +1693,7 @@ void PackedScene::_bind_methods() {
ObjectTypeDB::bind_method(_MD("can_instance"),&PackedScene::can_instance);
ObjectTypeDB::bind_method(_MD("_set_bundled_scene"),&PackedScene::_set_bundled_scene);
ObjectTypeDB::bind_method(_MD("_get_bundled_scene"),&PackedScene::_get_bundled_scene);
+ ObjectTypeDB::bind_method(_MD("get_state:SceneState"),&PackedScene::get_state);
ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"_bundled"),_SCS("_set_bundled_scene"),_SCS("_get_bundled_scene"));
diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h
index 00a812f16a..7fda4392d8 100644
--- a/scene/resources/packed_scene.h
+++ b/scene/resources/packed_scene.h
@@ -36,6 +36,8 @@
class SceneState : public Reference {
OBJ_TYPE( SceneState, Reference );
+
+
Vector<StringName> names;
Vector<Variant> variants;
Vector<NodePath> node_paths;
@@ -103,6 +105,13 @@ class SceneState : public Reference {
_FORCE_INLINE_ Ref<SceneState> _get_base_scene_state() const;
static bool disable_placeholders;
+
+ DVector<String> _get_node_groups(int p_idx) const;
+
+protected:
+
+ static void _bind_methods();
+
public:
enum {
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 5450b9e2ac..a6cba389f4 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -85,8 +85,7 @@ Error ResourceInteractiveLoaderText::_parse_ext_resource(VariantParser::Stream*
r_res=ResourceLoader::load(path,type);
if (r_res.is_null()) {
- r_err_str="Couldn't load external resource: "+path;
- return ERR_PARSE_ERROR;
+ WARN_PRINT(String("Couldn't load external resource: "+path).utf8().get_data());
}
VariantParser::get_token(p_stream,token,line,r_err_str);
@@ -356,7 +355,7 @@ Error ResourceInteractiveLoaderText::poll() {
int type=-1;
int name=-1;
int instance=-1;
- int base_scene=-1;
+// int base_scene=-1;
if (next_tag.fields.has("name")) {
name=packed_scene->get_state()->add_name(next_tag.fields["name"]);
@@ -394,6 +393,13 @@ Error ResourceInteractiveLoaderText::poll() {
int node_id = packed_scene->get_state()->add_node(parent,owner,type,name,instance);
+ if (next_tag.fields.has("groups")) {
+
+ Array groups = next_tag.fields["groups"];
+ for (int i=0;i<groups.size();i++) {
+ packed_scene->get_state()->add_node_group(node_id,packed_scene->get_state()->add_name(groups[i]));
+ }
+ }
while(true) {
@@ -619,57 +625,63 @@ void ResourceInteractiveLoaderText::get_dependencies(FileAccess *f,List<String>
Error ResourceInteractiveLoaderText::rename_dependencies(FileAccess *p_f, const String &p_path,const Map<String,String>& p_map) {
-
-
-#if 0
- open(p_f);
+ open(p_f,true);
ERR_FAIL_COND_V(error!=OK,error);
//FileAccess
- bool old_format=false;
-
FileAccess *fw = NULL;
String base_path=local_path.get_base_dir();
+
+ uint64_t tag_end = f->get_pos();
+
+
while(true) {
- bool exit;
- List<String> order;
- Tag *tag = parse_tag(&exit,true,&order);
- bool done=false;
- if (!tag) {
+ Error err = VariantParser::parse_tag(&stream,lines,error_text,next_tag,&rp);
+
+ if (err!=OK) {
if (fw) {
memdelete(fw);
}
error=ERR_FILE_CORRUPT;
- ERR_FAIL_COND_V(!exit,error);
- error=ERR_FILE_EOF;
-
- return error;
+ ERR_FAIL_V(error);
}
- if (tag->name=="ext_resource") {
+ if (next_tag.name!="ext_resource") {
- if (!tag->args.has("index") || !tag->args.has("path") || !tag->args.has("type")) {
- old_format=true;
- break;
- }
+ //nothing was done
+ if (!fw)
+ return OK;
+
+ break;
+
+
+ } else {
if (!fw) {
fw=FileAccess::open(p_path+".depren",FileAccess::WRITE);
- fw->store_line("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); //no escape
- fw->store_line("<resource_file type=\""+resource_type+"\" subresource_count=\""+itos(resources_total)+"\" version=\""+itos(VERSION_MAJOR)+"."+itos(VERSION_MINOR)+"\" version_name=\""+VERSION_FULL_NAME+"\">");
+ if (is_scene) {
+ fw->store_line("[gd_scene load_steps="+itos(resources_total)+" format="+itos(FORMAT_VERSION)+"]\n");
+ } else {
+ fw->store_line("[gd_resource type=\""+res_type+"\" load_steps="+itos(resources_total)+" format="+itos(FORMAT_VERSION)+"]\n");
+ }
+ }
+ if (!next_tag.fields.has("path") || !next_tag.fields.has("id") || !next_tag.fields.has("type")) {
+ memdelete(fw);
+ error=ERR_FILE_CORRUPT;
+ ERR_FAIL_V(error);
}
- String path = tag->args["path"];
- String index = tag->args["index"];
- String type = tag->args["type"];
+ String path = next_tag.fields["path"];
+ int index = next_tag.fields["id"];
+ String type = next_tag.fields["type"];
bool relative=false;
@@ -678,7 +690,6 @@ Error ResourceInteractiveLoaderText::rename_dependencies(FileAccess *p_f, const
relative=true;
}
-
if (p_map.has(path)) {
String np=p_map[path];
path=np;
@@ -689,74 +700,15 @@ Error ResourceInteractiveLoaderText::rename_dependencies(FileAccess *p_f, const
path=base_path.path_to_file(path);
}
- tag->args["path"]=path;
- tag->args["index"]=index;
- tag->args["type"]=type;
-
- } else {
-
- done=true;
- }
+ fw->store_line("[ext_resource path=\""+path+"\" type=\""+type+"\" id="+itos(index)+"]");
- String tagt="\t<";
- if (exit)
- tagt+="/";
- tagt+=tag->name;
+ tag_end = f->get_pos();
- for(List<String>::Element *E=order.front();E;E=E->next()) {
- tagt+=" "+E->get()+"=\""+tag->args[E->get()]+"\"";
}
- tagt+=">";
- fw->store_line(tagt);
- if (done)
- break;
- close_tag("ext_resource");
- fw->store_line("\t</ext_resource>");
}
-
- if (old_format) {
- if (fw)
- memdelete(fw);
-
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- da->remove(p_path+".depren");
- memdelete(da);
- //fuck it, use the old approach;
-
- WARN_PRINT(("This file is old, so it can't refactor dependencies, opening and resaving: "+p_path).utf8().get_data());
-
- Error err;
- FileAccess *f2 = FileAccess::open(p_path,FileAccess::READ,&err);
- if (err!=OK) {
- ERR_FAIL_COND_V(err!=OK,ERR_FILE_CANT_OPEN);
- }
-
- Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText );
- ria->local_path=Globals::get_singleton()->localize_path(p_path);
- ria->res_path=ria->local_path;
- ria->remaps=p_map;
- // ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
- ria->open(f2);
-
- err = ria->poll();
-
- while(err==OK) {
- err=ria->poll();
- }
-
- ERR_FAIL_COND_V(err!=ERR_FILE_EOF,ERR_FILE_CORRUPT);
- RES res = ria->get_resource();
- ERR_FAIL_COND_V(!res.is_valid(),ERR_FILE_CORRUPT);
-
- return ResourceFormatSaverText::singleton->save(p_path,res);
- }
-
- if (!fw) {
-
- return OK; //nothing to rename, do nothing
- }
+ f->seek(tag_end);
uint8_t c=f->get_8();
while(!f->eof_reached()) {
@@ -776,13 +728,13 @@ Error ResourceInteractiveLoaderText::rename_dependencies(FileAccess *p_f, const
da->remove(p_path);
da->rename(p_path+".depren",p_path);
memdelete(da);
-#endif
+
return OK;
}
-void ResourceInteractiveLoaderText::open(FileAccess *p_f) {
+void ResourceInteractiveLoaderText::open(FileAccess *p_f,bool p_skip_first_tag) {
error=OK;
@@ -845,13 +797,15 @@ void ResourceInteractiveLoaderText::open(FileAccess *p_f) {
resources_total=0;
}
+ if (!p_skip_first_tag) {
- err = VariantParser::parse_tag(&stream,lines,error_text,next_tag,&rp);
+ err = VariantParser::parse_tag(&stream,lines,error_text,next_tag,&rp);
- if (err) {
- error_text="Unexpected end of file";
- _printerr();
- error=ERR_FILE_CORRUPT;
+ if (err) {
+ error_text="Unexpected end of file";
+ _printerr();
+ error=ERR_FILE_CORRUPT;
+ }
}
rp.ext_func=_parse_ext_resources;
diff --git a/scene/resources/scene_format_text.h b/scene/resources/scene_format_text.h
index 0e844c9165..02436a6e2d 100644
--- a/scene/resources/scene_format_text.h
+++ b/scene/resources/scene_format_text.h
@@ -72,7 +72,7 @@ public:
virtual int get_stage() const;
virtual int get_stage_count() const;
- void open(FileAccess *p_f);
+ void open(FileAccess *p_f, bool p_skip_first_tag=false);
String recognize(FileAccess *p_f);
void get_dependencies(FileAccess *p_f, List<String> *p_dependencies, bool p_add_types);
Error rename_dependencies(FileAccess *p_f, const String &p_path,const Map<String,String>& p_map);
diff --git a/servers/physics/body_sw.h b/servers/physics/body_sw.h
index c958177a19..870e8357f1 100644
--- a/servers/physics/body_sw.h
+++ b/servers/physics/body_sw.h
@@ -93,10 +93,11 @@ class BodySW : public CollisionObjectSW {
struct AreaCMP {
AreaSW *area;
+ int refCount;
_FORCE_INLINE_ bool operator==(const AreaCMP& p_cmp) const { return area->get_self() == p_cmp.area->get_self();}
_FORCE_INLINE_ bool operator<(const AreaCMP& p_cmp) const { return area->get_priority() < p_cmp.area->get_priority();}
_FORCE_INLINE_ AreaCMP() {}
- _FORCE_INLINE_ AreaCMP(AreaSW *p_area) { area=p_area;}
+ _FORCE_INLINE_ AreaCMP(AreaSW *p_area) { area=p_area; refCount=1;}
};
Vector<AreaCMP> areas;
@@ -143,8 +144,23 @@ public:
void set_force_integration_callback(ObjectID p_id,const StringName& p_method,const Variant& p_udata=Variant());
- _FORCE_INLINE_ void add_area(AreaSW *p_area) { areas.ordered_insert(AreaCMP(p_area)); }
- _FORCE_INLINE_ void remove_area(AreaSW *p_area) { areas.erase(AreaCMP(p_area)); }
+ _FORCE_INLINE_ void add_area(AreaSW *p_area) {
+ int index = areas.find(AreaCMP(p_area));
+ if( index > -1 ) {
+ areas[index].refCount += 1;
+ } else {
+ areas.ordered_insert(AreaCMP(p_area));
+ }
+ }
+
+ _FORCE_INLINE_ void remove_area(AreaSW *p_area) {
+ int index = areas.find(AreaCMP(p_area));
+ if( index > -1 ) {
+ areas[index].refCount -= 1;
+ if( areas[index].refCount < 1 )
+ areas.remove(index);
+ }
+ }
_FORCE_INLINE_ void set_max_contacts_reported(int p_size) { contacts.resize(p_size); contact_count=0; if (mode==PhysicsServer::BODY_MODE_KINEMATIC && p_size) set_active(true);}
_FORCE_INLINE_ int get_max_contacts_reported() const { return contacts.size(); }
diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h
index 4bd462ac00..b7f3ab01db 100644
--- a/servers/physics_2d/body_2d_sw.h
+++ b/servers/physics_2d/body_2d_sw.h
@@ -93,10 +93,11 @@ class Body2DSW : public CollisionObject2DSW {
struct AreaCMP {
Area2DSW *area;
+ int refCount;
_FORCE_INLINE_ bool operator==(const AreaCMP& p_cmp) const { return area->get_self() == p_cmp.area->get_self();}
_FORCE_INLINE_ bool operator<(const AreaCMP& p_cmp) const { return area->get_priority() < p_cmp.area->get_priority();}
_FORCE_INLINE_ AreaCMP() {}
- _FORCE_INLINE_ AreaCMP(Area2DSW *p_area) { area=p_area;}
+ _FORCE_INLINE_ AreaCMP(Area2DSW *p_area) { area=p_area; refCount=1;}
};
@@ -143,8 +144,23 @@ public:
void set_force_integration_callback(ObjectID p_id, const StringName& p_method, const Variant &p_udata=Variant());
- _FORCE_INLINE_ void add_area(Area2DSW *p_area) { areas.ordered_insert(AreaCMP(p_area)); }
- _FORCE_INLINE_ void remove_area(Area2DSW *p_area) { areas.erase(AreaCMP(p_area)); }
+ _FORCE_INLINE_ void add_area(Area2DSW *p_area) {
+ int index = areas.find(AreaCMP(p_area));
+ if( index > -1 ) {
+ areas[index].refCount += 1;
+ } else {
+ areas.ordered_insert(AreaCMP(p_area));
+ }
+ }
+
+ _FORCE_INLINE_ void remove_area(Area2DSW *p_area) {
+ int index = areas.find(AreaCMP(p_area));
+ if( index > -1 ) {
+ areas[index].refCount -= 1;
+ if( areas[index].refCount < 1 )
+ areas.remove(index);
+ }
+ }
_FORCE_INLINE_ void set_max_contacts_reported(int p_size) { contacts.resize(p_size); contact_count=0; if (mode==Physics2DServer::BODY_MODE_KINEMATIC && p_size) set_active(true);}
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index fbe50d6d96..cdce910665 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -2814,6 +2814,8 @@ void AnimationKeyEditor::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
+ key_editor->edit(key_edit);
+
zoomicon->set_texture( get_icon("Zoom","EditorIcons") );
menu_add_track->set_icon(get_icon("AddTrack","EditorIcons"));
@@ -3924,7 +3926,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
key_edit = memnew( AnimationKeyEdit );
key_edit->undo_redo=undo_redo;
//key_edit->ke_dialog=key_edit_dialog;
- key_editor->edit(key_edit);
+
type_menu = memnew( PopupMenu );
add_child(type_menu);
for(int i=0;i<Variant::VARIANT_MAX;i++)
diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp
index e94bc78f5d..1e530b21c2 100644
--- a/tools/editor/connections_dialog.cpp
+++ b/tools/editor/connections_dialog.cpp
@@ -96,7 +96,11 @@ void ConnectDialog::_notification(int p_what) {
RID ci = get_canvas_item();
get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
- }
+ }
+
+ if (p_what==NOTIFICATION_ENTER_TREE) {
+ bind_editor->edit(cdbinds);
+ }
}
void ConnectDialog::_tree_node_selected() {
@@ -456,7 +460,6 @@ ConnectDialog::ConnectDialog() {
set_as_toplevel(true);
cdbinds = memnew( ConnectDialogBinds );
- bind_editor->edit(cdbinds);
error = memnew( ConfirmationDialog );
add_child(error);
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp
index 5e613c658b..c872b1c3ca 100644
--- a/tools/editor/editor_data.cpp
+++ b/tools/editor/editor_data.cpp
@@ -635,6 +635,16 @@ String EditorData::get_scene_type(int p_idx) const {
return edited_scene[p_idx].root->get_type();
}
+void EditorData::move_edited_scene_to_index(int p_idx) {
+
+ ERR_FAIL_INDEX(current_edited_scene,edited_scene.size());
+ ERR_FAIL_INDEX(p_idx,edited_scene.size());
+
+ EditedScene es=edited_scene[current_edited_scene];
+ edited_scene.remove(current_edited_scene);
+ edited_scene.insert(p_idx,es);
+ current_edited_scene=p_idx;
+}
Ref<Script> EditorData::get_scene_root_script(int p_idx) const {
diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h
index 7dafeeea04..fcc8ccef06 100644
--- a/tools/editor/editor_data.h
+++ b/tools/editor/editor_data.h
@@ -196,6 +196,7 @@ public:
void set_edited_scene_live_edit_root(const NodePath& p_root);
NodePath get_edited_scene_live_edit_root();
bool check_and_update_scene(int p_idx);
+ void move_edited_scene_to_index(int p_idx);
void set_plugin_window_layout(Ref<ConfigFile> p_layout);
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 8d36134605..79f5e66401 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -2367,7 +2367,14 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
if (!scene)
break;
-
+
+ String filename = scene->get_filename();
+
+ if (filename==String()) {
+ show_warning("Can't reload a scene that was never saved..");
+ break;
+ }
+
if (unsaved_cache && !p_confirmed) {
confirmation->get_ok()->set_text("Revert");
confirmation->set_text("This action cannot be undone. Revert anyway?");
@@ -2375,7 +2382,13 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
break;
}
- Error err = load_scene(scene->get_filename());
+
+ int cur_idx = editor_data.get_edited_scene();
+ _remove_edited_scene();
+ Error err = load_scene(filename);
+ editor_data.move_edited_scene_to_index(cur_idx);
+ get_undo_redo()->clear_history();
+ scene_tabs->set_current_tab(cur_idx);
} break;
@@ -4520,14 +4533,14 @@ void EditorNode::_scene_tab_changed(int p_tab) {
editor_data.get_undo_redo().create_action("Switch Scene Tab");
editor_data.get_undo_redo().add_do_method(this,"set_current_version",unsaved?saved_version:0);
editor_data.get_undo_redo().add_do_method(this,"set_current_scene",p_tab);
- editor_data.get_undo_redo().add_do_method(scene_tabs,"set_current_tab",p_tab);
- editor_data.get_undo_redo().add_do_method(scene_tabs,"ensure_tab_visible",p_tab);
+ //editor_data.get_undo_redo().add_do_method(scene_tabs,"set_current_tab",p_tab);
+ //editor_data.get_undo_redo().add_do_method(scene_tabs,"ensure_tab_visible",p_tab);
editor_data.get_undo_redo().add_do_method(this,"set_current_version",next_scene_version==0?editor_data.get_undo_redo().get_version()+1:next_scene_version);
editor_data.get_undo_redo().add_undo_method(this,"set_current_version",next_scene_version);
editor_data.get_undo_redo().add_undo_method(this,"set_current_scene",editor_data.get_edited_scene());
- editor_data.get_undo_redo().add_undo_method(scene_tabs,"set_current_tab",editor_data.get_edited_scene());
- editor_data.get_undo_redo().add_undo_method(scene_tabs,"ensure_tab_visible",p_tab,editor_data.get_edited_scene());
+ //editor_data.get_undo_redo().add_undo_method(scene_tabs,"set_current_tab",editor_data.get_edited_scene());
+ //editor_data.get_undo_redo().add_undo_method(scene_tabs,"ensure_tab_visible",p_tab,editor_data.get_edited_scene());
editor_data.get_undo_redo().add_undo_method(this,"set_current_version",saved_version);
editor_data.get_undo_redo().commit_action();
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp
index b56140b32d..43b4276d45 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_player_editor_plugin.cpp
@@ -93,7 +93,7 @@ void AnimationPlayerEditor::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
- editor->connect("hide_animation_player_editors",this,"_hide_anim_editors");
+// editor->connect("hide_animation_player_editors",this,"_hide_anim_editors");
add_anim->set_icon( get_icon("New","EditorIcons") );
rename_anim->set_icon( get_icon("Rename","EditorIcons") );
duplicate_anim->set_icon( get_icon("Duplicate","EditorIcons") );
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index a259fa0fcc..0afea26957 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -603,6 +603,9 @@ bool CanvasItemEditor::_select(CanvasItem *item, Point2 p_click_pos, bool p_appe
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -643,6 +646,9 @@ void CanvasItemEditor::_key_move(const Vector2& p_dir, bool p_snap, KeyMoveMODE
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -702,6 +708,9 @@ Point2 CanvasItemEditor::_find_topleftmost_point() {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
@@ -731,6 +740,9 @@ int CanvasItemEditor::get_item_count() {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
ic++;
};
@@ -749,6 +761,8 @@ CanvasItem *CanvasItemEditor::get_single_item() {
CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
if (single_item)
return NULL; //morethan one
@@ -1102,6 +1116,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
@@ -1194,6 +1211,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -1400,6 +1420,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -1507,6 +1530,9 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -1881,6 +1907,8 @@ void CanvasItemEditor::_viewport_draw() {
CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>();
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
CanvasItemEditorSelectedItem *se=editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
if (!se)
continue;
@@ -2104,6 +2132,9 @@ void CanvasItemEditor::_notification(int p_what) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
if (canvas_item->cast_to<Control>())
has_control=true;
else
@@ -2509,6 +2540,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
canvas_item->set_meta("_edit_lock_",true);
emit_signal("item_lock_status_changed");
}
@@ -2524,6 +2558,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
canvas_item->set_meta("_edit_lock_",Variant());
emit_signal("item_lock_status_changed");
@@ -2542,6 +2579,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
canvas_item->set_meta("_edit_group_",true);
emit_signal("item_group_status_changed");
}
@@ -2557,6 +2597,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
canvas_item->set_meta("_edit_group_",Variant());
emit_signal("item_group_status_changed");
}
@@ -2575,6 +2618,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
Control *c = canvas_item->cast_to<Control>();
if (!c)
@@ -2693,6 +2739,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
if (canvas_item->cast_to<Node2D>()) {
Node2D *n2d = canvas_item->cast_to<Node2D>();
@@ -2803,6 +2852,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
if (canvas_item->cast_to<Node2D>()) {
@@ -2853,6 +2904,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
if (canvas_item->cast_to<Node2D>()) {
Node2D *n2d = canvas_item->cast_to<Node2D>();
@@ -2887,6 +2941,9 @@ void CanvasItemEditor::_popup_callback(int p_op) {
for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) {
CanvasItem *canvas_item = E->key()->cast_to<CanvasItem>();
if (!canvas_item) continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
+
// counting invisible items, for now
//if (!canvas_item->is_visible()) continue;
@@ -2979,6 +3036,8 @@ void CanvasItemEditor::_popup_callback(int p_op) {
if (!canvas_item || !canvas_item->is_visible())
continue;
+ if (canvas_item->get_viewport()!=EditorNode::get_singleton()->get_scene_root())
+ continue;
canvas_item->set_meta("_edit_ik_",true);
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 76e4af5f16..34d7e89760 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1018,8 +1018,10 @@ void ScriptEditor::_menu_option(int p_option) {
script_create_dialog->popup_centered(Size2(300, 300));
} break;
case FILE_SAVE: {
- if (!_test_script_times_on_disk())
+
+ if (_test_script_times_on_disk())
return;
+
editor->save_resource( current->get_edited_script() );
} break;
diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp
index 65b5365b50..18d8f5efc0 100644
--- a/tools/editor/plugins/shader_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_editor_plugin.cpp
@@ -234,7 +234,7 @@ void ShaderEditor::_tab_changed(int p_which) {
ShaderTextEditor *shader_editor = tab_container->get_tab_control(p_which)->cast_to<ShaderTextEditor>();
- if (shader_editor)
+ if (shader_editor && is_inside_tree())
shader_editor->get_text_edit()->grab_focus();
ensure_select_current();
diff --git a/tools/editor/plugins/sprite_region_editor_plugin.cpp b/tools/editor/plugins/sprite_region_editor_plugin.cpp
index 725de19dd7..8dfa8a60a6 100644
--- a/tools/editor/plugins/sprite_region_editor_plugin.cpp
+++ b/tools/editor/plugins/sprite_region_editor_plugin.cpp
@@ -367,7 +367,7 @@ void SpriteRegionEditor::edit(Node *p_sprite)
{
if (p_sprite) {
node=p_sprite->cast_to<Sprite>();
- node->connect("exit_tree",this,"_node_removed",varray(),CONNECT_ONESHOT);
+ node->connect("exit_tree",this,"_node_removed",varray(p_sprite),CONNECT_ONESHOT);
} else {
if (node)
node->disconnect("exit_tree",this,"_node_removed");
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp
index 29326a2222..acacd37f66 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_map_editor_plugin.cpp
@@ -533,6 +533,8 @@ void TileMapEditor::_canvas_draw() {
if (node->get_half_offset()!=TileMap::HALF_OFFSET_X) {
+ int max_lines=2000; //avoid crash if size too smal
+
for(int i=(si.pos.x)-1;i<=(si.pos.x+si.size.x);i++) {
Vector2 from = xform.xform(node->map_to_world(Vector2(i,si.pos.y)));
@@ -540,10 +542,12 @@ void TileMapEditor::_canvas_draw() {
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
-
+ if (max_lines--==0)
+ break;
}
} else {
+ int max_lines=10000; //avoid crash if size too smal
for(int i=(si.pos.x)-1;i<=(si.pos.x+si.size.x);i++) {
@@ -558,11 +562,17 @@ void TileMapEditor::_canvas_draw() {
Vector2 to = xform.xform(node->map_to_world(Vector2(i,j+1),true)+ofs);
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
+
+ if (max_lines--==0)
+ break;
+
}
}
}
+ int max_lines=10000; //avoid crash if size too smal
+
if (node->get_half_offset()!=TileMap::HALF_OFFSET_Y) {
for(int i=(si.pos.y)-1;i<=(si.pos.y+si.size.y);i++) {
@@ -573,6 +583,9 @@ void TileMapEditor::_canvas_draw() {
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
+ if (max_lines--==0)
+ break;
+
}
} else {
@@ -590,6 +603,10 @@ void TileMapEditor::_canvas_draw() {
Vector2 to = xform.xform(node->map_to_world(Vector2(j+1,i),true)+ofs);
Color col=i==0?Color(1,0.8,0.2,0.5):Color(1,0.3,0.1,0.2);
canvas_item_editor->draw_line(from,to,col,1);
+
+ if (max_lines--==0)
+ break;
+
}
}
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index 26e8919375..6c5e18ec9a 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -60,6 +60,9 @@ void ProjectSettings::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
+ search_button->set_icon(get_icon("Zoom","EditorIcons"));
+ clear_button->set_icon(get_icon("Close","EditorIcons"));
+
translation_list->connect("button_pressed",this,"_translation_delete");
_update_actions();
popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),"Key",InputEvent::KEY);
@@ -90,9 +93,7 @@ void ProjectSettings::_notification(int p_what) {
autoload_file_open->add_filter("*."+E->get());
}
- } else if (p_what==NOTIFICATION_POST_POPUP) {
- globals_editor->clear_search_box();
}
}
@@ -1338,6 +1339,32 @@ void ProjectSettings::_update_autoload() {
}
+void ProjectSettings::_toggle_search_bar(bool p_pressed) {
+
+ globals_editor->get_property_editor()->set_use_filter(p_pressed);
+
+ if (p_pressed) {
+
+ search_bar->show();
+ add_prop_bar->hide();
+ search_box->grab_focus();
+ search_box->select_all();
+ } else {
+
+ search_bar->hide();
+ add_prop_bar->show();
+ }
+}
+
+void ProjectSettings::_clear_search_box() {
+
+ if (search_box->get_text()=="")
+ return;
+
+ search_box->clear();
+ globals_editor->get_property_editor()->update_tree();
+}
+
void ProjectSettings::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_item_selected"),&ProjectSettings::_item_selected);
@@ -1380,6 +1407,9 @@ void ProjectSettings::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_autoload_delete"),&ProjectSettings::_autoload_delete);
ObjectTypeDB::bind_method(_MD("_autoload_edited"),&ProjectSettings::_autoload_edited);
+ ObjectTypeDB::bind_method(_MD("_clear_search_box"),&ProjectSettings::_clear_search_box);
+ ObjectTypeDB::bind_method(_MD("_toggle_search_bar"),&ProjectSettings::_toggle_search_bar);
+
}
ProjectSettings::ProjectSettings(EditorData *p_data) {
@@ -1410,50 +1440,77 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
props_base->add_child(hbc);
+ search_button = memnew( ToolButton );
+ search_button->set_toggle_mode(true);
+ search_button->set_pressed(false);
+ search_button->set_text("Search");
+ hbc->add_child(search_button);
+ search_button->connect("toggled",this,"_toggle_search_bar");
+
+ hbc->add_child( memnew( VSeparator ) );
+
+ add_prop_bar = memnew( HBoxContainer );
+ add_prop_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ hbc->add_child(add_prop_bar);
+
Label *l = memnew( Label );
- hbc->add_child(l);
+ add_prop_bar->add_child(l);
l->set_text("Category:");
category = memnew( LineEdit );
category->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- hbc->add_child(category);
+ add_prop_bar->add_child(category);
category->connect("text_entered",this,"_item_adds");
l = memnew( Label );
- hbc->add_child(l);
+ add_prop_bar->add_child(l);
l->set_text("Property:");
property = memnew( LineEdit );
property->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- hbc->add_child(property);
+ add_prop_bar->add_child(property);
property->connect("text_entered",this,"_item_adds");
l = memnew( Label );
- hbc->add_child(l);
+ add_prop_bar->add_child(l);
l->set_text("Type:");
type = memnew( OptionButton );
type->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- hbc->add_child(type);
+ add_prop_bar->add_child(type);
type->add_item("bool");
type->add_item("int");
type->add_item("float");
type->add_item("string");
Button *add = memnew( Button );
- hbc->add_child(add);
+ add_prop_bar->add_child(add);
add->set_text("Add");
add->connect("pressed",this,"_item_add");
Button *del = memnew( Button );
- hbc->add_child(del);
+ add_prop_bar->add_child(del);
del->set_text("Del");
del->connect("pressed",this,"_item_del");
+ search_bar = memnew( HBoxContainer );
+ search_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ hbc->add_child(search_bar);
+ search_bar->hide();
+
+ search_box = memnew( LineEdit );
+ search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ search_bar->add_child(search_box);
+
+ clear_button = memnew( ToolButton );
+ search_bar->add_child(clear_button);
+ clear_button->connect("pressed",this,"_clear_search_box");
+
globals_editor = memnew( SectionedPropertyEditor );
props_base->add_child(globals_editor);
//globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ globals_editor->get_property_editor()->register_text_enter(search_box);
globals_editor->get_property_editor()->set_capitalize_paths(false);
globals_editor->get_property_editor()->get_scene_tree()->connect("cell_selected",this,"_item_selected");
globals_editor->get_property_editor()->connect("property_toggled",this,"_item_checked",varray(),CONNECT_DEFERRED);
diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h
index cbf24e7bfd..b689340fdf 100644
--- a/tools/editor/project_settings.h
+++ b/tools/editor/project_settings.h
@@ -48,6 +48,12 @@ class ProjectSettings : public AcceptDialog {
UndoRedo *undo_redo;
SectionedPropertyEditor *globals_editor;
+ HBoxContainer *search_bar;
+ ToolButton *search_button;
+ LineEdit *search_box;
+ ToolButton *clear_button;
+
+ HBoxContainer *add_prop_bar;
ConfirmationDialog *message;
LineEdit *category;
LineEdit *property;
@@ -136,6 +142,9 @@ class ProjectSettings : public AcceptDialog {
void _translation_res_option_changed();
void _translation_res_option_delete(Object *p_item,int p_column, int p_button);
+ void _toggle_search_bar(bool p_pressed);
+ void _clear_search_box();
+
ProjectSettings();
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 16e4d4ec6c..4b1b93ea6e 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "property_editor.h"
+#include "scene/gui/label.h"
#include "io/resource_loader.h"
#include "io/image_loader.h"
#include "object_type_db.h"
@@ -34,6 +35,7 @@
#include "globals.h"
#include "scene/resources/font.h"
#include "pair.h"
+#include "scene/scene_string_names.h"
#include "editor_settings.h"
#include "editor_import_export.h"
#include "editor_node.h"
@@ -41,8 +43,6 @@
#include "array_property_edit.h"
#include "editor_help.h"
#include "scene/resources/packed_scene.h"
-#include "os/input.h"
-#include "os/keyboard.h"
void CustomPropertyEditor::_notification(int p_what) {
@@ -52,16 +52,11 @@ void CustomPropertyEditor::_notification(int p_what) {
RID ci = get_canvas_item();
get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
+ /*
+ if (v.get_type()==Variant::COLOR) {
- } else if (p_what==NOTIFICATION_POPUP_HIDE) {
-
- if (!text_changed)
- return;
-
- if (Input::get_singleton()->is_key_pressed(KEY_ESCAPE))
- return;
-
- _modified(String());
+ VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( 10,10,60, get_size().height-20 ), v );
+ }*/
}
}
@@ -240,8 +235,6 @@ String CustomPropertyEditor::get_name() const {
bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Type p_type, const Variant& p_variant,int p_hint,String p_hint_text) {
- text_changed=false;
-
owner=p_owner;
updating=true;
name=p_name;
@@ -261,6 +254,8 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
value_editor[i]->hide();
value_label[i]->hide();
+ if (i<4)
+ scroll[i]->hide();
}
for (int i=0;i<MAX_ACTION_BUTTONS;i++) {
@@ -596,10 +591,44 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
} break;
case Variant::COLOR: {
+
color_picker->show();
color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA);
color_picker->set_color(v);
set_size( Size2(300, color_picker->get_combined_minimum_size().height+10));
+ /*
+ int ofs=80;
+ int m=10;
+ int h=20;
+ Color c=v;
+ float values[4]={c.r,c.g,c.b,c.a};
+ for (int i=0;i<4;i++) {
+ int y=m+i*h;
+
+ value_editor[i]->show();
+ value_label[i]->show();
+ value_label[i]->set_pos(Point2(ofs,y));
+ scroll[i]->set_min(0);
+ scroll[i]->set_max(1.0);
+ scroll[i]->set_page(0);
+ scroll[i]->set_pos(Point2(ofs+15,y+Math::floor((h-scroll[i]->get_minimum_size().height)/2.0)));
+ scroll[i]->set_val(values[i]);
+ scroll[i]->set_size(Size2(120,1));
+ scroll[i]->show();
+ value_editor[i]->set_pos(Point2(ofs+140,y));
+ value_editor[i]->set_size(Size2(40,h));
+ value_editor[i]->set_text( String::num(values[i],2 ));
+
+ }
+
+ value_label[0]->set_text("R");
+ value_label[1]->set_text("G");
+ value_label[2]->set_text("B");
+ value_label[3]->set_text("A");
+
+ Size2 new_size = value_editor[3]->get_pos() + value_editor[3]->get_size() + Point2(10,10);
+ set_size( new_size );
+ */
} break;
case Variant::IMAGE: {
@@ -1155,8 +1184,37 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
} break;
default: {};
}
+
+}
+
+void CustomPropertyEditor::_scroll_modified(double p_value) {
+
+ if (updating)
+ return;
+ /*
+ switch(type) {
+
+ case Variant::COLOR: {
+
+ for (int i=0;i<4;i++) {
+
+ value_editor[i]->set_text( String::num(scroll[i]->get_val(),2) );
+ }
+ Color c;
+ c.r=scroll[0]->get_val();
+ c.g=scroll[1]->get_val();
+ c.b=scroll[2]->get_val();
+ c.a=scroll[3]->get_val();
+ v=c;
+ update();
+ emit_signal("variant_changed");
+ } break;
+ default: {}
+ }
+ */
}
+
void CustomPropertyEditor::_drag_easing(const InputEvent& p_ev) {
@@ -1251,7 +1309,6 @@ void CustomPropertyEditor::_modified(String p_string) {
if (updating)
return;
updating=true;
- text_changed=false;
switch(type) {
case Variant::REAL: {
@@ -1378,8 +1435,20 @@ void CustomPropertyEditor::_modified(String p_string) {
} break;
case Variant::COLOR: {
+ /*
+ for (int i=0;i<4;i++) {
-
+ scroll[i]->set_val( value_editor[i]->get_text().to_double() );
+ }
+ Color c;
+ c.r=value_editor[0]->get_text().to_double();
+ c.g=value_editor[1]->get_text().to_double();
+ c.b=value_editor[2]->get_text().to_double();
+ c.a=value_editor[3]->get_text().to_double();
+ v=c;
+ update();
+ emit_signal("variant_changed");
+ */
} break;
case Variant::IMAGE: {
@@ -1532,11 +1601,9 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns,int
value_label[i]->hide();
}
}
-}
-void CustomPropertyEditor::_text_editor_changed(String p_text) {
- text_changed=true;
+
}
void CustomPropertyEditor::_bind_methods() {
@@ -1545,6 +1612,7 @@ void CustomPropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method("_focus_exit", &CustomPropertyEditor::_focus_exit);
ObjectTypeDB::bind_method("_modified",&CustomPropertyEditor::_modified);
ObjectTypeDB::bind_method("_range_modified", &CustomPropertyEditor::_range_modified);
+ ObjectTypeDB::bind_method("_scroll_modified",&CustomPropertyEditor::_scroll_modified);
ObjectTypeDB::bind_method("_action_pressed",&CustomPropertyEditor::_action_pressed);
ObjectTypeDB::bind_method("_file_selected",&CustomPropertyEditor::_file_selected);
ObjectTypeDB::bind_method("_type_create_selected",&CustomPropertyEditor::_type_create_selected);
@@ -1552,9 +1620,9 @@ void CustomPropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method("_color_changed",&CustomPropertyEditor::_color_changed);
ObjectTypeDB::bind_method("_draw_easing",&CustomPropertyEditor::_draw_easing);
ObjectTypeDB::bind_method("_drag_easing",&CustomPropertyEditor::_drag_easing);
- ObjectTypeDB::bind_method("_text_edit_changed",&CustomPropertyEditor::_text_edit_changed);
- ObjectTypeDB::bind_method("_menu_option",&CustomPropertyEditor::_menu_option);
- ObjectTypeDB::bind_method("_text_editor_changed",&CustomPropertyEditor::_text_editor_changed);
+ ObjectTypeDB::bind_method( "_text_edit_changed",&CustomPropertyEditor::_text_edit_changed);
+ ObjectTypeDB::bind_method( "_menu_option",&CustomPropertyEditor::_menu_option);
+
ADD_SIGNAL( MethodInfo("variant_changed") );
ADD_SIGNAL( MethodInfo("resource_edit_request") );
@@ -1565,8 +1633,6 @@ CustomPropertyEditor::CustomPropertyEditor() {
read_only=false;
updating=false;
- text_changed=false;
-
for (int i=0;i<MAX_VALUE_EDITORS;i++) {
value_editor[i]=memnew( LineEdit );
@@ -1576,11 +1642,22 @@ CustomPropertyEditor::CustomPropertyEditor() {
value_editor[i]->hide();
value_label[i]->hide();
value_editor[i]->connect("text_entered", this,"_modified");
- value_editor[i]->connect("text_changed", this, "_text_editor_changed");
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++) {
+
+ scroll[i] = memnew( HScrollBar );
+ scroll[i]->hide();
+ scroll[i]->set_min(0);
+ scroll[i]->set_max(1.0);
+ scroll[i]->set_step(0.01);
+ add_child(scroll[i]);
+ scroll[i]->connect("value_changed", this,"_scroll_modified");
+
+ }
+
for(int i=0;i<20;i++) {
checks20[i]=memnew( Button );
checks20[i]->set_toggle_mode(true);
@@ -1652,6 +1729,7 @@ CustomPropertyEditor::CustomPropertyEditor() {
easing_draw->hide();
easing_draw->connect("draw",this,"_draw_easing");
easing_draw->connect("input_event",this,"_drag_easing");
+ //easing_draw->emit_signal(SceneStringNames::get_singleton()->input_event,InputEvent());
easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE);
menu = memnew(PopupMenu);
@@ -1967,7 +2045,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
if (img.empty())
p_item->set_text(1,"[Image (empty)]");
else
- p_item->set_text(1,"[Image "+itos(img.get_width())+"x"+itos(img.get_height())+"]");
+ p_item->set_text(1,"[Image "+itos(img.get_width())+"x"+itos(img.get_height())+"-"+String(Image::get_format_name(img.get_format()))+"]");
} break;
case Variant::NODE_PATH: {
@@ -2929,7 +3007,7 @@ void PropertyEditor::update_tree() {
if (img.empty())
item->set_text(1,"[Image (empty)]");
else
- item->set_text(1,"[Image "+itos(img.get_width())+"x"+itos(img.get_height())+"]");
+ item->set_text(1,"[Image "+itos(img.get_width())+"x"+itos(img.get_height())+"-"+String(Image::get_format_name(img.get_format()))+"]");
if (show_type_icons)
item->set_icon( 0,get_icon("Image","EditorIcons") );
@@ -3021,7 +3099,7 @@ void PropertyEditor::update_tree() {
int usage = d.has("usage")?int(int(d["usage"])&(PROPERTY_USAGE_STORE_IF_NONONE|PROPERTY_USAGE_STORE_IF_NONZERO)):0;
if (_get_instanced_node_original_property(p.name,vorig) || usage) {
Variant v = obj->get(p.name);
-
+
if (_is_property_different(v,vorig,usage)) {
//print_line("FOR "+String(p.name)+" RELOAD WITH: "+String(v)+"("+Variant::get_type_name(v.get_type())+")=="+String(vorig)+"("+Variant::get_type_name(vorig.get_type())+")");
@@ -3699,10 +3777,6 @@ class SectionedPropertyEditorFilter : public Object {
for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
PropertyInfo pi=E->get();
-
- if (section=="")
- p_list->push_back(pi);
-
int sp = pi.name.find("/");
if (sp!=-1) {
String ss = pi.name.substr(0,sp);
@@ -3712,7 +3786,7 @@ class SectionedPropertyEditorFilter : public Object {
p_list->push_back(pi);
}
} else {
- if (section=="global")
+ if (section=="")
p_list->push_back(pi);
}
}
@@ -3737,18 +3811,10 @@ public:
};
-void SectionedPropertyEditor::_notification(int p_what) {
-
- if (p_what==NOTIFICATION_ENTER_TREE) {
-
- clear_button->set_icon(get_icon("Close", "EditorIcons"));
- }
-}
void SectionedPropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method("_section_selected",&SectionedPropertyEditor::_section_selected);
- ObjectTypeDB::bind_method("_clear_search_box",&SectionedPropertyEditor::clear_search_box);
}
void SectionedPropertyEditor::_section_selected(int p_which) {
@@ -3756,30 +3822,9 @@ void SectionedPropertyEditor::_section_selected(int p_which) {
filter->set_section( sections->get_item_metadata(p_which) );
}
-void SectionedPropertyEditor::clear_search_box() {
-
- if (search_box->get_text().strip_edges()=="")
- return;
-
- search_box->clear();
- editor->update_tree();
-}
-
-
String SectionedPropertyEditor::get_current_section() const {
- String section = sections->get_item_metadata( sections->get_current() );
-
- if (section=="") {
- String name = editor->get_selected_path();
-
- int sp = name.find("/");
- if (sp!=-1)
- section = name.substr(0, sp);
-
- }
-
- return section;
+ return sections->get_item_metadata( sections->get_current() );
}
String SectionedPropertyEditor::get_full_item_path(const String& p_item) {
@@ -3799,20 +3844,11 @@ void SectionedPropertyEditor::edit(Object* p_object) {
sections->clear();
Set<String> existing_sections;
-
- existing_sections.insert("");
- sections->add_item("All");
- sections->set_item_metadata(0, "");
-
for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
PropertyInfo pi=E->get();
-
if (pi.usage&PROPERTY_USAGE_CATEGORY)
continue;
- if ( !(pi.usage&PROPERTY_USAGE_EDITOR) )
- continue;
-
if (pi.name.find(":")!=-1 || pi.name=="script/script")
continue;
int sp = pi.name.find("/");
@@ -3825,10 +3861,10 @@ void SectionedPropertyEditor::edit(Object* p_object) {
}
} else {
- if (!existing_sections.has("global")) {
- existing_sections.insert("global");
+ if (!existing_sections.has("")) {
+ existing_sections.insert("");
sections->add_item("Global");
- sections->set_item_metadata(sections->get_item_count()-1,"global");
+ sections->set_item_metadata(sections->get_item_count()-1,"");
}
}
@@ -3853,8 +3889,6 @@ PropertyEditor *SectionedPropertyEditor::get_property_editor() {
SectionedPropertyEditor::SectionedPropertyEditor() {
- add_constant_override("separation", 8);
-
VBoxContainer *left_vb = memnew( VBoxContainer);
left_vb->set_custom_minimum_size(Size2(160,0));
add_child(left_vb);
@@ -3869,26 +3903,12 @@ SectionedPropertyEditor::SectionedPropertyEditor() {
add_child(right_vb);
filter = memnew( SectionedPropertyEditorFilter );
-
- HBoxContainer *hbc = memnew( HBoxContainer );
- right_vb->add_margin_child("Search:",hbc);
-
- search_box = memnew( LineEdit );
- search_box->set_h_size_flags(SIZE_EXPAND_FILL);
- hbc->add_child(search_box);
-
- clear_button = memnew( ToolButton );
- hbc->add_child(clear_button);
- clear_button->connect("pressed", this, "_clear_search_box");
-
editor = memnew( PropertyEditor );
- editor->register_text_enter(search_box);
- editor->set_use_filter(true);
editor->set_v_size_flags(SIZE_EXPAND_FILL);
right_vb->add_margin_child("Properties:",editor,true);
editor->get_scene_tree()->set_column_titles_visible(false);
- add_child(editor);
+
editor->hide_top_label();
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index 2e533a0c64..63ad090901 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -38,6 +38,8 @@
#include "scene/gui/menu_button.h"
#include "scene/gui/texture_frame.h"
#include "scene/gui/text_edit.h"
+#include "scene/gui/check_button.h"
+#include "scene/gui/split_container.h"
#include "scene_tree_editor.h"
/**
@@ -83,6 +85,7 @@ class CustomPropertyEditor : public Popup {
String hint_text;
LineEdit *value_editor[MAX_VALUE_EDITORS];
Label *value_label[MAX_VALUE_EDITORS];
+ HScrollBar *scroll[4];
Button *action_buttons[MAX_ACTION_BUTTONS];
MenuButton *type_button;
Vector<String> inheritors_array;
@@ -103,6 +106,7 @@ class CustomPropertyEditor : public Popup {
void _text_edit_changed();
void _file_selected(String p_file);
+ void _scroll_modified(double p_value);
void _modified(String p_string);
void _range_modified(double p_value);
void _focus_enter();
@@ -122,10 +126,6 @@ class CustomPropertyEditor : public Popup {
void config_value_editors(int p_amount, int p_columns,int p_label_w,const List<String>& p_strings);
void config_action_buttons(const List<String>& p_strings);
- bool text_changed;
-
- void _text_editor_changed(String p_text);
-
protected:
void _notification(int p_what);
@@ -259,16 +259,12 @@ class SectionedPropertyEditor : public HBoxContainer {
OBJ_TYPE(SectionedPropertyEditor,HBoxContainer);
ItemList *sections;
SectionedPropertyEditorFilter *filter;
- LineEdit *search_box;
- ToolButton *clear_button;
PropertyEditor *editor;
- void _section_selected(int p_which);
-
-protected:
- void _notification(int p_what);
static void _bind_methods();
+ void _section_selected(int p_which);
+
public:
PropertyEditor *get_property_editor();
@@ -276,8 +272,6 @@ public:
String get_full_item_path(const String& p_item);
String get_current_section() const;
- void clear_search_box();
-
SectionedPropertyEditor();
~SectionedPropertyEditor();
};
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index ea7d760133..0260457c81 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -721,6 +721,9 @@ void SceneTreeEditor::_update_selection(TreeItem *item) {
NodePath np = item->get_metadata(0);
+ if (!has_node(np))
+ return;
+
Node *n=get_node(np);
if (!n)
diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp
index bcc80796c4..773f4c7eea 100644
--- a/tools/editor/script_editor_debugger.cpp
+++ b/tools/editor/script_editor_debugger.cpp
@@ -532,6 +532,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
+ inspector->edit(variables);
+
step->set_icon( get_icon("DebugStep","EditorIcons"));
next->set_icon( get_icon("DebugNext","EditorIcons"));
back->set_icon( get_icon("Back","EditorIcons"));
@@ -1310,7 +1312,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){
pending_in_queue=0;
variables = memnew( ScriptEditorDebuggerVariables );
- inspector->edit(variables);
+
breaked=false;
tabs->add_child(dbg);
diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp
index 3d30b3882d..ebbc488ff2 100644
--- a/tools/editor/settings_config_dialog.cpp
+++ b/tools/editor/settings_config_dialog.cpp
@@ -73,6 +73,9 @@ void EditorSettingsDialog::popup_edit_settings() {
property_editor->edit(EditorSettings::get_singleton());
property_editor->get_property_editor()->update_tree();
+ search_box->select_all();
+ search_box->grab_focus();
+
popup_centered_ratio(0.7);
}
@@ -245,15 +248,22 @@ void EditorSettingsDialog::_update_plugins() {
}
+void EditorSettingsDialog::_clear_search_box() {
+
+ if (search_box->get_text()=="")
+ return;
+
+ search_box->clear();
+ property_editor->get_property_editor()->update_tree();
+}
+
void EditorSettingsDialog::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
rescan_plugins->set_icon(get_icon("Reload","EditorIcons"));
+ clear_button->set_icon(get_icon("Close","EditorIcons"));
_update_plugins();
- } else if (p_what==NOTIFICATION_POST_POPUP) {
-
- property_editor->clear_search_box();
}
}
@@ -265,6 +275,7 @@ void EditorSettingsDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_plugin_settings"),&EditorSettingsDialog::_plugin_settings);
ObjectTypeDB::bind_method(_MD("_plugin_edited"),&EditorSettingsDialog::_plugin_edited);
ObjectTypeDB::bind_method(_MD("_plugin_install"),&EditorSettingsDialog::_plugin_install);
+ ObjectTypeDB::bind_method(_MD("_clear_search_box"),&EditorSettingsDialog::_clear_search_box);
}
EditorSettingsDialog::EditorSettingsDialog() {
@@ -275,17 +286,38 @@ EditorSettingsDialog::EditorSettingsDialog() {
add_child(tabs);
set_child_rect(tabs);
+ VBoxContainer *vbc = memnew( VBoxContainer );
+ tabs->add_child(vbc);
+ vbc->set_name("General");
+
+ HBoxContainer *hbc = memnew( HBoxContainer );
+ hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ vbc->add_child(hbc);
+
+ Label *l = memnew( Label );
+ l->set_text("Search: ");
+ hbc->add_child(l);
+
+ search_box = memnew( LineEdit );
+ search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ hbc->add_child(search_box);
+
+ clear_button = memnew( ToolButton );
+ hbc->add_child(clear_button);
+ clear_button->connect("pressed",this,"_clear_search_box");
+
property_editor = memnew( SectionedPropertyEditor );
//property_editor->hide_top_label();
- property_editor->set_name("General");
+ property_editor->get_property_editor()->set_use_filter(true);
+ property_editor->get_property_editor()->register_text_enter(search_box);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- tabs->add_child(property_editor);
+ vbc->add_child(property_editor);
- VBoxContainer *vbc = memnew( VBoxContainer );
+ vbc = memnew( VBoxContainer );
tabs->add_child(vbc);
vbc->set_name("Plugins");
- HBoxContainer *hbc = memnew( HBoxContainer );
+ hbc = memnew( HBoxContainer );
vbc->add_child(hbc);
hbc->add_child( memnew( Label("Plugin List: ")));
hbc->add_spacer();
diff --git a/tools/editor/settings_config_dialog.h b/tools/editor/settings_config_dialog.h
index 119b4035ca..e1c3238a64 100644
--- a/tools/editor/settings_config_dialog.h
+++ b/tools/editor/settings_config_dialog.h
@@ -51,6 +51,8 @@ class EditorSettingsDialog : public AcceptDialog {
Button *rescan_plugins;
Tree *plugins;
+ LineEdit *search_box;
+ ToolButton *clear_button;
SectionedPropertyEditor *property_editor;
Timer *timer;