From 89efebbf561fa19d29533acdd3716f8d1385595a Mon Sep 17 00:00:00 2001 From: Ovnuniarchos Date: Mon, 14 Dec 2015 02:56:11 +0100 Subject: New and corrected are override modes. --- scene/2d/area_2d.cpp | 2 +- scene/2d/area_2d.h | 4 +++- scene/3d/area.cpp | 2 +- scene/3d/area.h | 4 +++- servers/physics/body_sw.cpp | 30 +++++++++++++++++++++--------- servers/physics_2d/body_2d_sw.cpp | 33 +++++++++++++++++++++++---------- servers/physics_2d_server.cpp | 4 +++- servers/physics_2d_server.h | 2 ++ servers/physics_server.cpp | 4 +++- servers/physics_server.h | 2 ++ 10 files changed, 62 insertions(+), 25 deletions(-) diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index c44b46adbf..5038752b22 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -652,7 +652,7 @@ void Area2D::_bind_methods() { ADD_SIGNAL( MethodInfo("area_exit",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"))); - ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Replace"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode")); + ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Combine-Replace,Replace,Replace-Combine"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode")); ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"gravity_point"),_SCS("set_gravity_is_point"),_SCS("is_gravity_a_point")); ADD_PROPERTYNZ( PropertyInfo(Variant::REAL,"gravity_distance_scale", PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_gravity_distance_scale"),_SCS("get_gravity_distance_scale")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"gravity_vec"),_SCS("set_gravity_vector"),_SCS("get_gravity_vector")); diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h index f5a88390e7..2b74655109 100644 --- a/scene/2d/area_2d.h +++ b/scene/2d/area_2d.h @@ -40,7 +40,9 @@ public: enum SpaceOverride { SPACE_OVERRIDE_DISABLED, SPACE_OVERRIDE_COMBINE, - SPACE_OVERRIDE_REPLACE + SPACE_OVERRIDE_COMBINE_REPLACE, + SPACE_OVERRIDE_REPLACE, + SPACE_OVERRIDE_REPLACE_COMBINE }; private: diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index ff35837bc0..47cebd25a2 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -579,7 +579,7 @@ void Area::_bind_methods() { ADD_SIGNAL( MethodInfo("area_enter",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"))); ADD_SIGNAL( MethodInfo("area_exit",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area"))); - ADD_PROPERTY( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Replace"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode")); + ADD_PROPERTY( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Combine-Replace,Replace,Replace-Combine"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"gravity_point"),_SCS("set_gravity_is_point"),_SCS("is_gravity_a_point")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"gravity_distance_scale", PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_gravity_distance_scale"),_SCS("get_gravity_distance_scale")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"gravity_vec"),_SCS("set_gravity_vector"),_SCS("get_gravity_vector")); diff --git a/scene/3d/area.h b/scene/3d/area.h index f03955d1e7..529a116937 100644 --- a/scene/3d/area.h +++ b/scene/3d/area.h @@ -40,7 +40,9 @@ public: enum SpaceOverride { SPACE_OVERRIDE_DISABLED, SPACE_OVERRIDE_COMBINE, - SPACE_OVERRIDE_REPLACE + SPACE_OVERRIDE_COMBINE_REPLACE, + SPACE_OVERRIDE_REPLACE, + SPACE_OVERRIDE_REPLACE_COMBINE }; private: diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index c66e73b430..79d08b1e75 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -406,29 +406,41 @@ void BodySW::integrate_forces(real_t p_step) { return; AreaSW *def_area = get_space()->get_default_area(); - AreaSW *damp_area = def_area; + // AreaSW *damp_area = def_area; ERR_FAIL_COND(!def_area); int ac = areas.size(); - bool replace = false; + bool stopped = false; gravity = Vector3(0,0,0); area_linear_damp = 0; area_angular_damp = 0; if (ac) { areas.sort(); const AreaCMP *aa = &areas[0]; - damp_area = aa[ac-1].area; - for(int i=ac-1;i>=0;i--) { - _compute_area_gravity_and_dampenings(aa[i].area); - if (aa[i].area->get_space_override_mode() == PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE) { - replace = true; - break; + // damp_area = aa[ac-1].area; + for(int i=ac-1;i>=0 && !stopped;i--) { + PhysicsServer::AreaSpaceOverrideMode mode=aa[i].area->get_space_override_mode(); + switch (mode) { + case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE: + case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: { + _compute_area_gravity_and_dampenings(aa[i].area); + stopped = mode==PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE; + } break; + case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE: + case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: { + gravity = Vector3(0,0,0); + area_angular_damp = 0; + area_linear_damp = 0; + _compute_area_gravity_and_dampenings(aa[i].area); + stopped = mode==PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE; + } break; + default: {} } } } - if( !replace ) { + if( !stopped ) { _compute_area_gravity_and_dampenings(def_area); } diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index d0c5cbc77b..8d82d4a920 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -395,6 +395,7 @@ void Body2DSW::_compute_area_gravity_and_dampenings(const Area2DSW *p_area) { area_linear_damp += p_area->get_linear_damp(); area_angular_damp += p_area->get_angular_damp(); + printf("%f\n",gravity.y); } void Body2DSW::integrate_forces(real_t p_step) { @@ -403,27 +404,39 @@ void Body2DSW::integrate_forces(real_t p_step) { return; Area2DSW *def_area = get_space()->get_default_area(); - Area2DSW *damp_area = def_area; + // Area2DSW *damp_area = def_area; ERR_FAIL_COND(!def_area); int ac = areas.size(); - bool replace = false; + bool stopped = false; gravity = Vector2(0,0); area_angular_damp = 0; area_linear_damp = 0; if (ac) { areas.sort(); const AreaCMP *aa = &areas[0]; - damp_area = aa[ac-1].area; - for(int i=ac-1;i>=0;i--) { - _compute_area_gravity_and_dampenings(aa[i].area); - if (aa[i].area->get_space_override_mode() == Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE) { - replace = true; - break; + // damp_area = aa[ac-1].area; + for(int i=ac-1;i>=0 && !stopped;i--) { + Physics2DServer::AreaSpaceOverrideMode mode=aa[i].area->get_space_override_mode(); + switch (mode) { + case Physics2DServer::AREA_SPACE_OVERRIDE_COMBINE: + case Physics2DServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE: { + _compute_area_gravity_and_dampenings(aa[i].area); + stopped = mode==Physics2DServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE; + } break; + case Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE: + case Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE_COMBINE: { + gravity = Vector2(0,0); + area_angular_damp = 0; + area_linear_damp = 0; + _compute_area_gravity_and_dampenings(aa[i].area); + stopped = mode==Physics2DServer::AREA_SPACE_OVERRIDE_REPLACE; + } break; + default: {} } } } - if( !replace ) { + if( !stopped ) { _compute_area_gravity_and_dampenings(def_area); } gravity*=gravity_scale; @@ -501,7 +514,7 @@ void Body2DSW::integrate_forces(real_t p_step) { _update_shapes_with_motion(motion); } - damp_area=NULL; // clear the area, so it is set in the next frame + // damp_area=NULL; // clear the area, so it is set in the next frame def_area=NULL; // clear the area, so it is set in the next frame contact_count=0; diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index b9d15d6e35..6b6fd685d3 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -663,9 +663,11 @@ void Physics2DServer::_bind_methods() { BIND_CONSTANT( AREA_PARAM_ANGULAR_DAMP); BIND_CONSTANT( AREA_PARAM_PRIORITY ); - BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_DISABLED ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE_REPLACE ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE_COMBINE ); BIND_CONSTANT( BODY_MODE_STATIC ); BIND_CONSTANT( BODY_MODE_KINEMATIC ); diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index 6845c7dfe1..a53cfae752 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -325,7 +325,9 @@ public: enum AreaSpaceOverrideMode { AREA_SPACE_OVERRIDE_DISABLED, AREA_SPACE_OVERRIDE_COMBINE, + AREA_SPACE_OVERRIDE_COMBINE_REPLACE, // Combines, then discards all subsequent calculations AREA_SPACE_OVERRIDE_REPLACE, + AREA_SPACE_OVERRIDE_REPLACE_COMBINE // Discards all previous calculations, then keeps combining }; virtual void area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode)=0; diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index 53409acdfb..bc2b37d92c 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -693,9 +693,11 @@ void PhysicsServer::_bind_methods() { BIND_CONSTANT( AREA_PARAM_ANGULAR_DAMP ); BIND_CONSTANT( AREA_PARAM_PRIORITY ); - BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_DISABLED ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_COMBINE_REPLACE ); BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE ); + BIND_CONSTANT( AREA_SPACE_OVERRIDE_REPLACE_COMBINE ); BIND_CONSTANT( BODY_MODE_STATIC ); BIND_CONSTANT( BODY_MODE_KINEMATIC ); diff --git a/servers/physics_server.h b/servers/physics_server.h index 75584966bb..66296fa15d 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -318,7 +318,9 @@ public: enum AreaSpaceOverrideMode { AREA_SPACE_OVERRIDE_DISABLED, AREA_SPACE_OVERRIDE_COMBINE, + AREA_SPACE_OVERRIDE_COMBINE_REPLACE, AREA_SPACE_OVERRIDE_REPLACE, + AREA_SPACE_OVERRIDE_REPLACE_COMBINE }; virtual void area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode)=0; -- cgit v1.2.3 From 1bc91848e3cee91eccaf2150a74deaf1cd84be13 Mon Sep 17 00:00:00 2001 From: Ariel Manzur Date: Mon, 21 Dec 2015 10:58:51 -0300 Subject: thread --- servers/audio/audio_server_sw.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp index b4723fdc25..500886d73a 100644 --- a/servers/audio/audio_server_sw.cpp +++ b/servers/audio/audio_server_sw.cpp @@ -767,8 +767,6 @@ void AudioServerSW::_thread_func(void *self) { AudioServerSW *as=(AudioServerSW *)self; - as->thread->set_name("AudioServerSW"); - while (!as->exit_update_thread) { as->_update_streams(true); OS::get_singleton()->delay_usec(5000); @@ -809,6 +807,7 @@ void AudioServerSW::init() { #ifndef NO_THREADS exit_update_thread=false; thread = Thread::create(_thread_func,this); + thread->set_name("AudioServerSW"); #endif } -- cgit v1.2.3 From 541c9039c593e44afb86369c052ed846c42698bd Mon Sep 17 00:00:00 2001 From: hondres Date: Mon, 21 Dec 2015 22:39:03 +0100 Subject: Check pkg-config for libudev and enable gamepad code only if found. Linux only for now --- platform/x11/detect.py | 18 ++++++++++++------ platform/x11/joystick_linux.cpp | 2 +- platform/x11/joystick_linux.h | 2 +- platform/x11/os_x11.cpp | 6 +++--- platform/x11/os_x11.h | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index c93905ed3c..0226c8b8c0 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -45,10 +45,6 @@ def can_build(): print("xinerama not found.. x11 disabled.") return False - x11_error=os.system("pkg-config libevdev --modversion > /dev/null ") - if (x11_error): - print("evdev not found.. x11 disabled.") - return False return True # X11 enabled @@ -133,7 +129,6 @@ def configure(env): env.ParseConfig('pkg-config x11 --cflags --libs') env.ParseConfig('pkg-config xinerama --cflags --libs') env.ParseConfig('pkg-config xcursor --cflags --libs') - env.ParseConfig('pkg-config libevdev --cflags --libs') if (env["openssl"]=="yes"): env.ParseConfig('pkg-config openssl --cflags --libs') @@ -155,7 +150,18 @@ def configure(env): env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED']) if platform.system() == 'Linux': env.Append(CPPFLAGS=["-DALSA_ENABLED"]) - env.Append(LIBS=['asound', 'udev']) + env.Append(LIBS=['asound']) + + if not os.system("pkg-config --exists libudev"): + if not os.system("pkg-config --exists libevdev"): + print("Enabling udev/evdev") + env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"]) + env.ParseConfig('pkg-config libudev --cflags --libs') + env.ParseConfig('pkg-config libevdev --cflags --libs') + else: + print("libevdev development libraries not found, disabling gamepad support") + else: + print("libudev development libraries not found, disabling gamepad support") if (env["pulseaudio"]=="yes"): if not os.system("pkg-config --exists libpulse-simple"): diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp index e50916d2c2..cc806f6f78 100644 --- a/platform/x11/joystick_linux.cpp +++ b/platform/x11/joystick_linux.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ //author: Andreas Haas -#ifdef __linux__ +#ifdef JOYDEV_ENABLED #include "joystick_linux.h" #include "print_string.h" diff --git a/platform/x11/joystick_linux.h b/platform/x11/joystick_linux.h index 339a5f239d..1064a6f841 100644 --- a/platform/x11/joystick_linux.h +++ b/platform/x11/joystick_linux.h @@ -30,7 +30,7 @@ //author: Andreas Haas #ifndef JOYSTICK_LINUX_H #define JOYSTICK_LINUX_H -#ifdef __linux__ +#ifdef JOYDEV_ENABLED #include "main/input_default.h" #include "os/thread.h" #include "os/mutex.h" diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index d23994edd7..0afab6442b 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -426,7 +426,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi physics_2d_server->init(); input = memnew( InputDefault ); -#ifdef __linux__ +#ifdef JOYDEV_ENABLED joystick = memnew( joystick_linux(input)); #endif _ensure_data_dir(); @@ -461,7 +461,7 @@ void OS_X11::finalize() { physics_2d_server->finish(); memdelete(physics_2d_server); -#ifdef __linux__ +#ifdef JOYDEV_ENABLED memdelete(joystick); #endif memdelete(input); @@ -1753,7 +1753,7 @@ void OS_X11::run() { while (!force_quit) { process_xevents(); // get rid of pending events -#ifdef __linux__ +#ifdef JOYDEV_ENABLED event_id = joystick->process_joysticks(event_id); #endif if (Main::iteration()==true) diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 02518189e0..eee3e40136 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -126,7 +126,7 @@ class OS_X11 : public OS_Unix { InputDefault *input; -#ifdef __linux__ +#ifdef JOYDEV_ENABLED joystick_linux *joystick; #endif -- cgit v1.2.3 From 83f2084cb82d1dc006e7a9c0f23ca66e03736c2b Mon Sep 17 00:00:00 2001 From: Ariel Manzur Date: Tue, 22 Dec 2015 09:19:12 -0300 Subject: testing patch for aligned reads by webp in javascript --- drivers/webp/utils/bit_reader.c | 8 ++++++++ drivers/webp/utils/bit_reader.h | 8 ++++++++ servers/visual_server.cpp | 1 + 3 files changed, 17 insertions(+) diff --git a/drivers/webp/utils/bit_reader.c b/drivers/webp/utils/bit_reader.c index 5081d5cd4d..4d6b4f0164 100644 --- a/drivers/webp/utils/bit_reader.c +++ b/drivers/webp/utils/bit_reader.c @@ -17,6 +17,8 @@ #include "./bit_reader_inl.h" +#define JAVASCRIPT_ENABLED // testing + //------------------------------------------------------------------------------ // VP8BitReader @@ -40,7 +42,13 @@ void VP8InitBitReader(VP8BitReader* const br, br->bits_ = -8; // to load the very first 8bits br->eof_ = 0; VP8BitReaderSetBuffer(br, start, size); + +#ifdef JAVASCRIPT_ENABLED // html5 required aligned reads + while(((uintptr_t)br->buf_ & 1) != 0 && !br->eof_) + VP8LoadFinalBytes(br); +#else VP8LoadNewBytes(br); +#endif } void VP8RemapBitReader(VP8BitReader* const br, ptrdiff_t offset) { diff --git a/drivers/webp/utils/bit_reader.h b/drivers/webp/utils/bit_reader.h index 7e09653ebc..f0f450231d 100644 --- a/drivers/webp/utils/bit_reader.h +++ b/drivers/webp/utils/bit_reader.h @@ -37,6 +37,12 @@ extern "C" { // BITS can be any multiple of 8 from 8 to 56 (inclusive). // Pick values that fit natural register size. +#ifdef JAVASCRIPT_ENABLED + +#define BITS 16 + +#else + #if defined(__i386__) || defined(_M_IX86) // x86 32bit #define BITS 24 #elif defined(__x86_64__) || defined(_M_X64) // x86 64bit @@ -49,6 +55,8 @@ extern "C" { #define BITS 24 // TODO(skal): test aarch64 and find the proper BITS value. #endif +#endif + //------------------------------------------------------------------------------ // Derived types and constants: // bit_t = natural register type for storing 'value_' (which is BITS+8 bits) diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index 25e6a68469..52381cf096 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -526,6 +526,7 @@ void VisualServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("canvas_item_get_opacity"),&VisualServer::canvas_item_get_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_set_self_opacity"),&VisualServer::canvas_item_set_self_opacity); ObjectTypeDB::bind_method(_MD("canvas_item_get_self_opacity"),&VisualServer::canvas_item_get_self_opacity); + ObjectTypeDB::bind_method(_MD("canvas_item_set_z"),&VisualServer::canvas_item_set_z); ObjectTypeDB::bind_method(_MD("canvas_item_add_line"),&VisualServer::canvas_item_add_line, DEFVAL(1.0)); ObjectTypeDB::bind_method(_MD("canvas_item_add_rect"),&VisualServer::canvas_item_add_rect); -- cgit v1.2.3 From 8433221629b6c1e14c6012ab917100dbfb234a1f Mon Sep 17 00:00:00 2001 From: Ariel Manzur Date: Tue, 22 Dec 2015 09:26:54 -0300 Subject: missing? --- platform/javascript/detect.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index ec21bf6ee4..9cc1ffc2e2 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -98,3 +98,10 @@ def configure(env): #print "CCCOM is:", env.subst('$CCCOM') #print "P: ", env['p'], " Platofrm: ", env['platform'] + + import methods + + 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.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } ) -- cgit v1.2.3 From 02d6669a3849c55e415f37b23b36b49f23319957 Mon Sep 17 00:00:00 2001 From: Ariel Manzur Date: Tue, 22 Dec 2015 10:07:35 -0300 Subject: threads --- drivers/unix/thread_posix.cpp | 7 +++++++ platform/javascript/detect.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index b7bcd44783..1c18ebd855 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -81,6 +81,11 @@ Error ThreadPosix::set_name(const String& p_name) { ERR_FAIL_COND_V(pthread == 0, ERR_UNCONFIGURED); + #ifdef PTHREAD_NO_RENAME + return ERR_UNAVAILABLE; + + #else + #ifdef PTHREAD_RENAME_SELF // check if thread is the same as caller @@ -100,6 +105,8 @@ Error ThreadPosix::set_name(const String& p_name) { #endif return err == 0 ? OK : ERR_INVALID_PARAMETER; + + #endif // PTHREAD_NO_RENAME }; void ThreadPosix::make_default() { diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 9cc1ffc2e2..0a6c8b1457 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -80,7 +80,7 @@ def configure(env): env.opus_fixed_point="yes" env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti']) - env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS']) + env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS']) env.Append(CPPFLAGS=['-DGLES2_ENABLED']) env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS']) env.Append(CPPFLAGS=['-s','ASM_JS=1']) -- cgit v1.2.3 From 69a65e5a697108d7921eba2606e5281f96e78b82 Mon Sep 17 00:00:00 2001 From: Ovnuniarchos Date: Tue, 22 Dec 2015 15:48:41 +0100 Subject: New area space override modes documented. Also, PhysicsBody2D, Area2D, and CollisionObject2D. --- doc/base/classes.xml | 129 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 114 insertions(+), 15 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 39b3791e84..075f97c68e 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -2412,7 +2412,7 @@ - Container and player of [Animaton] resources. + Container and player of [Animation] resources. An animation player is used for general purpose playback of [Animation] resources. It contains a dictionary of animations (referenced by name) and custom blend times between their transitions. Additionally, animations can be played and blended in diferent channels. @@ -3257,6 +3257,12 @@ + Set the space override mode. This mode controls how an area affects gravity and damp. + AREA_SPACE_OVERRIDE_DISABLED: This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. + AREA_SPACE_OVERRIDE_COMBINE: This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. + AREA_SPACE_OVERRIDE_COMBINE_REPLACE: This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. + AREA_SPACE_OVERRIDE_REPLACE: This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. + AREA_SPACE_OVERRIDE_REPLACE_COMBINE: This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. @@ -3481,133 +3487,162 @@ - General purpose area detection and influence for 2D Phisics. + General purpose area detection and influence for 2D physics. - General purpose area detection for 2D Phisics. Areas can be used for detection of objects that enter/exit them, as well as overriding space parameters (changing gravity, damping, etc). An Area2D can be set as a children to a RigidBody2D to generate a custom gravity field. For this, use SPACE_OVERRIDE_COMBINE and point gravity at the center of mass. + General purpose area detection for 2D physics. Areas can be used for detection of objects that enter/exit them, as well as overriding space parameters (changing gravity, damping, etc). For this, use any space override different from AREA_SPACE_OVERRIDE_DISABLE and point gravity at the center of mass. + Set the space override mode. This mode controls how an area affects gravity and damp. + AREA_SPACE_OVERRIDE_DISABLED: This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. + AREA_SPACE_OVERRIDE_COMBINE: This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. + AREA_SPACE_OVERRIDE_COMBINE_REPLACE: This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. + AREA_SPACE_OVERRIDE_REPLACE: This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. + AREA_SPACE_OVERRIDE_REPLACE_COMBINE: This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. + Return the space override mode. - When overriding space parameters, areas can have a center of gravity as a point. + When overriding space parameters, this method sets whether this area has a center of gravity. To set/get the location of the center of gravity, use [method set_gravity_vector]/[method get_gravity_vector]. - Return if gravity is a point. When overriding space parameters, areas can have a center of gravity as a point. + Return whether gravity is a point. A point gravity will attract objects towards it, as opposed to a gravity vector, which moves them in a given direction. + Set the falloff factor for point gravity. The greater this value is, the faster the strength of gravity decreases with the square of distance. + Return the falloff factor for point gravity. - Set gravity vector. If gravity is a point, this will be the attraction center. + Set the gravity vector. This vector does not have to be normalized. + If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center. + Return the gravity vector. If gravity is a point (see [method is_gravity_a_point]), this will be the attraction center. + Set the gravity intensity. This is useful to alter the force of gravity without altering its direction. + This value multiplies the gravity vector, whether it is the given vector ([method set_gravity_vector]), or a calculated one (when using a center of gravity). + Return the gravity intensity. + Set the rate at which objects stop moving in this area, if there are not any other forces moving it. The value is a fraction of its current speed, lost per second. Thus, a value of 1.0 should mean stopping immediately, and 0.0 means the object never stops. + In practice, as the fraction of speed lost gets smaller with each frame, a value of 1.0 does not mean the object will stop in exactly one second. Only when the physics calculations are done at 1 frame per second, it does stop in a second. + Return the linear damp rate. + Set the rate at which objects stop spinning in this area, if there are not any other forces making it spin. The value is a fraction of its current speed, lost per second. Thus, a value of 1.0 should mean stopping immediately, and 0.0 means the object never stops. + In practice, as the fraction of speed lost gets smaller with each frame, a value of 1.0 does not mean the object will stop in exactly one second. Only when the physics calculations are done at 1 frame per second, it does stop in a second. + Return the angular damp rate. + Set the order in which the area is processed. Greater values mean the area gets processed first. This is useful for areas which have an space override different from AREA_SPACE_OVERRIDE_DISABLED or AREA_SPACE_OVERRIDE_COMBINE, as they replace values, and are thus order-dependent. + Areas with the same priority value get evaluated in an unpredictable order, and should be differentiated if evaluation order is to be important. + Return the processing order of this area. + Set the physics layers this area can scan for collisions. + Return the physics layers this area can scan for collisions. + Set the physics layers this area is in. + Collidable objects can exist in any of 32 different layers. These layers are not visual, but more of a tagging system instead. A collidable can use these layers/tags to select with which objects it can collide, using [method set_collision_mask]. + A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. + Return the physics layer this area is in. @@ -3616,6 +3651,7 @@ + Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier. @@ -3624,6 +3660,7 @@ + Return an individual bit on the collision mask. @@ -3632,6 +3669,7 @@ + Set/clear individual bits on the layer mask. This makes getting an area in/out of only one layer easier. @@ -3640,58 +3678,67 @@ + Return an individual bit on the layer mask. + Set whether this area can detect bodies/areas entering/exiting it. + Return whether this area detects bodies/areas entering/exiting it. + Set whether this area can be detected by other, monitoring, areas. Only areas need to be marked as monitorable. Bodies are always so. + Set whether this area can be detected by other, monitoring, areas. + Return a list of the bodies ([PhysicsBody2D]) that are totally or partially inside this area. + Return a list of the areas that are totally or partially inside this area. - + + Return whether the body passed is totally or partially inside this area. - + + Return whether the area passed is totally or partially inside this area. @@ -3700,6 +3747,7 @@ + This signal is triggered only once when a body enters this area. The only parameter passed is the body that entered this area. @@ -3712,12 +3760,14 @@ + This signal triggers only once when a body enters this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape of the body that entered this area, and the fourth one is the index of the shape in this area that repored the entering. + This signal is triggered only once when an area enters this area. The only parameter passed is the area that entered this area. @@ -3730,12 +3780,14 @@ + This signal triggers only once when an area enters this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering. + This signal is triggered only once when a body exits this area. The only parameter passed is the body that exited this area. @@ -3748,12 +3800,14 @@ + This signal triggers only once when a body exits this area. The first parameter is the body's [RID]. The second one is the body as an object. The third one is the index of the shape exiting this area, and the fourth one is the index of the shape in this area that reported the exit. + This signal is triggered only once when an area exits this area. The only parameter passed is the area that exited this area. @@ -3766,6 +3820,7 @@ + This signal triggers only once when an area exits this area. The first parameter is the area's [RID]. The second one is the area as an object. The third one is the index of the shape entering this area, and the fourth one is the index of the shape in this area that reported the entering. @@ -6969,7 +7024,7 @@ Base node for 2D collisionables. - CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionBody2D] and [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API. + CollisionObject2D is the base class for 2D physics collisionables. They can hold any number of 2D collision shapes. Usually, they are edited by placing [CollisionShape2D] and/or [CollisionPolygon2D] nodes as children. Such nodes are for reference and not present outside the editor, so code should use the regular shape API. @@ -6980,6 +7035,7 @@ + This method can be used to override normal input processing. The first parameter is the viewport where the event took place. The second holds the input event received, and the third the shape of this object where it happened. @@ -6995,7 +7051,7 @@ - Return the amount of shapes in the collision body. + Return the amount of shapes in the collision body. Because a [CollisionPolygon2D] can generate more than one [Shape2D], the amount returned does not have to match the sum of [CollisionShape2D] and [CollisionPolygon2D]. @@ -7004,7 +7060,7 @@ - Change a shape in the collision body. + Change a shape in the collision body. @@ -7022,6 +7078,7 @@ + Set whether a shape is a trigger. A trigger shape detects collisions, but is otherwise unaffected by physics (i.e. colliding objects will not get blocked). @@ -7048,6 +7105,7 @@ + Return whether a shape is a trigger. A trigger shape detects collisions, but is otherwise unaffected by physics (i.e. colliding objects will not get blocked). @@ -7066,25 +7124,28 @@ - Return the RID of the object. + Return the RID of this object. + Set whether this object is pickable. A pickable object can detect the mouse pointer enter/leave it and, if the mouse is inside it, report input events. + Return whether this object is pickable. + This event fires only once when the mouse pointer enters any shape of this object. @@ -7095,10 +7156,12 @@ + This signal triggers when an input event fires over a shape. The first parameter is the viewport where the event took place. The second holds the input event received, and the third the shape of this object where it happened. + This event fires only once when the mouse pointer exits all shapes of this object. @@ -23030,10 +23093,19 @@ This method controls whether the position between two cached points is interpola + This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. + + + This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. + This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. - + + This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. + + + This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. @@ -23321,7 +23393,7 @@ This method controls whether the position between two cached points is interpola - Base class for differnt types of Physics bodies. + Base class for different types of Physics bodies. PhysicsBody is an abstract base class for implementing a physics body. All PhysicsBody types inherit from it. @@ -23357,32 +23429,40 @@ This method controls whether the position between two cached points is interpola + Base class for all objects affected by physics. + PhysicsBody2D is an abstract base class for implementing a physics body. All [i]x[/i]Body2D types inherit from it. + Set the physics layers this area is in. + Collidable objects can exist in any of 32 different layers. These layers are not visual, but more of a tagging system instead. A collidable can use these layers/tags to select with which objects it can collide, using [method set_collision_mask]. + A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. + Return the physics layer this area is in. + Set the physics layers this area can scan for collisions. + Return the physics layers this area can scan for collisions. @@ -23391,6 +23471,7 @@ This method controls whether the position between two cached points is interpola + Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier. @@ -23399,6 +23480,7 @@ This method controls whether the position between two cached points is interpola + Return an individual bit on the collision mask. @@ -23407,6 +23489,7 @@ This method controls whether the position between two cached points is interpola + Set/clear individual bits on the layer mask. This makes getting a body in/out of only one layer easier. @@ -23415,42 +23498,49 @@ This method controls whether the position between two cached points is interpola + Return an individual bit on the collision mask. + Set a direction in which bodies can go through this one. If this value is different from (0,0), any movement within 90 degrees of this vector is considered a valid movement. Set this direction to (0,0) to disable one-way collisions. + Return the direction used for one-way collision detection. + Set how far a body can go through this one, when it allows one-way collisions (see [method set_one_way_collision_detection]). + Return how far a body can go through this one, when it allows one-way collisions. + Adds a body to the collision exception list. This list contains bodies that this body will not collide with. + Removes a body from the collision exception list. @@ -24766,10 +24856,19 @@ This method controls whether the position between two cached points is interpola + This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. + + + This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. + This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. + + + This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. - + + This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. -- cgit v1.2.3 From 0897b73cd6c7fd0d0e6fc2dbac901446c38568a2 Mon Sep 17 00:00:00 2001 From: mrezai Date: Wed, 23 Dec 2015 14:57:00 +0330 Subject: Fix ios libpng link error --- drivers/png/SCsub | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 5682a5667e..b9295d17d3 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -22,18 +22,19 @@ png_sources = [ "png/image_loader_png.cpp" ] -if ("neon_enabled" in env and env["neon_enabled"]): +if ("neon_enabled" in env and env["neon_enabled"]): + env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) env_neon = env.Clone(); if "S_compiler" in env: env_neon['CC'] = env['S_compiler'] - env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"]) + #env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"]) import os # Currently .ASM filter_neon.S does not compile on NT. if (os.name!="nt"): - env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c")) png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S")) - +else: + env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"]) env.drivers_sources+=png_sources -- cgit v1.2.3 From 92cc8fcc742a9b6e55baeac5627321b59cc5af64 Mon Sep 17 00:00:00 2001 From: mrezai Date: Wed, 23 Dec 2015 15:41:46 +0330 Subject: redundant TAB removed --- drivers/png/SCsub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/png/SCsub b/drivers/png/SCsub index b9295d17d3..5532e28ade 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -23,7 +23,7 @@ png_sources = [ ] if ("neon_enabled" in env and env["neon_enabled"]): - env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) + env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) env_neon = env.Clone(); if "S_compiler" in env: env_neon['CC'] = env['S_compiler'] -- cgit v1.2.3 From 6cfede11e3e1e4e4c9d970024010a304af1c2e4c Mon Sep 17 00:00:00 2001 From: Ariel Manzur Date: Wed, 23 Dec 2015 11:16:12 -0300 Subject: removed -ffast-math on ios, compiler bug? --- platform/iphone/detect.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 137fcc56f5..9472f05e16 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -59,11 +59,11 @@ def configure(env): import string if (env["bits"]=="64"): #env['CCFLAGS'] = string.split('-arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -miphoneos-version-min=5.1.1 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-invalid-offsetof -ffast-math -m64 -DDEBUG -D_DEBUG -MMD -MT dependencies -isysroot $IPHONESDK') - env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK') + env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK') env.Append(CPPFLAGS=['-DNEED_LONG_INT']) env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON']) else: - env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK') + env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK') if (env["bits"]=="64"): env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1', @@ -116,12 +116,12 @@ def configure(env): if (env["target"]=="release"): - env.Append(CCFLAGS=['-O3', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall']) - env.Append(LINKFLAGS=['-O3', '-ffast-math']) + env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math + env.Append(LINKFLAGS=['-O3']) # elif env["target"] == "release_debug": - env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) - env.Append(LINKFLAGS=['-Os', '-ffast-math']) + env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED']) + env.Append(LINKFLAGS=['-Os']) env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED']) elif (env["target"]=="debug"): @@ -131,7 +131,7 @@ def configure(env): elif (env["target"]=="profile"): - env.Append(CCFLAGS=['-g','-pg', '-Os', '-ffast-math']) + env.Append(CCFLAGS=['-g','-pg', '-Os']) env.Append(LINKFLAGS=['-pg']) -- cgit v1.2.3 From 6055a67cb8b5d53aa4ac0654b6c8ed48e1e5edb9 Mon Sep 17 00:00:00 2001 From: Marqin Date: Tue, 22 Dec 2015 18:20:43 +0100 Subject: upgrade .travis.yml Now it test 6 builds: * Ubuntu 14.04 - x11 (g++) * Ubuntu 14.04 - x11 (clang++) * Ubuntu 14.04 - windows (via MinGW) * OS X - osx (g++) * OS X - osx (clang++) * OS X - android * OS X - iphone Instead of just g++ on Ubuntu 12.04... --- .travis.yml | 58 ++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6dd21dae0b..13f91b99e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,48 @@ language: cpp -compiler: + +sudo: required +dist: trusty + +compiler: - gcc -before_install: - - -before_script: - - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - - sudo apt-get update -qq - - sudo apt-get install -qq scons pkg-config libx11-dev libxcursor-dev build-essential libasound2-dev libfreetype6-dev libgl1-mesa-dev libglu-dev - - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi - - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi - -script: scons platform=x11 + - clang + +os: + - linux + - osx + +env: + - GODOT_TARGET=iphone + - GODOT_TARGET=osx + - GODOT_TARGET=x11 + - GODOT_TARGET=android + - GODOT_TARGET=windows + +matrix: + exclude: + - os: linux + env: GODOT_TARGET=iphone + - os: linux + env: GODOT_TARGET=osx + - os: linux + env: GODOT_TARGET=android + - os: osx + env: GODOT_TARGET=x11 + - os: osx + env: GODOT_TARGET=windows + - compiler: gcc + env: GODOT_TARGET=iphone + - compiler: clang + env: GODOT_TARGET=android + - compiler: clang + env: GODOT_TARGET=windows + + +before_script: + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; sudo apt-get install -y scons pkg-config libx11-dev libxcursor-dev build-essential libasound2-dev libfreetype6-dev libgl1-mesa-dev libglu-dev libssl-dev libxinerama-dev libevdev-dev libudev-dev; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$GODOT_TARGET" = "windows" ]; then sudo apt-get update -qq; sudo apt-get install -y mingw32 mingw-w64; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; brew install scons; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then brew update; brew install android-sdk android-ndk; export ANDROID_HOME=/usr/local/opt/android-sdk; export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk; fi + +script: + - scons platform=$GODOT_TARGET CXX=$CXX -- cgit v1.2.3 From b431c88146b888d00d39ced082aff27841fbd5dc Mon Sep 17 00:00:00 2001 From: hondres Date: Thu, 24 Dec 2015 04:17:22 +0100 Subject: Colorize Rect2 and NodePath in script editor --- tools/editor/plugins/script_editor_plugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index f22bd3d956..59f5d89073 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -316,6 +316,8 @@ void ScriptTextEditor::_load_theme_settings() { get_text_edit()->add_keyword_color("Color",basetype_color); get_text_edit()->add_keyword_color("Image",basetype_color); get_text_edit()->add_keyword_color("InputEvent",basetype_color); + get_text_edit()->add_keyword_color("Rect2",basetype_color); + get_text_edit()->add_keyword_color("NodePath",basetype_color); //colorize engine types Color type_color= EDITOR_DEF("text_editor/engine_type_color",Color(0.0,0.2,0.4)); -- cgit v1.2.3 From d8143eb3fb0a11de78ed10487d5698fd75ebc4a0 Mon Sep 17 00:00:00 2001 From: Hondres Date: Sat, 26 Dec 2015 13:14:13 +0100 Subject: Fix joystick hotplugging on windows, using right indices now --- platform/windows/joystick.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/platform/windows/joystick.cpp b/platform/windows/joystick.cpp index 68364ea8d5..bda092de53 100644 --- a/platform/windows/joystick.cpp +++ b/platform/windows/joystick.cpp @@ -100,6 +100,13 @@ int joystick_windows::check_free_joy_slot() const { // adapted from SDL2, works a lot better than the MSDN version bool joystick_windows::is_xinput_device(const GUID *p_guid) { + static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + static GUID IID_X360WirelessGamepad = { MAKELONG(0x045E, 0x028E), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } }; + + if (p_guid == &IID_ValveStreamingGamepad || p_guid == &IID_X360WiredGamepad || p_guid == &IID_X360WirelessGamepad) + return true; + PRAWINPUTDEVICELIST dev_list = NULL; unsigned int dev_list_count = 0; @@ -144,7 +151,7 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) { return false; d_joysticks[joystick_count] = dinput_gamepad(); - dinput_gamepad* joy = &d_joysticks[num]; + dinput_gamepad* joy = &d_joysticks[joystick_count]; const DWORD devtype = (instance->dwDevType & 0xFF); @@ -168,7 +175,8 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) { guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); - id_to_change = num; + id_to_change = joystick_count; + joy->di_joy->SetDataFormat(&c_dfDIJoystick2); joy->di_joy->SetCooperativeLevel(*hWnd, DISCL_FOREGROUND); joy->di_joy->EnumObjects(objectsCallback, this, NULL); @@ -218,7 +226,7 @@ void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, i dinput_gamepad &joy = d_joysticks[p_joy_id]; - res = joy.di_joy->SetProperty(DIPROP_RANGE, &prop_range.diph); + res = IDirectInputDevice8_SetProperty(joy.di_joy, DIPROP_RANGE, &prop_range.diph); if (FAILED(res)) return; @@ -365,13 +373,13 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { IDirectInputDevice8_Acquire(joy->di_joy); joy->di_joy->Poll(); } - if (FAILED(hr = d_joysticks[i].di_joy->GetDeviceState(sizeof(DIJOYSTATE2), &js))) { + if (FAILED(hr = joy->di_joy->GetDeviceState(sizeof(DIJOYSTATE2), &js))) { //printf("failed to read joy #%d\n", i); continue; } - p_last_id = post_hat(p_last_id, i, js.rgdwPOV[0]); + p_last_id = post_hat(p_last_id, joy->id, js.rgdwPOV[0]); for (int j = 0; j < 128; j++) { @@ -379,7 +387,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { if (!joy->last_buttons[j]) { - p_last_id = input->joy_button(p_last_id, i, j, true); + p_last_id = input->joy_button(p_last_id, joy->id, j, true); joy->last_buttons[j] = true; } } @@ -387,7 +395,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { if (joy->last_buttons[j]) { - p_last_id = input->joy_button(p_last_id, i, j, false); + p_last_id = input->joy_button(p_last_id, joy->id, j, false); joy->last_buttons[j] = false; } } @@ -402,7 +410,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) { for (int k=0; kjoy_axis[j] == axes[k]) { - p_last_id = input->joy_axis(p_last_id, i, j, axis_correct(values[k])); + p_last_id = input->joy_axis(p_last_id, joy->id, j, axis_correct(values[k])); break; }; }; -- cgit v1.2.3 From 13964f59c1359473980916ea1f930fef1c28331a Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 26 Dec 2015 10:25:17 -0300 Subject: -Added table support to RichTextLabel -Made help more readable, closes #2851 --- scene/gui/rich_text_label.cpp | 512 ++++++++++++++++++------ scene/gui/rich_text_label.h | 90 +++-- scene/resources/default_theme/default_theme.cpp | 2 + tools/editor/editor_help.cpp | 22 +- 4 files changed, 467 insertions(+), 159 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 5abb6c1d01..c8ac816ffd 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -30,35 +30,62 @@ #include "scene/scene_string_names.h" #include "os/keyboard.h" #include "os/os.h" -RichTextLabel::Item *RichTextLabel::_get_next_item(Item* p_item) { +RichTextLabel::Item *RichTextLabel::_get_next_item(Item* p_item,bool p_free) { - if (p_item->subitems.size()) { + if (p_free) { - return p_item->subitems.front()->get(); - } else if (!p_item->parent) { - return NULL; - } else if (p_item->E->next()) { + if (p_item->subitems.size()) { + + return p_item->subitems.front()->get(); + } else if (!p_item->parent) { + return NULL; + } else if (p_item->E->next()) { + + return p_item->E->next()->get(); + } else { + //go up until something with a next is found + while (p_item->parent && !p_item->E->next()) { + p_item=p_item->parent; + } + + + if (p_item->parent) + return p_item->E->next()->get(); + else + return NULL; - return p_item->E->next()->get(); - } else { - //go up until something with a next is found - while (p_item->parent && !p_item->E->next()) { - p_item=p_item->parent; } + } else { + if (p_item->subitems.size() && p_item->type!=ITEM_TABLE) { - if (p_item && p_item->parent) - return p_item->E->next()->get(); - else + return p_item->subitems.front()->get(); + } else if (p_item->type==ITEM_FRAME) { return NULL; + } else if (p_item->E->next()) { + + return p_item->E->next()->get(); + } else { + //go up until something with a next is found + while (p_item->type!=ITEM_FRAME && !p_item->E->next()) { + p_item=p_item->parent; + } + + if (p_item->type!=ITEM_FRAME) + return p_item->E->next()->get(); + else + return NULL; + + } } return NULL; } -void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p_mode,const Ref &p_base_font,const Color &p_base_color,const Point2i& p_click_pos,Item **r_click_item,int *r_click_char,bool *r_outside,int p_char_count) { + +void RichTextLabel::_process_line(ItemFrame *p_frame,const Vector2& p_ofs,int &y, int p_width, int p_line, ProcessMode p_mode,const Ref &p_base_font,const Color &p_base_color,const Point2i& p_click_pos,Item **r_click_item,int *r_click_char,bool *r_outside,int p_char_count) { RID ci; if (r_outside) @@ -70,7 +97,7 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p *r_click_item=NULL; } - Line &l = lines[p_line]; + Line &l = p_frame->lines[p_line]; Item *it = l.from; @@ -91,6 +118,7 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p l.offset_caches.clear(); l.height_caches.clear(); l.char_count=0; + l.minimum_width=0; } int wofs=margin; @@ -138,7 +166,7 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p if (p_mode!=PROCESS_CACHE) {\ lh=line=y && p_click_pos.y<=y+lh && p_click_pos.x=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh && p_click_pos.x p_width) {\ if (p_mode==PROCESS_CACHE) {\ if (spaces>0) \ spaces-=1;\ }\ - if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=y && p_click_pos.y<=y+lh && p_click_pos.x>wofs) {\ + if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh && p_click_pos.x>p_ofs.x+wofs) {\ if (r_outside) *r_outside=true; \ *r_click_item=it;\ *r_click_char=rchar;\ @@ -165,7 +196,7 @@ void RichTextLabel::_process_line(int &y, int p_width, int p_line, ProcessMode p #define ADVANCE(m_width) \ {\ - if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=y && p_click_pos.y<=y+lh && p_click_pos.x>=wofs && p_click_pos.x=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh && p_click_pos.x>=p_ofs.x+wofs && p_click_pos.x line_height) {\ underline=true; } + } else if (p_mode==PROCESS_CACHE) { l.char_count+=text->text.length(); + } rchar=0; @@ -263,7 +296,6 @@ if (m_height > line_height) {\ } - ENSURE_WIDTH(w); @@ -294,7 +326,7 @@ if (m_height > line_height) {\ - if (p_mode==PROCESS_POINTER && r_click_char && p_click_pos.y>=y && p_click_pos.y<=y+lh) { + if (p_mode==PROCESS_POINTER && r_click_char && p_click_pos.y>=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh) { //int o = (wofs+w)-p_click_pos.x; @@ -303,7 +335,7 @@ if (m_height > line_height) {\ cw=tab_size*font->get_char_size(' ').width; } - if (p_click_pos.x-cw/2>pofs) { + if (p_click_pos.x-cw/2>p_ofs.x+pofs) { rchar=int((&c[i])-cf); //print_line("GOT: "+itos(rchar)); @@ -337,13 +369,13 @@ if (m_height > line_height) {\ if (selected) { cw = font->get_char_size(c[i],c[i+1]).x; - draw_rect(Rect2(pofs,y,cw,lh),selection_bg); + draw_rect(Rect2(p_ofs.x+pofs,p_ofs.y+y,cw,lh),selection_bg); if (visible) - font->draw_char(ci,Point2(pofs,y+lh-(fh-ascent)),c[i],c[i+1],selection_fg); + font->draw_char(ci,p_ofs+Point2(pofs,y+lh-(fh-ascent)),c[i],c[i+1],selection_fg); } else { if (visible) - cw=font->draw_char(ci,Point2(pofs,y+lh-(fh-ascent)),c[i],c[i+1],color); + cw=font->draw_char(ci,p_ofs+Point2(pofs,y+lh-(fh-ascent)),c[i],c[i+1],color); } p_char_count++; @@ -359,7 +391,7 @@ if (m_height > line_height) {\ uc.a*=0.5; //VS::get_singleton()->canvas_item_add_line(ci,Point2(pofs,y+ascent+2),Point2(pofs+cw,y+ascent+2),uc); int uy = y+lh-fh+ascent+2; - VS::get_singleton()->canvas_item_add_line(ci,Point2(pofs,uy),Point2(pofs+cw,uy),uc); + VS::get_singleton()->canvas_item_add_line(ci,p_ofs+Point2(pofs,uy),p_ofs+Point2(pofs+cw,uy),uc); } ofs+=cw; } @@ -397,7 +429,7 @@ if (m_height > line_height) {\ bool visible = visible_characters<0 || p_char_countimage->draw(ci,Point2(wofs,y+lh-font->get_descent()-img->image->get_height())); + img->image->draw(ci,p_ofs+Point2(wofs,y+lh-font->get_descent()-img->image->get_height())); } p_char_count++; @@ -435,6 +467,138 @@ if (m_height > line_height) {\ #endif } break; + case ITEM_TABLE: { + + lh=0; + ItemTable *table = static_cast(it); + int hseparation=get_constant("table_hseparation"); + int vseparation=get_constant("table_vseparation"); + Color ccolor = _find_color(table,p_base_color); + Vector2 draw_ofs = Point2(wofs,y); + + if (p_mode==PROCESS_CACHE) { + + int idx=0; + //set minimums to zero + for(int i=0;icolumns.size();i++) { + table->columns[i].min_width=0; + table->columns[i].width=0; + } + //compute minimum width for each cell + for (List::Element *E=table->subitems.front();E;E=E->next()) { + ERR_CONTINUE(E->get()->type!=ITEM_FRAME); //children should all be frames + ItemFrame *frame = static_cast(E->get()); + + int column = idx % table->columns.size(); + + int ly=0; + + + for(int i=0;ilines.size();i++) { + + _process_line(frame,Point2(),ly,p_width,i,PROCESS_CACHE,cfont,Color()); + table->columns[column].min_width=MAX( table->columns[i].min_width, frame->lines[i].minimum_width ); + } + idx++; + } + + //compute available width and total radio (for expanders) + + + int total_ratio=0; + int available_width=p_width - hseparation * (table->columns.size() -1); + table->total_width=hseparation; + + for(int i=0;icolumns.size();i++) { + available_width-=table->columns[i].min_width; + if (table->columns[i].expand) + total_ratio+=table->columns[i].expand_ratio; + } + + //assign actual widths + + for(int i=0;icolumns.size();i++) { + table->columns[i].width = table->columns[i].min_width; + if (table->columns[i].expand) + table->columns[i].width+=table->columns[i].expand_ratio*available_width/total_ratio; + table->total_width+=table->columns[i].width+hseparation; + } + + //compute caches properly again with the right width + idx=0; + for (List::Element *E=table->subitems.front();E;E=E->next()) { + ERR_CONTINUE(E->get()->type!=ITEM_FRAME); //children should all be frames + ItemFrame *frame = static_cast(E->get()); + + int column = idx % table->columns.size(); + + + for(int i=0;ilines.size();i++) { + + int ly=0; + _process_line(frame,Point2(),ly,table->columns[column].width,i,PROCESS_CACHE,cfont,Color()); + frame->lines[i].height_cache=ly; //actual height + frame->lines[i].height_accum_cache=ly; //actual height + } + idx++; + } + + } + + + + Point2 offset(hseparation,vseparation); + + int row_height=0; + //draw using computed caches + int idx=0; + for (List::Element *E=table->subitems.front();E;E=E->next()) { + ERR_CONTINUE(E->get()->type!=ITEM_FRAME); //children should all be frames + ItemFrame *frame = static_cast(E->get()); + + int column = idx % table->columns.size(); + + int ly=0; + int yofs=0; + + + for(int i=0;ilines.size();i++) { + + if (p_mode==PROCESS_DRAW) { + _process_line(frame,p_ofs+offset+draw_ofs+Vector2(0,yofs),ly,table->columns[column].width,i,PROCESS_DRAW,cfont,ccolor); + } else if (p_mode==PROCESS_POINTER) { + _process_line(frame,p_ofs+offset+draw_ofs+Vector2(0,yofs),ly,table->columns[column].width,i,PROCESS_POINTER,cfont,ccolor,p_click_pos,r_click_item,r_click_char,r_outside); + } + yofs+=frame->lines[i].height_cache; + if (p_mode==PROCESS_CACHE) { + frame->lines[i].height_accum_cache=offset.y+draw_ofs.y+frame->lines[i].height_cache; + } + + } + + row_height=MAX(yofs,row_height); + offset.x+=table->columns[column].width+hseparation; + + if (column==table->columns.size()-1) { + + offset.y+=row_height+vseparation; + offset.x=hseparation; + row_height=0; + } + idx++; + } + + int total_height = offset.y; + if (row_height) { + total_height=row_height+vseparation; + } + + + + ADVANCE( table->total_width ); + CHECK_HEIGHT( total_height ); + + } break; default: {} @@ -445,7 +609,7 @@ if (m_height > line_height) {\ it = _get_next_item(it); - if (p_mode == PROCESS_POINTER && r_click_item && itp && !it && p_click_pos.y>y+lh) { + if (p_mode == PROCESS_POINTER && r_click_item && itp && !it && p_click_pos.y>p_ofs.y+y+lh) { //at the end of all, return this if (r_outside) *r_outside=true; *r_click_item=itp; @@ -453,9 +617,9 @@ if (m_height > line_height) {\ return; } - if (it && (p_line+1 < lines.size()) && lines[p_line+1].from==it) { + if (it && (p_line+1 < p_frame->lines.size()) && p_frame->lines[p_line+1].from==it) { - if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=y && p_click_pos.y<=y+lh) { + if (p_mode==PROCESS_POINTER && r_click_item && p_click_pos.y>=p_ofs.y+y && p_click_pos.y<=p_ofs.y+y+lh) { //went to next line, but pointer was on the previous one if (r_outside) *r_outside=true; *r_click_item=itp; @@ -493,8 +657,8 @@ void RichTextLabel::_scroll_changed(double) { void RichTextLabel::_update_scroll() { int total_height=0; - if (lines.size()) - total_height=lines[lines.size()-1].height_accum_cache; + if (main->lines.size()) + total_height=main->lines[main->lines.size()-1].height_accum_cache; bool exceeds = total_height > get_size().height && scroll_active; @@ -503,18 +667,18 @@ void RichTextLabel::_update_scroll() { if (exceeds) { scroll_visible=true; - first_invalid_line=0; + main->first_invalid_line=0; scroll_w=vscroll->get_combined_minimum_size().width; vscroll->show(); vscroll->set_anchor_and_margin( MARGIN_LEFT, ANCHOR_END,scroll_w); - _validate_line_caches(); + _validate_line_caches(main); } else { scroll_visible=false; vscroll->hide(); scroll_w=0; - _validate_line_caches(); + _validate_line_caches(main); } } @@ -527,7 +691,7 @@ void RichTextLabel::_notification(int p_what) { case NOTIFICATION_RESIZED: { - first_invalid_line=0; //invalidate ALL + main->first_invalid_line=0; //invalidate ALL update(); } break; @@ -535,7 +699,7 @@ void RichTextLabel::_notification(int p_what) { if (use_bbcode) parse_bbcode(bbcode); - first_invalid_line=0; //invalidate ALL + main->first_invalid_line=0; //invalidate ALL update(); } break; @@ -550,7 +714,7 @@ void RichTextLabel::_notification(int p_what) { } break; case NOTIFICATION_DRAW: { - _validate_line_caches(); + _validate_line_caches(main); _update_scroll(); @@ -571,25 +735,25 @@ void RichTextLabel::_notification(int p_what) { int from_line = 0; int total_chars = 0; - while (from_linelines.size()) { - if (lines[from_line].height_accum_cache>=ofs) + if (main->lines[from_line].height_accum_cache>=ofs) break; from_line++; - total_chars+=lines[from_line].char_count; + total_chars+=main->lines[from_line].char_count; } - if (from_line>=lines.size()) + if (from_line>=main->lines.size()) break; //nothing to draw - int y = (lines[from_line].height_accum_cache - lines[from_line].height_cache) - ofs; + int y = (main->lines[from_line].height_accum_cache - main->lines[from_line].height_cache) - ofs; Ref base_font=get_font("normal_font"); Color base_color=get_color("default_color"); - while (ylines.size()) { - _process_line(y,size.width-scroll_w,from_line,PROCESS_DRAW,base_font,base_color,Point2i(),NULL,NULL,NULL,total_chars); - total_chars+=lines[from_line].char_count; + _process_line(main,Point2(),y,size.width-scroll_w,from_line,PROCESS_DRAW,base_font,base_color,Point2i(),NULL,NULL,NULL,total_chars); + total_chars+=main->lines[from_line].char_count; from_line++; } } @@ -597,7 +761,7 @@ void RichTextLabel::_notification(int p_what) { } -void RichTextLabel::_find_click(const Point2i& p_click,Item **r_click_item,int *r_click_char,bool *r_outside) { +void RichTextLabel::_find_click(ItemFrame* p_frame,const Point2i& p_click,Item **r_click_item,int *r_click_char,bool *r_outside) { if (r_click_item) *r_click_item=NULL; @@ -609,26 +773,26 @@ void RichTextLabel::_find_click(const Point2i& p_click,Item **r_click_item,int * //todo, change to binary search int from_line = 0; - while (from_linelines.size()) { - if (lines[from_line].height_accum_cache>=ofs) + if (p_frame->lines[from_line].height_accum_cache>=ofs) break; from_line++; } - if (from_line>=lines.size()) + if (from_line>=p_frame->lines.size()) return; - int y = (lines[from_line].height_accum_cache - lines[from_line].height_cache) - ofs; + int y = (p_frame->lines[from_line].height_accum_cache - p_frame->lines[from_line].height_cache) - ofs; Ref base_font=get_font("normal_font"); Color base_color=get_color("default_color"); - while (ylines.size()) { - _process_line(y,size.width-scroll_w,from_line,PROCESS_POINTER,base_font,base_color,p_click,r_click_item,r_click_char,r_outside); + _process_line(p_frame,Point2(),y,size.width-scroll_w,from_line,PROCESS_POINTER,base_font,base_color,p_click,r_click_item,r_click_char,r_outside); if (r_click_item && *r_click_item) return; from_line++; @@ -643,13 +807,13 @@ Control::CursorShape RichTextLabel::get_cursor_shape(const Point2& p_pos) const if (!underline_meta || selection.click) return CURSOR_ARROW; - if (first_invalid_linefirst_invalid_linelines.size()) return CURSOR_ARROW; //invalid int line=0; Item *item=NULL; - ((RichTextLabel*)(this))->_find_click(p_pos,&item,&line); + ((RichTextLabel*)(this))->_find_click(main,p_pos,&item,&line); if (item && ((RichTextLabel*)(this))->_find_meta(item,NULL)) @@ -665,7 +829,7 @@ void RichTextLabel::_input_event(InputEvent p_event) { case InputEvent::MOUSE_BUTTON: { - if (first_invalid_linefirst_invalid_linelines.size()) return; const InputEventMouseButton& b = p_event.mouse_button; @@ -680,7 +844,7 @@ void RichTextLabel::_input_event(InputEvent p_event) { Item *item=NULL; bool outside; - _find_click(Point2i(b.x,b.y),&item,&line,&outside); + _find_click(main,Point2i(b.x,b.y),&item,&line,&outside); if (item) { @@ -773,7 +937,7 @@ void RichTextLabel::_input_event(InputEvent p_event) { } break; case InputEvent::MOUSE_MOTION: { - if (first_invalid_linefirst_invalid_linelines.size()) return; const InputEventMouseMotion& m = p_event.mouse_motion; @@ -782,7 +946,7 @@ void RichTextLabel::_input_event(InputEvent p_event) { int line=0; Item *item=NULL; - _find_click(Point2i(m.x,m.y),&item,&line); + _find_click(main,Point2i(m.x,m.y),&item,&line); if (!item) return; // do not update @@ -950,9 +1114,9 @@ bool RichTextLabel::_find_meta(Item *p_item,Variant *r_meta) { } -void RichTextLabel::_validate_line_caches() { +void RichTextLabel::_validate_line_caches(ItemFrame* p_frame) { - if (first_invalid_line==lines.size()) + if (p_frame->first_invalid_line==p_frame->lines.size()) return; //validate invalid lines!s @@ -960,24 +1124,24 @@ void RichTextLabel::_validate_line_caches() { Ref base_font=get_font("normal_font"); - for(int i=first_invalid_line;ifirst_invalid_line;ilines.size();i++) { int y=0; - _process_line(y,size.width-scroll_w,i,PROCESS_CACHE,base_font,Color()); - lines[i].height_cache=y; - lines[i].height_accum_cache=y; + _process_line(p_frame,Point2(),y,size.width-scroll_w,i,PROCESS_CACHE,base_font,Color()); + p_frame->lines[i].height_cache=y; + p_frame->lines[i].height_accum_cache=y; if (i>0) - lines[i].height_accum_cache+=lines[i-1].height_accum_cache; + p_frame->lines[i].height_accum_cache+=p_frame->lines[i-1].height_accum_cache; } int total_height=0; - if (lines.size()) - total_height=lines[lines.size()-1].height_accum_cache; + if (p_frame->lines.size()) + total_height=p_frame->lines[p_frame->lines.size()-1].height_accum_cache; - first_invalid_line=lines.size(); + main->first_invalid_line=p_frame->lines.size(); updating_scroll=true; vscroll->set_max(total_height); @@ -990,17 +1154,20 @@ void RichTextLabel::_validate_line_caches() { } -void RichTextLabel::_invalidate_current_line() { +void RichTextLabel::_invalidate_current_line(ItemFrame* p_frame) { - if (lines.size()-1 <= first_invalid_line) { + if (p_frame->lines.size()-1 <= p_frame->first_invalid_line) { - first_invalid_line=lines.size()-1; + p_frame->first_invalid_line=p_frame->lines.size()-1; update(); } } void RichTextLabel::add_text(const String& p_text) { + if (current->type==ITEM_TABLE) + return; //can't add anything here + int pos=0; while (pos(current->subitems.back()->get()); ti->text+=line; - _invalidate_current_line(); + _invalidate_current_line(main); } else { //append item condition @@ -1043,11 +1210,11 @@ void RichTextLabel::add_text(const String& p_text) { if (eol) { ItemNewline *item = memnew( ItemNewline ); - item->line=lines.size(); + item->line=current_frame->lines.size(); _add_item(item,false); - lines.resize(lines.size()+1); - lines[lines.size()-1].from=item; - _invalidate_current_line(); + current_frame->lines.resize(current_frame->lines.size()+1); + current_frame->lines[current_frame->lines.size()-1].from=item; + _invalidate_current_line(current_frame); } @@ -1055,25 +1222,38 @@ void RichTextLabel::add_text(const String& p_text) { } } -void RichTextLabel::_add_item(Item *p_item, bool p_enter) { +void RichTextLabel::_add_item(Item *p_item, bool p_enter, bool p_ensure_newline) { + + p_item->parent=current; p_item->E=current->subitems.push_back(p_item); p_item->index=current_idx++; + if (p_enter) current=p_item; - if (lines[lines.size()-1].from==NULL) { - lines[lines.size()-1].from=p_item; + if (p_ensure_newline && current_frame->lines[current_frame->lines.size()-1].from) { + _invalidate_current_line(current_frame); + current_frame->lines.resize( current_frame->lines.size() +1 ); + + } + + if (current_frame->lines[current_frame->lines.size()-1].from==NULL) { + current_frame->lines[current_frame->lines.size()-1].from=p_item; } + p_item->line=current_frame->lines.size()-1; - _invalidate_current_line(); + _invalidate_current_line(current_frame); } void RichTextLabel::add_image(const Ref& p_image) { + if (current->type==ITEM_TABLE) + return; + ERR_FAIL_COND(p_image.is_null()); ItemImage *item = memnew( ItemImage ); @@ -1084,15 +1264,18 @@ void RichTextLabel::add_image(const Ref& p_image) { void RichTextLabel::add_newline() { + if (current->type==ITEM_TABLE) + return; ItemNewline *item = memnew( ItemNewline ); - item->line=lines.size(); - lines.resize(lines.size()+1); + item->line=current_frame->lines.size(); + current_frame->lines.resize(current_frame->lines.size()+1); _add_item(item,false); } void RichTextLabel::push_font(const Ref& p_font) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ERR_FAIL_COND(p_font.is_null()); ItemFont *item = memnew( ItemFont ); @@ -1102,6 +1285,7 @@ void RichTextLabel::push_font(const Ref& p_font) { } void RichTextLabel::push_color(const Color& p_color) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ItemColor *item = memnew( ItemColor ); item->color=p_color; @@ -1110,6 +1294,7 @@ void RichTextLabel::push_color(const Color& p_color) { } void RichTextLabel::push_underline() { + ERR_FAIL_COND(current->type==ITEM_TABLE); ItemUnderline *item = memnew( ItemUnderline ); _add_item(item,true); @@ -1118,47 +1303,40 @@ void RichTextLabel::push_underline() { void RichTextLabel::push_align(Align p_align) { - lines.resize(lines.size()+1); + ERR_FAIL_COND(current->type==ITEM_TABLE); ItemAlign *item = memnew( ItemAlign ); item->align=p_align; - _add_item(item,true); - - ItemNewline *itemnl = memnew( ItemNewline ); - itemnl->line=lines.size()-1; - _add_item(itemnl,false); + _add_item(item,true,true); } void RichTextLabel::push_indent(int p_level) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ERR_FAIL_COND(p_level<0); - lines.resize(lines.size()+1); - ItemIndent *item = memnew( ItemIndent ); item->level=p_level; - _add_item(item,true); - - ItemNewline *itemnl = memnew( ItemNewline ); - itemnl->line=lines.size()-1; - _add_item(itemnl,false); + _add_item(item,true,true); } void RichTextLabel::push_list(ListType p_list) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ERR_FAIL_INDEX(p_list,3); ItemList *item = memnew( ItemList ); item->list_type=p_list; - _add_item(item,true); + _add_item(item,true,true); } void RichTextLabel::push_meta(const Variant& p_meta) { + ERR_FAIL_COND(current->type==ITEM_TABLE); ItemMeta *item = memnew( ItemMeta ); item->meta=p_meta; @@ -1166,9 +1344,62 @@ void RichTextLabel::push_meta(const Variant& p_meta) { } +void RichTextLabel::push_table(int p_columns) { + + ERR_FAIL_COND( p_columns < 1); + ItemTable *item = memnew( ItemTable ); + + item->columns.resize(p_columns); + item->total_width=0; + for(int i=0;icolumns.size();i++) { + item->columns[i].expand=false; + item->columns[i].expand_ratio=1; + } + _add_item(item,true,true); + +} + +void RichTextLabel::set_table_column_expand(int p_column,bool p_expand,int p_ratio) { + + ERR_FAIL_COND(current->type!=ITEM_TABLE); + ItemTable *table = static_cast(current); + ERR_FAIL_INDEX(p_column,table->columns.size()); + table->columns[p_column].expand=p_expand; + table->columns[p_column].expand_ratio=p_ratio; +} + +void RichTextLabel::push_cell(){ + + ERR_FAIL_COND(current->type!=ITEM_TABLE); + + ItemFrame *item = memnew( ItemFrame ); + item->parent_frame=current_frame; + _add_item(item,true); + current_frame=item; + item->cell=true; + item->parent_line=item->parent_frame->lines.size()-1; + item->lines.resize(1); + item->lines[0].from=NULL; + item->first_invalid_line=0; + +} + +int RichTextLabel::get_current_table_column() const { + + ERR_FAIL_COND_V(current->type!=ITEM_TABLE,-1); + + ItemTable *table = static_cast(current); + + return table->subitems.size() % table->columns.size(); + +} + void RichTextLabel::pop() { ERR_FAIL_COND(!current->parent); + if (current->type==ITEM_FRAME) { + current_frame = static_cast(current)->parent_frame; + } current=current->parent; } @@ -1176,9 +1407,10 @@ void RichTextLabel::clear() { main->_clear_children(); current=main; - lines.clear(); - lines.resize(1); - first_invalid_line=0; + current_frame=main; + main->lines.clear(); + main->lines.resize(1); + main->first_invalid_line=0; update(); selection.click=NULL; selection.active=false; @@ -1189,7 +1421,7 @@ void RichTextLabel::clear() { void RichTextLabel::set_tab_size(int p_spaces) { tab_size=p_spaces; - first_invalid_line=0; + main->first_invalid_line=0; update(); } @@ -1345,6 +1577,30 @@ Error RichTextLabel::append_bbcode(const String& p_bbcode) { push_font(mono_font); pos=brk_end+1; tag_stack.push_front(tag); + } else if (tag.begins_with("table=")) { + + int columns = tag.substr(6,tag.length()).to_int(); + if (columns<1) + columns=1; + //use monospace font + push_table(columns); + pos=brk_end+1; + tag_stack.push_front("table"); + } else if (tag=="cell") { + + push_cell(); + pos=brk_end+1; + tag_stack.push_front(tag); + } else if (tag.begins_with("cell=")) { + + int ratio = tag.substr(6,tag.length()).to_int(); + if (ratio<1) + ratio=1; + //use monospace font + set_table_column_expand(get_current_table_column(),true,ratio); + push_cell(); + pos=brk_end+1; + tag_stack.push_front("cell"); } else if (tag=="u") { //use underline @@ -1504,15 +1760,15 @@ Error RichTextLabel::append_bbcode(const String& p_bbcode) { void RichTextLabel::scroll_to_line(int p_line) { - ERR_FAIL_INDEX(p_line,lines.size()); - _validate_line_caches(); - vscroll->set_val(lines[p_line].height_accum_cache-lines[p_line].height_cache); + ERR_FAIL_INDEX(p_line,main->lines.size()); + _validate_line_caches(main); + vscroll->set_val(main->lines[p_line].height_accum_cache-main->lines[p_line].height_cache); } int RichTextLabel::get_line_count() const { - return lines.size(); + return current_frame->lines.size(); } void RichTextLabel::set_selection_enabled(bool p_enabled) { @@ -1556,29 +1812,31 @@ bool RichTextLabel::search(const String& p_string,bool p_from_selection) { selection.active=true; update(); - if (line==-1) { + _validate_line_caches(main); - while(it) { + int fh = _find_font(t).is_valid()?_find_font(t)->get_height():get_font("normal_font")->get_height(); - if (it->type==ITEM_NEWLINE) { + float offset =0; - line=static_cast(it)->line; - break; + int line = t->line; + Item *item =t; + while(item) { + if (item->type==ITEM_FRAME) { + ItemFrame *frame = static_cast(item); + if (line>=0 && linelines.size()) { + offset+=frame->lines[line].height_accum_cache-frame->lines[line].height_cache; + line=frame->line; } - - it=_get_next_item(it); } - + item=item->parent; } - - line-=2; - scroll_to_line(line<0?0:line); + vscroll->set_val(offset-fh); return true; } } - it=_get_next_item(it); + it=_get_next_item(it,true); charidx=0; } @@ -1617,7 +1875,7 @@ void RichTextLabel::selection_copy() { if (item==selection.to) break; - item=_get_next_item(item); + item=_get_next_item(item,true); } if (text!="") { @@ -1670,6 +1928,9 @@ void RichTextLabel::_bind_methods() { ObjectTypeDB::bind_method(_MD("push_list","type"),&RichTextLabel::push_list); ObjectTypeDB::bind_method(_MD("push_meta","data"),&RichTextLabel::push_meta); ObjectTypeDB::bind_method(_MD("push_underline"),&RichTextLabel::push_underline); + ObjectTypeDB::bind_method(_MD("push_table","columns"),&RichTextLabel::push_table); + ObjectTypeDB::bind_method(_MD("set_table_column_expand","column","expand"),&RichTextLabel::set_table_column_expand); + ObjectTypeDB::bind_method(_MD("push_cell"),&RichTextLabel::push_cell); ObjectTypeDB::bind_method(_MD("pop"),&RichTextLabel::pop); ObjectTypeDB::bind_method(_MD("clear"),&RichTextLabel::clear); @@ -1722,7 +1983,7 @@ void RichTextLabel::_bind_methods() { BIND_CONSTANT( LIST_LETTERS ); BIND_CONSTANT( LIST_DOTS ); - BIND_CONSTANT( ITEM_MAIN ); + BIND_CONSTANT( ITEM_FRAME ); BIND_CONSTANT( ITEM_TEXT ); BIND_CONSTANT( ITEM_IMAGE ); BIND_CONSTANT( ITEM_NEWLINE ); @@ -1750,8 +2011,8 @@ int RichTextLabel::get_visible_characters() const { int RichTextLabel::get_total_character_count() const { int tc=0; - for(int i=0;ilines.size();i++) + tc+=current_frame->lines[i].char_count; return tc; } @@ -1760,12 +2021,13 @@ int RichTextLabel::get_total_character_count() const { RichTextLabel::RichTextLabel() { - main = memnew( ItemMain ); + main = memnew( ItemFrame ); main->index=0; current=main; - lines.resize(1); - lines[0].from=main; - first_invalid_line=0; + main->lines.resize(1); + main->lines[0].from=main; + main->first_invalid_line=0; + current_frame=main; tab_size=4; default_align=ALIGN_LEFT; underline_meta=true; diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index eaa8d5d60a..bc45ded4ad 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -54,7 +54,7 @@ public: enum ItemType { - ITEM_MAIN, + ITEM_FRAME, ITEM_TEXT, ITEM_IMAGE, ITEM_NEWLINE, @@ -64,6 +64,7 @@ public: ITEM_ALIGN, ITEM_INDENT, ITEM_LIST, + ITEM_TABLE, ITEM_META }; @@ -72,6 +73,24 @@ protected: static void _bind_methods(); private: + struct Item; + + struct Line { + + Item *from; + Vector offset_caches; + Vector height_caches; + Vector space_caches; + int height_cache; + int height_accum_cache; + int char_count; + int minimum_width; + + Line() { from=NULL; char_count=0; } + }; + + + struct Item { int index; @@ -79,18 +98,26 @@ private: ItemType type; List subitems; List::Element *E; + int line; void _clear_children() { while (subitems.size()) { memdelete(subitems.front()->get()); subitems.pop_front(); } } - Item() { parent=NULL; E=NULL; } + Item() { parent=NULL; E=NULL; line=0;} virtual ~Item() { _clear_children(); } }; - struct ItemMain : public Item { + struct ItemFrame : public Item{ + + int parent_line; + bool cell; + Vector lines; + int first_invalid_line; + ItemFrame *parent_frame; - ItemMain() { type=ITEM_MAIN; } + ItemFrame() { type=ITEM_FRAME; parent_frame=NULL; cell=false; parent_line=0; } }; + struct ItemText : public Item { String text; @@ -150,11 +177,28 @@ private: ItemNewline() { type=ITEM_NEWLINE; } }; - ItemMain *main; + + struct ItemTable : public Item{ + + struct Column { + bool expand; + int expand_ratio; + int min_width; + int width; + }; + + Vector columns; + int total_width; + ItemTable() { type=ITEM_TABLE; } + }; + + ItemFrame *main; Item *current; + ItemFrame *current_frame; VScrollBar *vscroll; + bool scroll_visible; bool scroll_follow; bool scroll_following; @@ -163,34 +207,16 @@ private: bool updating_scroll; int current_idx; - struct Line { - - Item *from; - Vector offset_caches; - Vector height_caches; - Vector space_caches; - int height_cache; - int height_accum_cache; - int char_count; - - Line() { from=NULL; char_count=0; } - }; - - - - - Vector lines; - int first_invalid_line; int tab_size; bool underline_meta; Align default_align; - void _invalidate_current_line(); - void _validate_line_caches(); + void _invalidate_current_line(ItemFrame *p_frame); + void _validate_line_caches(ItemFrame *p_frame); - void _add_item(Item *p_item, bool p_enter=false); + void _add_item(Item *p_item, bool p_enter=false,bool p_ensure_newline=false); @@ -227,8 +253,8 @@ private: int visible_characters; - void _process_line(int &y, int p_width, int p_line, ProcessMode p_mode,const Ref &p_base_font,const Color &p_base_color,const Point2i& p_click_pos=Point2i(),Item **r_click_item=NULL,int *r_click_char=NULL,bool *r_outside=NULL,int p_char_count=0); - void _find_click(const Point2i& p_click,Item **r_click_item=NULL,int *r_click_char=NULL,bool *r_outside=NULL); + void _process_line(ItemFrame *p_frame,const Vector2& p_ofs,int &y, int p_width, int p_line, ProcessMode p_mode,const Ref &p_base_font,const Color &p_base_color,const Point2i& p_click_pos=Point2i(),Item **r_click_item=NULL,int *r_click_char=NULL,bool *r_outside=NULL,int p_char_count=0); + void _find_click(ItemFrame *p_frame, const Point2i& p_click,Item **r_click_item=NULL,int *r_click_char=NULL,bool *r_outside=NULL); Ref _find_font(Item *p_item); @@ -242,12 +268,12 @@ private: void _scroll_changed(double); void _input_event(InputEvent p_event); - Item *_get_next_item(Item* p_item); + Item *_get_next_item(Item* p_item, bool p_free=false); bool use_bbcode; String bbcode; - + void _update_all_lines(); protected: void _notification(int p_what); @@ -264,6 +290,10 @@ public: void push_indent(int p_level); void push_list(ListType p_list); void push_meta(const Variant& p_data); + void push_table(int p_columns); + void set_table_column_expand(int p_column, bool p_expand, int p_ratio=1); + int get_current_table_column() const; + void push_cell(); void pop(); void clear(); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 33e1eb338e..68033b6682 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -797,6 +797,8 @@ void make_default_theme() { t->set_color("selection_color","RichTextLabel", Color(0.1,0.1,1,0.8) ); t->set_constant("line_separation","RichTextLabel", 1 ); + t->set_constant("table_hseparation","RichTextLabel", 3 ); + t->set_constant("table_vseparation","RichTextLabel", 3 ); diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index a5a3890129..1905ab731f 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -690,16 +690,28 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); //class_desc->add_newline(); - class_desc->add_newline(); +// class_desc->add_newline(); class_desc->push_indent(1); + class_desc->push_table(2); + class_desc->set_table_column_expand(1,1); for(int i=0;ipush_cell(); + + method_line[cd.methods[i].name]=class_desc->get_line_count()-2; //gets overriden if description + class_desc->push_align(RichTextLabel::ALIGN_RIGHT); class_desc->push_font(doc_code_font); _add_type(cd.methods[i].return_type); - class_desc->add_text(" "); + //class_desc->add_text(" "); + class_desc->pop(); //align + class_desc->pop(); //font + class_desc->pop(); //cell + class_desc->push_cell(); + class_desc->push_font(doc_code_font); + if (cd.methods[i].description!="") { method_descr=true; class_desc->push_meta("@"+cd.methods[i].name); @@ -742,12 +754,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { } class_desc->pop();//monofont - class_desc->add_newline(); +// class_desc->add_newline(); + class_desc->pop(); //cell } - + class_desc->pop(); //table class_desc->pop(); class_desc->add_newline(); + class_desc->add_newline(); } -- cgit v1.2.3 From 84c5585afee3ae8605620538e02887b38ef2bc8e Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Sat, 26 Dec 2015 17:55:48 +0100 Subject: Added reload icon to FileDialog's default theme --- scene/gui/file_dialog.cpp | 2 +- scene/resources/default_theme/default_theme.cpp | 6 +++++- scene/resources/default_theme/icon_reload.png | Bin 0 -> 519 bytes scene/resources/default_theme/theme_data.h | 5 +++++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 scene/resources/default_theme/icon_reload.png diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 22e3a81e52..9179d3a4e1 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -49,7 +49,7 @@ void FileDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { - refresh->set_icon(get_icon("Reload","EditorIcons")); + refresh->set_icon(get_icon("reload")); } if (p_what==NOTIFICATION_DRAW) { diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 33e1eb338e..7c43b66af3 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -543,7 +543,11 @@ void make_default_theme() { t->set_constant("close_v_ofs","WindowDialog", 20 ); t->set_constant("titlebar_height","WindowDialog", 18 ); t->set_constant("title_height","WindowDialog", 20 ); - + + + // File Dialog + + t->set_icon("reload","FileDialog",make_icon( icon_reload_png )); // Popup diff --git a/scene/resources/default_theme/icon_reload.png b/scene/resources/default_theme/icon_reload.png new file mode 100644 index 0000000000..f7c6530d77 Binary files /dev/null and b/scene/resources/default_theme/icon_reload.png differ diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h index c338126d3a..c1fac47724 100644 --- a/scene/resources/default_theme/theme_data.h +++ b/scene/resources/default_theme/theme_data.h @@ -194,6 +194,11 @@ static const unsigned char icon_play_png[]={ }; +static const unsigned char icon_reload_png[]={ +0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x12,0x0,0x0,0xb,0x12,0x1,0xd2,0xdd,0x7e,0xfc,0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x57,0x81,0xe,0x17,0x0,0x0,0x1,0x94,0x49,0x44,0x41,0x54,0x38,0x8d,0x85,0xd3,0xbd,0x6a,0x55,0x41,0x14,0xc5,0xf1,0xdf,0xb9,0x1f,0x91,0x20,0x5a,0x89,0xd8,0x8,0x4b,0xd0,0x42,0x1f,0xc0,0x42,0x4,0x4b,0xb,0x1b,0x9b,0xbc,0x80,0x58,0x45,0xc5,0x56,0x51,0x50,0x6b,0x21,0x9d,0xa5,0x6f,0x20,0x88,0x20,0xa8,0xad,0xa8,0xa0,0x2f,0x60,0x21,0xe8,0x4e,0x63,0xa9,0x85,0x22,0x31,0x37,0x37,0xb1,0xb8,0x73,0xc2,0xf1,0x23,0x38,0xd5,0x9c,0x61,0xaf,0x3d,0x7b,0xfe,0x6b,0x9d,0xce,0x1e,0xab,0xaa,0xc6,0x18,0xa1,0xc3,0xe,0xb6,0x92,0xec,0xfc,0x59,0x37,0xda,0x43,0x8,0xc7,0x70,0x9,0x37,0xb0,0xd2,0xd7,0x56,0x55,0x57,0x55,0xbb,0xf5,0xdd,0x1f,0xe2,0xae,0x9,0x9f,0xe2,0x24,0xb6,0x6,0x97,0x8c,0xf0,0x32,0xc9,0xb9,0xaa,0x9a,0x62,0x96,0x64,0xd1,0xa0,0x75,0x1c,0xe3,0x2,0x9e,0x34,0xc1,0x2b,0x3c,0xc6,0x3a,0x8e,0xe3,0x76,0xab,0x59,0xc6,0x41,0xfc,0xc0,0xbc,0x6f,0x30,0xc6,0x61,0x7c,0x6e,0xe2,0x53,0x49,0xde,0x57,0xd5,0x12,0xb6,0xd1,0x25,0x99,0x55,0xd5,0x3,0xac,0x36,0x1e,0xd3,0x5d,0x6,0x49,0xe6,0x78,0xd4,0xc4,0xe7,0xf1,0xa9,0x9d,0x6f,0x26,0xd9,0xc2,0xac,0x7d,0x5f,0xc1,0x73,0xcc,0xab,0xea,0x7a,0x55,0x4d,0x7b,0x30,0x37,0x71,0x6,0xdf,0x70,0x34,0xc9,0xc6,0x90,0x4d,0x92,0x21,0xa3,0x15,0xec,0xc3,0x6a,0x92,0x59,0x57,0x55,0x13,0x4c,0xdb,0x9b,0x36,0x92,0x2c,0x57,0xd5,0xb8,0x4d,0xf5,0xcf,0x55,0x55,0x33,0x4c,0x92,0x74,0xa3,0x46,0x7a,0x8e,0x13,0x38,0xd8,0x1a,0xfe,0x53,0x3c,0xb0,0xef,0x4b,0xbf,0x19,0xb5,0xf1,0x36,0xf1,0x31,0xc9,0xcc,0x22,0x34,0xff,0x5b,0x87,0xf1,0x95,0xbf,0x73,0xb0,0x86,0x5b,0xf8,0x89,0xed,0xfe,0xed,0x83,0xdb,0x97,0x70,0x19,0x6b,0x78,0x88,0xab,0xbd,0x8d,0x13,0x9c,0xc6,0x6b,0xac,0x27,0x49,0xb3,0x70,0x96,0x64,0xa7,0xc1,0x9b,0xe0,0x90,0x66,0x75,0x92,0xae,0xaa,0xba,0xde,0xc6,0xad,0x24,0x6f,0xf0,0xc,0x47,0xaa,0xea,0x3b,0x2e,0xe,0xb2,0xbf,0xdf,0x22,0xd2,0x7d,0x4e,0xce,0xb7,0x34,0xee,0xec,0x26,0x71,0x60,0xd5,0x5d,0xdc,0xb1,0x0,0xd9,0xff,0x17,0x2c,0xb2,0x30,0xc5,0x59,0xbc,0xee,0xeb,0xfb,0x9,0x86,0x84,0xef,0xe1,0x0,0xee,0xe3,0x2d,0x3e,0xe0,0x5,0xae,0x25,0xe9,0xf0,0x6e,0xc8,0xe6,0x37,0x88,0x3,0x58,0x1d,0xc6,0x2d,0x85,0xfd,0xf9,0x92,0x85,0x5b,0x86,0xd,0x7e,0x1,0x82,0x4c,0xaa,0x69,0x77,0x3c,0x4b,0x15,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + + static const unsigned char icon_stop_png[]={ 0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xde,0x9,0xf,0x14,0x33,0x24,0x62,0xd4,0x2f,0x95,0x0,0x0,0x0,0x39,0x49,0x44,0x41,0x54,0x38,0x8d,0x63,0x60,0xa0,0x6,0xf8,0xf0,0xe1,0x3,0x33,0xb9,0x7a,0x18,0x61,0x2,0xf,0x1f,0x3e,0xfc,0x4f,0x8a,0x1,0xf2,0xf2,0xf2,0x8c,0xc,0xc,0xc,0xc,0x4c,0xa4,0xda,0x8c,0xe,0x46,0xd,0x18,0x35,0x60,0x70,0x18,0xc0,0xc0,0xc0,0x40,0x59,0x66,0xa2,0x18,0x0,0x0,0x2a,0xc7,0xf,0x64,0xd5,0xe,0x11,0x85,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 }; -- cgit v1.2.3 From ddd66c890420e0849700ae30c0411004671bd954 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 26 Dec 2015 15:18:01 -0300 Subject: small optimization improvement to rich text label tables --- scene/gui/rich_text_label.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index c8ac816ffd..0db85981f7 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -475,6 +475,7 @@ if (m_height > line_height) {\ int vseparation=get_constant("table_vseparation"); Color ccolor = _find_color(table,p_base_color); Vector2 draw_ofs = Point2(wofs,y); + int max_y=get_size().height; if (p_mode==PROCESS_CACHE) { @@ -562,13 +563,22 @@ if (m_height > line_height) {\ int yofs=0; + int lines_h = frame->lines[frame->lines.size()-1].height_accum_cache - (frame->lines[0].height_accum_cache - frame->lines[0].height_cache); + int lines_ofs = p_ofs.y+offset.y+draw_ofs.y; + + bool visible = lines_ofs < get_size().height && lines_ofs+lines_h >=0; + for(int i=0;ilines.size();i++) { - if (p_mode==PROCESS_DRAW) { - _process_line(frame,p_ofs+offset+draw_ofs+Vector2(0,yofs),ly,table->columns[column].width,i,PROCESS_DRAW,cfont,ccolor); - } else if (p_mode==PROCESS_POINTER) { - _process_line(frame,p_ofs+offset+draw_ofs+Vector2(0,yofs),ly,table->columns[column].width,i,PROCESS_POINTER,cfont,ccolor,p_click_pos,r_click_item,r_click_char,r_outside); + + if (visible) { + if (p_mode==PROCESS_DRAW) { + _process_line(frame,p_ofs+offset+draw_ofs+Vector2(0,yofs),ly,table->columns[column].width,i,PROCESS_DRAW,cfont,ccolor); + } else if (p_mode==PROCESS_POINTER) { + _process_line(frame,p_ofs+offset+draw_ofs+Vector2(0,yofs),ly,table->columns[column].width,i,PROCESS_POINTER,cfont,ccolor,p_click_pos,r_click_item,r_click_char,r_outside); + } } + yofs+=frame->lines[i].height_cache; if (p_mode==PROCESS_CACHE) { frame->lines[i].height_accum_cache=offset.y+draw_ofs.y+frame->lines[i].height_cache; -- cgit v1.2.3 From 6387a8e01f6cd2f2417d030c0874600cba0b3a88 Mon Sep 17 00:00:00 2001 From: Ariel Manzur Date: Sat, 26 Dec 2015 15:38:39 -0300 Subject: fixes crash/deadlock when video is paused and unpaused, might affect audio sync tho --- scene/gui/video_player.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 58683a07ad..5db809a618 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -271,6 +271,7 @@ void VideoPlayer::set_paused(bool p_paused) { playback->set_paused(p_paused); set_process(!p_paused); }; + last_audio_time = 0; }; bool VideoPlayer::is_paused() const { -- cgit v1.2.3 From e66f4a40211fb5fa0a0d050a0acc0f266e392de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 27 Dec 2015 23:06:13 +0100 Subject: Sync doc with current source --- doc/base/classes.xml | 483 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 462 insertions(+), 21 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 075f97c68e..dba13eea04 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -525,13 +525,13 @@ Converts the value of a variable to a String. - + - Converts the value of a String to a variable. + Converts the value of a String to a Variant. @@ -573,7 +573,7 @@ - + Hashes the variable passed and returns an integer. @@ -1849,6 +1849,8 @@ + + @@ -3724,7 +3726,7 @@ - + @@ -3733,7 +3735,7 @@ - + @@ -3898,6 +3900,14 @@ Get whether this is a shared array instance. + + + + + + + + @@ -3905,6 +3915,12 @@ Append an element at the end of the array. + + + + + + @@ -5969,6 +5985,18 @@ + + + + + + + + + + + + Force the camera to update scroll immediately. @@ -6061,6 +6089,12 @@ Hide the CanvasItem currently visible. + + + + + + Queue the CanvasItem for update. NOTIFICATION_DRAW will be called on idle time to request redraw. @@ -6186,6 +6220,8 @@ + + Draw a texture at a given position. @@ -7060,7 +7096,7 @@ - Change a shape in the collision body. + Change a shape in the collision body. @@ -7734,6 +7770,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -8150,6 +8246,18 @@ Move the Control to a new position, relative to the top-left corner of the [i]window[/i] Control, and without changing current anchor mode. (see [method set_margin]). + + + + + + + + + + + + @@ -8186,6 +8294,18 @@ Returns the size of the Control, computed from all margins, however the size returned will [b]never be smaller than the minimum size reported by [method get_minimum_size][/b]. This means that even if end position of the Control rectangle is smaller than the begin position, the Control will still display and interact correctly. (see description, [method get_minimum_size], [method set_margin], [method set_anchor]). + + + + + + + + + + + + @@ -10681,6 +10801,8 @@ This approximation makes straight segments between each point, then subdivides t + + @@ -11032,6 +11154,18 @@ This approximation makes straight segments between each point, then subdivides t Draw character "char" into a canvas item using the font at a given "pos" position, with "modulate" color, and optionally kerning if "next" is apassed. clipping the width. "pos" specifies te baseline, not the top. To draw from the top, [i]ascent[/i] must be added to the Y axis. The width used by the character is returned, making this function useful for drawing strings character by character. + + + + + + + + + + + + @@ -11089,6 +11223,8 @@ This approximation makes straight segments between each point, then subdivides t + + @@ -13369,6 +13505,10 @@ returns:= "username=user&password=pass" + + + + @@ -15038,6 +15178,18 @@ returns:= "username=user&password=pass" + + + + + + + + + + + + @@ -15090,6 +15242,18 @@ returns:= "username=user&password=pass" + + + + + + + + + + + + @@ -15150,6 +15314,8 @@ returns:= "username=user&password=pass" + + @@ -15288,6 +15454,8 @@ returns:= "username=user&password=pass" + + @@ -15968,6 +16136,8 @@ returns:= "username=user&password=pass" + + @@ -16332,6 +16502,8 @@ returns:= "username=user&password=pass" + + @@ -18346,8 +18518,11 @@ returns:= "username=user&password=pass" + + Add a child [Node]. Nodes can have as many children as they want, but every child must have a unique name. Children nodes are automatically deleted when the parent node is deleted, so deleting a whole scene is performed by deleting its topmost node. + The optional boolean argument enforces creating child node with human-readable names, based on the name of node being instanced instead of its type only. @@ -19961,6 +20136,8 @@ returns:= "username=user&password=pass" + + @@ -20514,7 +20691,7 @@ returns:= "username=user&password=pass" - + @@ -21245,6 +21422,8 @@ returns:= "username=user&password=pass" + + @@ -21269,6 +21448,8 @@ returns:= "username=user&password=pass" + + @@ -22147,6 +22328,8 @@ This method controls whether the position between two cached points is interpola + + @@ -23092,15 +23275,15 @@ This method controls whether the position between two cached points is interpola + + This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. + This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. - - This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. - This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. @@ -24855,15 +25038,15 @@ This method controls whether the position between two cached points is interpola + + This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. + This area adds its gravity/damp values to whatever has been calculated so far. This way, many overlapping areas can combine their physics to make interesting effects. This area adds its gravity/damp values to whatever has been calculated so far. Then stops taking into account the rest of the areas, even the default one. - - This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. - This area replaces any gravity/damp, even the default one, and stops taking into account the rest of the areas. @@ -27073,7 +27256,7 @@ This method controls whether the position between two cached points is interpola - Compiles and assign the regular expression pattern to use. The limit on the number of capturing groups can be specified or made unlimited if negative. + Compiles and assign the regular expression pattern to use. The limit on the number of capturing groups can be specified or made unlimited if negative. @@ -27602,6 +27785,26 @@ This method controls whether the position between two cached points is interpola + + + + + + + + + + + + + + + + + + + + @@ -27766,7 +27969,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27786,10 +27989,14 @@ This method controls whether the position between two cached points is interpola - + + + + + @@ -30513,6 +30720,8 @@ This method controls whether the position between two cached points is interpola + + @@ -30775,12 +30984,14 @@ This method controls whether the position between two cached points is interpola - + + + @@ -30856,6 +31067,8 @@ This method controls whether the position between two cached points is interpola + + @@ -30868,6 +31081,8 @@ This method controls whether the position between two cached points is interpola + + @@ -31422,6 +31637,12 @@ This method controls whether the position between two cached points is interpola + + + + + + @@ -32639,6 +32860,178 @@ This method controls whether the position between two cached points is interpola Return a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will return how many were actually received. This function returns two values, an [Error] code, and a data array. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -34132,6 +34525,14 @@ This method controls whether the position between two cached points is interpola + + + + + + + + @@ -34657,7 +35058,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34705,7 +35106,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35177,6 +35578,16 @@ This method controls whether the position between two cached points is interpola + + + + + + + + + + @@ -35416,6 +35827,18 @@ This method controls whether the position between two cached points is interpola Return the collision bounce parameter. + + + + + + + + + + + + @@ -36815,6 +37238,8 @@ This method controls whether the position between two cached points is interpola + + @@ -37437,7 +37862,7 @@ This method controls whether the position between two cached points is interpola - + @@ -37447,7 +37872,7 @@ This method controls whether the position between two cached points is interpola - + @@ -38475,6 +38900,12 @@ This method controls whether the position between two cached points is interpola + + + + + + @@ -40277,6 +40708,14 @@ This method controls whether the position between two cached points is interpola + + + + + + + + @@ -40722,6 +41161,8 @@ This method controls whether the position between two cached points is interpola + + -- cgit v1.2.3 From 9fddc69769abf5df9472f283fab68967e7c8373b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 28 Dec 2015 00:12:13 +0100 Subject: Style fix for rounded_values methods in Range --- scene/gui/range.cpp | 24 +++++++++++++----------- scene/gui/range.h | 9 +++++---- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 7103ee651f..bee6527795 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -216,11 +216,10 @@ void Range::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_val"),&Range::get_val); ObjectTypeDB::bind_method(_MD("get_value"),&Range::get_val); ObjectTypeDB::bind_method(_MD("get_min"),&Range::get_min); - ObjectTypeDB::bind_method(_MD("get_max"),&Range::get_max); - ObjectTypeDB::bind_method(_MD("get_step"),&Range::get_step); - ObjectTypeDB::bind_method(_MD("get_page"),&Range::get_page); - ObjectTypeDB::bind_method(_MD("get_unit_value"),&Range::get_unit_value); - ObjectTypeDB::bind_method(_MD("get_rounded_values"),&Range::get_rounded_values); + ObjectTypeDB::bind_method(_MD("get_max"),&Range::get_max); + ObjectTypeDB::bind_method(_MD("get_step"),&Range::get_step); + ObjectTypeDB::bind_method(_MD("get_page"),&Range::get_page); + ObjectTypeDB::bind_method(_MD("get_unit_value"),&Range::get_unit_value); ObjectTypeDB::bind_method(_MD("set_val","value"),&Range::set_val); ObjectTypeDB::bind_method(_MD("set_value","value"),&Range::set_val); ObjectTypeDB::bind_method(_MD("set_min","minimum"),&Range::set_min); @@ -228,7 +227,8 @@ void Range::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_step","step"),&Range::set_step); ObjectTypeDB::bind_method(_MD("set_page","pagesize"),&Range::set_page); ObjectTypeDB::bind_method(_MD("set_unit_value","value"),&Range::set_unit_value); - ObjectTypeDB::bind_method(_MD("set_rounded_values"),&Range::set_rounded_values); + ObjectTypeDB::bind_method(_MD("set_rounded_values","enabled"),&Range::set_rounded_values); + ObjectTypeDB::bind_method(_MD("is_rounded_values"),&Range::is_rounded_values); ObjectTypeDB::bind_method(_MD("set_exp_unit_value","enabled"),&Range::set_exp_unit_value); ObjectTypeDB::bind_method(_MD("is_unit_value_exp"),&Range::is_unit_value_exp); @@ -244,16 +244,18 @@ void Range::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::REAL, "range/page" ), _SCS("set_page"), _SCS("get_page") ); ADD_PROPERTY( PropertyInfo( Variant::REAL, "range/value" ), _SCS("set_val"), _SCS("get_val") ); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "range/exp_edit" ), _SCS("set_exp_unit_value"), _SCS("is_unit_value_exp") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "rounded_values" ), _SCS("set_rounded_values"), _SCS("get_rounded_values") ); + ADD_PROPERTY( PropertyInfo( Variant::BOOL, "range/rounded" ), _SCS("set_rounded_values"), _SCS("is_rounded_values") ); } -void Range::set_rounded_values(bool p){ - _rounded_values = p; +void Range::set_rounded_values(bool p_enable) { + + _rounded_values = p_enable; } -bool Range::get_rounded_values() const{ - return _rounded_values; +bool Range::is_rounded_values() const { + + return _rounded_values; } void Range::set_exp_unit_value(bool p_enable) { diff --git a/scene/gui/range.h b/scene/gui/range.h index 48361ddb0e..f31a81f0b5 100644 --- a/scene/gui/range.h +++ b/scene/gui/range.h @@ -72,22 +72,23 @@ public: void set_step(double p_step); void set_page(double p_page); void set_unit_value(double p_value); - void set_rounded_values(bool); - + double get_val() const; double get_min() const; double get_max() const; double get_step() const; double get_page() const; double get_unit_value() const; - bool get_rounded_values() const; + + void set_rounded_values(bool p_enable); + bool is_rounded_values() const; void set_exp_unit_value(bool p_enable); bool is_unit_value_exp() const; void share(Range *p_range); void unshare(); - + Range(); ~Range(); -- cgit v1.2.3 From 46eebac3ae299177063b2be69b4f3cd4552f083a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 28 Dec 2015 01:18:37 +0100 Subject: Remove bogus argument in sample_get_description Copy-paste mistake from the setter most likely. --- doc/base/classes.xml | 2 -- platform/javascript/audio_server_javascript.cpp | 2 +- platform/javascript/audio_server_javascript.h | 2 +- servers/audio/audio_server_sw.cpp | 2 +- servers/audio/audio_server_sw.h | 2 +- servers/audio_server.h | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index dba13eea04..29ecf5d114 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -4104,8 +4104,6 @@ - - Return the description of an audio sample. Mainly used for organization. diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp index a2c6740eaf..fbd5d2e1c0 100644 --- a/platform/javascript/audio_server_javascript.cpp +++ b/platform/javascript/audio_server_javascript.cpp @@ -33,7 +33,7 @@ void AudioServerJavascript::sample_set_description(RID p_sample, const String& p } -String AudioServerJavascript::sample_get_description(RID p_sample, const String& p_description) const{ +String AudioServerJavascript::sample_get_description(RID p_sample) const{ return String(); } diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h index 450237d324..1dc90c48ee 100644 --- a/platform/javascript/audio_server_javascript.h +++ b/platform/javascript/audio_server_javascript.h @@ -95,7 +95,7 @@ public: virtual RID sample_create(SampleFormat p_format, bool p_stereo, int p_length); virtual void sample_set_description(RID p_sample, const String& p_description); - virtual String sample_get_description(RID p_sample, const String& p_description) const; + virtual String sample_get_description(RID p_sample) const; virtual SampleFormat sample_get_format(RID p_sample) const; virtual bool sample_is_stereo(RID p_sample) const; diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp index 500886d73a..9d7cdc2420 100644 --- a/servers/audio/audio_server_sw.cpp +++ b/servers/audio/audio_server_sw.cpp @@ -360,7 +360,7 @@ void AudioServerSW::sample_set_description(RID p_sample, const String& p_descrip AUDIO_LOCK sample_manager->sample_set_description(p_sample,p_description); } -String AudioServerSW::sample_get_description(RID p_sample, const String& p_description) const { +String AudioServerSW::sample_get_description(RID p_sample) const { AUDIO_LOCK return sample_manager->sample_get_description(p_sample); diff --git a/servers/audio/audio_server_sw.h b/servers/audio/audio_server_sw.h index c566e129c1..75d635e243 100644 --- a/servers/audio/audio_server_sw.h +++ b/servers/audio/audio_server_sw.h @@ -118,7 +118,7 @@ public: virtual RID sample_create(SampleFormat p_format, bool p_stereo, int p_length); virtual void sample_set_description(RID p_sample, const String& p_description); - virtual String sample_get_description(RID p_sample, const String& p_description) const; + virtual String sample_get_description(RID p_sample) const; virtual SampleFormat sample_get_format(RID p_sample) const; virtual bool sample_is_stereo(RID p_sample) const; diff --git a/servers/audio_server.h b/servers/audio_server.h index cd3e920f31..6490a281d8 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -160,7 +160,7 @@ public: virtual RID sample_create(SampleFormat p_format, bool p_stereo, int p_length)=0; virtual void sample_set_description(RID p_sample, const String& p_description)=0; - virtual String sample_get_description(RID p_sample, const String& p_description) const=0; + virtual String sample_get_description(RID p_sample) const=0; virtual SampleFormat sample_get_format(RID p_sample) const=0; virtual bool sample_is_stereo(RID p_sample) const=0; -- cgit v1.2.3 From d1caf2f0379bcd0f127df04fd2dcb66723e1ba2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 28 Dec 2015 01:32:12 +0100 Subject: Remove bogus argument in body_get_node --- doc/base/classes.xml | 2 -- servers/physics/physics_server_sw.cpp | 2 +- servers/physics/physics_server_sw.h | 2 +- servers/physics_server.h | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 29ecf5d114..2cc91ac070 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -24323,8 +24323,6 @@ This method controls whether the position between two cached points is interpola - - diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index a9a8042c19..7a35510963 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -517,7 +517,7 @@ void PhysicsServerSW::body_set_mode(RID p_body, BodyMode p_mode) { body->set_mode(p_mode); }; -PhysicsServer::BodyMode PhysicsServerSW::body_get_mode(RID p_body, BodyMode p_mode) const { +PhysicsServer::BodyMode PhysicsServerSW::body_get_mode(RID p_body) const { BodySW *body = body_owner.get(p_body); ERR_FAIL_COND_V(!body,BODY_MODE_STATIC); diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index abbb057616..b9dcff658b 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -146,7 +146,7 @@ public: virtual RID body_get_space(RID p_body) const; virtual void body_set_mode(RID p_body, BodyMode p_mode); - virtual BodyMode body_get_mode(RID p_body, BodyMode p_mode) const; + virtual BodyMode body_get_mode(RID p_body) const; virtual void body_add_shape(RID p_body, RID p_shape, const Transform& p_transform=Transform()); virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape); diff --git a/servers/physics_server.h b/servers/physics_server.h index 66296fa15d..d0065e13aa 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -372,7 +372,7 @@ public: virtual RID body_get_space(RID p_body) const=0; virtual void body_set_mode(RID p_body, BodyMode p_mode)=0; - virtual BodyMode body_get_mode(RID p_body, BodyMode p_mode) const=0; + virtual BodyMode body_get_mode(RID p_body) const=0; virtual void body_add_shape(RID p_body, RID p_shape, const Transform& p_transform=Transform())=0; virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape)=0; -- cgit v1.2.3 From fe46b2ac0c56b58fd9651d283cf1ec802e613646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 28 Dec 2015 01:42:22 +0100 Subject: Fix wrong getters in ShaderGraph --- scene/resources/shader_graph.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index f8a14e58a0..04334e1159 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -179,25 +179,25 @@ void ShaderGraph::_bind_methods() { ObjectTypeDB::bind_method(_MD("default_get_value","shader_type","id","param_id"), &ShaderGraph::default_get_value); ObjectTypeDB::bind_method(_MD("scalar_const_node_set_value","shader_type","id","value"),&ShaderGraph::scalar_const_node_set_value); - ObjectTypeDB::bind_method(_MD("scalar_const_node_get_value","shader_type","id"),&ShaderGraph::scalar_const_node_set_value); + ObjectTypeDB::bind_method(_MD("scalar_const_node_get_value","shader_type","id"),&ShaderGraph::scalar_const_node_get_value); ObjectTypeDB::bind_method(_MD("vec_const_node_set_value","shader_type","id","value"),&ShaderGraph::vec_const_node_set_value); - ObjectTypeDB::bind_method(_MD("vec_const_node_get_value","shader_type","id"),&ShaderGraph::vec_const_node_set_value); + ObjectTypeDB::bind_method(_MD("vec_const_node_get_value","shader_type","id"),&ShaderGraph::vec_const_node_get_value); ObjectTypeDB::bind_method(_MD("rgb_const_node_set_value","shader_type","id","value"),&ShaderGraph::rgb_const_node_set_value); - ObjectTypeDB::bind_method(_MD("rgb_const_node_get_value","shader_type","id"),&ShaderGraph::rgb_const_node_set_value); + ObjectTypeDB::bind_method(_MD("rgb_const_node_get_value","shader_type","id"),&ShaderGraph::rgb_const_node_get_value); ObjectTypeDB::bind_method(_MD("xform_const_node_set_value","shader_type","id","value"),&ShaderGraph::xform_const_node_set_value); - ObjectTypeDB::bind_method(_MD("xform_const_node_get_value","shader_type","id"),&ShaderGraph::xform_const_node_set_value); + ObjectTypeDB::bind_method(_MD("xform_const_node_get_value","shader_type","id"),&ShaderGraph::xform_const_node_get_value); // void get_node_list(ShaderType p_which,List *p_node_list) const; ObjectTypeDB::bind_method(_MD("texture_node_set_filter_size","shader_type","id","filter_size"),&ShaderGraph::texture_node_set_filter_size); - ObjectTypeDB::bind_method(_MD("texture_node_get_filter_size","shader_type","id"),&ShaderGraph::texture_node_set_filter_size); + ObjectTypeDB::bind_method(_MD("texture_node_get_filter_size","shader_type","id"),&ShaderGraph::texture_node_get_filter_size); ObjectTypeDB::bind_method(_MD("texture_node_set_filter_strength","shader_type","id","filter_strength"),&ShaderGraph::texture_node_set_filter_strength); - ObjectTypeDB::bind_method(_MD("texture_node_get_filter_strength","shader_type","id"),&ShaderGraph::texture_node_set_filter_strength); + ObjectTypeDB::bind_method(_MD("texture_node_get_filter_strength","shader_type","id"),&ShaderGraph::texture_node_get_filter_strength); ObjectTypeDB::bind_method(_MD("scalar_op_node_set_op","shader_type","id","op"),&ShaderGraph::scalar_op_node_set_op); ObjectTypeDB::bind_method(_MD("scalar_op_node_get_op","shader_type","id"),&ShaderGraph::scalar_op_node_get_op); -- cgit v1.2.3 From d4993b74fc715d294ca0a77b335db3782d4bdcd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 28 Dec 2015 02:13:05 +0100 Subject: Add missing argument names in GDScript bindings All classes were reviewed apart from VisualServer for which no argument name is documented at all. While doing this review, I found quite a few bugs that were fixed either in earlier commits or this one (mostly documentation bugs though, i.e. some arguments were listed at the wrong place). --- core/bind/core_bind.cpp | 12 +- core/globals.cpp | 8 +- core/io/config_file.cpp | 2 +- core/io/xml_parser.cpp | 12 +- core/object.cpp | 4 +- core/os/input.cpp | 4 +- core/resource.cpp | 2 +- core/translation.cpp | 6 +- doc/base/classes.xml | 280 ++++++++++++++++++------------------ modules/gridmap/grid_map.cpp | 2 +- scene/2d/camera_2d.cpp | 2 +- scene/2d/canvas_item.cpp | 2 +- scene/2d/collision_polygon_2d.cpp | 4 +- scene/2d/node_2d.cpp | 4 +- scene/2d/parallax_background.cpp | 2 +- scene/3d/body_shape.cpp | 2 +- scene/3d/collision_polygon.cpp | 2 +- scene/3d/light.cpp | 4 +- scene/3d/particles.cpp | 4 +- scene/3d/spatial_stream_player.cpp | 2 +- scene/audio/event_player.cpp | 10 +- scene/audio/stream_player.cpp | 2 +- scene/gui/file_dialog.cpp | 2 +- scene/gui/option_button.cpp | 2 +- scene/gui/popup_menu.cpp | 2 +- scene/gui/rich_text_label.cpp | 4 +- scene/gui/text_edit.cpp | 6 +- scene/gui/tree.cpp | 10 +- scene/main/node.cpp | 2 +- scene/main/scene_main_loop.cpp | 2 +- scene/main/viewport.cpp | 2 +- scene/resources/font.cpp | 2 +- scene/resources/mesh.cpp | 2 +- scene/resources/multimesh.cpp | 12 +- scene/resources/style_box.cpp | 8 +- scene/resources/texture.cpp | 6 +- scene/resources/theme.cpp | 12 +- servers/audio_server.cpp | 2 +- servers/physics_2d_server.cpp | 14 +- servers/physics_server.cpp | 4 +- tools/editor/editor_file_dialog.cpp | 2 +- tools/pck/pck_packer.cpp | 2 +- 42 files changed, 234 insertions(+), 236 deletions(-) diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 438db5d518..f1edc3d7d7 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -62,8 +62,8 @@ void _ResourceLoader::_bind_methods() { ObjectTypeDB::bind_method(_MD("load:Resource","path","type_hint", "p_no_cache"),&_ResourceLoader::load,DEFVAL(""), DEFVAL(false)); ObjectTypeDB::bind_method(_MD("get_recognized_extensions_for_type","type"),&_ResourceLoader::get_recognized_extensions_for_type); ObjectTypeDB::bind_method(_MD("set_abort_on_missing_resources","abort"),&_ResourceLoader::set_abort_on_missing_resources); - ObjectTypeDB::bind_method(_MD("get_dependencies"),&_ResourceLoader::get_dependencies); - ObjectTypeDB::bind_method(_MD("has"),&_ResourceLoader::has); + ObjectTypeDB::bind_method(_MD("get_dependencies","path"),&_ResourceLoader::get_dependencies); + ObjectTypeDB::bind_method(_MD("has","path"),&_ResourceLoader::has); } _ResourceLoader::_ResourceLoader() { @@ -96,7 +96,7 @@ _ResourceSaver *_ResourceSaver::singleton=NULL; void _ResourceSaver::_bind_methods() { - ObjectTypeDB::bind_method(_MD("save","path","resource:Resource"),&_ResourceSaver::save, DEFVAL(0)); + ObjectTypeDB::bind_method(_MD("save","path","resource:Resource","flags"),&_ResourceSaver::save,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_recognized_extensions","type"),&_ResourceSaver::get_recognized_extensions); BIND_CONSTANT(FLAG_RELATIVE_PATHS); @@ -812,7 +812,7 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time); ObjectTypeDB::bind_method(_MD("get_system_time_msec"), &_OS::get_system_time_msec); - ObjectTypeDB::bind_method(_MD("set_icon"),&_OS::set_icon); + ObjectTypeDB::bind_method(_MD("set_icon","icon"),&_OS::set_icon); ObjectTypeDB::bind_method(_MD("delay_usec","usec"),&_OS::delay_usec); ObjectTypeDB::bind_method(_MD("delay_msec","msec"),&_OS::delay_msec); @@ -851,9 +851,9 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second); ObjectTypeDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size); - ObjectTypeDB::bind_method(_MD("print_resources_by_type"),&_OS::print_resources_by_type); + ObjectTypeDB::bind_method(_MD("print_resources_by_type","types"),&_OS::print_resources_by_type); - ObjectTypeDB::bind_method(_MD("native_video_play"),&_OS::native_video_play); + ObjectTypeDB::bind_method(_MD("native_video_play","path","volume","audio_track","subtitle_track"),&_OS::native_video_play); ObjectTypeDB::bind_method(_MD("native_video_is_playing"),&_OS::native_video_is_playing); ObjectTypeDB::bind_method(_MD("native_video_stop"),&_OS::native_video_stop); ObjectTypeDB::bind_method(_MD("native_video_pause"),&_OS::native_video_pause); diff --git a/core/globals.cpp b/core/globals.cpp index eed37c2308..38e88e43e2 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -1390,11 +1390,11 @@ void Globals::_bind_methods() { ObjectTypeDB::bind_method(_MD("localize_path","path"),&Globals::localize_path); ObjectTypeDB::bind_method(_MD("globalize_path","path"),&Globals::globalize_path); ObjectTypeDB::bind_method(_MD("save"),&Globals::save); - ObjectTypeDB::bind_method(_MD("has_singleton"),&Globals::has_singleton); - ObjectTypeDB::bind_method(_MD("get_singleton"),&Globals::get_singleton_object); - ObjectTypeDB::bind_method(_MD("load_resource_pack"),&Globals::_load_resource_pack); + ObjectTypeDB::bind_method(_MD("has_singleton","name"),&Globals::has_singleton); + ObjectTypeDB::bind_method(_MD("get_singleton","name"),&Globals::get_singleton_object); + ObjectTypeDB::bind_method(_MD("load_resource_pack","pack"),&Globals::_load_resource_pack); - ObjectTypeDB::bind_method(_MD("save_custom"),&Globals::_save_custom_bnd); + ObjectTypeDB::bind_method(_MD("save_custom","file"),&Globals::_save_custom_bnd); } diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 75388f514a..26dd862e00 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -736,7 +736,7 @@ void ConfigFile::_bind_methods(){ ObjectTypeDB::bind_method(_MD("has_section_key","section","key"),&ConfigFile::has_section_key); ObjectTypeDB::bind_method(_MD("get_sections"),&ConfigFile::_get_sections); - ObjectTypeDB::bind_method(_MD("get_section_keys"),&ConfigFile::_get_section_keys); + ObjectTypeDB::bind_method(_MD("get_section_keys","section"),&ConfigFile::_get_section_keys); ObjectTypeDB::bind_method(_MD("load:Error","path"),&ConfigFile::load); ObjectTypeDB::bind_method(_MD("save:Error","path"),&ConfigFile::save); diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 1ff458f325..4fb175e639 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -385,15 +385,15 @@ void XMLParser::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_node_data"),&XMLParser::get_node_data); ObjectTypeDB::bind_method(_MD("get_node_offset"),&XMLParser::get_node_offset); ObjectTypeDB::bind_method(_MD("get_attribute_count"),&XMLParser::get_attribute_count); - ObjectTypeDB::bind_method(_MD("get_attribute_name"),&XMLParser::get_attribute_name); - ObjectTypeDB::bind_method(_MD("get_attribute_value"),(String (XMLParser::*)(int) const) &XMLParser::get_attribute_value); - ObjectTypeDB::bind_method(_MD("has_attribute"),&XMLParser::has_attribute); - ObjectTypeDB::bind_method(_MD("get_named_attribute_value"), (String (XMLParser::*)(const String&) const) &XMLParser::get_attribute_value); - ObjectTypeDB::bind_method(_MD("get_named_attribute_value_safe"), &XMLParser::get_attribute_value_safe); + ObjectTypeDB::bind_method(_MD("get_attribute_name","idx"),&XMLParser::get_attribute_name); + ObjectTypeDB::bind_method(_MD("get_attribute_value","idx"),(String (XMLParser::*)(int) const) &XMLParser::get_attribute_value); + ObjectTypeDB::bind_method(_MD("has_attribute","name"),&XMLParser::has_attribute); + ObjectTypeDB::bind_method(_MD("get_named_attribute_value","name"), (String (XMLParser::*)(const String&) const) &XMLParser::get_attribute_value); + ObjectTypeDB::bind_method(_MD("get_named_attribute_value_safe","name"), &XMLParser::get_attribute_value_safe); ObjectTypeDB::bind_method(_MD("is_empty"),&XMLParser::is_empty); ObjectTypeDB::bind_method(_MD("get_current_line"),&XMLParser::get_current_line); ObjectTypeDB::bind_method(_MD("skip_section"),&XMLParser::skip_section); - ObjectTypeDB::bind_method(_MD("seek"),&XMLParser::seek); + ObjectTypeDB::bind_method(_MD("seek","pos"),&XMLParser::seek); ObjectTypeDB::bind_method(_MD("open","file"),&XMLParser::open); ObjectTypeDB::bind_method(_MD("open_buffer","buffer"),&XMLParser::open_buffer); diff --git a/core/object.cpp b/core/object.cpp index 9fdd11eb2e..773581d41d 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1550,7 +1550,7 @@ void Object::_bind_methods() { ObjectTypeDB::bind_method(_MD("get","property"),&Object::_get_bind); ObjectTypeDB::bind_method(_MD("get_property_list"),&Object::_get_property_list_bind); ObjectTypeDB::bind_method(_MD("get_method_list"),&Object::_get_method_list_bind); - ObjectTypeDB::bind_method(_MD("notification","what"),&Object::notification,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("notification","what","reversed"),&Object::notification,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("get_instance_ID"),&Object::get_instance_ID); ObjectTypeDB::bind_method(_MD("set_script","script:Script"),&Object::set_script); @@ -1615,7 +1615,7 @@ void Object::_bind_methods() { ObjectTypeDB::bind_method(_MD("callv:Variant","method","arg_array"),&Object::callv); - ObjectTypeDB::bind_method(_MD("has_method"),&Object::has_method); + ObjectTypeDB::bind_method(_MD("has_method","method"),&Object::has_method); ObjectTypeDB::bind_method(_MD("get_signal_list"),&Object::_get_signal_list); diff --git a/core/os/input.cpp b/core/os/input.cpp index 15872d02fd..53358fd4f5 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -62,8 +62,8 @@ void Input::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode); ObjectTypeDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode); ObjectTypeDB::bind_method(_MD("warp_mouse_pos","to"),&Input::warp_mouse_pos); - ObjectTypeDB::bind_method(_MD("action_press"),&Input::action_press); - ObjectTypeDB::bind_method(_MD("action_release"),&Input::action_release); + ObjectTypeDB::bind_method(_MD("action_press","action"),&Input::action_press); + ObjectTypeDB::bind_method(_MD("action_release","action"),&Input::action_release); ObjectTypeDB::bind_method(_MD("set_custom_mouse_cursor","image:Texture","hotspot"),&Input::set_custom_mouse_cursor,DEFVAL(Vector2())); BIND_CONSTANT( MOUSE_MODE_VISIBLE ); diff --git a/core/resource.cpp b/core/resource.cpp index 6967599f96..13e0f73b80 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -278,7 +278,7 @@ void Resource::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_import_metadata","metadata"),&Resource::set_import_metadata); ObjectTypeDB::bind_method(_MD("get_import_metadata"),&Resource::get_import_metadata); - ObjectTypeDB::bind_method(_MD("duplicate"),&Resource::duplicate,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("duplicate","subresources"),&Resource::duplicate,DEFVAL(false)); ADD_SIGNAL( MethodInfo("changed") ); ADD_PROPERTY( PropertyInfo(Variant::STRING,"resource/path",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR ), _SCS("set_path"),_SCS("get_path")); ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"resource/name"), _SCS("set_name"),_SCS("get_name")); diff --git a/core/translation.cpp b/core/translation.cpp index 8247cd1201..bab6cde966 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -670,10 +670,10 @@ void TranslationServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_locale","locale"),&TranslationServer::set_locale); ObjectTypeDB::bind_method(_MD("get_locale"),&TranslationServer::get_locale); - ObjectTypeDB::bind_method(_MD("translate"),&TranslationServer::translate); + ObjectTypeDB::bind_method(_MD("translate","message"),&TranslationServer::translate); - ObjectTypeDB::bind_method(_MD("add_translation"),&TranslationServer::add_translation); - ObjectTypeDB::bind_method(_MD("remove_translation"),&TranslationServer::remove_translation); + ObjectTypeDB::bind_method(_MD("add_translation","translation:Translation"),&TranslationServer::add_translation); + ObjectTypeDB::bind_method(_MD("remove_translation","translation:Translation"),&TranslationServer::remove_translation); ObjectTypeDB::bind_method(_MD("clear"),&TranslationServer::clear); diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 2cc91ac070..a885b99989 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -4147,7 +4147,7 @@ - + Set the sample data for a given sample as an array of bytes. The length must be equal to the sample lenght expected in bytes or an error will be produced. @@ -5960,7 +5960,7 @@ - + @@ -6218,7 +6218,7 @@ - + Draw a texture at a given position. @@ -7209,7 +7209,7 @@ - + @@ -7284,7 +7284,7 @@ - + Set whether the polygon is to be a [ConvexPolygon2D] ([code]build_mode[/code]=0), or a [ConcavePolygon2D] ([code]build_mode[/code]=1). @@ -7298,7 +7298,7 @@ - + Set whether this polygon is a trigger. A trigger polygon detects collisions, but is otherwise unaffected by physics (i.e. colliding objects will not get blocked). @@ -7338,7 +7338,7 @@ - + @@ -7998,7 +7998,7 @@ - + @@ -9720,7 +9720,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -10313,6 +10313,12 @@ This approximation makes straight segments between each point, then subdivides t + + + + + + @@ -10333,24 +10339,18 @@ This approximation makes straight segments between each point, then subdivides t - + - + - - - - - - - + @@ -10737,7 +10737,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -11039,9 +11039,9 @@ This approximation makes straight segments between each point, then subdivides t - + - + Return a kerning pair as a difference. Kerning pairs are special cases where a typeface advance is determined by the next character. @@ -11829,7 +11829,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -11837,7 +11837,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -11845,7 +11845,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -11853,7 +11853,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -12369,7 +12369,7 @@ This approximation makes straight segments between each point, then subdivides t - + @@ -13690,13 +13690,13 @@ returns:= "username=user&password=pass" - + - + @@ -15781,7 +15781,7 @@ returns:= "username=user&password=pass" - + @@ -15797,7 +15797,7 @@ returns:= "username=user&password=pass" - + @@ -17090,9 +17090,9 @@ returns:= "username=user&password=pass" - + - + Create a new surface ([method get_surface_count] that will become surf_idx for this. @@ -17765,7 +17765,7 @@ returns:= "username=user&password=pass" - + Set the amount of instnces that is going to be drawn. Changing this number will erase all the existing instance transform and color data. @@ -17779,9 +17779,9 @@ returns:= "username=user&password=pass" - + - + Set the transform for a specific instance. @@ -17790,16 +17790,16 @@ returns:= "username=user&password=pass" - + Return the transform of a specific instance. - + - + Set the color of a specific instance. @@ -17808,14 +17808,14 @@ returns:= "username=user&password=pass" - + Get the color of a specific instance. - + Set the visibility AABB. If not provided, MultiMesh will not be visible. @@ -18662,7 +18662,7 @@ returns:= "username=user&password=pass" - + Add a node to a group. Groups are helpers to name and organize group of nodes, like for example: "Enemies", "Collectables", etc. A [Node] can be in any number of groups. Nodes can be assigned a group at any time, but will not be added to it until they are inside the scene tree (see [method is_inside_scene]). @@ -19113,7 +19113,7 @@ returns:= "username=user&password=pass" - + @@ -19121,7 +19121,7 @@ returns:= "username=user&password=pass" - + @@ -19590,7 +19590,7 @@ returns:= "username=user&password=pass" - + @@ -19755,7 +19755,7 @@ returns:= "username=user&password=pass" - + @@ -19763,13 +19763,13 @@ returns:= "username=user&password=pass" - + - + - + - + @@ -19996,7 +19996,7 @@ returns:= "username=user&password=pass" - + Notify the object of something. @@ -20146,7 +20146,7 @@ returns:= "username=user&password=pass" - + @@ -20474,7 +20474,7 @@ returns:= "username=user&password=pass" - + Select an item by index and make it the current item. @@ -20573,7 +20573,7 @@ returns:= "username=user&password=pass" - + @@ -20910,7 +20910,7 @@ returns:= "username=user&password=pass" - + @@ -21173,7 +21173,7 @@ returns:= "username=user&password=pass" - + Return the randomness for a specific variable of the particle system. Randomness produces small changes from the default each time a particle is emitted. @@ -21230,7 +21230,7 @@ returns:= "username=user&password=pass" - + @@ -22742,11 +22742,11 @@ This method controls whether the position between two cached points is interpola - + - + - + @@ -23056,9 +23056,9 @@ This method controls whether the position between two cached points is interpola - + - + @@ -23066,15 +23066,15 @@ This method controls whether the position between two cached points is interpola - + - + - + @@ -23082,7 +23082,7 @@ This method controls whether the position between two cached points is interpola - + @@ -23110,7 +23110,7 @@ This method controls whether the position between two cached points is interpola - + @@ -23234,7 +23234,7 @@ This method controls whether the position between two cached points is interpola - + @@ -24259,11 +24259,11 @@ This method controls whether the position between two cached points is interpola - + - + - + @@ -24867,7 +24867,7 @@ This method controls whether the position between two cached points is interpola - + @@ -25858,7 +25858,7 @@ This method controls whether the position between two cached points is interpola - + Set the checkstate status of the item at index "idx". @@ -26546,12 +26546,6 @@ This method controls whether the position between two cached points is interpola Return value mapped to 0 to 1 (unit) range. - - - - - - @@ -26599,11 +26593,17 @@ This method controls whether the position between two cached points is interpola - + + + + + + + @@ -27403,7 +27403,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27592,7 +27592,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27600,7 +27600,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27686,7 +27686,7 @@ This method controls whether the position between two cached points is interpola - + Save a resource to disk, to a given path. @@ -27792,7 +27792,7 @@ This method controls whether the position between two cached points is interpola - + @@ -27852,7 +27852,7 @@ This method controls whether the position between two cached points is interpola - + @@ -29578,7 +29578,7 @@ This method controls whether the position between two cached points is interpola - + @@ -30183,13 +30183,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -30203,13 +30203,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -30223,13 +30223,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -30243,13 +30243,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -30263,13 +30263,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -30283,13 +30283,13 @@ This method controls whether the position between two cached points is interpola - + + + - - @@ -31927,7 +31927,7 @@ This method controls whether the position between two cached points is interpola - + @@ -33159,7 +33159,7 @@ This method controls whether the position between two cached points is interpola - + @@ -33838,9 +33838,9 @@ This method controls whether the position between two cached points is interpola - + - + @@ -33993,7 +33993,7 @@ This method controls whether the position between two cached points is interpola - + Return the expand margin size (from enum MARGIN_*). Parts of the image below the size of the margin (and in the direction of the margin) will not expand. @@ -34034,7 +34034,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34050,7 +34050,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34592,7 +34592,7 @@ This method controls whether the position between two cached points is interpola - + Return the text of a specific line. @@ -34601,7 +34601,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34609,7 +34609,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34951,7 +34951,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34965,7 +34965,7 @@ This method controls whether the position between two cached points is interpola - + @@ -34979,7 +34979,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35324,7 +35324,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35370,7 +35370,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35416,7 +35416,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35462,7 +35462,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35508,7 +35508,7 @@ This method controls whether the position between two cached points is interpola - + @@ -35528,7 +35528,7 @@ This method controls whether the position between two cached points is interpola - + @@ -36700,19 +36700,19 @@ This method controls whether the position between two cached points is interpola - + - + - + @@ -36750,17 +36750,17 @@ This method controls whether the position between two cached points is interpola - + - + - + - + @@ -36768,13 +36768,13 @@ This method controls whether the position between two cached points is interpola - + - + @@ -37334,7 +37334,7 @@ This method controls whether the position between two cached points is interpola - + @@ -39232,7 +39232,7 @@ This method controls whether the position between two cached points is interpola - + @@ -41370,7 +41370,7 @@ This method controls whether the position between two cached points is interpola - + @@ -41378,7 +41378,7 @@ This method controls whether the position between two cached points is interpola - + @@ -41386,7 +41386,7 @@ This method controls whether the position between two cached points is interpola - + @@ -41394,7 +41394,7 @@ This method controls whether the position between two cached points is interpola - + @@ -41402,7 +41402,7 @@ This method controls whether the position between two cached points is interpola - + @@ -41426,7 +41426,7 @@ This method controls whether the position between two cached points is interpola - + diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index ad7c392cd0..423c272ee7 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -1096,7 +1096,7 @@ void GridMap::_bind_methods() { // ObjectTypeDB::bind_method(_MD("_recreate_octants"),&GridMap::_recreate_octants); ObjectTypeDB::bind_method(_MD("_update_dirty_map_callback"),&GridMap::_update_dirty_map_callback); - ObjectTypeDB::bind_method(_MD("resource_changed"),&GridMap::resource_changed); + ObjectTypeDB::bind_method(_MD("resource_changed","resource"),&GridMap::resource_changed); ObjectTypeDB::bind_method(_MD("set_center_x","enable"),&GridMap::set_center_x); ObjectTypeDB::bind_method(_MD("get_center_x"),&GridMap::get_center_x); diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index b7b99f935a..d1cc8bbcc4 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -503,7 +503,7 @@ void Camera2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_camera_pos"),&Camera2D::get_camera_pos); ObjectTypeDB::bind_method(_MD("get_camera_screen_center"),&Camera2D::get_camera_screen_center); - ObjectTypeDB::bind_method(_MD("set_zoom"),&Camera2D::set_zoom); + ObjectTypeDB::bind_method(_MD("set_zoom","zoom"),&Camera2D::set_zoom); ObjectTypeDB::bind_method(_MD("get_zoom"),&Camera2D::get_zoom); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 275e4d0304..7df6864a65 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -1080,7 +1080,7 @@ void CanvasItem::_bind_methods() { ObjectTypeDB::bind_method(_MD("draw_line","from","to","color","width"),&CanvasItem::draw_line,DEFVAL(1.0)); ObjectTypeDB::bind_method(_MD("draw_rect","rect","color"),&CanvasItem::draw_rect); ObjectTypeDB::bind_method(_MD("draw_circle","pos","radius","color"),&CanvasItem::draw_circle); - ObjectTypeDB::bind_method(_MD("draw_texture","texture:Texture","pos"),&CanvasItem::draw_texture); + ObjectTypeDB::bind_method(_MD("draw_texture","texture:Texture","pos","modulate"),&CanvasItem::draw_texture,DEFVAL(Color(1,1,1,1))); ObjectTypeDB::bind_method(_MD("draw_texture_rect","texture:Texture","rect","tile","modulate","transpose"),&CanvasItem::draw_texture_rect,DEFVAL(Color(1,1,1)),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("draw_texture_rect_region","texture:Texture","rect","src_rect","modulate","transpose"),&CanvasItem::draw_texture_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("draw_style_box","style_box:StyleBox","rect"),&CanvasItem::draw_style_box); diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 616d3da7c9..354d54b69f 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -257,10 +257,10 @@ void CollisionPolygon2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_polygon","polygon"),&CollisionPolygon2D::set_polygon); ObjectTypeDB::bind_method(_MD("get_polygon"),&CollisionPolygon2D::get_polygon); - ObjectTypeDB::bind_method(_MD("set_build_mode"),&CollisionPolygon2D::set_build_mode); + ObjectTypeDB::bind_method(_MD("set_build_mode","build_mode"),&CollisionPolygon2D::set_build_mode); ObjectTypeDB::bind_method(_MD("get_build_mode"),&CollisionPolygon2D::get_build_mode); - ObjectTypeDB::bind_method(_MD("set_trigger"),&CollisionPolygon2D::set_trigger); + ObjectTypeDB::bind_method(_MD("set_trigger","trigger"),&CollisionPolygon2D::set_trigger); ObjectTypeDB::bind_method(_MD("is_trigger"),&CollisionPolygon2D::is_trigger); ObjectTypeDB::bind_method(_MD("_set_shape_range","shape_range"),&CollisionPolygon2D::_set_shape_range); diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 52b112f090..975827bc7e 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -394,9 +394,9 @@ void Node2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_z_as_relative","enable"),&Node2D::set_z_as_relative); ObjectTypeDB::bind_method(_MD("is_z_relative"),&Node2D::is_z_relative); - ObjectTypeDB::bind_method(_MD("edit_set_pivot"),&Node2D::edit_set_pivot); + ObjectTypeDB::bind_method(_MD("edit_set_pivot","pivot"),&Node2D::edit_set_pivot); - ObjectTypeDB::bind_method(_MD("get_relative_transform"),&Node2D::get_relative_transform); + ObjectTypeDB::bind_method(_MD("get_relative_transform","parent"),&Node2D::get_relative_transform); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"transform/pos"),_SCS("set_pos"),_SCS("get_pos")); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"transform/rot",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_rotd"),_SCS("_get_rotd")); diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp index 8bb4eb55ba..fc38a55cdf 100644 --- a/scene/2d/parallax_background.cpp +++ b/scene/2d/parallax_background.cpp @@ -193,7 +193,7 @@ void ParallaxBackground::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_limit_begin"),&ParallaxBackground::get_limit_begin); ObjectTypeDB::bind_method(_MD("set_limit_end","ofs"),&ParallaxBackground::set_limit_end); ObjectTypeDB::bind_method(_MD("get_limit_end"),&ParallaxBackground::get_limit_end); - ObjectTypeDB::bind_method(_MD("set_ignore_camera_zoom"), &ParallaxBackground::set_ignore_camera_zoom); + ObjectTypeDB::bind_method(_MD("set_ignore_camera_zoom","ignore"), &ParallaxBackground::set_ignore_camera_zoom); ObjectTypeDB::bind_method(_MD("is_ignore_camera_zoom"), &ParallaxBackground::is_ignore_camera_zoom); diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp index b54cbfe0f9..49f95550c9 100644 --- a/scene/3d/body_shape.cpp +++ b/scene/3d/body_shape.cpp @@ -402,7 +402,7 @@ int CollisionShape::_get_update_shape_index() const{ void CollisionShape::_bind_methods() { //not sure if this should do anything - ObjectTypeDB::bind_method(_MD("resource_changed"),&CollisionShape::resource_changed); + ObjectTypeDB::bind_method(_MD("resource_changed","resource"),&CollisionShape::resource_changed); ObjectTypeDB::bind_method(_MD("set_shape","shape"),&CollisionShape::set_shape); ObjectTypeDB::bind_method(_MD("get_shape"),&CollisionShape::get_shape); ObjectTypeDB::bind_method(_MD("_add_to_collision_object"),&CollisionShape::_add_to_collision_object); diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index bb0a1fca12..3b14e1d767 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -236,7 +236,7 @@ void CollisionPolygon::_bind_methods() { ObjectTypeDB::bind_method(_MD("_add_to_collision_object"),&CollisionPolygon::_add_to_collision_object); - ObjectTypeDB::bind_method(_MD("set_build_mode"),&CollisionPolygon::set_build_mode); + ObjectTypeDB::bind_method(_MD("set_build_mode","build_mode"),&CollisionPolygon::set_build_mode); ObjectTypeDB::bind_method(_MD("get_build_mode"),&CollisionPolygon::get_build_mode); ObjectTypeDB::bind_method(_MD("set_depth","depth"),&CollisionPolygon::set_depth); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 9f9c87b675..38fff2089c 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -487,9 +487,9 @@ bool Light::is_editor_only() const{ void Light::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_parameter","variable","value"), &Light::set_parameter ); - ObjectTypeDB::bind_method(_MD("get_parameter"), &Light::get_parameter ); + ObjectTypeDB::bind_method(_MD("get_parameter","variable"), &Light::get_parameter ); ObjectTypeDB::bind_method(_MD("set_color","color","value"), &Light::set_color ); - ObjectTypeDB::bind_method(_MD("get_color"), &Light::get_color ); + ObjectTypeDB::bind_method(_MD("get_color","color"), &Light::get_color ); ObjectTypeDB::bind_method(_MD("set_project_shadows","enable"), &Light::set_project_shadows ); ObjectTypeDB::bind_method(_MD("has_project_shadows"), &Light::has_project_shadows ); ObjectTypeDB::bind_method(_MD("set_projector","projector:Texture"), &Light::set_projector ); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 6868646c48..e06f0288d3 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -422,14 +422,14 @@ void Particles::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_variable","variable","value"),&Particles::set_variable); ObjectTypeDB::bind_method(_MD("get_variable","variable"),&Particles::get_variable); ObjectTypeDB::bind_method(_MD("set_randomness","variable","randomness"),&Particles::set_randomness); - ObjectTypeDB::bind_method(_MD("get_randomness"),&Particles::get_randomness); + ObjectTypeDB::bind_method(_MD("get_randomness","variable"),&Particles::get_randomness); ObjectTypeDB::bind_method(_MD("set_color_phase_pos","phase","pos"),&Particles::set_color_phase_pos); ObjectTypeDB::bind_method(_MD("get_color_phase_pos","phase"),&Particles::get_color_phase_pos); ObjectTypeDB::bind_method(_MD("set_color_phase_color","phase","color"),&Particles::set_color_phase_color); ObjectTypeDB::bind_method(_MD("get_color_phase_color","phase"),&Particles::get_color_phase_color); ObjectTypeDB::bind_method(_MD("set_material","material:Material"),&Particles::set_material); ObjectTypeDB::bind_method(_MD("get_material:Material"),&Particles::get_material); - ObjectTypeDB::bind_method(_MD("set_emit_timeout"),&Particles::set_emit_timeout); + ObjectTypeDB::bind_method(_MD("set_emit_timeout","timeout"),&Particles::set_emit_timeout); ObjectTypeDB::bind_method(_MD("get_emit_timeout"),&Particles::get_emit_timeout); ObjectTypeDB::bind_method(_MD("set_height_from_velocity","enable"),&Particles::set_height_from_velocity); ObjectTypeDB::bind_method(_MD("has_height_from_velocity"),&Particles::has_height_from_velocity); diff --git a/scene/3d/spatial_stream_player.cpp b/scene/3d/spatial_stream_player.cpp index 7ed2335fcb..7f9b2a343e 100644 --- a/scene/3d/spatial_stream_player.cpp +++ b/scene/3d/spatial_stream_player.cpp @@ -332,7 +332,7 @@ void SpatialStreamPlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_stream","stream:Stream"),&SpatialStreamPlayer::set_stream); ObjectTypeDB::bind_method(_MD("get_stream:Stream"),&SpatialStreamPlayer::get_stream); - ObjectTypeDB::bind_method(_MD("play"),&SpatialStreamPlayer::play,DEFVAL(0)); + ObjectTypeDB::bind_method(_MD("play","offset"),&SpatialStreamPlayer::play,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("stop"),&SpatialStreamPlayer::stop); ObjectTypeDB::bind_method(_MD("is_playing"),&SpatialStreamPlayer::is_playing); diff --git a/scene/audio/event_player.cpp b/scene/audio/event_player.cpp index 1bd692431d..11f2c7d5cd 100644 --- a/scene/audio/event_player.cpp +++ b/scene/audio/event_player.cpp @@ -312,16 +312,14 @@ void EventPlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_pos"),&EventPlayer::get_pos); ObjectTypeDB::bind_method(_MD("seek_pos","time"),&EventPlayer::seek_pos); + ObjectTypeDB::bind_method(_MD("get_length"),&EventPlayer::get_length); + ObjectTypeDB::bind_method(_MD("set_autoplay","enabled"),&EventPlayer::set_autoplay); ObjectTypeDB::bind_method(_MD("has_autoplay"),&EventPlayer::has_autoplay); ObjectTypeDB::bind_method(_MD("set_channel_volume","idx","channel_volume"),&EventPlayer::set_channel_volume); - ObjectTypeDB::bind_method(_MD("get_channel_volume""idx"),&EventPlayer::get_channel_volume); - - ObjectTypeDB::bind_method(_MD("get_length"),&EventPlayer::get_length); - - - ObjectTypeDB::bind_method(_MD("get_channel_last_note_time"),&EventPlayer::get_channel_last_note_time); + ObjectTypeDB::bind_method(_MD("get_channel_volume","idx"),&EventPlayer::get_channel_volume); + ObjectTypeDB::bind_method(_MD("get_channel_last_note_time","idx"),&EventPlayer::get_channel_last_note_time); ObjectTypeDB::bind_method(_MD("_set_play","play"),&EventPlayer::_set_play); ObjectTypeDB::bind_method(_MD("_get_play"),&EventPlayer::_get_play); diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp index d08fdd0c76..c621d1cb47 100644 --- a/scene/audio/stream_player.cpp +++ b/scene/audio/stream_player.cpp @@ -333,7 +333,7 @@ void StreamPlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_stream","stream:Stream"),&StreamPlayer::set_stream); ObjectTypeDB::bind_method(_MD("get_stream:Stream"),&StreamPlayer::get_stream); - ObjectTypeDB::bind_method(_MD("play"),&StreamPlayer::play,DEFVAL(0)); + ObjectTypeDB::bind_method(_MD("play","offset"),&StreamPlayer::play,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("stop"),&StreamPlayer::stop); ObjectTypeDB::bind_method(_MD("is_playing"),&StreamPlayer::is_playing); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 9179d3a4e1..ad30295e60 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -650,7 +650,7 @@ void FileDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_vbox:VBoxContainer"),&FileDialog::get_vbox); ObjectTypeDB::bind_method(_MD("set_access","access"),&FileDialog::set_access); ObjectTypeDB::bind_method(_MD("get_access"),&FileDialog::get_access); - ObjectTypeDB::bind_method(_MD("set_show_hidden_files"),&FileDialog::set_show_hidden_files); + ObjectTypeDB::bind_method(_MD("set_show_hidden_files","show"),&FileDialog::set_show_hidden_files); ObjectTypeDB::bind_method(_MD("is_showing_hidden_files"),&FileDialog::is_showing_hidden_files); ObjectTypeDB::bind_method(_MD("_select_drive"),&FileDialog::_select_drive); ObjectTypeDB::bind_method(_MD("_make_dir"),&FileDialog::_make_dir); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 3cc5acc1a6..540df323b6 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -304,7 +304,7 @@ void OptionButton::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_item_count"),&OptionButton::get_item_count); ObjectTypeDB::bind_method(_MD("add_separator"),&OptionButton::add_separator); ObjectTypeDB::bind_method(_MD("clear"),&OptionButton::clear); - ObjectTypeDB::bind_method(_MD("select"),&OptionButton::select); + ObjectTypeDB::bind_method(_MD("select","idx"),&OptionButton::select); ObjectTypeDB::bind_method(_MD("get_selected"),&OptionButton::get_selected); ObjectTypeDB::bind_method(_MD("get_selected_ID"),&OptionButton::get_selected_ID); ObjectTypeDB::bind_method(_MD("get_selected_metadata"),&OptionButton::get_selected_metadata); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 9dc03272b2..c250ca34c1 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -898,7 +898,7 @@ void PopupMenu::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_item_icon","idx","icon"),&PopupMenu::set_item_icon); ObjectTypeDB::bind_method(_MD("set_item_accelerator","idx","accel"),&PopupMenu::set_item_accelerator); ObjectTypeDB::bind_method(_MD("set_item_metadata","idx","metadata"),&PopupMenu::set_item_metadata); - ObjectTypeDB::bind_method(_MD("set_item_checked","idx"),&PopupMenu::set_item_checked); + ObjectTypeDB::bind_method(_MD("set_item_checked","idx","checked"),&PopupMenu::set_item_checked); ObjectTypeDB::bind_method(_MD("set_item_disabled","idx","disabled"),&PopupMenu::set_item_disabled); ObjectTypeDB::bind_method(_MD("set_item_submenu","idx","submenu"),&PopupMenu::set_item_submenu); ObjectTypeDB::bind_method(_MD("set_item_as_separator","idx","enable"),&PopupMenu::set_item_as_separator); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 0db85981f7..d3ffb89272 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1939,7 +1939,7 @@ void RichTextLabel::_bind_methods() { ObjectTypeDB::bind_method(_MD("push_meta","data"),&RichTextLabel::push_meta); ObjectTypeDB::bind_method(_MD("push_underline"),&RichTextLabel::push_underline); ObjectTypeDB::bind_method(_MD("push_table","columns"),&RichTextLabel::push_table); - ObjectTypeDB::bind_method(_MD("set_table_column_expand","column","expand"),&RichTextLabel::set_table_column_expand); + ObjectTypeDB::bind_method(_MD("set_table_column_expand","column","expand","ratio"),&RichTextLabel::set_table_column_expand); ObjectTypeDB::bind_method(_MD("push_cell"),&RichTextLabel::push_cell); ObjectTypeDB::bind_method(_MD("pop"),&RichTextLabel::pop); @@ -1956,7 +1956,7 @@ void RichTextLabel::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_v_scroll"),&RichTextLabel::get_v_scroll); - ObjectTypeDB::bind_method(_MD("scroll_to_line"),&RichTextLabel::scroll_to_line); + ObjectTypeDB::bind_method(_MD("scroll_to_line","line"),&RichTextLabel::scroll_to_line); ObjectTypeDB::bind_method(_MD("set_tab_size","spaces"),&RichTextLabel::set_tab_size); ObjectTypeDB::bind_method(_MD("get_tab_size"),&RichTextLabel::get_tab_size); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 29969b65e6..f46336a224 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3742,10 +3742,10 @@ void TextEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_line_count"),&TextEdit::get_line_count); ObjectTypeDB::bind_method(_MD("get_text"),&TextEdit::get_text); - ObjectTypeDB::bind_method(_MD("get_line"),&TextEdit::get_line); + ObjectTypeDB::bind_method(_MD("get_line","line"),&TextEdit::get_line); - ObjectTypeDB::bind_method(_MD("cursor_set_column","column"),&TextEdit::cursor_set_column); - ObjectTypeDB::bind_method(_MD("cursor_set_line","line"),&TextEdit::cursor_set_line); + ObjectTypeDB::bind_method(_MD("cursor_set_column","column","adjust_viewport"),&TextEdit::cursor_set_column,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("cursor_set_line","line","adjust_viewport"),&TextEdit::cursor_set_line,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("cursor_get_column"),&TextEdit::cursor_get_column); ObjectTypeDB::bind_method(_MD("cursor_get_line"),&TextEdit::cursor_get_line); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 1b204cff65..585f3a8936 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -672,7 +672,7 @@ void TreeItem::_bind_methods() { ObjectTypeDB::bind_method(_MD("clear_custom_bg_color","column"),&TreeItem::clear_custom_bg_color); ObjectTypeDB::bind_method(_MD("get_custom_bg_color","column"),&TreeItem::get_custom_bg_color); - ObjectTypeDB::bind_method(_MD("add_button","column","button:Texture"),&TreeItem::add_button); + ObjectTypeDB::bind_method(_MD("add_button","column","button:Texture","button_idx"),&TreeItem::add_button); ObjectTypeDB::bind_method(_MD("get_button_count","column"),&TreeItem::get_button_count); ObjectTypeDB::bind_method(_MD("get_button:Texture","column","button_idx"),&TreeItem::get_button); ObjectTypeDB::bind_method(_MD("erase_button","column","button_idx"),&TreeItem::erase_button); @@ -3193,11 +3193,11 @@ void Tree::_bind_methods() { ObjectTypeDB::bind_method(_MD("create_item:TreeItem","parent:TreeItem"),&Tree::_create_item,DEFVAL((Object*)NULL)); ObjectTypeDB::bind_method(_MD("get_root:TreeItem"),&Tree::get_root); - ObjectTypeDB::bind_method(_MD("set_column_min_width"),&Tree::set_column_min_width); - ObjectTypeDB::bind_method(_MD("set_column_expand"),&Tree::set_column_expand); - ObjectTypeDB::bind_method(_MD("get_column_width"),&Tree::get_column_width); + ObjectTypeDB::bind_method(_MD("set_column_min_width","column","min_width"),&Tree::set_column_min_width); + ObjectTypeDB::bind_method(_MD("set_column_expand","column","expand"),&Tree::set_column_expand); + ObjectTypeDB::bind_method(_MD("get_column_width","column"),&Tree::get_column_width); - ObjectTypeDB::bind_method(_MD("set_hide_root"),&Tree::set_hide_root); + ObjectTypeDB::bind_method(_MD("set_hide_root","enable"),&Tree::set_hide_root); ObjectTypeDB::bind_method(_MD("get_next_selected:TreeItem","from:TreeItem"),&Tree::_get_next_selected); ObjectTypeDB::bind_method(_MD("get_selected:TreeItem"),&Tree::get_selected); ObjectTypeDB::bind_method(_MD("get_selected_column"),&Tree::get_selected_column); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index a832162994..027e9ace65 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2001,7 +2001,7 @@ void Node::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_greater_than","node:Node"),&Node::is_greater_than); ObjectTypeDB::bind_method(_MD("get_path"),&Node::get_path); ObjectTypeDB::bind_method(_MD("get_path_to","node:Node"),&Node::get_path_to); - ObjectTypeDB::bind_method(_MD("add_to_group","group"),&Node::add_to_group,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("add_to_group","group","persistent"),&Node::add_to_group,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("remove_from_group","group"),&Node::remove_from_group); ObjectTypeDB::bind_method(_MD("is_in_group","group"),&Node::is_in_group); ObjectTypeDB::bind_method(_MD("move_child","child_node:Node","to_pos"),&Node::move_child); diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index adf053f5c9..cdfaa4c716 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -1586,7 +1586,7 @@ void SceneTree::_bind_methods() { ObjectTypeDB::bind_method(_MD("notify_group","call_flags","group","notification"),&SceneTree::notify_group); ObjectTypeDB::bind_method(_MD("set_group","call_flags","group","property","value"),&SceneTree::set_group); - ObjectTypeDB::bind_method(_MD("get_nodes_in_group"),&SceneTree::_get_nodes_in_group); + ObjectTypeDB::bind_method(_MD("get_nodes_in_group","group"),&SceneTree::_get_nodes_in_group); ObjectTypeDB::bind_method(_MD("get_root:Viewport"),&SceneTree::get_root); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index d19b5767c2..26b5594599 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1456,7 +1456,7 @@ void Viewport::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_as_audio_listener_2d","enable"), &Viewport::set_as_audio_listener_2d); ObjectTypeDB::bind_method(_MD("is_audio_listener_2d","enable"), &Viewport::is_audio_listener_2d); - ObjectTypeDB::bind_method(_MD("set_render_target_to_screen_rect"), &Viewport::set_render_target_to_screen_rect); + ObjectTypeDB::bind_method(_MD("set_render_target_to_screen_rect","rect"), &Viewport::set_render_target_to_screen_rect); ObjectTypeDB::bind_method(_MD("get_mouse_pos"), &Viewport::get_mouse_pos); ObjectTypeDB::bind_method(_MD("warp_mouse","to_pos"), &Viewport::warp_mouse); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index aad5e7cfdd..3890f4bedb 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -517,7 +517,7 @@ void Font::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_descent"),&Font::get_descent); ObjectTypeDB::bind_method(_MD("add_kerning_pair","char_a","char_b","kerning"),&Font::add_kerning_pair); - ObjectTypeDB::bind_method(_MD("get_kerning_pair"),&Font::get_kerning_pair); + ObjectTypeDB::bind_method(_MD("get_kerning_pair","char_a","char_b"),&Font::get_kerning_pair); ObjectTypeDB::bind_method(_MD("add_texture","texture:Texture"),&Font::add_texture); ObjectTypeDB::bind_method(_MD("add_char","character","texture","rect","align","advance"),&Font::add_char,DEFVAL(Point2()),DEFVAL(-1)); diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 8cb0904415..88ed2f45c5 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -971,7 +971,7 @@ void Mesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_morph_target_mode","mode"),&Mesh::set_morph_target_mode); ObjectTypeDB::bind_method(_MD("get_morph_target_mode"),&Mesh::get_morph_target_mode); - ObjectTypeDB::bind_method(_MD("add_surface","primitive","arrays","morph_arrays"),&Mesh::add_surface,DEFVAL(Array())); + ObjectTypeDB::bind_method(_MD("add_surface","primitive","arrays","morph_arrays","alphasort"),&Mesh::add_surface,DEFVAL(Array()),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("get_surface_count"),&Mesh::get_surface_count); ObjectTypeDB::bind_method(_MD("surface_remove","surf_idx"),&Mesh::surface_remove); ObjectTypeDB::bind_method(_MD("surface_get_array_len","surf_idx"),&Mesh::surface_get_array_len); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 0755d101b2..ee68c3b7fc 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -224,13 +224,13 @@ void MultiMesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_mesh","mesh:Mesh"),&MultiMesh::set_mesh); ObjectTypeDB::bind_method(_MD("get_mesh:Mesh"),&MultiMesh::get_mesh); - ObjectTypeDB::bind_method(_MD("set_instance_count"),&MultiMesh::set_instance_count); + ObjectTypeDB::bind_method(_MD("set_instance_count","count"),&MultiMesh::set_instance_count); ObjectTypeDB::bind_method(_MD("get_instance_count"),&MultiMesh::get_instance_count); - ObjectTypeDB::bind_method(_MD("set_instance_transform"),&MultiMesh::set_instance_transform); - ObjectTypeDB::bind_method(_MD("get_instance_transform"),&MultiMesh::get_instance_transform); - ObjectTypeDB::bind_method(_MD("set_instance_color"),&MultiMesh::set_instance_color); - ObjectTypeDB::bind_method(_MD("get_instance_color"),&MultiMesh::get_instance_color); - ObjectTypeDB::bind_method(_MD("set_aabb"),&MultiMesh::set_aabb); + ObjectTypeDB::bind_method(_MD("set_instance_transform","instance","transform"),&MultiMesh::set_instance_transform); + ObjectTypeDB::bind_method(_MD("get_instance_transform","instance"),&MultiMesh::get_instance_transform); + ObjectTypeDB::bind_method(_MD("set_instance_color","instance","color"),&MultiMesh::set_instance_color); + ObjectTypeDB::bind_method(_MD("get_instance_color","instance"),&MultiMesh::get_instance_color); + ObjectTypeDB::bind_method(_MD("set_aabb","visibility_aabb"),&MultiMesh::set_aabb); ObjectTypeDB::bind_method(_MD("get_aabb"),&MultiMesh::get_aabb); ObjectTypeDB::bind_method(_MD("generate_aabb"),&MultiMesh::generate_aabb); diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 527fae5946..1f518c30e1 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -83,7 +83,7 @@ void StyleBox::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_center_size"),&StyleBox::get_center_size); ObjectTypeDB::bind_method(_MD("get_offset"),&StyleBox::get_offset); - ObjectTypeDB::bind_method(_MD("draw"),&StyleBox::draw); + ObjectTypeDB::bind_method(_MD("draw","canvas_item","rect"),&StyleBox::draw); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin/left", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_LEFT ); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "content_margin/right", PROPERTY_HINT_RANGE,"-1,2048,1" ), _SCS("set_default_margin"),_SCS("get_default_margin"), MARGIN_RIGHT ); @@ -182,10 +182,10 @@ void StyleBoxTexture::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_texture:Texture"),&StyleBoxTexture::get_texture); ObjectTypeDB::bind_method(_MD("set_margin_size","margin","size"),&StyleBoxTexture::set_margin_size); - ObjectTypeDB::bind_method(_MD("get_margin_size"),&StyleBoxTexture::get_margin_size); + ObjectTypeDB::bind_method(_MD("get_margin_size","margin"),&StyleBoxTexture::get_margin_size); ObjectTypeDB::bind_method(_MD("set_expand_margin_size","margin","size"),&StyleBoxTexture::set_expand_margin_size); - ObjectTypeDB::bind_method(_MD("get_expand_margin_size"),&StyleBoxTexture::get_expand_margin_size); + ObjectTypeDB::bind_method(_MD("get_expand_margin_size","margin"),&StyleBoxTexture::get_expand_margin_size); ObjectTypeDB::bind_method(_MD("set_draw_center","enable"),&StyleBoxTexture::set_draw_center); ObjectTypeDB::bind_method(_MD("get_draw_center"),&StyleBoxTexture::get_draw_center); @@ -392,7 +392,7 @@ void StyleBoxImageMask::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_expand","expand"),&StyleBoxImageMask::set_expand); ObjectTypeDB::bind_method(_MD("get_expand"),&StyleBoxImageMask::get_expand); ObjectTypeDB::bind_method(_MD("set_expand_margin_size","margin","size"),&StyleBoxImageMask::set_expand_margin_size); - ObjectTypeDB::bind_method(_MD("get_expand_margin_size"),&StyleBoxImageMask::get_expand_margin_size); + ObjectTypeDB::bind_method(_MD("get_expand_margin_size","margin"),&StyleBoxImageMask::get_expand_margin_size); ADD_PROPERTY( PropertyInfo(Variant::IMAGE, "image"), _SCS("set_image"), _SCS("get_image")); ADD_PROPERTY( PropertyInfo(Variant::BOOL, "expand"), _SCS("set_expand"), _SCS("get_expand")); diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 5df3d64d1a..edfa12da1f 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -70,9 +70,9 @@ void Texture::_bind_methods() { ObjectTypeDB::bind_method(_MD("has_alpha"),&Texture::has_alpha); ObjectTypeDB::bind_method(_MD("set_flags","flags"),&Texture::set_flags); ObjectTypeDB::bind_method(_MD("get_flags"),&Texture::get_flags); - ObjectTypeDB::bind_method(_MD("draw","canvas_item","pos","modulate"),&Texture::draw,DEFVAL(Color(1,1,1)),DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("draw_rect","canvas_item","rect","tile","modulate"),&Texture::draw_rect,DEFVAL(Color(1,1,1)),DEFVAL(false)); - ObjectTypeDB::bind_method(_MD("draw_rect_region","canvas_item","rect","src_rect","modulate"),&Texture::draw_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("draw","canvas_item","pos","modulate","transpose"),&Texture::draw,DEFVAL(Color(1,1,1)),DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("draw_rect","canvas_item","rect","tile","modulate","transpose"),&Texture::draw_rect,DEFVAL(Color(1,1,1)),DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("draw_rect_region","canvas_item","rect","src_rect","modulate","transpose"),&Texture::draw_rect_region,DEFVAL(Color(1,1,1)),DEFVAL(false)); BIND_CONSTANT( FLAG_MIPMAPS ); BIND_CONSTANT( FLAG_REPEAT ); diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 651e234b49..006aeeeaac 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -552,36 +552,36 @@ void Theme::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_icon:Texture","name","type"),&Theme::get_icon); ObjectTypeDB::bind_method(_MD("has_icon","name","type"),&Theme::has_icon); ObjectTypeDB::bind_method(_MD("clear_icon","name","type"),&Theme::clear_icon); - ObjectTypeDB::bind_method(_MD("get_icon_list"),&Theme::_get_icon_list); + ObjectTypeDB::bind_method(_MD("get_icon_list","type"),&Theme::_get_icon_list); ObjectTypeDB::bind_method(_MD("set_stylebox","name","type","texture:StyleBox"),&Theme::set_stylebox); ObjectTypeDB::bind_method(_MD("get_stylebox:StyleBox","name","type"),&Theme::get_stylebox); ObjectTypeDB::bind_method(_MD("has_stylebox","name","type"),&Theme::has_stylebox); ObjectTypeDB::bind_method(_MD("clear_stylebox","name","type"),&Theme::clear_stylebox); - ObjectTypeDB::bind_method(_MD("get_stylebox_list"),&Theme::_get_stylebox_list); + ObjectTypeDB::bind_method(_MD("get_stylebox_list","type"),&Theme::_get_stylebox_list); ObjectTypeDB::bind_method(_MD("set_font","name","type","font:Font"),&Theme::set_font); ObjectTypeDB::bind_method(_MD("get_font:Font","name","type"),&Theme::get_font); ObjectTypeDB::bind_method(_MD("has_font","name","type"),&Theme::has_font); ObjectTypeDB::bind_method(_MD("clear_font","name","type"),&Theme::clear_font); - ObjectTypeDB::bind_method(_MD("get_font_list"),&Theme::_get_font_list); + ObjectTypeDB::bind_method(_MD("get_font_list","type"),&Theme::_get_font_list); ObjectTypeDB::bind_method(_MD("set_color","name","type","color"),&Theme::set_color); ObjectTypeDB::bind_method(_MD("get_color","name","type"),&Theme::get_color); ObjectTypeDB::bind_method(_MD("has_color","name","type"),&Theme::has_color); ObjectTypeDB::bind_method(_MD("clear_color","name","type"),&Theme::clear_color); - ObjectTypeDB::bind_method(_MD("get_color_list"),&Theme::_get_color_list); + ObjectTypeDB::bind_method(_MD("get_color_list","type"),&Theme::_get_color_list); ObjectTypeDB::bind_method(_MD("set_constant","name","type","constant"),&Theme::set_constant); ObjectTypeDB::bind_method(_MD("get_constant","name","type"),&Theme::get_constant); ObjectTypeDB::bind_method(_MD("has_constant","name","type"),&Theme::has_constant); ObjectTypeDB::bind_method(_MD("clear_constant","name","type"),&Theme::clear_constant); - ObjectTypeDB::bind_method(_MD("get_constant_list"),&Theme::_get_constant_list); + ObjectTypeDB::bind_method(_MD("get_constant_list","type"),&Theme::_get_constant_list); ObjectTypeDB::bind_method(_MD("set_default_font","font"),&Theme::set_default_theme_font); ObjectTypeDB::bind_method(_MD("get_default_font"),&Theme::get_default_theme_font); - ObjectTypeDB::bind_method(_MD("get_type_list"),&Theme::_get_type_list); + ObjectTypeDB::bind_method(_MD("get_type_list","type"),&Theme::_get_type_list); ObjectTypeDB::bind_method("copy_default_theme",&Theme::copy_default_theme); diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 6c5a2de97b..8dbfea3fd6 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -88,7 +88,7 @@ void AudioServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("sample_get_length","sample"), &AudioServer::sample_get_length ); ObjectTypeDB::bind_method(_MD("sample_set_signed_data","sample","data"), &AudioServer::sample_set_signed_data ); - ObjectTypeDB::bind_method(_MD("sample_set_data","sample"), &AudioServer::sample_set_data ); + ObjectTypeDB::bind_method(_MD("sample_set_data","sample","data"), &AudioServer::sample_set_data ); ObjectTypeDB::bind_method(_MD("sample_get_data","sample"), &AudioServer::sample_get_data ); ObjectTypeDB::bind_method(_MD("sample_set_mix_rate","sample","mix_rate"), &AudioServer::sample_set_mix_rate ); diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index c18b32468a..789ec9950b 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -548,7 +548,7 @@ void Physics2DServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("area_attach_object_instance_ID","area","id"),&Physics2DServer::area_attach_object_instance_ID); ObjectTypeDB::bind_method(_MD("area_get_object_instance_ID","area"),&Physics2DServer::area_get_object_instance_ID); - ObjectTypeDB::bind_method(_MD("area_set_monitor_callback","receiver","method"),&Physics2DServer::area_set_monitor_callback); + ObjectTypeDB::bind_method(_MD("area_set_monitor_callback","area","receiver","method"),&Physics2DServer::area_set_monitor_callback); ObjectTypeDB::bind_method(_MD("body_create","mode","init_sleeping"),&Physics2DServer::body_create,DEFVAL(BODY_MODE_RIGID),DEFVAL(false)); @@ -606,17 +606,17 @@ void Physics2DServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("body_set_max_contacts_reported","body","amount"),&Physics2DServer::body_set_max_contacts_reported); ObjectTypeDB::bind_method(_MD("body_get_max_contacts_reported","body"),&Physics2DServer::body_get_max_contacts_reported); - ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_direction","normal"),&Physics2DServer::body_set_one_way_collision_direction); - ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_direction"),&Physics2DServer::body_get_one_way_collision_direction); + ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_direction","body","normal"),&Physics2DServer::body_set_one_way_collision_direction); + ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_direction","body"),&Physics2DServer::body_get_one_way_collision_direction); - ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_max_depth","normal"),&Physics2DServer::body_set_one_way_collision_max_depth); - ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_max_depth"),&Physics2DServer::body_get_one_way_collision_max_depth); + ObjectTypeDB::bind_method(_MD("body_set_one_way_collision_max_depth","body","depth"),&Physics2DServer::body_set_one_way_collision_max_depth); + ObjectTypeDB::bind_method(_MD("body_get_one_way_collision_max_depth","body"),&Physics2DServer::body_get_one_way_collision_max_depth); ObjectTypeDB::bind_method(_MD("body_set_omit_force_integration","body","enable"),&Physics2DServer::body_set_omit_force_integration); ObjectTypeDB::bind_method(_MD("body_is_omitting_force_integration","body"),&Physics2DServer::body_is_omitting_force_integration); - ObjectTypeDB::bind_method(_MD("body_set_force_integration_callback","body","receiver","method"),&Physics2DServer::body_set_force_integration_callback); + ObjectTypeDB::bind_method(_MD("body_set_force_integration_callback","body","receiver","method","userdata"),&Physics2DServer::body_set_force_integration_callback,DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("body_test_motion","body","motion","margin","result:Physics2DTestMotionResult"),&Physics2DServer::_body_test_motion,DEFVAL(0.08),DEFVAL(Variant())); @@ -638,7 +638,7 @@ void Physics2DServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_active","active"),&Physics2DServer::set_active); - ObjectTypeDB::bind_method(_MD("get_process_info"),&Physics2DServer::get_process_info); + ObjectTypeDB::bind_method(_MD("get_process_info","process_info"),&Physics2DServer::get_process_info); // ObjectTypeDB::bind_method(_MD("init"),&Physics2DServer::init); // ObjectTypeDB::bind_method(_MD("step"),&Physics2DServer::step); diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index bc2b37d92c..ea5f5fbbbf 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -467,7 +467,7 @@ void PhysicsServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("area_attach_object_instance_ID","area","id"),&PhysicsServer::area_attach_object_instance_ID); ObjectTypeDB::bind_method(_MD("area_get_object_instance_ID","area"),&PhysicsServer::area_get_object_instance_ID); - ObjectTypeDB::bind_method(_MD("area_set_monitor_callback","receiver","method"),&PhysicsServer::area_set_monitor_callback); + ObjectTypeDB::bind_method(_MD("area_set_monitor_callback","area","receiver","method"),&PhysicsServer::area_set_monitor_callback); ObjectTypeDB::bind_method(_MD("area_set_ray_pickable","area","enable"),&PhysicsServer::area_set_ray_pickable); ObjectTypeDB::bind_method(_MD("area_is_ray_pickable","area"),&PhysicsServer::area_is_ray_pickable); @@ -671,7 +671,7 @@ void PhysicsServer::_bind_methods() { //ObjectTypeDB::bind_method(_MD("flush_queries"),&PhysicsServer::flush_queries); - ObjectTypeDB::bind_method(_MD("get_process_info"),&PhysicsServer::get_process_info); + ObjectTypeDB::bind_method(_MD("get_process_info","process_info"),&PhysicsServer::get_process_info); BIND_CONSTANT( SHAPE_PLANE ); BIND_CONSTANT( SHAPE_RAY ); diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index fc7ee2bde7..28a9b63412 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -1071,7 +1071,7 @@ void EditorFileDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_vbox:VBoxContainer"),&EditorFileDialog::get_vbox); ObjectTypeDB::bind_method(_MD("set_access","access"),&EditorFileDialog::set_access); ObjectTypeDB::bind_method(_MD("get_access"),&EditorFileDialog::get_access); - ObjectTypeDB::bind_method(_MD("set_show_hidden_files"),&EditorFileDialog::set_show_hidden_files); + ObjectTypeDB::bind_method(_MD("set_show_hidden_files","show"),&EditorFileDialog::set_show_hidden_files); ObjectTypeDB::bind_method(_MD("is_showing_hidden_files"),&EditorFileDialog::is_showing_hidden_files); ObjectTypeDB::bind_method(_MD("_select_drive"),&EditorFileDialog::_select_drive); ObjectTypeDB::bind_method(_MD("_make_dir"),&EditorFileDialog::_make_dir); diff --git a/tools/pck/pck_packer.cpp b/tools/pck/pck_packer.cpp index d398fefb5f..228d37df7c 100644 --- a/tools/pck/pck_packer.cpp +++ b/tools/pck/pck_packer.cpp @@ -26,7 +26,7 @@ void PCKPacker::_bind_methods() { ObjectTypeDB::bind_method(_MD("pck_start","pck_name","alignment"),&PCKPacker::pck_start); ObjectTypeDB::bind_method(_MD("add_file","pck_path","source_path"),&PCKPacker::add_file); - ObjectTypeDB::bind_method(_MD("flush"),&PCKPacker::flush); + ObjectTypeDB::bind_method(_MD("flush","verbose"),&PCKPacker::flush); }; -- cgit v1.2.3 From f613d546ed81ce1926c180c4926d30e5c3c05bae Mon Sep 17 00:00:00 2001 From: reduz Date: Mon, 28 Dec 2015 01:40:23 -0300 Subject: -fixed rich text label fill alignment, always works now -made also sure it doesn't crash, fixes #2688 --- scene/gui/rich_text_label.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 0db85981f7..fd8ba33a51 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -86,7 +86,7 @@ RichTextLabel::Item *RichTextLabel::_get_next_item(Item* p_item,bool p_free) { void RichTextLabel::_process_line(ItemFrame *p_frame,const Vector2& p_ofs,int &y, int p_width, int p_line, ProcessMode p_mode,const Ref &p_base_font,const Color &p_base_color,const Point2i& p_click_pos,Item **r_click_item,int *r_click_char,bool *r_outside,int p_char_count) { - + print_line("BEGIN"); RID ci; if (r_outside) *r_outside=false; @@ -123,6 +123,8 @@ void RichTextLabel::_process_line(ItemFrame *p_frame,const Vector2& p_ofs,int &y int wofs=margin; int spaces_size=0; + int align_ofs=0; + if (p_mode!=PROCESS_CACHE && align!=ALIGN_FILL) wofs+=line_ofs; @@ -153,7 +155,7 @@ void RichTextLabel::_process_line(ItemFrame *p_frame,const Vector2& p_ofs,int &y case ALIGN_LEFT: l.offset_caches.push_back(0); break;\ case ALIGN_CENTER: l.offset_caches.push_back(((p_width-margin)-used)/2); break;\ case ALIGN_RIGHT: l.offset_caches.push_back(((p_width-margin)-used)); break;\ - case ALIGN_FILL: l.offset_caches.push_back((p_width-margin)-used+spaces_size); break;\ + case ALIGN_FILL: l.offset_caches.push_back((p_width-margin)-used/*+spaces_size*/); break;\ }\ l.height_caches.push_back(line_height);\ l.space_caches.push_back(spaces);\ @@ -163,6 +165,7 @@ void RichTextLabel::_process_line(ItemFrame *p_frame,const Vector2& p_ofs,int &y spaces=0;\ spaces_size=0;\ wofs=begin;\ + align_ofs=0;\ if (p_mode!=PROCESS_CACHE) {\ lh=line line_height) {\ if (c[end]==' ') { + fw+=cw; + /* if (p_mode==PROCESS_CACHE) { fw+=cw; } else if (align==ALIGN_FILL && line0) { @@ -287,7 +292,7 @@ if (m_height > line_height) {\ found_space=true; } else { fw+=cw; - } + }*/ } else { fw+=cw; } @@ -295,22 +300,26 @@ if (m_height > line_height) {\ end++; } - ENSURE_WIDTH(w); - //print_line("END: "+String::chr(c[end])+"."); if (end && c[end-1]==' ') { - spaces++; if (p_mode==PROCESS_CACHE) { spaces_size+=font->get_char_size(' ').width; + } else if (align==ALIGN_FILL) { + int ln = MIN(l.offset_caches.size()-1,line); + if (l.space_caches[ln]) { + align_ofs = spaces * l.offset_caches[ln] / l.space_caches[ln]; + } } + spaces++; + /* if (found_space) { int ln = MIN(l.offset_caches.size()-1,line); fw+=l.offset_caches[ln]/l.space_caches[ln]; - } + }*/ } @@ -335,7 +344,7 @@ if (m_height > line_height) {\ cw=tab_size*font->get_char_size(' ').width; } - if (p_click_pos.x-cw/2>p_ofs.x+pofs) { + if (p_click_pos.x-cw/2>p_ofs.x+align_ofs+pofs) { rchar=int((&c[i])-cf); //print_line("GOT: "+itos(rchar)); @@ -371,11 +380,11 @@ if (m_height > line_height) {\ cw = font->get_char_size(c[i],c[i+1]).x; draw_rect(Rect2(p_ofs.x+pofs,p_ofs.y+y,cw,lh),selection_bg); if (visible) - font->draw_char(ci,p_ofs+Point2(pofs,y+lh-(fh-ascent)),c[i],c[i+1],selection_fg); + font->draw_char(ci,p_ofs+Point2(align_ofs+pofs,y+lh-(fh-ascent)),c[i],c[i+1],selection_fg); } else { if (visible) - cw=font->draw_char(ci,p_ofs+Point2(pofs,y+lh-(fh-ascent)),c[i],c[i+1],color); + cw=font->draw_char(ci,p_ofs+Point2(align_ofs+pofs,y+lh-(fh-ascent)),c[i],c[i+1],color); } p_char_count++; @@ -391,7 +400,7 @@ if (m_height > line_height) {\ uc.a*=0.5; //VS::get_singleton()->canvas_item_add_line(ci,Point2(pofs,y+ascent+2),Point2(pofs+cw,y+ascent+2),uc); int uy = y+lh-fh+ascent+2; - VS::get_singleton()->canvas_item_add_line(ci,p_ofs+Point2(pofs,uy),p_ofs+Point2(pofs+cw,uy),uc); + VS::get_singleton()->canvas_item_add_line(ci,p_ofs+Point2(align_ofs+pofs,uy),p_ofs+Point2(align_ofs+pofs+cw,uy),uc); } ofs+=cw; } @@ -429,7 +438,7 @@ if (m_height > line_height) {\ bool visible = visible_characters<0 || p_char_countimage->draw(ci,p_ofs+Point2(wofs,y+lh-font->get_descent()-img->image->get_height())); + img->image->draw(ci,p_ofs+Point2(align_ofs+wofs,y+lh-font->get_descent()-img->image->get_height())); } p_char_count++; @@ -548,7 +557,7 @@ if (m_height > line_height) {\ - Point2 offset(hseparation,vseparation); + Point2 offset(align_ofs+hseparation,vseparation); int row_height=0; //draw using computed caches -- cgit v1.2.3 From fcd4b1a421e9c3ed25201cfd428cfbe789b12204 Mon Sep 17 00:00:00 2001 From: reduz Date: Mon, 28 Dec 2015 09:38:15 -0300 Subject: -added a visual tool to change the pivot of a sprite/asprite/polygon/etc. Closes #2670 --- tools/editor/icons/icon_edit_pivot.png | Bin 0 -> 407 bytes tools/editor/plugins/canvas_item_editor_plugin.cpp | 100 ++++++++++++++------- tools/editor/plugins/canvas_item_editor_plugin.h | 4 + 3 files changed, 70 insertions(+), 34 deletions(-) create mode 100644 tools/editor/icons/icon_edit_pivot.png diff --git a/tools/editor/icons/icon_edit_pivot.png b/tools/editor/icons/icon_edit_pivot.png new file mode 100644 index 0000000000..d68f7bbf25 Binary files /dev/null and b/tools/editor/icons/icon_edit_pivot.png differ diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 0946383c8d..6df0a653fa 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -152,6 +152,44 @@ public: } }; +void CanvasItemEditor::_edit_set_pivot(const Vector2& mouse_pos) { + List &selection = editor_selection->get_selected_node_list(); + + undo_redo->create_action("Move Pivot"); + + for(List::Element *E=selection.front();E;E=E->next()) { + + Node2D *n2d = E->get()->cast_to(); + + if (n2d && n2d->edit_has_pivot()) { + + Vector2 offset = n2d->edit_get_pivot(); + Vector2 gpos = n2d->get_global_pos(); + + Vector2 motion_ofs = gpos-mouse_pos; + + undo_redo->add_do_method(n2d,"set_global_pos",mouse_pos); + undo_redo->add_do_method(n2d,"edit_set_pivot",offset+n2d->get_global_transform().affine_inverse().basis_xform(motion_ofs)); + undo_redo->add_undo_method(n2d,"set_global_pos",gpos); + undo_redo->add_undo_method(n2d,"edit_set_pivot",offset); + for(int i=0;iget_child_count();i++) { + Node2D *n2dc = n2d->get_child(i)->cast_to(); + if (!n2dc) + continue; + + undo_redo->add_do_method(n2dc,"set_global_pos",n2dc->get_global_pos()); + undo_redo->add_undo_method(n2dc,"set_global_pos",n2dc->get_global_pos()); + + } + + } + + } + + undo_redo->commit_action(); + +} + void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { if (!is_visible()) @@ -179,38 +217,7 @@ void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { mouse_pos=transform.affine_inverse().xform(mouse_pos); mouse_pos=snap_point(mouse_pos); - undo_redo->create_action("Move Pivot"); - - for(List::Element *E=selection.front();E;E=E->next()) { - - Node2D *n2d = E->get()->cast_to(); - - if (n2d && n2d->edit_has_pivot()) { - - Vector2 offset = n2d->edit_get_pivot(); - Vector2 gpos = n2d->get_global_pos(); - - Vector2 motion_ofs = gpos-mouse_pos; - - undo_redo->add_do_method(n2d,"set_global_pos",mouse_pos); - undo_redo->add_do_method(n2d,"edit_set_pivot",offset+n2d->get_global_transform().affine_inverse().basis_xform(motion_ofs)); - undo_redo->add_undo_method(n2d,"set_global_pos",gpos); - undo_redo->add_undo_method(n2d,"edit_set_pivot",offset); - for(int i=0;iget_child_count();i++) { - Node2D *n2dc = n2d->get_child(i)->cast_to(); - if (!n2dc) - continue; - - undo_redo->add_do_method(n2dc,"set_global_pos",n2dc->get_global_pos()); - undo_redo->add_undo_method(n2dc,"set_global_pos",n2dc->get_global_pos()); - - } - - } - - } - - undo_redo->commit_action(); + _edit_set_pivot(mouse_pos); } } @@ -221,7 +228,7 @@ void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { void CanvasItemEditor::_tool_select(int p_index) { - ToolButton *tb[TOOL_MAX]={select_button,list_select_button,move_button,rotate_button,pan_button}; + ToolButton *tb[TOOL_MAX]={select_button,list_select_button,move_button,rotate_button,pivot_button,pan_button}; for(int i=0;iset_pressed(i==p_index); @@ -1130,6 +1137,20 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { return; } + + if (b.button_index==BUTTON_LEFT && tool==TOOL_EDIT_PIVOT) { + if (b.pressed) { + + Point2 mouse_pos(b.x,b.y); + mouse_pos=transform.affine_inverse().xform(mouse_pos); + mouse_pos=snap_point(mouse_pos); + _edit_set_pivot(mouse_pos); + } + return; + } + + + if (tool==TOOL_PAN || b.button_index!=BUTTON_LEFT || Input::get_singleton()->is_key_pressed(KEY_SPACE)) return; @@ -1858,6 +1879,8 @@ void CanvasItemEditor::_viewport_draw() { CanvasItem *single_item=NULL; + bool pivot_found=false; + for(Map::Element *E=selection.front();E;E=E->next()) { @@ -1899,7 +1922,7 @@ void CanvasItemEditor::_viewport_draw() { viewport->draw_line(endpoints[i],endpoints[(i+1)%4],c,2); } - if (single && (tool==TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_ROTATE)) { //kind of sucks + if (single && (tool==TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_ROTATE || tool==TOOL_EDIT_PIVOT)) { //kind of sucks if (canvas_item->cast_to()) { @@ -1907,6 +1930,7 @@ void CanvasItemEditor::_viewport_draw() { if (canvas_item->cast_to()->edit_has_pivot()) { viewport->draw_texture(pivot,xform.get_origin()+(-pivot->get_size()/2).floor()); can_move_pivot=true; + pivot_found=true; } } @@ -1941,6 +1965,7 @@ void CanvasItemEditor::_viewport_draw() { //E->get().last_rect = rect; } + pivot_button->set_disabled(!pivot_found); VisualServer::get_singleton()->canvas_item_add_set_transform(ci,Matrix32()); @@ -2149,6 +2174,7 @@ void CanvasItemEditor::_notification(int p_what) { move_button->set_icon( get_icon("ToolMove","EditorIcons")); rotate_button->set_icon( get_icon("ToolRotate","EditorIcons")); pan_button->set_icon( get_icon("ToolPan", "EditorIcons")); + pivot_button->set_icon( get_icon("EditPivot", "EditorIcons")); select_handle=get_icon("EditorHandle","EditorIcons"); lock_button->set_icon(get_icon("Lock","EditorIcons")); unlock_button->set_icon(get_icon("Unlock","EditorIcons")); @@ -3206,6 +3232,12 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { list_select_button->connect("pressed",this,"_tool_select",make_binds(TOOL_LIST_SELECT)); list_select_button->set_tooltip("Show a list of all objects at the position clicked\n(same as Alt+RMB in selet mode)."); + pivot_button = memnew( ToolButton ); + pivot_button->set_toggle_mode(true); + hb->add_child(pivot_button); + pivot_button->connect("pressed",this,"_tool_select",make_binds(TOOL_EDIT_PIVOT)); + pivot_button->set_tooltip("Click to change object's rotation pivot"); + pan_button = memnew( ToolButton ); pan_button->set_toggle_mode(true); hb->add_child(pan_button); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h index 2376e9f842..c731e8c4c6 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.h +++ b/tools/editor/plugins/canvas_item_editor_plugin.h @@ -70,6 +70,7 @@ class CanvasItemEditor : public VBoxContainer { TOOL_LIST_SELECT, TOOL_MOVE, TOOL_ROTATE, + TOOL_EDIT_PIVOT, TOOL_PAN, TOOL_MAX }; @@ -245,6 +246,7 @@ class CanvasItemEditor : public VBoxContainer { ToolButton *move_button; ToolButton *rotate_button; + ToolButton *pivot_button; ToolButton *pan_button; ToolButton *lock_button; @@ -266,6 +268,7 @@ class CanvasItemEditor : public VBoxContainer { PopupMenu *selection_menu; + //PopupMenu *popup; DragType drag; Point2 drag_from; @@ -306,6 +309,7 @@ class CanvasItemEditor : public VBoxContainer { CanvasItem *ref_item; + void _edit_set_pivot(const Vector2& mouse_pos); void _add_canvas_item(CanvasItem *p_canvas_item); void _remove_canvas_item(CanvasItem *p_canvas_item); void _clear_canvas_items(); -- cgit v1.2.3 From e0d21d2158e8d03ee3139392284915c19ee4619b Mon Sep 17 00:00:00 2001 From: reduz Date: Mon, 28 Dec 2015 15:59:20 -0300 Subject: Ability to set autoloads as singleton global variables --- core/script_language.h | 1 + main/main.cpp | 15 +++++ modules/gdscript/gd_script.cpp | 6 ++ modules/gdscript/gd_script.h | 1 + scene/main/node.cpp | 5 +- tools/editor/project_settings.cpp | 119 ++++++++++++++++++++++++++++++++++---- tools/editor/project_settings.h | 2 + 7 files changed, 137 insertions(+), 12 deletions(-) diff --git a/core/script_language.h b/core/script_language.h index 9660f141c7..52ae4e488f 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -165,6 +165,7 @@ public: virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const=0; virtual Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List* r_options,String& r_call_hint) { return ERR_UNAVAILABLE; } virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const=0; + virtual void add_global_constant(const StringName& p_variable,const Variant& p_value)=0; /* DEBUGGER FUNCTIONS */ diff --git a/main/main.cpp b/main/main.cpp index 66391ffa7e..8127bba3e9 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1330,6 +1330,12 @@ bool Main::start() { continue; String name = s.get_slicec('/',1); String path = Globals::get_singleton()->get(s); + bool global_var=false; + if (path.begins_with("*")) { + global_var=true; + path=path.substr(1,path.length()-1); + } + RES res = ResourceLoader::load(path); ERR_EXPLAIN("Can't autoload: "+path); ERR_CONTINUE(res.is_null()); @@ -1355,7 +1361,16 @@ bool Main::start() { ERR_EXPLAIN("Path in autoload not a node or script: "+path); ERR_CONTINUE(!n); n->set_name(name); + sml->get_root()->add_child(n); + + if (global_var) { + for(int i=0;iadd_global_constant(name,n); + } + } + + } } diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 62006cf18b..ef53dcfe71 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -2570,6 +2570,12 @@ void GDScriptLanguage::_add_global(const StringName& p_name,const Variant& p_val _global_array=global_array.ptr(); } +void GDScriptLanguage::add_global_constant(const StringName& p_variable,const Variant& p_value) { + + _add_global(p_variable,p_value); +} + + void GDScriptLanguage::init() { diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 3d16b59065..952a28bdb5 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -529,6 +529,7 @@ public: virtual String make_function(const String& p_class,const String& p_name,const StringArray& p_args) const; virtual Error complete_code(const String& p_code, const String& p_base_path, Object*p_owner,List* r_options,String& r_call_hint); virtual void auto_indent_code(String& p_code,int p_from_line,int p_to_line) const; + virtual void add_global_constant(const StringName& p_variable,const Variant& p_value); /* DEBUGGER FUNCTIONS */ diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 027e9ace65..2b2a188e76 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -856,7 +856,10 @@ Node *Node::_get_child_by_name(const StringName& p_name) const { Node *Node::_get_node(const NodePath& p_path) const { - ERR_FAIL_COND_V( !data.inside_tree && p_path.is_absolute(), NULL ); + if (!data.inside_tree && p_path.is_absolute()) { + ERR_EXPLAIN("Can't use get_node() with absolute paths from outside the active scene tree."); + ERR_FAIL_V(NULL); + } Node *current=NULL; Node *root=NULL; diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index dd3c7552de..98d96f711d 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -33,6 +33,7 @@ #include "editor_node.h" #include "scene/gui/margin_container.h" #include "translation.h" +#include "global_constants.h" ProjectSettings *ProjectSettings::singleton=NULL; @@ -777,10 +778,11 @@ void ProjectSettings::_translation_file_open() { void ProjectSettings::_autoload_file_callback(const String& p_path) { autoload_add_path->set_text(p_path); - if (autoload_add_name->get_text().strip_edges()==String()) { + //if (autoload_add_name->get_text().strip_edges()==String()) { autoload_add_name->set_text( p_path.get_file().basename() ); - } + //} + //_translation_add(p_translation); } @@ -789,6 +791,40 @@ void ProjectSettings::_autoload_file_open() { autoload_file_open->popup_centered_ratio(); } +void ProjectSettings::_autoload_edited() { + + if (updating_autoload) + return; + + TreeItem *ti = autoload_list->get_edited(); + if (!ti || autoload_list->get_edited_column()!=2) + return; + + updating_autoload=true; + bool checked=ti->is_checked(2); + + String base="autoload/"+ti->get_text(0); + + String path = Globals::get_singleton()->get(base); + + if (path.begins_with("*")) + path=path.substr(1,path.length()); + + if (checked) + path="*"+path; + + undo_redo->create_action("Toggle Autoload GlobalVar"); + undo_redo->add_do_property(Globals::get_singleton(),base,path); + undo_redo->add_undo_property(Globals::get_singleton(),base,Globals::get_singleton()->get(base)); + undo_redo->add_do_method(this,"_update_autoload"); + undo_redo->add_undo_method(this,"_update_autoload"); + undo_redo->add_do_method(this,"_settings_changed"); + undo_redo->add_undo_method(this,"_settings_changed"); + undo_redo->commit_action(); + updating_autoload=false; + +} + void ProjectSettings::_autoload_add() { String name = autoload_add_name->get_text(); @@ -799,6 +835,35 @@ void ProjectSettings::_autoload_add() { } + if (ObjectTypeDB::type_exists(name)) { + + message->set_text("Invalid Name.Must not collide with an existing engine class name."); + message->popup_centered(Size2(300,100)); + return; + + } + + for(int i=0;iset_text("Invalid Name.Must not collide with an existing buit-in type name."); + message->popup_centered(Size2(300,100)); + return; + + } + } + + for(int i=0;iset_text("Invalid Name.Must not collide with an existing global constant name."); + message->popup_centered(Size2(300,100)); + return; + } + + } + String path = autoload_add_path->get_text(); if (!FileAccess::exists(path)) { message->set_text("Invalid Path.\nFile does not exist."); @@ -815,7 +880,7 @@ void ProjectSettings::_autoload_add() { undo_redo->create_action("Add Autoload"); name = "autoload/"+name; - undo_redo->add_do_property(Globals::get_singleton(),name,path); + undo_redo->add_do_property(Globals::get_singleton(),name,"*"+path); if (Globals::get_singleton()->has(name)) undo_redo->add_undo_property(Globals::get_singleton(),name,Globals::get_singleton()->get(name)); else @@ -1208,6 +1273,11 @@ void ProjectSettings::_update_translations() { void ProjectSettings::_update_autoload() { + if (updating_autoload) + return; + + updating_autoload=true; + autoload_list->clear(); TreeItem *root = autoload_list->create_item(); autoload_list->set_hide_root(true); @@ -1222,18 +1292,31 @@ void ProjectSettings::_update_autoload() { continue; String name = pi.name.get_slice("/",1); + String path = Globals::get_singleton()->get(pi.name); + if (name=="") continue; - + bool global=false; + if (path.begins_with("*")) { + path=path.substr(1,path.length()); + global=true; + } TreeItem *t = autoload_list->create_item(root); t->set_text(0,name); - t->set_text(1,Globals::get_singleton()->get(pi.name)); - t->add_button(1,get_icon("MoveUp","EditorIcons"),1); - t->add_button(1,get_icon("MoveDown","EditorIcons"),2); - t->add_button(1,get_icon("Del","EditorIcons"),0); + t->set_text(1,path); + t->set_cell_mode(2,TreeItem::CELL_MODE_CHECK); + t->set_editable(2,true); + t->set_text(2,"Enable"); + t->set_checked(2,global); + t->add_button(3,get_icon("MoveUp","EditorIcons"),1); + t->add_button(3,get_icon("MoveDown","EditorIcons"),2); + t->add_button(3,get_icon("Del","EditorIcons"),0); + } + updating_autoload=false; + } void ProjectSettings::_toggle_search_bar(bool p_pressed) { @@ -1302,6 +1385,7 @@ void ProjectSettings::_bind_methods() { ObjectTypeDB::bind_method(_MD("_autoload_file_callback"),&ProjectSettings::_autoload_file_callback); ObjectTypeDB::bind_method(_MD("_update_autoload"),&ProjectSettings::_update_autoload); 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); @@ -1694,11 +1778,24 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { autoload_file_open->set_mode(EditorFileDialog::MODE_OPEN_FILE); autoload_file_open->connect("file_selected",this,"_autoload_file_callback"); - autoload_list->set_columns(2); + autoload_list->set_columns(4); autoload_list->set_column_titles_visible(true); - autoload_list->set_column_title(0,"name"); - autoload_list->set_column_title(1,"path"); + autoload_list->set_column_title(0,"Name"); + autoload_list->set_column_expand(0,true); + autoload_list->set_column_min_width(0,100); + autoload_list->set_column_title(1,"Path"); + autoload_list->set_column_expand(1,true); + autoload_list->set_column_min_width(1,100); + autoload_list->set_column_title(2,"GlobalVar"); + autoload_list->set_column_expand(2,false); + autoload_list->set_column_min_width(2,80); + autoload_list->set_column_expand(3,false); + autoload_list->set_column_min_width(3,80); + autoload_list->connect("button_pressed",this,"_autoload_delete"); + autoload_list->connect("item_edited",this,"_autoload_edited"); + + updating_autoload=false; } diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h index f201f5c48f..0148c4a2f1 100644 --- a/tools/editor/project_settings.h +++ b/tools/editor/project_settings.h @@ -95,8 +95,10 @@ class ProjectSettings : public AcceptDialog { void _update_autoload(); void _autoload_file_callback(const String& p_path); void _autoload_add(); + void _autoload_edited(); void _autoload_file_open(); void _autoload_delete(Object *p_item,int p_column, int p_button); + bool updating_autoload; void _item_selected(); -- cgit v1.2.3 From 110de2ccace05ade4d9fbdded7f4c158dfaa13c1 Mon Sep 17 00:00:00 2001 From: reduz Date: Mon, 28 Dec 2015 16:36:29 -0300 Subject: -Added proper code completion for singletons --- modules/gdscript/gd_editor.cpp | 64 +++++++++++++++++++++++++++++++++++++++ tools/editor/project_settings.cpp | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 381edcba50..6255cfd86a 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -1147,8 +1147,54 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const } } + //autoloads as singletons + List props; + Globals::get_singleton()->get_property_list(&props); + for(List::Element *E=props.front();E;E=E->next()) { + String s = E->get().name; + if (!s.begins_with("autoload/")) + continue; + String name = s.get_slice("/",1); + if (name==String(p_identifier)) { + + String path = Globals::get_singleton()->get(s); + if (path.begins_with("*")) { + String script =path.substr(1,path.length()); + + if (!script.ends_with(".gd")) { + //not a script, try find the script anyway, + //may have some success + script=script.basename()+".gd"; + } + + if (FileAccess::exists(script)) { + + //print_line("is a script"); + + + Ref