diff options
157 files changed, 9571 insertions, 1584 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..f1e99ee8ca --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +*.cpp eol=lf +*.h eol=lf +*.py eol=lf +*.hpp eol=lf diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index b4bf1ed4bd..94557d149d 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -732,6 +732,11 @@ int _OS::find_scancode_from_string(const String& p_code) const { return find_keycode(p_code); } +void _OS::alert(const String& p_alert,const String& p_title) { + + OS::get_singleton()->alert(p_alert,p_title); +} + _OS *_OS::singleton=NULL; void _OS::_bind_methods() { @@ -859,6 +864,7 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_use_file_access_save_and_swap","enabled"),&_OS::set_use_file_access_save_and_swap); + ObjectTypeDB::bind_method(_MD("alert","text","title"),&_OS::alert,DEFVAL("Alert!")); BIND_CONSTANT( DAY_SUNDAY ); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index ed3db29259..24ea810767 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -256,6 +256,9 @@ public: String get_data_dir() const; + void alert(const String& p_alert,const String& p_title="ALERT!"); + + void set_screen_orientation(ScreenOrientation p_orientation); ScreenOrientation get_screen_orientation() const; diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 33175ed2fc..ec089ebc8b 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -79,9 +79,9 @@ public: return Math::log( p_linear ) * 8.6858896380650365530225783783321; } - static inline double db2linear(double p_linear) { + static inline double db2linear(double p_db) { - return Math::exp( p_linear * 0.11512925464970228420089957273422 ); + return Math::exp( p_db * 0.11512925464970228420089957273422 ); } static bool is_nan(double p_val); diff --git a/core/os/input.cpp b/core/os/input.cpp index cf2938f5cd..15872d02fd 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -64,6 +64,7 @@ void Input::_bind_methods() { 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("set_custom_mouse_cursor","image:Texture","hotspot"),&Input::set_custom_mouse_cursor,DEFVAL(Vector2())); BIND_CONSTANT( MOUSE_MODE_VISIBLE ); BIND_CONSTANT( MOUSE_MODE_HIDDEN ); @@ -104,309 +105,3 @@ Input::Input() { ////////////////////////////////////////////////////////// - -void InputDefault::SpeedTrack::update(const Vector2& p_delta_p) { - - uint64_t tick = OS::get_singleton()->get_ticks_usec(); - uint32_t tdiff = tick-last_tick; - float delta_t = tdiff / 1000000.0; - last_tick=tick; - - - accum+=p_delta_p; - accum_t+=delta_t; - - if (accum_t>max_ref_frame*10) - accum_t=max_ref_frame*10; - - while( accum_t>=min_ref_frame ) { - - float slice_t = min_ref_frame / accum_t; - Vector2 slice = accum*slice_t; - accum=accum-slice; - accum_t-=min_ref_frame; - - speed=(slice/min_ref_frame).linear_interpolate(speed,min_ref_frame/max_ref_frame); - } - - - -} - -void InputDefault::SpeedTrack::reset() { - last_tick = OS::get_singleton()->get_ticks_usec(); - speed=Vector2(); - accum_t=0; -} - -InputDefault::SpeedTrack::SpeedTrack() { - - min_ref_frame=0.1; - max_ref_frame=0.3; - reset(); -} - -bool InputDefault::is_key_pressed(int p_scancode) { - - _THREAD_SAFE_METHOD_ - return keys_pressed.has(p_scancode); -} - -bool InputDefault::is_mouse_button_pressed(int p_button) { - - _THREAD_SAFE_METHOD_ - return (mouse_button_mask&(1<<p_button))!=0; -} - - -static int _combine_device(int p_value,int p_device) { - - return p_value|(p_device<<20); -} - -bool InputDefault::is_joy_button_pressed(int p_device, int p_button) { - - _THREAD_SAFE_METHOD_ - return joy_buttons_pressed.has(_combine_device(p_button,p_device)); -} - -bool InputDefault::is_action_pressed(const StringName& p_action) { - - if (custom_action_press.has(p_action)) - return true; //simpler - - const List<InputEvent> *alist = InputMap::get_singleton()->get_action_list(p_action); - if (!alist) - return NULL; - - - for (const List<InputEvent>::Element *E=alist->front();E;E=E->next()) { - - - int device=E->get().device; - - switch(E->get().type) { - - case InputEvent::KEY: { - - const InputEventKey &iek=E->get().key; - if ((keys_pressed.has(iek.scancode))) - return true; - } break; - case InputEvent::MOUSE_BUTTON: { - - const InputEventMouseButton &iemb=E->get().mouse_button; - if(mouse_button_mask&(1<<iemb.button_index)) - return true; - } break; - case InputEvent::JOYSTICK_BUTTON: { - - const InputEventJoystickButton &iejb=E->get().joy_button; - int c = _combine_device(iejb.button_index,device); - if (joy_buttons_pressed.has(c)) - return true; - } break; - } - } - - return false; -} - -float InputDefault::get_joy_axis(int p_device,int p_axis) { - - _THREAD_SAFE_METHOD_ - int c = _combine_device(p_axis,p_device); - if (joy_axis.has(c)) { - return joy_axis[c]; - } else { - return 0; - } -} - -String InputDefault::get_joy_name(int p_idx) { - - _THREAD_SAFE_METHOD_ - return joy_names[p_idx]; -}; - -void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_name) { - - _THREAD_SAFE_METHOD_ - joy_names[p_idx] = p_connected ? p_name : ""; - - emit_signal("joy_connection_changed", p_idx, p_connected); -}; - -Vector3 InputDefault::get_accelerometer() { - - _THREAD_SAFE_METHOD_ - return accelerometer; -} - -void InputDefault::parse_input_event(const InputEvent& p_event) { - - _THREAD_SAFE_METHOD_ - switch(p_event.type) { - - case InputEvent::KEY: { - - if (p_event.key.echo) - break; - if (p_event.key.scancode==0) - break; - - // print_line(p_event); - - if (p_event.key.pressed) - keys_pressed.insert(p_event.key.scancode); - else - keys_pressed.erase(p_event.key.scancode); - } break; - case InputEvent::MOUSE_BUTTON: { - - if (p_event.mouse_button.doubleclick) - break; - - if (p_event.mouse_button.pressed) - mouse_button_mask|=(1<<p_event.mouse_button.button_index); - else - mouse_button_mask&=~(1<<p_event.mouse_button.button_index); - - if (main_loop && emulate_touch && p_event.mouse_button.button_index==1) { - InputEventScreenTouch touch_event; - touch_event.index=0; - touch_event.pressed=p_event.mouse_button.pressed; - touch_event.x=p_event.mouse_button.x; - touch_event.y=p_event.mouse_button.y; - InputEvent ev; - ev.type=InputEvent::SCREEN_TOUCH; - ev.screen_touch=touch_event; - main_loop->input_event(ev); - } - } break; - case InputEvent::MOUSE_MOTION: { - - if (main_loop && emulate_touch && p_event.mouse_motion.button_mask&1) { - InputEventScreenDrag drag_event; - drag_event.index=0; - drag_event.x=p_event.mouse_motion.x; - drag_event.y=p_event.mouse_motion.y; - drag_event.relative_x=p_event.mouse_motion.relative_x; - drag_event.relative_y=p_event.mouse_motion.relative_y; - drag_event.speed_x=p_event.mouse_motion.speed_x; - drag_event.speed_y=p_event.mouse_motion.speed_y; - - InputEvent ev; - ev.type=InputEvent::SCREEN_DRAG; - ev.screen_drag=drag_event; - - main_loop->input_event(ev); - } - - } break; - case InputEvent::JOYSTICK_BUTTON: { - - int c = _combine_device(p_event.joy_button.button_index,p_event.device); - - if (p_event.joy_button.pressed) - joy_buttons_pressed.insert(c); - else - joy_buttons_pressed.erase(c); - } break; - case InputEvent::JOYSTICK_MOTION: { - set_joy_axis(p_event.device, p_event.joy_motion.axis, p_event.joy_motion.axis_value); - } break; - - } - - if (main_loop) - main_loop->input_event(p_event); - -} - -void InputDefault::set_joy_axis(int p_device,int p_axis,float p_value) { - - _THREAD_SAFE_METHOD_ - int c = _combine_device(p_axis,p_device); - joy_axis[c]=p_value; -} - -void InputDefault::set_accelerometer(const Vector3& p_accel) { - - _THREAD_SAFE_METHOD_ - - accelerometer=p_accel; - -} - -void InputDefault::set_main_loop(MainLoop *p_main_loop) { - main_loop=p_main_loop; - -} - -void InputDefault::set_mouse_pos(const Point2& p_posf) { - - mouse_speed_track.update(p_posf-mouse_pos); - mouse_pos=p_posf; -} - -Point2 InputDefault::get_mouse_pos() const { - - return mouse_pos; -} -Point2 InputDefault::get_mouse_speed() const { - - return mouse_speed_track.speed; -} - -int InputDefault::get_mouse_button_mask() const { - - return OS::get_singleton()->get_mouse_button_state(); -} - -void InputDefault::warp_mouse_pos(const Vector2& p_to) { - - OS::get_singleton()->warp_mouse_pos(p_to); -} - - -void InputDefault::iteration(float p_step) { - - -} - -void InputDefault::action_press(const StringName& p_action) { - - if (custom_action_press.has(p_action)) { - - custom_action_press[p_action]++; - } else { - custom_action_press[p_action]=1; - } -} - -void InputDefault::action_release(const StringName& p_action){ - - ERR_FAIL_COND(!custom_action_press.has(p_action)); - custom_action_press[p_action]--; - if (custom_action_press[p_action]==0) { - custom_action_press.erase(p_action); - } -} - -void InputDefault::set_emulate_touch(bool p_emulate) { - - emulate_touch=p_emulate; -} - -bool InputDefault::is_emulating_touchscreen() const { - - return emulate_touch; -} - -InputDefault::InputDefault() { - - mouse_button_mask=0; - emulate_touch=false; - main_loop=NULL; -} diff --git a/core/os/input.h b/core/os/input.h index 5c69ced825..8aa0e6b18a 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -80,82 +80,13 @@ public: virtual bool is_emulating_touchscreen() const=0; + virtual void set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot=Vector2())=0; + virtual void set_mouse_in_window(bool p_in_window)=0; Input(); }; VARIANT_ENUM_CAST(Input::MouseMode); -class InputDefault : public Input { - - OBJ_TYPE( InputDefault, Input ); - _THREAD_SAFE_CLASS_ - - int mouse_button_mask; - Set<int> keys_pressed; - Set<int> joy_buttons_pressed; - Map<int,float> joy_axis; - Map<StringName,int> custom_action_press; - Map<int, String> joy_names; - Vector3 accelerometer; - Vector2 mouse_pos; - MainLoop *main_loop; - - bool emulate_touch; - - struct SpeedTrack { - - uint64_t last_tick; - Vector2 speed; - Vector2 accum; - float accum_t; - float min_ref_frame; - float max_ref_frame; - - void update(const Vector2& p_delta_p); - void reset(); - SpeedTrack(); - }; - - SpeedTrack mouse_speed_track; - -public: - - virtual bool is_key_pressed(int p_scancode); - virtual bool is_mouse_button_pressed(int p_button); - virtual bool is_joy_button_pressed(int p_device, int p_button); - virtual bool is_action_pressed(const StringName& p_action); - - virtual float get_joy_axis(int p_device,int p_axis); - String get_joy_name(int p_idx); - void joy_connection_changed(int p_idx, bool p_connected, String p_name); - - virtual Vector3 get_accelerometer(); - - virtual Point2 get_mouse_pos() const; - virtual Point2 get_mouse_speed() const; - virtual int get_mouse_button_mask() const; - - virtual void warp_mouse_pos(const Vector2& p_to); - - - void parse_input_event(const InputEvent& p_event); - void set_accelerometer(const Vector3& p_accel); - void set_joy_axis(int p_device,int p_axis,float p_value); - - void set_main_loop(MainLoop *main_loop); - void set_mouse_pos(const Point2& p_posf); - - void action_press(const StringName& p_action); - void action_release(const StringName& p_action); - - void iteration(float p_step); - - void set_emulate_touch(bool p_emulate); - virtual bool is_emulating_touchscreen() const; - - InputDefault(); - -}; #endif // INPUT_H diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index b4c02ddbce..c37c281fb9 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -45,7 +45,8 @@ void MainLoop::_bind_methods() { BIND_VMETHOD( MethodInfo("_idle",PropertyInfo(Variant::REAL,"delta")) ); BIND_VMETHOD( MethodInfo("_finalize") ); - + BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER); + BIND_CONSTANT(NOTIFICATION_WM_MOUSE_EXIT); BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN); BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT); BIND_CONSTANT(NOTIFICATION_WM_QUIT_REQUEST); diff --git a/core/os/main_loop.h b/core/os/main_loop.h index bf9fe83a43..c5d58120c5 100644 --- a/core/os/main_loop.h +++ b/core/os/main_loop.h @@ -47,6 +47,8 @@ protected: public: enum { + NOTIFICATION_WM_MOUSE_ENTER = 3, + NOTIFICATION_WM_MOUSE_EXIT = 4, NOTIFICATION_WM_FOCUS_IN = 5, NOTIFICATION_WM_FOCUS_OUT = 6, NOTIFICATION_WM_QUIT_REQUEST = 7, diff --git a/core/ustring.cpp b/core/ustring.cpp index ff7c8984fa..e5419effcb 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3119,8 +3119,8 @@ String String::xml_escape(bool p_escape_quotes) const { String str=*this; str=str.replace("&","&"); - str=str.replace("<",">"); - str=str.replace(">","<"); + str=str.replace("<","<"); + str=str.replace(">",">"); if (p_escape_quotes) { str=str.replace("'","'"); str=str.replace("\"","""); @@ -3172,12 +3172,12 @@ static _FORCE_INLINE_ int _xml_unescape(const CharType *p_src,int p_src_len,Char } else if (p_src_len>=4 && p_src[1]=='g' && p_src[2]=='t' && p_src[3]==';') { if (p_dst) - *p_dst='<'; + *p_dst='>'; eat=4; } else if (p_src_len>=4 && p_src[1]=='l' && p_src[2]=='t' && p_src[3]==';') { if (p_dst) - *p_dst='>'; + *p_dst='<'; eat=4; } else if (p_src_len>=5 && p_src[1]=='a' && p_src[2]=='m' && p_src[3]=='p' && p_src[4]==';') { diff --git a/demos/2d/dynamic_collision_shapes/ball.gd b/demos/2d/dynamic_collision_shapes/ball.gd new file mode 100644 index 0000000000..c17b20f9c8 --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/ball.gd @@ -0,0 +1,21 @@ + +extends RigidBody2D + +# member variables here, example: +# var a=2 +# var b="textvar" + +var timeout=5 + +func _process(delta): + timeout-=delta + if (timeout<1): + set_opacity(timeout) + if (timeout<0): + queue_free() +func _ready(): + set_process(true) + # Initialization here + pass + + diff --git a/demos/2d/dynamic_collision_shapes/ball.png b/demos/2d/dynamic_collision_shapes/ball.png Binary files differnew file mode 100644 index 0000000000..b7cf71da29 --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/ball.png diff --git a/demos/2d/dynamic_collision_shapes/ball.scn b/demos/2d/dynamic_collision_shapes/ball.scn Binary files differnew file mode 100644 index 0000000000..e332de276d --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/ball.scn diff --git a/demos/2d/dynamic_collision_shapes/box.png b/demos/2d/dynamic_collision_shapes/box.png Binary files differnew file mode 100644 index 0000000000..f29b83ce38 --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/box.png diff --git a/demos/2d/dynamic_collision_shapes/circle.png b/demos/2d/dynamic_collision_shapes/circle.png Binary files differnew file mode 100644 index 0000000000..9fdfa550b1 --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/circle.png diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd new file mode 100644 index 0000000000..a6a42a1914 --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd @@ -0,0 +1,23 @@ + +extends Node2D + +# member variables here, example: +# var a=2 +# var b="textvar" +const EMIT_INTERVAL=0.1 +var timeout=EMIT_INTERVAL + +func _process(delta): + timeout-=delta + if (timeout<0): + timeout=EMIT_INTERVAL + var ball = preload("res://ball.scn").instance() + ball.set_pos( Vector2(randf() * get_viewport_rect().size.x, 0) ) + add_child(ball) + +func _ready(): + set_process(true) + # Initialization here + pass + + diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn Binary files differnew file mode 100644 index 0000000000..e6d1ebf9cf --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn diff --git a/demos/2d/dynamic_collision_shapes/engine.cfg b/demos/2d/dynamic_collision_shapes/engine.cfg new file mode 100644 index 0000000000..536b75f2f2 --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/engine.cfg @@ -0,0 +1,4 @@ +[application] + +name="Run-Time CollisionShape" +main_scene="res://dynamic_colobjs.scn" diff --git a/demos/2d/dynamic_collision_shapes/poly.png b/demos/2d/dynamic_collision_shapes/poly.png Binary files differnew file mode 100644 index 0000000000..49ed55cc7d --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/poly.png diff --git a/demos/2d/isometric/dungeon.scn b/demos/2d/isometric/dungeon.scn Binary files differindex 64efc257c0..e03a3bd3dd 100644 --- a/demos/2d/isometric/dungeon.scn +++ b/demos/2d/isometric/dungeon.scn diff --git a/demos/2d/lights_shadows/light_shadows.scn b/demos/2d/lights_shadows/light_shadows.scn Binary files differindex a13e31376e..152f68a407 100644 --- a/demos/2d/lights_shadows/light_shadows.scn +++ b/demos/2d/lights_shadows/light_shadows.scn diff --git a/demos/2d/platformer/enemy.xml b/demos/2d/platformer/enemy.xml index 470797db46..ad3a70931d 100644 --- a/demos/2d/platformer/enemy.xml +++ b/demos/2d/platformer/enemy.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> -<resource_file type="PackedScene" subresource_count="11" version="1.0" version_name="Godot Engine v1.0.3917-beta1"> - <ext_resource path="res://sound_explode.*" type="Sample"></ext_resource> - <ext_resource path="res://enemy.*" type="Texture"></ext_resource> - <ext_resource path="res://enemy.*" type="Script"></ext_resource> - <ext_resource path="res://sound_hit.*" type="Sample"></ext_resource> - <ext_resource path="res://bullet.*" type="Texture"></ext_resource> +<resource_file type="PackedScene" subresource_count="12" version="2.0" version_name="Godot Engine v2.0.alpha.custom_build"> + <ext_resource path="res://bullet.png" type="Texture" index="2"></ext_resource> + <ext_resource path="res://enemy.gd" type="Script" index="0"></ext_resource> + <ext_resource path="res://enemy.png" type="Texture" index="1"></ext_resource> + <ext_resource path="res://sound_hit.wav" type="Sample" index="4"></ext_resource> + <ext_resource path="res://sound_explode.wav" type="Sample" index="3"></ext_resource> <resource type="CircleShape2D" path="local://1"> <real name="custom_solver_bias"> 0 </real> <real name="radius"> 14 </real> @@ -21,6 +21,8 @@ <dictionary name="tracks/0/keys" shared="false"> <string> "cont" </string> <bool> False </bool> + <string> "times" </string> + <real_array len="10"> 0, 0.75, 1.5, 2.25, 3, 3.75, 4.5, 5.25, 6, 6.75 </real_array> <string> "transitions" </string> <real_array len="10"> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 </real_array> <string> "values" </string> @@ -36,8 +38,33 @@ <int> 7 </int> <int> 5 </int> </array> + </dictionary> + + </resource> + <resource type="Animation" path="local://4"> + <string name="resource/name"> "walk" </string> + <real name="length"> 1.25 </real> + <bool name="loop"> True </bool> + <real name="step"> 0.25 </real> + <string name="tracks/0/type"> "value" </string> + <node_path name="tracks/0/path"> "sprite:frame" </node_path> + <int name="tracks/0/interp"> 1 </int> + <dictionary name="tracks/0/keys" shared="false"> + <string> "cont" </string> + <bool> False </bool> <string> "times" </string> - <real_array len="10"> 0, 0.75, 1.5, 2.25, 3, 3.75, 4.5, 5.25, 6, 6.75 </real_array> + <real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array> + <string> "transitions" </string> + <real_array len="6"> 1, 1, 1, 1, 1, 1 </real_array> + <string> "values" </string> + <array len="6" shared="false"> + <int> 0 </int> + <int> 1 </int> + <int> 2 </int> + <int> 3 </int> + <int> 4 </int> + <int> 0 </int> + </array> </dictionary> </resource> @@ -52,6 +79,8 @@ <dictionary name="tracks/0/keys" shared="false"> <string> "cont" </string> <bool> True </bool> + <string> "times" </string> + <real_array len="2"> 3.58422, 4.33851 </real_array> <string> "transitions" </string> <real_array len="2"> 1, 1 </real_array> <string> "values" </string> @@ -59,8 +88,6 @@ <real> 1 </real> <real> 0 </real> </array> - <string> "times" </string> - <real_array len="2"> 3.58422, 4.33851 </real_array> </dictionary> <string name="tracks/1/type"> "value" </string> <node_path name="tracks/1/path"> "sprite:frame" </node_path> @@ -68,14 +95,14 @@ <dictionary name="tracks/1/keys" shared="false"> <string> "cont" </string> <bool> True </bool> + <string> "times" </string> + <real_array len="1"> 0 </real_array> <string> "transitions" </string> <real_array len="1"> 1 </real_array> <string> "values" </string> <array len="1" shared="false"> <int> 4 </int> </array> - <string> "times" </string> - <real_array len="1"> 0 </real_array> </dictionary> <string name="tracks/2/type"> "value" </string> <node_path name="tracks/2/path"> "Particles2D:config/emitting" </node_path> @@ -83,19 +110,21 @@ <dictionary name="tracks/2/keys" shared="false"> <string> "cont" </string> <bool> False </bool> + <string> "times" </string> + <real_array len="1"> 3.47394 </real_array> <string> "transitions" </string> <real_array len="1"> 1 </real_array> <string> "values" </string> <array len="1" shared="false"> <bool> True </bool> </array> - <string> "times" </string> - <real_array len="1"> 3.47394 </real_array> </dictionary> <string name="tracks/3/type"> "method" </string> <node_path name="tracks/3/path"> "." </node_path> <int name="tracks/3/interp"> 1 </int> <dictionary name="tracks/3/keys" shared="false"> + <string> "times" </string> + <real_array len="2"> 3.20357, 5.07305 </real_array> <string> "transitions" </string> <real_array len="2"> 1, 1 </real_array> <string> "values" </string> @@ -115,36 +144,12 @@ <string> "_die" </string> </dictionary> </array> - <string> "times" </string> - <real_array len="2"> 3.20357, 5.07305 </real_array> </dictionary> </resource> - <resource type="Animation" path="local://4"> - <string name="resource/name"> "walk" </string> - <real name="length"> 1.25 </real> - <bool name="loop"> True </bool> - <real name="step"> 0.25 </real> - <string name="tracks/0/type"> "value" </string> - <node_path name="tracks/0/path"> "sprite:frame" </node_path> - <int name="tracks/0/interp"> 1 </int> - <dictionary name="tracks/0/keys" shared="false"> - <string> "cont" </string> - <bool> False </bool> - <string> "transitions" </string> - <real_array len="6"> 1, 1, 1, 1, 1, 1 </real_array> - <string> "values" </string> - <array len="6" shared="false"> - <int> 0 </int> - <int> 1 </int> - <int> 2 </int> - <int> 3 </int> - <int> 4 </int> - <int> 0 </int> - </array> - <string> "times" </string> - <real_array len="6"> 0, 0.25, 0.5, 0.75, 1, 1.25 </real_array> - </dictionary> + <resource type="ColorRamp" path="local://6"> + <real_array name="offsets" len="2"> 0, 1 </real_array> + <color_array name="colors" len="2"> 1, 0.884956, 0.823009, 1, 0.768627, 0.389381, 0, 0 </color_array> </resource> <resource type="SampleLibrary" path="local://5"> @@ -154,7 +159,7 @@ <string> "pitch" </string> <real> 1 </real> <string> "sample" </string> - <resource resource_type="Sample" path="res://sound_explode.*"> </resource> + <resource external="3"> </resource> </dictionary> <dictionary name="samples/hit" shared="false"> <string> "db" </string> @@ -162,24 +167,21 @@ <string> "pitch" </string> <real> 1 </real> <string> "sample" </string> - <resource resource_type="Sample" path="res://sound_hit.*"> </resource> + <resource external="4"> </resource> </dictionary> </resource> <main_resource> <dictionary name="_bundled" shared="false"> + <string> "conn_count" </string> + <int> 0 </int> + <string> "conns" </string> + <int_array len="0"> </int_array> <string> "names" </string> - <string_array len="132"> + <string_array len="107"> <string> "enemy" </string> <string> "RigidBody2D" </string> - <string> "visibility/visible" </string> - <string> "visibility/opacity" </string> - <string> "visibility/self_opacity" </string> - <string> "visibility/on_top" </string> - <string> "transform/pos" </string> - <string> "transform/rot" </string> - <string> "transform/scale" </string> - <string> "shape_count" </string> + <string> "input/pickable" </string> <string> "shapes/0/shape" </string> <string> "shapes/0/transform" </string> <string> "shapes/0/trigger" </string> @@ -189,71 +191,71 @@ <string> "shapes/2/shape" </string> <string> "shapes/2/transform" </string> <string> "shapes/2/trigger" </string> + <string> "collision/layers" </string> + <string> "collision/mask" </string> <string> "mode" </string> <string> "mass" </string> <string> "friction" </string> <string> "bounce" </string> + <string> "gravity_scale" </string> <string> "custom_integrator" </string> <string> "continuous_cd" </string> <string> "contacts_reported" </string> <string> "contact_monitor" </string> - <string> "active" </string> + <string> "sleeping" </string> <string> "can_sleep" </string> <string> "velocity/linear" </string> <string> "velocity/angular" </string> + <string> "damp_override/linear" </string> + <string> "damp_override/angular" </string> <string> "script/script" </string> <string> "__meta__" </string> <string> "enabler" </string> <string> "VisibilityEnabler2D" </string> + <string> "transform/pos" </string> + <string> "transform/scale" </string> <string> "rect" </string> <string> "enabler/pause_animations" </string> <string> "enabler/freeze_bodies" </string> + <string> "enabler/pause_particles" </string> + <string> "enabler/process_parent" </string> + <string> "enabler/fixed_process_parent" </string> <string> "anim" </string> <string> "AnimationPlayer" </string> <string> "playback/process_mode" </string> <string> "playback/default_blend_time" </string> <string> "root/root" </string> <string> "anims/idle" </string> - <string> "anims/explode" </string> <string> "anims/walk" </string> + <string> "anims/explode" </string> <string> "playback/active" </string> <string> "playback/speed" </string> <string> "blend_times" </string> <string> "autoplay" </string> - <string> "CollisionShape2D" </string> - <string> "shape" </string> - <string> "trigger" </string> - <string> "CollisionShape2D 2" </string> - <string> "CollisionShape2D 3" </string> <string> "sprite" </string> <string> "Sprite" </string> <string> "texture" </string> - <string> "centered" </string> - <string> "offset" </string> - <string> "flip_h" </string> - <string> "flip_v" </string> - <string> "vframes" </string> <string> "hframes" </string> <string> "frame" </string> - <string> "modulate" </string> - <string> "region" </string> - <string> "region_rect" </string> + <string> "CollisionShape2D" </string> + <string> "shape" </string> + <string> "trigger" </string> + <string> "_update_shape_index" </string> + <string> "CollisionShape2D 2" </string> + <string> "CollisionShape2D 3" </string> <string> "raycast_left" </string> <string> "RayCast2D" </string> <string> "enabled" </string> <string> "cast_to" </string> + <string> "layer_mask" </string> <string> "raycast_right" </string> <string> "Particles2D" </string> + <string> "visibility/self_opacity" </string> <string> "visibility/blend_mode" </string> <string> "config/amount" </string> <string> "config/lifetime" </string> - <string> "config/time_scale" </string> - <string> "config/preprocess" </string> <string> "config/emit_timeout" </string> <string> "config/emitting" </string> - <string> "config/offset" </string> - <string> "config/half_extents" </string> - <string> "config/local_space" </string> <string> "config/explosiveness" </string> <string> "config/texture" </string> <string> "params/direction" </string> @@ -266,32 +268,14 @@ <string> "params/radial_accel" </string> <string> "params/tangential_accel" </string> <string> "params/damping" </string> + <string> "params/initial_angle" </string> <string> "params/initial_size" </string> <string> "params/final_size" </string> <string> "params/hue_variation" </string> - <string> "randomness/direction" </string> - <string> "randomness/spread" </string> - <string> "randomness/linear_velocity" </string> + <string> "params/anim_speed_scale" </string> + <string> "params/anim_initial_pos" </string> <string> "randomness/spin_velocity" </string> - <string> "randomness/orbit_velocity" </string> - <string> "randomness/gravity_direction" </string> - <string> "randomness/gravity_strength" </string> - <string> "randomness/radial_accel" </string> - <string> "randomness/tangential_accel" </string> - <string> "randomness/damping" </string> - <string> "randomness/initial_size" </string> - <string> "randomness/final_size" </string> - <string> "randomness/hue_variation" </string> - <string> "color_phases/count" </string> - <string> "phase_0/pos" </string> - <string> "phase_0/color" </string> - <string> "phase_1/pos" </string> - <string> "phase_1/color" </string> - <string> "phase_2/pos" </string> - <string> "phase_2/color" </string> - <string> "phase_3/pos" </string> - <string> "phase_3/color" </string> - <string> "emission_points" </string> + <string> "color/color_ramp" </string> <string> "sound" </string> <string> "SamplePlayer2D" </string> <string> "params/volume_db" </string> @@ -303,125 +287,154 @@ <string> "config/samples" </string> <string> "config/pitch_random" </string> </string_array> - <string> "version" </string> - <int> 1 </int> - <string> "conn_count" </string> - <int> 0 </int> <string> "node_count" </string> <int> 11 </int> + <string> "nodes" </string> + <int_array len="285"> -1, -1, 1, 0, -1, 29, 2, 0, 3, 1, 4, 2, 5, 0, 6, 1, 7, 3, 8, 0, 9, 1, 10, 4, 11, 0, 12, 5, 13, 5, 14, 6, 15, 7, 16, 8, 17, 8, 18, 7, 19, 0, 20, 9, 21, 10, 22, 0, 23, 0, 24, 11, 25, 12, 26, 8, 27, 13, 28, 13, 29, 14, 30, 15, 0, 0, 0, 32, 31, -1, 8, 33, 16, 34, 17, 35, 18, 36, 11, 37, 11, 38, 11, 39, 0, 40, 0, 0, 0, 0, 42, 41, -1, 10, 43, 5, 44, 8, 45, 19, 46, 20, 47, 21, 48, 22, 49, 11, 50, 23, 51, 24, 52, 25, 0, 0, 0, 54, 53, -1, 3, 55, 26, 56, 27, 57, 10, 0, 0, 0, 58, 58, -1, 4, 33, 28, 59, 1, 60, 0, 61, 29, 0, 0, 0, 58, 62, -1, 4, 33, 30, 59, 1, 60, 0, 61, 29, 0, 0, 0, 58, 63, -1, 4, 33, 31, 59, 1, 60, 0, 61, 29, 0, 0, 0, 65, 64, -1, 4, 33, 32, 66, 11, 67, 33, 68, 5, 0, 0, 0, 65, 69, -1, 4, 33, 34, 66, 11, 67, 33, 68, 5, 0, 0, 0, 70, 70, -1, 26, 71, 35, 72, 5, 73, 36, 74, 37, 75, 37, 76, 0, 77, 38, 78, 39, 79, 8, 80, 40, 81, 41, 82, 42, 83, 8, 84, 8, 85, 43, 86, 8, 87, 8, 88, 8, 89, 8, 90, 42, 91, 23, 92, 8, 93, 7, 94, 8, 95, 7, 96, 44, 0, 0, 0, 98, 97, -1, 8, 99, 8, 100, 7, 101, 7, 102, 45, 103, 7, 104, 46, 105, 47, 106, 8, 0 </int_array> <string> "variants" </string> - <array len="51" shared="false"> - <bool> True </bool> - <real> 1 </real> - <vector2> 0, 0 </vector2> - <real> 0 </real> - <vector2> 1, 1 </vector2> - <int> 3 </int> + <array len="48" shared="false"> + <bool> False </bool> <resource resource_type="Shape2D" path="local://1"> </resource> <matrix32> 1, -0, 0, 1, -1.08072, -2.16144 </matrix32> - <bool> False </bool> <matrix32> 1, -0, 0, 1, 6.48431, 3.24216 </matrix32> <matrix32> 1, -0, 0, 1, -12.495, 3.53415 </matrix32> + <int> 1 </int> <int> 2 </int> + <real> 1 </real> + <real> 0 </real> + <int> 0 </int> <int> 4 </int> - <resource resource_type="Script" path="res://enemy.*"> </resource> + <bool> True </bool> + <vector2> 0, 0 </vector2> + <real> -1 </real> + <resource external="0"> </resource> <dictionary shared="false"> + <string> "__editor_plugin_screen__" </string> + <string> "2D" </string> <string> "__editor_plugin_states__" </string> <dictionary shared="false"> - <string> "Script" </string> - <dictionary shared="false"> - <string> "current" </string> - <int> 0 </int> - <string> "sources" </string> - <array len="1" shared="false"> - <string> "res://enemy.gd" </string> - </array> - </dictionary> <string> "2D" </string> <dictionary shared="false"> - <string> "pixel_snap" </string> + <string> "ofs" </string> + <vector2> -227.625, -197.9 </vector2> + <string> "snap_grid" </string> + <bool> False </bool> + <string> "snap_offset" </string> + <vector2> 0, 0 </vector2> + <string> "snap_pixel" </string> + <bool> False </bool> + <string> "snap_relative" </string> + <bool> False </bool> + <string> "snap_rotation" </string> <bool> False </bool> + <string> "snap_rotation_offset" </string> + <real> 0 </real> + <string> "snap_rotation_step" </string> + <real> 0.261799 </real> + <string> "snap_show_grid" </string> + <bool> False </bool> + <string> "snap_step" </string> + <vector2> 10, 10 </vector2> <string> "zoom" </string> <real> 1.108033 </real> - <string> "ofs" </string> - <vector2> -227.625, -197.9 </vector2> </dictionary> <string> "3D" </string> <dictionary shared="false"> - <string> "zfar" </string> - <real> 500 </real> + <string> "ambient_light_color" </string> + <color> 0.15, 0.15, 0.15, 1 </color> + <string> "default_light" </string> + <bool> True </bool> + <string> "default_srgb" </string> + <bool> False </bool> + <string> "deflight_rot_x" </string> + <real> 0.942478 </real> + <string> "deflight_rot_y" </string> + <real> 0.628319 </real> <string> "fov" </string> <real> 45 </real> + <string> "show_grid" </string> + <bool> True </bool> + <string> "show_origin" </string> + <bool> True </bool> + <string> "viewport_mode" </string> + <int> 1 </int> <string> "viewports" </string> <array len="4" shared="false"> <dictionary shared="false"> <string> "distance" </string> <real> 4 </real> + <string> "listener" </string> + <bool> True </bool> + <string> "pos" </string> + <vector3> 0, 0, 0 </vector3> + <string> "use_environment" </string> + <bool> False </bool> + <string> "use_orthogonal" </string> + <bool> False </bool> <string> "x_rot" </string> <real> 0 </real> <string> "y_rot" </string> <real> 0 </real> - <string> "use_orthogonal" </string> - <bool> False </bool> - <string> "use_environment" </string> - <bool> False </bool> - <string> "pos" </string> - <vector3> 0, 0, 0 </vector3> </dictionary> <dictionary shared="false"> <string> "distance" </string> <real> 4 </real> + <string> "listener" </string> + <bool> False </bool> + <string> "pos" </string> + <vector3> 0, 0, 0 </vector3> + <string> "use_environment" </string> + <bool> False </bool> + <string> "use_orthogonal" </string> + <bool> False </bool> <string> "x_rot" </string> <real> 0 </real> <string> "y_rot" </string> <real> 0 </real> - <string> "use_orthogonal" </string> - <bool> False </bool> - <string> "use_environment" </string> - <bool> False </bool> - <string> "pos" </string> - <vector3> 0, 0, 0 </vector3> </dictionary> <dictionary shared="false"> <string> "distance" </string> <real> 4 </real> + <string> "listener" </string> + <bool> False </bool> + <string> "pos" </string> + <vector3> 0, 0, 0 </vector3> + <string> "use_environment" </string> + <bool> False </bool> + <string> "use_orthogonal" </string> + <bool> False </bool> <string> "x_rot" </string> <real> 0 </real> <string> "y_rot" </string> <real> 0 </real> - <string> "use_orthogonal" </string> - <bool> False </bool> - <string> "use_environment" </string> - <bool> False </bool> - <string> "pos" </string> - <vector3> 0, 0, 0 </vector3> </dictionary> <dictionary shared="false"> <string> "distance" </string> <real> 4 </real> + <string> "listener" </string> + <bool> False </bool> + <string> "pos" </string> + <vector3> 0, 0, 0 </vector3> + <string> "use_environment" </string> + <bool> False </bool> + <string> "use_orthogonal" </string> + <bool> False </bool> <string> "x_rot" </string> <real> 0 </real> <string> "y_rot" </string> <real> 0 </real> - <string> "use_orthogonal" </string> - <bool> False </bool> - <string> "use_environment" </string> - <bool> False </bool> - <string> "pos" </string> - <vector3> 0, 0, 0 </vector3> </dictionary> </array> - <string> "viewport_mode" </string> - <int> 1 </int> - <string> "default_light" </string> - <bool> True </bool> - <string> "show_grid" </string> - <bool> True </bool> - <string> "show_origin" </string> - <bool> True </bool> + <string> "zfar" </string> + <real> 500 </real> <string> "znear" </string> <real> 0.1 </real> </dictionary> + <string> "Anim" </string> + <dictionary shared="false"> + <string> "visible" </string> + <bool> False </bool> + </dictionary> </dictionary> <string> "__editor_run_settings__" </string> <dictionary shared="false"> @@ -430,28 +443,24 @@ <string> "run_mode" </string> <int> 0 </int> </dictionary> - <string> "__editor_plugin_screen__" </string> - <string> "2D" </string> </dictionary> <vector2> 16.2569, 11.0034 </vector2> <vector2> 23.5056, 10.8629 </vector2> <rect2> -10, -10, 20, 20 </rect2> - <int> 1 </int> <node_path> ".." </node_path> <resource resource_type="Animation" path="local://2"> </resource> - <resource resource_type="Animation" path="local://3"> </resource> <resource resource_type="Animation" path="local://4"> </resource> + <resource resource_type="Animation" path="local://3"> </resource> <real> 3 </real> <array len="0" shared="false"> </array> <string> "" </string> + <resource external="1"> </resource> + <int> 8 </int> <vector2> -1.08072, -2.16144 </vector2> + <int> -1 </int> <vector2> 6.48431, 3.24216 </vector2> <vector2> -12.495, 3.53415 </vector2> - <resource resource_type="Texture" path="res://enemy.*"> </resource> - <int> 8 </int> - <color> 1, 1, 1, 1 </color> - <rect2> 0, 0, 0, 0 </rect2> <vector2> -33.2868, -9.34363 </vector2> <vector2> 0, 45 </vector2> <vector2> 29.1987, -9.34363 </vector2> @@ -459,22 +468,18 @@ <int> 32 </int> <real> 0.5 </real> <real> 0.1 </real> - <resource resource_type="Texture" path="res://bullet.*"> </resource> + <resource external="2"> </resource> <real> 180 </real> <real> 90 </real> <real> 2 </real> <real> 9.8 </real> - <color> 1, 0.884956, 0.823009, 1 </color> - <color> 0.768627, 0.389381, 0, 0 </color> - <color> 0, 0, 0, 1 </color> - <vector2_array len="0"> </vector2_array> + <resource resource_type="ColorRamp" path="local://6"> </resource> <real> 2048 </real> + <int> 3 </int> <resource resource_type="SampleLibrary" path="local://5"> </resource> </array> - <string> "nodes" </string> - <int_array len="445"> -1, -1, 1, 0, -1, 31, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 7, 12, 8, 13, 6, 14, 9, 15, 8, 16, 6, 17, 10, 18, 8, 19, 11, 20, 1, 21, 3, 22, 3, 23, 8, 24, 8, 25, 12, 26, 8, 27, 0, 28, 0, 29, 2, 30, 3, 31, 13, 32, 14, 0, 0, 0, 34, 33, -1, 10, 2, 0, 3, 1, 4, 1, 5, 0, 6, 15, 7, 3, 8, 16, 35, 17, 36, 0, 37, 0, 0, 0, 0, 39, 38, -1, 10, 40, 18, 41, 3, 42, 19, 43, 20, 44, 21, 45, 22, 46, 0, 47, 23, 48, 24, 49, 25, 0, 0, 0, 50, 50, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 26, 7, 3, 8, 4, 51, 6, 52, 8, 0, 0, 0, 50, 53, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 27, 7, 3, 8, 4, 51, 6, 52, 8, 0, 0, 0, 50, 54, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 28, 7, 3, 8, 4, 51, 6, 52, 8, 0, 0, 0, 56, 55, -1, 18, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 57, 29, 58, 0, 59, 2, 60, 8, 61, 8, 62, 18, 63, 30, 64, 12, 65, 31, 66, 8, 67, 32, 0, 0, 0, 69, 68, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 33, 7, 3, 8, 4, 70, 0, 71, 34, 0, 0, 0, 69, 72, -1, 9, 2, 0, 3, 1, 4, 1, 5, 0, 6, 35, 7, 3, 8, 4, 70, 0, 71, 34, 0, 0, 0, 73, 73, -1, 55, 2, 0, 3, 1, 4, 36, 5, 0, 74, 18, 6, 2, 7, 3, 8, 4, 75, 37, 76, 38, 77, 1, 78, 3, 79, 38, 80, 8, 81, 2, 82, 2, 83, 0, 84, 39, 85, 40, 86, 3, 87, 41, 88, 42, 89, 43, 90, 3, 91, 3, 92, 44, 93, 3, 94, 3, 95, 3, 96, 43, 97, 23, 98, 3, 99, 3, 100, 3, 101, 3, 102, 1, 103, 3, 104, 3, 105, 3, 106, 3, 107, 3, 108, 3, 109, 3, 110, 3, 111, 3, 112, 11, 113, 3, 114, 45, 115, 1, 116, 46, 117, 1, 118, 47, 119, 1, 120, 47, 121, 48, 0, 0, 0, 123, 122, -1, 15, 2, 0, 3, 1, 4, 1, 5, 0, 6, 2, 7, 3, 8, 4, 124, 3, 125, 1, 126, 1, 127, 49, 128, 1, 129, 5, 130, 50, 131, 3, 0 </int_array> - <string> "conns" </string> - <int_array len="0"> </int_array> + <string> "version" </string> + <int> 1 </int> </dictionary> </main_resource> diff --git a/demos/2d/platformer/stage.xml b/demos/2d/platformer/stage.xml index 4d6083adf6..d081a1be38 100644 --- a/demos/2d/platformer/stage.xml +++ b/demos/2d/platformer/stage.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<resource_file type="PackedScene" subresource_count="10" version="1.1" version_name="Godot Engine v1.1.rc1.custom_build"> +<resource_file type="PackedScene" subresource_count="10" version="1.1" version_name="Godot Engine v1.1.stable.custom_build"> <ext_resource path="res://tileset.xml" type="TileSet"></ext_resource> <ext_resource path="res://coin.xml" type="PackedScene"></ext_resource> <ext_resource path="res://moving_platform.xml" type="PackedScene"></ext_resource> @@ -16,22 +16,12 @@ <string> "conns" </string> <int_array len="0"> </int_array> <string> "names" </string> - <string_array len="133"> + <string_array len="117"> <string> "stage" </string> <string> "Node" </string> - <string> "_import_path" </string> <string> "__meta__" </string> <string> "tile_map" </string> <string> "TileMap" </string> - <string> "visibility/visible" </string> - <string> "visibility/opacity" </string> - <string> "visibility/self_opacity" </string> - <string> "visibility/light_mask" </string> - <string> "transform/pos" </string> - <string> "transform/rot" </string> - <string> "transform/scale" </string> - <string> "z/z" </string> - <string> "z/relative" </string> <string> "mode" </string> <string> "tile_set" </string> <string> "cell/size" </string> @@ -49,6 +39,8 @@ <string> "coins" </string> <string> "coin" </string> <string> "Area2D" </string> + <string> "_import_path" </string> + <string> "transform/pos" </string> <string> "coin 2" </string> <string> "coin 3" </string> <string> "coin 4" </string> @@ -129,14 +121,9 @@ <string> "margin/top" </string> <string> "margin/right" </string> <string> "margin/bottom" </string> - <string> "focus_neighbour/left" </string> - <string> "focus_neighbour/top" </string> - <string> "focus_neighbour/right" </string> - <string> "focus_neighbour/bottom" </string> <string> "focus/ignore_mouse" </string> <string> "focus/stop_mouse" </string> <string> "size_flags/horizontal" </string> - <string> "size_flags/stretch_ratio" </string> <string> "range/min" </string> <string> "range/max" </string> <string> "range/step" </string> @@ -145,19 +132,15 @@ <string> "range/exp_edit" </string> <string> "rounded_values" </string> <string> "text" </string> - <string> "align" </string> - <string> "valign" </string> <string> "autowrap" </string> - <string> "uppercase" </string> <string> "percent_visible" </string> </string_array> <string> "node_count" </string> <int> 67 </int> <string> "nodes" </string> - <int_array len="973"> -1, -1, 1, 0, -1, 2, 2, 0, 3, 1, 0, 0, 0, 5, 4, -1, 25, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 10, 5, 11, 6, 12, 7, 13, 8, 14, 2, 15, 8, 16, 9, 17, 10, 18, 11, 19, 12, 20, 13, 21, 8, 22, 14, 23, 14, 24, 3, 25, 6, 26, 4, 27, 4, 28, 15, 3, 16, 0, 0, 0, 1, 29, -1, 1, 2, 0, 0, 2, 0, 31, 30, 17, 3, 2, 0, 10, 18, 3, 19, 0, 2, 0, 31, 32, 17, 3, 2, 0, 10, 20, 3, 19, 0, 2, 0, 31, 33, 17, 3, 2, 0, 10, 21, 3, 19, 0, 2, 0, 31, 34, 17, 3, 2, 0, 10, 22, 3, 19, 0, 2, 0, 31, 35, 17, 3, 2, 0, 10, 23, 3, 19, 0, 2, 0, 31, 36, 17, 3, 2, 0, 10, 24, 3, 19, 0, 2, 0, 31, 37, 17, 3, 2, 0, 10, 25, 3, 19, 0, 2, 0, 31, 38, 17, 3, 2, 0, 10, 26, 3, 19, 0, 2, 0, 31, 39, 17, 3, 2, 0, 10, 27, 3, 19, 0, 2, 0, 31, 40, 17, 3, 2, 0, 10, 28, 3, 19, 0, 2, 0, 31, 41, 17, 3, 2, 0, 10, 29, 3, 19, 0, 2, 0, 31, 42, 17, 3, 2, 0, 10, 30, 3, 19, 0, 2, 0, 31, 43, 17, 3, 2, 0, 10, 31, 3, 19, 0, 2, 0, 31, 44, 17, 3, 2, 0, 10, 32, 3, 19, 0, 2, 0, 31, 45, 17, 3, 2, 0, 10, 33, 3, 19, 0, 2, 0, 31, 46, 17, 3, 2, 0, 10, 34, 3, 19, 0, 2, 0, 31, 47, 17, 3, 2, 0, 10, 35, 3, 19, 0, 2, 0, 31, 48, 17, 3, 2, 0, 10, 36, 3, 19, 0, 2, 0, 31, 49, 17, 3, 2, 0, 10, 37, 3, 19, 0, 2, 0, 31, 50, 17, 3, 2, 0, 10, 38, 3, 19, 0, 2, 0, 31, 51, 17, 3, 2, 0, 10, 39, 3, 19, 0, 2, 0, 31, 52, 17, 3, 2, 0, 10, 40, 3, 19, 0, 2, 0, 31, 53, 17, 3, 2, 0, 10, 41, 3, 19, 0, 2, 0, 31, 54, 17, 3, 2, 0, 10, 42, 3, 19, 0, 2, 0, 31, 55, 17, 3, 2, 0, 10, 43, 3, 19, 0, 2, 0, 31, 56, 17, 3, 2, 0, 10, 44, 3, 19, 0, 2, 0, 31, 57, 17, 3, 2, 0, 10, 45, 3, 19, 0, 2, 0, 31, 58, 17, 3, 2, 0, 10, 46, 3, 19, 0, 2, 0, 31, 59, 17, 3, 2, 0, 10, 47, 3, 19, 0, 2, 0, 31, 60, 17, 3, 2, 0, 10, 48, 3, 19, 0, 2, 0, 31, 61, 17, 3, 2, 0, 10, 49, 3, 19, 0, 2, 0, 31, 62, 17, 3, 2, 0, 10, 50, 3, 19, 0, 2, 0, 31, 63, 17, 3, 2, 0, 10, 51, 3, 19, 0, 2, 0, 31, 64, 17, 3, 2, 0, 10, 52, 3, 19, 0, 2, 0, 31, 65, 17, 3, 2, 0, 10, 53, 3, 19, 0, 2, 0, 31, 66, 17, 3, 2, 0, 10, 54, 3, 19, 0, 2, 0, 31, 67, 17, 3, 2, 0, 10, 55, 3, 19, 0, 2, 0, 31, 68, 17, 3, 2, 0, 10, 56, 3, 19, 0, 2, 0, 31, 69, 17, 3, 2, 0, 10, 57, 3, 19, 0, 2, 0, 31, 70, 17, 3, 2, 0, 10, 58, 3, 19, 0, 2, 0, 31, 71, 17, 3, 2, 0, 10, 59, 3, 19, 0, 2, 0, 31, 72, 17, 3, 2, 0, 10, 60, 3, 19, 0, 0, 0, 1, 73, -1, 1, 2, 0, 0, 45, 0, 75, 74, 61, 5, 2, 0, 10, 62, 3, 63, 76, 64, 77, 65, 0, 45, 0, 75, 78, 61, 5, 2, 0, 10, 66, 3, 63, 76, 67, 77, 68, 0, 45, 0, 75, 79, 61, 5, 2, 0, 10, 69, 3, 63, 76, 70, 77, 68, 0, 45, 0, 75, 80, 71, 3, 2, 0, 10, 72, 3, 73, 0, 45, 0, 82, 81, 74, 3, 2, 0, 10, 75, 3, 76, 0, 0, 0, 84, 83, 77, 3, 2, 0, 10, 78, 3, 79, 0, 0, 0, 86, 85, -1, 7, 2, 0, 87, 80, 88, 14, 89, 2, 90, 81, 91, 2, 92, 14, 0, 0, 0, 1, 93, -1, 1, 2, 0, 0, 53, 0, 84, 94, 82, 3, 2, 0, 10, 83, 3, 84, 0, 53, 0, 84, 95, 82, 3, 2, 0, 10, 85, 3, 84, 0, 53, 0, 84, 96, 82, 3, 2, 0, 10, 86, 3, 84, 0, 53, 0, 84, 97, 82, 3, 2, 0, 10, 87, 3, 84, 0, 53, 0, 84, 98, 82, 3, 2, 0, 10, 88, 3, 84, 0, 53, 0, 84, 99, 82, 3, 2, 0, 10, 89, 3, 84, 0, 53, 0, 84, 100, 82, 3, 2, 0, 10, 90, 3, 84, 0, 53, 0, 84, 101, 82, 3, 2, 0, 10, 91, 3, 84, 0, 53, 0, 84, 102, 82, 3, 2, 0, 10, 92, 3, 84, 0, 53, 0, 84, 103, 82, 3, 2, 0, 10, 93, 3, 84, 0, 53, 0, 84, 104, 82, 3, 2, 0, 10, 94, 3, 84, 0, 0, 0, 106, 105, 95, 2, 2, 0, 3, 96, 0, 0, 0, 107, 107, -1, 30, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 108, 97, 109, 98, 110, 99, 111, 100, 112, 0, 113, 0, 114, 0, 115, 0, 116, 2, 117, 2, 118, 13, 119, 3, 120, 6, 121, 101, 122, 3, 123, 102, 124, 6, 125, 14, 126, 14, 127, 103, 128, 8, 129, 8, 130, 2, 131, 14, 132, 104, 0 </int_array> + <int_array len="917"> -1, -1, 1, 0, -1, 1, 2, 0, 0, 0, 0, 4, 3, -1, 15, 5, 1, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 1, 12, 7, 13, 7, 14, 8, 15, 9, 16, 10, 17, 10, 18, 11, 2, 12, 0, 0, 0, 1, 19, -1, 0, 0, 2, 0, 21, 20, 13, 3, 22, 14, 23, 15, 2, 16, 0, 2, 0, 21, 24, 13, 3, 22, 14, 23, 17, 2, 16, 0, 2, 0, 21, 25, 13, 3, 22, 14, 23, 18, 2, 16, 0, 2, 0, 21, 26, 13, 3, 22, 14, 23, 19, 2, 16, 0, 2, 0, 21, 27, 13, 3, 22, 14, 23, 20, 2, 16, 0, 2, 0, 21, 28, 13, 3, 22, 14, 23, 21, 2, 16, 0, 2, 0, 21, 29, 13, 3, 22, 14, 23, 22, 2, 16, 0, 2, 0, 21, 30, 13, 3, 22, 14, 23, 23, 2, 16, 0, 2, 0, 21, 31, 13, 3, 22, 14, 23, 24, 2, 16, 0, 2, 0, 21, 32, 13, 3, 22, 14, 23, 25, 2, 16, 0, 2, 0, 21, 33, 13, 3, 22, 14, 23, 26, 2, 16, 0, 2, 0, 21, 34, 13, 3, 22, 14, 23, 27, 2, 16, 0, 2, 0, 21, 35, 13, 3, 22, 14, 23, 28, 2, 16, 0, 2, 0, 21, 36, 13, 3, 22, 14, 23, 29, 2, 16, 0, 2, 0, 21, 37, 13, 3, 22, 14, 23, 30, 2, 16, 0, 2, 0, 21, 38, 13, 3, 22, 14, 23, 31, 2, 16, 0, 2, 0, 21, 39, 13, 3, 22, 14, 23, 32, 2, 16, 0, 2, 0, 21, 40, 13, 3, 22, 14, 23, 33, 2, 16, 0, 2, 0, 21, 41, 13, 3, 22, 14, 23, 34, 2, 16, 0, 2, 0, 21, 42, 13, 3, 22, 14, 23, 35, 2, 16, 0, 2, 0, 21, 43, 13, 3, 22, 14, 23, 36, 2, 16, 0, 2, 0, 21, 44, 13, 3, 22, 14, 23, 37, 2, 16, 0, 2, 0, 21, 45, 13, 3, 22, 14, 23, 38, 2, 16, 0, 2, 0, 21, 46, 13, 3, 22, 14, 23, 39, 2, 16, 0, 2, 0, 21, 47, 13, 3, 22, 14, 23, 40, 2, 16, 0, 2, 0, 21, 48, 13, 3, 22, 14, 23, 41, 2, 16, 0, 2, 0, 21, 49, 13, 3, 22, 14, 23, 42, 2, 16, 0, 2, 0, 21, 50, 13, 3, 22, 14, 23, 43, 2, 16, 0, 2, 0, 21, 51, 13, 3, 22, 14, 23, 44, 2, 16, 0, 2, 0, 21, 52, 13, 3, 22, 14, 23, 45, 2, 16, 0, 2, 0, 21, 53, 13, 3, 22, 14, 23, 46, 2, 16, 0, 2, 0, 21, 54, 13, 3, 22, 14, 23, 47, 2, 16, 0, 2, 0, 21, 55, 13, 3, 22, 14, 23, 48, 2, 16, 0, 2, 0, 21, 56, 13, 3, 22, 14, 23, 49, 2, 16, 0, 2, 0, 21, 57, 13, 3, 22, 14, 23, 50, 2, 16, 0, 2, 0, 21, 58, 13, 3, 22, 14, 23, 51, 2, 16, 0, 2, 0, 21, 59, 13, 3, 22, 14, 23, 52, 2, 16, 0, 2, 0, 21, 60, 13, 3, 22, 14, 23, 53, 2, 16, 0, 2, 0, 21, 61, 13, 3, 22, 14, 23, 54, 2, 16, 0, 2, 0, 21, 62, 13, 3, 22, 14, 23, 55, 2, 16, 0, 2, 0, 21, 63, 13, 3, 22, 14, 23, 56, 2, 16, 0, 2, 0, 21, 64, 13, 3, 22, 14, 23, 57, 2, 16, 0, 0, 0, 1, 65, -1, 0, 0, 45, 0, 67, 66, 58, 5, 22, 14, 23, 59, 2, 60, 68, 61, 69, 62, 0, 45, 0, 67, 70, 58, 5, 22, 14, 23, 63, 2, 60, 68, 64, 69, 65, 0, 45, 0, 67, 71, 58, 5, 22, 14, 23, 66, 2, 60, 68, 67, 69, 65, 0, 45, 0, 67, 72, 68, 3, 22, 14, 23, 69, 2, 70, 0, 45, 0, 74, 73, 71, 3, 22, 14, 23, 72, 2, 73, 0, 0, 0, 76, 75, 74, 3, 22, 14, 23, 75, 2, 76, 0, 0, 0, 78, 77, -1, 6, 79, 77, 80, 7, 81, 78, 82, 79, 83, 78, 84, 7, 0, 0, 0, 1, 85, -1, 0, 0, 53, 0, 76, 86, 80, 3, 22, 14, 23, 81, 2, 82, 0, 53, 0, 76, 87, 80, 3, 22, 14, 23, 83, 2, 82, 0, 53, 0, 76, 88, 80, 3, 22, 14, 23, 84, 2, 82, 0, 53, 0, 76, 89, 80, 3, 22, 14, 23, 85, 2, 82, 0, 53, 0, 76, 90, 80, 3, 22, 14, 23, 86, 2, 82, 0, 53, 0, 76, 91, 80, 3, 22, 14, 23, 87, 2, 82, 0, 53, 0, 76, 92, 80, 3, 22, 14, 23, 88, 2, 82, 0, 53, 0, 76, 93, 80, 3, 22, 14, 23, 89, 2, 82, 0, 53, 0, 76, 94, 80, 3, 22, 14, 23, 90, 2, 82, 0, 53, 0, 76, 95, 80, 3, 22, 14, 23, 91, 2, 82, 0, 53, 0, 76, 96, 80, 3, 22, 14, 23, 92, 2, 82, 0, 0, 0, 98, 97, 93, 2, 22, 14, 2, 94, 0, 0, 0, 99, 99, -1, 17, 100, 95, 101, 96, 102, 97, 103, 98, 104, 78, 105, 78, 106, 6, 107, 9, 108, 99, 109, 8, 110, 100, 111, 9, 112, 7, 113, 7, 114, 101, 115, 78, 116, 102, 0 </int_array> <string> "variants" </string> - <array len="105" shared="false"> - <node_path> "" </node_path> + <array len="103" shared="false"> <dictionary shared="false"> <string> "__editor_plugin_screen__" </string> <string> "2D" </string> @@ -166,7 +149,7 @@ <string> "2D" </string> <dictionary shared="false"> <string> "ofs" </string> - <vector2> 328.379, 822.226 </vector2> + <vector2> -70.6559, 735.599 </vector2> <string> "snap_grid" </string> <bool> False </bool> <string> "snap_offset" </string> @@ -186,7 +169,7 @@ <string> "snap_step" </string> <vector2> 10, 10 </vector2> <string> "zoom" </string> - <real> 1.108032 </real> + <real> 0.663419 </real> </dictionary> <string> "3D" </string> <dictionary shared="false"> @@ -280,18 +263,6 @@ <string> "znear" </string> <real> 0.1 </real> </dictionary> - <string> "Script" </string> - <dictionary shared="false"> - <string> "current" </string> - <int> 0 </int> - <string> "sources" </string> - <array len="4" shared="false"> - <string> "res://moving_platform.gd" </string> - <string> "res://enemy.gd" </string> - <string> "res://player.gd" </string> - <string> "res://coin.gd" </string> - </array> - </dictionary> </dictionary> <string> "__editor_run_settings__" </string> <dictionary shared="false"> @@ -301,12 +272,6 @@ <int> 0 </int> </dictionary> </dictionary> - <bool> True </bool> - <real> 1 </real> - <int> 1 </int> - <vector2> 0, 0 </vector2> - <real> 0 </real> - <vector2> 1, 1 </vector2> <int> 0 </int> <resource resource_type="TileSet" path="res://tileset.xml"> </resource> <vector2> 64, 64 </vector2> @@ -314,12 +279,16 @@ <matrix32> 1, 0, 0, 1, 0, 0 </matrix32> <int> 2 </int> <bool> False </bool> + <real> 1 </real> + <real> 0 </real> + <int> 1 </int> <int_array len="2008"> 0, 2, 70, 536870914, 71, 10, 72, 10, 73, 10, 74, 10, 75, 10, 76, 10, 77, 10, 78, 10, 65536, 2, 65606, 536870914, 65607, 10, 65608, 10, 65609, 10, 65610, 10, 65611, 10, 65612, 10, 65613, 10, 65614, 10, 131072, 2, 131142, 536870914, 131143, 10, 131144, 10, 131145, 10, 131146, 10, 131147, 10, 131148, 10, 131149, 10, 131150, 10, 196608, 2, 196626, 9, 196678, 536870914, 196679, 10, 196680, 10, 196681, 10, 196682, 10, 196683, 10, 196684, 10, 196685, 10, 196686, 10, 262144, 2, 262162, 8, 262214, 536870914, 262215, 10, 262216, 10, 262217, 10, 262218, 10, 262219, 10, 262220, 10, 262221, 10, 262222, 10, 327680, 2, 327697, 536870921, 327698, 7, 327733, 9, 327750, 536870914, 327751, 10, 327752, 10, 327753, 10, 327754, 10, 327755, 10, 327756, 10, 327757, 10, 327758, 10, 393216, 2, 393233, 536870920, 393234, 7, 393257, 9, 393269, 7, 393286, 536870914, 393287, 10, 393288, 10, 393289, 10, 393290, 10, 393291, 10, 393292, 10, 393293, 10, 393294, 10, 458752, 2, 458769, 7, 458770, 8, 458790, 9, 458793, 8, 458805, 8, 458822, 536870914, 458823, 10, 458824, 10, 458825, 10, 458826, 10, 458827, 10, 458828, 10, 458829, 10, 458830, 10, 524288, 4, 524289, 1, 524304, 536870913, 524305, 536870918, 524306, 6, 524307, 5, 524308, 1, 524326, 8, 524329, 7, 524341, 7, 524358, 536870914, 524359, 10, 524360, 10, 524361, 10, 524362, 10, 524363, 10, 524364, 10, 524365, 10, 524366, 10, 589824, 10, 589825, 13, 589840, 536870914, 589841, 10, 589842, 10, 589843, 10, 589844, 2, 589862, 7, 589865, 7, 589876, 536870913, 589877, 6, 589878, 1, 589894, 536870914, 589895, 10, 589896, 10, 589897, 10, 589898, 10, 589899, 10, 589900, 10, 589901, 10, 589902, 10, 655360, 2, 655376, 536870914, 655377, 10, 655378, 10, 655379, 10, 655380, 2, 655398, 7, 655401, 8, 655412, 536870925, 655413, 11, 655414, 13, 655430, 536870914, 655431, 10, 655432, 10, 655433, 10, 655434, 10, 655435, 10, 655436, 10, 655437, 10, 655438, 10, 720896, 2, 720912, 536870914, 720913, 10, 720914, 10, 720915, 10, 720916, 2, 720934, 8, 720937, 7, 720958, 536870913, 720959, 5, 720960, 536870917, 720961, 5, 720962, 5, 720963, 536870917, 720964, 5, 720965, 0, 720966, 536870916, 720967, 10, 720968, 10, 720969, 10, 720970, 10, 720971, 10, 720972, 10, 720973, 10, 720974, 10, 786432, 2, 786437, 9, 786448, 536870914, 786449, 10, 786450, 10, 786451, 10, 786452, 2, 786464, 536870913, 786465, 1, 786470, 7, 786473, 7, 786474, 536870924, 786475, 1, 786494, 536870914, 786495, 10, 786496, 10, 786497, 10, 786498, 10, 786499, 10, 786500, 10, 786501, 10, 786502, 10, 786503, 10, 786504, 10, 786505, 10, 786506, 10, 786507, 10, 786508, 10, 786509, 10, 851968, 2, 851973, 7, 851984, 536870914, 851985, 10, 851986, 10, 851987, 10, 851988, 2, 851996, 536870913, 851997, 1, 852000, 536870914, 852001, 3, 852006, 7, 852009, 536870913, 852011, 2, 852030, 536870914, 852031, 10, 852032, 10, 852033, 10, 852034, 10, 852035, 10, 852036, 10, 852037, 10, 852038, 10, 852039, 10, 852040, 10, 852041, 10, 852042, 10, 852043, 10, 852044, 10, 852045, 10, 917504, 2, 917506, 9, 917509, 7, 917512, 536870921, 917520, 536870925, 917521, 11, 917522, 11, 917523, 11, 917524, 13, 917532, 536870925, 917533, 13, 917536, 536870914, 917537, 4, 917538, 1, 917540, 536870913, 917541, 0, 917542, 1, 917545, 536870914, 917546, 10, 917547, 4, 917548, 1, 917566, 536870914, 917567, 10, 917568, 10, 917569, 10, 917570, 10, 917571, 10, 917572, 10, 917573, 10, 917574, 10, 917575, 10, 917576, 10, 917577, 10, 917578, 10, 917579, 10, 917580, 10, 917581, 10, 983040, 2, 983042, 7, 983045, 7, 983048, 536870920, 983050, 536870913, 983051, 0, 983052, 1, 983064, 536870913, 983065, 1, 983072, 536870914, 983073, 10, 983074, 4, 983075, 0, 983076, 536870916, 983077, 10, 983078, 4, 983079, 536870912, 983080, 536870912, 983081, 536870916, 983082, 10, 983083, 10, 983084, 2, 983095, 9, 983102, 536870914, 983103, 10, 983104, 10, 983105, 10, 983106, 10, 983107, 10, 983108, 10, 983109, 10, 983110, 10, 983111, 10, 983112, 10, 983113, 10, 983114, 10, 983115, 10, 983116, 10, 983117, 10, 1048576, 2, 1048578, 8, 1048581, 8, 1048584, 536870919, 1048586, 536870914, 1048587, 536870922, 1048588, 2, 1048600, 536870925, 1048601, 13, 1048604, 9, 1048608, 536870925, 1048609, 536870923, 1048610, 536870923, 1048611, 536870923, 1048612, 10, 1048613, 10, 1048614, 10, 1048615, 10, 1048616, 10, 1048617, 10, 1048618, 10, 1048619, 10, 1048620, 4, 1048621, 1, 1048630, 536870921, 1048631, 8, 1048638, 536870914, 1048639, 10, 1048640, 10, 1048641, 10, 1048642, 10, 1048643, 10, 1048644, 10, 1048645, 10, 1048646, 10, 1048647, 10, 1048648, 10, 1048649, 10, 1048650, 10, 1048651, 10, 1048652, 10, 1048653, 10, 1114112, 4, 1114113, 0, 1114114, 6, 1114115, 0, 1114116, 0, 1114117, 6, 1114118, 1, 1114120, 536870920, 1114122, 536870925, 1114123, 11, 1114124, 13, 1114128, 536870913, 1114129, 5, 1114130, 536870917, 1114131, 5, 1114132, 0, 1114133, 1, 1114140, 7, 1114141, 536870921, 1114148, 536870914, 1114149, 10, 1114150, 10, 1114151, 10, 1114152, 10, 1114153, 10, 1114154, 10, 1114155, 10, 1114156, 10, 1114157, 2, 1114166, 536870920, 1114167, 8, 1114174, 536870914, 1114175, 10, 1114176, 10, 1114177, 10, 1114178, 10, 1114179, 10, 1114180, 10, 1114181, 10, 1114182, 10, 1114183, 10, 1114184, 10, 1114185, 10, 1114186, 10, 1114187, 10, 1114188, 10, 1179648, 10, 1179649, 10, 1179650, 10, 1179651, 10, 1179652, 10, 1179653, 10, 1179654, 2, 1179656, 536870919, 1179663, 536870915, 1179665, 10, 1179666, 10, 1179667, 10, 1179668, 10, 1179669, 4, 1179670, 12, 1179675, 9, 1179676, 8, 1179677, 8, 1179684, 536870914, 1179685, 10, 1179686, 10, 1179687, 10, 1179688, 10, 1179689, 10, 1179690, 10, 1179691, 10, 1179692, 10, 1179693, 4, 1179694, 1, 1179701, 9, 1179702, 536870919, 1179703, 7, 1179710, 536870914, 1179711, 10, 1179712, 10, 1179713, 10, 1179714, 10, 1179715, 10, 1179716, 10, 1179717, 10, 1179718, 10, 1179719, 10, 1179720, 10, 1179721, 10, 1179722, 10, 1245184, 10, 1245185, 10, 1245186, 10, 1245187, 10, 1245188, 10, 1245189, 10, 1245190, 2, 1245192, 536870919, 1245199, 536870913, 1245200, 536870916, 1245201, 10, 1245202, 10, 1245203, 10, 1245204, 10, 1245205, 10, 1245207, 1, 1245211, 7, 1245212, 7, 1245213, 536870920, 1245220, 536870914, 1245221, 10, 1245222, 10, 1245223, 10, 1245224, 10, 1245225, 10, 1245226, 10, 1245227, 10, 1245228, 10, 1245229, 10, 1245230, 2, 1245237, 8, 1245238, 536870919, 1245239, 8, 1245240, 536870921, 1245246, 536870914, 1245247, 10, 1245248, 10, 1245249, 10, 1245250, 10, 1245251, 10, 1245252, 10, 1245253, 10, 1245254, 10, 1245255, 10, 1245256, 10, 1245257, 10, 1245258, 10, 1310720, 10, 1310721, 10, 1310722, 10, 1310723, 10, 1310724, 10, 1310725, 10, 1310726, 2, 1310728, 536870920, 1310730, 536870913, 1310731, 1, 1310734, 536870913, 1310735, 536870916, 1310736, 10, 1310737, 10, 1310738, 10, 1310739, 10, 1310740, 10, 1310741, 10, 1310742, 10, 1310743, 4, 1310744, 1, 1310747, 8, 1310748, 7, 1310749, 536870919, 1310756, 536870914, 1310757, 10, 1310758, 10, 1310759, 10, 1310760, 10, 1310761, 10, 1310762, 10, 1310763, 10, 1310764, 10, 1310765, 10, 1310766, 4, 1310767, 5, 1310768, 12, 1310773, 7, 1310774, 536870919, 1310775, 7, 1310776, 536870919, 1310782, 536870914, 1310783, 10, 1310784, 10, 1310785, 10, 1310786, 10, 1310787, 10, 1310788, 10, 1310789, 10, 1310790, 10, 1310791, 10, 1310792, 10, 1310793, 10, 1376256, 10, 1376257, 10, 1376258, 10, 1376259, 10, 1376260, 10, 1376261, 10, 1376262, 4, 1376263, 0, 1376264, 0, 1376265, 0, 1376266, 536870916, 1376267, 4, 1376268, 0, 1376269, 0, 1376270, 536870916, 1376271, 10, 1376272, 10, 1376273, 10, 1376274, 10, 1376275, 10, 1376276, 10, 1376277, 10, 1376278, 10, 1376279, 10, 1376280, 4, 1376281, 12, 1376283, 8, 1376284, 8, 1376285, 536870920, 1376287, 536870924, 1376288, 0, 1376289, 5, 1376290, 536870917, 1376291, 0, 1376292, 536870916, 1376293, 10, 1376294, 10, 1376295, 10, 1376296, 10, 1376297, 10, 1376298, 10, 1376299, 10, 1376300, 10, 1376301, 10, 1376302, 10, 1376303, 10, 1376305, 12, 1376309, 7, 1376310, 536870920, 1376311, 7, 1376312, 536870920, 1376318, 536870914, 1376319, 10, 1376320, 10, 1376321, 10, 1376322, 10, 1376323, 10, 1376324, 10, 1376325, 10, 1376326, 10, 1376327, 10, 1376328, 10, 1441792, 10, 1441793, 10, 1441794, 10, 1441795, 10, 1441796, 10, 1441797, 10, 1441798, 10, 1441799, 10, 1441800, 10, 1441801, 10, 1441802, 10, 1441803, 10, 1441804, 10, 1441805, 10, 1441806, 10, 1441807, 10, 1441808, 10, 1441809, 10, 1441810, 10, 1441811, 10, 1441812, 10, 1441813, 10, 1441814, 10, 1441815, 10, 1441816, 10, 1441818, 0, 1441819, 6, 1441820, 6, 1441821, 536870918, 1441822, 5, 1441824, 10, 1441825, 10, 1441826, 10, 1441827, 10, 1441828, 10, 1441829, 10, 1441830, 10, 1441831, 10, 1441832, 10, 1441833, 10, 1441834, 10, 1441835, 10, 1441836, 10, 1441837, 10, 1441838, 10, 1441839, 10, 1441840, 10, 1441842, 0, 1441843, 0, 1441844, 0, 1441845, 6, 1441846, 536870918, 1441847, 6, 1441848, 536870918, 1441849, 0, 1441850, 5, 1441851, 536870917, 1441852, 5, 1441853, 0, 1441854, 536870916, 1441855, 10, 1441856, 10, 1441857, 10, 1441858, 10, 1441859, 10, 1441860, 10, 1441861, 10, 1441862, 10, 1441863, 10, 1507328, 10, 1507329, 10, 1507330, 10, 1507331, 10, 1507332, 10, 1507333, 10, 1507334, 10, 1507335, 10, 1507336, 10, 1507337, 10, 1507338, 10, 1507339, 10, 1507340, 10, 1507341, 10, 1507342, 10, 1507343, 10, 1507344, 10, 1507345, 10, 1507346, 10, 1507347, 10, 1507348, 10, 1507349, 10, 1507350, 10, 1507351, 10, 1507352, 10, 1507353, 10, 1507354, 10, 1507355, 10, 1507356, 10, 1507357, 10, 1507358, 10, 1507359, 10, 1507360, 10, 1507361, 10, 1507362, 10, 1507363, 10, 1507364, 10, 1507365, 10, 1507366, 10, 1507367, 10, 1507368, 10, 1507369, 10, 1507370, 10, 1507371, 10, 1507372, 10, 1507373, 10, 1507374, 10, 1507375, 10, 1507376, 10, 1507377, 10, 1507378, 10, 1507379, 10, 1507380, 10, 1507381, 10, 1507382, 10, 1507383, 10, 1507384, 10, 1507385, 10, 1507386, 10, 1507387, 10, 1507388, 10, 1507389, 10, 1507390, 10, 1507391, 10, 1507392, 10, 1507393, 10, 1507394, 10, 1507395, 10, 1507396, 10, 1507397, 10, 1507398, 10, 1507399, 10, 1572864, 10, 1572865, 10, 1572866, 10, 1572867, 10, 1572868, 10, 1572869, 10, 1572870, 10, 1572871, 10, 1572872, 10, 1572873, 10, 1572874, 10, 1572875, 10, 1572876, 10, 1572877, 10, 1572878, 10, 1572879, 10, 1572880, 10, 1572881, 10, 1572882, 10, 1572883, 10, 1572884, 10, 1572885, 10, 1572886, 10, 1572887, 10, 1572888, 10, 1572889, 10, 1572890, 10, 1572891, 10, 1572892, 10, 1572893, 10, 1572894, 10, 1572895, 10, 1572896, 10, 1572897, 10, 1572898, 10, 1572899, 10, 1572900, 10, 1572901, 10, 1572902, 10, 1572903, 10, 1572904, 10, 1572905, 10, 1572906, 10, 1572907, 10, 1572908, 10, 1572909, 10, 1572910, 10, 1572911, 10, 1572912, 10, 1572913, 10, 1572914, 10, 1572915, 10, 1572916, 10, 1572917, 10, 1572918, 10, 1572919, 10, 1572920, 10, 1572921, 10, 1572922, 10, 1572923, 10, 1572924, 10, 1572925, 10, 1572926, 10, 1572927, 10, 1572928, 10, 1572929, 10, 1572930, 10, 1572931, 10, 1572932, 10, 1572933, 10, 1572934, 10, 1572935, 10, 1638400, 10, 1638401, 10, 1638402, 10, 1638403, 10, 1638404, 10, 1638405, 10, 1638406, 10, 1638407, 10, 1638408, 10, 1638409, 10, 1638410, 10, 1638411, 10, 1638412, 10, 1638413, 10, 1638414, 10, 1638415, 10, 1638416, 10, 1638417, 10, 1638418, 10, 1638419, 10, 1638420, 10, 1638421, 10, 1638422, 10, 1638423, 10, 1638424, 10, 1638425, 10, 1638426, 10, 1638427, 10, 1638428, 10, 1638429, 10, 1638430, 10, 1638431, 10, 1638432, 10, 1638433, 10, 1638434, 10, 1638435, 10, 1638436, 10, 1638437, 10, 1638438, 10, 1638439, 10, 1638440, 10, 1638441, 10, 1638442, 10, 1638443, 10, 1638444, 10, 1638445, 10, 1638446, 10, 1638447, 10, 1638448, 10, 1638449, 10, 1638450, 10, 1638451, 10, 1638452, 10, 1638453, 10, 1638454, 10, 1638455, 10, 1638456, 10, 1638457, 10, 1638458, 10, 1638459, 10, 1638460, 10, 1638461, 10, 1638462, 10, 1638463, 10, 1638464, 10, 1638465, 10, 1638466, 10, 1638467, 10, 1638468, 10, 1638469, 10, 1638470, 10, 1638471, 10, 1703952, 10, 1703953, 10, 1703954, 10, 1703955, 10, 1703956, 10, 1703957, 10, 1703958, 10, 1703959, 10, 1703960, 10, 1703961, 10, 1703962, 10, 1703963, 10, 1703964, 10, 1703965, 10, 1703966, 10, 1703967, 10, 1703968, 10, 1703969, 10, 1703970, 10, 1703971, 10, 1703972, 10, 1703973, 10, 1703974, 10, 1703975, 10, 1703976, 10, 1703977, 10, 1703978, 10, 1703979, 10, 1703980, 10, 1703981, 10, 1703982, 10, 1703983, 10, 1703984, 10, 1703985, 10, 1703986, 10, 1703987, 10, 1703988, 10, 1703989, 10, 1703990, 10, 1703991, 10, 1703992, 10, 1703993, 10, 1703994, 10, 1703995, 10, 1703996, 10, 1703997, 10, 1703998, 10, 1703999, 10, 1704000, 10, 1704001, 10, 1704002, 10, 1704003, 10, 1704004, 10, 1704005, 10, 1704006, 10, 1704007, 10, 1769488, 10, 1769489, 10, 1769490, 10, 1769491, 10, 1769492, 10, 1769493, 10, 1769494, 10, 1769495, 10, 1769496, 10, 1769497, 10, 1769498, 10, 1769499, 10, 1769500, 10, 1769501, 10, 1769502, 10, 1769503, 10, 1769504, 10, 1769505, 10, 1769506, 10, 1769507, 10, 1769508, 10, 1769509, 10, 1769510, 10, 1769511, 10, 1769512, 10, 1769513, 10, 1769514, 10, 1769515, 10, 1769516, 10, 1769517, 10, 1769518, 10, 1769519, 10, 1769520, 10, 1769521, 10, 1769522, 10, 1769523, 10, 1769524, 10, 1769525, 10, 1769526, 10, 1769527, 10, 1769528, 10, 1769529, 10, 1769530, 10, 1769531, 10, 1769532, 10, 1769533, 10, 1769534, 10, 1769535, 10, 1769536, 10, 1769537, 10, 1769538, 10, 1769539, 10, 1769540, 10, 1769541, 10 </int_array> <dictionary shared="false"> <string> "_edit_lock_" </string> <bool> True </bool> </dictionary> <resource resource_type="PackedScene" path="res://coin.xml"> </resource> + <node_path> "" </node_path> <vector2> 672, 1179 </vector2> <dictionary shared="false"> <string> "__editor_plugin_screen__" </string> @@ -957,6 +926,7 @@ </dictionary> </dictionary> <resource resource_type="AudioStream" path="res://music.ogg"> </resource> + <bool> True </bool> <real> 2 </real> <resource resource_type="PackedScene" path="res://enemy.xml"> </resource> <vector2> 834.664, 1309.6 </vector2> diff --git a/demos/3d/platformer/player.gd b/demos/3d/platformer/player.gd index 4eeb12e23b..76cf2861bf 100644 --- a/demos/3d/platformer/player.gd +++ b/demos/3d/platformer/player.gd @@ -69,9 +69,9 @@ func _integrate_forces( state ): var lv = state.get_linear_velocity() # linear velocity var g = state.get_total_gravity() var delta = state.get_step() - var d = 1.0 - delta*state.get_total_density() - if (d<0): - d=0 +# var d = 1.0 - delta*state.get_total_density() +# if (d<0): +# d=0 lv += g * delta #apply gravity var anim = ANIM_FLOOR diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 7488d93fe1..cbc1188995 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<doc version="1.0.3917-beta1" name="Engine Types"> +<doc version="2.0.alpha.custom_build" name="Engine Types"> <class name="@GDScript" category="Core"> <brief_description> Built-in GDScript functions. @@ -312,6 +312,14 @@ Random range, any floating point value between 'from' and 'to' </description> </method> + <method name="seed"> + <return type="Nil"> + </return> + <argument index="0" name="seed" type="float"> + </argument> + <description> + </description> + </method> <method name="rand_seed"> <return type="Array"> </return> @@ -402,7 +410,7 @@ </description> </method> <method name="weakref"> - <return type="Object"> + <return type="WeakRef"> </return> <argument index="0" name="obj" type="Object"> </argument> @@ -411,7 +419,7 @@ </description> </method> <method name="funcref"> - <return type="Object"> + <return type="FuncRef"> </return> <argument index="0" name="instance" type="Object"> </argument> @@ -476,6 +484,16 @@ Print one or more arguments to the console with a tab between each argument. </description> </method> + <method name="prints"> + <return type="Nil"> + </return> + <argument index="0" name="what" type="var"> + </argument> + <argument index="1" name="..." type="var"> + </argument> + <description> + </description> + </method> <method name="printerr"> <return type="Nil"> </return> @@ -508,9 +526,9 @@ </description> </method> <method name="str2var:var"> - <return type="String"> + <return type="Nil"> </return> - <argument index="0" name="str" type="String"> + <argument index="0" name="string" type="String"> </argument> <description> Converts the value of a String to a variable. @@ -526,7 +544,7 @@ </description> </method> <method name="load"> - <return type="Object"> + <return type="Resource"> </return> <argument index="0" name="path" type="String"> </argument> @@ -568,6 +586,14 @@ Print a stack track at code location, only works when running with debugger turned on. </description> </method> + <method name="instance_from_id"> + <return type="Object"> + </return> + <argument index="0" name="instance_id" type="int"> + </argument> + <description> + </description> + </method> </methods> <constants> <constant name="PI" value="3.141593"> @@ -1178,6 +1204,8 @@ </constant> <constant name="KEY_MASK_CTRL" value="268435456"> </constant> + <constant name="KEY_MASK_CMD" value="268435456"> + </constant> <constant name="KEY_MASK_KPAD" value="536870912"> </constant> <constant name="KEY_MASK_GROUP_SWITCH" value="1073741824"> @@ -1379,51 +1407,53 @@ </constant> <constant name="ERR_FILE_CORRUPT" value="16"> </constant> - <constant name="ERR_FILE_EOF" value="17"> + <constant name="ERR_FILE_MISSING_DEPENDENCIES" value="17"> + </constant> + <constant name="ERR_FILE_EOF" value="18"> </constant> - <constant name="ERR_CANT_OPEN" value="18"> + <constant name="ERR_CANT_OPEN" value="19"> </constant> - <constant name="ERR_CANT_CREATE" value="19"> + <constant name="ERR_CANT_CREATE" value="20"> </constant> - <constant name="ERROR_QUERY_FAILED" value="20"> + <constant name="ERROR_QUERY_FAILED" value="21"> </constant> - <constant name="ERR_ALREADY_IN_USE" value="21"> + <constant name="ERR_ALREADY_IN_USE" value="22"> </constant> - <constant name="ERR_LOCKED" value="22"> + <constant name="ERR_LOCKED" value="23"> </constant> - <constant name="ERR_TIMEOUT" value="23"> + <constant name="ERR_TIMEOUT" value="24"> </constant> - <constant name="ERR_CANT_AQUIRE_RESOURCE" value="27"> + <constant name="ERR_CANT_AQUIRE_RESOURCE" value="28"> </constant> - <constant name="ERR_INVALID_DATA" value="29"> + <constant name="ERR_INVALID_DATA" value="30"> </constant> - <constant name="ERR_INVALID_PARAMETER" value="30"> + <constant name="ERR_INVALID_PARAMETER" value="31"> </constant> - <constant name="ERR_ALREADY_EXISTS" value="31"> + <constant name="ERR_ALREADY_EXISTS" value="32"> </constant> - <constant name="ERR_DOES_NOT_EXIST" value="32"> + <constant name="ERR_DOES_NOT_EXIST" value="33"> </constant> - <constant name="ERR_DATABASE_CANT_READ" value="33"> + <constant name="ERR_DATABASE_CANT_READ" value="34"> </constant> - <constant name="ERR_DATABASE_CANT_WRITE" value="34"> + <constant name="ERR_DATABASE_CANT_WRITE" value="35"> </constant> - <constant name="ERR_COMPILATION_FAILED" value="35"> + <constant name="ERR_COMPILATION_FAILED" value="36"> </constant> - <constant name="ERR_METHOD_NOT_FOUND" value="36"> + <constant name="ERR_METHOD_NOT_FOUND" value="37"> </constant> - <constant name="ERR_LINK_FAILED" value="37"> + <constant name="ERR_LINK_FAILED" value="38"> </constant> - <constant name="ERR_SCRIPT_FAILED" value="38"> + <constant name="ERR_SCRIPT_FAILED" value="39"> </constant> - <constant name="ERR_CYCLIC_LINK" value="39"> + <constant name="ERR_CYCLIC_LINK" value="40"> </constant> - <constant name="ERR_BUSY" value="43"> + <constant name="ERR_BUSY" value="44"> </constant> - <constant name="ERR_HELP" value="45"> + <constant name="ERR_HELP" value="46"> </constant> - <constant name="ERR_BUG" value="46"> + <constant name="ERR_BUG" value="47"> </constant> - <constant name="ERR_WTF" value="48"> + <constant name="ERR_WTF" value="49"> </constant> <constant name="PROPERTY_HINT_NONE" value="0"> No hint for edited property. @@ -1441,34 +1471,37 @@ </constant> <constant name="PROPERTY_HINT_LENGTH" value="5"> </constant> - <constant name="PROPERTY_HINT_KEY_ACCEL" value="6"> + <constant name="PROPERTY_HINT_KEY_ACCEL" value="7"> </constant> - <constant name="PROPERTY_HINT_FLAGS" value="7"> + <constant name="PROPERTY_HINT_FLAGS" value="8"> Property hint for a bitmask description, for bits 0,1,2,3 and 5 the hint would be like "Bit0,Bit1,Bit2,Bit3,,Bit5". Valid only for integers. </constant> - <constant name="PROPERTY_HINT_ALL_FLAGS" value="8"> + <constant name="PROPERTY_HINT_ALL_FLAGS" value="9"> Property hint for a bitmask description that covers all 32 bits. Valid only for integers. </constant> - <constant name="PROPERTY_HINT_FILE" value="9"> + <constant name="PROPERTY_HINT_FILE" value="10"> String property is a file (so pop up a file dialog when edited). Hint string can be a set of wildcards like "*.doc". </constant> - <constant name="PROPERTY_HINT_DIR" value="10"> + <constant name="PROPERTY_HINT_DIR" value="11"> String property is a directory (so pop up a file dialog when edited). </constant> - <constant name="PROPERTY_HINT_GLOBAL_FILE" value="11"> + <constant name="PROPERTY_HINT_GLOBAL_FILE" value="12"> </constant> - <constant name="PROPERTY_HINT_GLOBAL_DIR" value="12"> + <constant name="PROPERTY_HINT_GLOBAL_DIR" value="13"> </constant> - <constant name="PROPERTY_HINT_RESOURCE_TYPE" value="13"> + <constant name="PROPERTY_HINT_RESOURCE_TYPE" value="14"> String property is a resource, so open the resource popup menu when edited. </constant> - <constant name="PROPERTY_HINT_MULTILINE_TEXT" value="14"> + <constant name="PROPERTY_HINT_MULTILINE_TEXT" value="15"> </constant> - <constant name="PROPERTY_HINT_COLOR_NO_ALPHA" value="15"> + <constant name="PROPERTY_HINT_COLOR_NO_ALPHA" value="16"> </constant> - <constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSY" value="16"> + <constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSY" value="17"> </constant> - <constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS" value="17"> + <constant name="PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS" value="18"> + </constant> + <constant name="PROPERTY_USAGE_STORAGE" value="1"> + Property will be used as storage (default). </constant> <constant name="PROPERTY_USAGE_STORAGE" value="1"> Property will be used as storage (default). @@ -1737,6 +1770,8 @@ </description> </method> <method name="AABB"> + <return type="AABB"> + </return> <argument index="0" name="pos" type="Vector3"> </argument> <argument index="1" name="size" type="Vector3"> @@ -1959,6 +1994,12 @@ </description> </method> </methods> + <signals> + <signal name="frame_changed"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> @@ -1993,6 +2034,12 @@ </description> </method> </methods> + <signals> + <signal name="frame_changed"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> @@ -2472,9 +2519,18 @@ Play a given animation by the animation name. Custom speed and blend times can be set. If custom speed is negative (-1), 'from_end' being true can play the animation backwards. </description> </method> + <method name="play_backwards"> + <argument index="0" name="name" type="String" default=""""> + </argument> + <argument index="1" name="custom_blend" type="float" default="-1"> + </argument> + <description> + </description> + </method> <method name="stop"> + <argument index="0" name="reset" type="bool" default="true"> + </argument> <description> - Stop the currently played animation. </description> </method> <method name="stop_all"> @@ -3123,6 +3179,18 @@ <description> </description> </method> + <method name="set_master_player"> + <argument index="0" name="nodepath" type="NodePath"> + </argument> + <description> + </description> + </method> + <method name="get_master_player" qualifiers="const"> + <return type="NodePath"> + </return> + <description> + </description> + </method> <method name="get_node_list"> <return type="StringArray"> </return> @@ -3191,6 +3259,18 @@ <description> </description> </method> + <method name="set_gravity_distance_scale"> + <argument index="0" name="distance_scale" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_gravity_distance_scale" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="set_gravity_vector"> <argument index="0" name="vector" type="Vector3"> </argument> @@ -3215,13 +3295,25 @@ <description> </description> </method> - <method name="set_density"> - <argument index="0" name="density" type="float"> + <method name="set_angular_damp"> + <argument index="0" name="angular_damp" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_angular_damp" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_linear_damp"> + <argument index="0" name="linear_damp" type="float"> </argument> <description> </description> </method> - <method name="get_density" qualifiers="const"> + <method name="get_linear_damp" qualifiers="const"> <return type="float"> </return> <description> @@ -3239,6 +3331,18 @@ <description> </description> </method> + <method name="set_monitorable"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_monitorable" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="set_enable_monitoring"> <argument index="0" name="enable" type="bool"> </argument> @@ -3257,6 +3361,28 @@ <description> </description> </method> + <method name="get_overlapping_areas" qualifiers="const"> + <return type="Array"> + </return> + <description> + </description> + </method> + <method name="overlaps_body" qualifiers="const"> + <return type="PhysicsBody"> + </return> + <argument index="0" name="body" type="Object"> + </argument> + <description> + </description> + </method> + <method name="overlaps_area" qualifiers="const"> + <return type="Area"> + </return> + <argument index="0" name="area" type="Object"> + </argument> + <description> + </description> + </method> </methods> <signals> <signal name="body_enter"> @@ -3277,6 +3403,24 @@ <description> </description> </signal> + <signal name="area_enter"> + <argument index="0" name="area" type="Object"> + </argument> + <description> + </description> + </signal> + <signal name="area_enter_shape"> + <argument index="0" name="area_id" type="int"> + </argument> + <argument index="1" name="area" type="Object"> + </argument> + <argument index="2" name="area_shape" type="int"> + </argument> + <argument index="3" name="area_shape" type="int"> + </argument> + <description> + </description> + </signal> <signal name="body_exit"> <argument index="0" name="body" type="Object"> </argument> @@ -3295,6 +3439,24 @@ <description> </description> </signal> + <signal name="area_exit"> + <argument index="0" name="area" type="Object"> + </argument> + <description> + </description> + </signal> + <signal name="area_exit_shape"> + <argument index="0" name="area_id" type="int"> + </argument> + <argument index="1" name="area" type="Object"> + </argument> + <argument index="2" name="area_shape" type="int"> + </argument> + <argument index="3" name="area_shape" type="int"> + </argument> + <description> + </description> + </signal> </signals> <constants> </constants> @@ -3333,6 +3495,18 @@ Return if gravity is a point. When overriding space parameters, areas can have a center of gravity as a point. </description> </method> + <method name="set_gravity_distance_scale"> + <argument index="0" name="distance_scale" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_gravity_distance_scale" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="set_gravity_vector"> <argument index="0" name="vector" type="Vector2"> </argument> @@ -3358,13 +3532,25 @@ <description> </description> </method> - <method name="set_density"> - <argument index="0" name="density" type="float"> + <method name="set_linear_damp"> + <argument index="0" name="linear_damp" type="float"> </argument> <description> </description> </method> - <method name="get_density" qualifiers="const"> + <method name="get_linear_damp" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_angular_damp"> + <argument index="0" name="angular_damp" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_angular_damp" qualifiers="const"> <return type="float"> </return> <description> @@ -3382,6 +3568,62 @@ <description> </description> </method> + <method name="set_collision_mask"> + <argument index="0" name="collision_mask" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_collision_mask" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_layer_mask"> + <argument index="0" name="layer_mask" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_layer_mask" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_collision_mask_bit"> + <argument index="0" name="bit" type="int"> + </argument> + <argument index="1" name="value" type="bool"> + </argument> + <description> + </description> + </method> + <method name="get_collision_mask_bit" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="bit" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_layer_mask_bit"> + <argument index="0" name="bit" type="int"> + </argument> + <argument index="1" name="value" type="bool"> + </argument> + <description> + </description> + </method> + <method name="get_layer_mask_bit" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="bit" type="int"> + </argument> + <description> + </description> + </method> <method name="set_enable_monitoring"> <argument index="0" name="enable" type="bool"> </argument> @@ -3394,12 +3636,46 @@ <description> </description> </method> + <method name="set_monitorable"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_monitorable" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="get_overlapping_bodies" qualifiers="const"> <return type="Array"> </return> <description> </description> </method> + <method name="get_overlapping_areas" qualifiers="const"> + <return type="Array"> + </return> + <description> + </description> + </method> + <method name="overlaps_body" qualifiers="const"> + <return type="PhysicsBody2D"> + </return> + <argument index="0" name="body" type="Object"> + </argument> + <description> + </description> + </method> + <method name="overlaps_area" qualifiers="const"> + <return type="Area2D"> + </return> + <argument index="0" name="area" type="Object"> + </argument> + <description> + </description> + </method> </methods> <signals> <signal name="body_enter"> @@ -3420,6 +3696,24 @@ <description> </description> </signal> + <signal name="area_enter"> + <argument index="0" name="area" type="Object"> + </argument> + <description> + </description> + </signal> + <signal name="area_enter_shape"> + <argument index="0" name="area_id" type="int"> + </argument> + <argument index="1" name="area" type="Object"> + </argument> + <argument index="2" name="area_shape" type="int"> + </argument> + <argument index="3" name="area_shape" type="int"> + </argument> + <description> + </description> + </signal> <signal name="body_exit"> <argument index="0" name="body" type="Object"> </argument> @@ -3438,6 +3732,24 @@ <description> </description> </signal> + <signal name="area_exit"> + <argument index="0" name="area" type="Object"> + </argument> + <description> + </description> + </signal> + <signal name="area_exit_shape"> + <argument index="0" name="area_id" type="int"> + </argument> + <argument index="1" name="area" type="Object"> + </argument> + <argument index="2" name="area_shape" type="int"> + </argument> + <argument index="3" name="area_shape" type="int"> + </argument> + <description> + </description> + </signal> </signals> <constants> </constants> @@ -3502,6 +3814,12 @@ <description> </description> </method> + <method name="is_shared"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="push_back"> <argument index="0" name="value" type="var"> </argument> @@ -3543,6 +3861,8 @@ </description> </method> <method name="Array"> + <return type="Array"> + </return> <argument index="0" name="from" type="RawArray"> </argument> <description> @@ -3550,6 +3870,8 @@ </description> </method> <method name="Array"> + <return type="Array"> + </return> <argument index="0" name="from" type="IntArray"> </argument> <description> @@ -3557,6 +3879,8 @@ </description> </method> <method name="Array"> + <return type="Array"> + </return> <argument index="0" name="from" type="RealArray"> </argument> <description> @@ -3564,6 +3888,8 @@ </description> </method> <method name="Array"> + <return type="Array"> + </return> <argument index="0" name="from" type="StringArray"> </argument> <description> @@ -3571,6 +3897,8 @@ </description> </method> <method name="Array"> + <return type="Array"> + </return> <argument index="0" name="from" type="Vector2Array"> </argument> <description> @@ -3578,6 +3906,8 @@ </description> </method> <method name="Array"> + <return type="Array"> + </return> <argument index="0" name="from" type="Vector3Array"> </argument> <description> @@ -3585,6 +3915,8 @@ </description> </method> <method name="Array"> + <return type="Array"> + </return> <argument index="0" name="from" type="ColorArray"> </argument> <description> @@ -4129,63 +4461,84 @@ Base class for audio streams. Audio streams are used for music playback, or other types of streamed sounds that don't fit or requiere more flexibility than a [Sample]. </description> <methods> + </methods> + <constants> + </constants> +</class> +<class name="AudioStreamMPC" inherits="AudioStream" category="Core"> + <brief_description> + MusePack audio stream driver. + </brief_description> + <description> + MusePack audio stream driver. + </description> + <methods> + </methods> + <constants> + </constants> +</class> +<class name="AudioStreamOGGVorbis" inherits="AudioStream" category="Core"> + <brief_description> + OGG Vorbis audio stream driver. + </brief_description> + <description> + OGG Vorbis audio stream driver. + </description> + <methods> + </methods> + <constants> + </constants> +</class> +<class name="AudioStreamPlayback" inherits="Reference" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> <method name="play"> + <argument index="0" name="from_pos_sec" type="float" default="0"> + </argument> <description> - Start playback of an audio stream. </description> </method> <method name="stop"> <description> - Stop playback of an audio stream. </description> </method> <method name="is_playing" qualifiers="const"> <return type="bool"> </return> <description> - Return wether the audio stream is currently playing. </description> </method> <method name="set_loop"> <argument index="0" name="enabled" type="bool"> </argument> <description> - Set the loop hint for the audio stream playback. if true, audio stream will attempt to loop (restart) when finished. </description> </method> <method name="has_loop" qualifiers="const"> <return type="bool"> </return> <description> - Return wether the audio stream loops. See [method set_loop] - </description> - </method> - <method name="get_stream_name" qualifiers="const"> - <return type="String"> - </return> - <description> - Return the name of the audio stream. Often the song title when the stream is music. </description> </method> <method name="get_loop_count" qualifiers="const"> <return type="int"> </return> <description> - Return the amount of times that the stream has looped (if loop is supported). </description> </method> <method name="seek_pos"> <argument index="0" name="pos" type="float"> </argument> <description> - Seek to a certain position (in seconds) in an audio stream. </description> </method> <method name="get_pos" qualifiers="const"> <return type="float"> </return> <description> - Return the current playing position (in seconds) of the audio stream (if supported). Since this value is updated internally, it may not be exact or updated continuosly. Accuracy depends on the sample buffer size of the audio driver. </description> </method> <method name="get_length" qualifiers="const"> @@ -4194,173 +4547,78 @@ <description> </description> </method> - <method name="get_update_mode" qualifiers="const"> + <method name="get_channels" qualifiers="const"> <return type="int"> </return> <description> - Return the type of update that the stream uses. Some types of stream may need manual polling. </description> </method> - <method name="update"> + <method name="get_mix_rate" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_minimum_buffer_size" qualifiers="const"> + <return type="int"> + </return> <description> - Manually poll the audio stream (if it is requested to). </description> </method> </methods> <constants> - <constant name="UPDATE_NONE" value="0"> - Does not need update, or manual polling. - </constant> - <constant name="UPDATE_IDLE" value="1"> - Stream is updated on the main thread, when idle. - </constant> - <constant name="UPDATE_THREAD" value="2"> - Stream is updated on its own thread. - </constant> </constants> </class> -<class name="AudioStreamGibberish" inherits="AudioStream" category="Core"> +<class name="AudioStreamSpeex" inherits="AudioStream" category="Core"> <brief_description> - Simple gibberish speech stream playback. + Speex audio stream driver. </brief_description> <description> - AudioStream used for gibberish playback. It plays randomized phonemes, which can be used to accompany text dialogs. + Speex audio stream driver. Speex is very useful for compressed speech. It allows loading a very large amount of speech in memory at little IO/latency cost. </description> <methods> - <method name="set_phonemes"> - <argument index="0" name="phonemes" type="Object"> - </argument> - <description> - Set the phoneme library. - </description> - </method> - <method name="get_phonemes" qualifiers="const"> - <return type="Object"> - </return> - <description> - Return the phoneme library. - </description> - </method> - <method name="set_pitch_scale"> - <argument index="0" name="pitch_scale" type="float"> - </argument> - <description> - Set pitch scale for the speech. Animating this value holds amusing results. - </description> - </method> - <method name="get_pitch_scale" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the pitch scale. - </description> - </method> - <method name="set_pitch_random_scale"> - <argument index="0" name="pitch_random_scale" type="float"> - </argument> - <description> - Set the random scaling for the pitch. - </description> - </method> - <method name="get_pitch_random_scale" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the pitch random scaling. - </description> - </method> - <method name="set_xfade_time"> - <argument index="0" name="sec" type="float"> - </argument> - <description> - Set the cross-fade time between random phonemes. - </description> - </method> - <method name="get_xfade_time" qualifiers="const"> - <return type="float"> - </return> - <description> - Return the cross-fade time between random phonemes. - </description> - </method> </methods> <constants> </constants> </class> -<class name="AudioStreamMPC" inherits="AudioStreamResampled" category="Core"> +<class name="BackBufferCopy" inherits="Node2D" category="Core"> <brief_description> - MusePack audio stream driver. </brief_description> <description> - MusePack audio stream driver. </description> <methods> - <method name="set_file"> - <argument index="0" name="name" type="String"> + <method name="set_rect"> + <argument index="0" name="rect" type="Rect2"> </argument> <description> - Set the file to be played. </description> </method> - <method name="get_file" qualifiers="const"> - <return type="String"> + <method name="get_rect" qualifiers="const"> + <return type="Rect2"> </return> <description> - Return the file being played. </description> </method> - </methods> - <constants> - </constants> -</class> -<class name="AudioStreamOGGVorbis" inherits="AudioStreamResampled" category="Core"> - <brief_description> - OGG Vorbis audio stream driver. - </brief_description> - <description> - OGG Vorbis audio stream driver. - </description> - <methods> - </methods> - <constants> - </constants> -</class> -<class name="AudioStreamResampled" inherits="AudioStream" category="Core"> - <brief_description> - Base class for resampled audio streams. - </brief_description> - <description> - Base class for resampled audio streams. - </description> - <methods> - </methods> - <constants> - </constants> -</class> -<class name="AudioStreamSpeex" inherits="AudioStreamResampled" category="Core"> - <brief_description> - Speex audio stream driver. - </brief_description> - <description> - Speex audio stream driver. Speex is very useful for compressed speech. It allows loading a very large amount of speech in memory at little IO/latency cost. - </description> - <methods> - <method name="set_file"> - <argument index="0" name="file" type="String"> + <method name="set_copy_mode"> + <argument index="0" name="copy_mode" type="int"> </argument> <description> - Set the speech file (which is loaded to memory). </description> </method> - <method name="get_file" qualifiers="const"> - <return type="String"> + <method name="get_copy_mode" qualifiers="const"> + <return type="int"> </return> <description> - Return the speech file. </description> </method> </methods> <constants> + <constant name="COPY_MODE_DISABLED" value="0"> + </constant> + <constant name="COPY_MODE_RECT" value="1"> + </constant> + <constant name="COPY_MODE_VIEWPORT" value="2"> + </constant> </constants> </class> <class name="BakedLight" inherits="Resource" category="Core"> @@ -4739,6 +4997,16 @@ BaseButton is the abstract base class for buttons, so it shouldn't be used directly (It doesnt display anything). Other types of buttons inherit from it. </description> <methods> + <method name="_pressed" qualifiers="virtual"> + <description> + </description> + </method> + <method name="_toggled" qualifiers="virtual"> + <argument index="0" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> <method name="set_pressed"> <argument index="0" name="pressed" type="bool"> </argument> @@ -4750,7 +5018,7 @@ <return type="bool"> </return> <description> - Return when the button is pressed (only if toggle_mode is active). + If toggle_mode is active, return whether the button is toggled. If toggle_mode is not active, return whether the button is pressed down. </description> </method> <method name="is_hovered" qualifiers="const"> @@ -4914,8 +5182,26 @@ Base class for Box containers. It arranges children controls vertically or horizontally, and rearranges them automatically when their minimum size changes. </description> <methods> + <method name="get_alignment" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_alignment"> + <argument index="0" name="alignment" type="int"> + </argument> + <description> + </description> + </method> </methods> <constants> + <constant name="ALIGN_BEGIN" value="0"> + </constant> + <constant name="ALIGN_CENTER" value="1"> + </constant> + <constant name="ALIGN_END" value="2"> + </constant> </constants> </class> <class name="BoxShape" inherits="Shape" category="Core"> @@ -5262,6 +5548,14 @@ Return how a 3D point in worldpsace maps to a 2D coordinate in the [Viewport] rectangle. </description> </method> + <method name="is_position_behind" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="world_point" type="Vector3"> + </argument> + <description> + </description> + </method> <method name="project_position" qualifiers="const"> <return type="Vector3"> </return> @@ -5357,24 +5651,6 @@ <description> </description> </method> - <method name="look_at"> - <argument index="0" name="target" type="Vector3"> - </argument> - <argument index="1" name="up" type="Vector3"> - </argument> - <description> - </description> - </method> - <method name="look_at_from_pos"> - <argument index="0" name="pos" type="Vector3"> - </argument> - <argument index="1" name="target" type="Vector3"> - </argument> - <argument index="2" name="up" type="Vector3"> - </argument> - <description> - </description> - </method> <method name="set_environment"> <argument index="0" name="env" type="Environment"> </argument> @@ -5436,18 +5712,16 @@ Return the scroll offset. </description> </method> - <method name="set_centered"> - <argument index="0" name="centered" type="bool"> + <method name="set_anchor_mode"> + <argument index="0" name="anchor_mode" type="int"> </argument> <description> - Set to true if the camera is at the center of the screen (default: true). </description> </method> - <method name="is_centered" qualifiers="const"> - <return type="bool"> + <method name="get_anchor_mode" qualifiers="const"> + <return type="int"> </return> <description> - Return true if the camera is at the center of the screen (default: true). </description> </method> <method name="set_rotating"> @@ -5467,6 +5741,10 @@ Make this the current 2D camera for the scene (viewport and layer), in case there's many cameras in the scene. </description> </method> + <method name="clear_current"> + <description> + </description> + </method> <method name="is_current" qualifiers="const"> <return type="bool"> </return> @@ -5602,6 +5880,10 @@ </method> </methods> <constants> + <constant name="ANCHOR_MODE_DRAG_CENTER" value="1"> + </constant> + <constant name="ANCHOR_MODE_FIXED_TOP_LEFT" value="0"> + </constant> </constants> </class> <class name="CanvasItem" inherits="Node" category="Core"> @@ -5716,6 +5998,18 @@ Return the current blending mode from enum BLEND_MODE_*. </description> </method> + <method name="set_light_mask"> + <argument index="0" name="light_mask" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_light_mask" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> <method name="set_opacity"> <argument index="0" name="opacity" type="float"> </argument> @@ -5745,7 +6039,7 @@ </description> </method> <method name="set_draw_behind_parent"> - <argument index="0" name="enabe" type="bool"> + <argument index="0" name="enable" type="bool"> </argument> <description> Sets whether the canvas item is drawn behind its parent. @@ -5805,7 +6099,7 @@ </argument> <argument index="1" name="rect" type="Rect2"> </argument> - <argument index="2" name="tile" type="bool" default="false"> + <argument index="2" name="tile" type="bool"> </argument> <argument index="3" name="modulate" type="Color" default="Color(1,1,1,1)"> </argument> @@ -5935,6 +6229,12 @@ <description> </description> </method> + <method name="get_global_transform_with_canvas" qualifiers="const"> + <return type="Matrix32"> + </return> + <description> + </description> + </method> <method name="get_viewport_transform" qualifiers="const"> <return type="Matrix32"> </return> @@ -5947,6 +6247,24 @@ <description> </description> </method> + <method name="get_canvas_transform" qualifiers="const"> + <return type="Matrix32"> + </return> + <description> + </description> + </method> + <method name="get_local_mouse_pos" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="get_global_mouse_pos" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> <method name="get_canvas" qualifiers="const"> <return type="RID"> </return> @@ -5959,6 +6277,38 @@ <description> </description> </method> + <method name="set_material"> + <argument index="0" name="material" type="CanvasItemMaterial"> + </argument> + <description> + </description> + </method> + <method name="get_material" qualifiers="const"> + <return type="CanvasItemMaterial"> + </return> + <description> + </description> + </method> + <method name="set_use_parent_material"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="get_use_parent_material" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="make_input_local" qualifiers="const"> + <return type="InputEvent"> + </return> + <argument index="0" name="event" type="InputEvent"> + </argument> + <description> + </description> + </method> </methods> <signals> <signal name="item_rect_changed"> @@ -6015,6 +6365,80 @@ </constant> </constants> </class> +<class name="CanvasItemMaterial" inherits="Resource" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_shader"> + <argument index="0" name="shader" type="Shader"> + </argument> + <description> + </description> + </method> + <method name="get_shader" qualifiers="const"> + <return type="Shader"> + </return> + <description> + </description> + </method> + <method name="set_shader_param"> + <argument index="0" name="param" type="String"> + </argument> + <argument index="1" name="value" type="var"> + </argument> + <description> + </description> + </method> + <method name="get_shader_param" qualifiers="const"> + <argument index="0" name="param" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_shading_mode"> + <argument index="0" name="mode" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_shading_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + </methods> + <constants> + <constant name="SHADING_NORMAL" value="0"> + </constant> + <constant name="SHADING_UNSHADED" value="1"> + </constant> + <constant name="SHADING_ONLY_LIGHT" value="2"> + </constant> + </constants> +</class> +<class name="CanvasItemShader" inherits="Shader" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + </methods> + <constants> + </constants> +</class> +<class name="CanvasItemShaderGraph" inherits="ShaderGraph" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + </methods> + <constants> + </constants> +</class> <class name="CanvasLayer" inherits="Node" category="Core"> <brief_description> Canvas Item layer. @@ -6111,6 +6535,28 @@ <constants> </constants> </class> +<class name="CanvasModulate" inherits="Node2D" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_color"> + <argument index="0" name="color" type="Color"> + </argument> + <description> + </description> + </method> + <method name="get_color" qualifiers="const"> + <return type="Color"> + </return> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="CapsuleShape" inherits="Shape" category="Core"> <brief_description> Capsule shape resource. @@ -6215,6 +6661,50 @@ <constants> </constants> </class> +<class name="CheckBox" inherits="Button" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + </methods> + <constants> + </constants> + <theme_items> + <theme_item name="check_vadjust" type="int"> + </theme_item> + <theme_item name="hseparation" type="int"> + </theme_item> + <theme_item name="font_color_disabled" type="Color"> + </theme_item> + <theme_item name="font_color" type="Color"> + </theme_item> + <theme_item name="font_color_hover" type="Color"> + </theme_item> + <theme_item name="font_color_pressed" type="Color"> + </theme_item> + <theme_item name="radio_checked" type="Texture"> + </theme_item> + <theme_item name="checked" type="Texture"> + </theme_item> + <theme_item name="radio_unchecked" type="Texture"> + </theme_item> + <theme_item name="unchecked" type="Texture"> + </theme_item> + <theme_item name="font" type="Font"> + </theme_item> + <theme_item name="hover" type="StyleBox"> + </theme_item> + <theme_item name="pressed" type="StyleBox"> + </theme_item> + <theme_item name="focus" type="StyleBox"> + </theme_item> + <theme_item name="disabled" type="StyleBox"> + </theme_item> + <theme_item name="normal" type="StyleBox"> + </theme_item> + </theme_items> +</class> <class name="CheckButton" inherits="Button" category="Core"> <brief_description> Checkable button. @@ -6441,6 +6931,16 @@ 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 ant not present outside the editor, so code should use the regular shape API. </description> <methods> + <method name="_input_event" qualifiers="virtual"> + <argument index="0" name="viewport" type="Object"> + </argument> + <argument index="1" name="event" type="InputEvent"> + </argument> + <argument index="2" name="shape_idx" type="int"> + </argument> + <description> + </description> + </method> <method name="add_shape"> <argument index="0" name="shape" type="Shape2D"> </argument> @@ -6528,7 +7028,39 @@ Return the RID of the object. </description> </method> + <method name="set_pickable"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_pickable" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> </methods> + <signals> + <signal name="mouse_enter"> + <description> + </description> + </signal> + <signal name="input_event"> + <argument index="0" name="viewport" type="Object"> + </argument> + <argument index="1" name="event" type="InputEvent"> + </argument> + <argument index="2" name="shape_idx" type="int"> + </argument> + <description> + </description> + </signal> + <signal name="mouse_exit"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> @@ -6538,14 +7070,14 @@ <description> </description> <methods> - <method name="set_polygon"> - <argument index="0" name="polygon" type="Vector2Array"> + <method name="set_build_mode"> + <argument index="0" name="arg0" type="int"> </argument> <description> </description> </method> - <method name="get_polygon" qualifiers="const"> - <return type="Vector2Array"> + <method name="get_build_mode" qualifiers="const"> + <return type="int"> </return> <description> </description> @@ -6562,13 +7094,25 @@ <description> </description> </method> - <method name="set_build_mode"> - <argument index="0" name="arg0" type="int"> + <method name="set_polygon"> + <argument index="0" name="polygon" type="Vector2Array"> </argument> <description> </description> </method> - <method name="get_build_mode" qualifiers="const"> + <method name="get_polygon" qualifiers="const"> + <return type="Vector2Array"> + </return> + <description> + </description> + </method> + <method name="get_collision_object_first_shape" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_collision_object_last_shape" qualifiers="const"> <return type="int"> </return> <description> @@ -6586,6 +7130,54 @@ Editor-Only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. This class is for editing custom shape polygons. </description> <methods> + <method name="set_polygon"> + <argument index="0" name="polygon" type="Vector2Array"> + </argument> + <description> + </description> + </method> + <method name="get_polygon" qualifiers="const"> + <return type="Vector2Array"> + </return> + <description> + </description> + </method> + <method name="set_build_mode"> + <argument index="0" name="arg0" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_build_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_trigger"> + <argument index="0" name="arg0" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_trigger" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="get_collision_object_first_shape" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_collision_object_last_shape" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -6596,6 +7188,46 @@ <description> </description> <methods> + <method name="resource_changed"> + <argument index="0" name="arg0" type="Object"> + </argument> + <description> + </description> + </method> + <method name="set_shape"> + <argument index="0" name="shape" type="Object"> + </argument> + <description> + </description> + </method> + <method name="get_shape" qualifiers="const"> + <return type="Object"> + </return> + <description> + </description> + </method> + <method name="set_trigger"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_trigger" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="make_convex_from_brothers"> + <description> + </description> + </method> + <method name="get_collision_object_shape_index" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -6608,6 +7240,36 @@ Editor-Only class. This is not present when running the game. It's used in the editor to properly edit and position collision shapes in [CollisionObject2D]. This is not accessible from regular code. </description> <methods> + <method name="set_shape"> + <argument index="0" name="shape" type="Object"> + </argument> + <description> + </description> + </method> + <method name="get_shape" qualifiers="const"> + <return type="Object"> + </return> + <description> + </description> + </method> + <method name="set_trigger"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_trigger" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="get_collision_object_shape_index" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -6684,6 +7346,8 @@ </description> </method> <method name="Color"> + <return type="Color"> + </return> <argument index="0" name="r" type="float"> </argument> <argument index="1" name="g" type="float"> @@ -6697,6 +7361,8 @@ </description> </method> <method name="Color"> + <return type="Color"> + </return> <argument index="0" name="r" type="float"> </argument> <argument index="1" name="g" type="float"> @@ -6708,6 +7374,8 @@ </description> </method> <method name="Color"> + <return type="Color"> + </return> <argument index="0" name="from" type="int"> </argument> <description> @@ -6715,6 +7383,8 @@ </description> </method> <method name="Color"> + <return type="Color"> + </return> <argument index="0" name="from" type="String"> </argument> <description> @@ -6789,6 +7459,8 @@ </description> </method> <method name="ColorArray"> + <return type="ColorArray"> + </return> <argument index="0" name="from" type="Array"> </argument> <description> @@ -6936,6 +7608,40 @@ </theme_item> </theme_items> </class> +<class name="ColorRamp" inherits="Resource" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_offsets"> + <argument index="0" name="offsets" type="RealArray"> + </argument> + <description> + </description> + </method> + <method name="get_offsets" qualifiers="const"> + <return type="RealArray"> + </return> + <description> + </description> + </method> + <method name="set_colors"> + <argument index="0" name="colors" type="ColorArray"> + </argument> + <description> + </description> + </method> + <method name="get_colors" qualifiers="const"> + <return type="ColorArray"> + </return> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="ConcavePolygonShape" inherits="Shape" category="Core"> <brief_description> Concave polygon shape. @@ -7083,7 +7789,7 @@ </description> </method> <method name="load"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="path" type="String"> </argument> @@ -7091,7 +7797,7 @@ </description> </method> <method name="save"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="path" type="String"> </argument> @@ -7694,6 +8400,12 @@ <description> </description> </method> + <method name="warp_mouse"> + <argument index="0" name="to_pos" type="Vector2"> + </argument> + <description> + </description> + </method> </methods> <signals> <signal name="focus_enter"> @@ -7727,6 +8439,8 @@ </description> </signal> <signal name="input_event"> + <argument index="0" name="ev" type="InputEvent"> + </argument> <description> Emitted when an input event is received. Connecting in realtime is recommended for accepting the events. </description> @@ -8114,6 +8828,16 @@ <description> </description> </method> + <method name="tesselate" qualifiers="const"> + <return type="Vector2Array"> + </return> + <argument index="0" name="max_stages" type="int" default="5"> + </argument> + <argument index="1" name="tolerance_degrees" type="float" default="4"> + </argument> + <description> + </description> + </method> </methods> <constants> </constants> @@ -8270,6 +8994,16 @@ <description> </description> </method> + <method name="tesselate" qualifiers="const"> + <return type="Vector3Array"> + </return> + <argument index="0" name="max_stages" type="int" default="5"> + </argument> + <argument index="1" name="tolerance_degrees" type="float" default="4"> + </argument> + <description> + </description> + </method> </methods> <constants> </constants> @@ -8478,7 +9212,7 @@ </description> <methods> <method name="open"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="path" type="String"> </argument> @@ -8522,7 +9256,7 @@ </description> </method> <method name="change_dir"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="todir" type="String"> </argument> @@ -8536,7 +9270,7 @@ </description> </method> <method name="make_dir"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="name" type="String"> </argument> @@ -8544,7 +9278,7 @@ </description> </method> <method name="make_dir_recursive"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="name" type="String"> </argument> @@ -8574,7 +9308,7 @@ </description> </method> <method name="copy"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="from" type="String"> </argument> @@ -8584,7 +9318,7 @@ </description> </method> <method name="rename"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="from" type="String"> </argument> @@ -8594,7 +9328,7 @@ </description> </method> <method name="remove"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="file" type="String"> </argument> @@ -8605,6 +9339,154 @@ <constants> </constants> </class> +<class name="EditorFileDialog" inherits="ConfirmationDialog" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="clear_filters"> + <description> + </description> + </method> + <method name="add_filter"> + <argument index="0" name="filter" type="String"> + </argument> + <description> + </description> + </method> + <method name="get_current_dir" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_current_file" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_current_path" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_current_dir"> + <argument index="0" name="dir" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_current_file"> + <argument index="0" name="file" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_current_path"> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_mode"> + <argument index="0" name="mode" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_vbox"> + <return type="VBoxContainer"> + </return> + <description> + </description> + </method> + <method name="set_access"> + <argument index="0" name="access" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_access" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_show_hidden_files"> + <argument index="0" name="arg0" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_showing_hidden_files" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_display_mode"> + <argument index="0" name="mode" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_display_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="invalidate"> + <description> + </description> + </method> + </methods> + <signals> + <signal name="files_selected"> + <argument index="0" name="paths" type="StringArray"> + </argument> + <description> + </description> + </signal> + <signal name="dir_selected"> + <argument index="0" name="dir" type="String"> + </argument> + <description> + </description> + </signal> + <signal name="file_selected"> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </signal> + </signals> + <constants> + <constant name="MODE_OPEN_FILE" value="0"> + </constant> + <constant name="MODE_OPEN_FILES" value="1"> + </constant> + <constant name="MODE_OPEN_DIR" value="2"> + </constant> + <constant name="MODE_SAVE_FILE" value="3"> + </constant> + <constant name="ACCESS_RESOURCES" value="0"> + </constant> + <constant name="ACCESS_USERDATA" value="1"> + </constant> + <constant name="ACCESS_FILESYSTEM" value="2"> + </constant> + </constants> +</class> <class name="EditorImportPlugin" inherits="Reference" category="Core"> <brief_description> </brief_description> @@ -8734,7 +9616,7 @@ </description> </method> <method name="get_undo_redo"> - <return type="UndoRedo"> + <return type="Object"> </return> <description> </description> @@ -8823,28 +9705,6 @@ <constants> </constants> </class> -<class name="EmptyControl" inherits="Control" category="Core"> - <brief_description> - </brief_description> - <description> - </description> - <methods> - <method name="set_minsize"> - <argument index="0" name="minsize" type="Vector2"> - </argument> - <description> - </description> - </method> - <method name="get_minsize" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - </description> - </method> - </methods> - <constants> - </constants> -</class> <class name="Environment" inherits="Resource" category="Core"> <brief_description> </brief_description> @@ -8919,23 +9779,23 @@ </constant> <constant name="BG_CUBEMAP" value="4"> </constant> - <constant name="BG_TEXTURE_RGBE" value="5"> + <constant name="BG_CANVAS" value="5"> </constant> - <constant name="BG_CUBEMAP_RGBE" value="6"> + <constant name="BG_MAX" value="6"> </constant> - <constant name="BG_MAX" value="7"> + <constant name="BG_PARAM_CANVAS_MAX_LAYER" value="0"> </constant> - <constant name="BG_PARAM_COLOR" value="0"> + <constant name="BG_PARAM_COLOR" value="1"> </constant> - <constant name="BG_PARAM_TEXTURE" value="1"> + <constant name="BG_PARAM_TEXTURE" value="2"> </constant> - <constant name="BG_PARAM_CUBEMAP" value="2"> + <constant name="BG_PARAM_CUBEMAP" value="3"> </constant> - <constant name="BG_PARAM_ENERGY" value="3"> + <constant name="BG_PARAM_ENERGY" value="4"> </constant> - <constant name="BG_PARAM_GLOW" value="5"> + <constant name="BG_PARAM_GLOW" value="6"> </constant> - <constant name="BG_PARAM_MAX" value="6"> + <constant name="BG_PARAM_MAX" value="7"> </constant> <constant name="FX_AMBIENT_LIGHT" value="0"> </constant> @@ -9376,7 +10236,7 @@ </description> </method> <method name="get_error" qualifiers="const"> - <return type="int"> + <return type="Error"> </return> <description> </description> @@ -9578,6 +10438,18 @@ <description> </description> </method> + <method name="set_show_hidden_files"> + <argument index="0" name="arg0" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_showing_hidden_files" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="invalidate"> <description> </description> @@ -9802,6 +10674,14 @@ Font contains an unicode compatible character set, as well as the ability to draw it with variable width, ascent, descent and kerning. For creating fonts from TTF files (or other font formats), see the editor support for fonts. TODO check wikipedia for graph of ascent/baseline/descent/height/etc. </description> <methods> + <method name="create_from_fnt"> + <return type="int"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </method> <method name="set_height"> <argument index="0" name="px" type="float"> </argument> @@ -9881,6 +10761,20 @@ Add a character to the font, where "character" is the unicode value, "texture" is the texture index, "rect" is the region in the texture (in pixels!), "align" is the (optional) alignment for the character and "advance" is the (optional) advance. </description> </method> + <method name="get_texture_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_texture" qualifiers="const"> + <return type="Texture"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> <method name="get_char_size" qualifiers="const"> <return type="Vector2"> </return> @@ -9901,6 +10795,18 @@ Return the size of a string, taking kerning and advance into account. </description> </method> + <method name="set_distance_field_hint"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_distance_field_hint" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="clear"> <description> Clear all the font data. @@ -10036,6 +10942,12 @@ <description> </description> </method> + <method name="get_as_byte_code" qualifiers="const"> + <return type="RawArray"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -10370,6 +11282,20 @@ <description> </description> </method> + <method name="point_is_inside_triangle" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="point" type="Vector2"> + </argument> + <argument index="1" name="a" type="Vector2"> + </argument> + <argument index="2" name="b" type="Vector2"> + </argument> + <argument index="3" name="c" type="Vector2"> + </argument> + <description> + </description> + </method> <method name="triangulate_polygon"> <return type="IntArray"> </return> @@ -10464,6 +11390,18 @@ <description> </description> </method> + <method name="set_extra_cull_margin"> + <argument index="0" name="margin" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_extra_cull_margin" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> </methods> <constants> <constant name="FLAG_VISIBLE" value="0"> @@ -10592,9 +11530,335 @@ <description> </description> </method> + <method name="save_custom"> + <return type="int"> + </return> + <argument index="0" name="arg0" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> +<class name="GraphEdit" inherits="Control" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="connect_node"> + <return type="Error"> + </return> + <argument index="0" name="from" type="String"> + </argument> + <argument index="1" name="from_port" type="int"> + </argument> + <argument index="2" name="to" type="String"> + </argument> + <argument index="3" name="to_port" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_node_connected"> + <return type="bool"> + </return> + <argument index="0" name="from" type="String"> + </argument> + <argument index="1" name="from_port" type="int"> + </argument> + <argument index="2" name="to" type="String"> + </argument> + <argument index="3" name="to_port" type="int"> + </argument> + <description> + </description> + </method> + <method name="disconnect_node"> + <argument index="0" name="from" type="String"> + </argument> + <argument index="1" name="from_port" type="int"> + </argument> + <argument index="2" name="to" type="String"> + </argument> + <argument index="3" name="to_port" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_connection_list" qualifiers="const"> + <return type="Array"> + </return> + <description> + </description> + </method> + <method name="set_right_disconnects"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_right_disconnects_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + </methods> + <signals> + <signal name="disconnection_request"> + <argument index="0" name="from" type="String"> + </argument> + <argument index="1" name="from_slot" type="int"> + </argument> + <argument index="2" name="to" type="String"> + </argument> + <argument index="3" name="to_slot" type="int"> + </argument> + <description> + </description> + </signal> + <signal name="connection_request"> + <argument index="0" name="from" type="String"> + </argument> + <argument index="1" name="from_slot" type="int"> + </argument> + <argument index="2" name="to" type="String"> + </argument> + <argument index="3" name="to_slot" type="int"> + </argument> + <description> + </description> + </signal> + </signals> + <constants> + </constants> +</class> +<class name="GraphNode" inherits="Container" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_title"> + <argument index="0" name="title" type="String"> + </argument> + <description> + </description> + </method> + <method name="get_title" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_slot"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="enable_left" type="bool"> + </argument> + <argument index="2" name="type_left" type="int"> + </argument> + <argument index="3" name="color_left" type="Color"> + </argument> + <argument index="4" name="enable_right" type="bool"> + </argument> + <argument index="5" name="type_right" type="int"> + </argument> + <argument index="6" name="color_right" type="Color"> + </argument> + <description> + </description> + </method> + <method name="clear_slot"> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="clear_all_slots"> + <description> + </description> + </method> + <method name="is_slot_enabled_left" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_slot_type_left" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_slot_color_left" qualifiers="const"> + <return type="Color"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_slot_enabled_right" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_slot_type_right" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_slot_color_right" qualifiers="const"> + <return type="Color"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_offset"> + <argument index="0" name="offset" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="get_offset" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="get_connection_output_count"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_connection_input_count"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_connection_output_pos"> + <return type="Vector2"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_connection_output_type"> + <return type="int"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_connection_output_color"> + <return type="Color"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_connection_input_pos"> + <return type="Vector2"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_connection_input_type"> + <return type="int"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_connection_input_color"> + <return type="Color"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_show_close_button"> + <argument index="0" name="show" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_close_button_visible" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> </methods> + <signals> + <signal name="raise_request"> + <description> + </description> + </signal> + <signal name="close_request"> + <description> + </description> + </signal> + <signal name="dragged"> + <argument index="0" name="from" type="Vector2"> + </argument> + <argument index="1" name="to" type="Vector2"> + </argument> + <description> + </description> + </signal> + <signal name="offset_changed"> + <description> + </description> + </signal> + </signals> <constants> </constants> + <theme_items> + <theme_item name="port_offset" type="int"> + </theme_item> + <theme_item name="close_offset" type="int"> + </theme_item> + <theme_item name="separation" type="int"> + </theme_item> + <theme_item name="title_offset" type="int"> + </theme_item> + <theme_item name="title_color" type="Color"> + </theme_item> + <theme_item name="port" type="Texture"> + </theme_item> + <theme_item name="close" type="Texture"> + </theme_item> + <theme_item name="title_font" type="Font"> + </theme_item> + <theme_item name="frame" type="StyleBox"> + </theme_item> + </theme_items> </class> <class name="GridContainer" inherits="Container" category="Core"> <brief_description> @@ -10618,7 +11882,9 @@ <constants> </constants> <theme_items> - <theme_item name="separation" type="int"> + <theme_item name="vseparation" type="int"> + </theme_item> + <theme_item name="hseparation" type="int"> </theme_item> </theme_items> </class> @@ -11081,7 +12347,7 @@ </description> <methods> <method name="connect"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="host" type="String"> </argument> @@ -11176,6 +12442,12 @@ <description> </description> </method> + <method name="set_read_chunk_size"> + <argument index="0" name="bytes" type="int"> + </argument> + <description> + </description> + </method> <method name="set_blocking_mode"> <argument index="0" name="enabled" type="bool"> </argument> @@ -11195,7 +12467,7 @@ </description> </method> <method name="poll"> - <return type="int"> + <return type="Error"> </return> <description> </description> @@ -11787,6 +13059,10 @@ <description> </description> </method> + <method name="normal_to_xy"> + <description> + </description> + </method> <method name="set_size_override"> <argument index="0" name="size" type="Vector2"> </argument> @@ -11848,7 +13124,7 @@ </description> </method> <method name="add_vertex"> - <argument index="0" name="color" type="Vector3"> + <argument index="0" name="pos" type="Vector3"> </argument> <description> </description> @@ -11939,13 +13215,6 @@ <description> </description> </method> - <method name="get_mouse_pos" qualifiers="const"> - <return type="Vector2"> - </return> - <description> - Return the global, unscaled, screen pointer coordinates. If the 2D viewport has been scaled, it may not work well with [Camera] or controls. - </description> - </method> <method name="get_mouse_speed" qualifiers="const"> <return type="Vector2"> </return> @@ -11976,6 +13245,26 @@ <description> </description> </method> + <method name="action_press"> + <argument index="0" name="arg0" type="String"> + </argument> + <description> + </description> + </method> + <method name="action_release"> + <argument index="0" name="arg0" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_custom_mouse_cursor"> + <argument index="0" name="image" type="Texture"> + </argument> + <argument index="1" name="hotspot" type="Vector2" default="Vector2(0,0)"> + </argument> + <description> + </description> + </method> </methods> <signals> <signal name="joy_connection_changed"> @@ -12023,6 +13312,22 @@ Return if this input event matches a pre-defined action, no matter the type. </description> </method> + <method name="is_action_pressed"> + <return type="bool"> + </return> + <argument index="0" name="is_action_pressed" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_released"> + <return type="bool"> + </return> + <argument index="0" name="is_action_released" type="String"> + </argument> + <description> + </description> + </method> <method name="is_echo"> <return type="bool"> </return> @@ -12037,6 +13342,14 @@ Return if this input event is pressed (for key, mouse, joy button or screen press events). </description> </method> + <method name="set_as_action"> + <argument index="0" name="action" type="String"> + </argument> + <argument index="1" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="type" type="int"> @@ -12087,6 +13400,22 @@ <description> </description> </method> + <method name="is_action_pressed"> + <return type="bool"> + </return> + <argument index="0" name="is_action_pressed" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_released"> + <return type="bool"> + </return> + <argument index="0" name="is_action_released" type="String"> + </argument> + <description> + </description> + </method> <method name="is_echo"> <return type="bool"> </return> @@ -12099,6 +13428,14 @@ <description> </description> </method> + <method name="set_as_action"> + <argument index="0" name="action" type="String"> + </argument> + <argument index="1" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="type" type="int"> @@ -12143,6 +13480,22 @@ <description> </description> </method> + <method name="is_action_pressed"> + <return type="bool"> + </return> + <argument index="0" name="is_action_pressed" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_released"> + <return type="bool"> + </return> + <argument index="0" name="is_action_released" type="String"> + </argument> + <description> + </description> + </method> <method name="is_echo"> <return type="bool"> </return> @@ -12155,6 +13508,14 @@ <description> </description> </method> + <method name="set_as_action"> + <argument index="0" name="action" type="String"> + </argument> + <argument index="1" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="type" type="int"> @@ -12205,6 +13566,22 @@ <description> </description> </method> + <method name="is_action_pressed"> + <return type="bool"> + </return> + <argument index="0" name="is_action_pressed" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_released"> + <return type="bool"> + </return> + <argument index="0" name="is_action_released" type="String"> + </argument> + <description> + </description> + </method> <method name="is_echo"> <return type="bool"> </return> @@ -12217,6 +13594,14 @@ <description> </description> </method> + <method name="set_as_action"> + <argument index="0" name="action" type="String"> + </argument> + <argument index="1" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="type" type="int"> @@ -12265,6 +13650,22 @@ <description> </description> </method> + <method name="is_action_pressed"> + <return type="bool"> + </return> + <argument index="0" name="is_action_pressed" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_released"> + <return type="bool"> + </return> + <argument index="0" name="is_action_released" type="String"> + </argument> + <description> + </description> + </method> <method name="is_echo"> <return type="bool"> </return> @@ -12277,6 +13678,14 @@ <description> </description> </method> + <method name="set_as_action"> + <argument index="0" name="action" type="String"> + </argument> + <argument index="1" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="type" type="int"> @@ -12337,6 +13746,22 @@ <description> </description> </method> + <method name="is_action_pressed"> + <return type="bool"> + </return> + <argument index="0" name="is_action_pressed" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_released"> + <return type="bool"> + </return> + <argument index="0" name="is_action_released" type="String"> + </argument> + <description> + </description> + </method> <method name="is_echo"> <return type="bool"> </return> @@ -12349,6 +13774,14 @@ <description> </description> </method> + <method name="set_as_action"> + <argument index="0" name="action" type="String"> + </argument> + <argument index="1" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="type" type="int"> @@ -12421,6 +13854,22 @@ <description> </description> </method> + <method name="is_action_pressed"> + <return type="bool"> + </return> + <argument index="0" name="is_action_pressed" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_released"> + <return type="bool"> + </return> + <argument index="0" name="is_action_released" type="String"> + </argument> + <description> + </description> + </method> <method name="is_echo"> <return type="bool"> </return> @@ -12433,6 +13882,14 @@ <description> </description> </method> + <method name="set_as_action"> + <argument index="0" name="action" type="String"> + </argument> + <argument index="1" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="type" type="int"> @@ -12511,6 +13968,22 @@ <description> </description> </method> + <method name="is_action_pressed"> + <return type="bool"> + </return> + <argument index="0" name="is_action_pressed" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_released"> + <return type="bool"> + </return> + <argument index="0" name="is_action_released" type="String"> + </argument> + <description> + </description> + </method> <method name="is_echo"> <return type="bool"> </return> @@ -12523,6 +13996,14 @@ <description> </description> </method> + <method name="set_as_action"> + <argument index="0" name="action" type="String"> + </argument> + <argument index="1" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="type" type="int"> @@ -12587,6 +14068,22 @@ <description> </description> </method> + <method name="is_action_pressed"> + <return type="bool"> + </return> + <argument index="0" name="is_action_pressed" type="String"> + </argument> + <description> + </description> + </method> + <method name="is_action_released"> + <return type="bool"> + </return> + <argument index="0" name="is_action_released" type="String"> + </argument> + <description> + </description> + </method> <method name="is_echo"> <return type="bool"> </return> @@ -12599,6 +14096,14 @@ <description> </description> </method> + <method name="set_as_action"> + <argument index="0" name="action" type="String"> + </argument> + <argument index="1" name="pressed" type="bool"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="type" type="int"> @@ -12710,7 +14215,7 @@ </description> </method> <method name="get_action_list"> - <return type="bool"> + <return type="Array"> </return> <argument index="0" name="action" type="String"> </argument> @@ -12783,6 +14288,8 @@ </description> </method> <method name="IntArray"> + <return type="IntArray"> + </return> <argument index="0" name="from" type="Array"> </argument> <description> @@ -12845,6 +14352,322 @@ <constants> </constants> </class> +<class name="ItemList" inherits="Control" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="add_item"> + <argument index="0" name="text" type="String"> + </argument> + <argument index="1" name="icon" type="Texture" default="Object()"> + </argument> + <argument index="2" name="selectable" type="bool" default="true"> + </argument> + <description> + </description> + </method> + <method name="add_icon_item"> + <argument index="0" name="icon" type="Texture"> + </argument> + <argument index="1" name="selectable" type="bool" default="true"> + </argument> + <description> + </description> + </method> + <method name="set_item_text"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="text" type="String"> + </argument> + <description> + </description> + </method> + <method name="get_item_text" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_item_icon"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="icon" type="Texture"> + </argument> + <description> + </description> + </method> + <method name="get_item_icon" qualifiers="const"> + <return type="Texture"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_item_selectable"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="selectable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_item_selectable" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_item_disabled"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="disabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_item_disabled" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_item_metadata"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="metadata" type="var"> + </argument> + <description> + </description> + </method> + <method name="get_item_metadata" qualifiers="const"> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_item_custom_bg_color"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="custom_bg_color" type="Color"> + </argument> + <description> + </description> + </method> + <method name="get_item_custom_bg_color" qualifiers="const"> + <return type="Color"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_item_tooltip"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="tooltip" type="String"> + </argument> + <description> + </description> + </method> + <method name="get_item_tooltip" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="select"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="single" type="bool" default="true"> + </argument> + <description> + </description> + </method> + <method name="unselect"> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_selected" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_item_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="remove_item"> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="clear"> + <description> + </description> + </method> + <method name="sort_items_by_text"> + <description> + </description> + </method> + <method name="set_fixed_column_width"> + <argument index="0" name="width" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_fixed_column_width" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_max_text_lines"> + <argument index="0" name="lines" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_max_text_lines" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_max_columns"> + <argument index="0" name="amount" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_max_columns" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_select_mode"> + <argument index="0" name="mode" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_select_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_icon_mode"> + <argument index="0" name="mode" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_icon_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_min_icon_size"> + <argument index="0" name="size" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="get_min_icon_size" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="ensure_current_is_visible"> + <description> + </description> + </method> + </methods> + <signals> + <signal name="item_activated"> + <argument index="0" name="index" type="int"> + </argument> + <description> + </description> + </signal> + <signal name="multi_selected"> + <argument index="0" name="index" type="int"> + </argument> + <argument index="1" name="selected" type="bool"> + </argument> + <description> + </description> + </signal> + <signal name="item_selected"> + <argument index="0" name="index" type="int"> + </argument> + <description> + </description> + </signal> + </signals> + <constants> + <constant name="ICON_MODE_TOP" value="0"> + </constant> + <constant name="ICON_MODE_LEFT" value="1"> + </constant> + <constant name="SELECT_SINGLE" value="0"> + </constant> + <constant name="SELECT_MULTI" value="1"> + </constant> + </constants> + <theme_items> + <theme_item name="vseparation" type="int"> + </theme_item> + <theme_item name="line_separation" type="int"> + </theme_item> + <theme_item name="icon_margin" type="int"> + </theme_item> + <theme_item name="hseparation" type="int"> + </theme_item> + <theme_item name="guide_color" type="Color"> + </theme_item> + <theme_item name="font_color_selected" type="Color"> + </theme_item> + <theme_item name="font_color" type="Color"> + </theme_item> + <theme_item name="font" type="Font"> + </theme_item> + <theme_item name="cursor" type="StyleBox"> + </theme_item> + <theme_item name="selected_focus" type="StyleBox"> + </theme_item> + <theme_item name="bg_focus" type="StyleBox"> + </theme_item> + <theme_item name="cursor_unfocused" type="StyleBox"> + </theme_item> + <theme_item name="selected" type="StyleBox"> + </theme_item> + <theme_item name="bg" type="StyleBox"> + </theme_item> + </theme_items> +</class> <class name="Joint" inherits="Spatial" category="Core"> <brief_description> </brief_description> @@ -13095,16 +14918,24 @@ <description> </description> </method> - <method name="can_move_to"> + <method name="test_move"> <return type="bool"> </return> - <argument index="0" name="position" type="Vector2"> - </argument> - <argument index="1" name="arg1" type="bool"> + <argument index="0" name="rel_vec" type="Vector2"> </argument> <description> </description> </method> + <method name="get_travel" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="revert_motion"> + <description> + </description> + </method> <method name="is_colliding" qualifiers="const"> <return type="bool"> </return> @@ -13143,54 +14974,6 @@ <description> </description> </method> - <method name="set_collide_with_static_bodies"> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> - <method name="can_collide_with_static_bodies" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="set_collide_with_kinematic_bodies"> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> - <method name="can_collide_with_kinematic_bodies" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="set_collide_with_rigid_bodies"> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> - <method name="can_collide_with_rigid_bodies" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> - <method name="set_collide_with_character_bodies"> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> - <method name="can_collide_with_character_bodies" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="set_collision_margin"> <argument index="0" name="pixels" type="float"> </argument> @@ -13207,7 +14990,7 @@ <constants> </constants> </class> -<class name="Label" inherits="Range" category="Core"> +<class name="Label" inherits="Control" category="Core"> <brief_description> Control that displays formatted text. </brief_description> @@ -13219,26 +15002,28 @@ <argument index="0" name="align" type="int"> </argument> <description> - Set the alignmend mode to any of the ALIGN_* enumeration values. + Sets the alignment mode to any of the ALIGN_* enumeration values. </description> </method> <method name="get_align" qualifiers="const"> <return type="int"> </return> <description> - Return the alignmend mode (any of the ALIGN_* enumeration values). + Return the alignment mode (any of the ALIGN_* enumeration values). </description> </method> <method name="set_valign"> <argument index="0" name="valign" type="int"> </argument> <description> + Sets the vertical alignment mode to any of the VALIGN_* enumeration values. </description> </method> <method name="get_valign" qualifiers="const"> <return type="int"> </return> <description> + Return the vertical alignment mode (any of the VALIGN_* enumeration values). </description> </method> <method name="set_text"> @@ -13269,16 +15054,32 @@ Return the state of the [i]autowrap[/i] mode (see [method set_autowrap]). </description> </method> + <method name="set_clip_text"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + Cuts off the rest of the text if it is too wide. + </description> + </method> + <method name="is_clipping_text" qualifiers="const"> + <return type="bool"> + </return> + <description> + Return true if text would be cut off if it is too wide. + </description> + </method> <method name="set_uppercase"> <argument index="0" name="enable" type="bool"> </argument> <description> + Display text in all capitals. </description> </method> <method name="is_uppercase" qualifiers="const"> <return type="bool"> </return> <description> + Return true if text is displayed in all capitals. </description> </method> <method name="get_line_height" qualifiers="const"> @@ -13299,24 +15100,63 @@ <return type="int"> </return> <description> + Return the total length of the text. </description> </method> <method name="set_visible_characters"> - <argument index="0" name="arg0" type="int"> + <argument index="0" name="amount" type="int"> </argument> <description> + Restricts the number of characters to display. Set to -1 to disable. + </description> + </method> + <method name="get_visible_characters" qualifiers="const"> + <return type="int"> + </return> + <description> + Return the restricted number of characters to display. Returns -1 if unrestricted. </description> </method> <method name="set_percent_visible"> <argument index="0" name="percent_visible" type="float"> </argument> <description> + Restricts the number of characters to display (as a percentage of the total text). </description> </method> <method name="get_percent_visible" qualifiers="const"> <return type="float"> </return> <description> + Return the restricted number of characters to display (as a percentage of the total text). + </description> + </method> + <method name="set_lines_skipped"> + <argument index="0" name="lines_skipped" type="int"> + </argument> + <description> + Sets the number of lines to skip before displaying. Useful for scrolling text. + </description> + </method> + <method name="get_lines_skipped" qualifiers="const"> + <return type="int"> + </return> + <description> + Return the the number of lines to skipped before displaying. + </description> + </method> + <method name="set_max_lines_visible"> + <argument index="0" name="lines_visible" type="int"> + </argument> + <description> + Restricts the number of lines to display. Set to -1 to disable. + </description> + </method> + <method name="get_max_lines_visible" qualifiers="const"> + <return type="int"> + </return> + <description> + Return the restricted number of lines to display. Returns -1 if unrestricted. </description> </method> </methods> @@ -13551,7 +15391,7 @@ </constant> <constant name="PARAM_SPOT_ANGLE" value="1"> </constant> - <constant name="PARAM_SPOT_ATTENUATION" value="4"> + <constant name="PARAM_SPOT_ATTENUATION" value="0"> </constant> <constant name="PARAM_SHADOW_DARKENING" value="5"> </constant> @@ -13571,6 +15411,272 @@ </constant> </constants> </class> +<class name="Light2D" inherits="Node2D" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_enabled"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_texture"> + <argument index="0" name="texture" type="Object"> + </argument> + <description> + </description> + </method> + <method name="get_texture" qualifiers="const"> + <return type="Object"> + </return> + <description> + </description> + </method> + <method name="set_texture_offset"> + <argument index="0" name="texture_offset" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="get_texture_offset" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="set_color"> + <argument index="0" name="color" type="Color"> + </argument> + <description> + </description> + </method> + <method name="get_color" qualifiers="const"> + <return type="Color"> + </return> + <description> + </description> + </method> + <method name="set_height"> + <argument index="0" name="height" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_height" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_energy"> + <argument index="0" name="energy" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_energy" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_texture_scale"> + <argument index="0" name="texture_scale" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_texture_scale" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_z_range_min"> + <argument index="0" name="z" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_z_range_min" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_z_range_max"> + <argument index="0" name="z" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_z_range_max" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_layer_range_min"> + <argument index="0" name="layer" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_layer_range_min" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_layer_range_max"> + <argument index="0" name="layer" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_layer_range_max" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_item_mask"> + <argument index="0" name="item_mask" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_item_mask" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_item_shadow_mask"> + <argument index="0" name="item_shadow_mask" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_item_shadow_mask" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_mode"> + <argument index="0" name="mode" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_shadow_enabled"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_shadow_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_shadow_buffer_size"> + <argument index="0" name="size" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_shadow_buffer_size" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_shadow_esm_multiplier"> + <argument index="0" name="multiplier" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_shadow_esm_multiplier" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_shadow_color"> + <argument index="0" name="shadow_color" type="Color"> + </argument> + <description> + </description> + </method> + <method name="get_shadow_color" qualifiers="const"> + <return type="Color"> + </return> + <description> + </description> + </method> + </methods> + <constants> + <constant name="MODE_ADD" value="0"> + </constant> + <constant name="MODE_SUB" value="1"> + </constant> + <constant name="MODE_MIX" value="2"> + </constant> + </constants> +</class> +<class name="LightOccluder2D" inherits="Node2D" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_occluder_polygon"> + <argument index="0" name="polygon" type="OccluderPolygon2D"> + </argument> + <description> + </description> + </method> + <method name="get_occluder_polygon" qualifiers="const"> + <return type="OccluderPolygon2D"> + </return> + <description> + </description> + </method> + <method name="set_occluder_light_mask"> + <argument index="0" name="mask" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_occluder_light_mask" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="LineEdit" inherits="Control" category="Core"> <brief_description> Control that provides single line string editing. @@ -13762,14 +15868,80 @@ Main loop is the abstract main loop base class. All other main loop classes are derived from it. Upon application start, a [MainLoop] has to be provided to OS, else the application will exit. This happens automatically (and a [SceneMainLoop] is created), unless a main [Script] is supplied, which may or not create and return a [MainLoop]. </description> <methods> + <method name="_finalize" qualifiers="virtual"> + <description> + </description> + </method> + <method name="_idle" qualifiers="virtual"> + <argument index="0" name="delta" type="float"> + </argument> + <description> + </description> + </method> + <method name="_initialize" qualifiers="virtual"> + <description> + </description> + </method> + <method name="_input_event" qualifiers="virtual"> + <argument index="0" name="ev" type="InputEvent"> + </argument> + <description> + </description> + </method> + <method name="_input_text" qualifiers="virtual"> + <argument index="0" name="text" type="String"> + </argument> + <description> + </description> + </method> + <method name="_iteration" qualifiers="virtual"> + <argument index="0" name="delta" type="float"> + </argument> + <description> + </description> + </method> <method name="input_event"> - <argument index="0" name="arg0" type="InputEvent"> + <argument index="0" name="ev" type="InputEvent"> </argument> <description> </description> </method> + <method name="input_text"> + <argument index="0" name="text" type="String"> + </argument> + <description> + </description> + </method> + <method name="init"> + <description> + </description> + </method> + <method name="iteration"> + <return type="bool"> + </return> + <argument index="0" name="delta" type="float"> + </argument> + <description> + </description> + </method> + <method name="idle"> + <return type="bool"> + </return> + <argument index="0" name="delta" type="float"> + </argument> + <description> + </description> + </method> + <method name="finish"> + <description> + </description> + </method> </methods> <constants> + <constant name="NOTIFICATION_WM_MOUSE_ENTER" value="3"> + </constant> + <constant name="NOTIFICATION_WM_MOUSE_EXIT" value="4"> + </constant> <constant name="NOTIFICATION_WM_FOCUS_IN" value="5"> </constant> <constant name="NOTIFICATION_WM_FOCUS_OUT" value="6"> @@ -13818,6 +15990,38 @@ <description> </description> </method> + <method name="raw_to_base64"> + <return type="String"> + </return> + <argument index="0" name="array" type="RawArray"> + </argument> + <description> + </description> + </method> + <method name="base64_to_raw"> + <return type="RawArray"> + </return> + <argument index="0" name="base64_str" type="String"> + </argument> + <description> + </description> + </method> + <method name="utf8_to_base64"> + <return type="String"> + </return> + <argument index="0" name="utf8_str" type="String"> + </argument> + <description> + </description> + </method> + <method name="base64_to_utf8"> + <return type="String"> + </return> + <argument index="0" name="base64_str" type="String"> + </argument> + <description> + </description> + </method> </methods> <constants> </constants> @@ -13934,6 +16138,26 @@ </constant> </constants> </class> +<class name="MaterialShader" inherits="Shader" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + </methods> + <constants> + </constants> +</class> +<class name="MaterialShaderGraph" inherits="ShaderGraph" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + </methods> + <constants> + </constants> +</class> <class name="Matrix3" category="Built-In Types"> <brief_description> 3x3 matrix datatype. @@ -14055,6 +16279,8 @@ </description> </method> <method name="Matrix3"> + <return type="Matrix3"> + </return> <argument index="0" name="x_axis" type="Vector3"> </argument> <argument index="1" name="y_axis" type="Vector3"> @@ -14066,6 +16292,8 @@ </description> </method> <method name="Matrix3"> + <return type="Matrix3"> + </return> <argument index="0" name="axis" type="Vector3"> </argument> <argument index="1" name="phi" type="float"> @@ -14075,6 +16303,8 @@ </description> </method> <method name="Matrix3"> + <return type="Matrix3"> + </return> <argument index="0" name="from" type="Quat"> </argument> <description> @@ -14204,6 +16434,18 @@ </description> </method> <method name="Matrix32"> + <return type="Matrix32"> + </return> + <argument index="0" name="rot" type="float"> + </argument> + <argument index="1" name="pos" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="Matrix32"> + <return type="Matrix32"> + </return> <argument index="0" name="x_axis" type="Vector2"> </argument> <argument index="1" name="y_axis" type="Vector2"> @@ -14213,6 +16455,14 @@ <description> </description> </method> + <method name="Matrix32"> + <return type="Matrix32"> + </return> + <argument index="0" name="from" type="Transform"> + </argument> + <description> + </description> + </method> </methods> <members> <member name="x" type="float"> @@ -14234,7 +16484,7 @@ </description> <methods> <method name="get_popup"> - <return type="Object"> + <return type="PopupMenu"> </return> <description> Return the [PopupMenu] contained in this button. @@ -15105,7 +17355,7 @@ </description> </method> <method name="try_lock"> - <return type="int"> + <return type="Error"> </return> <description> </description> @@ -15169,6 +17419,8 @@ </argument> <argument index="1" name="end" type="Vector3"> </argument> + <argument index="2" name="use_collision" type="bool" default="false"> + </argument> <description> </description> </method> @@ -15188,6 +17440,14 @@ <description> </description> </method> + <method name="get_closest_point_owner"> + <return type="Object"> + </return> + <argument index="0" name="to_point" type="Vector3"> + </argument> + <description> + </description> + </method> <method name="set_up_vector"> <argument index="0" name="up" type="Vector3"> </argument> @@ -15204,6 +17464,70 @@ <constants> </constants> </class> +<class name="Navigation2D" inherits="Node2D" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="navpoly_create"> + <return type="int"> + </return> + <argument index="0" name="mesh" type="NavigationPolygon"> + </argument> + <argument index="1" name="xform" type="Matrix32"> + </argument> + <argument index="2" name="owner" type="Object" default="NULL"> + </argument> + <description> + </description> + </method> + <method name="navpoly_set_transform"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="xform" type="Matrix32"> + </argument> + <description> + </description> + </method> + <method name="navpoly_remove"> + <argument index="0" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_simple_path"> + <return type="Vector2Array"> + </return> + <argument index="0" name="start" type="Vector2"> + </argument> + <argument index="1" name="end" type="Vector2"> + </argument> + <argument index="2" name="optimize" type="bool" default="true"> + </argument> + <description> + </description> + </method> + <method name="get_closest_point"> + <return type="Vector2"> + </return> + <argument index="0" name="to_point" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="get_closest_point_owner"> + <return type="Object"> + </return> + <argument index="0" name="to_point" type="Vector2"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="NavigationMesh" inherits="Resource" category="Core"> <brief_description> </brief_description> @@ -15284,6 +17608,136 @@ <constants> </constants> </class> +<class name="NavigationPolygon" inherits="Resource" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_vertices"> + <argument index="0" name="vertices" type="Vector2Array"> + </argument> + <description> + </description> + </method> + <method name="get_vertices" qualifiers="const"> + <return type="Vector2Array"> + </return> + <description> + </description> + </method> + <method name="add_polygon"> + <argument index="0" name="polygon" type="IntArray"> + </argument> + <description> + </description> + </method> + <method name="get_polygon_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_polygon"> + <return type="IntArray"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="clear_polygons"> + <description> + </description> + </method> + <method name="add_outline"> + <argument index="0" name="outline" type="Vector2Array"> + </argument> + <description> + </description> + </method> + <method name="add_outline_at_index"> + <argument index="0" name="outline" type="Vector2Array"> + </argument> + <argument index="1" name="index" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_outline_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_outline"> + <argument index="0" name="idx" type="int"> + </argument> + <argument index="1" name="outline" type="Vector2Array"> + </argument> + <description> + </description> + </method> + <method name="get_outline" qualifiers="const"> + <return type="Vector2Array"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="remove_outline"> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> + <method name="clear_outlines"> + <description> + </description> + </method> + <method name="make_polygons_from_outlines"> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> +<class name="NavigationPolygonInstance" inherits="Node2D" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_navigation_polygon"> + <argument index="0" name="navpoly" type="Object"> + </argument> + <description> + </description> + </method> + <method name="get_navigation_polygon" qualifiers="const"> + <return type="Object"> + </return> + <description> + </description> + </method> + <method name="set_enabled"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="Nil" category="Built-In Types"> <brief_description> </brief_description> @@ -15554,12 +18008,6 @@ Remove a child [Node]. Node is NOT deleted and will have to be deleted manually. </description> </method> - <method name="remove_and_delete_child"> - <argument index="0" name="node" type="Node"> - </argument> - <description> - </description> - </method> <method name="get_child_count" qualifiers="const"> <return type="int"> </return> @@ -15621,6 +18069,14 @@ Return the parent [Node] of the current [Node], or an empty Object if the node lacks a parent. </description> </method> + <method name="find_node" qualifiers="const"> + <return type="Node"> + </return> + <argument index="0" name="mask" type="NodePath" default="true"> + </argument> + <description> + </description> + </method> <method name="has_node_and_resource" qualifiers="const"> <return type="bool"> </return> @@ -15893,8 +18349,9 @@ <method name="duplicate" qualifiers="const"> <return type="Node"> </return> + <argument index="0" name="use_instancing" type="bool" default="false"> + </argument> <description> - Return a duplicate of the scene, with all nodes and parameters copied. Subscriptions will not be duplicated. </description> </method> <method name="replace_by"> @@ -16015,7 +18472,7 @@ </description> </method> <method name="rotate"> - <argument index="0" name="degrees" type="float"> + <argument index="0" name="radians" type="float"> </argument> <description> </description> @@ -16036,19 +18493,37 @@ <description> </description> </method> - <method name="get_global_pos" qualifiers="const"> - <return type="Vector2"> - </return> + <method name="translate"> + <argument index="0" name="offset" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="global_translate"> + <argument index="0" name="offset" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="scale"> + <argument index="0" name="ratio" type="Vector2"> + </argument> <description> - Return the global position of the 2D node. </description> </method> <method name="set_global_pos"> - <argument index="0" name="arg0" type="Vector2"> + <argument index="0" name="pos" type="Vector2"> </argument> <description> </description> </method> + <method name="get_global_pos" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + Return the global position of the 2D node. + </description> + </method> <method name="set_transform"> <argument index="0" name="xform" type="Matrix32"> </argument> @@ -16061,12 +18536,58 @@ <description> </description> </method> + <method name="look_at"> + <argument index="0" name="point" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="get_angle_to" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="point" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="set_z"> + <argument index="0" name="z" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_z" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_z_as_relative"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_z_relative" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="edit_set_pivot"> <argument index="0" name="arg0" type="Vector2"> </argument> <description> </description> </method> + <method name="get_relative_transform" qualifiers="const"> + <return type="Matrix32"> + </return> + <argument index="0" name="arg0" type="Object"> + </argument> + <description> + </description> + </method> </methods> <constants> </constants> @@ -16133,6 +18654,8 @@ </description> </method> <method name="NodePath"> + <return type="NodePath"> + </return> <argument index="0" name="from" type="String"> </argument> <description> @@ -16222,6 +18745,124 @@ Return the list of fullscreen modes. </description> </method> + <method name="get_screen_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_current_screen" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_current_screen"> + <argument index="0" name="screen" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_screen_position" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="screen" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="get_screen_size" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="screen" type="int" default="0"> + </argument> + <description> + </description> + </method> + <method name="get_window_position" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="set_window_position"> + <argument index="0" name="position" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="get_window_size" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="set_window_size"> + <argument index="0" name="size" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="set_window_fullscreen"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_window_fullscreen" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_window_resizable"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_window_resizable" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_window_minimized"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_window_minimized" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_window_maximized"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_window_maximized" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_screen_orientation"> + <argument index="0" name="orientation" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_screen_orientation" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> <method name="set_iterations_per_second"> <argument index="0" name="iterations_per_second" type="int"> </argument> @@ -16266,6 +18907,12 @@ <description> </description> </method> + <method name="set_window_title"> + <argument index="0" name="title" type="String"> + </argument> + <description> + </description> + </method> <method name="set_low_processor_usage_mode"> <argument index="0" name="enable" type="bool"> </argument> @@ -16373,15 +19020,23 @@ <method name="get_date" qualifiers="const"> <return type="Dictionary"> </return> + <argument index="0" name="utc" type="bool" default="false"> + </argument> <description> - Return the current date. </description> </method> <method name="get_time" qualifiers="const"> <return type="Dictionary"> </return> + <argument index="0" name="utc" type="bool" default="false"> + </argument> + <description> + </description> + </method> + <method name="get_time_zone_info" qualifiers="const"> + <return type="Dictionary"> + </return> <description> - Return the current time. </description> </method> <method name="get_unix_time" qualifiers="const"> @@ -16390,6 +19045,12 @@ <description> </description> </method> + <method name="get_system_time_msec" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> <method name="set_icon"> <argument index="0" name="arg0" type="Image"> </argument> @@ -16417,6 +19078,12 @@ Return the amount of time passed in milliseconds since the engine started. </description> </method> + <method name="get_splash_tick_msec" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> <method name="get_locale" qualifiers="const"> <return type="String"> </return> @@ -16519,12 +19186,26 @@ <description> </description> </method> + <method name="get_system_dir" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="dir" type="int"> + </argument> + <description> + </description> + </method> <method name="get_unique_ID" qualifiers="const"> <return type="String"> </return> <description> </description> </method> + <method name="is_ok_left_and_cancel_right" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="get_frames_per_second" qualifiers="const"> <return type="float"> </return> @@ -16548,9 +19229,9 @@ </argument> <argument index="1" name="arg1" type="float"> </argument> - <argument index="2" name="arg2" type="int"> + <argument index="2" name="arg2" type="String"> </argument> - <argument index="3" name="arg3" type="int"> + <argument index="3" name="arg3" type="String"> </argument> <description> </description> @@ -16569,12 +19250,44 @@ <description> </description> </method> + <method name="get_scancode_string" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="code" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_scancode_unicode" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="code" type="int"> + </argument> + <description> + </description> + </method> + <method name="find_scancode_from_string" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="string" type="String"> + </argument> + <description> + </description> + </method> <method name="set_use_file_access_save_and_swap"> <argument index="0" name="enabled" type="bool"> </argument> <description> </description> </method> + <method name="alert"> + <argument index="0" name="text" type="String"> + </argument> + <argument index="1" name="title" type="String" default=""Alert!""> + </argument> + <description> + </description> + </method> </methods> <constants> <constant name="DAY_SUNDAY" value="0"> @@ -16615,6 +19328,36 @@ </constant> <constant name="MONTH_DECEMBER" value="11"> </constant> + <constant name="SCREEN_ORIENTATION_LANDSCAPE" value="0"> + </constant> + <constant name="SCREEN_ORIENTATION_PORTRAIT" value="1"> + </constant> + <constant name="SCREEN_ORIENTATION_REVERSE_LANDSCAPE" value="2"> + </constant> + <constant name="SCREEN_ORIENTATION_REVERSE_PORTRAIT" value="3"> + </constant> + <constant name="SCREEN_ORIENTATION_SENSOR_LANDSCAPE" value="4"> + </constant> + <constant name="SCREEN_ORIENTATION_SENSOR_PORTRAIT" value="5"> + </constant> + <constant name="SCREEN_ORIENTATION_SENSOR" value="6"> + </constant> + <constant name="SYSTEM_DIR_DESKTOP" value="0"> + </constant> + <constant name="SYSTEM_DIR_DCIM" value="1"> + </constant> + <constant name="SYSTEM_DIR_DOCUMENTS" value="2"> + </constant> + <constant name="SYSTEM_DIR_DOWNLOADS" value="3"> + </constant> + <constant name="SYSTEM_DIR_MOVIES" value="4"> + </constant> + <constant name="SYSTEM_DIR_MUSIC" value="5"> + </constant> + <constant name="SYSTEM_DIR_PICTURES" value="6"> + </constant> + <constant name="SYSTEM_DIR_RINGTONES" value="7"> + </constant> </constants> </class> <class name="Object" category="Core"> @@ -16663,6 +19406,10 @@ Set a property. Return true if the property was found. </description> </method> + <method name="free"> + <description> + </description> + </method> <method name="get_type" qualifiers="const"> <return type="String"> </return> @@ -16702,6 +19449,12 @@ Return the list of properties as an array of dictionaries, dictionaries countain: name:String, type:int (see TYPE_* enum in globals) and optionally: hint:int (see PROPERTY_HINT_* in globals), hint_string:String, usage:int (see PROPERTY_USAGE_* in globals). </description> </method> + <method name="get_method_list" qualifiers="const"> + <return type="Array"> + </return> + <description> + </description> + </method> <method name="notification"> <argument index="0" name="what" type="int"> </argument> @@ -16773,6 +19526,14 @@ Add a user signal (can be added anytime). Arguments are optional, but can be added as an array of dictionaries, each containing "name" and "type" (from [@GlobalScope] TYPE_*). </description> </method> + <method name="has_user_signal" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="signal" type="String"> + </argument> + <description> + </description> + </method> <method name="emit_signal"> <argument index="0" name="signal" type="String"> </argument> @@ -16948,6 +19709,12 @@ Translate a message. Only works in message translation is enabled (which is by default). See [method set_message_translation]. </description> </method> + <method name="is_queued_for_deletion" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> </methods> <signals> <signal name="script_changed"> @@ -16973,6 +19740,58 @@ </constant> </constants> </class> +<class name="OccluderPolygon2D" inherits="Resource" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_closed"> + <argument index="0" name="closed" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_closed" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_cull_mode"> + <argument index="0" name="cull_mode" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_cull_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_polygon"> + <argument index="0" name="polygon" type="Vector2Array"> + </argument> + <description> + </description> + </method> + <method name="get_polygon" qualifiers="const"> + <return type="Vector2Array"> + </return> + <description> + </description> + </method> + </methods> + <constants> + <constant name="CULL_DISABLED" value="0"> + </constant> + <constant name="CULL_CLOCKWISE" value="1"> + </constant> + <constant name="CULL_COUNTER_CLOCKWISE" value="2"> + </constant> + </constants> +</class> <class name="OmniLight" inherits="Light" category="Core"> <brief_description> OmniDirectional Light, such as a lightbulb or a candle. @@ -17185,7 +20004,7 @@ </theme_item> </theme_items> </class> -<class name="PCKPacker" inherits="Object" category="Core"> +<class name="PCKPacker" inherits="Reference" category="Core"> <brief_description> </brief_description> <description> @@ -17248,7 +20067,7 @@ </description> <methods> <method name="pack"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="value" type="var"> </argument> @@ -17335,6 +20154,26 @@ <description> </description> </method> + <method name="get_packet" qualifiers="const"> + <return type="RawArray"> + </return> + <description> + </description> + </method> + <method name="put_packet"> + <return type="Error"> + </return> + <argument index="0" name="buffer" type="RawArray"> + </argument> + <description> + </description> + </method> + <method name="get_packet_error" qualifiers="const"> + <return type="Error"> + </return> + <description> + </description> + </method> <method name="get_available_packet_count" qualifiers="const"> <return type="int"> </return> @@ -17371,7 +20210,7 @@ </description> <methods> <method name="listen"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="port" type="int"> </argument> @@ -17385,7 +20224,7 @@ </description> </method> <method name="wait"> - <return type="int"> + <return type="Error"> </return> <description> </description> @@ -17650,28 +20489,6 @@ <constants> </constants> </class> -<class name="ParticleSystemMaterial" inherits="Material" category="Core"> - <brief_description> - </brief_description> - <description> - </description> - <methods> - <method name="set_texture"> - <argument index="0" name="texture" type="Object"> - </argument> - <description> - </description> - </method> - <method name="get_texture" qualifiers="const"> - <return type="Texture"> - </return> - <description> - </description> - </method> - </methods> - <constants> - </constants> -</class> <class name="Particles" inherits="GeometryInstance" category="Core"> <brief_description> Particle system 3D Node @@ -18062,6 +20879,30 @@ <description> </description> </method> + <method name="set_color"> + <argument index="0" name="color" type="Color"> + </argument> + <description> + </description> + </method> + <method name="get_color" qualifiers="const"> + <return type="Color"> + </return> + <description> + </description> + </method> + <method name="set_color_ramp"> + <argument index="0" name="color_ramp" type="Object"> + </argument> + <description> + </description> + </method> + <method name="get_color_ramp" qualifiers="const"> + <return type="ColorRamp"> + </return> + <description> + </description> + </method> <method name="set_emissor_offset"> <argument index="0" name="offset" type="Vector2"> </argument> @@ -18242,6 +21083,8 @@ </constant> <constant name="PARAM_SPIN_VELOCITY" value="3"> </constant> + <constant name="PARAM_ORBIT_VELOCITY" value="4"> + </constant> <constant name="PARAM_GRAVITY_DIRECTION" value="5"> </constant> <constant name="PARAM_GRAVITY_STRENGTH" value="6"> @@ -18250,18 +21093,88 @@ </constant> <constant name="PARAM_TANGENTIAL_ACCEL" value="8"> </constant> + <constant name="PARAM_DAMPING" value="9"> + </constant> + <constant name="PARAM_INITIAL_ANGLE" value="10"> + </constant> <constant name="PARAM_INITIAL_SIZE" value="11"> </constant> <constant name="PARAM_FINAL_SIZE" value="12"> </constant> <constant name="PARAM_HUE_VARIATION" value="13"> </constant> + <constant name="PARAM_ANIM_SPEED_SCALE" value="14"> + </constant> + <constant name="PARAM_ANIM_INITIAL_POS" value="15"> + </constant> <constant name="PARAM_MAX" value="16"> </constant> <constant name="MAX_COLOR_PHASES" value="4"> </constant> </constants> </class> +<class name="Patch9Frame" inherits="Control" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="set_texture"> + <argument index="0" name="texture" type="Object"> + </argument> + <description> + </description> + </method> + <method name="get_texture" qualifiers="const"> + <return type="Object"> + </return> + <description> + </description> + </method> + <method name="set_modulate"> + <argument index="0" name="modulate" type="Color"> + </argument> + <description> + </description> + </method> + <method name="get_modulate" qualifiers="const"> + <return type="Color"> + </return> + <description> + </description> + </method> + <method name="set_patch_margin"> + <argument index="0" name="margin" type="int"> + </argument> + <argument index="1" name="value" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_patch_margin" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="margin" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_draw_center"> + <argument index="0" name="draw_center" type="bool"> + </argument> + <description> + </description> + </method> + <method name="get_draw_center" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="Path" inherits="Spatial" category="Core"> <brief_description> </brief_description> @@ -18644,11 +21557,16 @@ Return the total gravity vector being currently applied to this body. </description> </method> - <method name="get_total_density" qualifiers="const"> + <method name="get_total_linear_damp" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="get_total_angular_damp" qualifiers="const"> <return type="float"> </return> <description> - Return the space density currently being applied to this body. </description> </method> <method name="get_inverse_mass" qualifiers="const"> @@ -18855,6 +21773,22 @@ Direct access object to a space in the [Physics2DServer]. It's used mainly to do queries against objects and areas residing in a given space. </description> <methods> + <method name="intersect_point"> + <return type="Array"> + </return> + <argument index="0" name="point" type="Vector2"> + </argument> + <argument index="1" name="max_results" type="int" default="32"> + </argument> + <argument index="2" name="exclude" type="Array" default="Array()"> + </argument> + <argument index="3" name="layer_mask" type="int" default="2147483647"> + </argument> + <argument index="4" name="type_mask" type="int" default="15"> + </argument> + <description> + </description> + </method> <method name="intersect_ray"> <return type="Dictionary"> </return> @@ -18869,7 +21803,7 @@ <argument index="4" name="type_mask" type="int" default="15"> </argument> <description> - Intersect a ray in a given space, the returned object is a dictionary with the following fields: + Intersect a ray in a given space, the returned object is a dictionary with the following fields: position: place where ray is stopped. normal: normal of the object at the point where the ray was stopped. shape: shape index of the object agaisnt which the ray was stopped. @@ -19131,6 +22065,22 @@ <description> </description> </method> + <method name="area_set_layer_mask"> + <argument index="0" name="area" type="RID"> + </argument> + <argument index="1" name="mask" type="int"> + </argument> + <description> + </description> + </method> + <method name="area_set_collision_mask"> + <argument index="0" name="area" type="RID"> + </argument> + <argument index="1" name="mask" type="int"> + </argument> + <description> + </description> + </method> <method name="area_set_param"> <argument index="0" name="area" type="RID"> </argument> @@ -19388,8 +22338,6 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="arg1" type="int"> - </argument> <description> </description> </method> @@ -19406,8 +22354,6 @@ </return> <argument index="0" name="body" type="RID"> </argument> - <argument index="1" name="arg1" type="int"> - </argument> <description> </description> </method> @@ -19499,6 +22445,38 @@ <description> </description> </method> + <method name="body_set_one_way_collision_direction"> + <argument index="0" name="normal" type="RID"> + </argument> + <argument index="1" name="arg1" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="body_get_one_way_collision_direction" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="arg0" type="RID"> + </argument> + <description> + </description> + </method> + <method name="body_set_one_way_collision_max_depth"> + <argument index="0" name="normal" type="RID"> + </argument> + <argument index="1" name="arg1" type="float"> + </argument> + <description> + </description> + </method> + <method name="body_get_one_way_collision_max_depth" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="arg0" type="RID"> + </argument> + <description> + </description> + </method> <method name="body_set_omit_force_integration"> <argument index="0" name="body" type="RID"> </argument> @@ -19527,6 +22505,20 @@ <description> </description> </method> + <method name="body_test_motion"> + <return type="bool"> + </return> + <argument index="0" name="body" type="RID"> + </argument> + <argument index="1" name="motion" type="Vector2"> + </argument> + <argument index="2" name="margin" type="float" default="0.08"> + </argument> + <argument index="3" name="result" type="Physics2DTestMotionResult" default="NULL"> + </argument> + <description> + </description> + </method> <method name="joint_set_param"> <argument index="0" name="joint" type="RID"> </argument> @@ -19661,11 +22653,15 @@ </constant> <constant name="AREA_PARAM_GRAVITY_IS_POINT" value="2"> </constant> - <constant name="AREA_PARAM_GRAVITY_POINT_ATTENUATION" value="3"> + <constant name="AREA_PARAM_GRAVITY_DISTANCE_SCALE" value="3"> + </constant> + <constant name="AREA_PARAM_GRAVITY_POINT_ATTENUATION" value="4"> </constant> - <constant name="AREA_PARAM_DENSITY" value="4"> + <constant name="AREA_PARAM_LINEAR_DAMP" value="5"> </constant> - <constant name="AREA_PARAM_PRIORITY" value="5"> + <constant name="AREA_PARAM_ANGULAR_DAMP" value="6"> + </constant> + <constant name="AREA_PARAM_PRIORITY" value="7"> </constant> <constant name="AREA_SPACE_OVERRIDE_COMBINE" value="1"> </constant> @@ -19687,7 +22683,13 @@ </constant> <constant name="BODY_PARAM_MASS" value="2"> </constant> - <constant name="BODY_PARAM_MAX" value="3"> + <constant name="BODY_PARAM_GRAVITY_SCALE" value="3"> + </constant> + <constant name="BODY_PARAM_LINEAR_DAMP" value="4"> + </constant> + <constant name="BODY_PARAM_ANGULAR_DAMP" value="5"> + </constant> + <constant name="BODY_PARAM_MAX" value="6"> </constant> <constant name="BODY_STATE_TRANSFORM" value="0"> </constant> @@ -19887,6 +22889,70 @@ <constants> </constants> </class> +<class name="Physics2DTestMotionResult" inherits="Reference" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="get_motion" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="get_motion_remainder" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="get_collision_point" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="get_collision_normal" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="get_collider_velocity" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="get_collider_id" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_collider_rid" qualifiers="const"> + <return type="RID"> + </return> + <description> + </description> + </method> + <method name="get_collider" qualifiers="const"> + <return type="Object"> + </return> + <description> + </description> + </method> + <method name="get_collider_shape" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="PhysicsBody" inherits="CollisionObject" category="Core"> <brief_description> Base class for differnt types of Physics bodies. @@ -19941,6 +23007,74 @@ <description> </description> </method> + <method name="set_collision_mask"> + <argument index="0" name="mask" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_collision_mask" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_collision_mask_bit"> + <argument index="0" name="bit" type="int"> + </argument> + <argument index="1" name="value" type="bool"> + </argument> + <description> + </description> + </method> + <method name="get_collision_mask_bit" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="bit" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_layer_mask_bit"> + <argument index="0" name="bit" type="int"> + </argument> + <argument index="1" name="value" type="bool"> + </argument> + <description> + </description> + </method> + <method name="get_layer_mask_bit" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="bit" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_one_way_collision_direction"> + <argument index="0" name="dir" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="get_one_way_collision_direction" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="set_one_way_collision_max_depth"> + <argument index="0" name="depth" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_one_way_collision_max_depth" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="add_collision_exception_with"> <argument index="0" name="body" type="PhysicsBody2D"> </argument> @@ -19969,7 +23103,13 @@ <description> </description> </method> - <method name="get_total_density" qualifiers="const"> + <method name="get_total_linear_damp" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="get_total_angular_damp" qualifiers="const"> <return type="float"> </return> <description> @@ -21249,11 +24389,15 @@ </constant> <constant name="AREA_PARAM_GRAVITY_IS_POINT" value="2"> </constant> - <constant name="AREA_PARAM_GRAVITY_POINT_ATTENUATION" value="3"> + <constant name="AREA_PARAM_GRAVITY_DISTANCE_SCALE" value="3"> </constant> - <constant name="AREA_PARAM_DENSITY" value="4"> + <constant name="AREA_PARAM_GRAVITY_POINT_ATTENUATION" value="4"> </constant> - <constant name="AREA_PARAM_PRIORITY" value="5"> + <constant name="AREA_PARAM_LINEAR_DAMP" value="5"> + </constant> + <constant name="AREA_PARAM_ANGULAR_DAMP" value="6"> + </constant> + <constant name="AREA_PARAM_PRIORITY" value="7"> </constant> <constant name="AREA_SPACE_OVERRIDE_COMBINE" value="1"> </constant> @@ -21275,7 +24419,13 @@ </constant> <constant name="BODY_PARAM_MASS" value="2"> </constant> - <constant name="BODY_PARAM_MAX" value="3"> + <constant name="BODY_PARAM_GRAVITY_SCALE" value="3"> + </constant> + <constant name="BODY_PARAM_ANGULAR_DAMP" value="5"> + </constant> + <constant name="BODY_PARAM_LINEAR_DAMP" value="4"> + </constant> + <constant name="BODY_PARAM_MAX" value="6"> </constant> <constant name="BODY_STATE_TRANSFORM" value="0"> </constant> @@ -21591,6 +24741,8 @@ </description> </method> <method name="Plane"> + <return type="Plane"> + </return> <argument index="0" name="a" type="float"> </argument> <argument index="1" name="b" type="float"> @@ -21604,6 +24756,8 @@ </description> </method> <method name="Plane"> + <return type="Plane"> + </return> <argument index="0" name="v1" type="Vector3"> </argument> <argument index="1" name="v2" type="Vector3"> @@ -21615,6 +24769,8 @@ </description> </method> <method name="Plane"> + <return type="Plane"> + </return> <argument index="0" name="normal" type="Vector3"> </argument> <argument index="1" name="d" type="float"> @@ -21751,18 +24907,6 @@ <description> </description> </method> - <method name="set_texture_repeat"> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - </description> - </method> - <method name="get_texture_repeat" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="set_invert"> <argument index="0" name="invert" type="bool"> </argument> @@ -22613,6 +25757,8 @@ </description> </method> <method name="Quat"> + <return type="Quat"> + </return> <argument index="0" name="x" type="float"> </argument> <argument index="1" name="y" type="float"> @@ -22625,6 +25771,18 @@ </description> </method> <method name="Quat"> + <return type="Quat"> + </return> + <argument index="0" name="axis" type="Vector3"> + </argument> + <argument index="1" name="angle" type="float"> + </argument> + <description> + </description> + </method> + <method name="Quat"> + <return type="Quat"> + </return> <argument index="0" name="from" type="Matrix3"> </argument> <description> @@ -22657,6 +25815,8 @@ </description> </method> <method name="RID"> + <return type="RID"> + </return> <argument index="0" name="from" type="Object"> </argument> <description> @@ -22875,6 +26035,8 @@ </description> </method> <method name="RawArray"> + <return type="RawArray"> + </return> <argument index="0" name="from" type="Array"> </argument> <description> @@ -22944,6 +26106,34 @@ <description> </description> </method> + <method name="add_exception_rid"> + <argument index="0" name="rid" type="RID"> + </argument> + <description> + </description> + </method> + <method name="add_exception"> + <argument index="0" name="node" type="Object"> + </argument> + <description> + </description> + </method> + <method name="remove_exception_rid"> + <argument index="0" name="rid" type="RID"> + </argument> + <description> + </description> + </method> + <method name="remove_exception"> + <argument index="0" name="node" type="Object"> + </argument> + <description> + </description> + </method> + <method name="clear_exceptions"> + <description> + </description> + </method> </methods> <constants> </constants> @@ -23143,6 +26333,8 @@ </description> </method> <method name="RealArray"> + <return type="RealArray"> + </return> <argument index="0" name="from" type="Array"> </argument> <description> @@ -23227,6 +26419,8 @@ </description> </method> <method name="Rect2"> + <return type="Rect2"> + </return> <argument index="0" name="pos" type="Vector2"> </argument> <argument index="1" name="size" type="Vector2"> @@ -23235,6 +26429,8 @@ </description> </method> <method name="Rect2"> + <return type="Rect2"> + </return> <argument index="0" name="x" type="float"> </argument> <argument index="1" name="y" type="float"> @@ -23356,6 +26552,30 @@ <description> </description> </method> + <method name="clear"> + <description> + </description> + </method> + <method name="is_valid" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="get_capture_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_capture" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="capture" type="int"> + </argument> + <description> + </description> + </method> <method name="get_captures" qualifiers="const"> <return type="StringArray"> </return> @@ -23498,7 +26718,7 @@ <method name="add_source"> <argument index="0" name="path" type="String"> </argument> - <argument index="1" name="md5" type="String"> + <argument index="1" name="md5" type="String" default=""""> </argument> <description> </description> @@ -23627,8 +26847,9 @@ </argument> <argument index="1" name="type_hint" type="String" default=""""> </argument> + <argument index="2" name="p_no_cache" type="bool" default="false"> + </argument> <description> - Load a resource. Optionally a hint can be given for the resource type to load. </description> </method> <method name="get_recognized_extensions_for_type"> @@ -23883,6 +27104,12 @@ <description> </description> </method> + <method name="get_v_scroll"> + <return type="Object"> + </return> + <description> + </description> + </method> <method name="set_tab_size"> <argument index="0" name="spaces" type="int"> </argument> @@ -23925,6 +27152,48 @@ <description> </description> </method> + <method name="set_bbcode"> + <argument index="0" name="text" type="String"> + </argument> + <description> + </description> + </method> + <method name="get_bbcode" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="set_visible_characters"> + <argument index="0" name="amount" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_visible_characters" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_total_character_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_use_bbcode"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_using_bbcode" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> </methods> <signals> <signal name="meta_clicked"> @@ -23981,7 +27250,15 @@ </theme_item> <theme_item name="font_color_selected" type="Color"> </theme_item> - <theme_item name="default_font" type="Font"> + <theme_item name="mono_font" type="Font"> + </theme_item> + <theme_item name="bold_italics_font" type="Font"> + </theme_item> + <theme_item name="italics_font" type="Font"> + </theme_item> + <theme_item name="bold_font" type="Font"> + </theme_item> + <theme_item name="normal_font" type="Font"> </theme_item> <theme_item name="focus" type="StyleBox"> </theme_item> @@ -24083,6 +27360,42 @@ <description> </description> </method> + <method name="set_gravity_scale"> + <argument index="0" name="gravity_scale" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_gravity_scale" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_linear_damp"> + <argument index="0" name="linear_damp" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_linear_damp" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_angular_damp"> + <argument index="0" name="angular_damp" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_angular_damp" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="set_max_contacts_reported"> <argument index="0" name="amount" type="int"> </argument> @@ -24324,6 +27637,42 @@ Return the body bounciness. </description> </method> + <method name="set_gravity_scale"> + <argument index="0" name="gravity_scale" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_gravity_scale" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_linear_damp"> + <argument index="0" name="linear_damp" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_linear_damp" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_angular_damp"> + <argument index="0" name="angular_damp" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_angular_damp" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="set_linear_velocity"> <argument index="0" name="linear_velocity" type="Vector2"> </argument> @@ -24460,6 +27809,18 @@ Return true if the body has the ability to fall asleep when not moving. See [set_can_sleep]. </description> </method> + <method name="test_motion"> + <return type="bool"> + </return> + <argument index="0" name="motion" type="Vector2"> + </argument> + <argument index="1" name="margin" type="float" default="0.08"> + </argument> + <argument index="2" name="result" type="Physics2DTestMotionResult" default="NULL"> + </argument> + <description> + </description> + </method> <method name="get_colliding_bodies" qualifiers="const"> <return type="Array"> </return> @@ -24613,7 +27974,7 @@ </class> <class name="Sample" inherits="Resource" category="Core"> <brief_description> - Audio Sample (sound) class. + Audio sample (sound) class. </brief_description> <description> Sample provides an audio sample class, containing audio data, together with some information for playback, such as format, mix rate and loop. It is used by sound playback routines. @@ -24627,21 +27988,22 @@ <argument index="2" name="length" type="int"> </argument> <description> - Create new data for the sample, with format "format" (see FORMAT_* enum), stereo hint, and length in frames (not samples or bytes!) "frame". Calling create overrides previous existing data if it exists. Stereo samples are interleaved pairs of left and right (in that order) points + Create new data for the sample, with format (see FORMAT_* constants), stereo hint, and length in frames (not samples or bytes!). + Calling this method overrides previously existing data. Stereo samples are interleaved pairs of left and right points (in that order). </description> </method> <method name="get_format" qualifiers="const"> <return type="int"> </return> <description> - Return the sample format (see FORMAT_* enum). + Return the sample format. </description> </method> <method name="is_stereo" qualifiers="const"> <return type="bool"> </return> <description> - Return true if the sample was created stereo. + Return whether the current sample was created as stereo. </description> </method> <method name="get_length" qualifiers="const"> @@ -24655,14 +28017,15 @@ <argument index="0" name="data" type="RawArray"> </argument> <description> - Set sample data. Data must be little endian, no matter the host platform, and exactly as long to fit all frames. Example, if data is Stereo, 16 bits, 256 frames, it will be 1024 bytes long. + Set sample data. Data must be little endian, no matter the host platform, and exactly as long as to fit all frames. + For example, if data is stereo, 16 bits, 256 frames, it will be 1024 bytes long. </description> </method> <method name="get_data" qualifiers="const"> <return type="RawArray"> </return> <description> - Return sample data. Data will be little endian, no matter the host platform, and exactly as long to fit all frames. Example, if data is Stereo, 16 bits, 256 frames, it will be 1024 bytes long. + Return sample data as little endian. </description> </method> <method name="set_mix_rate"> @@ -24676,28 +28039,28 @@ <return type="int"> </return> <description> - Return the mix rate for the sample (expected playback frequency). + Return the mix rate for the sample. </description> </method> <method name="set_loop_format"> <argument index="0" name="format" type="int"> </argument> <description> - Set the loop format, see LOOP_* enum + Set the loop format (use LOOP_* constants as argument). </description> </method> <method name="get_loop_format" qualifiers="const"> <return type="int"> </return> <description> - Return the loop format, see LOOP_* enum. + Return the loop format. </description> </method> <method name="set_loop_begin"> <argument index="0" name="pos" type="int"> </argument> <description> - Set the loop begin position, it must be a valid frame and less than the loop end position. + Set the loop begin position. It must be a valid frame and less than the loop end position. </description> </method> <method name="get_loop_begin" qualifiers="const"> @@ -24711,23 +28074,23 @@ <argument index="0" name="pos" type="int"> </argument> <description> - Set the loop end position, it must be a valid frame and greater than the loop begin position. + Set the loop end position. It must be a valid frame and greater than the loop begin position. </description> </method> <method name="get_loop_end" qualifiers="const"> <return type="int"> </return> <description> - Return the loop begin position. + Return the loop end position. </description> </method> </methods> <constants> <constant name="FORMAT_PCM8" value="0"> - 8-Bits signed little endian PCM audio. + 8-bits signed little endian PCM audio. </constant> <constant name="FORMAT_PCM16" value="1"> - 16-Bits signed little endian PCM audio. + 16-bits signed little endian PCM audio. </constant> <constant name="FORMAT_IMA_ADPCM" value="2"> IMA-ADPCM Audio. @@ -24736,19 +28099,19 @@ No loop enabled. </constant> <constant name="LOOP_FORWARD" value="1"> - Forward looping (when playback reaches loop end, goes back to loop begin) + Forward looping (when playback reaches loop end, goes back to loop begin). </constant> <constant name="LOOP_PING_PONG" value="2"> - Ping-Pong looping (when playback reaches loop end, plays backward untilloop begin). Not available in all platforms. + Ping-pong looping (when playback reaches loop end, plays backward until loop begin). Not available in all platforms. </constant> </constants> </class> <class name="SampleLibrary" inherits="Resource" category="Core"> <brief_description> - Library that contains a collection of Samples. + Library that contains a collection of samples. </brief_description> <description> - Library that contains a collection of Samples, each identified by an text id. This is used as a data containeer for the majority of the SamplePlayer classes and derivatives. + Library that contains a collection of [Sample]s, each identified by a text ID. This is used as a data container for the majority of the SamplePlayer classes and derivatives. </description> <methods> <method name="add_sample"> @@ -24757,7 +28120,7 @@ <argument index="1" name="sample" type="Sample"> </argument> <description> - Add a sample to the library, with a given text id. + Add a sample to the library, with a given text ID. </description> </method> <method name="get_sample" qualifiers="const"> @@ -24766,7 +28129,7 @@ <argument index="0" name="name" type="String"> </argument> <description> - Return a sample from the library, from a given text-id. Return null if the sample is not found. + Return the sample from the library matching the given text ID. Return null if the sample is not found. </description> </method> <method name="has_sample" qualifiers="const"> @@ -24775,14 +28138,14 @@ <argument index="0" name="name" type="String"> </argument> <description> - Return true if the sample text id exists in the library. + Return true if the sample text ID exists in the library. </description> </method> <method name="remove_sample"> <argument index="0" name="name" type="String"> </argument> <description> - Remove a sample given a specific text id. + Remove the sample matching the given text ID. </description> </method> <method name="sample_set_volume_db"> @@ -24791,6 +28154,7 @@ <argument index="1" name="db" type="float"> </argument> <description> + Set the volume (in dB) for the given sample. </description> </method> <method name="sample_get_volume_db" qualifiers="const"> @@ -24799,6 +28163,7 @@ <argument index="0" name="name" type="String"> </argument> <description> + Return the volume (in dB) for the given sample. </description> </method> <method name="sample_set_pitch_scale"> @@ -24807,6 +28172,7 @@ <argument index="1" name="pitch" type="float"> </argument> <description> + Set the pitch scale for the given sample. </description> </method> <method name="sample_get_pitch_scale" qualifiers="const"> @@ -24815,6 +28181,7 @@ <argument index="0" name="name" type="String"> </argument> <description> + Return the pitch scale for the given sample. </description> </method> </methods> @@ -24833,26 +28200,28 @@ <argument index="0" name="library" type="SampleLibrary"> </argument> <description> + Set the sample library for the player. </description> </method> <method name="get_sample_library" qualifiers="const"> <return type="SampleLibrary"> </return> <description> + Return the sample library used by the player. </description> </method> - <method name="set_voice_count"> + <method name="set_polyphony"> <argument index="0" name="max_voices" type="int"> </argument> <description> - Set the amount of simultaneous voices that will be used for playback. + Set the polyphony of the player (maximum amount of simultaneous voices). </description> </method> - <method name="get_voice_count" qualifiers="const"> + <method name="get_polyphony" qualifiers="const"> <return type="int"> </return> <description> - Return the amount of simultaneous voices that will be used for playback. + Return the polyphony of the player. </description> </method> <method name="play"> @@ -24863,18 +28232,20 @@ <argument index="1" name="unique" type="bool" default="false"> </argument> <description> - Play back sample, given it's identifier "name". If "unique" is true, all othere previous samples will be stopped. The voice allocated for playback will be returned. + Play a sample referenced by its name. + Optionally, the playback can be made "unique" to force stopping all other samples currently played. The voices allocated for playback will then be returned. </description> </method> <method name="stop"> <argument index="0" name="voice" type="int"> </argument> <description> - Stop a voice "voice". (see [method play]). + Stop a given voice. </description> </method> <method name="stop_all"> <description> + Stop all playing voices. </description> </method> <method name="set_mix_rate"> @@ -24883,7 +28254,7 @@ <argument index="1" name="hz" type="int"> </argument> <description> - Change the mix rate of a voice "voice" to given "hz". + Set the mix rate (in Hz) of a given voice. </description> </method> <method name="set_pitch_scale"> @@ -24892,24 +28263,28 @@ <argument index="1" name="ratio" type="float"> </argument> <description> - Scale the pitch (mix rate) of a voice by a ratio value "ratio". A ratio of 1.0 means the voice is unscaled. + Set the pitch scale of a given voice. A ratio of 1.0 is the normal scale. </description> </method> <method name="set_volume"> <argument index="0" name="voice" type="int"> </argument> - <argument index="1" name="nrg" type="float"> + <argument index="1" name="volume" type="float"> </argument> <description> - Set the volume of a voice, 0db is maximum volume (every about -6db, volume is reduced in half). "db" does in fact go from zero to negative. + Set the volume of a given voice using a linear scale. + The "volume" argument should be a positive factor ranging from 0.0 (mute) up to 16.0 (i.e. 24 dB). + A factor of 1.0 means that the voice will be played at normal system volume. Factors above 1.0 might be limited by the platform's audio output. </description> </method> <method name="set_volume_db"> <argument index="0" name="voice" type="int"> </argument> - <argument index="1" name="nrg" type="float"> + <argument index="1" name="db" type="float"> </argument> <description> + Set the volume of a given voice in dB. + The "dB" argument can range from -80 to 24 dB, 0 dB being the maximum volume. Every 6 dB (resp. -6 dB), the volume is increased (resp. reduced) by half. </description> </method> <method name="set_pan"> @@ -24922,7 +28297,8 @@ <argument index="3" name="height" type="float" default="0"> </argument> <description> - Set the panning of a voice. Panning goes from -1 (left) to +1 (right). Optionally, if the hardware supports 3D sound, also set depth and height (also in range -1 to +1). + Set the panning of a voice. Panning goes from -1.0 (left) to +1.0 (right). + Optionally, for hardware than support 3D sound, one can also set depth and height (also in range -1.0 to +1.0). </description> </method> <method name="set_filter"> @@ -24937,7 +28313,8 @@ <argument index="4" name="gain" type="float" default="0"> </argument> <description> - Set and enable a filter of a voice, with type "type" (see FILTER_* enum), cutoff (0 to 22khz) frequency and resonance (0+). + Set the filter for a given voice, using the given type (see FILTER_* constants), cutoff frequency (from 20 to 16,384 Hz) and resonance (from 0 to 4.0). + Optionally, a gain can also be given (from 0 to 2.0). </description> </method> <method name="set_chorus"> @@ -24946,7 +28323,7 @@ <argument index="1" name="send" type="float"> </argument> <description> - Set the chorus send level of a voice (0 to 1). For setting chorus parameters, see [AudioServer]. + Set the chorus send level of a voice (from 0 to 1.0). For setting chorus parameters, see [AudioServer]. </description> </method> <method name="set_reverb"> @@ -24957,7 +28334,7 @@ <argument index="2" name="send" type="float"> </argument> <description> - Set the reverb send level and type of a voice (0 to 1). (see REVERB_* enum for type). + Set the reverberation type (see REVERB_* constants) and send level (from 0 to 1.0) of a voice. </description> </method> <method name="get_mix_rate" qualifiers="const"> @@ -24984,7 +28361,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return the current volume (in db) for a given voice. 0db is maximum volume (every about -6db, volume is reduced in half). "db" does in fact go from zero to negative. + Return the current volume (on a linear scale) for a given voice. </description> </method> <method name="get_volume_db" qualifiers="const"> @@ -24993,6 +28370,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> + Return the current volume (in dB) for a given voice. </description> </method> <method name="get_pan" qualifiers="const"> @@ -25001,7 +28379,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return the current panning for a given voice. Panning goes from -1 (left) to +1 (right). + Return the current panning for a given voice. </description> </method> <method name="get_pan_depth" qualifiers="const"> @@ -25010,7 +28388,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return the current pan depth for a given voice (not used unless the hardware supports 3D sound) + Return the current pan depth for a given voice. </description> </method> <method name="get_pan_height" qualifiers="const"> @@ -25019,7 +28397,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return the current pan height for a given voice (not used unless the hardware supports 3D sound) + Return the current pan height for a given voice. </description> </method> <method name="get_filter_type" qualifiers="const"> @@ -25028,7 +28406,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return the current filter type in use (see FILTER_* enum) for a given voice. + Return the current filter type in use (see FILTER_* constants) for a given voice. </description> </method> <method name="get_filter_cutoff" qualifiers="const"> @@ -25037,7 +28415,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return the current filter cutoff for a given voice. Cutoff goes from 0 to 22khz. + Return the current filter cutoff frequency for a given voice. </description> </method> <method name="get_filter_resonance" qualifiers="const"> @@ -25046,7 +28424,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return the current filter resonance for a given voice. Resonance goes from 0 up. + Return the current filter resonance for a given voice. </description> </method> <method name="get_filter_gain" qualifiers="const"> @@ -25055,6 +28433,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> + Return the current filter gain for a given voice. </description> </method> <method name="get_chorus" qualifiers="const"> @@ -25063,16 +28442,16 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return the current chorus send level for a given voice. (0 to 1). + Return the current chorus send level for a given voice. </description> </method> <method name="get_reverb_room" qualifiers="const"> - <return type="float"> + <return type="int"> </return> <argument index="0" name="voice" type="int"> </argument> <description> - Return the current reverb room type for a given voice (see REVERB_* enum). + Return the current reverberation room type for a given voice (see REVERB_* enum). </description> </method> <method name="get_reverb" qualifiers="const"> @@ -25081,25 +28460,31 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return the current reverb send level for a given voice. (0 to 1). + Return the current reverberation send level for a given voice. </description> </method> <method name="set_default_pitch_scale"> <argument index="0" name="ratio" type="float"> </argument> <description> + Set the default pitch scale of the player. A ratio of 1.0 is the normal scale. </description> </method> <method name="set_default_volume"> - <argument index="0" name="nrg" type="float"> + <argument index="0" name="volume" type="float"> </argument> <description> + Set the default volume of the player using a linear scale. + The "volume" argument should be a positive factor ranging from 0.0 (mute) up to 16.0 (i.e. 24 dB). + A factor of 1.0 means that the voice will be played at normal system volume. Factors above 1.0 might be limited by the platform's audio output. </description> </method> <method name="set_default_volume_db"> <argument index="0" name="db" type="float"> </argument> <description> + Set the default volume of the player in dB. + The "dB" argument can range from -80 to 24 dB, 0 dB being the maximum volume. Every 6 dB (resp. -6 dB), the volume is increased (resp. reduced) by half. </description> </method> <method name="set_default_pan"> @@ -25110,6 +28495,8 @@ <argument index="2" name="height" type="float" default="0"> </argument> <description> + Set the default panning of the player. Panning goes from -1.0 (left) to +1.0 (right). + Optionally, for hardware than support 3D sound, one can also set depth and height (also in range -1.0 to +1.0). </description> </method> <method name="set_default_filter"> @@ -25122,12 +28509,15 @@ <argument index="3" name="gain" type="float" default="0"> </argument> <description> + Set the default filter for the player, using the given type (see FILTER_* constants), cutoff frequency (from 20 to 16,384 Hz) and resonance (from 0 to 4.0). + Optionally, a gain can also be given (from 0 to 2.0). </description> </method> <method name="set_default_chorus"> <argument index="0" name="send" type="float"> </argument> <description> + Set the default chorus send level of the player (from 0 to 1.0). For setting chorus parameters, see [AudioServer]. </description> </method> <method name="set_default_reverb"> @@ -25136,90 +28526,105 @@ <argument index="1" name="send" type="float"> </argument> <description> + Set the default reverberation type (see REVERB_* constants) and send level (from 0 to 1.0) of the player. </description> </method> <method name="get_default_pitch_scale" qualifiers="const"> <return type="float"> </return> <description> + Return the default pitch scale of the player. </description> </method> <method name="get_default_volume" qualifiers="const"> <return type="float"> </return> <description> + Return the default volume (on a linear scale) of the player. </description> </method> <method name="get_default_volume_db" qualifiers="const"> <return type="float"> </return> <description> + Return the default volume (in dB) of the player. </description> </method> <method name="get_default_pan" qualifiers="const"> <return type="float"> </return> <description> + Return the default panning of the player. </description> </method> <method name="get_default_pan_depth" qualifiers="const"> <return type="float"> </return> <description> + Return the default pan depth of the player. </description> </method> <method name="get_default_pan_height" qualifiers="const"> <return type="float"> </return> <description> + Return the default pan height of the player. </description> </method> <method name="get_default_filter_type" qualifiers="const"> <return type="int"> </return> <description> + Return the default filter type in use (see FILTER_* constants) for the player. </description> </method> <method name="get_default_filter_cutoff" qualifiers="const"> <return type="float"> </return> <description> + Return the default filter cutoff frequency of the player. </description> </method> <method name="get_default_filter_resonance" qualifiers="const"> <return type="float"> </return> <description> + Return the default filter resonance of the player. </description> </method> <method name="get_default_filter_gain" qualifiers="const"> <return type="float"> </return> <description> + Return the default filter gain of the player. </description> </method> <method name="get_default_chorus" qualifiers="const"> <return type="float"> </return> <description> + Return the default chorus send level of the player. </description> </method> <method name="get_default_reverb_room" qualifiers="const"> - <return type="float"> + <return type="int"> </return> <description> + Return the default reverberation room type of the player (see REVERB_* enum). </description> </method> <method name="get_default_reverb" qualifiers="const"> <return type="float"> </return> <description> + Return the default reverberation send level of the player. </description> </method> <method name="is_active" qualifiers="const"> <return type="bool"> </return> <description> + Return whether the player is currently active. </description> </method> <method name="is_voice_active" qualifiers="const"> @@ -25228,6 +28633,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> + Return whether the given voice is currently active. </description> </method> </methods> @@ -25236,46 +28642,52 @@ Filter is disabled for voice. </constant> <constant name="FILTER_LOWPASS" value="1"> - Lowpass filter is used for voice. + Low-pass filter is used for voice. </constant> <constant name="FILTER_BANDPASS" value="2"> - Bandpass filter is used for voice. + Band-pass filter is used for voice. </constant> <constant name="FILTER_HIPASS" value="3"> - Highpass filter is used for voice. + High-pass filter is used for voice. </constant> <constant name="FILTER_NOTCH" value="4"> Notch (band reject) filter is used for voice. </constant> <constant name="FILTER_PEAK" value="5"> + Peak (exclusive band) filter is used for voice. </constant> <constant name="FILTER_BANDLIMIT" value="6"> - Band-limit filter is used for voice, in this case resonance is the highpass cutoff. A band-limit filter has a different frequency response than a notch filter, but otherwise both are band-rejecting filters. + Band-limit filter is used for voice, in this case resonance is the high-pass cutoff. A band-limit filter has a different frequency response than a notch filter, but otherwise both are band-rejecting filters. </constant> <constant name="FILTER_LOW_SHELF" value="7"> + Low-shelf filter is used for voice. </constant> <constant name="FILTER_HIGH_SHELF" value="8"> + High-shelf filter is used for voice. </constant> <constant name="REVERB_SMALL" value="0"> - Small reverb room (house room). + Small reverberation room (house room). </constant> <constant name="REVERB_MEDIUM" value="1"> - Medium reverb room (street) + Medium reverberation room (street) </constant> <constant name="REVERB_LARGE" value="2"> - Large reverb room (Theather) + Large reverberation room (theatre) </constant> <constant name="REVERB_HALL" value="3"> - Huge reverb room (cathedral, warehouse). + Huge reverberation room (cathedral, warehouse). + </constant> + <constant name="INVALID_VOICE_ID" value="-1"> + Value returned if the voice ID is invalid. </constant> </constants> </class> <class name="SamplePlayer2D" inherits="SoundPlayer2D" category="Core"> <brief_description> - Sample player for Positional 2D Sound. + Sample player for positional 2D Sound. </brief_description> <description> - Sample player for Positional 2D Sound. Plays sound samples positionally, left and right depending on the distance/place on the screen. + Sample player for positional 2D Sound. Plays sound samples positionally, left and right depending on the distance/place on the screen. </description> <methods> <method name="set_sample_library"> @@ -25289,11 +28701,11 @@ <return type="SampleLibrary"> </return> <description> - Return the sample library used for the player. + Return the sample library used by the player. </description> </method> <method name="set_polyphony"> - <argument index="0" name="voices" type="int"> + <argument index="0" name="max_voices" type="int"> </argument> <description> Set the polyphony of the player (maximum amount of simultaneous voices). @@ -25303,7 +28715,7 @@ <return type="int"> </return> <description> - Return the polyphony of the player (maximum amount of simultaneous voices). + Return the polyphony of the player. </description> </method> <method name="play"> @@ -25314,7 +28726,8 @@ <argument index="1" name="voice" type="int" default="-2"> </argument> <description> - Play a sample, an internal polyphony id can be passed, or else it's assigned automatically. Returns a voice id which can be used to modify the voice parameters. + Play a sample. An internal polyphony ID can optionally be passed, or defaults to NEXT_VOICE. + Return a voice ID which can be used to modify the voice parameters, or INVALID_VOICE if the voice or sample are invalid. </description> </method> <method name="voice_set_pitch_scale"> @@ -25332,7 +28745,7 @@ <argument index="1" name="db" type="float"> </argument> <description> - Change the volume scale of a currently playing voice (using dB). + Change the volume scale (in dB) of a currently playing voice. </description> </method> <method name="is_voice_active" qualifiers="const"> @@ -25341,7 +28754,7 @@ <argument index="0" name="voice" type="int"> </argument> <description> - Return true if a voice is still active (false if it stopped playing). + Return whether a voice is still active or has stopped playing. </description> </method> <method name="stop_voice"> @@ -25360,20 +28773,26 @@ <argument index="0" name="val" type="float"> </argument> <description> + Set the amplitude for random pitch scale variations. If different from zero, the pitch scale will vary randomly around 1.0 in a range defined by val. + The actual pitch scale will be, with "variation" ranging from -val to val: + * variation > 0: 1.0 + variation + * variation < 0: 1.0/(1.0 - variation) </description> </method> <method name="get_random_pitch_scale" qualifiers="const"> <return type="float"> </return> <description> + Return the amplitude used for random pitch scale variations. </description> </method> </methods> <constants> <constant name="INVALID_VOICE" value="-1"> - If the voice is invalid, this is returned. + Value returned if the voice or sample are invalid. </constant> <constant name="NEXT_VOICE" value="-2"> + Default voice for the play method. Corresponds to the first voice following the last used voice. </constant> </constants> </class> @@ -25437,6 +28856,30 @@ <description> </description> </method> + <method name="set_debug_collisions_hint"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_debugging_collisions_hint" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="set_debug_navigation_hint"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_debugging_navigation_hint" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="set_edited_scene_root"> <argument index="0" name="scene" type="Object"> </argument> @@ -25517,6 +28960,40 @@ <description> </description> </method> + <method name="set_current_scene"> + <argument index="0" name="child_node" type="Node"> + </argument> + <description> + </description> + </method> + <method name="get_current_scene" qualifiers="const"> + <return type="Node"> + </return> + <description> + </description> + </method> + <method name="change_scene"> + <return type="int"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </method> + <method name="change_scene_to"> + <return type="int"> + </return> + <argument index="0" name="packed_scene" type="PackedScene"> + </argument> + <description> + </description> + </method> + <method name="reload_current_scene"> + <return type="int"> + </return> + <description> + </description> + </method> </methods> <signals> <signal name="screen_resized"> @@ -25529,10 +29006,18 @@ <description> </description> </signal> + <signal name="idle_frame"> + <description> + </description> + </signal> <signal name="tree_changed"> <description> </description> </signal> + <signal name="fixed_frame"> + <description> + </description> + </signal> </signals> <constants> <constant name="GROUP_CALL_DEFAULT" value="0"> @@ -25740,13 +29225,13 @@ </description> <methods> <method name="wait"> - <return type="int"> + <return type="Error"> </return> <description> </description> </method> <method name="post"> - <return type="int"> + <return type="Error"> </return> <description> </description> @@ -25775,12 +29260,6 @@ To be changed, ignore. </description> <methods> - <method name="set_mode"> - <argument index="0" name="mode" type="int"> - </argument> - <description> - </description> - </method> <method name="get_mode" qualifiers="const"> <return type="int"> </return> @@ -25819,6 +29298,22 @@ <description> </description> </method> + <method name="set_default_texture_param"> + <argument index="0" name="param" type="String"> + </argument> + <argument index="1" name="texture" type="Texture"> + </argument> + <description> + </description> + </method> + <method name="get_default_texture_param" qualifiers="const"> + <return type="Texture"> + </return> + <argument index="0" name="param" type="String"> + </argument> + <description> + </description> + </method> <method name="has_param" qualifiers="const"> <return type="bool"> </return> @@ -25837,6 +29332,852 @@ </constant> </constants> </class> +<class name="ShaderGraph" inherits="Shader" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="node_add"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="node_type" type="int"> + </argument> + <argument index="2" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="node_remove"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="node_set_pos"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="pos" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="node_get_pos" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="node_get_type" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_node_list" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <description> + </description> + </method> + <method name="scalar_const_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="float"> + </argument> + <description> + </description> + </method> + <method name="scalar_const_node_get_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="arg2" type="float"> + </argument> + <description> + </description> + </method> + <method name="vec_const_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="vec_const_node_get_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="arg2" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="rgb_const_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="Color"> + </argument> + <description> + </description> + </method> + <method name="rgb_const_node_get_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="arg2" type="Color"> + </argument> + <description> + </description> + </method> + <method name="xform_const_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="Transform"> + </argument> + <description> + </description> + </method> + <method name="xform_const_node_get_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="arg2" type="Transform"> + </argument> + <description> + </description> + </method> + <method name="texture_node_set_filter_size"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="filter_size" type="int"> + </argument> + <description> + </description> + </method> + <method name="texture_node_get_filter_size"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="arg2" type="int"> + </argument> + <description> + </description> + </method> + <method name="texture_node_set_filter_strength"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <argument index="2" name="filter_strength" type="float"> + </argument> + <description> + </description> + </method> + <method name="texture_node_get_filter_strength"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <argument index="2" name="arg2" type="float"> + </argument> + <description> + </description> + </method> + <method name="scalar_op_node_set_op"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <argument index="2" name="op" type="int"> + </argument> + <description> + </description> + </method> + <method name="scalar_op_node_get_op" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <description> + </description> + </method> + <method name="vec_op_node_set_op"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <argument index="2" name="op" type="int"> + </argument> + <description> + </description> + </method> + <method name="vec_op_node_get_op" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <description> + </description> + </method> + <method name="vec_scalar_op_node_set_op"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <argument index="2" name="op" type="int"> + </argument> + <description> + </description> + </method> + <method name="vec_scalar_op_node_get_op" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <description> + </description> + </method> + <method name="rgb_op_node_set_op"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <argument index="2" name="op" type="int"> + </argument> + <description> + </description> + </method> + <method name="rgb_op_node_get_op" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="float"> + </argument> + <description> + </description> + </method> + <method name="xform_vec_mult_node_set_no_translation"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="disable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="xform_vec_mult_node_get_no_translation" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="scalar_func_node_set_function"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="func" type="int"> + </argument> + <description> + </description> + </method> + <method name="scalar_func_node_get_function" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="vec_func_node_set_function"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="func" type="int"> + </argument> + <description> + </description> + </method> + <method name="vec_func_node_get_function" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="input_node_set_name"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="input_node_get_name"> + <return type="String"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="scalar_input_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="float"> + </argument> + <description> + </description> + </method> + <method name="scalar_input_node_get_value" qualifiers="const"> + <return type="float"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="vec_input_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="vec_input_node_get_value" qualifiers="const"> + <return type="Vector3"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="rgb_input_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="Color"> + </argument> + <description> + </description> + </method> + <method name="rgb_input_node_get_value" qualifiers="const"> + <return type="Color"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="xform_input_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="Transform"> + </argument> + <description> + </description> + </method> + <method name="xform_input_node_get_value" qualifiers="const"> + <return type="Transform"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="texture_input_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="Texture"> + </argument> + <description> + </description> + </method> + <method name="texture_input_node_get_value" qualifiers="const"> + <return type="Texture"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="cubemap_input_node_set_value"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="value" type="CubeMap"> + </argument> + <description> + </description> + </method> + <method name="cubemap_input_node_get_value" qualifiers="const"> + <return type="CubeMap"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="comment_node_set_text"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="text" type="String"> + </argument> + <description> + </description> + </method> + <method name="comment_node_get_text" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="color_ramp_node_set_ramp"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="colors" type="ColorArray"> + </argument> + <argument index="3" name="offsets" type="RealArray"> + </argument> + <description> + </description> + </method> + <method name="color_ramp_node_get_colors" qualifiers="const"> + <return type="ColorArray"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="color_ramp_node_get_offsets" qualifiers="const"> + <return type="RealArray"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="curve_map_node_set_points"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="points" type="Vector2Array"> + </argument> + <description> + </description> + </method> + <method name="curve_map_node_get_points" qualifiers="const"> + <return type="Vector2Array"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + <method name="connect_node"> + <return type="Error"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="src_id" type="int"> + </argument> + <argument index="2" name="src_slot" type="int"> + </argument> + <argument index="3" name="dst_id" type="int"> + </argument> + <argument index="4" name="dst_slot" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_node_connected" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="src_id" type="int"> + </argument> + <argument index="2" name="src_slot" type="int"> + </argument> + <argument index="3" name="dst_id" type="int"> + </argument> + <argument index="4" name="dst_slot" type="int"> + </argument> + <description> + </description> + </method> + <method name="disconnect_node"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="src_id" type="int"> + </argument> + <argument index="2" name="src_slot" type="int"> + </argument> + <argument index="3" name="dst_id" type="int"> + </argument> + <argument index="4" name="dst_slot" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_node_connections" qualifiers="const"> + <return type="Array"> + </return> + <argument index="0" name="shader_type" type="int"> + </argument> + <description> + </description> + </method> + <method name="clear"> + <argument index="0" name="shader_type" type="int"> + </argument> + <description> + </description> + </method> + <method name="node_set_state"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <argument index="2" name="state" type="var"> + </argument> + <description> + </description> + </method> + <method name="node_get_state" qualifiers="const"> + <argument index="0" name="shader_type" type="int"> + </argument> + <argument index="1" name="id" type="int"> + </argument> + <description> + </description> + </method> + </methods> + <signals> + <signal name="updated"> + <description> + </description> + </signal> + </signals> + <constants> + <constant name="NODE_INPUT" value="0"> + </constant> + <constant name="NODE_SCALAR_CONST" value="1"> + </constant> + <constant name="NODE_VEC_CONST" value="2"> + </constant> + <constant name="NODE_RGB_CONST" value="3"> + </constant> + <constant name="NODE_XFORM_CONST" value="4"> + </constant> + <constant name="NODE_TIME" value="5"> + </constant> + <constant name="NODE_SCREEN_TEX" value="6"> + </constant> + <constant name="NODE_SCALAR_OP" value="7"> + </constant> + <constant name="NODE_VEC_OP" value="8"> + </constant> + <constant name="NODE_VEC_SCALAR_OP" value="9"> + </constant> + <constant name="NODE_RGB_OP" value="10"> + </constant> + <constant name="NODE_XFORM_MULT" value="11"> + </constant> + <constant name="NODE_XFORM_VEC_MULT" value="12"> + </constant> + <constant name="NODE_XFORM_VEC_INV_MULT" value="13"> + </constant> + <constant name="NODE_SCALAR_FUNC" value="14"> + </constant> + <constant name="NODE_VEC_FUNC" value="15"> + </constant> + <constant name="NODE_VEC_LEN" value="16"> + </constant> + <constant name="NODE_DOT_PROD" value="17"> + </constant> + <constant name="NODE_VEC_TO_SCALAR" value="18"> + </constant> + <constant name="NODE_SCALAR_TO_VEC" value="19"> + </constant> + <constant name="NODE_VEC_TO_XFORM" value="21"> + </constant> + <constant name="NODE_XFORM_TO_VEC" value="20"> + </constant> + <constant name="NODE_SCALAR_INTERP" value="22"> + </constant> + <constant name="NODE_VEC_INTERP" value="23"> + </constant> + <constant name="NODE_COLOR_RAMP" value="24"> + </constant> + <constant name="NODE_CURVE_MAP" value="25"> + </constant> + <constant name="NODE_SCALAR_INPUT" value="26"> + </constant> + <constant name="NODE_VEC_INPUT" value="27"> + </constant> + <constant name="NODE_RGB_INPUT" value="28"> + </constant> + <constant name="NODE_XFORM_INPUT" value="29"> + </constant> + <constant name="NODE_TEXTURE_INPUT" value="30"> + </constant> + <constant name="NODE_CUBEMAP_INPUT" value="31"> + </constant> + <constant name="NODE_DEFAULT_TEXTURE" value="32"> + </constant> + <constant name="NODE_OUTPUT" value="33"> + </constant> + <constant name="NODE_COMMENT" value="34"> + </constant> + <constant name="NODE_TYPE_MAX" value="35"> + </constant> + <constant name="SLOT_TYPE_SCALAR" value="0"> + </constant> + <constant name="SLOT_TYPE_VEC" value="1"> + </constant> + <constant name="SLOT_TYPE_XFORM" value="2"> + </constant> + <constant name="SLOT_TYPE_TEXTURE" value="3"> + </constant> + <constant name="SLOT_MAX" value="4"> + </constant> + <constant name="SHADER_TYPE_VERTEX" value="0"> + </constant> + <constant name="SHADER_TYPE_FRAGMENT" value="1"> + </constant> + <constant name="SHADER_TYPE_LIGHT" value="2"> + </constant> + <constant name="SHADER_TYPE_MAX" value="3"> + </constant> + <constant name="SLOT_IN" value="0"> + </constant> + <constant name="SLOT_OUT" value="1"> + </constant> + <constant name="GRAPH_OK" value="0"> + </constant> + <constant name="GRAPH_ERROR_CYCLIC" value="1"> + </constant> + <constant name="GRAPH_ERROR_MISSING_CONNECTIONS" value="2"> + </constant> + <constant name="SCALAR_OP_ADD" value="0"> + </constant> + <constant name="SCALAR_OP_SUB" value="1"> + </constant> + <constant name="SCALAR_OP_MUL" value="2"> + </constant> + <constant name="SCALAR_OP_DIV" value="3"> + </constant> + <constant name="SCALAR_OP_MOD" value="4"> + </constant> + <constant name="SCALAR_OP_POW" value="5"> + </constant> + <constant name="SCALAR_OP_MAX" value="6"> + </constant> + <constant name="SCALAR_OP_MIN" value="7"> + </constant> + <constant name="SCALAR_OP_ATAN2" value="8"> + </constant> + <constant name="SCALAR_MAX_OP" value="9"> + </constant> + <constant name="VEC_OP_ADD" value="0"> + </constant> + <constant name="VEC_OP_SUB" value="1"> + </constant> + <constant name="VEC_OP_MUL" value="2"> + </constant> + <constant name="VEC_OP_DIV" value="3"> + </constant> + <constant name="VEC_OP_MOD" value="4"> + </constant> + <constant name="VEC_OP_POW" value="5"> + </constant> + <constant name="VEC_OP_MAX" value="6"> + </constant> + <constant name="VEC_OP_MIN" value="7"> + </constant> + <constant name="VEC_OP_CROSS" value="8"> + </constant> + <constant name="VEC_MAX_OP" value="9"> + </constant> + <constant name="VEC_SCALAR_OP_MUL" value="0"> + </constant> + <constant name="VEC_SCALAR_OP_DIV" value="1"> + </constant> + <constant name="VEC_SCALAR_OP_POW" value="2"> + </constant> + <constant name="VEC_SCALAR_MAX_OP" value="3"> + </constant> + <constant name="RGB_OP_SCREEN" value="0"> + </constant> + <constant name="RGB_OP_DIFFERENCE" value="1"> + </constant> + <constant name="RGB_OP_DARKEN" value="2"> + </constant> + <constant name="RGB_OP_LIGHTEN" value="3"> + </constant> + <constant name="RGB_OP_OVERLAY" value="4"> + </constant> + <constant name="RGB_OP_DODGE" value="5"> + </constant> + <constant name="RGB_OP_BURN" value="6"> + </constant> + <constant name="RGB_OP_SOFT_LIGHT" value="7"> + </constant> + <constant name="RGB_OP_HARD_LIGHT" value="8"> + </constant> + <constant name="RGB_MAX_OP" value="9"> + </constant> + <constant name="SCALAR_FUNC_SIN" value="0"> + </constant> + <constant name="SCALAR_FUNC_COS" value="1"> + </constant> + <constant name="SCALAR_FUNC_TAN" value="2"> + </constant> + <constant name="SCALAR_FUNC_ASIN" value="3"> + </constant> + <constant name="SCALAR_FUNC_ACOS" value="4"> + </constant> + <constant name="SCALAR_FUNC_ATAN" value="5"> + </constant> + <constant name="SCALAR_FUNC_SINH" value="6"> + </constant> + <constant name="SCALAR_FUNC_COSH" value="7"> + </constant> + <constant name="SCALAR_FUNC_TANH" value="8"> + </constant> + <constant name="SCALAR_FUNC_LOG" value="9"> + </constant> + <constant name="SCALAR_FUNC_EXP" value="10"> + </constant> + <constant name="SCALAR_FUNC_SQRT" value="11"> + </constant> + <constant name="SCALAR_FUNC_ABS" value="12"> + </constant> + <constant name="SCALAR_FUNC_SIGN" value="13"> + </constant> + <constant name="SCALAR_FUNC_FLOOR" value="14"> + </constant> + <constant name="SCALAR_FUNC_ROUND" value="15"> + </constant> + <constant name="SCALAR_FUNC_CEIL" value="16"> + </constant> + <constant name="SCALAR_FUNC_FRAC" value="17"> + </constant> + <constant name="SCALAR_FUNC_SATURATE" value="18"> + </constant> + <constant name="SCALAR_FUNC_NEGATE" value="19"> + </constant> + <constant name="SCALAR_MAX_FUNC" value="20"> + </constant> + <constant name="VEC_FUNC_NORMALIZE" value="0"> + </constant> + <constant name="VEC_FUNC_SATURATE" value="1"> + </constant> + <constant name="VEC_FUNC_NEGATE" value="2"> + </constant> + <constant name="VEC_FUNC_RECIPROCAL" value="3"> + </constant> + <constant name="VEC_FUNC_RGB2HSV" value="4"> + </constant> + <constant name="VEC_FUNC_HSV2RGB" value="5"> + </constant> + <constant name="VEC_MAX_FUNC" value="6"> + </constant> + </constants> +</class> <class name="ShaderMaterial" inherits="Material" category="Core"> <brief_description> </brief_description> @@ -26019,6 +30360,12 @@ Return the amount of bones in the skeleton. </description> </method> + <method name="unparent_bone_and_rest"> + <argument index="0" name="bone_idx" type="int"> + </argument> + <description> + </description> + </method> <method name="get_bone_rest" qualifiers="const"> <return type="Transform"> </return> @@ -26037,6 +30384,22 @@ Set the rest transform for bone "bone_idx" </description> </method> + <method name="set_bone_disable_rest"> + <argument index="0" name="bone_idx" type="int"> + </argument> + <argument index="1" name="disable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_bone_rest_disabled" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="bone_idx" type="int"> + </argument> + <description> + </description> + </method> <method name="bind_child_node_to_bone"> <argument index="0" name="bone_idx" type="int"> </argument> @@ -26474,6 +30837,90 @@ <description> </description> </method> + <method name="set_notify_local_transform"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_local_transform_notification_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="rotate"> + <argument index="0" name="normal" type="Vector3"> + </argument> + <argument index="1" name="radians" type="float"> + </argument> + <description> + </description> + </method> + <method name="global_rotate"> + <argument index="0" name="normal" type="Vector3"> + </argument> + <argument index="1" name="radians" type="float"> + </argument> + <description> + </description> + </method> + <method name="rotate_x"> + <argument index="0" name="radians" type="float"> + </argument> + <description> + </description> + </method> + <method name="rotate_y"> + <argument index="0" name="radians" type="float"> + </argument> + <description> + </description> + </method> + <method name="rotate_z"> + <argument index="0" name="radians" type="float"> + </argument> + <description> + </description> + </method> + <method name="translate"> + <argument index="0" name="offset" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="global_translate"> + <argument index="0" name="offset" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="orthonormalize"> + <description> + </description> + </method> + <method name="set_identity"> + <description> + </description> + </method> + <method name="look_at"> + <argument index="0" name="target" type="Vector3"> + </argument> + <argument index="1" name="up" type="Vector3"> + </argument> + <description> + </description> + </method> + <method name="look_at_from_pos"> + <argument index="0" name="pos" type="Vector3"> + </argument> + <argument index="1" name="target" type="Vector3"> + </argument> + <argument index="2" name="up" type="Vector3"> + </argument> + <description> + </description> + </method> </methods> <signals> <signal name="visibility_changed"> @@ -26678,6 +31125,8 @@ </description> </method> <method name="play"> + <argument index="0" name="arg0" type="float" default="0"> + </argument> <description> </description> </method> @@ -26691,6 +31140,18 @@ <description> </description> </method> + <method name="set_paused"> + <argument index="0" name="paused" type="bool"> + </argument> + <description> + </description> + </method> + <method name="is_paused" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> <method name="set_loop"> <argument index="0" name="enabled" type="bool"> </argument> @@ -26703,6 +31164,54 @@ <description> </description> </method> + <method name="set_volume"> + <argument index="0" name="volume" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_volume" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_volume_db"> + <argument index="0" name="db" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_volume_db" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> + <method name="set_buffering_msec"> + <argument index="0" name="msec" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_buffering_msec" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_loop_restart_time"> + <argument index="0" name="secs" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_loop_restart_time" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="get_stream_name" qualifiers="const"> <return type="String"> </return> @@ -26727,6 +31236,24 @@ <description> </description> </method> + <method name="set_autoplay"> + <argument index="0" name="enabled" type="bool"> + </argument> + <description> + </description> + </method> + <method name="has_autoplay" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="get_length" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -26865,6 +31392,14 @@ </description> </method> </methods> + <signals> + <signal name="dragged"> + <argument index="0" name="offset" type="int"> + </argument> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> @@ -27043,6 +31578,12 @@ </description> </method> </methods> + <signals> + <signal name="frame_changed"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> @@ -27125,6 +31666,12 @@ </description> </method> </methods> + <signals> + <signal name="frame_changed"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> @@ -27518,7 +32065,7 @@ </description> <methods> <method name="accept"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="stream" type="StreamPeer"> </argument> @@ -27526,7 +32073,7 @@ </description> </method> <method name="connect"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="stream" type="StreamPeer"> </argument> @@ -27572,7 +32119,7 @@ </return> <argument index="0" name="host" type="String"> </argument> - <argument index="1" name="ip" type="int"> + <argument index="1" name="port" type="int"> </argument> <description> </description> @@ -27638,6 +32185,8 @@ </description> </method> <method name="play"> + <argument index="0" name="arg0" type="float" default="0"> + </argument> <description> </description> </method> @@ -27699,6 +32248,30 @@ <description> </description> </method> + <method name="set_buffering_msec"> + <argument index="0" name="msec" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_buffering_msec" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="set_loop_restart_time"> + <argument index="0" name="secs" type="float"> + </argument> + <description> + </description> + </method> + <method name="get_loop_restart_time" qualifiers="const"> + <return type="float"> + </return> + <description> + </description> + </method> <method name="get_stream_name" qualifiers="const"> <return type="String"> </return> @@ -28110,6 +32683,12 @@ Return part of the string from "from", with length "len". </description> </method> + <method name="to_ascii"> + <return type="String"> + </return> + <description> + </description> + </method> <method name="to_float"> <return type="float"> </return> @@ -28138,6 +32717,12 @@ Return the string converted to uppercase. </description> </method> + <method name="to_utf8"> + <return type="String"> + </return> + <description> + </description> + </method> <method name="xml_escape"> <return type="String"> </return> @@ -28199,6 +32784,8 @@ </description> </method> <method name="StringArray"> + <return type="StringArray"> + </return> <argument index="0" name="from" type="Array"> </argument> <description> @@ -28682,6 +33269,20 @@ Return the current tab that is being showed. </description> </method> + <method name="get_current_tab_control" qualifiers="const"> + <return type="Control"> + </return> + <description> + </description> + </method> + <method name="get_tab_control" qualifiers="const"> + <return type="Control"> + </return> + <argument index="0" name="idx" type="int"> + </argument> + <description> + </description> + </method> <method name="set_tab_align"> <argument index="0" name="align" type="int"> </argument> @@ -28745,8 +33346,24 @@ <description> </description> </method> + <method name="set_popup"> + <argument index="0" name="popup" type="Popup"> + </argument> + <description> + </description> + </method> + <method name="get_popup" qualifiers="const"> + <return type="Popup"> + </return> + <description> + </description> + </method> </methods> <signals> + <signal name="pre_popup_pressed"> + <description> + </description> + </signal> <signal name="tab_changed"> <argument index="0" name="tab" type="int"> </argument> @@ -28772,8 +33389,12 @@ </theme_item> <theme_item name="font_color_fg" type="Color"> </theme_item> + <theme_item name="menu_hilite" type="Texture"> + </theme_item> <theme_item name="increment_hilite" type="Texture"> </theme_item> + <theme_item name="menu" type="Texture"> + </theme_item> <theme_item name="decrement_hilite" type="Texture"> </theme_item> <theme_item name="increment" type="Texture"> @@ -28862,8 +33483,26 @@ <description> </description> </method> + <method name="set_tab_align"> + <argument index="0" name="align" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_tab_align" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> </methods> <signals> + <signal name="right_button_pressed"> + <argument index="0" name="tab" type="int"> + </argument> + <description> + </description> + </signal> <signal name="tab_changed"> <argument index="0" name="tab" type="int"> </argument> @@ -28872,6 +33511,12 @@ </signal> </signals> <constants> + <constant name="ALIGN_LEFT" value="0"> + </constant> + <constant name="ALIGN_CENTER" value="1"> + </constant> + <constant name="ALIGN_RIGHT" value="2"> + </constant> </constants> <theme_items> <theme_item name="label_valign_fg" type="int"> @@ -28890,10 +33535,14 @@ </theme_item> <theme_item name="tab_fg" type="StyleBox"> </theme_item> + <theme_item name="button" type="StyleBox"> + </theme_item> <theme_item name="tab_bg" type="StyleBox"> </theme_item> <theme_item name="panel" type="StyleBox"> </theme_item> + <theme_item name="button_pressed" type="StyleBox"> + </theme_item> </theme_items> </class> <class name="TestCube" inherits="GeometryInstance" category="Core"> @@ -29179,10 +33828,6 @@ </description> </signal> <signal name="request_completion"> - <argument index="0" name="keyword" type="String"> - </argument> - <argument index="1" name="line" type="int"> - </argument> <description> </description> </signal> @@ -29223,6 +33868,8 @@ </theme_item> <theme_item name="completion_scroll_color" type="Color"> </theme_item> + <theme_item name="brace_mismatch_color" type="Color"> + </theme_item> <theme_item name="current_line_color" type="Color"> </theme_item> <theme_item name="mark_color" type="Color"> @@ -29304,8 +33951,9 @@ </argument> <argument index="2" name="modulate" type="Color" default="Color(1,1,1,1)"> </argument> + <argument index="3" name="arg3" type="bool" default="false"> + </argument> <description> - Draw the texture into a a [VisualServer] canvas item. </description> </method> <method name="draw_rect" qualifiers="const"> @@ -29317,6 +33965,8 @@ </argument> <argument index="3" name="modulate" type="Color" default="Color(1,1,1,1)"> </argument> + <argument index="4" name="arg4" type="bool" default="false"> + </argument> <description> </description> </method> @@ -29329,6 +33979,8 @@ </argument> <argument index="3" name="modulate" type="Color" default="Color(1,1,1,1)"> </argument> + <argument index="4" name="arg4" type="bool" default="false"> + </argument> <description> </description> </method> @@ -29353,6 +34005,8 @@ </constant> <constant name="FLAG_CONVERT_TO_LINEAR" value="16"> </constant> + <constant name="FLAG_MIRRORED_REPEAT" value="32"> + </constant> </constants> </class> <class name="TextureButton" inherits="BaseButton" category="Core"> @@ -29400,6 +34054,18 @@ <description> </description> </method> + <method name="set_scale"> + <argument index="0" name="scale" type="Vector2"> + </argument> + <description> + </description> + </method> + <method name="set_modulate"> + <argument index="0" name="color" type="Color"> + </argument> + <description> + </description> + </method> <method name="get_normal_texture" qualifiers="const"> <return type="Texture"> </return> @@ -29436,6 +34102,18 @@ <description> </description> </method> + <method name="get_scale" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="get_modulate" qualifiers="const"> + <return type="Color"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -29810,7 +34488,7 @@ </description> <methods> <method name="start"> - <return type="int"> + <return type="Error"> </return> <argument index="0" name="instance" type="Object"> </argument> @@ -29851,10 +34529,10 @@ </class> <class name="TileMap" inherits="Node2D" category="Core"> <brief_description> - Node for 2D Tile-Based games. + Node for 2D tile-based games. </brief_description> <description> - Node for 2D Tile-Based games. Tilemaps use a TileSet which contain a list of tiles (textures, their rect and a collision) and are used to create complex grid-based maps. + Node for 2D tile-based games. Tilemaps use a [TileSet] which contain a list of tiles (textures, their rect and a collision) and are used to create complex grid-based maps. To optimize drawing and culling (sort of like [GridMap]), you can specify a quadrant size, so chunks of the map will be batched together at drawing time. </description> <methods> @@ -29876,36 +34554,43 @@ <argument index="0" name="mode" type="int"> </argument> <description> + Set the orientation mode as square, isometric or custom (use MODE_* constants as argument). </description> </method> <method name="get_mode" qualifiers="const"> <return type="int"> </return> <description> + Return the orientation mode. </description> </method> <method name="set_half_offset"> <argument index="0" name="half_offset" type="int"> </argument> <description> + Set an half offset on the X coordinate, Y coordinate, or none (use HALF_OFFSET_* constants as argument). + Half offset sets every other tile off by a half tile size in the specified direction. </description> </method> <method name="get_half_offset" qualifiers="const"> <return type="int"> </return> <description> + Return the current half offset configuration. </description> </method> <method name="set_custom_transform"> <argument index="0" name="custom_transform" type="Matrix32"> </argument> <description> + Set custom transform matrix, to use in combination with the custom orientation mode. </description> </method> <method name="get_custom_transform" qualifiers="const"> <return type="Matrix32"> </return> <description> + Return the custom transform matrix. </description> </method> <method name="set_cell_size"> @@ -29927,13 +34612,28 @@ </argument> <description> Set the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time. + Allowed values are integers ranging from 1 to 128. </description> </method> <method name="get_quadrant_size" qualifiers="const"> <return type="int"> </return> <description> - Return the quadrant size, this optimizes drawing by batching chunks of map at draw/cull time. + Return the quadrant size. + </description> + </method> + <method name="set_tile_origin"> + <argument index="0" name="origin" type="int"> + </argument> + <description> + Set the tile origin to the tile center or its top-left corner (use TILE_ORIGIN_* constants as argument). + </description> + </method> + <method name="get_tile_origin" qualifiers="const"> + <return type="int"> + </return> + <description> + Return the tile origin configuration. </description> </method> <method name="set_center_x"> @@ -29964,40 +34664,93 @@ Return true if tiles are to be centered in y coordinate (by default this is false and they are drawn from upper left cell corner). </description> </method> - <method name="set_collision_layer_mask"> + <method name="set_y_sort_mode"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + Set the Y sort mode. Enabled Y sort mode means that children of the tilemap will be drawn in the order defined by their Y coordinate. + A tile with a higher Y coordinate will therefore be drawn later, potentially covering up the tile(s) above it if its sprite is higher than its cell size. + </description> + </method> + <method name="is_y_sort_mode_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + Return the Y sort mode. + </description> + </method> + <method name="set_collision_use_kinematic"> + <argument index="0" name="use_kinematic" type="bool"> + </argument> + <description> + Set the tilemap to handle collisions as a kinematic body (enabled) or a static body (disabled). + </description> + </method> + <method name="get_collision_use_kinematic" qualifiers="const"> + <return type="bool"> + </return> + <description> + Return whether the tilemap handles collisions as a kinematic body. + </description> + </method> + <method name="set_collision_layer"> + <argument index="0" name="mask" type="int"> + </argument> + <description> + Set the collision layer. + Layers are referenced by binary indexes, so allowable values to describe the 20 available layers range from 0 to 2^20-1. + </description> + </method> + <method name="get_collision_layer" qualifiers="const"> + <return type="int"> + </return> + <description> + Return the collision layer. + </description> + </method> + <method name="set_collision_mask"> <argument index="0" name="mask" type="int"> </argument> <description> + Set the collision masks. + Masks are referenced by binary indexes, so allowable values to describe the 20 available masks range from 0 to 2^20-1. </description> </method> - <method name="get_collision_layer_mask" qualifiers="const"> + <method name="get_collision_mask" qualifiers="const"> <return type="int"> </return> <description> + Return the collision mask. </description> </method> <method name="set_collision_friction"> <argument index="0" name="value" type="float"> </argument> <description> + Set the collision friction parameter. + Allowable values range from 0 to 1. </description> </method> <method name="get_collision_friction" qualifiers="const"> <return type="float"> </return> <description> + Return the collision friction parameter. </description> </method> <method name="set_collision_bounce"> <argument index="0" name="value" type="float"> </argument> <description> + Set the collision bounce parameter. + Allowable values range from 0 to 1. </description> </method> <method name="get_collision_bounce" qualifiers="const"> <return type="float"> </return> <description> + Return the collision bounce parameter. </description> </method> <method name="set_cell"> @@ -30011,8 +34764,29 @@ </argument> <argument index="4" name="flip_y" type="bool" default="false"> </argument> + <argument index="5" name="transpose" type="bool" default="false"> + </argument> + <description> + Set the tile index for the cell referenced by its grid-based X and Y coordinates. + A tile index of -1 clears the cell. + Optionally, the tile can also be flipped over the X and Y coordinates or transposed. + </description> + </method> + <method name="set_cellv"> + <argument index="0" name="pos" type="Vector2"> + </argument> + <argument index="1" name="tile" type="int"> + </argument> + <argument index="2" name="flip_x" type="bool" default="false"> + </argument> + <argument index="3" name="flip_y" type="bool" default="false"> + </argument> + <argument index="4" name="transpose" type="bool" default="false"> + </argument> <description> - Set the contents of a cell. Cells can be optionally flipped in y or x. + Set the tile index for the cell referenced by a Vector2 of grid-based coordinates. + A tile index of -1 clears the cell. + Optionally, the tile can also be flipped over the X and Y axes or transposed. </description> </method> <method name="get_cell" qualifiers="const"> @@ -30023,7 +34797,7 @@ <argument index="1" name="y" type="int"> </argument> <description> - Return the contents of a cell. + Return the tile index of the referenced cell. </description> </method> <method name="is_cell_x_flipped" qualifiers="const"> @@ -30034,7 +34808,7 @@ <argument index="1" name="y" type="int"> </argument> <description> - Return if a given cell is flipped in x axis. + Return whether the referenced cell is flipped over the X axis. </description> </method> <method name="is_cell_y_flipped" qualifiers="const"> @@ -30045,7 +34819,7 @@ <argument index="1" name="y" type="int"> </argument> <description> - Return if a given cell is flipped in y axis. + Return whether the referenced cell is flipped over the Y axis. </description> </method> <method name="clear"> @@ -30053,6 +34827,13 @@ Clear all cells. </description> </method> + <method name="get_used_cells" qualifiers="const"> + <return type="Array"> + </return> + <description> + Return an array of all cells containing a tile from the tileset (i.e. a tile index different from -1). + </description> + </method> <method name="map_to_world" qualifiers="const"> <return type="Vector2"> </return> @@ -30061,6 +34842,8 @@ <argument index="1" name="ignore_half_ofs" type="bool" default="false"> </argument> <description> + Return the absolute world position corresponding to the tilemap (grid-based) coordinates given as an argument. + Optionally, the tilemap's potential half offset can be ignored. </description> </method> <method name="world_to_map" qualifiers="const"> @@ -30069,12 +34852,14 @@ <argument index="0" name="worldpos" type="Vector2"> </argument> <description> + Return the tilemap (grid-based) coordinates corresponding to the absolute world position given as an argument. </description> </method> </methods> <signals> <signal name="settings_changed"> <description> + Signal indicating that a tilemap setting has changed. </description> </signal> </signals> @@ -30083,16 +34868,28 @@ Returned when a cell doesn't exist. </constant> <constant name="MODE_SQUARE" value="0"> + Orthogonal orientation mode. </constant> <constant name="MODE_ISOMETRIC" value="1"> + Isometric orientation mode. </constant> <constant name="MODE_CUSTOM" value="2"> + Custom orientation mode. </constant> <constant name="HALF_OFFSET_X" value="0"> + Half offset on the X coordinate. </constant> <constant name="HALF_OFFSET_Y" value="1"> + Half offset on the Y coordinate. </constant> <constant name="HALF_OFFSET_DISABLED" value="2"> + Half offset disabled. + </constant> + <constant name="TILE_ORIGIN_TOP_LEFT" value="0"> + Tile origin at its top-left corner. + </constant> + <constant name="TILE_ORIGIN_CENTER" value="1"> + Tile origin at its center. </constant> </constants> </class> @@ -30102,13 +34899,14 @@ </brief_description> <description> A TileSet is a library of tiles for a [TileMap]. It contains a list of tiles, each consisting of a sprite and optional collision shapes. + Tiles are referenced by a unique integer ID. </description> <methods> <method name="create_tile"> <argument index="0" name="id" type="int"> </argument> <description> - Create a new tile, the ID must be specified. + Create a new tile which will be referenced by the given ID. </description> </method> <method name="tile_set_name"> @@ -30117,7 +34915,7 @@ <argument index="1" name="name" type="String"> </argument> <description> - Set the name of a tile, for decriptive purposes. + Set the name of the tile, for descriptive purposes. </description> </method> <method name="tile_get_name" qualifiers="const"> @@ -30126,7 +34924,7 @@ <argument index="0" name="id" type="int"> </argument> <description> - Return the name of a tile, for decriptive purposes. + Return the name of the tile. </description> </method> <method name="tile_set_texture"> @@ -30147,12 +34945,31 @@ Return the texture of the tile. </description> </method> + <method name="tile_set_material"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="material" type="CanvasItemMaterial"> + </argument> + <description> + Set the material of the tile. + </description> + </method> + <method name="tile_get_material" qualifiers="const"> + <return type="CanvasItemMaterial"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Return the material of the tile. + </description> + </method> <method name="tile_set_texture_offset"> <argument index="0" name="id" type="int"> </argument> <argument index="1" name="texture_offset" type="Vector2"> </argument> <description> + Set the texture offset of the tile. </description> </method> <method name="tile_get_texture_offset" qualifiers="const"> @@ -30161,6 +34978,7 @@ <argument index="0" name="id" type="int"> </argument> <description> + Return the texture offset of the tile. </description> </method> <method name="tile_set_shape_offset"> @@ -30169,6 +34987,7 @@ <argument index="1" name="shape_offset" type="Vector2"> </argument> <description> + Set the shape offset of the tile. </description> </method> <method name="tile_get_shape_offset" qualifiers="const"> @@ -30177,6 +34996,7 @@ <argument index="0" name="id" type="int"> </argument> <description> + Return the shape offset of the tile. </description> </method> <method name="tile_set_region"> @@ -30194,7 +35014,7 @@ <argument index="0" name="id" type="int"> </argument> <description> - Return the tile sub-region in the texture. This is common in texture atlases. + Return the tile sub-region in the texture. </description> </method> <method name="tile_set_shape"> @@ -30221,6 +35041,7 @@ <argument index="1" name="shapes" type="Array"> </argument> <description> + Set an array of shapes for the tile, enabling physics to collide with it. </description> </method> <method name="tile_get_shapes" qualifiers="const"> @@ -30229,13 +35050,86 @@ <argument index="0" name="id" type="int"> </argument> <description> + Return the array of shapes of the tile. + </description> + </method> + <method name="tile_set_navigation_polygon"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="navigation_polygon" type="NavigationPolygon"> + </argument> + <description> + Set a navigation polygon for the tile. + </description> + </method> + <method name="tile_get_navigation_polygon" qualifiers="const"> + <return type="NavigationPolygon"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Return the navigation polygon of the tile. + </description> + </method> + <method name="tile_set_navigation_polygon_offset"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="navigation_polygon_offset" type="Vector2"> + </argument> + <description> + Set an offset for the tile's navigation polygon. + </description> + </method> + <method name="tile_get_navigation_polygon_offset" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Return the offset of the tile's navigation polygon. + </description> + </method> + <method name="tile_set_light_occluder"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="light_occluder" type="OccluderPolygon2D"> + </argument> + <description> + Set a light occluder for the tile. + </description> + </method> + <method name="tile_get_light_occluder" qualifiers="const"> + <return type="OccluderPolygon2D"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Return the light occluder of the tile. + </description> + </method> + <method name="tile_set_occluder_offset"> + <argument index="0" name="id" type="int"> + </argument> + <argument index="1" name="occluder_offset" type="Vector2"> + </argument> + <description> + Set an offset for the tile's light occluder. + </description> + </method> + <method name="tile_get_occluder_offset" qualifiers="const"> + <return type="Vector2"> + </return> + <argument index="0" name="id" type="int"> + </argument> + <description> + Return the offset of the tile's light occluder. </description> </method> <method name="remove_tile"> <argument index="0" name="id" type="int"> </argument> <description> - Remove a tile, by integer id. + Remove the tile referenced by the given ID. </description> </method> <method name="clear"> @@ -30247,7 +35141,7 @@ <return type="int"> </return> <description> - Find an empty id for creating a new tile. + Return the ID following the last currently used ID, useful when creating a new tile. </description> </method> <method name="find_tile_by_name" qualifiers="const"> @@ -30256,13 +35150,14 @@ <argument index="0" name="name" type="String"> </argument> <description> - Find the first tile with the given name. + Find the first tile matching the given name. </description> </method> <method name="get_tiles_ids" qualifiers="const"> <return type="Array"> </return> <description> + Return an array of all currently used tile IDs. </description> </method> </methods> @@ -30273,35 +35168,35 @@ <brief_description> </brief_description> <description> - Timer node. This is a simple node that will emit a timeout callback when the timer runs out. It can optinally be set to loop. + Timer node. This is a simple node that will emit a timeout callback when the timer runs out. It can optionally be set to loop. </description> <methods> <method name="set_wait_time"> <argument index="0" name="time_sec" type="float"> </argument> <description> - Set wait time. When the time is over, it will emit the timeout signal. + Set wait time in seconds. When the time is over, it will emit the timeout signal. </description> </method> <method name="get_wait_time" qualifiers="const"> <return type="float"> </return> <description> - Return the wait time. When the time is over, it will emit the timeout signal. + Return the wait time in seconds. </description> </method> <method name="set_one_shot"> <argument index="0" name="enable" type="bool"> </argument> <description> - Set as one-shot. If true, timer will stop after timeout, otherwise it will automatically restart. + Set as one-shot. If enabled, the timer will stop after timeout, otherwise it will automatically restart. </description> </method> <method name="is_one_shot" qualifiers="const"> <return type="bool"> </return> <description> - Return true if is set as one-shot. If true, timer will stop after timeout, otherwise it will automatically restart. + Return true if configured as one-shot. </description> </method> <method name="set_autostart"> @@ -30332,7 +35227,21 @@ <return type="float"> </return> <description> - Return the time left for timeout if the timer is active. + Return the time left for timeout in seconds if the timer is active, 0 otherwise. + </description> + </method> + <method name="set_timer_process_mode"> + <argument index="0" name="mode" type="int"> + </argument> + <description> + Set the timer's processing mode (fixed or idle, use TIMER_PROCESS_* constants as argument). + </description> + </method> + <method name="get_timer_process_mode" qualifiers="const"> + <return type="int"> + </return> + <description> + Return the timer's processing mode. </description> </method> </methods> @@ -30344,8 +35253,48 @@ </signal> </signals> <constants> + <constant name="TIMER_PROCESS_FIXED" value="0"> + Update the timer at fixed intervals (framerate processing). + </constant> + <constant name="TIMER_PROCESS_IDLE" value="1"> + Update the timer during the idle time at each frame. + </constant> </constants> </class> +<class name="ToolButton" inherits="Button" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + </methods> + <constants> + </constants> + <theme_items> + <theme_item name="hseparation" type="int"> + </theme_item> + <theme_item name="font_color_disabled" type="Color"> + </theme_item> + <theme_item name="font_color" type="Color"> + </theme_item> + <theme_item name="font_color_hover" type="Color"> + </theme_item> + <theme_item name="font_color_pressed" type="Color"> + </theme_item> + <theme_item name="font" type="Font"> + </theme_item> + <theme_item name="hover" type="StyleBox"> + </theme_item> + <theme_item name="pressed" type="StyleBox"> + </theme_item> + <theme_item name="focus" type="StyleBox"> + </theme_item> + <theme_item name="disabled" type="StyleBox"> + </theme_item> + <theme_item name="normal" type="StyleBox"> + </theme_item> + </theme_items> +</class> <class name="TouchScreenButton" inherits="Node2D" category="Core"> <brief_description> </brief_description> @@ -30526,6 +35475,8 @@ </description> </method> <method name="Transform"> + <return type="Transform"> + </return> <argument index="0" name="x_axis" type="Vector3"> </argument> <argument index="1" name="y_axis" type="Vector3"> @@ -30538,6 +35489,8 @@ </description> </method> <method name="Transform"> + <return type="Transform"> + </return> <argument index="0" name="basis" type="Matrix3"> </argument> <argument index="1" name="origin" type="Vector3"> @@ -30546,18 +35499,24 @@ </description> </method> <method name="Transform"> + <return type="Transform"> + </return> <argument index="0" name="from" type="Matrix32"> </argument> <description> </description> </method> <method name="Transform"> + <return type="Transform"> + </return> <argument index="0" name="from" type="Quat"> </argument> <description> </description> </method> <method name="Transform"> + <return type="Transform"> + </return> <argument index="0" name="from" type="Matrix3"> </argument> <description> @@ -31411,7 +36370,7 @@ <method name="reset"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="key" type="String"> </argument> @@ -31427,7 +36386,7 @@ <method name="stop"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="key" type="String"> </argument> @@ -31443,7 +36402,7 @@ <method name="resume"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="key" type="String"> </argument> @@ -31459,7 +36418,7 @@ <method name="remove"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="key" type="String"> </argument> @@ -31495,7 +36454,7 @@ <method name="interpolate_property"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="property" type="String"> </argument> @@ -31517,7 +36476,7 @@ <method name="interpolate_method"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="method" type="String"> </argument> @@ -31539,13 +36498,43 @@ <method name="interpolate_callback"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> + </argument> + <argument index="1" name="times_in_sec" type="float"> + </argument> + <argument index="2" name="callback" type="String"> </argument> - <argument index="1" name="callback" type="String"> + <argument index="3" name="arg1" type="var" default="NULL"> </argument> - <argument index="2" name="times_in_sec" type="float"> + <argument index="4" name="arg2" type="var" default="NULL"> </argument> - <argument index="3" name="args" type="var" default="NULL"> + <argument index="5" name="arg3" type="var" default="NULL"> + </argument> + <argument index="6" name="arg4" type="var" default="NULL"> + </argument> + <argument index="7" name="arg5" type="var" default="NULL"> + </argument> + <description> + </description> + </method> + <method name="interpolate_deferred_callback"> + <return type="bool"> + </return> + <argument index="0" name="object" type="Object"> + </argument> + <argument index="1" name="times_in_sec" type="float"> + </argument> + <argument index="2" name="callback" type="String"> + </argument> + <argument index="3" name="arg1" type="var" default="NULL"> + </argument> + <argument index="4" name="arg2" type="var" default="NULL"> + </argument> + <argument index="5" name="arg3" type="var" default="NULL"> + </argument> + <argument index="6" name="arg4" type="var" default="NULL"> + </argument> + <argument index="7" name="arg5" type="var" default="NULL"> </argument> <description> </description> @@ -31553,7 +36542,7 @@ <method name="follow_property"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="property" type="String"> </argument> @@ -31577,7 +36566,7 @@ <method name="follow_method"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="method" type="String"> </argument> @@ -31601,7 +36590,7 @@ <method name="targeting_property"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="property" type="String"> </argument> @@ -31625,7 +36614,7 @@ <method name="targeting_method"> <return type="bool"> </return> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="method" type="String"> </argument> @@ -31649,7 +36638,7 @@ </methods> <signals> <signal name="tween_complete"> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="key" type="String"> </argument> @@ -31657,7 +36646,7 @@ </description> </signal> <signal name="tween_step"> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="key" type="String"> </argument> @@ -31669,7 +36658,7 @@ </description> </signal> <signal name="tween_start"> - <argument index="0" name="node" type="Object"> + <argument index="0" name="object" type="Object"> </argument> <argument index="1" name="key" type="String"> </argument> @@ -31678,6 +36667,10 @@ </signal> </signals> <constants> + <constant name="TWEEN_PROCESS_FIXED" value="0"> + </constant> + <constant name="TWEEN_PROCESS_IDLE" value="1"> + </constant> <constant name="TRANS_LINEAR" value="0"> </constant> <constant name="TRANS_SINE" value="1"> @@ -31710,44 +36703,104 @@ </constant> </constants> </class> -<class name="UnshadedMaterial" inherits="Material" category="Core"> +<class name="UndoRedo" inherits="Object" category="Core"> <brief_description> </brief_description> <description> </description> <methods> - <method name="set_texture"> - <argument index="0" name="texture" type="Object"> + <method name="create_action"> + <argument index="0" name="name" type="String"> + </argument> + <argument index="1" name="mergeable" type="bool" default="false"> </argument> <description> </description> </method> - <method name="get_texture" qualifiers="const"> - <return type="Texture"> - </return> + <method name="commit_action"> <description> </description> </method> - <method name="set_use_alpha"> - <argument index="0" name="enable" type="bool"> + <method name="add_do_method"> + <argument index="0" name="object" type="Object"> + </argument> + <argument index="1" name="method" type="String"> + </argument> + <argument index="2" name="arg0" type="var" default="NULL"> + </argument> + <argument index="3" name="arg1" type="var" default="NULL"> + </argument> + <argument index="4" name="arg2" type="var" default="NULL"> + </argument> + <argument index="5" name="arg3" type="var" default="NULL"> + </argument> + <argument index="6" name="arg4" type="var" default="NULL"> </argument> <description> </description> </method> - <method name="is_using_alpha" qualifiers="const"> - <return type="bool"> - </return> + <method name="add_undo_method"> + <argument index="0" name="object" type="Object"> + </argument> + <argument index="1" name="method" type="String"> + </argument> + <argument index="2" name="arg0" type="var" default="NULL"> + </argument> + <argument index="3" name="arg1" type="var" default="NULL"> + </argument> + <argument index="4" name="arg2" type="var" default="NULL"> + </argument> + <argument index="5" name="arg3" type="var" default="NULL"> + </argument> + <argument index="6" name="arg4" type="var" default="NULL"> + </argument> <description> </description> </method> - <method name="set_use_color_array"> - <argument index="0" name="enable" type="bool"> + <method name="add_do_property"> + <argument index="0" name="object" type="Object"> + </argument> + <argument index="1" name="property" type="String"> + </argument> + <argument index="2" name="value" type="var"> </argument> <description> </description> </method> - <method name="is_using_color_array" qualifiers="const"> - <return type="bool"> + <method name="add_undo_property"> + <argument index="0" name="object" type="Object"> + </argument> + <argument index="1" name="property" type="String"> + </argument> + <argument index="2" name="value" type="var"> + </argument> + <description> + </description> + </method> + <method name="add_do_reference"> + <argument index="0" name="object" type="Object"> + </argument> + <description> + </description> + </method> + <method name="add_undo_reference"> + <argument index="0" name="object" type="Object"> + </argument> + <description> + </description> + </method> + <method name="clear_history"> + <description> + </description> + </method> + <method name="get_current_action_name" qualifiers="const"> + <return type="String"> + </return> + <description> + </description> + </method> + <method name="get_version" qualifiers="const"> + <return type="int"> </return> <description> </description> @@ -31912,6 +36965,7 @@ <argument index="0" name="to" type="Vector2"> </argument> <description> + Returns the angle in radians between the two vectors. </description> </method> <method name="angle_to_point"> @@ -31920,12 +36974,14 @@ <argument index="0" name="to" type="Vector2"> </argument> <description> + Returns the angle in radians between the line connecting the two points and the x coordinate. </description> </method> <method name="atan2"> <return type="float"> </return> <description> + Returns the result of atan2 when called with the Vector's x and y as parameters. </description> </method> <method name="cubic_interpolate"> @@ -31940,6 +36996,7 @@ <argument index="3" name="t" type="float"> </argument> <description> + Cubicly interpolates between this Vector and "b", using "pre_a" and "post_b" as handles, and returning the result at position "t". </description> </method> <method name="distance_squared_to"> @@ -31948,6 +37005,7 @@ <argument index="0" name="to" type="Vector2"> </argument> <description> + Returns the squared distance to vector "b". Prefer this function over "distance_to" if you need to sort vectors or need the squared distance for some formula. </description> </method> <method name="distance_to"> @@ -31985,6 +37043,7 @@ <return type="float"> </return> <description> + Returns the ratio of X to Y. </description> </method> <method name="length"> @@ -31998,6 +37057,7 @@ <return type="float"> </return> <description> + Returns the squared length of the vector. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula. </description> </method> <method name="linear_interpolate"> @@ -32008,7 +37068,7 @@ <argument index="1" name="t" type="float"> </argument> <description> - Returns the result of the linear interpolation between this vector and "b", by amount "i". + Returns the result of the linear interpolation between this vector and "b", by amount "t". </description> </method> <method name="normalized"> @@ -32019,11 +37079,12 @@ </description> </method> <method name="reflect"> - <return type="float"> + <return type="Vector2"> </return> <argument index="0" name="vec" type="Vector2"> </argument> <description> + Reflects/mirrors the vector around another vector. </description> </method> <method name="rotated"> @@ -32032,14 +37093,16 @@ <argument index="0" name="phi" type="float"> </argument> <description> + Rotates the vector by "phi" radians. </description> </method> <method name="slide"> - <return type="float"> + <return type="Vector2"> </return> <argument index="0" name="vec" type="Vector2"> </argument> <description> + Slides the vector by the other vector. </description> </method> <method name="snapped"> @@ -32048,20 +37111,25 @@ <argument index="0" name="by" type="Vector2"> </argument> <description> + Snaps the vector to a grid with the given size. </description> </method> <method name="tangent"> <return type="Vector2"> </return> <description> + Returns a perpendicular vector. </description> </method> <method name="Vector2"> + <return type="Vector2"> + </return> <argument index="0" name="x" type="float"> </argument> <argument index="1" name="y" type="float"> </argument> <description> + Constructs a new Vector2 from the given x and y. </description> </method> </methods> @@ -32080,8 +37148,10 @@ </class> <class name="Vector2Array" category="Built-In Types"> <brief_description> + An Array of Vector2's. </brief_description> <description> + An Array specifically designed to hold Vector2's. </description> <methods> <method name="get"> @@ -32090,18 +37160,21 @@ <argument index="0" name="idx" type="int"> </argument> <description> + Get the Vector2 at the given index. </description> </method> <method name="push_back"> <argument index="0" name="vector2" type="Vector2"> </argument> <description> + Insert a new Vector2. </description> </method> <method name="resize"> <argument index="0" name="idx" type="int"> </argument> <description> + Set the size of the Vector2Array. If larger than the current size it will reserve some space beforehand, and if it is smaller it will cut off the array. </description> </method> <method name="set"> @@ -32110,18 +37183,23 @@ <argument index="1" name="vector2" type="Vector2"> </argument> <description> + Set the Vector2 at the given index. </description> </method> <method name="size"> <return type="int"> </return> <description> + Returns the size of the array. </description> </method> <method name="Vector2Array"> + <return type="Vector2Array"> + </return> <argument index="0" name="from" type="Array"> </argument> <description> + Constructs a new Vector2Array. Optionally, you can pass in an Array that will be converted. </description> </method> </methods> @@ -32280,6 +37358,8 @@ </description> </method> <method name="Vector3"> + <return type="Vector3"> + </return> <argument index="0" name="x" type="float"> </argument> <argument index="1" name="y" type="float"> @@ -32348,6 +37428,8 @@ </description> </method> <method name="Vector3Array"> + <return type="Vector3Array"> + </return> <argument index="0" name="from" type="Array"> </argument> <description> @@ -32869,6 +37951,22 @@ <description> </description> </method> + <method name="set_render_target_clear_on_new_frame"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="get_render_target_clear_on_new_frame" qualifiers="const"> + <return type="bool"> + </return> + <description> + </description> + </method> + <method name="render_target_clear"> + <description> + </description> + </method> <method name="set_render_target_filter"> <argument index="0" name="enable" type="bool"> </argument> @@ -32994,6 +38092,18 @@ <description> </description> </method> + <method name="get_mouse_pos" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> + <method name="warp_mouse"> + <argument index="0" name="to_pos" type="Vector2"> + </argument> + <description> + </description> + </method> </methods> <signals> <signal name="size_changed"> @@ -33130,7 +38240,13 @@ </constant> <constant name="ENABLER_PAUSE_ANIMATIONS" value="0"> </constant> - <constant name="ENABLER_MAX" value="2"> + <constant name="ENABLER_PAUSE_PARTICLES" value="2"> + </constant> + <constant name="ENABLER_PARENT_PROCESS" value="3"> + </constant> + <constant name="ENABLER_PARENT_FIXED_PROCESS" value="4"> + </constant> + <constant name="ENABLER_MAX" value="5"> </constant> </constants> </class> @@ -34478,6 +39594,8 @@ </argument> <argument index="4" name="arg4" type="Color" default="Color(1,1,1,1)"> </argument> + <argument index="5" name="arg5" type="bool" default="false"> + </argument> <description> </description> </method> @@ -34492,6 +39610,8 @@ </argument> <argument index="4" name="arg4" type="Color" default="Color(1,1,1,1)"> </argument> + <argument index="5" name="arg5" type="bool" default="false"> + </argument> <description> </description> </method> @@ -34625,7 +39745,7 @@ <description> </description> </method> - <method name="flush"> + <method name="sync"> <description> </description> </method> @@ -34877,6 +39997,20 @@ </constant> </constants> </class> +<class name="WeakRef" inherits="Reference" category="Core"> + <brief_description> + </brief_description> + <description> + </description> + <methods> + <method name="get_ref" qualifiers="const"> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> <class name="WindowDialog" inherits="Popup" category="Core"> <brief_description> Base class for window dialogs. @@ -34914,10 +40048,10 @@ </theme_item> <theme_item name="titlebar_height" type="int"> </theme_item> - <theme_item name="close_v_ofs" type="int"> - </theme_item> <theme_item name="title_height" type="int"> </theme_item> + <theme_item name="close_v_ofs" type="int"> + </theme_item> <theme_item name="title_color" type="Color"> </theme_item> <theme_item name="close_hilite" type="Texture"> @@ -34968,6 +40102,12 @@ <description> </description> </method> + <method name="get_direct_space_state"> + <return type="PhysicsDirectSpaceState"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -34998,6 +40138,12 @@ <description> </description> </method> + <method name="get_direct_space_state"> + <return type="Physics2DDirectSpaceState"> + </return> + <description> + </description> + </method> </methods> <constants> </constants> @@ -35195,18 +40341,24 @@ </description> <methods> <method name="bool"> + <return type="bool"> + </return> <argument index="0" name="from" type="int"> </argument> <description> </description> </method> <method name="bool"> + <return type="bool"> + </return> <argument index="0" name="from" type="float"> </argument> <description> </description> </method> <method name="bool"> + <return type="bool"> + </return> <argument index="0" name="from" type="String"> </argument> <description> @@ -35223,18 +40375,24 @@ </description> <methods> <method name="float"> + <return type="float"> + </return> <argument index="0" name="from" type="bool"> </argument> <description> </description> </method> <method name="float"> + <return type="float"> + </return> <argument index="0" name="from" type="int"> </argument> <description> </description> </method> <method name="float"> + <return type="float"> + </return> <argument index="0" name="from" type="String"> </argument> <description> @@ -35253,18 +40411,24 @@ </description> <methods> <method name="int"> + <return type="int"> + </return> <argument index="0" name="from" type="bool"> </argument> <description> </description> </method> <method name="int"> + <return type="int"> + </return> <argument index="0" name="from" type="float"> </argument> <description> </description> </method> <method name="int"> + <return type="int"> + </return> <argument index="0" name="from" type="String"> </argument> <description> diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index ebe0c61967..a2de785e2d 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -5970,6 +5970,10 @@ void RasterizerGLES2::_render(const Geometry *p_geometry,const Material *p_mater if (element_count==0) return; + if (mm->visible>=0) { + element_count=MIN(element_count,mm->visible); + } + const MultiMesh::Element *elements=&mm->elements[0]; _rinfo.vertex_count+=s->array_len*element_count; diff --git a/main/input_default.cpp b/main/input_default.cpp new file mode 100644 index 0000000000..878d21c302 --- /dev/null +++ b/main/input_default.cpp @@ -0,0 +1,343 @@ +#include "input_default.h" +#include "servers/visual_server.h" +#include "os/os.h" +#include "input_map.h" + +void InputDefault::SpeedTrack::update(const Vector2& p_delta_p) { + + uint64_t tick = OS::get_singleton()->get_ticks_usec(); + uint32_t tdiff = tick-last_tick; + float delta_t = tdiff / 1000000.0; + last_tick=tick; + + + accum+=p_delta_p; + accum_t+=delta_t; + + if (accum_t>max_ref_frame*10) + accum_t=max_ref_frame*10; + + while( accum_t>=min_ref_frame ) { + + float slice_t = min_ref_frame / accum_t; + Vector2 slice = accum*slice_t; + accum=accum-slice; + accum_t-=min_ref_frame; + + speed=(slice/min_ref_frame).linear_interpolate(speed,min_ref_frame/max_ref_frame); + } + +} + +void InputDefault::SpeedTrack::reset() { + last_tick = OS::get_singleton()->get_ticks_usec(); + speed=Vector2(); + accum_t=0; +} + +InputDefault::SpeedTrack::SpeedTrack() { + + min_ref_frame=0.1; + max_ref_frame=0.3; + reset(); +} + +bool InputDefault::is_key_pressed(int p_scancode) { + + _THREAD_SAFE_METHOD_ + return keys_pressed.has(p_scancode); +} + +bool InputDefault::is_mouse_button_pressed(int p_button) { + + _THREAD_SAFE_METHOD_ + return (mouse_button_mask&(1<<p_button))!=0; +} + + +static int _combine_device(int p_value,int p_device) { + + return p_value|(p_device<<20); +} + +bool InputDefault::is_joy_button_pressed(int p_device, int p_button) { + + _THREAD_SAFE_METHOD_ + return joy_buttons_pressed.has(_combine_device(p_button,p_device)); +} + +bool InputDefault::is_action_pressed(const StringName& p_action) { + + if (custom_action_press.has(p_action)) + return true; //simpler + + const List<InputEvent> *alist = InputMap::get_singleton()->get_action_list(p_action); + if (!alist) + return NULL; + + + for (const List<InputEvent>::Element *E=alist->front();E;E=E->next()) { + + + int device=E->get().device; + + switch(E->get().type) { + + case InputEvent::KEY: { + + const InputEventKey &iek=E->get().key; + if ((keys_pressed.has(iek.scancode))) + return true; + } break; + case InputEvent::MOUSE_BUTTON: { + + const InputEventMouseButton &iemb=E->get().mouse_button; + if(mouse_button_mask&(1<<iemb.button_index)) + return true; + } break; + case InputEvent::JOYSTICK_BUTTON: { + + const InputEventJoystickButton &iejb=E->get().joy_button; + int c = _combine_device(iejb.button_index,device); + if (joy_buttons_pressed.has(c)) + return true; + } break; + } + } + + return false; +} + +float InputDefault::get_joy_axis(int p_device,int p_axis) { + + _THREAD_SAFE_METHOD_ + int c = _combine_device(p_axis,p_device); + if (joy_axis.has(c)) { + return joy_axis[c]; + } else { + return 0; + } +} + +String InputDefault::get_joy_name(int p_idx) { + + _THREAD_SAFE_METHOD_ + return joy_names[p_idx]; +}; + +void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_name) { + + _THREAD_SAFE_METHOD_ + joy_names[p_idx] = p_connected ? p_name : ""; + + emit_signal("joy_connection_changed", p_idx, p_connected); +}; + +Vector3 InputDefault::get_accelerometer() { + + _THREAD_SAFE_METHOD_ + return accelerometer; +} + +void InputDefault::parse_input_event(const InputEvent& p_event) { + + _THREAD_SAFE_METHOD_ + switch(p_event.type) { + + case InputEvent::KEY: { + + if (p_event.key.echo) + break; + if (p_event.key.scancode==0) + break; + + // print_line(p_event); + + if (p_event.key.pressed) + keys_pressed.insert(p_event.key.scancode); + else + keys_pressed.erase(p_event.key.scancode); + } break; + case InputEvent::MOUSE_BUTTON: { + + if (p_event.mouse_button.doubleclick) + break; + + if (p_event.mouse_button.pressed) + mouse_button_mask|=(1<<p_event.mouse_button.button_index); + else + mouse_button_mask&=~(1<<p_event.mouse_button.button_index); + + if (main_loop && emulate_touch && p_event.mouse_button.button_index==1) { + InputEventScreenTouch touch_event; + touch_event.index=0; + touch_event.pressed=p_event.mouse_button.pressed; + touch_event.x=p_event.mouse_button.x; + touch_event.y=p_event.mouse_button.y; + InputEvent ev; + ev.type=InputEvent::SCREEN_TOUCH; + ev.screen_touch=touch_event; + main_loop->input_event(ev); + } + } break; + case InputEvent::MOUSE_MOTION: { + + if (main_loop && emulate_touch && p_event.mouse_motion.button_mask&1) { + InputEventScreenDrag drag_event; + drag_event.index=0; + drag_event.x=p_event.mouse_motion.x; + drag_event.y=p_event.mouse_motion.y; + drag_event.relative_x=p_event.mouse_motion.relative_x; + drag_event.relative_y=p_event.mouse_motion.relative_y; + drag_event.speed_x=p_event.mouse_motion.speed_x; + drag_event.speed_y=p_event.mouse_motion.speed_y; + + InputEvent ev; + ev.type=InputEvent::SCREEN_DRAG; + ev.screen_drag=drag_event; + + main_loop->input_event(ev); + } + + } break; + case InputEvent::JOYSTICK_BUTTON: { + + int c = _combine_device(p_event.joy_button.button_index,p_event.device); + + if (p_event.joy_button.pressed) + joy_buttons_pressed.insert(c); + else + joy_buttons_pressed.erase(c); + } break; + case InputEvent::JOYSTICK_MOTION: { + set_joy_axis(p_event.device, p_event.joy_motion.axis, p_event.joy_motion.axis_value); + } break; + + } + + if (main_loop) + main_loop->input_event(p_event); + +} + +void InputDefault::set_joy_axis(int p_device,int p_axis,float p_value) { + + _THREAD_SAFE_METHOD_ + int c = _combine_device(p_axis,p_device); + joy_axis[c]=p_value; +} + +void InputDefault::set_accelerometer(const Vector3& p_accel) { + + _THREAD_SAFE_METHOD_ + + accelerometer=p_accel; + +} + +void InputDefault::set_main_loop(MainLoop *p_main_loop) { + main_loop=p_main_loop; + +} + +void InputDefault::set_mouse_pos(const Point2& p_posf) { + + mouse_speed_track.update(p_posf-mouse_pos); + mouse_pos=p_posf; + if (custom_cursor.is_valid()) { + VisualServer::get_singleton()->cursor_set_pos(get_mouse_pos()); + } +} + +Point2 InputDefault::get_mouse_pos() const { + + return mouse_pos; +} +Point2 InputDefault::get_mouse_speed() const { + + return mouse_speed_track.speed; +} + +int InputDefault::get_mouse_button_mask() const { + + return OS::get_singleton()->get_mouse_button_state(); +} + +void InputDefault::warp_mouse_pos(const Vector2& p_to) { + + OS::get_singleton()->warp_mouse_pos(p_to); +} + + +void InputDefault::iteration(float p_step) { + + +} + +void InputDefault::action_press(const StringName& p_action) { + + if (custom_action_press.has(p_action)) { + + custom_action_press[p_action]++; + } else { + custom_action_press[p_action]=1; + } +} + +void InputDefault::action_release(const StringName& p_action){ + + ERR_FAIL_COND(!custom_action_press.has(p_action)); + custom_action_press[p_action]--; + if (custom_action_press[p_action]==0) { + custom_action_press.erase(p_action); + } +} + +void InputDefault::set_emulate_touch(bool p_emulate) { + + emulate_touch=p_emulate; +} + +bool InputDefault::is_emulating_touchscreen() const { + + return emulate_touch; +} + +void InputDefault::set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot) { + if (custom_cursor==p_cursor) + return; + + custom_cursor=p_cursor; + + if (p_cursor.is_null()) { + set_mouse_mode(MOUSE_MODE_VISIBLE); + VisualServer::get_singleton()->cursor_set_visible(false); + } else { + set_mouse_mode(MOUSE_MODE_HIDDEN); + VisualServer::get_singleton()->cursor_set_visible(true); + VisualServer::get_singleton()->cursor_set_texture(custom_cursor->get_rid(),p_hotspot); + VisualServer::get_singleton()->cursor_set_pos(get_mouse_pos()); + } +} + +void InputDefault::set_mouse_in_window(bool p_in_window) { + + if (custom_cursor.is_valid()) { + + if (p_in_window) { + set_mouse_mode(MOUSE_MODE_HIDDEN); + VisualServer::get_singleton()->cursor_set_visible(true); + } else { + set_mouse_mode(MOUSE_MODE_VISIBLE); + VisualServer::get_singleton()->cursor_set_visible(false); + } + + } +} + +InputDefault::InputDefault() { + + mouse_button_mask=0; + emulate_touch=false; + main_loop=NULL; +} diff --git a/main/input_default.h b/main/input_default.h new file mode 100644 index 0000000000..2ef4f727c6 --- /dev/null +++ b/main/input_default.h @@ -0,0 +1,83 @@ +#ifndef INPUT_DEFAULT_H +#define INPUT_DEFAULT_H + +#include "os/input.h" + +class InputDefault : public Input { + + OBJ_TYPE( InputDefault, Input ); + _THREAD_SAFE_CLASS_ + + int mouse_button_mask; + Set<int> keys_pressed; + Set<int> joy_buttons_pressed; + Map<int,float> joy_axis; + Map<StringName,int> custom_action_press; + Map<int, String> joy_names; + Vector3 accelerometer; + Vector2 mouse_pos; + MainLoop *main_loop; + + bool emulate_touch; + + struct SpeedTrack { + + uint64_t last_tick; + Vector2 speed; + Vector2 accum; + float accum_t; + float min_ref_frame; + float max_ref_frame; + + void update(const Vector2& p_delta_p); + void reset(); + SpeedTrack(); + }; + + SpeedTrack mouse_speed_track; + + RES custom_cursor; + +public: + + virtual bool is_key_pressed(int p_scancode); + virtual bool is_mouse_button_pressed(int p_button); + virtual bool is_joy_button_pressed(int p_device, int p_button); + virtual bool is_action_pressed(const StringName& p_action); + + virtual float get_joy_axis(int p_device,int p_axis); + String get_joy_name(int p_idx); + void joy_connection_changed(int p_idx, bool p_connected, String p_name); + + virtual Vector3 get_accelerometer(); + + virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_speed() const; + virtual int get_mouse_button_mask() const; + + virtual void warp_mouse_pos(const Vector2& p_to); + + + void parse_input_event(const InputEvent& p_event); + void set_accelerometer(const Vector3& p_accel); + void set_joy_axis(int p_device,int p_axis,float p_value); + + void set_main_loop(MainLoop *main_loop); + void set_mouse_pos(const Point2& p_posf); + + void action_press(const StringName& p_action); + void action_release(const StringName& p_action); + + void iteration(float p_step); + + void set_emulate_touch(bool p_emulate); + virtual bool is_emulating_touchscreen() const; + + virtual void set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot=Vector2()); + virtual void set_mouse_in_window(bool p_in_window); + + InputDefault(); + +}; + +#endif // INPUT_DEFAULT_H diff --git a/main/main.cpp b/main/main.cpp index 9b7e190e03..84f7c3a88e 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -75,7 +75,7 @@ #include "core/io/file_access_zip.h" #include "translation.h" #include "version.h" -#include "os/input.h" +#include "main/input_default.h" #include "performance.h" static Globals *globals=NULL; @@ -97,6 +97,8 @@ static OS::VideoMode video_mode; static bool init_maximized=false; static bool init_fullscreen=false; static bool init_use_custom_pos=false; +static bool debug_collisions=false; +static bool debug_navigation=false; static Vector2 init_custom_pos; static int video_driver_idx=-1; static int audio_driver_idx=-1; @@ -514,6 +516,10 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } else if (I->get()=="-debug" || I->get()=="-d") { debug_mode="local"; + } else if (I->get()=="-debugcol" || I->get()=="-dc") { + debug_collisions=true; + } else if (I->get()=="-debugnav" || I->get()=="-dn") { + debug_navigation=true; } else if (I->get()=="-editor_scene") { if (I->next()) { @@ -920,6 +926,9 @@ Error Main::setup2() { id->set_emulate_touch(true); } } + + + MAIN_PRINT("Main: Load Remaps"); MAIN_PRINT("Main: Load Scene Types"); @@ -927,6 +936,20 @@ Error Main::setup2() { register_scene_types(); register_server_types(); + GLOBAL_DEF("display/custom_mouse_cursor",String()); + GLOBAL_DEF("display/custom_mouse_cursor_hotspot",Vector2()); + Globals::get_singleton()->set_custom_property_info("display/custom_mouse_cursor",PropertyInfo(Variant::STRING,"display/custom_mouse_cursor",PROPERTY_HINT_FILE,"*.png,*.webp")); + + if (String(Globals::get_singleton()->get("display/custom_mouse_cursor"))!=String()) { + + print_line("use custom cursor"); + Ref<Texture> cursor=ResourceLoader::load(Globals::get_singleton()->get("display/custom_mouse_cursor")); + if (cursor.is_valid()) { + print_line("loaded ok"); + Vector2 hotspot = Globals::get_singleton()->get("display/custom_mouse_cursor_hotspot"); + Input::get_singleton()->set_custom_mouse_cursor(cursor,hotspot); + } + } #ifdef TOOLS_ENABLED EditorNode::register_editor_types(); ObjectTypeDB::register_type<PCKPacker>(); // todo: move somewhere else @@ -1154,8 +1177,15 @@ bool Main::start() { SceneTree *sml = main_loop->cast_to<SceneTree>(); + if (debug_collisions) { + sml->set_debug_collisions_hint(true); + } + if (debug_navigation) { + sml->set_debug_navigation_hint(true); + } #ifdef TOOLS_ENABLED + EditorNode *editor_node=NULL; if (editor) { diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 4f0daf329f..ad7c392cd0 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -34,7 +34,7 @@ #include "scene/3d/baked_light_instance.h" #include "io/marshalls.h" #include "scene/scene_string_names.h" - +#include "os/os.h" bool GridMap::_set(const StringName& p_name, const Variant& p_value) { @@ -393,8 +393,12 @@ void GridMap::set_cell_item(int p_x,int p_y,int p_z, int p_item,int p_rot){ if (g.items.empty()) { PhysicsServer::get_singleton()->free(g.static_body); + if (g.collision_debug.is_valid()) { + PhysicsServer::get_singleton()->free(g.collision_debug); + PhysicsServer::get_singleton()->free(g.collision_debug_instance); + } - memdelete(&g); + memdelete(&g); octant_map.erase(octantkey); } else { @@ -422,6 +426,20 @@ void GridMap::set_cell_item(int p_x,int p_y,int p_z, int p_item,int p_rot){ if (is_inside_world()) PhysicsServer::get_singleton()->body_set_space(g->static_body,get_world()->get_space()); + SceneTree *st=SceneTree::get_singleton(); + + if (st && st->is_debugging_collisions_hint()) { + + g->collision_debug=VisualServer::get_singleton()->mesh_create(); + g->collision_debug_instance=VisualServer::get_singleton()->instance_create(); + VisualServer::get_singleton()->instance_set_base(g->collision_debug_instance,g->collision_debug); + if (is_inside_world()) { + VisualServer::get_singleton()->instance_set_scenario(g->collision_debug_instance,get_world()->get_scenario()); + VisualServer::get_singleton()->instance_set_transform(g->collision_debug_instance,get_global_transform()); + } + + } + octant_map[octantkey]=g; } @@ -512,6 +530,13 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) { //print_line("BODYPOS: "+get_global_transform()); + if (g.collision_debug_instance.is_valid()) { + VS::get_singleton()->instance_set_scenario(g.collision_debug_instance,get_world()->get_scenario()); + VS::get_singleton()->instance_set_transform(g.collision_debug_instance,get_global_transform()); + if (area_map.has(p_key.area)) { + VS::get_singleton()->instance_set_room(g.collision_debug_instance,area_map[p_key.area]->instance); + } + } if (g.baked.is_valid()) { Transform xf = get_global_transform(); @@ -545,6 +570,10 @@ void GridMap::_octant_transform(const OctantKey &p_key) { Octant&g = *octant_map[p_key]; PhysicsServer::get_singleton()->body_set_state(g.static_body,PhysicsServer::BODY_STATE_TRANSFORM,get_global_transform()); + if (g.collision_debug_instance.is_valid()) { + VS::get_singleton()->instance_set_transform(g.collision_debug_instance,get_global_transform()); + } + if (g.baked.is_valid()) { Transform xf = get_global_transform(); @@ -572,6 +601,13 @@ void GridMap::_octant_update(const OctantKey &p_key) { PhysicsServer::get_singleton()->body_clear_shapes(g.static_body); + if (g.collision_debug.is_valid()) { + + VS::get_singleton()->mesh_clear(g.collision_debug); + } + + DVector<Vector3> col_debug; + for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) { Octant::ItemInstances &ii=E->get(); @@ -609,6 +645,7 @@ void GridMap::_octant_update(const OctantKey &p_key) { xform.basis.scale(Vector3(cell_scale,cell_scale,cell_scale)); ii.multimesh->set_instance_transform(idx,xform); + //ii.multimesh->set_instance_transform(idx,Transform() ); ii.multimesh->set_instance_color(idx,Color(1,1,1,1)); //print_line("MMINST: "+xform); @@ -624,8 +661,11 @@ void GridMap::_octant_update(const OctantKey &p_key) { if (ii.shape.is_valid()) { PhysicsServer::get_singleton()->body_add_shape(g.static_body,ii.shape->get_rid(),xform); - // print_line("PHIS x: "+xform); + if (g.collision_debug.is_valid()) { + ii.shape->add_vertices_to_array(col_debug,xform); + } + // print_line("PHIS x: "+xform); } idx++; @@ -636,6 +676,20 @@ void GridMap::_octant_update(const OctantKey &p_key) { } + if (col_debug.size()) { + + + Array arr; + arr.resize(VS::ARRAY_MAX); + arr[VS::ARRAY_VERTEX]=col_debug; + + VS::get_singleton()->mesh_add_surface(g.collision_debug,VS::PRIMITIVE_LINES,arr); + SceneTree *st=SceneTree::get_singleton(); + if (st) { + VS::get_singleton()->mesh_surface_set_material( g.collision_debug, 0,st->get_debug_collision_material()->get_rid() ); + } + } + g.dirty=false; } @@ -656,6 +710,12 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) { } + if (g.collision_debug_instance.is_valid()) { + + VS::get_singleton()->instance_set_room(g.collision_debug_instance,RID()); + VS::get_singleton()->instance_set_scenario(g.collision_debug_instance,RID()); + } + for(Map<int,Octant::ItemInstances>::Element *E=g.items.front();E;E=E->next()) { VS::get_singleton()->instance_set_scenario(E->get().multimesh_instance,RID()); @@ -959,6 +1019,11 @@ void GridMap::_clear_internal(bool p_keep_areas) { if (E->get()->bake_instance.is_valid()) VS::get_singleton()->free(E->get()->bake_instance); + if (E->get()->collision_debug.is_valid()) + VS::get_singleton()->free(E->get()->collision_debug); + if (E->get()->collision_debug_instance.is_valid()) + VS::get_singleton()->free(E->get()->collision_debug_instance); + PhysicsServer::get_singleton()->free(E->get()->static_body); memdelete(E->get()); diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index dff9fe3d68..9d3b1dcf95 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -93,6 +93,8 @@ class GridMap : public Spatial { Ref<Mesh> baked; RID bake_instance; + RID collision_debug; + RID collision_debug_instance; bool dirty; RID static_body; diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 982ef9d1cb..f8fc03ec61 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -249,11 +249,11 @@ public: virtual int get_device_count() const; virtual String get_device_name(int p_device) const; virtual String get_device_info(int p_device) const; - virtual Error run(int p_device,bool p_dumb=false,bool p_remote_debug=false); + virtual Error run(int p_device,int p_flags=0); virtual bool requieres_password(bool p_debug) const { return !p_debug; } virtual String get_binary_extension() const { return "apk"; } - virtual Error export_project(const String& p_path, bool p_debug, bool p_dumb=false, bool p_remote_debug=false); + virtual Error export_project(const String& p_path, bool p_debug, int p_flags=0); virtual bool can_export(String *r_error=NULL) const; @@ -1014,7 +1014,7 @@ Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata,const String& -Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_debug, bool p_dumb,bool p_remote_debug) { +Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_debug, int p_flags) { String src_apk; @@ -1078,7 +1078,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d if (file=="AndroidManifest.xml") { - _fix_manifest(data,p_dumb || p_remote_debug); + _fix_manifest(data,p_flags&(EXPORT_DUMB_CLIENT|EXPORT_REMOTE_DEBUG)); } if (file=="resources.arsc") { @@ -1156,9 +1156,9 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d } } - gen_export_flags(cl,p_dumb,p_remote_debug); + gen_export_flags(cl,p_flags); - if (p_dumb) { + if (p_flags) { /*String host = EditorSettings::get_singleton()->get("file_server/host"); int port = EditorSettings::get_singleton()->get("file_server/post"); @@ -1485,7 +1485,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { } -Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { ERR_FAIL_INDEX_V(p_device,devices.size(),ERR_INVALID_PARAMETER); device_lock->lock(); @@ -1504,7 +1504,7 @@ Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb, bool p_remote_ ep.step("Exporting APK",0); String export_to=EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmpexport.apk"; - Error err = export_project(export_to,true,p_dumb,p_remote_debug); + Error err = export_project(export_to,true,p_flags); if (err) { device_lock->unlock(); return err; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index e9b0d00196..dcaa1db654 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -39,7 +39,7 @@ #include "servers/physics_2d/physics_2d_server_sw.h" #include "servers/physics_2d/physics_2d_server_wrap_mt.h" #include "servers/visual/rasterizer.h" - +#include "main/input_default.h" //#ifdef USE_JAVA_FILE_ACCESS diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp index 44fef621c7..434aaff414 100644 --- a/platform/bb10/export/export.cpp +++ b/platform/bb10/export/export.cpp @@ -67,11 +67,11 @@ public: virtual int get_device_count() const; virtual String get_device_name(int p_device) const; virtual String get_device_info(int p_device) const; - virtual Error run(int p_device,bool p_dumb=false,bool p_remote_debug=false); + virtual Error run(int p_device,int p_flags=0); virtual bool requieres_password(bool p_debug) const { return !p_debug; } virtual String get_binary_extension() const { return "bar"; } - virtual Error export_project(const String& p_path,bool p_debug,bool p_dumb=false,bool p_remote_debug=false); + virtual Error export_project(const String& p_path,bool p_debug,int p_flags=0); virtual bool can_export(String *r_error=NULL) const; @@ -270,7 +270,7 @@ void EditorExportPlatformBB10::_fix_descriptor(Vector<uint8_t>& p_descriptor) { -Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debug, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debug, int p_flags) { EditorProgress ep("export","Exporting for BlackBerry 10",104); @@ -619,7 +619,7 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) { } -Error EditorExportPlatformBB10::run(int p_device, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformBB10::run(int p_device, int p_flags) { ERR_FAIL_INDEX_V(p_device,devices.size(),ERR_INVALID_PARAMETER); @@ -643,7 +643,7 @@ Error EditorExportPlatformBB10::run(int p_device, bool p_dumb, bool p_remote_deb ep.step("Exporting APK",0); String export_to=EditorSettings::get_singleton()->get_settings_path().plus_file("/tmp/tmpexport.bar"); - Error err = export_project(export_to,true); + Error err = export_project(export_to,true,p_flags); if (err) { device_lock->unlock(); return err; diff --git a/platform/flash/os_flash.h b/platform/flash/os_flash.h index 42ae3f0718..c8013df2f2 100644 --- a/platform/flash/os_flash.h +++ b/platform/flash/os_flash.h @@ -11,6 +11,7 @@ #include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
#include "servers/audio/audio_server_sw.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
+#include "main/input_default.h"
class OSFlash : public OS_Unix {
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index de000d0bf7..06a67b0cfd 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -43,10 +43,12 @@ #include "servers/audio/sample_manager_sw.h" #include "servers/spatial_sound/spatial_sound_server_sw.h" #include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h" +#include "main/input_default.h" #include "game_center.h" #include "in_app_store.h" #include "icloud.h" + class AudioDriverIphone; class RasterizerGLES2; diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp index fd505b8a8f..a2c6740eaf 100644 --- a/platform/javascript/audio_server_javascript.cpp +++ b/platform/javascript/audio_server_javascript.cpp @@ -259,12 +259,12 @@ void AudioServerJavascript::voice_play(RID p_voice, RID p_sample){ voice->active=true; } -void AudioServerJavascript::voice_set_volume(RID p_voice, float p_gain){ +void AudioServerJavascript::voice_set_volume(RID p_voice, float p_volume){ Voice* voice=voice_owner.get(p_voice); ERR_FAIL_COND(!voice); - voice->volume=p_gain; + voice->volume=p_volume; if (voice->active) { EM_ASM_( { diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h index bdab171b45..450237d324 100644 --- a/platform/javascript/audio_server_javascript.h +++ b/platform/javascript/audio_server_javascript.h @@ -125,7 +125,7 @@ public: virtual void voice_play(RID p_voice, RID p_sample); - virtual void voice_set_volume(RID p_voice, float p_gain); + virtual void voice_set_volume(RID p_voice, float p_volume); virtual void voice_set_pan(RID p_voice, float p_pan, float p_depth=0,float height=0); //pan and depth go from -1 to 1 virtual void voice_set_filter(RID p_voice, FilterType p_type, float p_cutoff, float p_resonance, float p_gain=0); virtual void voice_set_chorus(RID p_voice, float p_chorus ); diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index c38035e64a..9e2595f4a1 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -77,11 +77,11 @@ public: virtual int get_device_count() const { return show_run?1:0; }; virtual String get_device_name(int p_device) const { return "Run in Browser"; } virtual String get_device_info(int p_device) const { return "Run exported HTML in the system's default browser."; } - virtual Error run(int p_device,bool p_dumb=false,bool p_remote_debug=false); + virtual Error run(int p_device,int p_flags=0); virtual bool requieres_password(bool p_debug) const { return false; } virtual String get_binary_extension() const { return "html"; } - virtual Error export_project(const String& p_path,bool p_debug,bool p_dumb=false,bool p_remote_debug=false); + virtual Error export_project(const String& p_path,bool p_debug,int p_flags=0); virtual bool can_export(String *r_error=NULL) const; @@ -198,7 +198,7 @@ struct JSExportData { -Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool p_debug, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool p_debug, int p_flags) { String src_template; @@ -309,10 +309,10 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool } -Error EditorExportPlatformJavaScript::run(int p_device, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformJavaScript::run(int p_device, int p_flags) { String path = EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmp_export.html"; - Error err = export_project(path,true,""); + Error err = export_project(path,true,p_flags); if (err) return err; diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index 55ac7cdae4..1e925fb8df 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -40,6 +40,7 @@ #include "servers/visual/rasterizer.h" #include "audio_server_javascript.h" #include "audio_driver_javascript.h" +#include "main/input_default.h" typedef void (*GFXInitFunc)(void *ud,bool gl2,int w, int h, bool fs); typedef int (*OpenURIFunc)(const String&); diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 823bc46d74..79ee91bc61 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -57,11 +57,11 @@ public: virtual int get_device_count() const { return 0; }; virtual String get_device_name(int p_device) const { return String(); } virtual String get_device_info(int p_device) const { return String(); } - virtual Error run(int p_device,bool p_dumb=false,bool p_remote_debug=false); + virtual Error run(int p_device,int p_flags=0); virtual bool requieres_password(bool p_debug) const { return false; } virtual String get_binary_extension() const { return "zip"; } - virtual Error export_project(const String& p_path,bool p_debug,bool p_dumb=false,bool p_remote_debug=false); + virtual Error export_project(const String& p_path,bool p_debug,int p_flags=0); virtual bool can_export(String *r_error=NULL) const; @@ -245,7 +245,7 @@ void EditorExportPlatformOSX::_fix_plist(Vector<uint8_t>& plist,const String& p_ } } -Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug, int p_flags) { String src_pkg; @@ -437,7 +437,7 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug } -Error EditorExportPlatformOSX::run(int p_device, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformOSX::run(int p_device, int p_flags) { return OK; } diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 869997f190..49fa6c0862 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -32,7 +32,7 @@ #include "os/input.h" #include "drivers/unix/os_unix.h" - +#include "main/input_default.h" #include "servers/visual_server.h" #include "servers/visual/visual_server_wrap_mt.h" #include "servers/visual/rasterizer.h" diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index abfe42beda..b0ce37cecf 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -512,12 +512,26 @@ static int button_mask=0; - (void)mouseExited:(NSEvent *)event { + if (!OS_OSX::singleton) + return; + + if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode!=OS::MOUSE_MODE_CAPTURED) + OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT); + if (OS_OSX::singleton->input) + OS_OSX::singleton->input->set_mouse_in_window(false); // _glfwInputCursorEnter(window, GL_FALSE); } - (void)mouseEntered:(NSEvent *)event { // _glfwInputCursorEnter(window, GL_TRUE); + if (!OS_OSX::singleton) + return; + if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode!=OS::MOUSE_MODE_CAPTURED) + OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER); + if (OS_OSX::singleton->input) + OS_OSX::singleton->input->set_mouse_in_window(true); + } - (void)viewDidChangeBackingProperties diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 4e7721f068..b3410f7955 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -30,7 +30,7 @@ #define OS_SERVER_H -#include "os/input.h" +#include "main/input_default.h" #include "drivers/unix/os_unix.h" #include "servers/visual_server.h" #include "servers/visual/rasterizer.h" diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 0fe4f9f3b5..ddd7c1318e 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -134,8 +134,8 @@ def can_build(): if (os.getenv("MINGW64_PREFIX")):
mingw64=os.getenv("MINGW64_PREFIX")
- test = "gcc --version >/dev/null"
- if os.system(mingw+test) == 0 or os.system(mingw64+test) ==0 or os.system(mingw32+test) ==0 :
+ test = "gcc --version &>/dev/null"
+ if (os.system(mingw+test) == 0 or os.system(mingw64+test) == 0 or os.system(mingw32+test) == 0):
return True
return False
@@ -150,7 +150,7 @@ def get_opts(): mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-"
- if os.system(mingw32+"gcc --version >/dev/null") != 0 :
+ if os.system(mingw32+"gcc --version &>/dev/null") != 0 :
mingw32 = mingw
if (os.getenv("MINGW32_PREFIX")):
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 87d9a43d8c..438a5a6903 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -323,11 +323,21 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { old_invalid=true; outside=true; + if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED) + main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT); + if (input) + input->set_mouse_in_window(false); } break; case WM_MOUSEMOVE: { if (outside) { + //mouse enter + + if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED) + main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER); + if (input) + input->set_mouse_in_window(true); CursorShape c=cursor_shape; cursor_shape=CURSOR_MAX; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index cce94f5b25..026b50c33d 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -47,6 +47,7 @@ #include "servers/physics_2d/physics_2d_server_sw.h" #include "servers/physics_2d/physics_2d_server_wrap_mt.h" +#include "main/input_default.h" #include <windows.h> diff --git a/platform/winrt/os_winrt.h b/platform/winrt/os_winrt.h index b69feccae9..5719426f9f 100644 --- a/platform/winrt/os_winrt.h +++ b/platform/winrt/os_winrt.h @@ -50,6 +50,8 @@ #include <fcntl.h> #include <stdio.h> +#include "main/input_default.h" + /** @author Juan Linietsky <reduzio@gmail.com> */ diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 51f4392eb4..fe15dd5a08 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1181,8 +1181,22 @@ void OS_X11::process_xevents() { XVisibilityEvent * visibility = (XVisibilityEvent *)&event; minimized = (visibility->state == VisibilityFullyObscured); } break; + case LeaveNotify: { - case FocusIn: + if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED) + main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT); + if (input) + input->set_mouse_in_window(false); + + } break; + case EnterNotify: { + + if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED) + main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER); + if (input) + input->set_mouse_in_window(true); + } break; + case FocusIn: minimized = false; #ifdef NEW_WM_API if(current_videomode.fullscreen) { @@ -1866,6 +1880,16 @@ void OS_X11::swap_buffers() { context_gl->swap_buffers(); } +void OS_X11::alert(const String& p_alert,const String& p_title) { + + List<String> args; + args.push_back("-center"); + args.push_back("-title"); + args.push_back(p_title); + args.push_back(p_alert); + + execute("/usr/bin/xmessage",args,true); +} void OS_X11::set_icon(const Image& p_icon) { if (!p_icon.empty()) { diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 12f0aec611..1566062b9e 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -46,6 +46,7 @@ #include "drivers/pulseaudio/audio_driver_pulseaudio.h" #include "servers/physics_2d/physics_2d_server_sw.h" #include "servers/physics_2d/physics_2d_server_wrap_mt.h" +#include "main/input_default.h" #include <X11/keysym.h> #include <X11/Xlib.h> @@ -243,7 +244,7 @@ public: virtual bool is_window_maximized() const; virtual void move_window_to_foreground(); - + virtual void alert(const String& p_alert,const String& p_title="ALERT!"); void run(); OS_X11(); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 92d5088b81..357aaa225b 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -265,7 +265,7 @@ void CanvasItem::_propagate_visibility_changed(bool p_visible) { CanvasItem *c=get_child(i)->cast_to<CanvasItem>(); - if (c && c->hidden!=p_visible) //should the toplevels stop propagation? i think so but.. + if (c && !c->hidden) //should the toplevels stop propagation? i think so but.. c->_propagate_visibility_changed(p_visible); } @@ -1172,6 +1172,14 @@ Matrix32 CanvasItem::get_viewport_transform() const { } +void CanvasItem::set_notify_local_transform(bool p_enable) { + notify_local_transform=p_enable; +} + +bool CanvasItem::is_local_transform_notification_enabled() const { + return notify_local_transform; +} + CanvasItem::CanvasItem() : xform_change(this) { @@ -1191,6 +1199,7 @@ CanvasItem::CanvasItem() : xform_change(this) { canvas_layer=NULL; use_parent_material=false; global_invalid=true; + notify_local_transform=false; light_mask=1; C=NULL; diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 6d8308dbe4..4885256c64 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -126,6 +126,7 @@ private: bool block_transform_notify; bool behind; bool use_parent_material; + bool notify_local_transform; Ref<CanvasItemMaterial> material; @@ -155,7 +156,7 @@ private: protected: - _FORCE_INLINE_ void _notify_transform() { if (!is_inside_tree()) return; _notify_transform(this); if (!block_transform_notify) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); } + _FORCE_INLINE_ void _notify_transform() { if (!is_inside_tree()) return; _notify_transform(this); if (!block_transform_notify && notify_local_transform) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); } void item_rect_changed(); @@ -263,6 +264,10 @@ public: Vector2 get_global_mouse_pos() const; Vector2 get_local_mouse_pos() const; + void set_notify_local_transform(bool p_enable); + bool is_local_transform_notification_enabled() const; + + CanvasItem(); ~CanvasItem(); }; diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index ceea41d1c8..1479cb7881 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -33,7 +33,7 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { - if (unparenting) + if (unparenting || !can_update_body) return; CollisionObject2D *co = p_obj->cast_to<CollisionObject2D>(); @@ -49,6 +49,7 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { //here comes the sun, lalalala //decompose concave into multiple convex polygons and add them Vector< Vector<Vector2> > decomp = Geometry::decompose_polygon(polygon); + shape_from=co->get_shape_count(); for(int i=0;i<decomp.size();i++) { Ref<ConvexPolygonShape2D> convex = memnew( ConvexPolygonShape2D ); convex->set_points(decomp[i]); @@ -57,6 +58,11 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { co->set_shape_as_trigger(co->get_shape_count()-1,true); } + shape_to=co->get_shape_count()-1; + if (shape_to<shape_from) { + shape_from=-1; + shape_to=-1; + } } else { @@ -78,6 +84,9 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { if (trigger) co->set_shape_as_trigger(co->get_shape_count()-1,true); + shape_from=co->get_shape_count()-1; + shape_to=co->get_shape_count()-1; + } @@ -86,6 +95,8 @@ void CollisionPolygon2D::_add_to_collision_object(Object *p_obj) { void CollisionPolygon2D::_update_parent() { + if (!can_update_body) + return; Node *parent = get_parent(); if (!parent) return; @@ -101,33 +112,55 @@ void CollisionPolygon2D::_notification(int p_what) { switch(p_what) { case NOTIFICATION_ENTER_TREE: { unparenting=false; + can_update_body=get_tree()->is_editor_hint(); + } break; + case NOTIFICATION_EXIT_TREE: { + can_update_body=false; } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (!is_inside_tree()) break; - _update_parent(); + if (can_update_body) { + _update_parent(); + } else if (shape_from>=0 && shape_to>=0) { + CollisionObject2D *co = get_parent()->cast_to<CollisionObject2D>(); + for(int i=shape_from;i<=shape_to;i++) { + co->set_shape_transform(i,get_transform()); + } + } + } break; case NOTIFICATION_DRAW: { + + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + break; + } + + for(int i=0;i<polygon.size();i++) { Vector2 p = polygon[i]; Vector2 n = polygon[(i+1)%polygon.size()]; - draw_line(p,n,Color(0,0.6,0.7,0.5),3); + draw_line(p,n,Color(0.9,0.2,0.0,0.8),3); } +//#define DEBUG_DECOMPOSE +#if defined(TOOLS_ENABLED) && defined (DEBUG_DECOMPOSE) Vector< Vector<Vector2> > decomp = Geometry::decompose_polygon(polygon); -#define DEBUG_DECOMPOSE -#ifdef DEBUG_DECOMPOSE Color c(0.4,0.9,0.1); for(int i=0;i<decomp.size();i++) { c.set_hsv( Math::fmod(c.get_h() + 0.738,1),c.get_s(),c.get_v(),0.5); draw_colored_polygon(decomp[i],c); } +#else + draw_colored_polygon(polygon,get_tree()->get_debug_collisions_color()); #endif + + } break; case NOTIFICATION_UNPARENTED: { unparenting = true; @@ -141,20 +174,22 @@ void CollisionPolygon2D::set_polygon(const Vector<Point2>& p_polygon) { polygon=p_polygon; - for(int i=0;i<polygon.size();i++) { - if (i==0) - aabb=Rect2(polygon[i],Size2()); - else - aabb.expand_to(polygon[i]); - } - if (aabb==Rect2()) { + if (can_update_body) { + for(int i=0;i<polygon.size();i++) { + if (i==0) + aabb=Rect2(polygon[i],Size2()); + else + aabb.expand_to(polygon[i]); + } + if (aabb==Rect2()) { - aabb=Rect2(-10,-10,20,20); - } else { - aabb.pos-=aabb.size*0.3; - aabb.size+=aabb.size*0.6; + aabb=Rect2(-10,-10,20,20); + } else { + aabb.pos-=aabb.size*0.3; + aabb.size+=aabb.size*0.6; + } + _update_parent(); } - _update_parent(); update(); } @@ -184,6 +219,13 @@ void CollisionPolygon2D::set_trigger(bool p_trigger) { trigger=p_trigger; _update_parent(); + if (!can_update_body && is_inside_tree() && shape_from>=0 && shape_to>=0) { + CollisionObject2D *co = get_parent()->cast_to<CollisionObject2D>(); + for(int i=shape_from;i<=shape_to;i++) { + co->set_shape_as_trigger(i,p_trigger); + } + + } } bool CollisionPolygon2D::is_trigger() const{ @@ -192,6 +234,17 @@ bool CollisionPolygon2D::is_trigger() const{ } +void CollisionPolygon2D::_set_shape_range(const Vector2& p_range) { + + shape_from=p_range.x; + shape_to=p_range.y; +} + +Vector2 CollisionPolygon2D::_get_shape_range() const { + + return Vector2(shape_from,shape_to); +} + void CollisionPolygon2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("_add_to_collision_object"),&CollisionPolygon2D::_add_to_collision_object); @@ -204,9 +257,17 @@ void CollisionPolygon2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_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); + ObjectTypeDB::bind_method(_MD("_get_shape_range"),&CollisionPolygon2D::_get_shape_range); + + ObjectTypeDB::bind_method(_MD("get_collision_object_first_shape"),&CollisionPolygon2D::get_collision_object_first_shape); + ObjectTypeDB::bind_method(_MD("get_collision_object_last_shape"),&CollisionPolygon2D::get_collision_object_last_shape); + ADD_PROPERTY( PropertyInfo(Variant::INT,"build_mode",PROPERTY_HINT_ENUM,"Solids,Segments"),_SCS("set_build_mode"),_SCS("get_build_mode")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"shape_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_shape_range"),_SCS("_get_shape_range")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger")); + } CollisionPolygon2D::CollisionPolygon2D() { @@ -215,6 +276,9 @@ CollisionPolygon2D::CollisionPolygon2D() { build_mode=BUILD_SOLIDS; trigger=false; unparenting=false; - + shape_from=-1; + shape_to=-1; + can_update_body=false; + set_notify_local_transform(true); } diff --git a/scene/2d/collision_polygon_2d.h b/scene/2d/collision_polygon_2d.h index 4e78868082..4bc9713c8a 100644 --- a/scene/2d/collision_polygon_2d.h +++ b/scene/2d/collision_polygon_2d.h @@ -56,6 +56,14 @@ protected: void _add_to_collision_object(Object *p_obj); void _update_parent(); + bool can_update_body; + int shape_from; + int shape_to; + + void _set_shape_range(const Vector2& p_range); + Vector2 _get_shape_range() const; + + protected: void _notification(int p_what); @@ -72,6 +80,10 @@ public: Vector<Point2> get_polygon() const; virtual Rect2 get_item_rect() const; + + int get_collision_object_first_shape() const { return shape_from; } + int get_collision_object_last_shape() const { return shape_to; } + CollisionPolygon2D(); }; diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index 5012c54b17..85751fc735 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -44,10 +44,12 @@ void CollisionShape2D::_add_to_collision_object(Object *p_obj) { CollisionObject2D *co = p_obj->cast_to<CollisionObject2D>(); ERR_FAIL_COND(!co); + update_shape_index=co->get_shape_count(); co->add_shape(shape,get_transform()); if (trigger) co->set_shape_as_trigger(co->get_shape_count()-1,true); + } void CollisionShape2D::_shape_changed() { @@ -74,12 +76,27 @@ void CollisionShape2D::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { unparenting=false; + can_update_body=get_tree()->is_editor_hint(); + } break; case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { if (!is_inside_tree()) break; - _update_parent(); + if (can_update_body) { + _update_parent(); + } else if (update_shape_index>=0){ + + CollisionObject2D *co = get_parent()->cast_to<CollisionObject2D>(); + if (co) { + co->set_shape_transform(update_shape_index,get_transform()); + } + + } + + } break; + case NOTIFICATION_EXIT_TREE: { + can_update_body=false; } break; /* @@ -92,106 +109,22 @@ void CollisionShape2D::_notification(int p_what) { } break;*/ case NOTIFICATION_DRAW: { - rect=Rect2(); - - Color draw_col=Color(0,0.6,0.7,0.5); - - if (shape->cast_to<LineShape2D>()) { - - LineShape2D *l = shape->cast_to<LineShape2D>(); - Vector2 point = l->get_d() * l->get_normal(); - - Vector2 l1[2]={point-l->get_normal().tangent()*100,point+l->get_normal().tangent()*100}; - draw_line(l1[0],l1[1],draw_col,3); - Vector2 l2[2]={point,point+l->get_normal()*30}; - draw_line(l2[0],l2[1],draw_col,3); - rect.pos=l1[0]; - rect.expand_to(l1[1]); - rect.expand_to(l2[0]); - rect.expand_to(l2[1]); - - } else if (shape->cast_to<SegmentShape2D>()) { - - SegmentShape2D *s = shape->cast_to<SegmentShape2D>(); - draw_line(s->get_a(),s->get_b(),draw_col,3); - rect.pos=s->get_a(); - rect.expand_to(s->get_b()); - - } else if (shape->cast_to<RayShape2D>()) { - - RayShape2D *s = shape->cast_to<RayShape2D>(); - - Vector2 tip = Vector2(0,s->get_length()); - draw_line(Vector2(),tip,draw_col,3); - Vector<Vector2> pts; - float tsize=4; - pts.push_back(tip+Vector2(0,tsize)); - pts.push_back(tip+Vector2(0.707*tsize,0)); - pts.push_back(tip+Vector2(-0.707*tsize,0)); - Vector<Color> cols; - for(int i=0;i<3;i++) - cols.push_back(draw_col); - - draw_primitive(pts,cols,Vector<Vector2>()); //small arrow - - rect.pos=Vector2(); - rect.expand_to(tip); - rect=rect.grow(0.707*tsize); - - } else if (shape->cast_to<CircleShape2D>()) { - - CircleShape2D *s = shape->cast_to<CircleShape2D>(); - Vector<Vector2> points; - for(int i=0;i<24;i++) { - - points.push_back(Vector2(Math::cos(i*Math_PI*2/24.0),Math::sin(i*Math_PI*2/24.0))*s->get_radius()); - } - - draw_colored_polygon(points,draw_col); - rect.pos=-Point2(s->get_radius(),s->get_radius()); - rect.size=Point2(s->get_radius(),s->get_radius())*2.0; - - } else if (shape->cast_to<RectangleShape2D>()) { - - RectangleShape2D *s = shape->cast_to<RectangleShape2D>(); - Vector2 he = s->get_extents(); - rect=Rect2(-he,he*2.0); - draw_rect(rect,draw_col);; - - } else if (shape->cast_to<CapsuleShape2D>()) { - - CapsuleShape2D *s = shape->cast_to<CapsuleShape2D>(); - - Vector<Vector2> points; - for(int i=0;i<24;i++) { - Vector2 ofs = Vector2(0,(i>6 && i<=18) ? -s->get_height()*0.5 : s->get_height()*0.5); - - points.push_back(Vector2(Math::sin(i*Math_PI*2/24.0),Math::cos(i*Math_PI*2/24.0))*s->get_radius() + ofs); - if (i==6 || i==18) - points.push_back(Vector2(Math::sin(i*Math_PI*2/24.0),Math::cos(i*Math_PI*2/24.0))*s->get_radius() - ofs); - } - - draw_colored_polygon(points,draw_col); - Vector2 he=Point2(s->get_radius(),s->get_radius()+s->get_height()*0.5); - rect.pos=-he; - rect.size=he*2.0; + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) { + break; + } - } else if (shape->cast_to<ConvexPolygonShape2D>()) { + if (!shape.is_valid()) { + break; + } - ConvexPolygonShape2D *s = shape->cast_to<ConvexPolygonShape2D>(); + rect=Rect2(); - Vector<Vector2> points = s->get_points(); - for(int i=0;i<points.size();i++) { - if (i==0) - rect.pos=points[i]; - else - rect.expand_to(points[i]); - } - draw_colored_polygon(points,draw_col); + Color draw_col=get_tree()->get_debug_collisions_color(); + shape->draw(get_canvas_item(),draw_col); - } + rect=shape->get_rect(); rect=rect.grow(3); } break; @@ -209,7 +142,14 @@ void CollisionShape2D::set_shape(const Ref<Shape2D>& p_shape) { shape->disconnect("changed",this,"_shape_changed"); shape=p_shape; update(); - _update_parent(); + if (is_inside_tree() && can_update_body) + _update_parent(); + if (is_inside_tree() && !can_update_body && update_shape_index>=0) { + CollisionObject2D *co = get_parent()->cast_to<CollisionObject2D>(); + if (co) { + co->set_shape(update_shape_index,p_shape); + } + } if (shape.is_valid()) shape->connect("changed",this,"_shape_changed"); @@ -228,7 +168,14 @@ Rect2 CollisionShape2D::get_item_rect() const { void CollisionShape2D::set_trigger(bool p_trigger) { trigger=p_trigger; - _update_parent(); + if (can_update_body) { + _update_parent(); + } else if (is_inside_tree() && update_shape_index>=0){ + CollisionObject2D *co = get_parent()->cast_to<CollisionObject2D>(); + if (co) { + co->set_shape_as_trigger(update_shape_index,p_trigger); + } + } } bool CollisionShape2D::is_trigger() const{ @@ -236,6 +183,19 @@ bool CollisionShape2D::is_trigger() const{ return trigger; } + +void CollisionShape2D::_set_update_shape_index(int p_index) { + + + update_shape_index=p_index; +} + +int CollisionShape2D::_get_update_shape_index() const{ + + return update_shape_index; +} + + void CollisionShape2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_shape","shape"),&CollisionShape2D::set_shape); @@ -245,14 +205,23 @@ void CollisionShape2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_trigger","enable"),&CollisionShape2D::set_trigger); ObjectTypeDB::bind_method(_MD("is_trigger"),&CollisionShape2D::is_trigger); + ObjectTypeDB::bind_method(_MD("_set_update_shape_index","index"),&CollisionShape2D::_set_update_shape_index); + ObjectTypeDB::bind_method(_MD("_get_update_shape_index"),&CollisionShape2D::_get_update_shape_index); + + ObjectTypeDB::bind_method(_MD("get_collision_object_shape_index"),&CollisionShape2D::get_collision_object_shape_index); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape2D"),_SCS("set_shape"),_SCS("get_shape")); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "_update_shape_index", PROPERTY_HINT_NONE, "",PROPERTY_USAGE_NOEDITOR), _SCS("_set_update_shape_index"), _SCS("_get_update_shape_index")); + } CollisionShape2D::CollisionShape2D() { rect=Rect2(-Point2(10,10),Point2(20,20)); - + set_notify_local_transform(true); trigger=false; unparenting = false; + can_update_body = false; + update_shape_index=-1; } diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h index 507912d31e..82e1137174 100644 --- a/scene/2d/collision_shape_2d.h +++ b/scene/2d/collision_shape_2d.h @@ -39,7 +39,13 @@ class CollisionShape2D : public Node2D { Rect2 rect; bool trigger; bool unparenting; + bool can_update_body; void _shape_changed(); + int update_shape_index; + + void _set_update_shape_index(int p_index); + int _get_update_shape_index() const; + protected: void _update_parent(); @@ -55,6 +61,8 @@ public: void set_trigger(bool p_trigger); bool is_trigger() const; + int get_collision_object_shape_index() const { return _get_update_shape_index(); } + CollisionShape2D(); }; diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp index fc69ea8a0d..792f079ab0 100644 --- a/scene/2d/navigation_polygon.cpp +++ b/scene/2d/navigation_polygon.cpp @@ -279,7 +279,7 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) { } - if (get_tree()->is_editor_hint()) + if (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) update(); // update_gizmo(); @@ -338,7 +338,7 @@ void NavigationPolygonInstance::_notification(int p_what) { } break; case NOTIFICATION_DRAW: { - if (is_inside_tree() && get_tree()->is_editor_hint() && navpoly.is_valid()) { + if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) { DVector<Vector2> verts=navpoly->get_vertices(); int vsize = verts.size(); @@ -348,9 +348,9 @@ void NavigationPolygonInstance::_notification(int p_what) { Color color; if (enabled) { - color=Color(0.1,0.8,1.0,0.4); + color=get_tree()->get_debug_navigation_color(); } else { - color=Color(1.0,0.8,0.1,0.4); + color=get_tree()->get_debug_navigation_disabled_color(); } Vector<Color> colors; Vector<Vector2> vertices; @@ -423,7 +423,7 @@ Ref<NavigationPolygon> NavigationPolygonInstance::get_navigation_polygon() const void NavigationPolygonInstance::_navpoly_changed() { - if (is_inside_tree() && get_tree()->is_editor_hint()) + if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) update(); } diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 20abe42cd9..05594fd79c 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -115,17 +115,17 @@ void RayCast2D::_notification(int p_what) { set_fixed_process(false); } break; -#ifdef TOOLS_ENABLED + case NOTIFICATION_DRAW: { - if (!get_tree()->is_editor_hint()) + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) break; Matrix32 xf; xf.rotate(cast_to.atan2()); xf.translate(Vector2(0,cast_to.length())); //Vector2 tip = Vector2(0,s->get_length()); - Color dcol(0.9,0.2,0.2,0.4); + Color dcol=get_tree()->get_debug_collisions_color();//0.9,0.2,0.2,0.4); draw_line(Vector2(),cast_to,dcol,3); Vector<Vector2> pts; float tsize=4; @@ -139,7 +139,7 @@ void RayCast2D::_notification(int p_what) { draw_primitive(pts,cols,Vector<Vector2>()); //small arrow } break; -#endif + case NOTIFICATION_FIXED_PROCESS: { diff --git a/scene/2d/sample_player_2d.cpp b/scene/2d/sample_player_2d.cpp index bb37475944..ec17ffc55e 100644 --- a/scene/2d/sample_player_2d.cpp +++ b/scene/2d/sample_player_2d.cpp @@ -214,7 +214,7 @@ void SamplePlayer2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_sample_library","library:SampleLibrary"),&SamplePlayer2D::set_sample_library); ObjectTypeDB::bind_method(_MD("get_sample_library:SampleLibrary"),&SamplePlayer2D::get_sample_library); - ObjectTypeDB::bind_method(_MD("set_polyphony","voices"),&SamplePlayer2D::set_polyphony); + ObjectTypeDB::bind_method(_MD("set_polyphony","max_voices"),&SamplePlayer2D::set_polyphony); ObjectTypeDB::bind_method(_MD("get_polyphony"),&SamplePlayer2D::get_polyphony); ObjectTypeDB::bind_method(_MD("play","sample","voice"),&SamplePlayer2D::play,DEFVAL(NEXT_VOICE)); diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 6705cebf37..87697fc073 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -189,6 +189,7 @@ void Sprite::set_region_rect(const Rect2& p_region_rect) { if (region && changed) { update(); item_rect_changed(); + _change_notify("region_rect"); } } diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 17f93f816f..418ee192b2 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -30,6 +30,7 @@ #include "io/marshalls.h" #include "servers/physics_2d_server.h" #include "method_bind_ext.inc" +#include "os/os.h" int TileMap::_get_quadrant_size() const { @@ -262,6 +263,14 @@ void TileMap::_update_dirty_quadrants() { Vector2 qofs; + SceneTree *st=SceneTree::get_singleton(); + Color debug_collision_color; + + bool debug_shapes = st && st->is_debugging_collisions_hint(); + if (debug_shapes) { + debug_collision_color=st->get_debug_collisions_color(); + } + while (dirty_quadrant_list.first()) { Quadrant &q = *dirty_quadrant_list.first()->self(); @@ -398,11 +407,19 @@ void TileMap::_update_dirty_quadrants() { _fix_cell_transform(xform,c,shape_ofs+center_ofs,s); - ps->body_add_shape(q.body,shape->get_rid(),xform); + if (debug_shapes) { + vs->canvas_item_add_set_transform(canvas_item,xform); + shape->draw(canvas_item,debug_collision_color); + + } + ps->body_add_shape(q.body,shape->get_rid(),xform); ps->body_set_shape_metadata(q.body,shape_idx++,Vector2(E->key().x,E->key().y)); } } + if (debug_shapes) { + vs->canvas_item_add_set_transform(canvas_item,Matrix32()); + } if (navigation) { Ref<NavigationPolygon> navpoly = tile_set->tile_get_navigation_polygon(c.id); @@ -412,6 +429,7 @@ void TileMap::_update_dirty_quadrants() { xform.set_origin(offset.floor()+q.pos); _fix_cell_transform(xform,c,npoly_ofs+center_ofs,s); + int pid = navigation->navpoly_create(navpoly,nav_rel * xform); Quadrant::NavPoly np; diff --git a/scene/3d/body_shape.cpp b/scene/3d/body_shape.cpp index c49d1b028c..b54cbfe0f9 100644 --- a/scene/3d/body_shape.cpp +++ b/scene/3d/body_shape.cpp @@ -43,7 +43,10 @@ void CollisionShape::_update_body() { - + if (!is_inside_tree() || !can_update_body) + return; + if (!get_tree()->is_editor_hint()) + return; if (get_parent() && get_parent()->cast_to<CollisionObject>()) get_parent()->cast_to<CollisionObject>()->_update_shapes_from_children(); @@ -310,10 +313,13 @@ void CollisionShape::_add_to_collision_object(Object* p_cshape) { if (shape.is_valid()) { + update_shape_index=co->get_shape_count(); co->add_shape(shape,get_transform()); - if (trigger) - co->set_shape_as_trigger( co->get_shape_count() -1, true ); - } + if (trigger) + co->set_shape_as_trigger( co->get_shape_count() -1, true ); + } else { + update_shape_index=-1; + } } void CollisionShape::_notification(int p_what) { @@ -322,12 +328,18 @@ void CollisionShape::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { unparenting=false; + can_update_body=get_tree()->is_editor_hint(); + set_notify_local_transform(!can_update_body); + + if (get_tree()->is_debugging_collisions_hint()) { + _create_debug_shape(); + } //indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario()); } break; case NOTIFICATION_TRANSFORM_CHANGED: { // VisualServer::get_singleton()->instance_set_transform(indicator_instance,get_global_transform()); - if (updating_body) { + if (can_update_body && updating_body) { _update_body(); } } break; @@ -336,16 +348,34 @@ void CollisionShape::_notification(int p_what) { VisualServer::get_singleton()->free(indicator_instance); indicator_instance=RID(); }*/ + can_update_body=false; + set_notify_local_transform(false); + if (debug_shape) { + debug_shape->queue_delete(); + debug_shape=NULL; + } } break; case NOTIFICATION_UNPARENTED: { unparenting=true; - if (updating_body) + if (can_update_body && updating_body) _update_body(); } break; case NOTIFICATION_PARENTED: { - if (updating_body) + if (can_update_body && updating_body) _update_body(); } break; + case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { + + if (!can_update_body && update_shape_index>=0) { + + CollisionObject *co = get_parent()->cast_to<CollisionObject>(); + if (co) { + co->set_shape_transform(update_shape_index,get_transform()); + } + } + + } break; + } } @@ -357,6 +387,18 @@ void CollisionShape::resource_changed(RES res) { } +void CollisionShape::_set_update_shape_index(int p_index) { + + + update_shape_index=p_index; +} + +int CollisionShape::_get_update_shape_index() const{ + + return update_shape_index; +} + + void CollisionShape::_bind_methods() { //not sure if this should do anything @@ -368,10 +410,14 @@ void CollisionShape::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_trigger"),&CollisionShape::is_trigger); ObjectTypeDB::bind_method(_MD("make_convex_from_brothers"),&CollisionShape::make_convex_from_brothers); ObjectTypeDB::set_method_flags("CollisionShape","make_convex_from_brothers",METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR); + ObjectTypeDB::bind_method(_MD("_set_update_shape_index","index"),&CollisionShape::_set_update_shape_index); + ObjectTypeDB::bind_method(_MD("_get_update_shape_index"),&CollisionShape::_get_update_shape_index); + ObjectTypeDB::bind_method(_MD("get_collision_object_shape_index"),&CollisionShape::get_collision_object_shape_index); ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape"), _SCS("set_shape"), _SCS("get_shape")); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"trigger"),_SCS("set_trigger"),_SCS("is_trigger")); + ADD_PROPERTY( PropertyInfo( Variant::INT, "_update_shape_index", PROPERTY_HINT_NONE, "",PROPERTY_USAGE_NOEDITOR), _SCS("_set_update_shape_index"), _SCS("_get_update_shape_index")); } @@ -383,8 +429,15 @@ void CollisionShape::set_shape(const Ref<Shape> &p_shape) { if (!shape.is_null()) shape->register_owner(this); update_gizmo(); - if (updating_body) + if (updating_body) { _update_body(); + } else if (can_update_body && update_shape_index>=0 && is_inside_tree()){ + CollisionObject *co = get_parent()->cast_to<CollisionObject>(); + if (co) { + co->set_shape(update_shape_index,p_shape); + } + + } } Ref<Shape> CollisionShape::get_shape() const { @@ -405,8 +458,14 @@ bool CollisionShape::is_updating_body() const { void CollisionShape::set_trigger(bool p_trigger) { trigger=p_trigger; - if (updating_body) + if (updating_body) { _update_body(); + } else if (can_update_body && update_shape_index>=0 && is_inside_tree()){ + CollisionObject *co = get_parent()->cast_to<CollisionObject>(); + if (co) { + co->set_shape_as_trigger(update_shape_index,p_trigger); + } + } } bool CollisionShape::is_trigger() const{ @@ -419,7 +478,10 @@ CollisionShape::CollisionShape() { //indicator = VisualServer::get_singleton()->mesh_create(); updating_body=true; unparenting=false; - trigger=false; + update_shape_index=-1; + trigger=false; + can_update_body=false; + debug_shape=NULL; } CollisionShape::~CollisionShape() { @@ -428,6 +490,30 @@ CollisionShape::~CollisionShape() { //VisualServer::get_singleton()->free(indicator); } +void CollisionShape::_create_debug_shape() { + + + if (debug_shape) { + debug_shape->queue_delete();; + debug_shape=NULL; + } + + Ref<Shape> s = get_shape(); + + if (s.is_null()) + return; + + + Ref<Mesh> mesh = s->get_debug_mesh(); + + MeshInstance *mi = memnew( MeshInstance ); + mi->set_mesh(mesh); + + add_child(mi); + debug_shape=mi; + +} + #if 0 #include "body_volume.h" diff --git a/scene/3d/body_shape.h b/scene/3d/body_shape.h index b3c0006d79..6c0b89da56 100644 --- a/scene/3d/body_shape.h +++ b/scene/3d/body_shape.h @@ -50,14 +50,26 @@ class CollisionShape : public Spatial { RID indicator_instance; */ + Node* debug_shape; + void resource_changed(RES res); bool updating_body; bool unparenting; bool trigger; + bool can_update_body; + + int update_shape_index; + void _update_body(); void _add_to_collision_object(Object* p_cshape); + + void _set_update_shape_index(int p_index); + int _get_update_shape_index() const; + + void _create_debug_shape(); + protected: void _notification(int p_what); @@ -73,8 +85,10 @@ public: void set_updating_body(bool p_update); bool is_updating_body() const; - void set_trigger(bool p_trigger); - bool is_trigger() const; + void set_trigger(bool p_trigger); + bool is_trigger() const; + + int get_collision_object_shape_index() const { return _get_update_shape_index(); } CollisionShape(); ~CollisionShape(); diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index 4ab1a1a1ab..c857b4851a 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -6,6 +6,8 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) { + if (!can_update_body) + return; CollisionObject *co = p_obj->cast_to<CollisionObject>(); ERR_FAIL_COND(!co); @@ -23,6 +25,7 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) { //here comes the sun, lalalala //decompose concave into multiple convex polygons and add them + shape_from=co->get_shape_count(); for(int i=0;i<decomp.size();i++) { Ref<ConvexPolygonShape> convex = memnew( ConvexPolygonShape ); DVector<Vector3> cp; @@ -43,6 +46,11 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) { co->add_shape(convex,get_transform()); } + shape_to=co->get_shape_count()-1; + if (shape_to<shape_from) { + shape_from=-1; + shape_to=-1; + } } else { #if 0 @@ -71,6 +79,9 @@ void CollisionPolygon::_add_to_collision_object(Object *p_obj) { void CollisionPolygon::_update_parent() { + if (!can_update_body) + return; + Node *parent = get_parent(); if (!parent) return; @@ -80,15 +91,50 @@ void CollisionPolygon::_update_parent() { co->_update_shapes_from_children(); } +void CollisionPolygon::_set_shape_range(const Vector2& p_range) { + + shape_from=p_range.x; + shape_to=p_range.y; +} + +Vector2 CollisionPolygon::_get_shape_range() const { + + return Vector2(shape_from,shape_to); +} + void CollisionPolygon::_notification(int p_what) { switch(p_what) { + case NOTIFICATION_ENTER_TREE: { + can_update_body=get_tree()->is_editor_hint(); + set_notify_local_transform(!can_update_body); + + //indicator_instance = VisualServer::get_singleton()->instance_create2(indicator,get_world()->get_scenario()); + } break; + case NOTIFICATION_EXIT_TREE: { + can_update_body=false; + set_notify_local_transform(false); + } break; case NOTIFICATION_TRANSFORM_CHANGED: { if (!is_inside_tree()) break; - _update_parent(); + if (can_update_body) { + _update_parent(); + } + + } break; + case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { + if (!can_update_body && shape_from>=0 && shape_from>=0) { + + CollisionObject *co = get_parent()->cast_to<CollisionObject>(); + if (co) { + for(int i=shape_from;i<=shape_to;i++) { + co->set_shape_transform(i,get_transform()); + } + } + } } break; #if 0 @@ -119,29 +165,31 @@ void CollisionPolygon::_notification(int p_what) { void CollisionPolygon::set_polygon(const Vector<Point2>& p_polygon) { polygon=p_polygon; + if (can_update_body) { - for(int i=0;i<polygon.size();i++) { + for(int i=0;i<polygon.size();i++) { - Vector3 p1(polygon[i].x,polygon[i].y,depth*0.5); + Vector3 p1(polygon[i].x,polygon[i].y,depth*0.5); - if (i==0) - aabb=AABB(p1,Vector3()); - else - aabb.expand_to(p1); + if (i==0) + aabb=AABB(p1,Vector3()); + else + aabb.expand_to(p1); - Vector3 p2(polygon[i].x,polygon[i].y,-depth*0.5); - aabb.expand_to(p2); + Vector3 p2(polygon[i].x,polygon[i].y,-depth*0.5); + aabb.expand_to(p2); - } - if (aabb==AABB()) { + } + if (aabb==AABB()) { - aabb=AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); - } else { - aabb.pos-=aabb.size*0.3; - aabb.size+=aabb.size*0.6; + aabb=AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); + } else { + aabb.pos-=aabb.size*0.3; + aabb.size+=aabb.size*0.6; + } + _update_parent(); } - _update_parent(); update_gizmo(); } @@ -154,6 +202,8 @@ void CollisionPolygon::set_build_mode(BuildMode p_mode) { ERR_FAIL_INDEX(p_mode,2); build_mode=p_mode; + if (!can_update_body) + return; _update_parent(); } @@ -170,6 +220,8 @@ AABB CollisionPolygon::get_item_rect() const { void CollisionPolygon::set_depth(float p_depth) { depth=p_depth; + if (!can_update_body) + return; _update_parent(); update_gizmo(); } @@ -183,22 +235,34 @@ float CollisionPolygon::get_depth() const { void CollisionPolygon::_bind_methods() { ObjectTypeDB::bind_method(_MD("_add_to_collision_object"),&CollisionPolygon::_add_to_collision_object); - ObjectTypeDB::bind_method(_MD("set_polygon","polygon"),&CollisionPolygon::set_polygon); - ObjectTypeDB::bind_method(_MD("get_polygon"),&CollisionPolygon::get_polygon); + + ObjectTypeDB::bind_method(_MD("set_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); ObjectTypeDB::bind_method(_MD("get_depth"),&CollisionPolygon::get_depth); - ObjectTypeDB::bind_method(_MD("set_build_mode"),&CollisionPolygon::set_build_mode); - ObjectTypeDB::bind_method(_MD("get_build_mode"),&CollisionPolygon::get_build_mode); + ObjectTypeDB::bind_method(_MD("set_polygon","polygon"),&CollisionPolygon::set_polygon); + ObjectTypeDB::bind_method(_MD("get_polygon"),&CollisionPolygon::get_polygon); + + ObjectTypeDB::bind_method(_MD("_set_shape_range","shape_range"),&CollisionPolygon::_set_shape_range); + ObjectTypeDB::bind_method(_MD("_get_shape_range"),&CollisionPolygon::_get_shape_range); + + ObjectTypeDB::bind_method(_MD("get_collision_object_first_shape"),&CollisionPolygon::get_collision_object_first_shape); + ObjectTypeDB::bind_method(_MD("get_collision_object_last_shape"),&CollisionPolygon::get_collision_object_last_shape); ADD_PROPERTY( PropertyInfo(Variant::INT,"build_mode",PROPERTY_HINT_ENUM,"Solids,Triangles"),_SCS("set_build_mode"),_SCS("get_build_mode")); - ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"depth"),_SCS("set_depth"),_SCS("get_depth")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon")); + ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"shape_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_shape_range"),_SCS("_get_shape_range")); } CollisionPolygon::CollisionPolygon() { + shape_from=-1; + shape_to=-1; + can_update_body=false; + aabb=AABB(Vector3(-1,-1,-1),Vector3(2,2,2)); build_mode=BUILD_SOLIDS; depth=1.0; diff --git a/scene/3d/collision_polygon.h b/scene/3d/collision_polygon.h index efb3666778..9b9afea34f 100644 --- a/scene/3d/collision_polygon.h +++ b/scene/3d/collision_polygon.h @@ -24,9 +24,17 @@ protected: BuildMode build_mode; Vector<Point2> polygon; + void _add_to_collision_object(Object *p_obj); void _update_parent(); + bool can_update_body; + int shape_from; + int shape_to; + + void _set_shape_range(const Vector2& p_range); + Vector2 _get_shape_range() const; + protected: void _notification(int p_what); @@ -43,6 +51,10 @@ public: Vector<Point2> get_polygon() const; virtual AABB get_item_rect() const; + + int get_collision_object_first_shape() const { return shape_from; } + int get_collision_object_last_shape() const { return shape_to; } + CollisionPolygon(); }; diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp index 8c52d4c35c..a238a8ff22 100644 --- a/scene/3d/navigation_mesh.cpp +++ b/scene/3d/navigation_mesh.cpp @@ -1,6 +1,6 @@ #include "navigation_mesh.h" #include "navigation.h" - +#include "mesh_instance.h" void NavigationMesh::create_from_mesh(const Ref<Mesh>& p_mesh) { @@ -87,6 +87,97 @@ void NavigationMesh::clear_polygons(){ polygons.clear(); } +Ref<Mesh> NavigationMesh::get_debug_mesh() { + + if (debug_mesh.is_valid()) + return debug_mesh; + + + + DVector<Vector3> vertices = get_vertices(); + DVector<Vector3>::Read vr=vertices.read(); + List<Face3> faces; + for(int i=0;i<get_polygon_count();i++) { + Vector<int> p = get_polygon(i); + + for(int j=2;j<p.size();j++) { + Face3 f; + f.vertex[0]=vr[p[0]]; + f.vertex[1]=vr[p[j-1]]; + f.vertex[2]=vr[p[j]]; + + faces.push_back(f); + } + } + + + Map<_EdgeKey,bool> edge_map; + DVector<Vector3> tmeshfaces; + tmeshfaces.resize(faces.size()*3); + + { + DVector<Vector3>::Write tw=tmeshfaces.write(); + int tidx=0; + + + for(List<Face3>::Element *E=faces.front();E;E=E->next()) { + + const Face3 &f = E->get(); + + for(int j=0;j<3;j++) { + + tw[tidx++]=f.vertex[j]; + _EdgeKey ek; + ek.from=f.vertex[j].snapped(CMP_EPSILON); + ek.to=f.vertex[(j+1)%3].snapped(CMP_EPSILON); + if (ek.from<ek.to) + SWAP(ek.from,ek.to); + + Map<_EdgeKey,bool>::Element *E=edge_map.find(ek); + + if (E) { + + E->get()=false; + + } else { + + edge_map[ek]=true; + } + + } + } + } + List<Vector3> lines; + + for(Map<_EdgeKey,bool>::Element *E=edge_map.front();E;E=E->next()) { + + if (E->get()) { + lines.push_back(E->key().from); + lines.push_back(E->key().to); + } + } + + DVector<Vector3> varr; + varr.resize(lines.size()); + { + DVector<Vector3>::Write w = varr.write(); + int idx=0; + for(List<Vector3>::Element *E=lines.front();E;E=E->next()) { + w[idx++]=E->get(); + } + } + + debug_mesh = Ref<Mesh>( memnew( Mesh ) ); + + Array arr; + arr.resize(Mesh::ARRAY_MAX); + arr[Mesh::ARRAY_VERTEX]=varr; + + debug_mesh->add_surface(Mesh::PRIMITIVE_LINES,arr); + + return debug_mesh; +} + void NavigationMesh::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_vertices","vertices"),&NavigationMesh::set_vertices); @@ -135,6 +226,16 @@ void NavigationMeshInstance::set_enabled(bool p_enabled) { } + if (debug_view) { + MeshInstance *dm=debug_view->cast_to<MeshInstance>(); + if (is_enabled()) { + dm->set_material_override( get_tree()->get_debug_navigation_material() ); + } else { + dm->set_material_override( get_tree()->get_debug_navigation_disabled_material() ); + } + + } + update_gizmo(); } @@ -170,6 +271,19 @@ void NavigationMeshInstance::_notification(int p_what) { c=c->get_parent_spatial(); } + if (navmesh.is_valid() && get_tree()->is_debugging_navigation_hint()) { + + MeshInstance *dm = memnew( MeshInstance ); + dm->set_mesh( navmesh->get_debug_mesh() ); + if (is_enabled()) { + dm->set_material_override( get_tree()->get_debug_navigation_material() ); + } else { + dm->set_material_override( get_tree()->get_debug_navigation_disabled_material() ); + } + add_child(dm); + debug_view=dm; + } + } break; case NOTIFICATION_TRANSFORM_CHANGED: { @@ -177,6 +291,8 @@ void NavigationMeshInstance::_notification(int p_what) { navigation->navmesh_set_transform(nav_id,get_relative_transform(navigation)); } + + } break; case NOTIFICATION_EXIT_TREE: { @@ -187,6 +303,11 @@ void NavigationMeshInstance::_notification(int p_what) { nav_id=-1; } } + + if (debug_view) { + debug_view->queue_delete(); + debug_view=NULL; + } navigation=NULL; } break; } @@ -230,6 +351,7 @@ void NavigationMeshInstance::_bind_methods() { NavigationMeshInstance::NavigationMeshInstance() { + debug_view=NULL; navigation=NULL; nav_id=-1; enabled=true; diff --git a/scene/3d/navigation_mesh.h b/scene/3d/navigation_mesh.h index fccf405f9d..1e53b2127a 100644 --- a/scene/3d/navigation_mesh.h +++ b/scene/3d/navigation_mesh.h @@ -4,6 +4,7 @@ #include "scene/3d/spatial.h" #include "scene/resources/mesh.h" +class Mesh; class NavigationMesh : public Resource { @@ -14,6 +15,16 @@ class NavigationMesh : public Resource { Vector<int> indices; }; Vector<Polygon> polygons; + Ref<Mesh> debug_mesh; + + struct _EdgeKey { + + Vector3 from; + Vector3 to; + + bool operator<(const _EdgeKey& p_with) const { return from==p_with.from ? to < p_with.to : from < p_with.from; } + }; + protected: @@ -21,6 +32,7 @@ protected: void _set_polygons(const Array& p_array); Array _get_polygons() const; + public: void create_from_mesh(const Ref<Mesh>& p_mesh); @@ -33,6 +45,8 @@ public: Vector<int> get_polygon(int p_idx); void clear_polygons(); + Ref<Mesh> get_debug_mesh(); + NavigationMesh(); }; @@ -47,6 +61,9 @@ class NavigationMeshInstance : public Spatial { int nav_id; Navigation *navigation; Ref<NavigationMesh> navmesh; + + Node *debug_view; + protected: void _notification(int p_what); diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index 9df29f70ec..4712ba308a 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -187,30 +187,59 @@ void Skeleton::_notification(int p_what) { Bone &b=bonesptr[i]; - if (b.enabled) { + if (b.disable_rest) { + if (b.enabled) { - Transform pose=b.pose; - if (b.custom_pose_enable) { + Transform pose=b.pose; + if (b.custom_pose_enable) { - pose = b.custom_pose * pose; - } + pose = b.custom_pose * pose; + } + + if (b.parent>=0) { + + b.pose_global=bonesptr[b.parent].pose_global * pose; + } else { - if (b.parent>=0) { - - b.pose_global=bonesptr[b.parent].pose_global * (b.rest * pose); + b.pose_global=pose; + } } else { - - b.pose_global=b.rest * pose; + + if (b.parent>=0) { + + b.pose_global=bonesptr[b.parent].pose_global; + } else { + + b.pose_global=Transform(); + } } + } else { - - if (b.parent>=0) { - - b.pose_global=bonesptr[b.parent].pose_global * b.rest; + if (b.enabled) { + + Transform pose=b.pose; + if (b.custom_pose_enable) { + + pose = b.custom_pose * pose; + } + + if (b.parent>=0) { + + b.pose_global=bonesptr[b.parent].pose_global * (b.rest * pose); + } else { + + b.pose_global=b.rest * pose; + } } else { - - b.pose_global=b.rest; - } + + if (b.parent>=0) { + + b.pose_global=bonesptr[b.parent].pose_global * b.rest; + } else { + + b.pose_global=b.rest; + } + } } vs->skeleton_bone_set_transform( skeleton, i, b.pose_global * b.rest_global_inverse ); @@ -315,6 +344,37 @@ void Skeleton::set_bone_parent(int p_bone, int p_parent) { _make_dirty(); } +void Skeleton::unparent_bone_and_rest(int p_bone) { + + ERR_FAIL_INDEX( p_bone, bones.size() ); + + int parent=bones[p_bone].parent; + while(parent>=0) { + bones[p_bone].rest = bones[parent].rest * bones[p_bone].rest; + parent=bones[parent].parent; + } + + bones[p_bone].parent=-1; + bones[p_bone].rest_global_inverse=bones[p_bone].rest.affine_inverse(); //same thing + + _make_dirty(); + +} + +void Skeleton::set_bone_disable_rest(int p_bone, bool p_disable) { + + ERR_FAIL_INDEX( p_bone, bones.size() ); + bones[p_bone].disable_rest=p_disable; + +} + +bool Skeleton::is_bone_rest_disabled(int p_bone) const { + + ERR_FAIL_INDEX_V( p_bone, bones.size(), false ); + return bones[p_bone].disable_rest; +} + + int Skeleton::get_bone_parent(int p_bone) const { ERR_FAIL_INDEX_V( p_bone, bones.size(), -1 ); @@ -522,9 +582,14 @@ void Skeleton::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_bone_count"),&Skeleton::get_bone_count); + ObjectTypeDB::bind_method(_MD("unparent_bone_and_rest","bone_idx"),&Skeleton::unparent_bone_and_rest); + ObjectTypeDB::bind_method(_MD("get_bone_rest","bone_idx"),&Skeleton::get_bone_rest); ObjectTypeDB::bind_method(_MD("set_bone_rest","bone_idx","rest"),&Skeleton::set_bone_rest); + ObjectTypeDB::bind_method(_MD("set_bone_disable_rest","bone_idx","disable"),&Skeleton::set_bone_disable_rest); + ObjectTypeDB::bind_method(_MD("is_bone_rest_disabled","bone_idx"),&Skeleton::is_bone_rest_disabled); + ObjectTypeDB::bind_method(_MD("bind_child_node_to_bone","bone_idx","node:Node"),&Skeleton::bind_child_node_to_bone); ObjectTypeDB::bind_method(_MD("unbind_child_node_from_bone","bone_idx","node:Node"),&Skeleton::unbind_child_node_from_bone); ObjectTypeDB::bind_method(_MD("get_bound_child_nodes_to_bone","bone_idx"),&Skeleton::_get_bound_child_nodes_to_bone); diff --git a/scene/3d/skeleton.h b/scene/3d/skeleton.h index b7f84f44c9..6678722d12 100644 --- a/scene/3d/skeleton.h +++ b/scene/3d/skeleton.h @@ -46,6 +46,7 @@ class Skeleton : public Spatial { bool enabled; int parent; + bool disable_rest; Transform rest; Transform rest_global_inverse; @@ -57,7 +58,7 @@ class Skeleton : public Spatial { List<uint32_t> nodes_bound; - Bone() { parent=-1; enabled=true; custom_pose_enable=false; } + Bone() { parent=-1; enabled=true; custom_pose_enable=false; disable_rest=false; } }; bool rest_global_inverse_dirty; @@ -111,6 +112,11 @@ public: void set_bone_parent(int p_bone, int p_parent); int get_bone_parent(int p_bone) const; + void unparent_bone_and_rest(int p_idx); + + void set_bone_disable_rest(int p_bone, bool p_disable); + bool is_bone_rest_disabled(int p_bone) const; + int get_bone_count() const; void set_bone_rest(int p_bone, const Transform& p_rest); diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index 7117c59176..a65f68ed2c 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -231,6 +231,11 @@ void Spatial::set_transform(const Transform& p_transform) { _change_notify("transform/rotation"); _change_notify("transform/scale"); _propagate_transform_changed(this); + if (data.notify_local_transform) { + notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); + } + + } @@ -335,6 +340,9 @@ void Spatial::set_translation(const Vector3& p_translation) { data.local_transform.origin=p_translation; _propagate_transform_changed(this); + if (data.notify_local_transform) { + notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); + } } @@ -348,6 +356,9 @@ void Spatial::set_rotation(const Vector3& p_euler){ data.rotation=p_euler; data.dirty|=DIRTY_LOCAL; _propagate_transform_changed(this); + if (data.notify_local_transform) { + notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); + } } void Spatial::set_scale(const Vector3& p_scale){ @@ -360,6 +371,9 @@ void Spatial::set_scale(const Vector3& p_scale){ data.scale=p_scale; data.dirty|=DIRTY_LOCAL; _propagate_transform_changed(this); + if (data.notify_local_transform) { + notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); + } } @@ -685,6 +699,13 @@ void Spatial::look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, con } +void Spatial::set_notify_local_transform(bool p_enable) { + data.notify_local_transform=p_enable; +} + +bool Spatial::is_local_transform_notification_enabled() const { + return data.notify_local_transform; +} void Spatial::_bind_methods() { @@ -725,6 +746,9 @@ void Spatial::_bind_methods() { ObjectTypeDB::bind_method(_MD("_set_visible_"), &Spatial::_set_visible_); ObjectTypeDB::bind_method(_MD("_is_visible_"), &Spatial::_is_visible_); + ObjectTypeDB::bind_method(_MD("set_notify_local_transform","enable"), &Spatial::set_notify_local_transform); + ObjectTypeDB::bind_method(_MD("is_local_transform_notification_enabled"), &Spatial::is_local_transform_notification_enabled); + void rotate(const Vector3& p_normal,float p_radians); void rotate_x(float p_radians); void rotate_y(float p_radians); @@ -783,6 +807,7 @@ Spatial::Spatial() : xform_change(this) data.gizmo_disabled=false; data.gizmo_dirty=false; #endif + data.notify_local_transform=false; data.parent=NULL; data.C=NULL; diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h index 8b40786fb8..7fa6099d7a 100644 --- a/scene/3d/spatial.h +++ b/scene/3d/spatial.h @@ -91,6 +91,7 @@ class Spatial : public Node { List<Spatial*>::Element *C; bool ignore_notification; + bool notify_local_transform; bool visible; @@ -134,6 +135,7 @@ public: NOTIFICATION_ENTER_WORLD=41, NOTIFICATION_EXIT_WORLD=42, NOTIFICATION_VISIBILITY_CHANGED=43, + NOTIFICATION_LOCAL_TRANSFORM_CHANGED=44, }; Spatial *get_parent_spatial() const; @@ -179,6 +181,9 @@ public: void look_at(const Vector3& p_target, const Vector3& p_up_normal); void look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal); + void set_notify_local_transform(bool p_enable); + bool is_local_transform_notification_enabled() const; + void orthonormalize(); void set_identity(); diff --git a/scene/3d/spatial_stream_player.cpp b/scene/3d/spatial_stream_player.cpp index b81d98e8bf..346e354df2 100644 --- a/scene/3d/spatial_stream_player.cpp +++ b/scene/3d/spatial_stream_player.cpp @@ -331,7 +331,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); + ObjectTypeDB::bind_method(_MD("play"),&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/sample_player.cpp b/scene/audio/sample_player.cpp index b93f7e7ddd..7c0a926324 100644 --- a/scene/audio/sample_player.cpp +++ b/scene/audio/sample_player.cpp @@ -48,8 +48,8 @@ bool SamplePlayer::_set(const StringName& p_name, const Variant& p_value) { } } else if (name=="config/samples") set_sample_library(p_value); - else if (name=="config/voices") - set_voice_count(p_value); + else if (name=="config/polyphony") + set_polyphony(p_value); else if (name.begins_with("default/")) { String what=name.right(8); @@ -95,14 +95,14 @@ bool SamplePlayer::_get(const StringName& p_name,Variant &r_ret) const { if (name=="play/play") { r_ret=played_back; - } else if (name=="config/voices") { - r_ret= get_voice_count(); + } else if (name=="config/polyphony") { + r_ret= get_polyphony(); } else if (name=="config/samples") { r_ret= get_sample_library(); } else if (name.begins_with("default/")) { - String what=name.get_slicec('/',1); + String what=name.right(8); if (what=="volume_db") r_ret= get_default_volume_db(); @@ -153,7 +153,7 @@ void SamplePlayer::_get_property_list(List<PropertyInfo> *p_list) const { } p_list->push_back( PropertyInfo( Variant::STRING, "play/play", PROPERTY_HINT_ENUM, en,PROPERTY_USAGE_EDITOR)); - p_list->push_back( PropertyInfo( Variant::INT, "config/voices", PROPERTY_HINT_RANGE, "1,256,1")); + p_list->push_back( PropertyInfo( Variant::INT, "config/polyphony", PROPERTY_HINT_RANGE, "1,256,1")); p_list->push_back( PropertyInfo( Variant::OBJECT, "config/samples", PROPERTY_HINT_RESOURCE_TYPE, "SampleLibrary")); p_list->push_back( PropertyInfo( Variant::REAL, "default/volume_db", PROPERTY_HINT_RANGE, "-80,24,0.01")); p_list->push_back( PropertyInfo( Variant::REAL, "default/pitch_scale", PROPERTY_HINT_RANGE, "0.01,48,0.01")); @@ -164,7 +164,7 @@ void SamplePlayer::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back( PropertyInfo( Variant::REAL, "default/filter/cutoff", PROPERTY_HINT_RANGE, "20,16384.0,0.01")); p_list->push_back( PropertyInfo( Variant::REAL, "default/filter/resonance", PROPERTY_HINT_RANGE, "0,4,0.01")); p_list->push_back( PropertyInfo( Variant::REAL, "default/filter/gain", PROPERTY_HINT_RANGE, "0,2,0.01")); - p_list->push_back( PropertyInfo( Variant::INT, "default/reverb_room", PROPERTY_HINT_ENUM, "Small,Medimum,Large,Hall")); + p_list->push_back( PropertyInfo( Variant::INT, "default/reverb_room", PROPERTY_HINT_ENUM, "Small,Medium,Large,Hall")); p_list->push_back( PropertyInfo( Variant::REAL, "default/reverb_send", PROPERTY_HINT_RANGE, "0,1,0.01")); p_list->push_back( PropertyInfo( Variant::REAL, "default/chorus_send", PROPERTY_HINT_RANGE, "0,1,0.01")); @@ -203,14 +203,14 @@ SamplePlayer::Voice::~Voice() { } -void SamplePlayer::set_voice_count(int p_voice_count) { +void SamplePlayer::set_polyphony(int p_voice_count) { ERR_FAIL_COND( p_voice_count <1 || p_voice_count >0xFFFE ); voices.resize(p_voice_count); } -int SamplePlayer::get_voice_count() const { +int SamplePlayer::get_polyphony() const { return voices.size(); } @@ -460,9 +460,9 @@ float SamplePlayer::get_chorus(VoiceID p_voice) const { return v.chorus_send; } -float SamplePlayer::get_reverb_room(VoiceID p_voice) const { +SamplePlayer::ReverbRoomType SamplePlayer::get_reverb_room(VoiceID p_voice) const { - _GET_VOICE_V(0); + _GET_VOICE_V(REVERB_SMALL); return v.reverb_room; } @@ -591,7 +591,7 @@ float SamplePlayer::get_default_chorus() const { return _default.chorus_send; } -float SamplePlayer::get_default_reverb_room() const { +SamplePlayer::ReverbRoomType SamplePlayer::get_default_reverb_room() const { return _default.reverb_room; } @@ -606,8 +606,8 @@ void SamplePlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_sample_library","library:SampleLibrary"),&SamplePlayer::set_sample_library ); ObjectTypeDB::bind_method(_MD("get_sample_library:SampleLibrary"),&SamplePlayer::get_sample_library ); - ObjectTypeDB::bind_method(_MD("set_voice_count","max_voices"),&SamplePlayer::set_voice_count ); - ObjectTypeDB::bind_method(_MD("get_voice_count"),&SamplePlayer::get_voice_count ); + ObjectTypeDB::bind_method(_MD("set_polyphony","max_voices"),&SamplePlayer::set_polyphony ); + ObjectTypeDB::bind_method(_MD("get_polyphony"),&SamplePlayer::get_polyphony ); ObjectTypeDB::bind_method(_MD("play","name","unique"),&SamplePlayer::play, DEFVAL(false) ); ObjectTypeDB::bind_method(_MD("stop","voice"),&SamplePlayer::stop ); @@ -615,8 +615,8 @@ void SamplePlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_mix_rate","voice","hz"),&SamplePlayer::set_mix_rate ); ObjectTypeDB::bind_method(_MD("set_pitch_scale","voice","ratio"),&SamplePlayer::set_pitch_scale ); - ObjectTypeDB::bind_method(_MD("set_volume","voice","nrg"),&SamplePlayer::set_volume ); - ObjectTypeDB::bind_method(_MD("set_volume_db","voice","nrg"),&SamplePlayer::set_volume_db ); + ObjectTypeDB::bind_method(_MD("set_volume","voice","volume"),&SamplePlayer::set_volume ); + ObjectTypeDB::bind_method(_MD("set_volume_db","voice","db"),&SamplePlayer::set_volume_db ); ObjectTypeDB::bind_method(_MD("set_pan","voice","pan","depth","height"),&SamplePlayer::set_pan,DEFVAL(0),DEFVAL(0) ); ObjectTypeDB::bind_method(_MD("set_filter","voice","type","cutoff_hz","resonance","gain"),&SamplePlayer::set_filter,DEFVAL(0) ); ObjectTypeDB::bind_method(_MD("set_chorus","voice","send"),&SamplePlayer::set_chorus ); @@ -638,8 +638,8 @@ void SamplePlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_reverb","voice"),&SamplePlayer::get_reverb ); ObjectTypeDB::bind_method(_MD("set_default_pitch_scale","ratio"),&SamplePlayer::set_default_pitch_scale ); - ObjectTypeDB::bind_method(_MD("set_default_volume","nrg"),&SamplePlayer::set_default_volume ); - ObjectTypeDB::bind_method(_MD("set_default_volume_db","db"),&SamplePlayer::set_default_volume ); + ObjectTypeDB::bind_method(_MD("set_default_volume","volume"),&SamplePlayer::set_default_volume ); + ObjectTypeDB::bind_method(_MD("set_default_volume_db","db"),&SamplePlayer::set_default_volume_db ); ObjectTypeDB::bind_method(_MD("set_default_pan","pan","depth","height"),&SamplePlayer::set_default_pan,DEFVAL(0),DEFVAL(0) ); ObjectTypeDB::bind_method(_MD("set_default_filter","type","cutoff_hz","resonance","gain"),&SamplePlayer::set_default_filter,DEFVAL(0) ); ObjectTypeDB::bind_method(_MD("set_default_chorus","send"),&SamplePlayer::set_default_chorus ); @@ -647,7 +647,7 @@ void SamplePlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_default_pitch_scale"),&SamplePlayer::get_default_pitch_scale ); ObjectTypeDB::bind_method(_MD("get_default_volume"),&SamplePlayer::get_default_volume ); - ObjectTypeDB::bind_method(_MD("get_default_volume_db"),&SamplePlayer::get_default_volume ); + ObjectTypeDB::bind_method(_MD("get_default_volume_db"),&SamplePlayer::get_default_volume_db ); ObjectTypeDB::bind_method(_MD("get_default_pan"),&SamplePlayer::get_default_pan ); ObjectTypeDB::bind_method(_MD("get_default_pan_depth"),&SamplePlayer::get_default_pan_depth ); ObjectTypeDB::bind_method(_MD("get_default_pan_height"),&SamplePlayer::get_default_pan_height ); @@ -677,6 +677,8 @@ void SamplePlayer::_bind_methods() { BIND_CONSTANT( REVERB_LARGE ); BIND_CONSTANT( REVERB_HALL ); + BIND_CONSTANT( INVALID_VOICE_ID ); + } diff --git a/scene/audio/sample_player.h b/scene/audio/sample_player.h index 53e085b8d8..75a01aff86 100644 --- a/scene/audio/sample_player.h +++ b/scene/audio/sample_player.h @@ -130,8 +130,8 @@ public: void set_sample_library(const Ref<SampleLibrary>& p_library); Ref<SampleLibrary> get_sample_library() const; - void set_voice_count(int p_voice_count); - int get_voice_count() const; + void set_polyphony(int p_voice_count); + int get_polyphony() const; VoiceID play(const String& p_name,bool unique=false); void stop(VoiceID p_voice); @@ -161,7 +161,7 @@ public: float get_filter_resonance(VoiceID p_voice) const; float get_filter_gain(VoiceID p_voice) const; float get_chorus(VoiceID p_voice) const; - float get_reverb_room(VoiceID p_voice) const; + ReverbRoomType get_reverb_room(VoiceID p_voice) const; float get_reverb(VoiceID p_voice) const; @@ -185,7 +185,7 @@ public: float get_default_filter_resonance() const; float get_default_filter_gain() const; float get_default_chorus() const; - float get_default_reverb_room() const; + ReverbRoomType get_default_reverb_room() const; float get_default_reverb() const; SamplePlayer(); diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp index 699d068287..c4e1ccc9b6 100644 --- a/scene/audio/stream_player.cpp +++ b/scene/audio/stream_player.cpp @@ -325,7 +325,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); + ObjectTypeDB::bind_method(_MD("play"),&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/base_button.cpp b/scene/gui/base_button.cpp index 965e7f399d..0c63a3bc74 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -255,6 +255,16 @@ void BaseButton::_notification(int p_what) { group->_remove_button(this); } + if (p_what==NOTIFICATION_VISIBILITY_CHANGED && !is_visible()) { + + if (!toggle_mode) { + status.pressed = false; + } + status.hovering = false; + status.press_attempt = false; + status.pressing_inside = false; + status.pressing_button = 0; + } } void BaseButton::pressed() { diff --git a/scene/gui/box_container.cpp b/scene/gui/box_container.cpp index 6489cbccd5..b63b3de530 100644 --- a/scene/gui/box_container.cpp +++ b/scene/gui/box_container.cpp @@ -99,8 +99,10 @@ void BoxContainer::_resort() { elements exist */ + bool has_stretched = false; while(stretch_ratio_total>0) { // first of all, dont even be here if no stretchable objects exist + has_stretched = true; bool refit_successful=true; //assume refit-test will go well for(int i=0;i<get_child_count();i++) { @@ -143,6 +145,18 @@ void BoxContainer::_resort() { int ofs=0; + if (!has_stretched) { + switch (align) { + case ALIGN_BEGIN: + break; + case ALIGN_CENTER: + ofs = stretch_diff / 2; + break; + case ALIGN_END: + ofs = stretch_diff; + break; + } + } first=true; int idx=0; @@ -254,6 +268,15 @@ void BoxContainer::_notification(int p_what) { } } +void BoxContainer::set_alignment(AlignMode p_align) { + align = p_align; + _resort(); +} + +BoxContainer::AlignMode BoxContainer::get_alignment() const { + return align; +} + void BoxContainer::add_spacer(bool p_begin) { Control *c = memnew( Control ); @@ -270,10 +293,23 @@ void BoxContainer::add_spacer(bool p_begin) { BoxContainer::BoxContainer(bool p_vertical) { vertical=p_vertical; + align = ALIGN_BEGIN; // set_ignore_mouse(true); set_stop_mouse(false); } +void BoxContainer::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("get_alignment"),&BoxContainer::get_alignment); + ObjectTypeDB::bind_method(_MD("set_alignment","alignment"),&BoxContainer::set_alignment); + + BIND_CONSTANT( ALIGN_BEGIN ); + BIND_CONSTANT( ALIGN_CENTER ); + BIND_CONSTANT( ALIGN_END ); + + ADD_PROPERTY( PropertyInfo(Variant::INT,"alignment", PROPERTY_HINT_ENUM, "Begin,Center,End"), _SCS("set_alignment"),_SCS("get_alignment") ); + +} MarginContainer* VBoxContainer::add_margin_child(const String& p_label,Control *p_control,bool p_expand) { diff --git a/scene/gui/box_container.h b/scene/gui/box_container.h index d461b4aebe..c357814baf 100644 --- a/scene/gui/box_container.h +++ b/scene/gui/box_container.h @@ -35,16 +35,31 @@ class BoxContainer : public Container { OBJ_TYPE(BoxContainer,Container); +public: + + enum AlignMode { + ALIGN_BEGIN, + ALIGN_CENTER, + ALIGN_END + }; + +private: bool vertical; + AlignMode align; void _resort(); protected: void _notification(int p_what); + + static void _bind_methods(); public: void add_spacer(bool p_begin=false); + void set_alignment(AlignMode p_align); + AlignMode get_alignment() const; + virtual Size2 get_minimum_size() const; BoxContainer(bool p_vertical=false); @@ -73,4 +88,6 @@ public: VBoxContainer() : BoxContainer(true) {} }; +VARIANT_ENUM_CAST(BoxContainer::AlignMode); + #endif // BOX_CONTAINER_H diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index b7b2f061ea..40fade840c 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1025,7 +1025,7 @@ void ItemList::_bind_methods(){ ObjectTypeDB::bind_method(_MD("get_item_text","idx"),&ItemList::get_item_text); ObjectTypeDB::bind_method(_MD("set_item_icon","idx","icon:Texture"),&ItemList::set_item_icon); - ObjectTypeDB::bind_method(_MD("get_item_icon:Tedture","idx"),&ItemList::get_item_icon); + ObjectTypeDB::bind_method(_MD("get_item_icon:Texture","idx"),&ItemList::get_item_icon); ObjectTypeDB::bind_method(_MD("set_item_selectable","idx","selectable"),&ItemList::set_item_selectable); ObjectTypeDB::bind_method(_MD("is_item_selectable","idx"),&ItemList::is_item_selectable); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index e7af4fa349..002e49cbcf 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -33,15 +33,15 @@ void Label::set_autowrap(bool p_autowrap) { - + autowrap=p_autowrap; word_cache_dirty=true; minimum_size_changed(); - - + update(); + } bool Label::has_autowrap() const { - + return autowrap; } @@ -51,6 +51,7 @@ void Label::set_uppercase(bool p_uppercase) { uppercase=p_uppercase; word_cache_dirty=true; minimum_size_changed(); + update(); } bool Label::is_uppercase() const { @@ -66,19 +67,18 @@ int Label::get_line_height() const { void Label::_notification(int p_what) { - + if (p_what==NOTIFICATION_DRAW) { - - if (clip && !autowrap) - VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(),true); + if (clip || autowrap) + VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(),true); if (word_cache_dirty) regenerate_word_cache(); - + RID ci = get_canvas_item(); - + Size2 string_size; Size2 size=get_size(); @@ -91,38 +91,43 @@ void Label::_notification(int p_what) { VisualServer::get_singleton()->canvas_item_set_distance_field_mode(get_canvas_item(),font.is_valid() && font->is_distance_field_hint()); int font_h = font->get_height(); - int line_from=(int)get_val(); // + p_exposed.pos.y / font_h; int lines_visible = size.y/font_h; - int line_to=(int)get_val() + lines_visible; //p_exposed.pos.y+p_exposed.size.height / font_h; int space_w=font->get_char_size(' ').width; - int lines_total = get_max(); int chars_total=0; int vbegin=0,vsep=0; - - if (lines_total && lines_total < lines_visible) { + if (lines_visible > line_count) { + lines_visible = line_count; + + } + + if (max_lines_visible >= 0 && lines_visible > max_lines_visible) { + lines_visible = max_lines_visible; + + } + + if (lines_visible > 0) { switch(valign) { case VALIGN_TOP: { - //nothing } break; case VALIGN_CENTER: { - - vbegin=(lines_visible-lines_total) * font_h / 2; + vbegin=(size.y - lines_visible * font_h) / 2; vsep=0; + } break; case VALIGN_BOTTOM: { - vbegin=(lines_visible-lines_total) * font_h; + vbegin=size.y - lines_visible * font_h; vsep=0; } break; case VALIGN_FILL: { vbegin=0; - if (lines_total>1) { - vsep=(lines_visible-lines_total) * font_h / (lines_total-1); + if (lines_visible>1) { + vsep=(size.y - lines_visible * font_h) / (lines_visible - 1); } else { vsep=0; } @@ -130,20 +135,21 @@ void Label::_notification(int p_what) { } break; } } - - + + WordCache *wc = word_cache; if (!wc) return; - + int c = 0; int line=0; + int line_to=lines_skipped + (lines_visible>0?lines_visible:1); while(wc) { /* handle lines not meant to be drawn quickly */ - if (line>line_to) + if (line>=line_to) break; - if (line<line_from) { - + if (line<lines_skipped) { + while (wc && wc->char_pos>=0) wc=wc->next; if (wc) @@ -151,36 +157,36 @@ void Label::_notification(int p_what) { line++; continue; } - + /* handle lines normally */ - + if (wc->char_pos<0) { //empty line wc=wc->next; line++; continue; } - + WordCache *from=wc; WordCache *to=wc; - + int taken=0; int spaces=0; while(to && to->char_pos>=0) { - + taken+=to->pixel_width; if (to!=from && to->space_count) { spaces+=to->space_count; } to=to->next; } - + bool can_fill = to && to->char_pos==WordCache::CHAR_WRAPLINE; float x_ofs=0; - + switch (align) { - + case ALIGN_FILL: case ALIGN_LEFT: { @@ -198,16 +204,16 @@ void Label::_notification(int p_what) { } break; } - - int y_ofs=(line-(int)get_val())*font_h + font->get_ascent(); + + int y_ofs=(line-lines_skipped)*font_h + font->get_ascent(); y_ofs+=vbegin + line*vsep; - + while(from!=to) { - + // draw a word int pos = from->char_pos; if (from->char_pos<0) { - + ERR_PRINT("BUG"); return; } @@ -221,15 +227,15 @@ void Label::_notification(int p_what) { } - - - + + + if (font_color_shadow.a>0) { - + int chars_total_shadow = chars_total; //save chars drawn float x_ofs_shadow=x_ofs; for (int i=0;i<from->word_len;i++) { - + if (visible_chars < 0 || chars_total_shadow<visible_chars) { CharType c = text[i+pos]; CharType n = text[i+pos+1]; @@ -249,7 +255,7 @@ void Label::_notification(int p_what) { } } - + } for (int i=0;i<from->word_len;i++) { @@ -268,73 +274,73 @@ void Label::_notification(int p_what) { } from=from->next; } - + wc=to?to->next:0; line++; - - } + + } } - + if (p_what==NOTIFICATION_THEME_CHANGED) { word_cache_dirty=true; update(); } if (p_what==NOTIFICATION_RESIZED) { - + word_cache_dirty=true; } - + } Size2 Label::get_minimum_size() const { - + if (autowrap) return Size2(1,1); else { - + // don't want to mutable everything - if(word_cache_dirty) + if(word_cache_dirty) const_cast<Label*>(this)->regenerate_word_cache(); - + Size2 ms=minsize; if (clip) ms.width=1; return ms; - } + } } int Label::get_longest_line_width() const { - + Ref<Font> font = get_font("font"); int max_line_width=0; int line_width=0; - - for (int i=0;i<text.size()+1;i++) { - - CharType current=i<text.length()?text[i]:' '; //always a space at the end, so the algo works + + for (int i=0;i<text.size();i++) { + + CharType current=text[i]; if (uppercase) current=String::char_uppercase(current); if (current<32) { - + if (current=='\n') { - + if (line_width>max_line_width) max_line_width=line_width; line_width=0; } } else { - + int char_width=font->get_char_size(current).width; - line_width+=char_width; + line_width+=char_width; } - + } if (line_width>max_line_width) max_line_width=line_width; - + return max_line_width; } @@ -349,15 +355,15 @@ int Label::get_line_count() const { } void Label::regenerate_word_cache() { - + while (word_cache) { - + WordCache *current=word_cache; word_cache=current->next; memdelete( current ); } - - + + int width=autowrap?get_size().width:get_longest_line_width(); Ref<Font> font = get_font("font"); @@ -368,11 +374,11 @@ void Label::regenerate_word_cache() { int space_width=font->get_char_size(' ').width; line_count=1; total_char_cache=0; - + WordCache *last=NULL; - + for (int i=0;i<text.size()+1;i++) { - + CharType current=i<text.length()?text[i]:' '; //always a space at the end, so the algo works if (uppercase) @@ -429,12 +435,12 @@ void Label::regenerate_word_cache() { if (current_word_size==0) { word_pos=i; } - + char_width=font->get_char_size(current).width; current_word_size+=char_width; line_width+=char_width; total_char_cache++; - + } if ((autowrap && (line_width >= width) && ((last && last->char_pos >= 0) || separatable)) || insert_newline) { @@ -474,29 +480,22 @@ void Label::regenerate_word_cache() { space_count=0; } - + } - - //total_char_cache -= line_count + 1; // do not count new lines (including the first one) - + if (!autowrap) { - minsize.width=width; - minsize.height=font->get_height()*line_count; - set_page( line_count ); - - } else { - - set_page( get_size().height / font->get_height() ); + if (max_lines_visible > 0 && line_count > max_lines_visible) { + minsize.height=font->get_height()*max_lines_visible; + } else { + minsize.height=font->get_height()*line_count; + } } - - set_max(line_count); - + word_cache_dirty=false; } - void Label::set_align(Align p_align) { ERR_FAIL_INDEX(p_align,4); @@ -505,7 +504,7 @@ void Label::set_align(Align p_align) { } Label::Align Label::get_align() const{ - + return align; } @@ -522,24 +521,23 @@ Label::VAlign Label::get_valign() const{ } void Label::set_text(const String& p_string) { - + String str = XL_MESSAGE(p_string); if (text==str) return; - + text=str; word_cache_dirty=true; + if (percent_visible<1) + visible_chars=get_total_character_count()*percent_visible; update(); - if (!autowrap) - minimum_size_changed(); - + minimum_size_changed(); + } void Label::set_clip_text(bool p_clip) { - if (clip==p_clip) - return; clip=p_clip; update(); minimum_size_changed(); @@ -551,23 +549,39 @@ bool Label::is_clipping_text() const { } String Label::get_text() const { - + return text; } void Label::set_visible_characters(int p_amount) { visible_chars=p_amount; + if (get_total_character_count() > 0) { + percent_visible=(float)p_amount/(float)total_char_cache; + } update(); } +int Label::get_visible_characters() const { + + return visible_chars; +} + void Label::set_percent_visible(float p_percent) { - if (p_percent<0) - set_visible_characters(-1); - else - set_visible_characters(get_total_character_count()*p_percent); - percent_visible=p_percent; + if (p_percent<0 || p_percent>=1) { + + visible_chars=-1; + percent_visible=1; + + } else { + + visible_chars=get_total_character_count()*p_percent; + percent_visible=p_percent; + + } + update(); + } float Label::get_percent_visible() const{ @@ -575,6 +589,27 @@ float Label::get_percent_visible() const{ return percent_visible; } +void Label::set_lines_skipped(int p_lines) { + + lines_skipped=p_lines; + update(); +} + +int Label::get_lines_skipped() const{ + + return lines_skipped; +} + +void Label::set_max_lines_visible(int p_lines) { + + max_lines_visible=p_lines; + update(); +} + +int Label::get_max_lines_visible() const{ + + return max_lines_visible; +} int Label::get_total_character_count() const { @@ -585,7 +620,7 @@ int Label::get_total_character_count() const { } void Label::_bind_methods() { - + ObjectTypeDB::bind_method(_MD("set_align","align"),&Label::set_align); ObjectTypeDB::bind_method(_MD("get_align"),&Label::get_align); ObjectTypeDB::bind_method(_MD("set_valign","valign"),&Label::set_valign); @@ -594,14 +629,21 @@ void Label::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_text"),&Label::get_text); ObjectTypeDB::bind_method(_MD("set_autowrap","enable"),&Label::set_autowrap); ObjectTypeDB::bind_method(_MD("has_autowrap"),&Label::has_autowrap); + ObjectTypeDB::bind_method(_MD("set_clip_text","enable"),&Label::set_clip_text); + ObjectTypeDB::bind_method(_MD("is_clipping_text"),&Label::is_clipping_text); ObjectTypeDB::bind_method(_MD("set_uppercase","enable"),&Label::set_uppercase); ObjectTypeDB::bind_method(_MD("is_uppercase"),&Label::is_uppercase); ObjectTypeDB::bind_method(_MD("get_line_height"),&Label::get_line_height); ObjectTypeDB::bind_method(_MD("get_line_count"),&Label::get_line_count); ObjectTypeDB::bind_method(_MD("get_total_character_count"),&Label::get_total_character_count); - ObjectTypeDB::bind_method(_MD("set_visible_characters"),&Label::set_visible_characters); + ObjectTypeDB::bind_method(_MD("set_visible_characters","amount"),&Label::set_visible_characters); + ObjectTypeDB::bind_method(_MD("get_visible_characters"),&Label::get_visible_characters); ObjectTypeDB::bind_method(_MD("set_percent_visible","percent_visible"),&Label::set_percent_visible); ObjectTypeDB::bind_method(_MD("get_percent_visible"),&Label::get_percent_visible); + ObjectTypeDB::bind_method(_MD("set_lines_skipped","lines_skipped"),&Label::set_lines_skipped); + ObjectTypeDB::bind_method(_MD("get_lines_skipped"),&Label::get_lines_skipped); + ObjectTypeDB::bind_method(_MD("set_max_lines_visible","lines_visible"),&Label::set_max_lines_visible); + ObjectTypeDB::bind_method(_MD("get_max_lines_visible"),&Label::get_max_lines_visible); BIND_CONSTANT( ALIGN_LEFT ); BIND_CONSTANT( ALIGN_CENTER ); @@ -617,18 +659,21 @@ void Label::_bind_methods() { ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "align", PROPERTY_HINT_ENUM,"Left,Center,Right,Fill" ),_SCS("set_align"),_SCS("get_align") ); ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "valign", PROPERTY_HINT_ENUM,"Top,Center,Bottom,Fill" ),_SCS("set_valign"),_SCS("get_valign") ); ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "autowrap"),_SCS("set_autowrap"),_SCS("has_autowrap") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "clip_text"),_SCS("set_clip_text"),_SCS("is_clipping_text") ); ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "uppercase"),_SCS("set_uppercase"),_SCS("is_uppercase") ); ADD_PROPERTY( PropertyInfo( Variant::REAL, "percent_visible", PROPERTY_HINT_RANGE,"0,1,0.001"),_SCS("set_percent_visible"),_SCS("get_percent_visible") ); + ADD_PROPERTY( PropertyInfo( Variant::INT, "lines_skipped", PROPERTY_HINT_RANGE,"0,999,1"),_SCS("set_lines_skipped"),_SCS("get_lines_skipped") ); + ADD_PROPERTY( PropertyInfo( Variant::INT, "max_lines_visible", PROPERTY_HINT_RANGE,"-1,999,1"),_SCS("set_max_lines_visible"),_SCS("get_max_lines_visible") ); } Label::Label(const String &p_text) { - + align=ALIGN_LEFT; valign=VALIGN_TOP; text=""; word_cache=NULL; - word_cache_dirty=true; + word_cache_dirty=true; autowrap=false; line_count=0; set_v_size_flags(0); @@ -636,20 +681,22 @@ Label::Label(const String &p_text) { set_ignore_mouse(true); total_char_cache=0; visible_chars=-1; - percent_visible=-1; + percent_visible=1; + lines_skipped=0; + max_lines_visible=-1; set_text(p_text); uppercase=false; } Label::~Label() { - + while (word_cache) { - + WordCache *current=word_cache; word_cache=current->next; memdelete( current ); - } + } } diff --git a/scene/gui/label.h b/scene/gui/label.h index 81e3ab5676..4ea9f5d377 100644 --- a/scene/gui/label.h +++ b/scene/gui/label.h @@ -29,17 +29,17 @@ #ifndef LABEL_H #define LABEL_H -#include "scene/gui/range.h" +#include "scene/gui/control.h" /** @author Juan Linietsky <reduzio@gmail.com> */ -class Label : public Range { - - OBJ_TYPE( Label, Range ); -public: - +class Label : public Control { + + OBJ_TYPE( Label, Control ); +public: + enum Align { - + ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, @@ -63,11 +63,11 @@ private: Size2 minsize; int line_count; bool uppercase; - + int get_longest_line_width() const; - + struct WordCache { - + enum { CHAR_NEWLINE=-1, CHAR_WRAPLINE=-2 @@ -78,23 +78,25 @@ private: int space_count; WordCache *next; WordCache() { char_pos=0; word_len=0; pixel_width=0; next=0; space_count=0;} - }; - + }; + bool word_cache_dirty; void regenerate_word_cache(); float percent_visible; - + WordCache *word_cache; int total_char_cache; int visible_chars; -protected: + int lines_skipped; + int max_lines_visible; +protected: void _notification(int p_what); static void _bind_methods(); // bind helpers public: - + virtual Size2 get_minimum_size() const; void set_align(Align p_align); @@ -105,7 +107,7 @@ public: void set_text(const String& p_string); String get_text() const; - + void set_autowrap(bool p_autowrap); bool has_autowrap() const; @@ -113,6 +115,7 @@ public: bool is_uppercase() const; void set_visible_characters(int p_amount); + int get_visible_characters() const; int get_total_character_count() const; void set_clip_text(bool p_clip); @@ -121,6 +124,11 @@ public: void set_percent_visible(float p_percent); float get_percent_visible() const; + void set_lines_skipped(int p_lines); + int get_lines_skipped() const; + + void set_max_lines_visible(int p_lines); + int get_max_lines_visible() const; int get_line_height() const; int get_line_count() const; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 1759f3eb04..b5fdde30cd 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -94,9 +94,9 @@ void TextEdit::Text::set_tab_size(int p_tab_size) { void TextEdit::Text::_update_line_cache(int p_line) const { - int w =0; - int tab_w=font->get_char_size(' ').width; - + int w = 0; + int tab_w=font->get_char_size(' ').width*tab_size; + int len = text[p_line].data.length(); const CharType *str = text[p_line].data.c_str(); @@ -292,7 +292,10 @@ void TextEdit::_update_scrollbars() { int vscroll_pixels = v_scroll->get_combined_minimum_size().width; int visible_width = size.width - cache.style_normal->get_minimum_size().width; - int total_width = text.get_max_width(); + int total_width = text.get_max_width() + vmin.x; + + if (line_numbers) + total_width += cache.line_number_w; bool use_hscroll=true; bool use_vscroll=true; @@ -322,7 +325,6 @@ void TextEdit::_update_scrollbars() { v_scroll->show(); v_scroll->set_max(total_rows); v_scroll->set_page(visible_rows); - v_scroll->set_val(cursor.line_ofs); } else { @@ -336,6 +338,7 @@ void TextEdit::_update_scrollbars() { h_scroll->set_max(total_width); h_scroll->set_page(visible_width); h_scroll->set_val(cursor.x_ofs); + } else { h_scroll->hide(); diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index 45e3d92ece..adf053f5c9 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -42,6 +42,8 @@ #include "io/resource_loader.h" #include "viewport.h" #include "scene/resources/packed_scene.h" +#include "scene/resources/material.h" +#include "scene/resources/mesh.h" void SceneTree::tree_changed() { @@ -470,7 +472,6 @@ void SceneTree::init() { input_handled=false; - editor_hint=false; pause=false; root->_set_tree(this); @@ -624,6 +625,175 @@ bool SceneTree::is_editor_hint() const { return editor_hint; } +void SceneTree::set_debug_collisions_hint(bool p_enabled) { + + debug_collisions_hint=p_enabled; +} + +bool SceneTree::is_debugging_collisions_hint() const { + + return debug_collisions_hint; +} + +void SceneTree::set_debug_navigation_hint(bool p_enabled) { + + debug_navigation_hint=p_enabled; +} + +bool SceneTree::is_debugging_navigation_hint() const { + + return debug_navigation_hint; +} + +void SceneTree::set_debug_collisions_color(const Color& p_color) { + + debug_collisions_color=p_color; +} + +Color SceneTree::get_debug_collisions_color() const { + + return debug_collisions_color; +} + +void SceneTree::set_debug_collision_contact_color(const Color& p_color) { + + debug_collision_contact_color=p_color; +} + +Color SceneTree::get_debug_collision_contact_color() const { + + return debug_collision_contact_color; +} + +void SceneTree::set_debug_navigation_color(const Color& p_color) { + + debug_navigation_color=p_color; +} + +Color SceneTree::get_debug_navigation_color() const { + + return debug_navigation_color; +} + +void SceneTree::set_debug_navigation_disabled_color(const Color& p_color) { + + debug_navigation_disabled_color=p_color; +} + +Color SceneTree::get_debug_navigation_disabled_color() const { + + return debug_navigation_disabled_color; +} + +Ref<Material> SceneTree::get_debug_navigation_material() { + + if (navigation_material.is_valid()) + return navigation_material; + + Ref<FixedMaterial> line_material = Ref<FixedMaterial>( memnew( FixedMaterial )); + line_material->set_flag(Material::FLAG_UNSHADED, true); + line_material->set_line_width(3.0); + line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_color()); + + navigation_material=line_material; + + return navigation_material; + +} + +Ref<Material> SceneTree::get_debug_navigation_disabled_material(){ + + if (navigation_disabled_material.is_valid()) + return navigation_disabled_material; + + Ref<FixedMaterial> line_material = Ref<FixedMaterial>( memnew( FixedMaterial )); + line_material->set_flag(Material::FLAG_UNSHADED, true); + line_material->set_line_width(3.0); + line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_navigation_disabled_color()); + + navigation_disabled_material=line_material; + + return navigation_disabled_material; + +} +Ref<Material> SceneTree::get_debug_collision_material() { + + if (collision_material.is_valid()) + return collision_material; + + + Ref<FixedMaterial> line_material = Ref<FixedMaterial>( memnew( FixedMaterial )); + line_material->set_flag(Material::FLAG_UNSHADED, true); + line_material->set_line_width(3.0); + line_material->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA, true); + line_material->set_fixed_flag(FixedMaterial::FLAG_USE_COLOR_ARRAY, true); + line_material->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collisions_color()); + + collision_material=line_material; + + return collision_material; +} + +Ref<Mesh> SceneTree::get_debug_contact_mesh() { + + if (debug_contact_mesh.is_valid()) + return debug_contact_mesh; + + debug_contact_mesh = Ref<Mesh>( memnew( Mesh ) ); + + Ref<FixedMaterial> mat = memnew( FixedMaterial ); + mat->set_flag(Material::FLAG_UNSHADED,true); + mat->set_flag(Material::FLAG_DOUBLE_SIDED,true); + mat->set_fixed_flag(FixedMaterial::FLAG_USE_ALPHA,true); + mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,get_debug_collision_contact_color()); + + Vector3 diamond[6]={ + Vector3(-1, 0, 0), + Vector3( 1, 0, 0), + Vector3( 0, -1, 0), + Vector3( 0, 1, 0), + Vector3( 0, 0, -1), + Vector3( 0, 0, 1) + }; + + int diamond_faces[8*3]={ + 0,2,4, + 0,3,4, + 1,2,4, + 1,3,4, + 0,2,5, + 0,3,5, + 1,2,5, + 1,3,5, + }; + + DVector<int> indices; + for(int i=0;i<8*3;i++) + indices.push_back(diamond_faces[i]); + + DVector<Vector3> vertices; + for(int i=0;i<6;i++) + vertices.push_back(diamond[i]*0.1); + + Array arr; + arr.resize(Mesh::ARRAY_MAX); + arr[Mesh::ARRAY_VERTEX]=vertices; + arr[Mesh::ARRAY_INDEX]=indices; + + + debug_contact_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,arr); + debug_contact_mesh->surface_set_material(0,mat); + + return debug_contact_mesh; + +} + + + void SceneTree::set_pause(bool p_enabled) { if (p_enabled==pause) @@ -1424,6 +1594,11 @@ void SceneTree::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_editor_hint","enable"),&SceneTree::set_editor_hint); ObjectTypeDB::bind_method(_MD("is_editor_hint"),&SceneTree::is_editor_hint); + ObjectTypeDB::bind_method(_MD("set_debug_collisions_hint","enable"),&SceneTree::set_debug_collisions_hint); + ObjectTypeDB::bind_method(_MD("is_debugging_collisions_hint"),&SceneTree::is_debugging_collisions_hint); + ObjectTypeDB::bind_method(_MD("set_debug_navigation_hint","enable"),&SceneTree::set_debug_navigation_hint); + ObjectTypeDB::bind_method(_MD("is_debugging_navigation_hint"),&SceneTree::is_debugging_navigation_hint); + #ifdef TOOLS_ENABLED ObjectTypeDB::bind_method(_MD("set_edited_scene_root","scene"),&SceneTree::set_edited_scene_root); ObjectTypeDB::bind_method(_MD("get_edited_scene_root"),&SceneTree::get_edited_scene_root); @@ -1490,10 +1665,23 @@ void SceneTree::_bind_methods() { } +SceneTree *SceneTree::singleton=NULL; + SceneTree::SceneTree() { + singleton=this; _quit=false; initialized=false; + editor_hint=false; + debug_collisions_hint=false; + debug_navigation_hint=false; + debug_collisions_color=GLOBAL_DEF("debug/collision_shape_color",Color(0.0,0.6,0.7,0.5)); + debug_collision_contact_color=GLOBAL_DEF("debug/collision_contact_color",Color(1.0,0.2,0.1,0.8)); + debug_navigation_color=GLOBAL_DEF("debug/navigation_geometry_color",Color(0.1,1.0,0.7,0.4)); + debug_navigation_disabled_color=GLOBAL_DEF("debug/navigation_disabled_geometry_color",Color(1.0,0.7,0.1,0.4)); + collision_debug_contacts=GLOBAL_DEF("debug/collision_max_contacts_displayed",10000); + + tree_version=1; fixed_process_time=1; idle_process_time=1; diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h index 1f09d9c546..8d9021d24e 100644 --- a/scene/main/scene_main_loop.h +++ b/scene/main/scene_main_loop.h @@ -45,6 +45,8 @@ class SceneTree; class PackedScene; class Node; class Viewport; +class Material; +class Mesh; class SceneTree : public MainLoop { @@ -87,6 +89,8 @@ private: uint32_t last_id; bool editor_hint; + bool debug_collisions_hint; + bool debug_navigation_hint; bool pause; int root_lock; @@ -138,9 +142,20 @@ private: Node *current_scene; + Color debug_collisions_color; + Color debug_collision_contact_color; + Color debug_navigation_color; + Color debug_navigation_disabled_color; + Ref<Mesh> debug_contact_mesh; + Ref<Material> navigation_material; + Ref<Material> navigation_disabled_material; + Ref<Material> collision_material; + int collision_debug_contacts; + void _change_scene(Node* p_to); //void _call_group(uint32_t p_call_flags,const StringName& p_group,const StringName& p_function,const Variant& p_arg1,const Variant& p_arg2); + static SceneTree *singleton; friend class Node; void tree_changed(); @@ -270,6 +285,32 @@ public: void set_camera(const RID& p_camera); RID get_camera() const; + void set_debug_collisions_hint(bool p_enabled); + bool is_debugging_collisions_hint() const; + + void set_debug_navigation_hint(bool p_enabled); + bool is_debugging_navigation_hint() const; + + void set_debug_collisions_color(const Color& p_color); + Color get_debug_collisions_color() const; + + void set_debug_collision_contact_color(const Color& p_color); + Color get_debug_collision_contact_color() const; + + void set_debug_navigation_color(const Color& p_color); + Color get_debug_navigation_color() const; + + void set_debug_navigation_disabled_color(const Color& p_color); + Color get_debug_navigation_disabled_color() const; + + + Ref<Material> get_debug_navigation_material(); + Ref<Material> get_debug_navigation_disabled_material(); + Ref<Material> get_debug_collision_material(); + Ref<Mesh> get_debug_contact_mesh(); + + int get_collision_debug_contact_count() { return collision_debug_contacts; } + int64_t get_frame() const; int get_node_count() const; @@ -297,6 +338,7 @@ public: //used by Main::start, don't use otherwise void add_current_scene(Node * p_current); + static SceneTree* get_singleton() { return singleton; } SceneTree(); diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp index 3a80382a40..1bd22a9db1 100644 --- a/scene/main/timer.cpp +++ b/scene/main/timer.cpp @@ -182,11 +182,14 @@ void Timer::_bind_methods() { ADD_SIGNAL( MethodInfo("timeout") ); - ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_timer_process_mode"), _SCS("get_timer_process_mode")); + ADD_PROPERTY( PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_timer_process_mode"), _SCS("get_timer_process_mode") ); ADD_PROPERTY( PropertyInfo(Variant::REAL, "wait_time", PROPERTY_HINT_EXP_RANGE, "0.01,4096,0.01" ), _SCS("set_wait_time"), _SCS("get_wait_time") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL, "one_shot" ), _SCS("set_one_shot"), _SCS("is_one_shot") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL, "autostart" ), _SCS("set_autostart"), _SCS("has_autostart") ); + BIND_CONSTANT( TIMER_PROCESS_FIXED ); + BIND_CONSTANT( TIMER_PROCESS_IDLE ); + } Timer::Timer() { diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 3bb64e54c6..d19b5767c2 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -37,6 +37,7 @@ #include "servers/spatial_sound_2d_server.h" #include "scene/gui/control.h" #include "scene/3d/camera.h" +#include "scene/resources/mesh.h" #include "scene/3d/spatial_indexer.h" #include "scene/3d/collision_object.h" @@ -319,6 +320,23 @@ void Viewport::_notification(int p_what) { } add_to_group("_viewports"); + if (get_tree()->is_debugging_collisions_hint()) { + //2D + Physics2DServer::get_singleton()->space_set_debug_contacts(find_world_2d()->get_space(),get_tree()->get_collision_debug_contact_count()); + contact_2d_debug=VisualServer::get_singleton()->canvas_item_create(); + VisualServer::get_singleton()->canvas_item_set_parent(contact_2d_debug,find_world_2d()->get_canvas()); + //3D + PhysicsServer::get_singleton()->space_set_debug_contacts(find_world()->get_space(),get_tree()->get_collision_debug_contact_count()); + contact_3d_debug_multimesh=VisualServer::get_singleton()->multimesh_create(); + VisualServer::get_singleton()->multimesh_set_instance_count(contact_3d_debug_multimesh,get_tree()->get_collision_debug_contact_count()); + VisualServer::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh,0); + VisualServer::get_singleton()->multimesh_set_mesh(contact_3d_debug_multimesh,get_tree()->get_debug_contact_mesh()->get_rid()); + contact_3d_debug_instance=VisualServer::get_singleton()->instance_create(); + VisualServer::get_singleton()->instance_set_base(contact_3d_debug_instance,contact_3d_debug_multimesh); + VisualServer::get_singleton()->instance_set_scenario(contact_3d_debug_instance,find_world()->get_scenario()); + VisualServer::get_singleton()->instance_geometry_set_flag(contact_3d_debug_instance,VS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS,true); + + } } break; case NOTIFICATION_READY: { @@ -351,11 +369,69 @@ void Viewport::_notification(int p_what) { VisualServer::get_singleton()->viewport_set_scenario(viewport,RID()); SpatialSoundServer::get_singleton()->listener_set_space(listener,RID()); VisualServer::get_singleton()->viewport_remove_canvas(viewport,current_canvas); + if (contact_2d_debug.is_valid()) { + VisualServer::get_singleton()->free(contact_2d_debug); + contact_2d_debug=RID(); + } + + if (contact_3d_debug_multimesh.is_valid()) { + VisualServer::get_singleton()->free(contact_3d_debug_multimesh); + VisualServer::get_singleton()->free(contact_3d_debug_instance); + contact_3d_debug_instance=RID(); + contact_3d_debug_multimesh=RID(); + } + remove_from_group("_viewports"); } break; case NOTIFICATION_FIXED_PROCESS: { + + if (get_tree()->is_debugging_collisions_hint() && contact_2d_debug.is_valid()) { + + VisualServer::get_singleton()->canvas_item_clear(contact_2d_debug); + VisualServer::get_singleton()->canvas_item_raise(contact_2d_debug); + + Vector<Vector2> points = Physics2DServer::get_singleton()->space_get_contacts(find_world_2d()->get_space()); + int point_count = Physics2DServer::get_singleton()->space_get_contact_count(find_world_2d()->get_space()); + Color ccol = get_tree()->get_debug_collision_contact_color(); + + + for(int i=0;i<point_count;i++) { + + VisualServer::get_singleton()->canvas_item_add_rect(contact_2d_debug,Rect2(points[i]-Vector2(2,2),Vector2(5,5)),ccol); + } + } + + if (get_tree()->is_debugging_collisions_hint() && contact_3d_debug_multimesh.is_valid()) { + + + Vector<Vector3> points = PhysicsServer::get_singleton()->space_get_contacts(find_world()->get_space()); + int point_count = PhysicsServer::get_singleton()->space_get_contact_count(find_world()->get_space()); + + + VS::get_singleton()->multimesh_set_visible_instances(contact_3d_debug_multimesh,point_count); + + if (point_count>0) { + AABB aabb; + + Transform t; + for(int i=0;i<point_count;i++) { + + if (i==0) + aabb.pos=points[i]; + else + aabb.expand_to(points[i]); + t.origin=points[i]; + VisualServer::get_singleton()->multimesh_instance_set_transform(contact_3d_debug_multimesh,i,t); + } + aabb.grow(aabb.get_longest_axis_size()*0.01); + VisualServer::get_singleton()->multimesh_set_aabb(contact_3d_debug_multimesh,aabb); + } + } + + + if (physics_object_picking) { Vector2 last_pos(1e20,1e20); @@ -1449,6 +1525,8 @@ Viewport::Viewport() { unhandled_key_input_group = "_vp_unhandled_key_input"+id; + + } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index c3c339ac5d..843a1fd9b7 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -104,6 +104,11 @@ friend class RenderTargetTexture; Rect2 rect; Rect2 to_screen_rect; + RID contact_2d_debug; + RID contact_3d_debug_multimesh; + RID contact_3d_debug_instance; + + bool size_override; bool size_override_stretch; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 3727c2e8ec..851de4a89f 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -458,7 +458,6 @@ void register_scene_types() { /* disable types by default, only editors should enable them */ - ObjectTypeDB::set_type_enabled("CollisionShape",false); //ObjectTypeDB::set_type_enabled("BodyVolumeSphere",false); //ObjectTypeDB::set_type_enabled("BodyVolumeBox",false); //ObjectTypeDB::set_type_enabled("BodyVolumeCapsule",false); @@ -492,9 +491,12 @@ void register_scene_types() { ObjectTypeDB::register_type<OccluderPolygon2D>(); ObjectTypeDB::register_type<YSort>(); ObjectTypeDB::register_type<BackBufferCopy>(); - - ObjectTypeDB::set_type_enabled("CollisionShape2D",false); - ObjectTypeDB::set_type_enabled("CollisionPolygon2D",false); + if (bool(GLOBAL_DEF("physics/remove_collision_helpers_at_runtime",false))) { + ObjectTypeDB::set_type_enabled("CollisionShape2D",false); + ObjectTypeDB::set_type_enabled("CollisionPolygon2D",false); + ObjectTypeDB::set_type_enabled("CollisionShape",false); + ObjectTypeDB::set_type_enabled("CollisionPolygon",false); + } OS::get_singleton()->yield(); //may take time to init diff --git a/scene/resources/box_shape.cpp b/scene/resources/box_shape.cpp index 22ee9f8c09..ba29a1b601 100644 --- a/scene/resources/box_shape.cpp +++ b/scene/resources/box_shape.cpp @@ -30,6 +30,25 @@ #include "servers/physics_server.h" +Vector<Vector3> BoxShape::_gen_debug_mesh_lines() { + + + Vector<Vector3> lines; + AABB aabb; + aabb.pos=-get_extents(); + aabb.size=aabb.pos*-2; + + for(int i=0;i<12;i++) { + Vector3 a,b; + aabb.get_edge(i,a,b); + lines.push_back(a); + lines.push_back(b); + } + + + return lines; +} + void BoxShape::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(),extents); diff --git a/scene/resources/box_shape.h b/scene/resources/box_shape.h index 18c5f5e5fb..9667515657 100644 --- a/scene/resources/box_shape.h +++ b/scene/resources/box_shape.h @@ -41,6 +41,7 @@ protected: static void _bind_methods(); virtual void _update_shape(); + virtual Vector<Vector3> _gen_debug_mesh_lines(); public: diff --git a/scene/resources/capsule_shape.cpp b/scene/resources/capsule_shape.cpp index 2633b132cf..67ceed6be0 100644 --- a/scene/resources/capsule_shape.cpp +++ b/scene/resources/capsule_shape.cpp @@ -30,6 +30,46 @@ #include "servers/physics_server.h" +Vector<Vector3> CapsuleShape::_gen_debug_mesh_lines() { + + + float radius = get_radius(); + float height = get_height(); + + + Vector<Vector3> points; + + Vector3 d(0,0,height*0.5); + for(int i=0;i<360;i++) { + + float ra=Math::deg2rad(i); + float rb=Math::deg2rad(i+1); + Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*radius; + Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*radius; + + points.push_back(Vector3(a.x,a.y,0)+d); + points.push_back(Vector3(b.x,b.y,0)+d); + + points.push_back(Vector3(a.x,a.y,0)-d); + points.push_back(Vector3(b.x,b.y,0)-d); + + if (i%90==0) { + + points.push_back(Vector3(a.x,a.y,0)+d); + points.push_back(Vector3(a.x,a.y,0)-d); + } + + Vector3 dud = i<180?d:-d; + + points.push_back(Vector3(0,a.y,a.x)+dud); + points.push_back(Vector3(0,b.y,b.x)+dud); + points.push_back(Vector3(a.y,0,a.x)+dud); + points.push_back(Vector3(b.y,0,b.x)+dud); + + } + + return points; +} void CapsuleShape::_update_shape() { @@ -65,7 +105,6 @@ float CapsuleShape::get_height() const { return height; } - void CapsuleShape::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_radius","radius"),&CapsuleShape::set_radius); diff --git a/scene/resources/capsule_shape.h b/scene/resources/capsule_shape.h index 43b8331949..e516d0e3c7 100644 --- a/scene/resources/capsule_shape.h +++ b/scene/resources/capsule_shape.h @@ -43,6 +43,7 @@ protected: virtual void _update_shape(); + virtual Vector<Vector3> _gen_debug_mesh_lines(); public: void set_radius(float p_radius); @@ -50,6 +51,7 @@ public: void set_height(float p_height); float get_height() const; + CapsuleShape(); }; diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp index 135eb41d8f..923a509ad5 100644 --- a/scene/resources/capsule_shape_2d.cpp +++ b/scene/resources/capsule_shape_2d.cpp @@ -29,6 +29,7 @@ #include "capsule_shape_2d.h" #include "servers/physics_2d_server.h" +#include "servers/visual_server.h" void CapsuleShape2D::_update_shape() { @@ -60,6 +61,32 @@ real_t CapsuleShape2D::get_height() const { } +void CapsuleShape2D::draw(const RID& p_to_rid,const Color& p_color) { + + Vector<Vector2> points; + for(int i=0;i<24;i++) { + Vector2 ofs = Vector2(0,(i>6 && i<=18) ? -get_height()*0.5 : get_height()*0.5); + + points.push_back(Vector2(Math::sin(i*Math_PI*2/24.0),Math::cos(i*Math_PI*2/24.0))*get_radius() + ofs); + if (i==6 || i==18) + points.push_back(Vector2(Math::sin(i*Math_PI*2/24.0),Math::cos(i*Math_PI*2/24.0))*get_radius() - ofs); + } + + Vector<Color> col; + col.push_back(p_color); + VisualServer::get_singleton()->canvas_item_add_polygon(p_to_rid,points,col); + +} + +Rect2 CapsuleShape2D::get_rect() const { + + Vector2 he=Point2(get_radius(),get_radius()+get_height()*0.5); + Rect2 rect; + rect.pos=-he; + rect.size=he*2.0; + return rect; +} + void CapsuleShape2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_radius","radius"),&CapsuleShape2D::set_radius); diff --git a/scene/resources/capsule_shape_2d.h b/scene/resources/capsule_shape_2d.h index 4dd6348282..dc679966f9 100644 --- a/scene/resources/capsule_shape_2d.h +++ b/scene/resources/capsule_shape_2d.h @@ -49,6 +49,9 @@ public: void set_radius(real_t p_radius); real_t get_radius() const; + virtual void draw(const RID& p_to_rid,const Color& p_color); + virtual Rect2 get_rect() const ; + CapsuleShape2D(); }; diff --git a/scene/resources/circle_shape_2d.cpp b/scene/resources/circle_shape_2d.cpp index 4135bc7c3b..c77395612c 100644 --- a/scene/resources/circle_shape_2d.cpp +++ b/scene/resources/circle_shape_2d.cpp @@ -29,7 +29,7 @@ #include "circle_shape_2d.h" #include "servers/physics_2d_server.h" - +#include "servers/visual_server.h" void CircleShape2D::_update_shape() { Physics2DServer::get_singleton()->shape_set_data(get_rid(),radius); @@ -58,6 +58,27 @@ void CircleShape2D::_bind_methods() { } +Rect2 CircleShape2D::get_rect() const { + Rect2 rect; + rect.pos=-Point2(get_radius(),get_radius()); + rect.size=Point2(get_radius(),get_radius())*2.0; + return rect; +} + +void CircleShape2D::draw(const RID& p_to_rid,const Color& p_color) { + + Vector<Vector2> points; + for(int i=0;i<24;i++) { + + points.push_back(Vector2(Math::cos(i*Math_PI*2/24.0),Math::sin(i*Math_PI*2/24.0))*get_radius()); + } + + Vector<Color> col; + col.push_back(p_color); + VisualServer::get_singleton()->canvas_item_add_polygon(p_to_rid,points,col); + +} + CircleShape2D::CircleShape2D() : Shape2D( Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_CIRCLE)) { radius=10; diff --git a/scene/resources/circle_shape_2d.h b/scene/resources/circle_shape_2d.h index d937af2979..a5902b189c 100644 --- a/scene/resources/circle_shape_2d.h +++ b/scene/resources/circle_shape_2d.h @@ -44,6 +44,10 @@ public: void set_radius(real_t p_radius); real_t get_radius() const; + virtual void draw(const RID& p_to_rid,const Color& p_color); + virtual Rect2 get_rect() const; + + CircleShape2D(); }; diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp index 55bd5de690..7aeac04a22 100644 --- a/scene/resources/concave_polygon_shape.cpp +++ b/scene/resources/concave_polygon_shape.cpp @@ -30,6 +30,40 @@ #include "servers/physics_server.h" +Vector<Vector3> ConcavePolygonShape::_gen_debug_mesh_lines() { + + Set<DrawEdge> edges; + + DVector<Vector3> data=get_faces(); + int datalen=data.size(); + ERR_FAIL_COND_V( (datalen%3)!=0,Vector<Vector3>() ); + + DVector<Vector3>::Read r=data.read(); + + for(int i=0;i<datalen;i+=3) { + + for(int j=0;j<3;j++) { + + DrawEdge de(r[i+j],r[i+((j+1)%3)]); + edges.insert(de); + } + + } + + Vector<Vector3> points; + points.resize(edges.size()*2); + int idx=0; + for (Set<DrawEdge>::Element*E=edges.front();E;E=E->next()) { + + points[idx+0]=E->get().a; + points[idx+1]=E->get().b; + idx+=2; + } + + return points; + +} + bool ConcavePolygonShape::_set(const StringName& p_name, const Variant& p_value) { if (p_name=="data") diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape.h index 7bd80eb9c0..fae98ee046 100644 --- a/scene/resources/concave_polygon_shape.h +++ b/scene/resources/concave_polygon_shape.h @@ -35,16 +35,36 @@ class ConcavePolygonShape : public Shape { OBJ_TYPE(ConcavePolygonShape,Shape); + struct DrawEdge { + + Vector3 a; + Vector3 b; + bool operator<(const DrawEdge& p_edge) const { + if (a==p_edge.a) + return b<p_edge.b; + else + return a<p_edge.a; + } + + DrawEdge(const Vector3& p_a=Vector3(),const Vector3& p_b=Vector3()) { + a=p_a; + b=p_b; + if (a<b) { + SWAP(a,b); + } + } + }; protected: + bool _set(const StringName& p_name, const Variant& p_value); bool _get(const StringName& p_name,Variant &r_ret) const; void _get_property_list( List<PropertyInfo> *p_list) const; static void _bind_methods(); virtual void _update_shape(); - + virtual Vector<Vector3> _gen_debug_mesh_lines(); public: void set_faces(const DVector<Vector3>& p_faces); diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp index 0287d79dc6..923e2817ef 100644 --- a/scene/resources/concave_polygon_shape_2d.cpp +++ b/scene/resources/concave_polygon_shape_2d.cpp @@ -29,7 +29,7 @@ #include "concave_polygon_shape_2d.h" #include "servers/physics_2d_server.h" - +#include "servers/visual_server.h" void ConcavePolygonShape2D::set_segments(const DVector<Vector2>& p_segments) { @@ -41,6 +41,43 @@ DVector<Vector2> ConcavePolygonShape2D::get_segments() const { return Physics2DServer::get_singleton()->shape_get_data(get_rid()); } +void ConcavePolygonShape2D::draw(const RID& p_to_rid,const Color& p_color) { + + + DVector<Vector2> s = get_segments(); + int len=s.size(); + if (len==0 || (len%2)==1) + return; + + DVector<Vector2>::Read r = s.read(); + for(int i=0;i<len;i+=2) { + VisualServer::get_singleton()->canvas_item_add_line(p_to_rid,r[i],r[i+1],p_color,2); + } + +} + +Rect2 ConcavePolygonShape2D::get_rect() const { + + + DVector<Vector2> s = get_segments(); + int len=s.size(); + if (len==0) + return Rect2(); + + Rect2 rect; + + DVector<Vector2>::Read r = s.read(); + for(int i=0;i<len;i++) { + if (i==0) + rect.pos=r[i]; + else + rect.expand_to(r[i]); + } + + return rect; + +} + void ConcavePolygonShape2D::_bind_methods() { diff --git a/scene/resources/concave_polygon_shape_2d.h b/scene/resources/concave_polygon_shape_2d.h index b835096b2a..29666c88c1 100644 --- a/scene/resources/concave_polygon_shape_2d.h +++ b/scene/resources/concave_polygon_shape_2d.h @@ -41,6 +41,9 @@ public: void set_segments(const DVector<Vector2>& p_segments); DVector<Vector2> get_segments() const; + virtual void draw(const RID& p_to_rid,const Color& p_color); + virtual Rect2 get_rect() const ; + ConcavePolygonShape2D(); }; diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp index 326a0e5180..6a405c9c94 100644 --- a/scene/resources/convex_polygon_shape.cpp +++ b/scene/resources/convex_polygon_shape.cpp @@ -28,7 +28,34 @@ /*************************************************************************/ #include "convex_polygon_shape.h" #include "servers/physics_server.h" +#include "quick_hull.h" +Vector<Vector3> ConvexPolygonShape::_gen_debug_mesh_lines() { + + DVector<Vector3> points = get_points(); + + if (points.size()>3) { + + QuickHull qh; + Vector<Vector3> varr = Variant(points); + Geometry::MeshData md; + Error err = qh.build(varr,md); + if (err==OK) { + Vector<Vector3> lines; + lines.resize(md.edges.size()*2); + for(int i=0;i<md.edges.size();i++) { + lines[i*2+0]=md.vertices[md.edges[i].a]; + lines[i*2+1]=md.vertices[md.edges[i].b]; + } + return lines; + + + } + + } + + return Vector<Vector3>(); +} void ConvexPolygonShape::_update_shape() { diff --git a/scene/resources/convex_polygon_shape.h b/scene/resources/convex_polygon_shape.h index e0a590e09d..48454deb2b 100644 --- a/scene/resources/convex_polygon_shape.h +++ b/scene/resources/convex_polygon_shape.h @@ -42,6 +42,7 @@ protected: virtual void _update_shape(); + virtual Vector<Vector3> _gen_debug_mesh_lines(); public: void set_points(const DVector<Vector3>& p_points); diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index 74506f8600..dac39fc846 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -29,7 +29,7 @@ #include "convex_polygon_shape_2d.h" #include "servers/physics_2d_server.h" - +#include "servers/visual_server.h" void ConvexPolygonShape2D::_update_shape() { Physics2DServer::get_singleton()->shape_set_data(get_rid(),points); @@ -66,6 +66,29 @@ void ConvexPolygonShape2D::_bind_methods() { } +void ConvexPolygonShape2D::draw(const RID& p_to_rid,const Color& p_color) { + + + Vector<Color> col; + col.push_back(p_color); + VisualServer::get_singleton()->canvas_item_add_polygon(p_to_rid,points,col); +} + +Rect2 ConvexPolygonShape2D::get_rect() const { + + + Rect2 rect; + for(int i=0;i<points.size();i++) { + if (i==0) + rect.pos=points[i]; + else + rect.expand_to(points[i]); + } + + return rect; + +} + ConvexPolygonShape2D::ConvexPolygonShape2D() : Shape2D( Physics2DServer::get_singleton()->shape_create(Physics2DServer::SHAPE_CONVEX_POLYGON)) { diff --git a/scene/resources/convex_polygon_shape_2d.h b/scene/resources/convex_polygon_shape_2d.h index efcaa19be6..1af7787f67 100644 --- a/scene/resources/convex_polygon_shape_2d.h +++ b/scene/resources/convex_polygon_shape_2d.h @@ -45,6 +45,9 @@ public: void set_points(const Vector<Vector2>& p_points); Vector<Vector2> get_points() const; + virtual void draw(const RID& p_to_rid,const Color& p_color); + virtual Rect2 get_rect() const ; + ConvexPolygonShape2D(); }; diff --git a/scene/resources/plane_shape.cpp b/scene/resources/plane_shape.cpp index 150406ceff..760a36a91e 100644 --- a/scene/resources/plane_shape.cpp +++ b/scene/resources/plane_shape.cpp @@ -30,7 +30,34 @@ #include "servers/physics_server.h" - +Vector<Vector3> PlaneShape::_gen_debug_mesh_lines() { + + Plane p = get_plane(); + Vector<Vector3> points; + + Vector3 n1 = p.get_any_perpendicular_normal(); + Vector3 n2 = p.normal.cross(n1).normalized(); + + Vector3 pface[4]={ + p.normal*p.d+n1*10.0+n2*10.0, + p.normal*p.d+n1*10.0+n2*-10.0, + p.normal*p.d+n1*-10.0+n2*-10.0, + p.normal*p.d+n1*-10.0+n2*10.0, + }; + + points.push_back(pface[0]); + points.push_back(pface[1]); + points.push_back(pface[1]); + points.push_back(pface[2]); + points.push_back(pface[2]); + points.push_back(pface[3]); + points.push_back(pface[3]); + points.push_back(pface[0]); + points.push_back(p.normal*p.d); + points.push_back(p.normal*p.d+p.normal*3); + + return points; +} void PlaneShape::_update_shape() { diff --git a/scene/resources/plane_shape.h b/scene/resources/plane_shape.h index 3bdf8f2bef..dd285171c4 100644 --- a/scene/resources/plane_shape.h +++ b/scene/resources/plane_shape.h @@ -39,9 +39,9 @@ class PlaneShape : public Shape { protected: static void _bind_methods(); - virtual void _update_shape(); + virtual Vector<Vector3> _gen_debug_mesh_lines(); public: void set_plane(Plane p_plane); diff --git a/scene/resources/ray_shape.cpp b/scene/resources/ray_shape.cpp index e12ecf107b..ee55cc6e37 100644 --- a/scene/resources/ray_shape.cpp +++ b/scene/resources/ray_shape.cpp @@ -30,7 +30,14 @@ #include "servers/physics_server.h" +Vector<Vector3> RayShape::_gen_debug_mesh_lines() { + Vector<Vector3> points; + points.push_back(Vector3()); + points.push_back(Vector3(0,0,get_length())); + + return points; +} void RayShape::_update_shape() { diff --git a/scene/resources/ray_shape.h b/scene/resources/ray_shape.h index 0b6156d343..edb29b83b5 100644 --- a/scene/resources/ray_shape.h +++ b/scene/resources/ray_shape.h @@ -39,7 +39,7 @@ protected: static void _bind_methods(); virtual void _update_shape(); - + virtual Vector<Vector3> _gen_debug_mesh_lines(); public: void set_length(float p_length); diff --git a/scene/resources/rectangle_shape_2d.cpp b/scene/resources/rectangle_shape_2d.cpp index d3332f45a5..7903d88736 100644 --- a/scene/resources/rectangle_shape_2d.cpp +++ b/scene/resources/rectangle_shape_2d.cpp @@ -29,7 +29,7 @@ #include "rectangle_shape_2d.h" #include "servers/physics_2d_server.h" - +#include "servers/visual_server.h" void RectangleShape2D::_update_shape() { Physics2DServer::get_singleton()->shape_set_data(get_rid(),extents); @@ -48,6 +48,19 @@ Vector2 RectangleShape2D::get_extents() const { return extents; } +void RectangleShape2D::draw(const RID& p_to_rid,const Color& p_color) { + + + VisualServer::get_singleton()->canvas_item_add_rect(p_to_rid,Rect2(-extents,extents*2.0),p_color); + +} + +Rect2 RectangleShape2D::get_rect() const { + + return Rect2(-extents,extents*2.0); + +} + void RectangleShape2D::_bind_methods() { diff --git a/scene/resources/rectangle_shape_2d.h b/scene/resources/rectangle_shape_2d.h index 0b89441d04..96de02fb70 100644 --- a/scene/resources/rectangle_shape_2d.h +++ b/scene/resources/rectangle_shape_2d.h @@ -44,6 +44,9 @@ public: void set_extents(const Vector2& p_extents); Vector2 get_extents() const; + virtual void draw(const RID& p_to_rid,const Color& p_color); + virtual Rect2 get_rect() const ; + RectangleShape2D(); }; diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp index b8bd3de552..88f7adcd9b 100644 --- a/scene/resources/segment_shape_2d.cpp +++ b/scene/resources/segment_shape_2d.cpp @@ -29,6 +29,7 @@ #include "segment_shape_2d.h" #include "servers/physics_2d_server.h" +#include "servers/visual_server.h" void SegmentShape2D::_update_shape() { @@ -62,6 +63,23 @@ Vector2 SegmentShape2D::get_b() const { return b; } +void SegmentShape2D::draw(const RID& p_to_rid,const Color& p_color) { + + VisualServer::get_singleton()->canvas_item_add_line(p_to_rid,a,b,p_color,3); +} + +Rect2 SegmentShape2D::get_rect() const{ + + Rect2 rect; + rect.pos=a; + rect.expand_to(b); + return rect; + +} + + + + void SegmentShape2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_a","a"),&SegmentShape2D::set_a); @@ -94,6 +112,37 @@ void RayShape2D::_update_shape() { } + +void RayShape2D::draw(const RID& p_to_rid,const Color& p_color) { + + + Vector2 tip = Vector2(0,get_length()); + VS::get_singleton()->canvas_item_add_line(p_to_rid,Vector2(),tip,p_color,3); + Vector<Vector2> pts; + float tsize=4; + pts.push_back(tip+Vector2(0,tsize)); + pts.push_back(tip+Vector2(0.707*tsize,0)); + pts.push_back(tip+Vector2(-0.707*tsize,0)); + Vector<Color> cols; + for(int i=0;i<3;i++) + cols.push_back(p_color); + + VS::get_singleton()->canvas_item_add_primitive(p_to_rid,pts,cols,Vector<Point2>(),RID()); + + + +} + +Rect2 RayShape2D::get_rect() const { + + Rect2 rect; + rect.pos=Vector2(); + rect.expand_to(Vector2(0,length)); + rect=rect.grow(0.707*4); + return rect; +} + + void RayShape2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_length","length"),&RayShape2D::set_length); diff --git a/scene/resources/segment_shape_2d.h b/scene/resources/segment_shape_2d.h index ec771cd2ed..37c68b6c92 100644 --- a/scene/resources/segment_shape_2d.h +++ b/scene/resources/segment_shape_2d.h @@ -49,6 +49,9 @@ public: Vector2 get_a() const; Vector2 get_b() const; + virtual void draw(const RID& p_to_rid,const Color& p_color); + virtual Rect2 get_rect() const; + SegmentShape2D(); }; @@ -67,6 +70,8 @@ public: void set_length(real_t p_length); real_t get_length() const; + virtual void draw(const RID& p_to_rid,const Color& p_color); + virtual Rect2 get_rect() const; RayShape2D(); }; diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp index 1120a8d672..143ef82d51 100644 --- a/scene/resources/shape.cpp +++ b/scene/resources/shape.cpp @@ -29,9 +29,67 @@ #include "shape.h" #include "servers/physics_server.h" +#include "scene/resources/mesh.h" +#include "os/os.h" +#include "scene/main/scene_main_loop.h" +void Shape::add_vertices_to_array(DVector<Vector3> &array, const Transform& p_xform) { + Vector<Vector3> toadd = _gen_debug_mesh_lines(); + + if (toadd.size()) { + + int base=array.size(); + array.resize(base+toadd.size()); + DVector<Vector3>::Write w = array.write(); + for(int i=0;i<toadd.size();i++) { + w[i+base]=p_xform.xform(toadd[i]); + } + + } +} + +Ref<Mesh> Shape::get_debug_mesh() { + + if (debug_mesh_cache.is_valid()) + return debug_mesh_cache; + + Vector<Vector3> lines = _gen_debug_mesh_lines(); + + debug_mesh_cache = Ref<Mesh>(memnew(Mesh)); + + if (!lines.empty()) { + //make mesh + DVector<Vector3> array; + array.resize(lines.size()); + { + + DVector<Vector3>::Write w=array.write(); + for(int i=0;i<lines.size();i++) { + w[i]=lines[i]; + } + } + + Array arr; + arr.resize(Mesh::ARRAY_MAX); + arr[Mesh::ARRAY_VERTEX]=array; + + SceneTree *st=OS::get_singleton()->get_main_loop()->cast_to<SceneTree>(); + + debug_mesh_cache->add_surface(Mesh::PRIMITIVE_LINES,arr); + + if (st) { + debug_mesh_cache->surface_set_material(0,st->get_debug_collision_material()); + } + + } + + + + return debug_mesh_cache; + +} Shape::Shape() { @@ -49,3 +107,4 @@ Shape::~Shape() { PhysicsServer::get_singleton()->free(shape); } + diff --git a/scene/resources/shape.h b/scene/resources/shape.h index 3cc806c7a3..1992ce51c3 100644 --- a/scene/resources/shape.h +++ b/scene/resources/shape.h @@ -30,6 +30,7 @@ #define SHAPE_H #include "resource.h" +class Mesh; class Shape : public Resource { @@ -38,13 +39,22 @@ class Shape : public Resource { RES_BASE_EXTENSION("shp"); RID shape; + Ref<Mesh> debug_mesh_cache; + protected: _FORCE_INLINE_ RID get_shape() const { return shape; } Shape(RID p_shape); + + virtual Vector<Vector3> _gen_debug_mesh_lines()=0;// { return Vector<Vector3>(); } public: virtual RID get_rid() const { return shape; } + + Ref<Mesh> get_debug_mesh(); + + void add_vertices_to_array(DVector<Vector3> &array, const Transform& p_xform); + Shape(); ~Shape(); }; diff --git a/scene/resources/shape_2d.h b/scene/resources/shape_2d.h index 55f3173db4..1737301d9d 100644 --- a/scene/resources/shape_2d.h +++ b/scene/resources/shape_2d.h @@ -53,6 +53,8 @@ public: Variant collide_with_motion_and_get_contacts(const Matrix32& p_local_xform, const Vector2& p_local_motion, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform, const Vector2 &p_p_shape_motion); Variant collide_and_get_contacts(const Matrix32& p_local_xform, const Ref<Shape2D>& p_shape, const Matrix32& p_shape_xform); + virtual void draw(const RID& p_to_rid,const Color& p_color) {} + virtual Rect2 get_rect() const { return Rect2(); } virtual RID get_rid() const; Shape2D(); ~Shape2D(); diff --git a/scene/resources/shape_line_2d.cpp b/scene/resources/shape_line_2d.cpp index d4dc46d64f..c660b604f3 100644 --- a/scene/resources/shape_line_2d.cpp +++ b/scene/resources/shape_line_2d.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "shape_line_2d.h" #include "servers/physics_2d_server.h" - +#include "servers/visual_server.h" void LineShape2D::_update_shape() { Array arr; @@ -61,6 +61,32 @@ real_t LineShape2D::get_d() const { return d; } + +void LineShape2D::draw(const RID& p_to_rid,const Color& p_color) { + + Vector2 point = get_d() * get_normal(); + + Vector2 l1[2]={point-get_normal().tangent()*100,point+get_normal().tangent()*100}; + VS::get_singleton()->canvas_item_add_line(p_to_rid,l1[0],l1[1],p_color,3); + Vector2 l2[2]={point,point+get_normal()*30}; + VS::get_singleton()->canvas_item_add_line(p_to_rid,l2[0],l2[1],p_color,3); + +} +Rect2 LineShape2D::get_rect() const{ + + Vector2 point = get_d() * get_normal(); + + Vector2 l1[2]={point-get_normal().tangent()*100,point+get_normal().tangent()*100}; + Vector2 l2[2]={point,point+get_normal()*30}; + Rect2 rect; + rect.pos=l1[0]; + rect.expand_to(l1[1]); + rect.expand_to(l2[0]); + rect.expand_to(l2[1]); + return rect; + +} + void LineShape2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_normal","normal"),&LineShape2D::set_normal); diff --git a/scene/resources/shape_line_2d.h b/scene/resources/shape_line_2d.h index 3ba8f57add..f32ad7fb7c 100644 --- a/scene/resources/shape_line_2d.h +++ b/scene/resources/shape_line_2d.h @@ -49,6 +49,9 @@ public: Vector2 get_normal() const; real_t get_d() const; + virtual void draw(const RID& p_to_rid,const Color& p_color); + virtual Rect2 get_rect() const; + LineShape2D(); }; diff --git a/scene/resources/sphere_shape.cpp b/scene/resources/sphere_shape.cpp index e93d718efa..a7e28eb727 100644 --- a/scene/resources/sphere_shape.cpp +++ b/scene/resources/sphere_shape.cpp @@ -29,6 +29,30 @@ #include "sphere_shape.h" #include "servers/physics_server.h" +Vector<Vector3> SphereShape::_gen_debug_mesh_lines() { + + float r=get_radius(); + + Vector<Vector3> points; + + for(int i=0;i<=360;i++) { + + float ra=Math::deg2rad(i); + float rb=Math::deg2rad(i+1); + Point2 a = Vector2(Math::sin(ra),Math::cos(ra))*r; + Point2 b = Vector2(Math::sin(rb),Math::cos(rb))*r; + + points.push_back(Vector3(a.x,0,a.y)); + points.push_back(Vector3(b.x,0,b.y)); + points.push_back(Vector3(0,a.x,a.y)); + points.push_back(Vector3(0,b.x,b.y)); + points.push_back(Vector3(a.x,a.y,0)); + points.push_back(Vector3(b.x,b.y,0)); + + } + + return points; +} void SphereShape::_update_shape() { diff --git a/scene/resources/sphere_shape.h b/scene/resources/sphere_shape.h index 1bbddb9fd9..2543d94439 100644 --- a/scene/resources/sphere_shape.h +++ b/scene/resources/sphere_shape.h @@ -42,7 +42,7 @@ protected: static void _bind_methods(); virtual void _update_shape(); - + virtual Vector<Vector3> _gen_debug_mesh_lines(); public: void set_radius(float p_radius); diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp index 09cb4eca5f..141c940615 100644 --- a/servers/audio/audio_server_sw.cpp +++ b/servers/audio/audio_server_sw.cpp @@ -455,12 +455,12 @@ void AudioServerSW::voice_play(RID p_voice, RID p_sample) { } -void AudioServerSW::voice_set_volume(RID p_voice, float p_db) { +void AudioServerSW::voice_set_volume(RID p_voice, float p_volume) { VoiceRBSW::Command cmd; cmd.type=VoiceRBSW::Command::CMD_SET_VOLUME; cmd.voice=p_voice; - cmd.volume.volume=p_db; + cmd.volume.volume=p_volume; voice_rb.push_command(cmd); } diff --git a/servers/audio/audio_server_sw.h b/servers/audio/audio_server_sw.h index 77d2f2e8dd..250855a43e 100644 --- a/servers/audio/audio_server_sw.h +++ b/servers/audio/audio_server_sw.h @@ -146,7 +146,7 @@ public: virtual void voice_play(RID p_voice, RID p_sample); - virtual void voice_set_volume(RID p_voice, float p_db); + virtual void voice_set_volume(RID p_voice, float p_volume); virtual void voice_set_pan(RID p_voice, float p_pan, float p_depth=0,float height=0); //pan and depth go from -1 to 1 virtual void voice_set_filter(RID p_voice, FilterType p_type, float p_cutoff, float p_resonance,float p_gain=0); virtual void voice_set_chorus(RID p_voice, float p_chorus ); diff --git a/servers/audio_server.h b/servers/audio_server.h index f54698a1e3..cd3e920f31 100644 --- a/servers/audio_server.h +++ b/servers/audio_server.h @@ -210,7 +210,7 @@ public: virtual void voice_play(RID p_voice, RID p_sample)=0; - virtual void voice_set_volume(RID p_voice, float p_gain)=0; + virtual void voice_set_volume(RID p_voice, float p_volume)=0; virtual void voice_set_pan(RID p_voice, float p_pan, float p_depth=0,float height=0)=0; //pan and depth go from -1 to 1 virtual void voice_set_filter(RID p_voice, FilterType p_type, float p_cutoff, float p_resonance, float p_gain=0)=0; virtual void voice_set_chorus(RID p_voice, float p_chorus )=0; diff --git a/servers/physics/body_pair_sw.cpp b/servers/physics/body_pair_sw.cpp index e2b2fa2051..da4c1b48d8 100644 --- a/servers/physics/body_pair_sw.cpp +++ b/servers/physics/body_pair_sw.cpp @@ -299,6 +299,16 @@ bool BodyPairSW::setup(float p_step) { c.active=true; +#ifdef DEBUG_ENABLED + + + if (space->is_debugging_contacts()) { + space->add_debug_contact(global_A+offset_A); + space->add_debug_contact(global_B+offset_A); + } +#endif + + int gather_A = A->can_report_contacts(); int gather_B = B->can_report_contacts(); diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index 521ffae0ea..a9a8042c19 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -201,6 +201,30 @@ PhysicsDirectSpaceState* PhysicsServerSW::space_get_direct_state(RID p_space) { return space->get_direct_state(); } +void PhysicsServerSW::space_set_debug_contacts(RID p_space,int p_max_contacts) { + + SpaceSW *space = space_owner.get(p_space); + ERR_FAIL_COND(!space); + space->set_debug_contacts(p_max_contacts); + +} + +Vector<Vector3> PhysicsServerSW::space_get_contacts(RID p_space) const { + + SpaceSW *space = space_owner.get(p_space); + ERR_FAIL_COND_V(!space,Vector<Vector3>()); + return space->get_debug_contacts(); + +} + +int PhysicsServerSW::space_get_contact_count(RID p_space) const { + + SpaceSW *space = space_owner.get(p_space); + ERR_FAIL_COND_V(!space,0); + return space->get_debug_contact_count(); + +} + RID PhysicsServerSW::area_create() { AreaSW *area = memnew( AreaSW ); diff --git a/servers/physics/physics_server_sw.h b/servers/physics/physics_server_sw.h index 80007b8499..abbb057616 100644 --- a/servers/physics/physics_server_sw.h +++ b/servers/physics/physics_server_sw.h @@ -94,6 +94,9 @@ public: // this function only works on fixed process, errors and returns null otherwise virtual PhysicsDirectSpaceState* space_get_direct_state(RID p_space); + virtual void space_set_debug_contacts(RID p_space,int p_max_contacts); + virtual Vector<Vector3> space_get_contacts(RID p_space) const; + virtual int space_get_contact_count(RID p_space) const; /* AREA API */ diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp index d329a10f04..a4fe1dd3fc 100644 --- a/servers/physics/space_sw.cpp +++ b/servers/physics/space_sw.cpp @@ -640,7 +640,7 @@ void SpaceSW::call_queries() { void SpaceSW::setup() {
-
+ contact_debug_count=0;
while(inertia_update_list.first()) {
inertia_update_list.first()->self()->update_inertias();
inertia_update_list.remove(inertia_update_list.first());
@@ -651,6 +651,7 @@ void SpaceSW::setup() { void SpaceSW::update() {
+
broadphase->update();
}
@@ -712,6 +713,7 @@ SpaceSW::SpaceSW() { collision_pairs=0;
active_objects=0;
island_count=0;
+ contact_debug_count=0;
locked=false;
contact_recycle_radius=0.01;
diff --git a/servers/physics/space_sw.h b/servers/physics/space_sw.h index 16f5ad3c81..e88f61d881 100644 --- a/servers/physics/space_sw.h +++ b/servers/physics/space_sw.h @@ -103,6 +103,9 @@ class SpaceSW { RID static_global_body;
+ Vector<Vector3> contact_debug;
+ int contact_debug_count;
+
friend class PhysicsDirectSpaceStateSW;
public:
@@ -166,6 +169,11 @@ public: PhysicsDirectSpaceStateSW *get_direct_state();
+ void set_debug_contacts(int p_amount) { contact_debug.resize(p_amount); }
+ _FORCE_INLINE_ bool is_debugging_contacts() const { return !contact_debug.empty(); }
+ _FORCE_INLINE_ void add_debug_contact(const Vector3& p_contact) { if (contact_debug_count<contact_debug.size()) contact_debug[contact_debug_count++]=p_contact; }
+ _FORCE_INLINE_ Vector<Vector3> get_debug_contacts() { return contact_debug; }
+ _FORCE_INLINE_ int get_debug_contact_count() { return contact_debug_count; }
void set_static_global_body(RID p_body) { static_global_body=p_body; }
RID get_static_global_body() { return static_global_body; }
diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp index 6bfed134e6..eb3abbb267 100644 --- a/servers/physics_2d/body_pair_2d_sw.cpp +++ b/servers/physics_2d/body_pair_2d_sw.cpp @@ -379,7 +379,12 @@ bool BodyPair2DSW::setup(float p_step) { } c.active=true; - +#ifdef DEBUG_ENABLED + if (space->is_debugging_contacts()) { + space->add_debug_contact(global_A+offset_A); + space->add_debug_contact(global_B+offset_A); + } +#endif int gather_A = A->can_report_contacts(); int gather_B = B->can_report_contacts(); diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index b446f4928a..14b4c09ebc 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -257,6 +257,30 @@ real_t Physics2DServerSW::space_get_param(RID p_space,SpaceParameter p_param) co return space->get_param(p_param); } +void Physics2DServerSW::space_set_debug_contacts(RID p_space,int p_max_contacts) { + + Space2DSW *space = space_owner.get(p_space); + ERR_FAIL_COND(!space); + space->set_debug_contacts(p_max_contacts); + +} + +Vector<Vector2> Physics2DServerSW::space_get_contacts(RID p_space) const { + + Space2DSW *space = space_owner.get(p_space); + ERR_FAIL_COND_V(!space,Vector<Vector2>()); + return space->get_debug_contacts(); + +} + +int Physics2DServerSW::space_get_contact_count(RID p_space) const { + + Space2DSW *space = space_owner.get(p_space); + ERR_FAIL_COND_V(!space,0); + return space->get_debug_contact_count(); + +} + Physics2DDirectSpaceState* Physics2DServerSW::space_get_direct_state(RID p_space) { Space2DSW *space = space_owner.get(p_space); diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h index 6e875701b8..605e04ead8 100644 --- a/servers/physics_2d/physics_2d_server_sw.h +++ b/servers/physics_2d/physics_2d_server_sw.h @@ -102,6 +102,11 @@ public: virtual void space_set_param(RID p_space,SpaceParameter p_param, real_t p_value); virtual real_t space_get_param(RID p_space,SpaceParameter p_param) const; + virtual void space_set_debug_contacts(RID p_space,int p_max_contacts); + virtual Vector<Vector2> space_get_contacts(RID p_space) const; + virtual int space_get_contact_count(RID p_space) const; + + // this function only works on fixed process, errors and returns null otherwise virtual Physics2DDirectSpaceState* space_get_direct_state(RID p_space); diff --git a/servers/physics_2d/physics_2d_server_wrap_mt.h b/servers/physics_2d/physics_2d_server_wrap_mt.h index 0ddc8f16ec..54af3eeb99 100644 --- a/servers/physics_2d/physics_2d_server_wrap_mt.h +++ b/servers/physics_2d/physics_2d_server_wrap_mt.h @@ -94,6 +94,22 @@ public: return physics_2d_server->space_get_direct_state(p_space); } + FUNC2(space_set_debug_contacts,RID,int); + virtual Vector<Vector2> space_get_contacts(RID p_space) const { + + ERR_FAIL_COND_V(main_thread!=Thread::get_caller_ID(),Vector<Vector2>()); + return physics_2d_server->space_get_contacts(p_space); + + } + + virtual int space_get_contact_count(RID p_space) const { + + ERR_FAIL_COND_V(main_thread!=Thread::get_caller_ID(),0); + return physics_2d_server->space_get_contact_count(p_space); + + } + + /* AREA API */ diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 767ad9038d..a71e6c4bf5 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -1230,6 +1230,7 @@ void Space2DSW::call_queries() { void Space2DSW::setup() { + contact_debug_count=0; while(inertia_update_list.first()) { inertia_update_list.first()->self()->update_inertias(); @@ -1302,6 +1303,8 @@ Space2DSW::Space2DSW() { active_objects=0; island_count=0; + contact_debug_count=0; + locked=false; contact_recycle_radius=0.01; contact_max_separation=0.05; @@ -1320,6 +1323,10 @@ Space2DSW::Space2DSW() { direct_access = memnew( Physics2DDirectSpaceStateSW ); direct_access->space=this; + + + + } Space2DSW::~Space2DSW() { diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h index abee8628fc..97ad3d7f80 100644 --- a/servers/physics_2d/space_2d_sw.h +++ b/servers/physics_2d/space_2d_sw.h @@ -103,6 +103,9 @@ class Space2DSW { int _cull_aabb_for_body(Body2DSW *p_body,const Rect2& p_aabb); + Vector<Vector2> contact_debug; + int contact_debug_count; + friend class Physics2DDirectSpaceStateSW; public: @@ -169,6 +172,14 @@ public: bool test_body_motion(Body2DSW *p_body, const Vector2&p_motion, float p_margin, Physics2DServer::MotionResult *r_result); + + void set_debug_contacts(int p_amount) { contact_debug.resize(p_amount); } + _FORCE_INLINE_ bool is_debugging_contacts() const { return !contact_debug.empty(); } + _FORCE_INLINE_ void add_debug_contact(const Vector2& p_contact) { if (contact_debug_count<contact_debug.size()) contact_debug[contact_debug_count++]=p_contact; } + _FORCE_INLINE_ Vector<Vector2> get_debug_contacts() { return contact_debug; } + _FORCE_INLINE_ int get_debug_contact_count() { return contact_debug_count; } + + Physics2DDirectSpaceStateSW *get_direct_state(); Space2DSW(); diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index b24496880e..2d70337dc8 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -293,6 +293,9 @@ public: // this function only works on fixed process, errors and returns null otherwise virtual Physics2DDirectSpaceState* space_get_direct_state(RID p_space)=0; + virtual void space_set_debug_contacts(RID p_space,int p_max_contacts)=0; + virtual Vector<Vector2> space_get_contacts(RID p_space) const=0; + virtual int space_get_contact_count(RID p_space) const=0; //missing space parameters diff --git a/servers/physics_server.h b/servers/physics_server.h index b82d4cf5da..75584966bb 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -286,6 +286,9 @@ public: // this function only works on fixed process, errors and returns null otherwise virtual PhysicsDirectSpaceState* space_get_direct_state(RID p_space)=0; + virtual void space_set_debug_contacts(RID p_space,int p_max_contacts)=0; + virtual Vector<Vector3> space_get_contacts(RID p_space) const=0; + virtual int space_get_contact_count(RID p_space) const=0; //missing space parameters diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 155d10d85a..fbea60c3a6 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -454,6 +454,14 @@ AABB VisualServerRaster::mesh_get_custom_aabb(RID p_mesh) const { return rasterizer->mesh_get_custom_aabb(p_mesh); } +void VisualServerRaster::mesh_clear(RID p_mesh) { + + ERR_FAIL_COND(!rasterizer->is_mesh(p_mesh)); + while(rasterizer->mesh_get_surface_count(p_mesh)) { + rasterizer->mesh_remove_surface(p_mesh,0); + } +} + /* MULTIMESH */ diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 73298d58cd..3d8331984a 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -765,6 +765,7 @@ public: virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb); virtual AABB mesh_get_custom_aabb(RID p_mesh) const; + virtual void mesh_clear(RID p_mesh); /* MULTIMESH API */ diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index db03d82829..af88c9bdc9 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -199,6 +199,7 @@ public: FUNC2(mesh_remove_surface,RID,int); FUNC1RC(int,mesh_get_surface_count,RID); + FUNC1(mesh_clear,RID); FUNC2(mesh_set_custom_aabb,RID,const AABB&); diff --git a/servers/visual_server.h b/servers/visual_server.h index dd71650801..ece61ec701 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -353,6 +353,8 @@ public: virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb)=0; virtual AABB mesh_get_custom_aabb(RID p_mesh) const=0; + virtual void mesh_clear(RID p_mesh)=0; + /* MULTIMESH API */ virtual RID multimesh_create()=0; diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index 08697ab72d..432f358627 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -917,9 +917,9 @@ Error DocData::save(const String& p_path) { String qualifiers; if (m.qualifiers!="") - qualifiers+="qualifiers=\""+m.qualifiers.xml_escape()+"\""; + qualifiers+=" qualifiers=\""+m.qualifiers.xml_escape()+"\""; - _write_string(f,2,"<method name=\""+m.name+"\" "+qualifiers+" >"); + _write_string(f,2,"<method name=\""+m.name+"\""+qualifiers+">"); if (m.return_type!="") { diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index 84fc14d2ec..3b5b8fba81 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -842,6 +842,17 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func boot_splash=splash; } } + StringName custom_cursor; + { + String splash=Globals::get_singleton()->get("display/custom_mouse_cursor"); //avoid splash from being converted + splash=splash.strip_edges(); + if (splash!=String()) { + if (!splash.begins_with("res://")) + splash="res://"+splash; + splash=splash.simplify_path(); + custom_cursor=splash; + } + } @@ -853,7 +864,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func String src=files[i]; Vector<uint8_t> buf; - if (src==boot_splash) + if (src==boot_splash || src==custom_cursor) buf = get_exported_file_default(src); //bootsplash must be kept if used else buf = get_exported_file(src); @@ -942,11 +953,11 @@ static int _get_pad(int p_alignment, int p_n) { return pad; }; -void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, bool p_dumb, bool p_remote_debug) { +void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) { String host = EditorSettings::get_singleton()->get("network/debug_host"); - if (p_dumb) { + if (p_flags&EXPORT_DUMB_CLIENT) { int port = EditorSettings::get_singleton()->get("file_server/port"); String passwd = EditorSettings::get_singleton()->get("file_server/password"); r_flags.push_back("-rfs"); @@ -957,7 +968,7 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, bool p_dumb } } - if (p_remote_debug) { + if (p_flags&EXPORT_REMOTE_DEBUG) { r_flags.push_back("-rdebug"); r_flags.push_back(host+":"+String::num(GLOBAL_DEF("debug/debug_port", 6007))); @@ -982,6 +993,17 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, bool p_dumb } + if (p_flags&EXPORT_VIEW_COLLISONS) { + + r_flags.push_back("-debugcol"); + } + + if (p_flags&EXPORT_VIEW_NAVIGATION) { + + r_flags.push_back("-debugnav"); + } + + } Error EditorExportPlatform::save_pack_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total) { @@ -1097,7 +1119,7 @@ Error EditorExportPlatform::save_pack(FileAccess *dst,bool p_make_bundles, int p return OK; } -Error EditorExportPlatformPC::export_project(const String& p_path, bool p_debug, bool p_dumb,bool p_remote_debug) { +Error EditorExportPlatformPC::export_project(const String& p_path, bool p_debug, int p_flags) { diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h index d8601929cf..9de6509605 100644 --- a/tools/editor/editor_import_export.h +++ b/tools/editor/editor_import_export.h @@ -105,7 +105,7 @@ protected: }; - void gen_export_flags(Vector<String> &r_flags,bool p_dumb,bool p_remote_debug); + void gen_export_flags(Vector<String> &r_flags, int p_flags); static Error save_pack_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total); public: @@ -121,6 +121,13 @@ public: IMAGE_COMPRESSION_ETC2, // ericsson new compression format (can handle alpha) }; + enum ExportFlags { + EXPORT_DUMB_CLIENT=1, + EXPORT_REMOTE_DEBUG=2, + EXPORT_VIEW_COLLISONS=4, + EXPORT_VIEW_NAVIGATION=8 + }; + Error export_project_files(EditorExportSaveFunction p_func, void* p_udata,bool p_make_bundles); @@ -133,14 +140,14 @@ public: virtual int get_device_count() const { return 0; } virtual String get_device_name(int p_device) const { return ""; } virtual String get_device_info(int p_device) const { return ""; } - virtual Error run(int p_device,bool p_dumb=false,bool p_remote_debug=false) { return OK; } + virtual Error run(int p_device,int p_flags) { return OK; } virtual bool can_export(String *r_error=NULL) const=0; virtual bool requieres_password(bool p_debug) const { return false; } virtual String get_binary_extension() const=0; - virtual Error export_project(const String& p_path,bool p_debug,bool p_dumb=false,bool p_remote_debug=false)=0; + virtual Error export_project(const String& p_path,bool p_debug,int p_flags=0)=0; EditorExportPlatform() {}; }; @@ -190,7 +197,7 @@ public: virtual ImageCompression get_image_compression() const { return IMAGE_COMPRESSION_BC; } virtual String get_binary_extension() const { return binary_extension; } - virtual Error export_project(const String& p_path, bool p_debug, bool p_dumb=false, bool p_remote_debug=false); + virtual Error export_project(const String& p_path, bool p_debug, int p_flags=0); virtual void set_release_binary32(const String& p_binary) { release_binary32=p_binary; } virtual void set_debug_binary32(const String& p_binary) { debug_binary32=p_binary; } virtual void set_release_binary64(const String& p_binary) { release_binary64=p_binary; } diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 63684dcc93..4f5755bd3d 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -58,6 +58,7 @@ // plugins #include "plugins/sprite_frames_editor_plugin.h" +#include "plugins/sprite_region_editor_plugin.h" #include "plugins/canvas_item_editor_plugin.h" #include "plugins/spatial_editor_plugin.h" #include "plugins/sample_editor_plugin.h" @@ -93,7 +94,7 @@ #include "plugins/light_occluder_2d_editor_plugin.h" #include "plugins/color_ramp_editor_plugin.h" #include "plugins/collision_shape_2d_editor_plugin.h" -#include "os/input.h" +#include "main/input_default.h" // end #include "tools/editor/io_plugins/editor_texture_import_plugin.h" #include "tools/editor/io_plugins/editor_scene_import_plugin.h" @@ -2677,6 +2678,20 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { run_native->set_deploy_debug_remote(!ischecked); } break; + case RUN_DEBUG_COLLISONS: { + + bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS)); + debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS),!ischecked); + run_native->set_debug_collisions(!ischecked); + editor_run.set_debug_collisions(!ischecked); + } break; + case RUN_DEBUG_NAVIGATION: { + + bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION)); + debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION),!ischecked); + run_native->set_debug_navigation(!ischecked); + editor_run.set_debug_navigation(!ischecked); + } break; case SETTINGS_UPDATE_ALWAYS: { update_menu->get_popup()->set_item_checked(0,true); @@ -4390,11 +4405,15 @@ EditorNode::EditorNode() { EditorHelp::generate_doc(); //before any editor classes are crated - if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton()) { - //only if no touchscreen ui hint, set emulation - InputDefault *id = Input::get_singleton()->cast_to<InputDefault>(); - if (id) + InputDefault *id = Input::get_singleton()->cast_to<InputDefault>(); + + if (id) { + + if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton()) { + //only if no touchscreen ui hint, set emulation id->set_emulate_touch(false); //just disable just in case + } + id->set_custom_mouse_cursor(RES()); } @@ -4955,6 +4974,9 @@ EditorNode::EditorNode() { p->add_separator(); p->add_check_item("Deploy Remote Debug",RUN_DEPLOY_REMOTE_DEBUG); p->add_check_item("Deploy File Server Clients",RUN_DEPLOY_DUMB_CLIENTS); + p->add_separator(); + p->add_check_item("Visible Collision Shapes",RUN_DEBUG_COLLISONS); + p->add_check_item("Visible Navigation",RUN_DEBUG_NAVIGATION); p->connect("item_pressed",this,"_menu_option"); /* @@ -5454,6 +5476,7 @@ EditorNode::EditorNode() { add_editor_plugin( memnew( TileSetEditorPlugin(this) ) ); add_editor_plugin( memnew( TileMapEditorPlugin(this) ) ); add_editor_plugin( memnew( SpriteFramesEditorPlugin(this) ) ); + add_editor_plugin( memnew( SpriteRegionEditorPlugin(this) ) ); add_editor_plugin( memnew( Particles2DEditorPlugin(this) ) ); add_editor_plugin( memnew( Path2DEditorPlugin(this) ) ); add_editor_plugin( memnew( PathEditorPlugin(this) ) ); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index dba2b7b86c..53e16d9c58 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -156,6 +156,8 @@ class EditorNode : public Node { RUN_FILE_SERVER, RUN_DEPLOY_DUMB_CLIENTS, RUN_LIVE_DEBUG, + RUN_DEBUG_COLLISONS, + RUN_DEBUG_NAVIGATION, RUN_DEPLOY_REMOTE_DEBUG, SETTINGS_UPDATE_ALWAYS, SETTINGS_UPDATE_CHANGES, diff --git a/tools/editor/editor_run.cpp b/tools/editor/editor_run.cpp index 4d07463b21..b635cea84b 100644 --- a/tools/editor/editor_run.cpp +++ b/tools/editor/editor_run.cpp @@ -61,6 +61,13 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List } } + if (debug_collisions) { + args.push_back("-debugcol"); + } + + if (debug_navigation) { + args.push_back("-debugnav"); + } int screen = EditorSettings::get_singleton()->get("game_window_placement/screen"); @@ -169,7 +176,31 @@ void EditorRun::stop() { status=STATUS_STOP; } +void EditorRun::set_debug_collisions(bool p_debug) { + + debug_collisions=p_debug; +} + +bool EditorRun::get_debug_collisions() const{ + + return debug_collisions; +} + +void EditorRun::set_debug_navigation(bool p_debug) { + + debug_navigation=p_debug; +} + +bool EditorRun::get_debug_navigation() const{ + + return debug_navigation; +} + + EditorRun::EditorRun() { status=STATUS_STOP; + debug_collisions=false; + debug_navigation=false; + } diff --git a/tools/editor/editor_run.h b/tools/editor/editor_run.h index 402d5e3820..e1b0b081c7 100644 --- a/tools/editor/editor_run.h +++ b/tools/editor/editor_run.h @@ -43,6 +43,8 @@ public: OS::ProcessID pid; private: + bool debug_collisions; + bool debug_navigation; Status status; public: @@ -50,6 +52,13 @@ public: Error run(const String& p_scene,const String p_custom_args,const List<String>& p_breakpoints,const String& p_edited_scene); void run_native_notify() { status=STATUS_PLAY; } void stop(); + + void set_debug_collisions(bool p_debug); + bool get_debug_collisions() const; + + void set_debug_navigation(bool p_debug); + bool get_debug_navigation() const; + EditorRun(); }; diff --git a/tools/editor/editor_run_native.cpp b/tools/editor/editor_run_native.cpp index 42c7f89608..2eedba93dc 100644 --- a/tools/editor/editor_run_native.cpp +++ b/tools/editor/editor_run_native.cpp @@ -105,7 +105,17 @@ void EditorRunNative::_run_native(int p_idx,const String& p_platform) { emit_signal("native_run"); } - eep->run(p_idx,deploy_dumb,deploy_debug_remote); + int flags=0; + if (deploy_debug_remote) + flags|=EditorExportPlatform::EXPORT_REMOTE_DEBUG; + if (deploy_dumb) + flags|=EditorExportPlatform::EXPORT_DUMB_CLIENT; + if (debug_collisions) + flags|=EditorExportPlatform::EXPORT_VIEW_COLLISONS; + if (debug_navigation) + flags|=EditorExportPlatform::EXPORT_VIEW_NAVIGATION; + + eep->run(p_idx,flags); } void EditorRunNative::_bind_methods() { @@ -135,6 +145,25 @@ bool EditorRunNative::is_deploy_debug_remote_enabled() const{ return deploy_debug_remote; } +void EditorRunNative::set_debug_collisions(bool p_debug) { + + debug_collisions=p_debug; +} + +bool EditorRunNative::get_debug_collisions() const{ + + return debug_collisions; +} + +void EditorRunNative::set_debug_navigation(bool p_debug) { + + debug_navigation=p_debug; +} + +bool EditorRunNative::get_debug_navigation() const{ + + return debug_navigation; +} EditorRunNative::EditorRunNative() { @@ -142,4 +171,7 @@ EditorRunNative::EditorRunNative() first=true; deploy_dumb=false; deploy_debug_remote=false; + debug_collisions=false; + debug_navigation=false; + } diff --git a/tools/editor/editor_run_native.h b/tools/editor/editor_run_native.h index a0baf527f1..77d6dc198e 100644 --- a/tools/editor/editor_run_native.h +++ b/tools/editor/editor_run_native.h @@ -40,6 +40,8 @@ class EditorRunNative : public HBoxContainer { bool first; bool deploy_dumb; bool deploy_debug_remote; + bool debug_collisions; + bool debug_navigation; void _run_native(int p_idx,const String& p_platform); @@ -55,6 +57,12 @@ public: void set_deploy_debug_remote(bool p_enabled); bool is_deploy_debug_remote_enabled() const; + void set_debug_collisions(bool p_debug); + bool get_debug_collisions() const; + + void set_debug_navigation(bool p_debug); + bool get_debug_navigation() const; + EditorRunNative(); }; diff --git a/tools/editor/icons/icon_grid.png b/tools/editor/icons/icon_grid.png Binary files differnew file mode 100644 index 0000000000..dcdd86c9b5 --- /dev/null +++ b/tools/editor/icons/icon_grid.png diff --git a/tools/editor/icons/icon_region_edit.png b/tools/editor/icons/icon_region_edit.png Binary files differnew file mode 100644 index 0000000000..824607f2cc --- /dev/null +++ b/tools/editor/icons/icon_region_edit.png diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 344e42c13b..f8c484e886 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -1393,6 +1393,7 @@ AnimationPlayerEditorPlugin::AnimationPlayerEditorPlugin(EditorNode *p_node) { editor=p_node; anim_editor = memnew( AnimationPlayerEditor(editor) ); + anim_editor->set_undo_redo(editor->get_undo_redo()); editor->get_animation_panel()->add_child(anim_editor); /* editor->get_viewport()->add_child(anim_editor); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index d25880fdff..3029dcf2ab 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -50,6 +50,9 @@ void Polygon2DEditor::_notification(int p_what) { uv_button[UV_MODE_ROTATE]->set_icon(get_icon("ToolRotate","EditorIcons")); uv_button[UV_MODE_SCALE]->set_icon(get_icon("ToolScale","EditorIcons")); + b_snap_grid->set_icon( get_icon("Grid", "EditorIcons")); + b_snap_enable->set_icon( get_icon("Snap", "EditorIcons")); + uv_icon_zoom->set_texture( get_icon("Zoom", "EditorIcons")); } break; case NOTIFICATION_FIXED_PROCESS: { @@ -158,6 +161,41 @@ void Polygon2DEditor::_menu_option(int p_option) { } } +void Polygon2DEditor::_set_use_snap(bool p_use) +{ + use_snap=p_use; +} + +void Polygon2DEditor::_set_show_grid(bool p_show) +{ + snap_show_grid=p_show; + uv_edit_draw->update(); +} + +void Polygon2DEditor::_set_snap_off_x(float p_val) +{ + snap_offset.x=p_val; + uv_edit_draw->update(); +} + +void Polygon2DEditor::_set_snap_off_y(float p_val) +{ + snap_offset.y=p_val; + uv_edit_draw->update(); +} + +void Polygon2DEditor::_set_snap_step_x(float p_val) +{ + snap_step.x=p_val; + uv_edit_draw->update(); +} + +void Polygon2DEditor::_set_snap_step_y(float p_val) +{ + snap_step.y=p_val; + uv_edit_draw->update(); +} + void Polygon2DEditor::_wip_close() { undo_redo->create_action("Create Poly"); @@ -494,7 +532,7 @@ void Polygon2DEditor::_uv_input(const InputEvent& p_input) { Vector2 tuv=mtx.xform(uv_prev[i]); if (tuv.distance_to(Vector2(mb.x,mb.y))<8) { - + uv_drag_from=tuv; uv_drag_index=i; } } @@ -545,7 +583,7 @@ void Polygon2DEditor::_uv_input(const InputEvent& p_input) { } else if (uv_drag) { - Vector2 uv_drag_to(mm.x,mm.y); + Vector2 uv_drag_to=snap_point(Vector2(mm.x,mm.y)); Vector2 drag = mtx.affine_inverse().xform(uv_drag_to) - mtx.affine_inverse().xform(uv_drag_from); @@ -649,6 +687,33 @@ void Polygon2DEditor::_uv_draw() { uv_edit_draw->draw_texture(base_tex,Point2()); VS::get_singleton()->canvas_item_add_set_transform(uv_edit_draw->get_canvas_item(),Matrix32()); + if (snap_show_grid) { + Size2 s = uv_edit_draw->get_size(); + int last_cell; + + if (snap_step.x!=0) { + for(int i=0;i<s.width;i++) { + int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(i,0)).x-snap_offset.x)/snap_step.x)); + if (i==0) + last_cell=cell; + if (last_cell!=cell) + uv_edit_draw->draw_line(Point2(i,0),Point2(i,s.height),Color(0.3,0.7,1,0.3)); + last_cell=cell; + } + } + + if (snap_step.y!=0) { + for(int i=0;i<s.height;i++) { + int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(0,i)).y-snap_offset.y)/snap_step.y)); + if (i==0) + last_cell=cell; + if (last_cell!=cell) + uv_edit_draw->draw_line(Point2(0,i),Point2(s.width,i),Color(0.3,0.7,1,0.3)); + last_cell=cell; + } + } + } + DVector<Vector2> uvs = node->get_uv(); Ref<Texture> handle = get_icon("EditorHandle","EditorIcons"); @@ -720,8 +785,27 @@ void Polygon2DEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_uv_input"),&Polygon2DEditor::_uv_input); ObjectTypeDB::bind_method(_MD("_uv_scroll_changed"),&Polygon2DEditor::_uv_scroll_changed); ObjectTypeDB::bind_method(_MD("_node_removed"),&Polygon2DEditor::_node_removed); + ObjectTypeDB::bind_method(_MD("_set_use_snap"),&Polygon2DEditor::_set_use_snap); + ObjectTypeDB::bind_method(_MD("_set_show_grid"),&Polygon2DEditor::_set_show_grid); + ObjectTypeDB::bind_method(_MD("_set_snap_off_x"),&Polygon2DEditor::_set_snap_off_x); + ObjectTypeDB::bind_method(_MD("_set_snap_off_y"),&Polygon2DEditor::_set_snap_off_y); + ObjectTypeDB::bind_method(_MD("_set_snap_step_x"),&Polygon2DEditor::_set_snap_step_x); + ObjectTypeDB::bind_method(_MD("_set_snap_step_y"),&Polygon2DEditor::_set_snap_step_y); + +} +inline float _snap_scalar(float p_offset, float p_step, float p_target) { + return p_step != 0 ? Math::stepify(p_target - p_offset, p_step) + p_offset : p_target; +} + +Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const { + if (use_snap) { + p_target.x = _snap_scalar(snap_offset.x*uv_draw_zoom-uv_draw_ofs.x, snap_step.x*uv_draw_zoom, p_target.x); + p_target.y = _snap_scalar(snap_offset.y*uv_draw_zoom-uv_draw_ofs.y, snap_step.y*uv_draw_zoom, p_target.y); + } + + return p_target; } Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) { @@ -731,6 +815,10 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) { editor=p_editor; undo_redo = editor->get_undo_redo(); + snap_step=Vector2(10,10); + use_snap=false; + snap_show_grid=false; + add_child( memnew( VSeparator )); button_create = memnew( ToolButton ); add_child(button_create); @@ -800,9 +888,72 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) { uv_menu->get_popup()->add_separator(); uv_menu->get_popup()->add_item("Clear UV",UVEDIT_UV_CLEAR); uv_menu->get_popup()->connect("item_pressed",this,"_menu_option"); + + uv_mode_hb->add_child( memnew( VSeparator )); + + b_snap_enable = memnew( ToolButton ); + uv_mode_hb->add_child(b_snap_enable); + b_snap_enable->set_text("Snap"); + b_snap_enable->set_focus_mode(FOCUS_NONE); + b_snap_enable->set_toggle_mode(true); + b_snap_enable->set_pressed(use_snap); + b_snap_enable->set_tooltip("Enable Snap"); + b_snap_enable->connect("toggled",this,"_set_use_snap"); + + b_snap_grid = memnew( ToolButton ); + uv_mode_hb->add_child(b_snap_grid); + b_snap_grid->set_text("Grid"); + b_snap_grid->set_focus_mode(FOCUS_NONE); + b_snap_grid->set_toggle_mode(true); + b_snap_grid->set_pressed(snap_show_grid); + b_snap_grid->set_tooltip("Show Grid"); + b_snap_grid->connect("toggled",this,"_set_show_grid"); + + uv_mode_hb->add_child( memnew( VSeparator )); + uv_mode_hb->add_child( memnew( Label("Grid Offset:") ) ); + + SpinBox *sb_off_x = memnew( SpinBox ); + sb_off_x->set_min(-256); + sb_off_x->set_max(256); + sb_off_x->set_step(1); + sb_off_x->set_val(snap_offset.x); + sb_off_x->set_suffix("px"); + sb_off_x->connect("value_changed", this, "_set_snap_off_x"); + uv_mode_hb->add_child(sb_off_x); + + SpinBox *sb_off_y = memnew( SpinBox ); + sb_off_y->set_min(-256); + sb_off_y->set_max(256); + sb_off_y->set_step(1); + sb_off_y->set_val(snap_offset.y); + sb_off_y->set_suffix("px"); + sb_off_y->connect("value_changed", this, "_set_snap_off_y"); + uv_mode_hb->add_child(sb_off_y); + + uv_mode_hb->add_child( memnew( VSeparator )); + uv_mode_hb->add_child( memnew( Label("Grid Step:") ) ); + + SpinBox *sb_step_x = memnew( SpinBox ); + sb_step_x->set_min(-256); + sb_step_x->set_max(256); + sb_step_x->set_step(1); + sb_step_x->set_val(snap_step.x); + sb_step_x->set_suffix("px"); + sb_step_x->connect("value_changed", this, "_set_snap_step_x"); + uv_mode_hb->add_child(sb_step_x); + + SpinBox *sb_step_y = memnew( SpinBox ); + sb_step_y->set_min(-256); + sb_step_y->set_max(256); + sb_step_y->set_step(1); + sb_step_y->set_val(snap_step.y); + sb_step_y->set_suffix("px"); + sb_step_y->connect("value_changed", this, "_set_snap_step_y"); + uv_mode_hb->add_child(sb_step_y); + uv_mode_hb->add_child( memnew( VSeparator )); uv_icon_zoom = memnew( TextureFrame ); - uv_main_hb->add_child( uv_icon_zoom ); + uv_mode_hb->add_child( uv_icon_zoom ); uv_zoom = memnew( HSlider ); uv_zoom->set_min(0.01); uv_zoom->set_max(4); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.h b/tools/editor/plugins/polygon_2d_editor_plugin.h index 8f807cb7e8..0939c44264 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/polygon_2d_editor_plugin.h @@ -41,6 +41,8 @@ class Polygon2DEditor : public HBoxContainer { UVMode uv_mode; AcceptDialog *uv_edit; ToolButton *uv_button[4]; + ToolButton *b_snap_enable; + ToolButton *b_snap_grid; Control *uv_edit_draw; HSlider *uv_zoom; SpinBox *uv_zoom_value; @@ -78,6 +80,11 @@ class Polygon2DEditor : public HBoxContainer { Vector<Vector2> wip; bool wip_active; + bool use_snap; + bool snap_show_grid; + Vector2 snap_offset; + Vector2 snap_step; + void _uv_scroll_changed(float); void _uv_input(const InputEvent& p_input); void _uv_draw(); @@ -86,10 +93,20 @@ class Polygon2DEditor : public HBoxContainer { void _canvas_draw(); void _menu_option(int p_option); + void _set_use_snap(bool p_use); + void _set_show_grid(bool p_show); + void _set_snap_off_x(float p_val); + void _set_snap_off_y(float p_val); + void _set_snap_step_x(float p_val); + void _set_snap_step_y(float p_val); + protected: void _notification(int p_what); void _node_removed(Node *p_node); static void _bind_methods(); + + Vector2 snap_point(Vector2 p_target) const; + public: bool forward_input_event(const InputEvent& p_event); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 302e4f2196..bd0f580a34 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -211,7 +211,6 @@ void ScriptEditorQuickOpen::_bind_methods() { ObjectTypeDB::bind_method(_MD("_confirmed"),&ScriptEditorQuickOpen::_confirmed); ObjectTypeDB::bind_method(_MD("_sbox_input"),&ScriptEditorQuickOpen::_sbox_input); - ADD_SIGNAL(MethodInfo("goto_line",PropertyInfo(Variant::INT,"line"))); } @@ -547,6 +546,10 @@ void ScriptEditor::_show_debugger(bool p_show) { } +void ScriptEditor::_script_created(Ref<Script> p_script) { + editor->push_item(p_script.operator->()); +} + void ScriptEditor::_goto_script_line2(int p_line) { int selected = tab_container->get_current_tab(); @@ -574,7 +577,7 @@ void ScriptEditor::_close_current_tab() { int selected = tab_container->get_current_tab(); if (selected<0 || selected>=tab_container->get_child_count()) return; - + ScriptTextEditor *current = tab_container->get_child(selected)->cast_to<ScriptTextEditor>(); if (!current) return; @@ -753,7 +756,6 @@ void ScriptEditor::_menu_option(int p_option) { if (p_option==FILE_OPEN) { - editor->open_resource("Script"); return; } @@ -766,8 +768,11 @@ void ScriptEditor::_menu_option(int p_option) { return; switch(p_option) { + case FILE_NEW: { + script_create_dialog->config("Node", ".gd"); + script_create_dialog->popup_centered(Size2(300, 300)); + } break; case FILE_SAVE: { - if (!_test_script_times_on_disk()) return; editor->save_resource( current->get_edited_script() ); @@ -1419,6 +1424,7 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_update_script_names",&ScriptEditor::_update_script_names); ObjectTypeDB::bind_method("_tree_changed",&ScriptEditor::_tree_changed); ObjectTypeDB::bind_method("_script_selected",&ScriptEditor::_script_selected); + ObjectTypeDB::bind_method("_script_created",&ScriptEditor::_script_created); ObjectTypeDB::bind_method("_script_split_dragged",&ScriptEditor::_script_split_dragged); } @@ -1803,6 +1809,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu = memnew( MenuButton ); menu_hb->add_child(file_menu); file_menu->set_text("File"); + file_menu->get_popup()->add_item("New",FILE_NEW); file_menu->get_popup()->add_item("Open",FILE_OPEN); file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_item("Save",FILE_SAVE,KEY_MASK_ALT|KEY_MASK_CMD|KEY_S); @@ -1899,6 +1906,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { add_child(erase_tab_confirm); erase_tab_confirm->connect("confirmed", this,"_close_current_tab"); + script_create_dialog = memnew(ScriptCreateDialog); + script_create_dialog->set_title("Create Script"); + add_child(script_create_dialog); + script_create_dialog->connect("script_created", this, "_script_created"); goto_line_dialog = memnew(GotoLineDialog); add_child(goto_line_dialog); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 59173068fb..e635a1974b 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -30,6 +30,7 @@ #define SCRIPT_EDITOR_PLUGIN_H #include "tools/editor/editor_plugin.h" +#include "tools/editor/script_create_dialog.h" #include "scene/gui/tab_container.h" #include "scene/gui/text_edit.h" #include "scene/gui/menu_button.h" @@ -115,7 +116,7 @@ class ScriptEditor : public VBoxContainer { EditorNode *editor; enum { - + FILE_NEW, FILE_OPEN, FILE_SAVE, FILE_SAVE_AS, @@ -167,6 +168,7 @@ class ScriptEditor : public VBoxContainer { FindReplaceDialog *find_replace_dialog; GotoLineDialog *goto_line_dialog; ConfirmationDialog *erase_tab_confirm; + ScriptCreateDialog *script_create_dialog; ScriptEditorDebugger* debugger; ToolButton *scripts_visible; @@ -207,6 +209,7 @@ class ScriptEditor : public VBoxContainer { void _breaked(bool p_breaked,bool p_can_debug); void _show_debugger(bool p_show); void _update_window_menu(); + void _script_created(Ref<Script> p_script); void _editor_settings_changed(); void _autosave_scripts(); diff --git a/tools/editor/plugins/sprite_region_editor_plugin.cpp b/tools/editor/plugins/sprite_region_editor_plugin.cpp new file mode 100644 index 0000000000..35c53cf562 --- /dev/null +++ b/tools/editor/plugins/sprite_region_editor_plugin.cpp @@ -0,0 +1,565 @@ +/*************************************************************************/ +/* sprite_region_editor_plugin.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Author: Mariano Suligoy */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "sprite_region_editor_plugin.h" +#include "scene/gui/check_box.h" +#include "os/input.h" +#include "os/keyboard.h" + +void SpriteRegionEditor::_region_draw() +{ + Ref<Texture> base_tex = node->get_texture(); + if (base_tex.is_null()) + return; + + Matrix32 mtx; + mtx.elements[2]=-draw_ofs; + mtx.scale_basis(Vector2(draw_zoom,draw_zoom)); + + VS::get_singleton()->canvas_item_set_clip(edit_draw->get_canvas_item(),true); + VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(),mtx); + edit_draw->draw_texture(base_tex,Point2()); + VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(),Matrix32()); + + if (snap_show_grid) { + Size2 s = edit_draw->get_size(); + int last_cell; + + if (snap_step.x!=0) { + for(int i=0;i<s.width;i++) { + int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(i,0)).x-snap_offset.x)/snap_step.x)); + if (i==0) + last_cell=cell; + if (last_cell!=cell) + edit_draw->draw_line(Point2(i,0),Point2(i,s.height),Color(0.3,0.7,1,0.3)); + last_cell=cell; + } + } + + if (snap_step.y!=0) { + for(int i=0;i<s.height;i++) { + int cell = Math::fast_ftoi(Math::floor((mtx.affine_inverse().xform(Vector2(0,i)).y-snap_offset.y)/snap_step.y)); + if (i==0) + last_cell=cell; + if (last_cell!=cell) + edit_draw->draw_line(Point2(0,i),Point2(s.width,i),Color(0.3,0.7,1,0.3)); + last_cell=cell; + } + } + } + + Ref<Texture> select_handle = get_icon("EditorHandle","EditorIcons"); + + Rect2 scroll_rect(Point2(),mtx.basis_xform(base_tex->get_size())); + scroll_rect.expand_to(mtx.basis_xform(edit_draw->get_size())); + + Vector2 endpoints[4]={ + mtx.basis_xform(rect.pos), + mtx.basis_xform(rect.pos+Vector2(rect.size.x,0)), + mtx.basis_xform(rect.pos+rect.size), + mtx.basis_xform(rect.pos+Vector2(0,rect.size.y)) + }; + + for(int i=0;i<4;i++) { + + int prev = (i+3)%4; + int next = (i+1)%4; + + Vector2 ofs = ((endpoints[i] - endpoints[prev]).normalized() + ((endpoints[i] - endpoints[next]).normalized())).normalized(); + ofs*=1.4144*(select_handle->get_size().width/2); + + edit_draw->draw_line(endpoints[i]-draw_ofs, endpoints[next]-draw_ofs, Color(0.9,0.5,0.5), 2); + + edit_draw->draw_texture(select_handle,(endpoints[i]+ofs-(select_handle->get_size()/2)).floor()-draw_ofs); + + ofs = (endpoints[next]-endpoints[i])/2; + ofs += (endpoints[next]-endpoints[i]).tangent().normalized()*(select_handle->get_size().width/2); + + edit_draw->draw_texture(select_handle,(endpoints[i]+ofs-(select_handle->get_size()/2)).floor()-draw_ofs); + + scroll_rect.expand_to(endpoints[i]); + } + + scroll_rect=scroll_rect.grow(200); + updating_scroll=true; + hscroll->set_min(scroll_rect.pos.x); + hscroll->set_max(scroll_rect.pos.x+scroll_rect.size.x); + hscroll->set_page(edit_draw->get_size().x); + hscroll->set_val(draw_ofs.x); + hscroll->set_step(0.001); + + vscroll->set_min(scroll_rect.pos.y); + vscroll->set_max(scroll_rect.pos.y+scroll_rect.size.y); + vscroll->set_page(edit_draw->get_size().y); + vscroll->set_val(draw_ofs.y); + vscroll->set_step(0.001); + updating_scroll=false; +} + +void SpriteRegionEditor::_region_input(const InputEvent& p_input) +{ + Matrix32 mtx; + mtx.elements[2]=-draw_ofs; + mtx.scale_basis(Vector2(draw_zoom,draw_zoom)); + + Vector2 endpoints[8]={ + mtx.xform(rect.pos)+Vector2(-4,-4), + mtx.xform(rect.pos+Vector2(rect.size.x/2,0))+Vector2(0,-4), + mtx.xform(rect.pos+Vector2(rect.size.x,0))+Vector2(4,-4), + mtx.xform(rect.pos+Vector2(rect.size.x,rect.size.y/2))+Vector2(4,0), + mtx.xform(rect.pos+rect.size)+Vector2(4,4), + mtx.xform(rect.pos+Vector2(rect.size.x/2,rect.size.y))+Vector2(0,4), + mtx.xform(rect.pos+Vector2(0,rect.size.y))+Vector2(-4,4), + mtx.xform(rect.pos+Vector2(0,rect.size.y/2))+Vector2(-4,0) + }; + + if (p_input.type==InputEvent::MOUSE_BUTTON) { + + + const InputEventMouseButton &mb=p_input.mouse_button; + + if (mb.button_index==BUTTON_LEFT) { + + + if (mb.pressed) { + + drag_from=mtx.affine_inverse().xform(Vector2(mb.x,mb.y)); + drag_from=snap_point(drag_from); + drag=true; + rect_prev=node->get_region_rect(); + + drag_index=-1; + for(int i=0;i<8;i++) { + + Vector2 tuv=endpoints[i]; + if (tuv.distance_to(Vector2(mb.x,mb.y))<8) { + drag_index=i; + creating = false; + } + } + + if (drag_index==-1) { + creating = true; + rect = Rect2(drag_from,Size2()); + } + + } else if (drag) { + + undo_redo->create_action("Set region_rect"); + undo_redo->add_do_method(node,"set_region_rect",node->get_region_rect()); + undo_redo->add_undo_method(node,"set_region_rect",rect_prev); + undo_redo->add_do_method(edit_draw,"update"); + undo_redo->add_undo_method(edit_draw,"update"); + undo_redo->commit_action(); + + drag=false; + } + + } else if (mb.button_index==BUTTON_RIGHT && mb.pressed) { + + if (drag) { + drag=false; + node->set_region_rect(rect_prev); + rect=rect_prev; + edit_draw->update(); + } + + } else if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed) { + + zoom->set_val( zoom->get_val()/0.9 ); + } else if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed) { + + zoom->set_val( zoom->get_val()*0.9); + } + + } else if (p_input.type==InputEvent::MOUSE_MOTION) { + + const InputEventMouseMotion &mm=p_input.mouse_motion; + + if (mm.button_mask&BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) { + + Vector2 draged(mm.relative_x,mm.relative_y); + hscroll->set_val( hscroll->get_val()-draged.x ); + vscroll->set_val( vscroll->get_val()-draged.y ); + + } else if (drag) { + + Vector2 new_pos = mtx.affine_inverse().xform(Vector2(mm.x,mm.y)); + new_pos = snap_point(new_pos); + + if (creating) { + rect = Rect2(drag_from,Size2()); + rect.expand_to(new_pos); + node->set_region_rect(rect); + edit_draw->update(); + return; + } + + switch(drag_index) { + case 0: { + Vector2 p=rect_prev.pos+rect_prev.size; + rect = Rect2(p,Size2()); + rect.expand_to(new_pos); + node->set_region_rect(rect); + } break; + case 1: { + Vector2 p=rect_prev.pos+Vector2(0,rect_prev.size.y); + rect = Rect2(p,Size2(rect_prev.size.x,0)); + rect.expand_to(new_pos); + node->set_region_rect(rect); + } break; + case 2: { + Vector2 p=rect_prev.pos+Vector2(0,rect_prev.size.y); + rect = Rect2(p,Size2()); + rect.expand_to(new_pos); + node->set_region_rect(rect); + } break; + case 3: { + Vector2 p=rect_prev.pos; + rect = Rect2(p,Size2(0,rect_prev.size.y)); + rect.expand_to(new_pos); + node->set_region_rect(rect); + } break; + case 4: { + Vector2 p=rect_prev.pos; + rect = Rect2(p,Size2()); + rect.expand_to(new_pos); + node->set_region_rect(rect); + } break; + case 5: { + Vector2 p=rect_prev.pos; + rect = Rect2(p,Size2(rect_prev.size.x,0)); + rect.expand_to(new_pos); + node->set_region_rect(rect); + } break; + case 6: { + Vector2 p=rect_prev.pos+Vector2(rect_prev.size.x,0); + rect = Rect2(p,Size2()); + rect.expand_to(new_pos); + node->set_region_rect(rect); + } break; + case 7: { + Vector2 p=rect_prev.pos+Vector2(rect_prev.size.x,0); + rect = Rect2(p,Size2(0,rect_prev.size.y)); + rect.expand_to(new_pos); + node->set_region_rect(rect); + } break; + + } + edit_draw->update(); + } + + } +} + +void SpriteRegionEditor::_scroll_changed(float) +{ + if (updating_scroll) + return; + + draw_ofs.x=hscroll->get_val(); + draw_ofs.y=vscroll->get_val(); + draw_zoom=zoom->get_val(); + print_line("_scroll_changed"); + edit_draw->update(); +} + +void SpriteRegionEditor::_set_use_snap(bool p_use) +{ + use_snap=p_use; +} + +void SpriteRegionEditor::_set_show_grid(bool p_show) +{ + snap_show_grid=p_show; + edit_draw->update(); +} + +void SpriteRegionEditor::_set_snap_off_x(float p_val) +{ + snap_offset.x=p_val; + edit_draw->update(); +} + +void SpriteRegionEditor::_set_snap_off_y(float p_val) +{ + snap_offset.y=p_val; + edit_draw->update(); +} + +void SpriteRegionEditor::_set_snap_step_x(float p_val) +{ + snap_step.x=p_val; + edit_draw->update(); +} + +void SpriteRegionEditor::_set_snap_step_y(float p_val) +{ + snap_step.y=p_val; + edit_draw->update(); +} + +void SpriteRegionEditor::_notification(int p_what) +{ + switch(p_what) { + + case NOTIFICATION_READY: { + edit_node->set_icon( get_icon("RegionEdit","EditorIcons")); + b_snap_grid->set_icon( get_icon("Grid", "EditorIcons")); + b_snap_enable->set_icon( get_icon("Snap", "EditorIcons")); + icon_zoom->set_texture( get_icon("Zoom", "EditorIcons")); + } break; + } +} + +void SpriteRegionEditor::_node_removed(Node *p_node) +{ + if(p_node==node) { + node=NULL; + hide(); + } +} + +void SpriteRegionEditor::_bind_methods() +{ + ObjectTypeDB::bind_method(_MD("_edit_node"),&SpriteRegionEditor::_edit_node); + ObjectTypeDB::bind_method(_MD("_region_draw"),&SpriteRegionEditor::_region_draw); + ObjectTypeDB::bind_method(_MD("_region_input"),&SpriteRegionEditor::_region_input); + ObjectTypeDB::bind_method(_MD("_scroll_changed"),&SpriteRegionEditor::_scroll_changed); + ObjectTypeDB::bind_method(_MD("_node_removed"),&SpriteRegionEditor::_node_removed); + ObjectTypeDB::bind_method(_MD("_set_use_snap"),&SpriteRegionEditor::_set_use_snap); + ObjectTypeDB::bind_method(_MD("_set_show_grid"),&SpriteRegionEditor::_set_show_grid); + ObjectTypeDB::bind_method(_MD("_set_snap_off_x"),&SpriteRegionEditor::_set_snap_off_x); + ObjectTypeDB::bind_method(_MD("_set_snap_off_y"),&SpriteRegionEditor::_set_snap_off_y); + ObjectTypeDB::bind_method(_MD("_set_snap_step_x"),&SpriteRegionEditor::_set_snap_step_x); + ObjectTypeDB::bind_method(_MD("_set_snap_step_y"),&SpriteRegionEditor::_set_snap_step_y); +} + +void SpriteRegionEditor::edit(Node *p_sprite) +{ + if (p_sprite) { + node=p_sprite->cast_to<Sprite>(); + node->connect("exit_tree",this,"_node_removed",varray(),CONNECT_ONESHOT); + } else { + if (node) + node->disconnect("exit_tree",this,"_node_removed"); + node=NULL; + } + +} +void SpriteRegionEditor::_edit_node() +{ + if (node->get_texture().is_null()) { + + error->set_text("No texture in this sprite.\nSet a texture to be able to edit Region."); + error->popup_centered_minsize(); + return; + } + + rect=node->get_region_rect(); + dlg_editor->popup_centered_ratio(0.85); +} + +inline float _snap_scalar(float p_offset, float p_step, float p_target) { + return p_step != 0 ? Math::stepify(p_target - p_offset, p_step) + p_offset : p_target; +} + +Vector2 SpriteRegionEditor::snap_point(Vector2 p_target) const { + if (use_snap) { + p_target.x = _snap_scalar(snap_offset.x, snap_step.x, p_target.x); + p_target.y = _snap_scalar(snap_offset.y, snap_step.y, p_target.y); + } + p_target = p_target.snapped(Size2(1, 1)); + + return p_target; +} + +SpriteRegionEditor::SpriteRegionEditor(EditorNode* p_editor) +{ + node=NULL; + editor=p_editor; + undo_redo = editor->get_undo_redo(); + + snap_step=Vector2(10,10); + use_snap=false; + snap_show_grid=false; + + add_child( memnew( VSeparator )); + edit_node = memnew( ToolButton ); + add_child(edit_node); + edit_node->connect("pressed",this,"_edit_node"); + + dlg_editor = memnew( AcceptDialog ); + add_child(dlg_editor); + dlg_editor->set_title("Sprite Region Editor"); + dlg_editor->set_self_opacity(0.9); + + VBoxContainer *main_vb = memnew( VBoxContainer ); + dlg_editor->add_child(main_vb); + dlg_editor->set_child_rect(main_vb); + HBoxContainer *hb_tools = memnew( HBoxContainer ); + main_vb->add_child(hb_tools); + + b_snap_enable = memnew( ToolButton ); + hb_tools->add_child(b_snap_enable); + b_snap_enable->set_text("Snap"); + b_snap_enable->set_focus_mode(FOCUS_NONE); + b_snap_enable->set_toggle_mode(true); + b_snap_enable->set_pressed(use_snap); + b_snap_enable->set_tooltip("Enable Snap"); + b_snap_enable->connect("toggled",this,"_set_use_snap"); + + b_snap_grid = memnew( ToolButton ); + hb_tools->add_child(b_snap_grid); + b_snap_grid->set_text("Grid"); + b_snap_grid->set_focus_mode(FOCUS_NONE); + b_snap_grid->set_toggle_mode(true); + b_snap_grid->set_pressed(snap_show_grid); + b_snap_grid->set_tooltip("Show Grid"); + b_snap_grid->connect("toggled",this,"_set_show_grid"); + + hb_tools->add_child( memnew( VSeparator )); + hb_tools->add_child( memnew( Label("Grid Offset:") ) ); + + SpinBox *sb_off_x = memnew( SpinBox ); + sb_off_x->set_min(-256); + sb_off_x->set_max(256); + sb_off_x->set_step(1); + sb_off_x->set_val(snap_offset.x); + sb_off_x->set_suffix("px"); + sb_off_x->connect("value_changed", this, "_set_snap_off_x"); + hb_tools->add_child(sb_off_x); + + SpinBox *sb_off_y = memnew( SpinBox ); + sb_off_y->set_min(-256); + sb_off_y->set_max(256); + sb_off_y->set_step(1); + sb_off_y->set_val(snap_offset.y); + sb_off_y->set_suffix("px"); + sb_off_y->connect("value_changed", this, "_set_snap_off_y"); + hb_tools->add_child(sb_off_y); + + hb_tools->add_child( memnew( VSeparator )); + hb_tools->add_child( memnew( Label("Grid Step:") ) ); + + SpinBox *sb_step_x = memnew( SpinBox ); + sb_step_x->set_min(-256); + sb_step_x->set_max(256); + sb_step_x->set_step(1); + sb_step_x->set_val(snap_step.x); + sb_step_x->set_suffix("px"); + sb_step_x->connect("value_changed", this, "_set_snap_step_x"); + hb_tools->add_child(sb_step_x); + + SpinBox *sb_step_y = memnew( SpinBox ); + sb_step_y->set_min(-256); + sb_step_y->set_max(256); + sb_step_y->set_step(1); + sb_step_y->set_val(snap_step.y); + sb_step_y->set_suffix("px"); + sb_step_y->connect("value_changed", this, "_set_snap_step_y"); + hb_tools->add_child(sb_step_y); + +// MARIANOGNU::TODO: Add more tools? + + HBoxContainer *main_hb = memnew( HBoxContainer ); + main_vb->add_child(main_hb); + edit_draw = memnew( Control ); + main_hb->add_child(edit_draw); + main_hb->set_v_size_flags(SIZE_EXPAND_FILL); + edit_draw->set_h_size_flags(SIZE_EXPAND_FILL); + + + hb_tools->add_child( memnew( VSeparator )); + icon_zoom = memnew( TextureFrame ); + hb_tools->add_child(icon_zoom); + + zoom = memnew( HSlider ); + zoom->set_min(0.01); + zoom->set_max(4); + zoom->set_val(1); + zoom->set_step(0.01); + hb_tools->add_child(zoom); + zoom->set_custom_minimum_size(Size2(200,0)); + zoom_value = memnew( SpinBox ); + zoom->share(zoom_value); + zoom_value->set_custom_minimum_size(Size2(50,0)); + hb_tools->add_child(zoom_value); + zoom->connect("value_changed",this,"_scroll_changed"); + + + + vscroll = memnew( VScrollBar); + main_hb->add_child(vscroll); + vscroll->connect("value_changed",this,"_scroll_changed"); + hscroll = memnew( HScrollBar ); + main_vb->add_child(hscroll); + hscroll->connect("value_changed",this,"_scroll_changed"); + + edit_draw->connect("draw",this,"_region_draw"); + edit_draw->connect("input_event",this,"_region_input"); + draw_zoom=1.0; + updating_scroll=false; + + error = memnew( AcceptDialog); + add_child(error); + +} + +void SpriteRegionEditorPlugin::edit(Object *p_node) +{ + region_editor->edit(p_node->cast_to<Node>()); +} + +bool SpriteRegionEditorPlugin::handles(Object *p_node) const +{ + return p_node->is_type("Sprite"); +} + +void SpriteRegionEditorPlugin::make_visible(bool p_visible) +{ + if (p_visible) { + region_editor->show(); + } else { + region_editor->hide(); + region_editor->edit(NULL); + } +} + +SpriteRegionEditorPlugin::SpriteRegionEditorPlugin(EditorNode *p_node) +{ + editor = p_node; + region_editor= memnew ( SpriteRegionEditor(p_node) ); + CanvasItemEditor::get_singleton()->add_control_to_menu_panel(region_editor); + + region_editor->hide(); +} + diff --git a/tools/editor/plugins/sprite_region_editor_plugin.h b/tools/editor/plugins/sprite_region_editor_plugin.h new file mode 100644 index 0000000000..cf69395f40 --- /dev/null +++ b/tools/editor/plugins/sprite_region_editor_plugin.h @@ -0,0 +1,125 @@ +/*************************************************************************/ +/* sprite_region_editor_plugin.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Author: Mariano Suligoy */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef SPRITE_REGION_EDITOR_PLUGIN_H +#define SPRITE_REGION_EDITOR_PLUGIN_H + +#include "canvas_item_editor_plugin.h" +#include "tools/editor/editor_plugin.h" +#include "tools/editor/editor_node.h" +#include "scene/2d/sprite.h" + +class SpriteRegionEditor : public HBoxContainer { + + OBJ_TYPE(SpriteRegionEditor, HBoxContainer ); + + ToolButton *edit_node; +// Button *use_region; + ToolButton *b_snap_enable; + ToolButton *b_snap_grid; + TextureFrame *icon_zoom; + HSlider *zoom; + SpinBox *zoom_value; + Control *edit_draw; + + VScrollBar *vscroll; + HScrollBar *hscroll; + + Sprite *node; + EditorNode *editor; + AcceptDialog *dlg_editor; + UndoRedo* undo_redo; + + Vector2 draw_ofs; + float draw_zoom; + bool updating_scroll; + + bool use_snap; + bool snap_show_grid; + Vector2 snap_offset; + Vector2 snap_step; + + Rect2 rect; + Rect2 rect_prev; + bool drag; + bool creating; + Vector2 drag_from; + int drag_index; + + AcceptDialog *error; + + void _set_use_snap(bool p_use); + void _set_show_grid(bool p_show); + void _set_snap_off_x(float p_val); + void _set_snap_off_y(float p_val); + void _set_snap_step_x(float p_val); + void _set_snap_step_y(float p_val); + +protected: + + void _notification(int p_what); + void _node_removed(Node *p_node); + static void _bind_methods(); + + Vector2 snap_point(Vector2 p_target) const; + +public: + + void edit(); + void _edit_node(); + void _region_draw(); + void _region_input(const InputEvent &p_input); + void _scroll_changed(float); + + void edit(Node *p_sprite); + SpriteRegionEditor(EditorNode* p_editor); + +}; + +class SpriteRegionEditorPlugin : public EditorPlugin +{ + + OBJ_TYPE( SpriteRegionEditorPlugin, EditorPlugin ); + + SpriteRegionEditor *region_editor; + EditorNode *editor; +public: + + virtual String get_name() const { return "Sprite"; } + bool has_main_screen() const { return false; } + virtual void edit(Object *p_node); + virtual bool handles(Object *p_node) const; + virtual void make_visible(bool p_visible); + + SpriteRegionEditorPlugin(EditorNode *p_node); +}; + +#endif // SPRITE_REGION_EDITOR_PLUGIN_H diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index bdfb66f0f2..622150ab68 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -74,17 +74,17 @@ bool ScriptCreateDialog::_validate(const String& p_string) { void ScriptCreateDialog::_class_name_changed(const String& p_name) { if (!_validate(parent_name->get_text())) { - error_label->set_text("INVALID PARENT CLASS NAME"); + error_label->set_text("Invaild parent class name"); error_label->add_color_override("font_color",Color(1,0.4,0.0,0.8)); } else if (class_name->is_editable()) { if (class_name->get_text()=="") { error_label->set_text("Valid Chars: a-z A-Z 0-9 _"); error_label->add_color_override("font_color",Color(1,1,1,0.6)); } else if (!_validate(class_name->get_text())) { - error_label->set_text("INVALID CLASS NAME"); + error_label->set_text("Invalid class name"); error_label->add_color_override("font_color",Color(1,0.2,0.2,0.8)); } else { - error_label->set_text("Name is Valid"); + error_label->set_text("Valid Name"); error_label->add_color_override("font_color",Color(0,1.0,0.8,0.8)); } } else { @@ -363,7 +363,7 @@ ScriptCreateDialog::ScriptCreateDialog() { set_size(Size2(200,150)); set_hide_on_ok(false); - set_title("Create Script for Node..");; + set_title("Create Script for Node"); file_browse = memnew( EditorFileDialog ); file_browse->connect("file_selected",this,"_file_selected"); |