diff options
-rw-r--r-- | core/bind/core_bind.cpp | 28 | ||||
-rw-r--r-- | core/bind/core_bind.h | 4 | ||||
-rw-r--r-- | core/global_constants.cpp | 10 | ||||
-rw-r--r-- | core/method_bind.h | 1 | ||||
-rw-r--r-- | core/os/thread.cpp | 4 | ||||
-rw-r--r-- | core/os/thread.h | 6 | ||||
-rw-r--r-- | doc/base/classes.xml | 4 | ||||
-rw-r--r-- | drivers/theora/video_stream_theora.cpp | 3 | ||||
-rw-r--r-- | drivers/unix/memory_pool_static_malloc.cpp | 2 | ||||
-rw-r--r-- | drivers/unix/thread_posix.cpp | 17 | ||||
-rw-r--r-- | drivers/unix/thread_posix.h | 5 | ||||
-rw-r--r-- | main/main.cpp | 6 | ||||
-rw-r--r-- | modules/gdscript/gd_script.cpp | 1 | ||||
-rw-r--r-- | scene/3d/camera.cpp | 23 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 11 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 9 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 32 | ||||
-rw-r--r-- | scene/main/viewport.h | 6 | ||||
-rw-r--r-- | servers/audio/audio_server_sw.cpp | 3 | ||||
-rw-r--r-- | servers/register_server_types.cpp | 4 | ||||
-rw-r--r-- | tools/editor/animation_editor.cpp | 69 | ||||
-rw-r--r-- | tools/editor/animation_editor.h | 2 | ||||
-rw-r--r-- | tools/editor/project_settings.cpp | 2 |
23 files changed, 169 insertions, 83 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 94d9e22a1e..522c42928c 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -390,6 +390,12 @@ bool _OS::is_ok_left_and_cancel_right() const { return OS::get_singleton()->get_swap_ok_cancel(); } +Error _OS::set_thread_name(const String& p_name) { + + return Thread::set_name(p_name); +}; + + /* enum Weekday { DAY_SUNDAY, @@ -877,6 +883,8 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("alert","text","title"),&_OS::alert,DEFVAL("Alert!")); + ObjectTypeDB::bind_method(_MD("set_thread_name","name"),&_OS::set_thread_name); + BIND_CONSTANT( DAY_SUNDAY ); BIND_CONSTANT( DAY_MONDAY ); @@ -1895,13 +1903,7 @@ void _Thread::_start_func(void *ud) { Variant::CallError ce; const Variant* arg[1]={&t->userdata}; - // we don't know our thread pointer yet :( - if (t->name == "") { - // come up with a better name using maybe the filename on the Script? - //t->thread->set_name(t->target_method); - } else { - //t->thread->set_name(t->name); - }; + Thread::set_name(t->target_method); t->ret=t->target_instance->call(t->target_method,arg,1,ce); if (ce.error!=Variant::CallError::CALL_OK) { @@ -1992,24 +1994,12 @@ Variant _Thread::wait_to_finish() { return r; } -Error _Thread::set_name(const String &p_name) { - - name = p_name; - - if (thread) { - return thread->set_name(p_name); - }; - - return OK; -}; - void _Thread::_bind_methods() { ObjectTypeDB::bind_method(_MD("start:Error","instance","method","userdata","priority"),&_Thread::start,DEFVAL(Variant()),DEFVAL(PRIORITY_NORMAL)); ObjectTypeDB::bind_method(_MD("get_id"),&_Thread::get_id); ObjectTypeDB::bind_method(_MD("is_active"),&_Thread::is_active); ObjectTypeDB::bind_method(_MD("wait_to_finish:Variant"),&_Thread::wait_to_finish); - ObjectTypeDB::bind_method(_MD("set_name:Error", "name"),&_Thread::set_name); BIND_CONSTANT( PRIORITY_LOW ); BIND_CONSTANT( PRIORITY_NORMAL ); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index e03657f3a0..cb8fba3dcd 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -270,6 +270,8 @@ public: bool is_ok_left_and_cancel_right() const; + Error set_thread_name(const String& p_name); + static _OS *get_singleton() { return singleton; } _OS(); @@ -512,7 +514,6 @@ protected: Object *target_instance; StringName target_method; Thread *thread; - String name; static void _bind_methods(); static void _start_func(void *ud); public: @@ -528,7 +529,6 @@ public: String get_id() const; bool is_active() const; Variant wait_to_finish(); - Error set_name(const String& p_name); _Thread(); ~_Thread(); diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 92e50a8b96..89d918fed9 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -476,6 +476,16 @@ static _GlobalConstant _global_constants[]={ BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_EDITOR ), BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_NETWORK ), BIND_GLOBAL_CONSTANT( PROPERTY_USAGE_DEFAULT ), + + BIND_GLOBAL_CONSTANT( METHOD_FLAG_NORMAL ), + BIND_GLOBAL_CONSTANT( METHOD_FLAG_EDITOR ), + BIND_GLOBAL_CONSTANT( METHOD_FLAG_NOSCRIPT ), + BIND_GLOBAL_CONSTANT( METHOD_FLAG_CONST ), + BIND_GLOBAL_CONSTANT( METHOD_FLAG_REVERSE ), + BIND_GLOBAL_CONSTANT( METHOD_FLAG_VIRTUAL ), + BIND_GLOBAL_CONSTANT( METHOD_FLAG_FROM_SCRIPT ), + BIND_GLOBAL_CONSTANT( METHOD_FLAGS_DEFAULT ), + {"TYPE_NIL",Variant::NIL}, {"TYPE_BOOL",Variant::BOOL}, {"TYPE_INT",Variant::INT}, diff --git a/core/method_bind.h b/core/method_bind.h index 4c2598e50c..da3d7c1062 100644 --- a/core/method_bind.h +++ b/core/method_bind.h @@ -50,6 +50,7 @@ enum MethodFlags { METHOD_FLAG_CONST=8, METHOD_FLAG_REVERSE=16, // used for events METHOD_FLAG_VIRTUAL=32, + METHOD_FLAG_FROM_SCRIPT=64, METHOD_FLAGS_DEFAULT=METHOD_FLAG_NORMAL, }; diff --git a/core/os/thread.cpp b/core/os/thread.cpp index 7fb1e969d4..f5d984876d 100644 --- a/core/os/thread.cpp +++ b/core/os/thread.cpp @@ -32,6 +32,7 @@ Thread* (*Thread::create_func)(ThreadCreateCallback,void *,const Settings&)=NULL; Thread::ID (*Thread::get_thread_ID_func)()=NULL; void (*Thread::wait_to_finish_func)(Thread*)=NULL; +Error (*Thread::set_name_func)(const String&)=NULL; Thread::ID Thread::_main_thread_id=0; @@ -60,6 +61,9 @@ void Thread::wait_to_finish(Thread *p_thread) { Error Thread::set_name(const String &p_name) { + if (set_name_func) + return set_name_func(p_name); + return ERR_UNAVAILABLE; }; diff --git a/core/os/thread.h b/core/os/thread.h index 5711561809..4fead72b94 100644 --- a/core/os/thread.h +++ b/core/os/thread.h @@ -63,6 +63,7 @@ protected: static Thread* (*create_func)(ThreadCreateCallback p_callback,void *,const Settings&); static ID (*get_thread_ID_func)(); static void (*wait_to_finish_func)(Thread*); + static Error (*set_name_func)(const String&); friend class Main; @@ -73,10 +74,9 @@ protected: public: - virtual Error set_name(const String& p_name); - virtual ID get_ID() const=0; - + + static Error set_name(const String &p_name); _FORCE_INLINE_ static ID get_main_ID() { return _main_thread_id; } ///< get the ID of the main thread static ID get_caller_ID(); ///< get the ID of the caller function ID static void wait_to_finish(Thread *p_thread); ///< waits until thread is finished, and deallocates it. diff --git a/doc/base/classes.xml b/doc/base/classes.xml index e642430636..13bc5a91e6 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -681,9 +681,9 @@ </member> <member name="PS2D" type="Physics2DServer"> </member> - <member name="SpatialSoundServer" type="SpatialSound2DServer"> + <member name="SpatialSoundServer" type="SpatialSoundServer"> </member> - <member name="SS" type="SpatialSound2DServer"> + <member name="SS" type="SpatialSoundServer"> </member> <member name="SpatialSound2DServer" type="SpatialSound2DServer"> </member> diff --git a/drivers/theora/video_stream_theora.cpp b/drivers/theora/video_stream_theora.cpp index 1d2e6b9dda..e577c3f932 100644 --- a/drivers/theora/video_stream_theora.cpp +++ b/drivers/theora/video_stream_theora.cpp @@ -489,6 +489,9 @@ Ref<Texture> VideoStreamPlaybackTheora::get_texture() { void VideoStreamPlaybackTheora::update(float p_delta) { + if (!file) + return; + if (!playing || paused) { //printf("not playing\n"); return; diff --git a/drivers/unix/memory_pool_static_malloc.cpp b/drivers/unix/memory_pool_static_malloc.cpp index 1a79272dc1..e75b682c19 100644 --- a/drivers/unix/memory_pool_static_malloc.cpp +++ b/drivers/unix/memory_pool_static_malloc.cpp @@ -321,7 +321,7 @@ size_t MemoryPoolStaticMalloc::get_max_usage() { /* Most likely available only if memory debugger was compiled in */ int MemoryPoolStaticMalloc::get_alloc_count() { - return 0; + return total_pointers; } void * MemoryPoolStaticMalloc::get_alloc_ptr(int p_alloc_idx) { diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index bd33c81298..6ace64a923 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -81,9 +81,9 @@ void ThreadPosix::wait_to_finish_func_posix(Thread* p_thread) { tp->pthread=0; } -Error ThreadPosix::set_name(const String& p_name) { +Error ThreadPosix::set_name_func_posix(const String& p_name) { - ERR_FAIL_COND_V(pthread == 0, ERR_UNCONFIGURED); + pthread_t running_thread = pthread_self(); #ifdef PTHREAD_NO_RENAME return ERR_UNAVAILABLE; @@ -93,22 +93,15 @@ Error ThreadPosix::set_name(const String& p_name) { #ifdef PTHREAD_RENAME_SELF // check if thread is the same as caller - int caller = Thread::get_caller_ID(); - int self = get_ID(); - if (caller != self) { - ERR_EXPLAIN("On this platform, thread can only be renamed with calls from the threads to be renamed."); - ERR_FAIL_V(ERR_UNAVAILABLE); - return ERR_UNAVAILABLE; - }; int err = pthread_setname_np(p_name.utf8().get_data()); #else #ifdef PTHREAD_BSD_SET_NAME - pthread_set_name_np(pthread, p_name.utf8().get_data()); + pthread_set_name_np(running_thread, p_name.utf8().get_data()); int err = 0; // Open/FreeBSD ignore errors in this function #else - int err = pthread_setname_np(pthread, p_name.utf8().get_data()); + int err = pthread_setname_np(running_thread, p_name.utf8().get_data()); #endif // PTHREAD_BSD_SET_NAME #endif // PTHREAD_RENAME_SELF @@ -123,7 +116,7 @@ void ThreadPosix::make_default() { create_func=create_func_posix; get_thread_ID_func=get_thread_ID_func_posix; wait_to_finish_func=wait_to_finish_func_posix; - + set_name_func = set_name_func_posix; } ThreadPosix::ThreadPosix() { diff --git a/drivers/unix/thread_posix.h b/drivers/unix/thread_posix.h index 179d56d5bd..06a17c2ae6 100644 --- a/drivers/unix/thread_posix.h +++ b/drivers/unix/thread_posix.h @@ -55,13 +55,14 @@ class ThreadPosix : public Thread { static Thread* create_func_posix(ThreadCreateCallback p_callback,void *,const Settings&); static ID get_thread_ID_func_posix(); static void wait_to_finish_func_posix(Thread* p_thread); - + + static Error set_name_func_posix(const String& p_name); + ThreadPosix(); public: virtual ID get_ID() const; - Error set_name(const String& p_name); static void make_default(); diff --git a/main/main.cpp b/main/main.cpp index 19fe037613..f8786f5aec 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -726,8 +726,9 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas /* Determine Video Driver */ - if (audio_driver=="") // specified in engine.cfg + if (audio_driver=="") { // specified in engine.cfg audio_driver=GLOBAL_DEF("audio/driver",OS::get_singleton()->get_audio_driver_name(0)); + } for (int i=0;i<OS::get_singleton()->get_video_driver_count();i++) { @@ -758,7 +759,8 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas if (audio_driver_idx<0) { OS::get_singleton()->alert( "Invalid Audio Driver: "+audio_driver ); - goto error; + audio_driver_idx = 0; + //goto error; } { diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 62c5eb735a..8f48a3d6a7 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -2456,6 +2456,7 @@ void GDInstance::get_method_list(List<MethodInfo> *p_list) const { MethodInfo mi; mi.name=E->key(); + mi.flags|=METHOD_FLAG_FROM_SCRIPT; for(int i=0;i<E->get().get_argument_count();i++) mi.arguments.push_back(PropertyInfo(Variant::NIL,"arg"+itos(i))); p_list->push_back(mi); diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 3e78fef147..01163e40e8 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -213,8 +213,7 @@ void Camera::_notification(int p_what) { case NOTIFICATION_ENTER_WORLD: { - bool first_camera = get_viewport()->cameras.size()==0; - get_viewport()->cameras.insert(this); + bool first_camera = get_viewport()->_camera_add(this); if (!get_tree()->is_node_being_edited(this) && (current || first_camera)) make_current(); @@ -236,7 +235,7 @@ void Camera::_notification(int p_what) { } } - get_viewport()->cameras.erase(this); + get_viewport()->_camera_remove(this); } break; @@ -304,7 +303,7 @@ void Camera::make_current() { if (!is_inside_tree()) return; - get_viewport()->_set_camera(this); + get_viewport()->_camera_set(this); //get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,camera_group,"_camera_make_current",this); } @@ -319,20 +318,8 @@ void Camera::clear_current() { return; if (get_viewport()->get_camera()==this) { - get_viewport()->_set_camera(NULL); - //a group is used beause this needs to be in order to be deterministic - - for (Set<Camera*>::Element *E=get_viewport()->cameras.front();E;E=E->next()) { - - if (this==E->get()) - continue; - if (!E->get()->is_inside_tree()) - continue; - if (get_viewport()->get_camera()!=NULL) - return; - - E->get()->make_current(); - } + get_viewport()->_camera_set(NULL); + get_viewport()->_camera_make_next_current(this); } } diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index f6d058c2fd..344fc5ecde 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -147,14 +147,21 @@ void AnimationPlayer::_get_property_list( List<PropertyInfo> *p_list) const { List<String> names; + List<PropertyInfo> anim_names; + for( Map<StringName, AnimationData>::Element *E=animation_set.front();E;E=E->next()) { - p_list->push_back( PropertyInfo( Variant::OBJECT, "anims/"+String(E->key()), PROPERTY_HINT_RESOURCE_TYPE, "Animation",PROPERTY_USAGE_NOEDITOR) ); + anim_names.push_back( PropertyInfo( Variant::OBJECT, "anims/"+String(E->key()), PROPERTY_HINT_RESOURCE_TYPE, "Animation",PROPERTY_USAGE_NOEDITOR) ); if (E->get().next!=StringName()) - p_list->push_back( PropertyInfo( Variant::STRING, "next/"+String(E->key()), PROPERTY_HINT_NONE, "",PROPERTY_USAGE_NOEDITOR) ); + anim_names.push_back( PropertyInfo( Variant::STRING, "next/"+String(E->key()), PROPERTY_HINT_NONE, "",PROPERTY_USAGE_NOEDITOR) ); names.push_back(E->key()); } + anim_names.sort(); + + for( List<PropertyInfo>::Element *E=anim_names.front();E;E=E->next()) { + p_list->push_back(E->get()); + } { names.sort(); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index fdced3f62f..2a62ab30fc 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -80,8 +80,8 @@ void LineEdit::_input_event(InputEvent p_event) { selection.creating=false; selection.doubleclick=false; - // notify to show soft keyboard - notification(NOTIFICATION_FOCUS_ENTER); + if (OS::get_singleton()->has_virtual_keyboard()) + OS::get_singleton()->show_virtual_keyboard(get_text(),get_global_rect()); } update(); @@ -230,8 +230,9 @@ void LineEdit::_input_event(InputEvent p_event) { case KEY_RETURN: { emit_signal( "text_entered",text ); - // notify to hide soft keyboard - notification(NOTIFICATION_FOCUS_EXIT); + if (OS::get_singleton()->has_virtual_keyboard()) + OS::get_singleton()->hide_virtual_keyboard(); + return; } break; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index a1bfbda1fc..7ed1882d77 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -855,7 +855,7 @@ void Viewport::_camera_transform_changed_notify() { #endif } -void Viewport::_set_camera(Camera* p_camera) { +void Viewport::_camera_set(Camera* p_camera) { #ifndef _3D_DISABLED @@ -880,6 +880,36 @@ void Viewport::_set_camera(Camera* p_camera) { #endif } +bool Viewport::_camera_add(Camera* p_camera) { + + cameras.insert(p_camera); + return cameras.size()==1; +} + +void Viewport::_camera_remove(Camera* p_camera) { + + cameras.erase(p_camera); + if (camera==p_camera) { + camera=NULL; + } +} + +void Viewport::_camera_make_next_current(Camera* p_exclude) { + + for(Set<Camera*>::Element *E=cameras.front();E;E=E->next()) { + + if (p_exclude==E->get()) + continue; + if (!E->get()->is_inside_tree()) + continue; + if (camera!=NULL) + return; + + E->get()->make_current(); + + } +} + void Viewport::set_transparent_background(bool p_enable) { diff --git a/scene/main/viewport.h b/scene/main/viewport.h index cff729612e..5bf7418ee9 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -264,7 +264,11 @@ friend class Control; friend class Camera; void _camera_transform_changed_notify(); - void _set_camera(Camera* p_camera); + void _camera_set(Camera* p_camera); + bool _camera_add(Camera* p_camera); //true if first + void _camera_remove(Camera* p_camera); + void _camera_make_next_current(Camera* p_exclude); + protected: void _notification(int p_what); diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp index d634c348dc..8b5b5e4f46 100644 --- a/servers/audio/audio_server_sw.cpp +++ b/servers/audio/audio_server_sw.cpp @@ -765,6 +765,8 @@ void AudioServerSW::free(RID p_id) { void AudioServerSW::_thread_func(void *self) { + Thread::set_name("AudioServerSW"); + AudioServerSW *as=(AudioServerSW *)self; while (!as->exit_update_thread) { @@ -807,7 +809,6 @@ void AudioServerSW::init() { #ifndef NO_THREADS exit_update_thread=false; thread = Thread::create(_thread_func,this); - thread->set_name("AudioServerSW"); #endif } diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp index 4752210b5f..06eaa4d122 100644 --- a/servers/register_server_types.cpp +++ b/servers/register_server_types.cpp @@ -65,8 +65,8 @@ void register_server_types() { Globals::get_singleton()->add_singleton( Globals::Singleton("PS",PhysicsServer::get_singleton()) ); Globals::get_singleton()->add_singleton( Globals::Singleton("Physics2DServer",Physics2DServer::get_singleton()) ); Globals::get_singleton()->add_singleton( Globals::Singleton("PS2D",Physics2DServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("SpatialSoundServer",SpatialSound2DServer::get_singleton()) ); - Globals::get_singleton()->add_singleton( Globals::Singleton("SS",SpatialSound2DServer::get_singleton()) ); + Globals::get_singleton()->add_singleton( Globals::Singleton("SpatialSoundServer",SpatialSoundServer::get_singleton()) ); + Globals::get_singleton()->add_singleton( Globals::Singleton("SS",SpatialSoundServer::get_singleton()) ); Globals::get_singleton()->add_singleton( Globals::Singleton("SpatialSound2DServer",SpatialSound2DServer::get_singleton()) ); Globals::get_singleton()->add_singleton( Globals::Singleton("SS2D",SpatialSound2DServer::get_singleton()) ); diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index a247543830..79a9677edd 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -35,6 +35,7 @@ #include "scene/gui/separator.h" #include "editor_node.h" #include "tools/editor/plugins/animation_player_editor_plugin.h" +#include "scene/main/viewport.h" /* Missing to fix: *Set @@ -256,6 +257,25 @@ public: //PopupDialog *ke_dialog; + void _fix_node_path(Variant &value) { + + + NodePath np=value; + + Node* root = EditorNode::get_singleton()->get_tree()->get_root(); + + Node* np_node = root->get_node(np); + ERR_FAIL_COND(!np_node); + + Node* edited_node = root->get_node(base); + ERR_FAIL_COND(!edited_node); + + + + value = edited_node->get_path_to(np_node); + } + + void _update_obj(const Ref<Animation> &p_anim) { if (setting) return; @@ -356,10 +376,18 @@ public: case Animation::TYPE_VALUE: { if (name=="value") { + + Variant value = p_value; + + if (value.get_type()==Variant::NODE_PATH) { + + _fix_node_path(value); + } + setting=true; undo_redo->create_action("Anim Change Value",true); Variant prev = animation->track_get_key_value(track,key); - undo_redo->add_do_method(animation.ptr(),"track_set_key_value",track,key,p_value); + undo_redo->add_do_method(animation.ptr(),"track_set_key_value",track,key,value); undo_redo->add_undo_method(animation.ptr(),"track_set_key_value",track,key,prev); undo_redo->add_do_method(this,"_update_obj",animation); undo_redo->add_undo_method(this,"_update_obj",animation); @@ -420,7 +448,14 @@ public: } if (what=="value") { - args[idx]=p_value; + + Variant value=p_value; + if (value.get_type()==Variant::NODE_PATH) { + + _fix_node_path(value); + } + + args[idx]=value; d_new["args"]=args; mergeable=true; } @@ -441,7 +476,7 @@ public: } break; } - return false; + return false; @@ -616,6 +651,7 @@ public: float key_ofs; PropertyInfo hint; + NodePath base; void notify_change() { @@ -1630,8 +1666,9 @@ void AnimationKeyEditor::_select_at_anim(const Ref<Animation>& p_anim,int p_trac } -PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx) { +PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx,NodePath& r_base_path) { + r_base_path=NodePath(); ERR_FAIL_COND_V(!animation.is_valid(),PropertyInfo()); ERR_FAIL_INDEX_V(p_idx,animation->get_track_count(),PropertyInfo()); @@ -1640,9 +1677,6 @@ PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx) { NodePath path = animation->track_get_path(p_idx); - String property = path.get_property(); - if (property=="") - return PropertyInfo(); if (!root->has_node_and_resource(path)) return PropertyInfo(); @@ -1650,6 +1684,15 @@ PropertyInfo AnimationKeyEditor::_find_hint_for_track(int p_idx) { RES res; Node *node = root->get_node_and_resource(path,res); + + if (node) { + r_base_path=node->get_path(); + } + + String property = path.get_property(); + if (property=="") + return PropertyInfo(); + List<PropertyInfo> pinfo; if (res.is_valid()) res->get_property_list(&pinfo); @@ -1729,7 +1772,7 @@ bool AnimationKeyEditor::_edit_if_single_selection() { key_edit->animation=animation; key_edit->track=idx; key_edit->key_ofs=animation->track_get_key_time(idx,key); - key_edit->hint=_find_hint_for_track(idx); + key_edit->hint=_find_hint_for_track(idx,key_edit->base); key_edit->notify_change(); curve_edit->set_transition(animation->track_get_key_transition(idx,key)); @@ -2187,7 +2230,8 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { newval=d; } else if (tt==Animation::TYPE_VALUE) { - PropertyInfo inf = _find_hint_for_track(idx); + NodePath np; + PropertyInfo inf = _find_hint_for_track(idx,np); if (inf.type!=Variant::NIL) { Variant::CallError err; @@ -2975,6 +3019,7 @@ void AnimationKeyEditor::_clear_selection() { key_edit->track=0; key_edit->key_ofs=0; key_edit->hint=PropertyInfo(); + key_edit->base=NodePath(); key_edit->notify_change(); } @@ -3269,9 +3314,10 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) { { //shitty hack + NodePath np; animation->add_track(p_id.type); animation->track_set_path(animation->get_track_count()-1,p_id.path); - PropertyInfo h = _find_hint_for_track(animation->get_track_count()-1); + PropertyInfo h = _find_hint_for_track(animation->get_track_count()-1,np); animation->remove_track(animation->get_track_count()-1); //hack @@ -3645,6 +3691,9 @@ void AnimationKeyEditor::_add_call_track(const NodePath& p_base) { NodePath path = root->get_path_to(from); + //print_line("root: "+String(root->get_path())); + //print_line("path: "+String(path)); + undo_redo->create_action("Anim Add Call Track"); undo_redo->add_do_method(animation.ptr(),"add_track",Animation::TYPE_METHOD); undo_redo->add_do_method(animation.ptr(),"track_set_path",animation->get_track_count(),path); diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h index 5e81439fe6..cd22dc3106 100644 --- a/tools/editor/animation_editor.h +++ b/tools/editor/animation_editor.h @@ -302,7 +302,7 @@ class AnimationKeyEditor : public VBoxContainer { void _select_at_anim(const Ref<Animation>& p_anim,int p_track,float p_pos); void _curve_transition_changed(float p_what); - PropertyInfo _find_hint_for_track(int p_idx); + PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path); void _create_value_item(int p_type); void _pane_drag(const Point2& p_delta); diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index cbac870a6b..f889cc7748 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -924,10 +924,12 @@ void ProjectSettings::_autoload_delete(Object *p_item,int p_column, int p_button if (p_button==0) { //delete + int order = Globals::get_singleton()->get_order(name); undo_redo->create_action("Remove Autoload"); undo_redo->add_do_property(Globals::get_singleton(),name,Variant()); undo_redo->add_undo_property(Globals::get_singleton(),name,Globals::get_singleton()->get(name)); undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",name,true); + undo_redo->add_undo_method(Globals::get_singleton(),"set_order",name,order); undo_redo->add_do_method(this,"_update_autoload"); undo_redo->add_undo_method(this,"_update_autoload"); undo_redo->add_do_method(this,"_settings_changed"); |