diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-01-22 19:17:24 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-01-22 19:17:24 -0300 |
commit | 84d7a559e5198478b1ae23d00dbd966461aadfe7 (patch) | |
tree | 8480de1917859c12d8c0b081c87190ae07d65244 | |
parent | 9d571d8eacb07e1b96de049feca976b3309cd21d (diff) | |
parent | ed3c73408b3b0ddf234ddcc5349fe85831e3ebba (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
-rw-r--r-- | doc/base/classes.xml | 113 | ||||
-rw-r--r-- | main/input_default.cpp | 45 | ||||
-rw-r--r-- | main/input_default.h | 4 | ||||
-rwxr-xr-x | methods.py | 4 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 68 | ||||
-rw-r--r-- | platform/javascript/os_javascript.h | 8 | ||||
-rw-r--r-- | scene/audio/event_player.cpp | 6 | ||||
-rw-r--r-- | scene/gui/spin_box.cpp | 3 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 37 | ||||
-rw-r--r-- | scene/gui/tree.h | 5 | ||||
-rw-r--r-- | servers/audio_server.cpp | 53 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/property_editor.cpp | 126 | ||||
-rw-r--r-- | tools/editor/property_editor.h | 8 | ||||
-rw-r--r-- | tools/html_fs/godot.html | 24 |
16 files changed, 339 insertions, 169 deletions
diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 4c8e57eca7..8128771b6a 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -4120,7 +4120,8 @@ <argument index="2" name="length" type="int"> </argument> <description> - Create an audio sample, return a [RID] referencing it. The sample will be created with a given format (from the SAMPLE_FORMAT_* enum), a total length (in frames, not samples or bytes), in either stereo or mono. + Create an audio sample, return a [RID] referencing it. The sample will be created with a given format (from the SAMPLE_FORMAT_* enum), a total length (in samples, not bytes), in either stereo or mono. + Even if a stereo sample consists of a left sample and a right sample, it still counts as one sample for length purposes. </description> </method> <method name="sample_set_description"> @@ -4156,7 +4157,7 @@ <argument index="0" name="sample" type="RID"> </argument> <description> - Return wether the sample is stereo (2 channels) + Return whether the sample is stereo (2 channels). </description> </method> <method name="sample_get_length" qualifiers="const"> @@ -4165,7 +4166,7 @@ <argument index="0" name="sample" type="RID"> </argument> <description> - Return the length in frames of the audio sample (not samples or bytes). + Return the length in samples (not bytes) of the audio sample. Even if a stereo sample consists of a left sample and a right sample, it still counts as one sample for length purposes. </description> </method> <method name="sample_set_signed_data"> @@ -4175,6 +4176,8 @@ </argument> <description> Set the sample data for a given sample as an array of floats. The length must be equal to the sample lenght or an error will be produced. + For this method, a stereo sample is made from two samples. Thus, in case of a stereo sample, the array length must be twice the length returned by [method sample_get_length]. + Trying to alter a SAMPLE_FORMAT_IMA_ADPCM sample is not supported. It will throw an error to the console, but will not alter the sample data. </description> </method> <method name="sample_set_data"> @@ -4183,7 +4186,11 @@ <argument index="1" name="data" type="RawArray"> </argument> <description> - Set the sample data for a given sample as an array of bytes. The length must be equal to the sample lenght expected in bytes or an error will be produced. + Set the sample data for a given sample as an array of bytes. The length must be equal to the sample lenght expected in bytes or an error will be produced. The byte length can be calculated as follows: + Get the sample length ([method get_sample_length]). + If the sample format is SAMPLE_FORMAT_PCM16, multiply it by 2. + If the sample format is SAMPLE_FORMAT_IMA_ADPCM, divide it by 2 (rounding any fraction up), then add 4. + If the sample is stereo ([method sample_is_stereo]), multiply it by 2. </description> </method> <method name="sample_get_data" qualifiers="const"> @@ -4498,24 +4505,28 @@ <argument index="0" name="scale" type="float"> </argument> <description> + Set global scale for all voices (not including streams). Default is 1.0. </description> </method> <method name="get_fx_global_volume_scale" qualifiers="const"> <return type="float"> </return> <description> + Return the global scale for all voices. </description> </method> <method name="set_event_voice_global_volume_scale"> <argument index="0" name="scale" type="float"> </argument> <description> + Set global scale for event-based stream ([EventStream]) playback. Default is 1.0. </description> </method> <method name="get_event_voice_global_volume_scale" qualifiers="const"> <return type="float"> </return> <description> + Return the global scale for event-based stream playback. </description> </method> </methods> @@ -4524,7 +4535,7 @@ Sample format is 8 bits, signed. </constant> <constant name="SAMPLE_FORMAT_PCM16" value="1"> - Sample format is 16 bits, signed. + Sample format is 16 bits, little-endian, signed. </constant> <constant name="SAMPLE_FORMAT_IMA_ADPCM" value="2"> Sample format is IMA-ADPCM compressed. @@ -4572,8 +4583,11 @@ </class> <class name="AudioServerSW" inherits="AudioServer" category="Core"> <brief_description> + Software implementation of [AudioServer]. </brief_description> <description> + This is a software audio server. It does not use any kind of hardware acceleration. + This class does not expose any new method. </description> <methods> </methods> @@ -10230,172 +10244,204 @@ This approximation makes straight segments between each point, then subdivides t </class> <class name="EventPlayer" inherits="Node" category="Core"> <brief_description> + Class for event stream playback. </brief_description> <description> + Class for event stream playback. Event streams are music expressed as a series of events (note on, note off, instrument change...), as opposed to audio streams, which are just audio data. Examples of event-based streams are MIDI files, or MOD music. + Currently, only MOD, S3M, IT, and XM music is supported. </description> <methods> <method name="set_stream"> <argument index="0" name="stream" type="EventStream"> </argument> <description> + Set the [EventStream] this player will play. </description> </method> <method name="get_stream" qualifiers="const"> <return type="EventStream"> </return> <description> + Return the currently assigned stream. </description> </method> <method name="play"> <description> + Play the currently assigned stream. </description> </method> <method name="stop"> <description> + Stop playing. </description> </method> <method name="is_playing" qualifiers="const"> <return type="bool"> </return> <description> + Return whether this player is playing. </description> </method> <method name="set_paused"> <argument index="0" name="paused" type="bool"> </argument> <description> + Pause stream playback. </description> </method> <method name="is_paused" qualifiers="const"> <return type="bool"> </return> <description> + Return whether the playback is currently paused. </description> </method> <method name="set_loop"> <argument index="0" name="enabled" type="bool"> </argument> <description> + Set whether the stream will be restarted at the end. </description> </method> <method name="has_loop" qualifiers="const"> <return type="bool"> </return> <description> + Return whether this player will be restart the playback at the end. </description> </method> <method name="set_volume"> <argument index="0" name="volume" type="float"> </argument> <description> + Set the playback volume for this player. This is a float between 0.0 (silent) and 1.0 (full volume). Values over 1.0 may amplify sound even more, but may introduce distortion. Negative values may just invert the output waveform, which produces no audible difference. + The effect of these special values uiltimately depends on the low-level implementation of the file format being played. </description> </method> <method name="get_volume" qualifiers="const"> <return type="float"> </return> <description> + Return the playback volume for this player. </description> </method> <method name="set_pitch_scale"> <argument index="0" name="pitch_scale" type="float"> </argument> <description> + Set the pitch multiplier for all sounds coming from this stream. A value of 2.0 shifts all pitches one octave up, and a value of 0.5 shifts pitches one octave down. </description> </method> <method name="get_pitch_scale" qualifiers="const"> <return type="float"> </return> <description> + Return the pitch scale factor for this player. </description> </method> <method name="set_tempo_scale"> <argument index="0" name="tempo_scale" type="float"> </argument> <description> + Set the tempo multiplier. This allows to slow down or speed up the music, without affecting its pitch. </description> </method> <method name="get_tempo_scale" qualifiers="const"> <return type="float"> </return> <description> + Return the tempo multiplier. </description> </method> <method name="set_volume_db"> <argument index="0" name="db" type="float"> </argument> <description> + Set the playback volume for this player, in decibels. This is a float between -80.0 (silent) and 0.0 (full volume). Values under -79.0 get truncated to -80, but values over 0.0 do not, so the warnings for overamplifying (see [set_volume]) still apply. </description> </method> <method name="get_volume_db" qualifiers="const"> <return type="float"> </return> <description> + Return the playback volume for this player, in decibels. </description> </method> <method name="get_stream_name" qualifiers="const"> <return type="String"> </return> <description> + Return the name of the currently assigned stream. This is not the file name, but a field inside the file. If no stream is assigned, if returns "<No Stream>". </description> </method> <method name="get_loop_count" qualifiers="const"> <return type="int"> </return> <description> + Return the number of times the playback has looped. </description> </method> <method name="get_pos" qualifiers="const"> <return type="float"> </return> <description> + Return the playback position. May be in seconds, but depends on the stream type. </description> </method> <method name="seek_pos"> <argument index="0" name="time" type="float"> </argument> <description> + Set the playback position. May be in seconds, but depends on the stream type. </description> </method> <method name="get_length" qualifiers="const"> <return type="float"> </return> <description> + Return the song length. May be in seconds, but depends on the stream type. </description> </method> <method name="set_autoplay"> <argument index="0" name="enabled" type="bool"> </argument> <description> + Set whether this player will start playing as soon as it enters the scene tree. </description> </method> <method name="has_autoplay" qualifiers="const"> <return type="bool"> </return> <description> + Return whether this player will start playing as soon as it enters the scene tree. </description> </method> <method name="set_channel_volume"> - <argument index="0" name="idx" type="int"> + <argument index="0" name="channel" type="int"> </argument> <argument index="1" name="channel_volume" type="float"> </argument> <description> + Set the volume scale for an individual channel of the stream, with the same value range as [methid set_volume]. The channel number depends on the stream format. For example, MIDIs range from 0 to 15, and MODs from 0 to 63. + Many stream formats are multichannel, so this allows to affect only a part of the music. </description> </method> <method name="get_channel_volume" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="idx" type="int"> + <argument index="0" name="channel" type="int"> </argument> <description> + Return the volume scale for an individual channel of the stream. </description> </method> <method name="get_channel_last_note_time" qualifiers="const"> <return type="float"> </return> - <argument index="0" name="idx" type="int"> + <argument index="0" name="channel" type="int"> </argument> <description> + Return the time at which the last note of a given channel in the stream plays. </description> </method> </methods> @@ -10404,8 +10450,11 @@ This approximation makes straight segments between each point, then subdivides t </class> <class name="EventStream" inherits="Resource" category="Core"> <brief_description> + Base class for all event-based stream drivers. </brief_description> <description> + Base class for all event-based stream drivers. Event streams are music expressed as a series of events (note on, note off, instrument change...), as opposed to audio streams, which are just audio data. Examples of event-based streams are MIDI files, of MOD music. + This class exposes no methods. </description> <methods> </methods> @@ -10414,8 +10463,15 @@ This approximation makes straight segments between each point, then subdivides t </class> <class name="EventStreamChibi" inherits="EventStream" category="Core"> <brief_description> + Driver for MOD playback. </brief_description> <description> + This driver plays MOD music. MOD music, as all event-based streams, is a music format defined by note events ocurring at defined moments, instead of a stream of audio samples. + Currently, this driver supports the MOD, S3M, IT, and XM formats. + This class exposes no methods. + This class can return its playback positon in seconds, but does not allow to set it, failing with only a console warning. + This class can not return its song length, returning 1.0 when queried. + This class does not limit its volume settings, allowing for overflow/distortion and wave inversion. </description> <methods> </methods> @@ -28888,8 +28944,8 @@ This method controls whether the position between two cached points is interpola <argument index="2" name="length" type="int"> </argument> <description> - 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). + Create new data for the sample, with format (see FORMAT_* constants), stereo hint, and length in samples (not bytes). + Calling this method overrides previously existing data. Stereo samples are interleaved pairs of left and right points (in that order), but count as one sample for length purposes. </description> </method> <method name="get_format" qualifiers="const"> @@ -28910,15 +28966,18 @@ This method controls whether the position between two cached points is interpola <return type="int"> </return> <description> - Return the sample length in frames. + Return the sample length in samples. Stereo samples count as one, even if they are made of a left and a right sample. </description> </method> <method name="set_data"> <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 as to fit all frames. - For 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 samples. The length of this array can be calculated as follows: + Get the sample length ([method get_length]). + If the sample format is FORMAT_PCM16, multiply it by 2. + If the sample format is FORMAT_IMA_ADPCM, divide it by 2 (rounding any fraction up), then add 4. + If the sample is stereo ([method is_stereo]), multiply it by 2. </description> </method> <method name="get_data" qualifiers="const"> @@ -28987,7 +29046,7 @@ This method controls whether the position between two cached points is interpola </methods> <constants> <constant name="FORMAT_PCM8" value="0"> - 8-bits signed little endian PCM audio. + 8-bits signed PCM audio. </constant> <constant name="FORMAT_PCM16" value="1"> 16-bits signed little endian PCM audio. @@ -33311,148 +33370,174 @@ This method controls whether the position between two cached points is interpola <argument index="0" name="stream" type="Stream"> </argument> <description> + Set the [EventStream] this player will play. </description> </method> <method name="get_stream" qualifiers="const"> <return type="Stream"> </return> <description> + Return the currently assigned stream. </description> </method> <method name="play"> <argument index="0" name="offset" type="float" default="0"> </argument> <description> + Play the currently assigned stream, starting from a given position (in seconds). </description> </method> <method name="stop"> <description> + Stop the playback. </description> </method> <method name="is_playing" qualifiers="const"> <return type="bool"> </return> <description> + Return whether this player is playing. </description> </method> <method name="set_paused"> <argument index="0" name="paused" type="bool"> </argument> <description> + Pause stream playback. </description> </method> <method name="is_paused" qualifiers="const"> <return type="bool"> </return> <description> + Return whether the playback is currently paused. </description> </method> <method name="set_loop"> <argument index="0" name="enabled" type="bool"> </argument> <description> + Set whether the stream will be restarted at the end. </description> </method> <method name="has_loop" qualifiers="const"> <return type="bool"> </return> <description> + Return whether the stream will be restarted at the end. </description> </method> <method name="set_volume"> <argument index="0" name="volume" type="float"> </argument> <description> + Set the playback volume for this player. This is a float between 0.0 (silent) and 1.0 (full volume). Values over 1.0 will amplify sound even more, but may introduce distortion. Negative values will just invert the output waveform, which produces no audible difference. </description> </method> <method name="get_volume" qualifiers="const"> <return type="float"> </return> <description> + Return the playback volume for this player. </description> </method> <method name="set_volume_db"> <argument index="0" name="db" type="float"> </argument> <description> + Set the playback volume for this player, in decibels. This is a float between -80.0 (silent) and 0.0 (full volume). Values under -79.0 get truncated to -80, but values over 0.0 do not, so the warnings for overamplifying (see [set_volume]) still apply. </description> </method> <method name="get_volume_db" qualifiers="const"> <return type="float"> </return> <description> + Return the playback volume for this player, in decibels. </description> </method> <method name="set_buffering_msec"> <argument index="0" name="msec" type="int"> </argument> <description> + Set the size (in milliseconds) of the audio buffer. A long audio buffer protects better against slowdowns, but responds worse to changes (in volume, stream played...). A shorter buffer takes less time to respond to changes, but may stutter if the application suffers some slowdown. + Default is 500 milliseconds. </description> </method> <method name="get_buffering_msec" qualifiers="const"> <return type="int"> </return> <description> + Return the size of the audio buffer. </description> </method> <method name="set_loop_restart_time"> <argument index="0" name="secs" type="float"> </argument> <description> + Set the point in time the stream will rewind to, when looping. </description> </method> <method name="get_loop_restart_time" qualifiers="const"> <return type="float"> </return> <description> + Return the point in time the stream will rewind to, when looping. </description> </method> <method name="get_stream_name" qualifiers="const"> <return type="String"> </return> <description> + Return the name of the currently assigned stream. This is not the file name, but a field inside the file. If no stream is assigned, if returns "<No Stream>". </description> </method> <method name="get_loop_count" qualifiers="const"> <return type="int"> </return> <description> + Return the number of times the playback has looped. </description> </method> <method name="get_pos" qualifiers="const"> <return type="float"> </return> <description> + Return the playback position, in seconds. </description> </method> <method name="seek_pos"> <argument index="0" name="time" type="float"> </argument> <description> + Set the playback position, in seconds. </description> </method> <method name="set_autoplay"> <argument index="0" name="enabled" type="bool"> </argument> <description> + Set whether this player will start playing as soon as it enters the scene tree. </description> </method> <method name="has_autoplay" qualifiers="const"> <return type="bool"> </return> <description> + Return whether this player will start playing as soon as it enters the scene tree. </description> </method> <method name="get_length" qualifiers="const"> <return type="float"> </return> <description> + Return the length of the stream, in seconds. </description> </method> </methods> <signals> <signal name="finished"> <description> + This signal triggers when the player stops playing. It will not trigger on each loop. </description> </signal> </signals> diff --git a/main/input_default.cpp b/main/input_default.cpp index a79199580b..4e5d753ea9 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -478,6 +478,16 @@ static const char *s_ControllerMappings [] = #if defined(__ANDROID__) "4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", #endif + + #ifdef JAVASCRIPT_ENABLED + "Default HTML5 Gamepad, Default Mapping,leftx:a0,lefty:a1,dpdown:b13,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:b14,lefttrigger:a6,x:b2,dpup:b12,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b0,dpright:b15,righttrigger:a7,b:b1,", + "303534632d303236382d536f6e792050,PS3 Controller USB/Linux,leftx:a0,lefty:a1,dpdown:b6,rightstick:b2,rightshoulder:b11,rightx:a2,start:b3,righty:a3,dpleft:b7,lefttrigger:b8,x:b15,dpup:b4,back:b0,leftstick:b1,leftshoulder:b10,y:b12,a:b14,dpright:b5,righttrigger:b9,b:b13,", + "303534632d303563342d536f6e792043,PS4 Controller USB/Linux,leftx:a0,lefty:a1,dpdown:a7,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a5,dpleft:a6,lefttrigger:a3,x:b0,dpup:a7,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,dpright:a6,righttrigger:a4,b:b2,", + "303534632d303563342d576972656c65,PS4 Controller USB/Win,leftx:a0,lefty:a1,dpdown:b15,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a5,lefttrigger:a3,x:b0,dpup:b14,dpleft:b16,dpright:b17,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b1,righttrigger:b7,b:b2,", + "303435652d303238652d4d6963726f73,Wired X360 Controller,leftx:a0,lefty:a1,dpdown:a7,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:a6,lefttrigger:a2,x:b2,dpup:a7,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:a6,righttrigger:a5,b:b1,", + "303435652d303731392d58626f782033,Wireless X360 Controller,leftx:a0,lefty:a1,dpdown:b14,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:b11,lefttrigger:a2,x:b2,dpup:b13,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:b12,righttrigger:a5,b:b1,", + "c2a94d6963726f736f66742058626f78,Wireless X360 Controller,leftx:a0,lefty:a1,dpdown:b14,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:b11,lefttrigger:a2,x:b2,dpup:b13,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:b12,righttrigger:a5,b:b1,", + #endif NULL }; @@ -607,6 +617,41 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co int axis = map.index == JOY_L2 ? JOY_ANALOG_L2 : JOY_ANALOG_R2; p_last_id = _axis_event(p_last_id, p_device, axis, value); } + + if (map.index == JOY_DPAD_UP || map.index == JOY_DPAD_DOWN) { + bool pressed = p_value.value != 0.0f; + int button = p_value.value < 0 ? JOY_DPAD_UP : JOY_DPAD_DOWN; + + if (!pressed) { + if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_UP, p_device))) { + p_last_id = _button_event(p_last_id, p_device, JOY_DPAD_UP, false); + } + if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_DOWN, p_device))) { + p_last_id = _button_event(p_last_id, p_device, JOY_DPAD_DOWN, false); + } + } + if ( pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) { + return p_last_id; + } + return _button_event(p_last_id, p_device, button, true); + } + if (map.index == JOY_DPAD_LEFT || map.index == JOY_DPAD_RIGHT) { + bool pressed = p_value.value != 0.0f; + int button = p_value.value < 0 ? JOY_DPAD_LEFT : JOY_DPAD_RIGHT; + + if (!pressed) { + if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_LEFT, p_device))) { + p_last_id = _button_event(p_last_id, p_device, JOY_DPAD_LEFT, false); + } + if (joy_buttons_pressed.has(_combine_device(JOY_DPAD_RIGHT, p_device))) { + p_last_id = _button_event(p_last_id, p_device, JOY_DPAD_RIGHT, false); + } + } + if ( pressed == joy_buttons_pressed.has(_combine_device(button, p_device))) { + return p_last_id; + } + return _button_event(p_last_id, p_device, button, true); + } float deadzone = p_value.min == 0 ? 0.5f : 0.0f; bool pressed = p_value.value > deadzone ? true : false; if (pressed == joy_buttons_pressed.has(_combine_device(map.index,p_device))) { diff --git a/main/input_default.h b/main/input_default.h index bbfd9ced2c..a75865e0cb 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -36,7 +36,7 @@ class InputDefault : public Input { struct Joystick { StringName name; StringName uid; - bool last_buttons[JOY_BUTTON_MAX]; + bool last_buttons[JOY_BUTTON_MAX + 2]; //html5 needs support for 18 buttons to map some devices correctly float last_axis[JOY_AXIS_MAX]; float filter; int last_hat; @@ -50,7 +50,7 @@ class InputDefault : public Input { last_axis[i] = 0.0f; } - for (int i = 0; i < JOY_BUTTON_MAX; i++) { + for (int i = 0; i < JOY_BUTTON_MAX + 2; i++) { last_buttons[i] = false; } diff --git a/methods.py b/methods.py index a894973e69..e8de4696cd 100755 --- a/methods.py +++ b/methods.py @@ -1287,10 +1287,10 @@ def android_add_java_dir(self,subpath): def android_add_res_dir(self,subpath): base_path = self.Dir(".").abspath+"/modules/"+self.current_module+"/"+subpath self.android_res_dirs.append(base_path) -def android_add_aidl_dir(self,file): +def android_add_aidl_dir(self,subpath): base_path = self.Dir(".").abspath+"/modules/"+self.current_module+"/"+subpath self.android_aidl_dirs.append(base_path) -def android_add_jni_dir(self,file): +def android_add_jni_dir(self,subpath): base_path = self.Dir(".").abspath+"/modules/"+self.current_module+"/"+subpath self.android_jni_dirs.append(base_path) diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 7bb47881a3..562733ab89 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -76,6 +76,14 @@ void OS_JavaScript::set_opengl_extensions(const char* p_gl_extensions) { gl_extensions=p_gl_extensions; } +static EM_BOOL joy_callback_func(int p_type, const EmscriptenGamepadEvent *p_event, void *p_user) { + OS_JavaScript *os = (OS_JavaScript*) OS::get_singleton(); + if (os) { + return os->joy_connection_changed(p_type, p_event); + } + return false; +} + void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) { print_line("Init OS"); @@ -142,6 +150,8 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int input = memnew( InputDefault ); + emscripten_set_gamepadconnected_callback(NULL, true, &joy_callback_func); + emscripten_set_gamepaddisconnected_callback(NULL, true, &joy_callback_func); } void OS_JavaScript::set_main_loop( MainLoop * p_main_loop ) { @@ -296,7 +306,7 @@ bool OS_JavaScript::main_loop_iterate() { } - + process_joysticks(); return Main::iteration(); } @@ -605,6 +615,62 @@ void OS_JavaScript::_close_notification_funcs(const String& p_file,int p_flags) } } +void OS_JavaScript::process_joysticks() { + + int joy_count = emscripten_get_num_gamepads(); + for (int i = 0; i < joy_count; i++) { + EmscriptenGamepadEvent state; + emscripten_get_gamepad_status(i, &state); + if (state.connected) { + + int num_buttons = MIN(state.numButtons, 18); + int num_axes = MIN(state.numAxes, 8); + for (int j = 0; j < num_buttons; j++) { + + float value = state.analogButton[j]; + if (String(state.mapping) == "standard" && (j == 6 || j == 7)) { + InputDefault::JoyAxis jx; + jx.min = 0; + jx.value = value; + last_id = input->joy_axis(last_id, i, j, jx); + } + else { + last_id = input->joy_button(last_id, i, j, value); + } + } + for (int j = 0; j < num_axes; j++) { + + InputDefault::JoyAxis jx; + jx.min = -1; + jx.value = state.axis[j]; + last_id = input->joy_axis(last_id, i, j, jx); + } + } + } +} + +bool OS_JavaScript::joy_connection_changed(int p_type, const EmscriptenGamepadEvent *p_event) { + if (p_type == EMSCRIPTEN_EVENT_GAMEPADCONNECTED) { + + String guid = ""; + if (String(p_event->mapping) == "standard") + guid = "Default HTML5 Gamepad"; + input->joy_connection_changed(p_event->index, true, String(p_event->id), guid); + } + else { + input->joy_connection_changed(p_event->index, false, ""); + } + return true; +} + +bool OS_JavaScript::is_joy_known(int p_device) { + return input->is_joy_mapped(p_device); +} + +String OS_JavaScript::get_joy_guid(int p_device) const { + return input->get_joy_guid_remapped(p_device); +} + OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func,GetLocaleFunc p_get_locale_func) { diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index 61eecd8f32..ec3a6cf911 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -41,6 +41,7 @@ #include "audio_server_javascript.h" #include "audio_driver_javascript.h" #include "main/input_default.h" +#include "emscripten/html5.h" typedef void (*GFXInitFunc)(void *ud,bool gl2,int w, int h, bool fs); typedef int (*OpenURIFunc)(const String&); @@ -90,6 +91,8 @@ private: static void _close_notification_funcs(const String& p_file,int p_flags); + void process_joysticks(); + public: // functions used by main to initialize/deintialize the OS @@ -163,6 +166,11 @@ public: void process_accelerometer(const Vector3& p_accelerometer); void process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points); void push_input(const InputEvent& p_ev); + + virtual bool is_joy_known(int p_device); + virtual String get_joy_guid(int p_device) const; + bool joy_connection_changed(int p_type, const EmscriptenGamepadEvent *p_event); + OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func,GetLocaleFunc p_get_locale_func); ~OS_JavaScript(); diff --git a/scene/audio/event_player.cpp b/scene/audio/event_player.cpp index b49b285f76..eabe84a8ee 100644 --- a/scene/audio/event_player.cpp +++ b/scene/audio/event_player.cpp @@ -317,9 +317,9 @@ void EventPlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_autoplay","enabled"),&EventPlayer::set_autoplay); ObjectTypeDB::bind_method(_MD("has_autoplay"),&EventPlayer::has_autoplay); - ObjectTypeDB::bind_method(_MD("set_channel_volume","idx","channel_volume"),&EventPlayer::set_channel_volume); - ObjectTypeDB::bind_method(_MD("get_channel_volume","idx"),&EventPlayer::get_channel_volume); - ObjectTypeDB::bind_method(_MD("get_channel_last_note_time","idx"),&EventPlayer::get_channel_last_note_time); + ObjectTypeDB::bind_method(_MD("set_channel_volume","channel","channel_volume"),&EventPlayer::set_channel_volume); + ObjectTypeDB::bind_method(_MD("get_channel_volume","channel"),&EventPlayer::get_channel_volume); + ObjectTypeDB::bind_method(_MD("get_channel_last_note_time","channel"),&EventPlayer::get_channel_last_note_time); ObjectTypeDB::bind_method(_MD("_set_play","play"),&EventPlayer::_set_play); ObjectTypeDB::bind_method(_MD("_get_play"),&EventPlayer::_get_play); diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 38c61ded2c..2b64d36a81 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -72,8 +72,7 @@ void SpinBox::_range_click_timeout() { if (!drag.enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) { - int pos_y = Input::get_singleton()->get_mouse_pos().y-get_global_pos().y; - bool up = pos_y < (get_size().height/2); + bool up = get_local_mouse_pos().y < (get_size().height/2); set_val( get_val() + (up?get_step():-get_step())); if (range_click_timer->is_one_shot()) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 8d28180490..66ce117c9d 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1373,7 +1373,7 @@ void Tree::_range_click_timeout() { if (range_item_last && !range_drag_enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) { - Point2 pos = (Input::get_singleton()->get_mouse_pos()-get_global_pos())-cache.bg->get_offset(); + Point2 pos = get_local_mouse_pos()-cache.bg->get_offset(); if (show_column_titles) { pos.y-=_get_title_button_height(); @@ -1384,7 +1384,7 @@ void Tree::_range_click_timeout() { } click_handled=false; - InputModifierState mod = {}; // should be irrelevant.. + InputModifierState mod = InputModifierState(); // should be irrelevant.. blocked++; propagate_mouse_event(pos+cache.offset, 0, 0, false, root, BUTTON_LEFT, mod); @@ -1414,6 +1414,10 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_ if (!skip && p_pos.y<item_h) { // check event! + if (range_click_timer->get_time_left() > 0 && p_item != range_item_last) { + return -1; + } + if (!hide_folding && (p_pos.x >=x_ofs && p_pos.x < (x_ofs+cache.item_margin) )) { @@ -1719,6 +1723,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_ void Tree::text_editor_enter(String p_text) { + text_changed=false; text_editor->hide(); value_editor->hide(); @@ -1757,6 +1762,22 @@ void Tree::text_editor_enter(String p_text) { } +void Tree::text_editor_changed(String p_text) { + + text_changed=true; +} + +void Tree::text_editor_hide() { + + if (!text_changed) + return; + + if (Input::get_singleton()->is_key_pressed(KEY_ESCAPE)) + return; + + text_editor_enter(text_editor->get_text()); +} + void Tree::value_editor_changed(double p_value) { if (updating_value_editor) { @@ -2074,8 +2095,6 @@ void Tree::_input_event(InputEvent p_event) { update_cache(); const InputEventMouseMotion& b=p_event.mouse_motion; - range_click_timer->stop(); - Ref<StyleBox> bg = cache.bg; Point2 pos = Point2(b.x,b.y) - bg->get_offset(); @@ -2272,12 +2291,10 @@ void Tree::_input_event(InputEvent p_event) { } break; case BUTTON_WHEEL_UP: { - range_click_timer->stop(); v_scroll->set_val( v_scroll->get_val()-v_scroll->get_page()/8 ); } break; case BUTTON_WHEEL_DOWN: { - range_click_timer->stop(); v_scroll->set_val( v_scroll->get_val()+v_scroll->get_page()/8 ); } break; } @@ -2350,6 +2367,8 @@ bool Tree::edit_selected() { } else if (c.mode==TreeItem::CELL_MODE_STRING || c.mode==TreeItem::CELL_MODE_RANGE) { + text_changed=false; + Point2i textedpos=get_global_pos() + rect.pos; text_editor->set_pos( textedpos ); text_editor->set_size( rect.size); @@ -3185,6 +3204,8 @@ void Tree::_bind_methods() { ObjectTypeDB::bind_method(_MD("_input_event"),&Tree::_input_event); ObjectTypeDB::bind_method(_MD("_popup_select"),&Tree::popup_select); ObjectTypeDB::bind_method(_MD("_text_editor_enter"),&Tree::text_editor_enter); + ObjectTypeDB::bind_method(_MD("_text_editor_changed"),&Tree::text_editor_changed); + ObjectTypeDB::bind_method(_MD("_text_editor_hide"),&Tree::text_editor_hide); ObjectTypeDB::bind_method(_MD("_value_editor_changed"),&Tree::value_editor_changed); ObjectTypeDB::bind_method(_MD("_scroll_moved"),&Tree::_scroll_moved); @@ -3283,6 +3304,8 @@ Tree::Tree() { h_scroll->connect("value_changed", this,"_scroll_moved"); v_scroll->connect("value_changed", this,"_scroll_moved"); text_editor->connect("text_entered", this,"_text_editor_enter"); + text_editor->connect("text_changed",this,"_text_editor_changed"); + text_editor->connect("hide",this,"_text_editor_hide"); popup_menu->connect("item_pressed", this,"_popup_select"); value_editor->connect("value_changed", this,"_value_editor_changed"); @@ -3316,6 +3339,8 @@ Tree::Tree() { hide_folding=false; + text_changed=false; + } diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 54e6a9c6b9..2562e6aaef 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -271,7 +271,6 @@ friend class TreeItem; bool range_drag_enabled; Vector2 range_drag_capture_pos; - //TreeItem *cursor_item; //int cursor_column; @@ -314,6 +313,8 @@ friend class TreeItem; void select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col,TreeItem *p_prev=NULL,bool *r_in_range=NULL); int propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_doubleclick,TreeItem *p_item,int p_button,const InputModifierState& p_mod); void text_editor_enter(String p_text); + void text_editor_changed(String p_text); + void text_editor_hide(); void value_editor_changed(double p_value); void popup_select(int p_option); @@ -418,6 +419,8 @@ friend class TreeItem; bool hide_folding; + bool text_changed; + protected: static void _bind_methods(); diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 74f866afb7..1f0a2e403a 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -48,26 +48,51 @@ AudioServer *AudioServer::get_singleton() { void AudioServer::sample_set_signed_data(RID p_sample, const DVector<float>& p_buffer) { + SampleFormat format = sample_get_format(p_sample); + + ERR_EXPLAIN("IMA ADPCM is not supported."); + ERR_FAIL_COND(format==SAMPLE_FORMAT_IMA_ADPCM); + int len = p_buffer.size(); ERR_FAIL_COND( len == 0 ); DVector<uint8_t> data; - data.resize(len*2); - DVector<uint8_t>::Write w=data.write(); - - int16_t *samples = (int16_t*)w.ptr(); - + DVector<uint8_t>::Write w; DVector<float>::Read r = p_buffer.read(); - for(int i=0;i<len;i++) { - - float sample = r[i]; - sample = Math::floor( sample * (1<<16) ); - if (sample<-32768) - sample=-32768; - else if (sample>32767) - sample=32767; - samples[i]=sample; + switch(format) { + case SAMPLE_FORMAT_PCM8: { + data.resize(len); + w=data.write(); + + int8_t *samples8 = (int8_t*)w.ptr(); + + for(int i=0;i<len;i++) { + + float sample = Math::floor( r[i] * (1<<8) ); + if (sample<-128) + sample=-128; + else if (sample>127) + sample=127; + samples8[i]=sample; + } + } break; + case SAMPLE_FORMAT_PCM16: { + data.resize(len*2); + w=data.write(); + + int16_t *samples16 = (int16_t*)w.ptr(); + + for(int i=0;i<len;i++) { + + float sample = Math::floor( r[i] * (1<<16) ); + if (sample<-32768) + sample=-32768; + else if (sample>32767) + sample=32767; + samples16[i]=sample; + } + } break; } w = DVector<uint8_t>::Write(); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 3888ed23a6..eae2d69dd9 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -164,7 +164,7 @@ void EditorNode::_update_title() { void EditorNode::_unhandled_input(const InputEvent& p_event) { - if (p_event.type==InputEvent::KEY && p_event.key.pressed && !p_event.key.echo) { + if (p_event.type==InputEvent::KEY && p_event.key.pressed && !p_event.key.echo && !gui_base->get_viewport()->gui_has_modal_stack()) { switch(p_event.key.scancode) { diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 1e16f32e6e..76e4af5f16 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -2329,7 +2329,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { script_list = memnew( ItemList ); script_split->add_child(script_list); script_list->set_custom_minimum_size(Size2(0,0)); - script_split->set_split_offset(70); + script_split->set_split_offset(140); tab_container = memnew( TabContainer ); tab_container->set_tabs_visible(false); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 286a8f25b1..16e4d4ec6c 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -27,7 +27,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "property_editor.h" -#include "scene/gui/label.h" #include "io/resource_loader.h" #include "io/image_loader.h" #include "object_type_db.h" @@ -35,7 +34,6 @@ #include "globals.h" #include "scene/resources/font.h" #include "pair.h" -#include "scene/scene_string_names.h" #include "editor_settings.h" #include "editor_import_export.h" #include "editor_node.h" @@ -43,6 +41,8 @@ #include "array_property_edit.h" #include "editor_help.h" #include "scene/resources/packed_scene.h" +#include "os/input.h" +#include "os/keyboard.h" void CustomPropertyEditor::_notification(int p_what) { @@ -52,11 +52,16 @@ void CustomPropertyEditor::_notification(int p_what) { RID ci = get_canvas_item(); get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); - /* - if (v.get_type()==Variant::COLOR) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( 10,10,60, get_size().height-20 ), v ); - }*/ + } else if (p_what==NOTIFICATION_POPUP_HIDE) { + + if (!text_changed) + return; + + if (Input::get_singleton()->is_key_pressed(KEY_ESCAPE)) + return; + + _modified(String()); } } @@ -235,6 +240,8 @@ String CustomPropertyEditor::get_name() const { bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Type p_type, const Variant& p_variant,int p_hint,String p_hint_text) { + text_changed=false; + owner=p_owner; updating=true; name=p_name; @@ -254,8 +261,6 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty value_editor[i]->hide(); value_label[i]->hide(); - if (i<4) - scroll[i]->hide(); } for (int i=0;i<MAX_ACTION_BUTTONS;i++) { @@ -591,44 +596,10 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; case Variant::COLOR: { - color_picker->show(); color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA); color_picker->set_color(v); set_size( Size2(300, color_picker->get_combined_minimum_size().height+10)); - /* - int ofs=80; - int m=10; - int h=20; - Color c=v; - float values[4]={c.r,c.g,c.b,c.a}; - for (int i=0;i<4;i++) { - int y=m+i*h; - - value_editor[i]->show(); - value_label[i]->show(); - value_label[i]->set_pos(Point2(ofs,y)); - scroll[i]->set_min(0); - scroll[i]->set_max(1.0); - scroll[i]->set_page(0); - scroll[i]->set_pos(Point2(ofs+15,y+Math::floor((h-scroll[i]->get_minimum_size().height)/2.0))); - scroll[i]->set_val(values[i]); - scroll[i]->set_size(Size2(120,1)); - scroll[i]->show(); - value_editor[i]->set_pos(Point2(ofs+140,y)); - value_editor[i]->set_size(Size2(40,h)); - value_editor[i]->set_text( String::num(values[i],2 )); - - } - - value_label[0]->set_text("R"); - value_label[1]->set_text("G"); - value_label[2]->set_text("B"); - value_label[3]->set_text("A"); - - Size2 new_size = value_editor[3]->get_pos() + value_editor[3]->get_size() + Point2(10,10); - set_size( new_size ); - */ } break; case Variant::IMAGE: { @@ -1184,37 +1155,8 @@ void CustomPropertyEditor::_action_pressed(int p_which) { } break; default: {}; } - -} - -void CustomPropertyEditor::_scroll_modified(double p_value) { - - if (updating) - return; - /* - switch(type) { - - case Variant::COLOR: { - - for (int i=0;i<4;i++) { - - value_editor[i]->set_text( String::num(scroll[i]->get_val(),2) ); - } - Color c; - c.r=scroll[0]->get_val(); - c.g=scroll[1]->get_val(); - c.b=scroll[2]->get_val(); - c.a=scroll[3]->get_val(); - v=c; - update(); - emit_signal("variant_changed"); - } break; - default: {} - } - */ } - void CustomPropertyEditor::_drag_easing(const InputEvent& p_ev) { @@ -1309,6 +1251,7 @@ void CustomPropertyEditor::_modified(String p_string) { if (updating) return; updating=true; + text_changed=false; switch(type) { case Variant::REAL: { @@ -1435,20 +1378,8 @@ void CustomPropertyEditor::_modified(String p_string) { } break; case Variant::COLOR: { - /* - for (int i=0;i<4;i++) { - scroll[i]->set_val( value_editor[i]->get_text().to_double() ); - } - Color c; - c.r=value_editor[0]->get_text().to_double(); - c.g=value_editor[1]->get_text().to_double(); - c.b=value_editor[2]->get_text().to_double(); - c.a=value_editor[3]->get_text().to_double(); - v=c; - update(); - emit_signal("variant_changed"); - */ + } break; case Variant::IMAGE: { @@ -1601,9 +1532,11 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns,int value_label[i]->hide(); } } +} +void CustomPropertyEditor::_text_editor_changed(String p_text) { - + text_changed=true; } void CustomPropertyEditor::_bind_methods() { @@ -1612,7 +1545,6 @@ void CustomPropertyEditor::_bind_methods() { ObjectTypeDB::bind_method("_focus_exit", &CustomPropertyEditor::_focus_exit); ObjectTypeDB::bind_method("_modified",&CustomPropertyEditor::_modified); ObjectTypeDB::bind_method("_range_modified", &CustomPropertyEditor::_range_modified); - ObjectTypeDB::bind_method("_scroll_modified",&CustomPropertyEditor::_scroll_modified); ObjectTypeDB::bind_method("_action_pressed",&CustomPropertyEditor::_action_pressed); ObjectTypeDB::bind_method("_file_selected",&CustomPropertyEditor::_file_selected); ObjectTypeDB::bind_method("_type_create_selected",&CustomPropertyEditor::_type_create_selected); @@ -1620,9 +1552,9 @@ void CustomPropertyEditor::_bind_methods() { ObjectTypeDB::bind_method("_color_changed",&CustomPropertyEditor::_color_changed); ObjectTypeDB::bind_method("_draw_easing",&CustomPropertyEditor::_draw_easing); ObjectTypeDB::bind_method("_drag_easing",&CustomPropertyEditor::_drag_easing); - ObjectTypeDB::bind_method( "_text_edit_changed",&CustomPropertyEditor::_text_edit_changed); - ObjectTypeDB::bind_method( "_menu_option",&CustomPropertyEditor::_menu_option); - + ObjectTypeDB::bind_method("_text_edit_changed",&CustomPropertyEditor::_text_edit_changed); + ObjectTypeDB::bind_method("_menu_option",&CustomPropertyEditor::_menu_option); + ObjectTypeDB::bind_method("_text_editor_changed",&CustomPropertyEditor::_text_editor_changed); ADD_SIGNAL( MethodInfo("variant_changed") ); ADD_SIGNAL( MethodInfo("resource_edit_request") ); @@ -1633,6 +1565,8 @@ CustomPropertyEditor::CustomPropertyEditor() { read_only=false; updating=false; + text_changed=false; + for (int i=0;i<MAX_VALUE_EDITORS;i++) { value_editor[i]=memnew( LineEdit ); @@ -1642,22 +1576,11 @@ CustomPropertyEditor::CustomPropertyEditor() { value_editor[i]->hide(); value_label[i]->hide(); value_editor[i]->connect("text_entered", this,"_modified"); + value_editor[i]->connect("text_changed", this, "_text_editor_changed"); value_editor[i]->connect("focus_enter", this, "_focus_enter"); value_editor[i]->connect("focus_exit", this, "_focus_exit"); } - for(int i=0;i<4;i++) { - - scroll[i] = memnew( HScrollBar ); - scroll[i]->hide(); - scroll[i]->set_min(0); - scroll[i]->set_max(1.0); - scroll[i]->set_step(0.01); - add_child(scroll[i]); - scroll[i]->connect("value_changed", this,"_scroll_modified"); - - } - for(int i=0;i<20;i++) { checks20[i]=memnew( Button ); checks20[i]->set_toggle_mode(true); @@ -1729,7 +1652,6 @@ CustomPropertyEditor::CustomPropertyEditor() { easing_draw->hide(); easing_draw->connect("draw",this,"_draw_easing"); easing_draw->connect("input_event",this,"_drag_easing"); - //easing_draw->emit_signal(SceneStringNames::get_singleton()->input_event,InputEvent()); easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE); menu = memnew(PopupMenu); diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 5dc2f6d154..2e533a0c64 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -38,8 +38,6 @@ #include "scene/gui/menu_button.h" #include "scene/gui/texture_frame.h" #include "scene/gui/text_edit.h" -#include "scene/gui/check_button.h" -#include "scene/gui/split_container.h" #include "scene_tree_editor.h" /** @@ -85,7 +83,6 @@ class CustomPropertyEditor : public Popup { String hint_text; LineEdit *value_editor[MAX_VALUE_EDITORS]; Label *value_label[MAX_VALUE_EDITORS]; - HScrollBar *scroll[4]; Button *action_buttons[MAX_ACTION_BUTTONS]; MenuButton *type_button; Vector<String> inheritors_array; @@ -106,7 +103,6 @@ class CustomPropertyEditor : public Popup { void _text_edit_changed(); void _file_selected(String p_file); - void _scroll_modified(double p_value); void _modified(String p_string); void _range_modified(double p_value); void _focus_enter(); @@ -126,6 +122,10 @@ class CustomPropertyEditor : public Popup { void config_value_editors(int p_amount, int p_columns,int p_label_w,const List<String>& p_strings); void config_action_buttons(const List<String>& p_strings); + bool text_changed; + + void _text_editor_changed(String p_text); + protected: void _notification(int p_what); diff --git a/tools/html_fs/godot.html b/tools/html_fs/godot.html index 6176fe7afa..c354826e1f 100644 --- a/tools/html_fs/godot.html +++ b/tools/html_fs/godot.html @@ -93,23 +93,15 @@ top: 0; right: 0; bottom: 0; - } - - #status-table { - /* vertical centering per table... */ - display: table; - width: 100%; - height: 100%; - } - - #status-table-cell { - display: table-cell; - vertical-align: middle; + display: flex; + justify-content: center; + align-items: center; + /* don't consume click events - make children visible explicitly */ + visibility: hidden; } #status { - /* hidden until explicitly shown in debug mode */ - visibility: hidden; + visibility: visible; padding: 4px 6px; } @@ -184,9 +176,9 @@ <canvas id="canvas" width="$GODOT_CANVAS_WIDTH" height="$GODOT_CANVAS_HEIGHT" onclick="canvas.ownerDocument.defaultView.focus();" oncontextmenu="event.preventDefault();"> HTML5 canvas appears to be unsupported in the current browser.<br />Please try updating or use a different browser. </canvas> - <div id="status-container"><div id="status-table"><div id="status-table-cell"> + <div id="status-container"> <span id="status" class="godot" onclick="this.style.visibility='hidden';">Loading page...</span> - </div></div></div> + </div> <div id="controls" class="godot"> <label id="display-output"><input id="output-toggle" type="checkbox" autocomplete="off" onchange="Presentation.setOutputVisible(this.checked);" />display output</label> <!-- hidden until implemented |