diff options
49 files changed, 334 insertions, 393 deletions
diff --git a/SConstruct b/SConstruct index 4fd1b86f54..705ef4881c 100644 --- a/SConstruct +++ b/SConstruct @@ -189,7 +189,17 @@ for k in platform_opts.keys(): opts.Add(o) for x in module_list: - opts.Add(BoolVariable('module_' + x + '_enabled', "Enable module '%s'" % (x, ), True)) + module_enabled = True + tmppath = "./modules/" + x + sys.path.append(tmppath) + try: + import config + if (not config.is_enabled()): + module_enabled = False + except: + pass + sys.path.remove(tmppath) + opts.Add(BoolVariable('module_' + x + '_enabled', "Enable module '%s'" % (x, ), module_enabled)) opts.Update(env_base) # update environment Help(opts.GenerateHelpText(env_base)) # generate help diff --git a/doc/classes/AudioEffectAmplify.xml b/doc/classes/AudioEffectAmplify.xml index 8497042b53..35d7991833 100644 --- a/doc/classes/AudioEffectAmplify.xml +++ b/doc/classes/AudioEffectAmplify.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectAmplify" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> - Amplifies the volume of an audio source. + Adds a Amplify audio effect to an Audio bus. + Increases or decreases the volume of the selected audio bus. </brief_description> <description> - Amplifies the volume of an audio source. Increase gain of the audio being routed through the bus. + Increases or decreases the volume being routed through the audio bus. </description> <tutorials> </tutorials> @@ -15,7 +16,6 @@ <return type="float"> </return> <description> - Returns the set maximum volume. </description> </method> <method name="set_volume_db"> @@ -24,13 +24,12 @@ <argument index="0" name="volume" type="float"> </argument> <description> - Sets the maximum volume. </description> </method> </methods> <members> <member name="volume_db" type="float" setter="set_volume_db" getter="get_volume_db"> - The effect's volume limit. + Amount of amplification. Positive values make the sound louder, negative values make it quieter. Value can range from -80 to 24. Default value: [code]0[/code]. </member> </members> <constants> diff --git a/doc/classes/AudioEffectCompressor.xml b/doc/classes/AudioEffectCompressor.xml index 5a7a91ede0..9d7e25dbf2 100644 --- a/doc/classes/AudioEffectCompressor.xml +++ b/doc/classes/AudioEffectCompressor.xml @@ -1,8 +1,16 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectCompressor" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a Compressor audio effect to an Audio bus. + Reduces sounds that exceed a certain threshold level, smooths out the dynamics and increases the overall volume. </brief_description> <description> + Dynamic range compressor reduces the level of the sound when the amplitude goes over a certain threshold in Decibels. One of the main uses of a compressor is to increase the dynamic range by clipping as little as possible (when sound goes over 0dB). + Compressor has many uses in the mix: + - In the Master bus to compress the whole output (Although a [AudioEffectLimiter] is probably better) + - In voice channels to ensure they sound as balanced as possible. + - Sidechained. Sidechained, which can reduce the sound level sidechained with another audio bus for threshold detection.. This technique is very common in video game mixing to download the level of Music/SFX while voices are being heard. + - Accentuates transients by using a wider attack, making effects sound more punchy. </description> <tutorials> </tutorials> @@ -110,18 +118,25 @@ </methods> <members> <member name="attack_us" type="float" setter="set_attack_us" getter="get_attack_us"> + Compressor's reaction time when the signal exceeds the threshold. Value can range from 20 to 2000. Default value: [code]20ms[/code]. </member> <member name="gain" type="float" setter="set_gain" getter="get_gain"> + Gain applied to the output signal. </member> <member name="mix" type="float" setter="set_mix" getter="get_mix"> + Balance between original signal and effect signal. Value can range from 0 (totally dry) to 1 (totally wet). Default value: [code]1[/code]. </member> <member name="ratio" type="float" setter="set_ratio" getter="get_ratio"> + Amount of compression applied to the audio once it passes the threshold level. The higher the ratio the more the loud parts of the audio will be compressed. Value can range from 1 to 48. Default value: [code]4[/code]. </member> <member name="release_ms" type="float" setter="set_release_ms" getter="get_release_ms"> + Compressor's delay time to stop reducing the signal after the signal level falls below the threshold. Value can range from 20 to 2000. Default value: [code]250ms[/code]. </member> <member name="sidechain" type="String" setter="set_sidechain" getter="get_sidechain"> + Reduce the sound level using another audio bus for threshold detection. </member> <member name="threshold" type="float" setter="set_threshold" getter="get_threshold"> + The level above which compression is applied to the audio. Value can range from -60 to 0. Default value: [code]0[/code]. </member> </members> <constants> diff --git a/doc/classes/AudioEffectDelay.xml b/doc/classes/AudioEffectDelay.xml index 8d317b3c46..9dc61883ab 100644 --- a/doc/classes/AudioEffectDelay.xml +++ b/doc/classes/AudioEffectDelay.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectDelay" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a Delay audio effect to an Audio bus. Plays input signal back after a period of time. + Two tap delay and feedback options. </brief_description> <description> + Plays input signal back after a period of time. The delayed signal may be played back multiple times to create the sound of a repeating, decaying echo. Delay effects range from a subtle echo effect to a pronounced blending of previous sounds with new sounds. </description> <tutorials> </tutorials> @@ -194,30 +197,43 @@ </methods> <members> <member name="dry" type="float" setter="set_dry" getter="get_dry"> + Output percent of original sound. At 0, only delayed sounds are output. Value can range from 0 to 1. Default value: [code]1[/code]. </member> <member name="feedback/active" type="bool" setter="set_feedback_active" getter="is_feedback_active"> + If [code]true[/code] feedback is enabled. Default value: [code]false[/code]. </member> <member name="feedback/delay_ms" type="float" setter="set_feedback_delay_ms" getter="get_feedback_delay_ms"> + Feedback delay time in milliseconds. Default value: [code]340[/code]. </member> <member name="feedback/level_db" type="float" setter="set_feedback_level_db" getter="get_feedback_level_db"> + Sound level for [code]tap1[/code]. Default value: [code]-6 dB[/code]. </member> <member name="feedback/lowpass" type="float" setter="set_feedback_lowpass" getter="get_feedback_lowpass"> + Low-pass filter for feedback. Frequencies below the Low Cut value are filtered out of the source signal. Default value: [code]16000[/code]. </member> <member name="tap1/active" type="bool" setter="set_tap1_active" getter="is_tap1_active"> + If [code]true[/code], [code]tap1[/code] will be enabled. Default value: [code]true[/code]. </member> <member name="tap1/delay_ms" type="float" setter="set_tap1_delay_ms" getter="get_tap1_delay_ms"> + [b]Tap1[/b] delay time in milliseconds. Default value: [code]250ms[/code]. </member> <member name="tap1/level_db" type="float" setter="set_tap1_level_db" getter="get_tap1_level_db"> + Sound level for [code]tap1[/code]. Default value: [code]-6 dB[/code]. </member> <member name="tap1/pan" type="float" setter="set_tap1_pan" getter="get_tap1_pan"> + Pan position for [code]tap1[/code]. Value can range from -1 (fully left) to 1 (fully right). Default value: [code]0.2[/code]. </member> <member name="tap2/active" type="bool" setter="set_tap2_active" getter="is_tap2_active"> + If [code]true[/code], [code]tap2[/code] will be enabled. Default value: [code]true[/code]. </member> <member name="tap2/delay_ms" type="float" setter="set_tap2_delay_ms" getter="get_tap2_delay_ms"> + [b]Tap2[/b] delay time in milliseconds. Default value: [code]500ms[/code]. </member> <member name="tap2/level_db" type="float" setter="set_tap2_level_db" getter="get_tap2_level_db"> + Sound level for [code]tap2[/code]. Default value: [code]-12 dB[/code]. </member> <member name="tap2/pan" type="float" setter="set_tap2_pan" getter="get_tap2_pan"> + Pan position for [code]tap2[/code]. Value can range from -1 (fully left) to 1 (fully right). Default value: [code]-0.4[/code]. </member> </members> <constants> diff --git a/doc/classes/AudioEffectDistortion.xml b/doc/classes/AudioEffectDistortion.xml index e5c5a3b50e..1a6aa1d2b6 100644 --- a/doc/classes/AudioEffectDistortion.xml +++ b/doc/classes/AudioEffectDistortion.xml @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectDistortion" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a Distortion audio effect to an Audio bus. + Modify the sound to make it dirty. </brief_description> <description> + Modify the sound and make it dirty. Differents types available : clip, tan, lofi (bit crushing), overdrive, or waveshape. + By distorting the waveform the frequency content change, which will often make the sound "crunchy" or "abrasive". For games, it can simulate sound coming from some saturated device or speaker very efficiently. </description> <tutorials> </tutorials> @@ -82,26 +86,35 @@ </methods> <members> <member name="drive" type="float" setter="set_drive" getter="get_drive"> + Distortion power. Value can range from 0 to 1. Default value: [code]0[/code]. </member> <member name="keep_hf_hz" type="float" setter="set_keep_hf_hz" getter="get_keep_hf_hz"> + High-pass filter. Frequencies higher than this value will not be affected by the distortion. Value can range from 1 to 20000. Default value: [code]16000[/code]. </member> <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="AudioEffectDistortion.Mode"> + Distortion type. Default value: [code]MODE_CLIP[/code]. </member> <member name="post_gain" type="float" setter="set_post_gain" getter="get_post_gain"> + Increases or decreases the volume after the effect. Value can range from -80 to 24. Default value: [code]0[/code]. </member> <member name="pre_gain" type="float" setter="set_pre_gain" getter="get_pre_gain"> + Increases or decreases the volume before the effect. Value can range from -60 to 60. Default value: [code]0[/code]. </member> </members> <constants> <constant name="MODE_CLIP" value="0"> + Digital distortion effect which cuts off peaks at the top and bottom of the waveform. </constant> <constant name="MODE_ATAN" value="1"> </constant> <constant name="MODE_LOFI" value="2"> + Low-resolution digital distortion effect. You can use it to emulate the sound of early digital audio devices. </constant> <constant name="MODE_OVERDRIVE" value="3"> + Emulates the warm distortion produced by a field effect transistor, which is commonly used in solid-state musical instrument amplifiers. </constant> <constant name="MODE_WAVESHAPE" value="4"> + Waveshaper distortions are used mainly by electronic musicians to achieve an extra-abrasive sound. </constant> </constants> </class> diff --git a/doc/classes/AudioEffectEQ.xml b/doc/classes/AudioEffectEQ.xml index 94d5c696c3..246f6b882e 100644 --- a/doc/classes/AudioEffectEQ.xml +++ b/doc/classes/AudioEffectEQ.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectEQ" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Base class for audio equalizers. Gives you control over frequencies. + Use it to create a custom equalizer if [AudioEffectEQ6], [AudioEffectEQ10] or [AudioEffectEQ21] don't fit your needs. </brief_description> <description> + AudioEffectEQ gives you control over frequencies. Use it to compensate for existing deficiencies in audio. AudioEffectEQ are very useful on the Master Bus to completely master a mix and give it character. They are also very useful when a game is run on a mobile device, to adjust the mix to that kind of speakers (it can be added but disabled when headphones are plugged). </description> <tutorials> </tutorials> @@ -13,6 +16,7 @@ <return type="int"> </return> <description> + Returns the number of bands of the equalizer. </description> </method> <method name="get_band_gain_db" qualifiers="const"> @@ -21,6 +25,7 @@ <argument index="0" name="band_idx" type="int"> </argument> <description> + Returns the band's gain at the specified index, in dB. </description> </method> <method name="set_band_gain_db"> @@ -31,6 +36,7 @@ <argument index="1" name="volume_db" type="float"> </argument> <description> + Sets band's gain at the specified index, in dB. </description> </method> </methods> diff --git a/doc/classes/AudioEffectEQ10.xml b/doc/classes/AudioEffectEQ10.xml index 004236dfde..7a29f4cc0b 100644 --- a/doc/classes/AudioEffectEQ10.xml +++ b/doc/classes/AudioEffectEQ10.xml @@ -1,8 +1,23 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectEQ10" inherits="AudioEffectEQ" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a 10-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 31 Hz to 16000 Hz. + Each frequency can be modulated between -60/+24 dB. </brief_description> <description> + Frequency bands : + Band 1 : 31 Hz + Band 2 : 62 Hz + Band 3 : 125 Hz + Band 4 : 250 Hz + Band 5 : 500 Hz + Band 6 : 1000 Hz + Band 7 : 2000 Hz + Band 8 : 4000 Hz + Band 9 : 8000 Hz + Band 10 : 16000 Hz + + See also [AudioEffectEQ], [AudioEffectEQ6], [AudioEffectEQ21]. </description> <tutorials> </tutorials> diff --git a/doc/classes/AudioEffectEQ21.xml b/doc/classes/AudioEffectEQ21.xml index e4faa9bb0c..327f5a291a 100644 --- a/doc/classes/AudioEffectEQ21.xml +++ b/doc/classes/AudioEffectEQ21.xml @@ -1,8 +1,34 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectEQ21" inherits="AudioEffectEQ" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a 21-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 22 Hz to 22000 Hz. + Each frequency can be modulated between -60/+24 dB. </brief_description> <description> + Frequency bands : + Band 1 : 22 Hz + Band 2 : 32 Hz + Band 3 : 44 Hz + Band 4 : 63 Hz + Band 5 : 90 Hz + Band 6 : 125 Hz + Band 7 : 175 Hz + Band 8 : 250 Hz + Band 9 : 350 Hz + Band 10 : 500 Hz + Band 11 : 700 Hz + Band 12 : 1000 Hz + Band 13 : 1400 Hz + Band 14 : 2000 Hz + Band 15 : 2800 Hz + Band 16 : 4000 Hz + Band 17 : 5600 Hz + Band 18 : 8000 Hz + Band 19 : 11000 Hz + Band 20 : 16000 Hz + Band 21 : 22000 Hz + + See also [AudioEffectEQ], [AudioEffectEQ6], [AudioEffectEQ10]. </description> <tutorials> </tutorials> diff --git a/doc/classes/AudioEffectEQ6.xml b/doc/classes/AudioEffectEQ6.xml index b74cc5d285..bc05535041 100644 --- a/doc/classes/AudioEffectEQ6.xml +++ b/doc/classes/AudioEffectEQ6.xml @@ -1,8 +1,19 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectEQ6" inherits="AudioEffectEQ" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a 6-band equalizer audio effect to an Audio bus. Gives you control over frequencies from 32 Hz to 10000 Hz. + Each frequency can be modulated between -60/+24 dB. </brief_description> <description> + Frequency bands : + Band 1 : 32 Hz + Band 2 : 100 Hz + Band 3 : 320 Hz + Band 4 : 1000 Hz + Band 5 : 3200 Hz + Band 6 : 10000 Hz + + See also [AudioEffectEQ], [AudioEffectEQ10], [AudioEffectEQ21]. </description> <tutorials> </tutorials> diff --git a/doc/classes/AudioEffectLimiter.xml b/doc/classes/AudioEffectLimiter.xml index e52fb57c70..5209f290b1 100644 --- a/doc/classes/AudioEffectLimiter.xml +++ b/doc/classes/AudioEffectLimiter.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectLimiter" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a soft clip Limiter audio effect to an Audio bus. </brief_description> <description> + A limiter is similar to a compressor, but it’s less flexible and designed to disallow sound going over a given dB threshold. Adding one in the Master Bus is always recommended to reduce the effects of clipping. + Soft clipping starts to reduce the peaks a little below the threshold level and progressively increases its effect as the input level increases such that the threshold is never exceeded. </description> <tutorials> </tutorials> @@ -68,12 +71,15 @@ </methods> <members> <member name="ceiling_db" type="float" setter="set_ceiling_db" getter="get_ceiling_db"> + The waveform's maximum allowed value. Value can range from -20 to -0.1. Default value: [code]-0.1dB[/code]. </member> <member name="soft_clip_db" type="float" setter="set_soft_clip_db" getter="get_soft_clip_db"> + Applies a gain to the limited waves. Value can range from 0 to 6. Default value: [code]2dB[/code]. </member> <member name="soft_clip_ratio" type="float" setter="set_soft_clip_ratio" getter="get_soft_clip_ratio"> </member> <member name="threshold_db" type="float" setter="set_threshold_db" getter="get_threshold_db"> + Threshold from which the limiter begins to be active. Value can range from -30 to 0. Default value: [code]0dB[/code]. </member> </members> <constants> diff --git a/doc/classes/AudioEffectPanner.xml b/doc/classes/AudioEffectPanner.xml index b55d7f91c1..56b39a36c6 100644 --- a/doc/classes/AudioEffectPanner.xml +++ b/doc/classes/AudioEffectPanner.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectPanner" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a Panner audio effect to an Audio bus. Pans sound left or right. </brief_description> <description> + Determines how much of an audio signal is sent to the left and right buses. </description> <tutorials> </tutorials> @@ -26,6 +28,7 @@ </methods> <members> <member name="pan" type="float" setter="set_pan" getter="get_pan"> + Pan position. Value can range from -1 (fully left) to 1 (fully right). </member> </members> <constants> diff --git a/doc/classes/AudioEffectPhaser.xml b/doc/classes/AudioEffectPhaser.xml index 7e9cd27a47..bd9067471b 100644 --- a/doc/classes/AudioEffectPhaser.xml +++ b/doc/classes/AudioEffectPhaser.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectPhaser" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a Phaser audio effect to an Audio bus. + Combines the original signal with a copy that is slightly out of phase with the original. </brief_description> <description> + Combines phase-shifted signals with the original signal. The movement of the phase-shifted signals is controlled using a Low Frequency Oscillator. </description> <tutorials> </tutorials> @@ -82,14 +85,19 @@ </methods> <members> <member name="depth" type="float" setter="set_depth" getter="get_depth"> + Governs how high the filter frequencies sweep. Low value will primarily affect bass frequencies. High value can sweep high into the treble. Value can range from 0.1 to 4. Default value: [code]1[/code]. </member> <member name="feedback" type="float" setter="set_feedback" getter="get_feedback"> + Output percent of modified sound. Value can range from 0.1 to 0.9. Default value: [code]0.7[/code]. </member> <member name="range_max_hz" type="float" setter="set_range_max_hz" getter="get_range_max_hz"> + Determines the maximum frequency affected by the LFO modulations. Value can range from 10 to 10000. Default value: [code]1600hz[/code]. </member> <member name="range_min_hz" type="float" setter="set_range_min_hz" getter="get_range_min_hz"> + Determines the minimum frequency affected by the LFO modulations. Value can range from 10 to 10000. Default value: [code]440hz[/code]. </member> <member name="rate_hz" type="float" setter="set_rate_hz" getter="get_rate_hz"> + Adjusts the rate at which the effect sweeps up and down across the frequency range. </member> </members> <constants> diff --git a/doc/classes/AudioEffectPitchShift.xml b/doc/classes/AudioEffectPitchShift.xml index 6fc3acdc20..edcb54e09e 100644 --- a/doc/classes/AudioEffectPitchShift.xml +++ b/doc/classes/AudioEffectPitchShift.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectPitchShift" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a Pitch shift audio effect to an Audio bus. + Raises or lowers the pitch of original sound. </brief_description> <description> + Allows modulation of pitch independently of tempo. All frequencies can be increased/decreased with minimal effect on transients. </description> <tutorials> </tutorials> @@ -26,6 +29,7 @@ </methods> <members> <member name="pitch_scale" type="float" setter="set_pitch_scale" getter="get_pitch_scale"> + Pitch value. Can range from 0 (-1 octave) to 16 (+16 octaves). </member> </members> <constants> diff --git a/doc/classes/AudioEffectReverb.xml b/doc/classes/AudioEffectReverb.xml index b390fa239c..4cda24530b 100644 --- a/doc/classes/AudioEffectReverb.xml +++ b/doc/classes/AudioEffectReverb.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectReverb" inherits="AudioEffect" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Adds a Reverb audio effect to an Audio bus. + Simulates the sound of acoustic environments such as rooms, concert halls, caverns, or an open spaces. </brief_description> <description> + Simulates rooms of different sizes. Its parameters can be adjusted to simulate the sound of a specific room. </description> <tutorials> </tutorials> @@ -124,20 +127,28 @@ </methods> <members> <member name="damping" type="float" setter="set_damping" getter="get_damping"> + Widens or narrows the stereo image of the reverb tail. 1 means fully widens. Value can range from 0 to 1. Default value: [code]1[/code]. </member> <member name="dry" type="float" setter="set_dry" getter="get_dry"> + Output percent of original sound. At 0, only modified sound is outputted. Value can range from 0 to 1. Default value: [code]1[/code]. </member> <member name="hipass" type="float" setter="set_hpf" getter="get_hpf"> + High-pass filter passes signals with a frequency higher than a certain cutoff frequency and attenuates signals with frequencies lower than the cutoff frequency. Value can range from 0 to 1. Default value: [code]0[/code]. </member> <member name="predelay_feedback" type="float" setter="set_predelay_msec" getter="get_predelay_msec"> + Output percent of predelay. Value can range from 0 to 1. Default value: [code]1[/code]. </member> <member name="predelay_msec" type="float" setter="set_predelay_msec" getter="get_predelay_msec"> + Time between the original signal and the early reflections of the reverb signal. Default value: [code]150ms[/code]. </member> <member name="room_size" type="float" setter="set_room_size" getter="get_room_size"> + Dimensions of simulated room. Bigger means more echoes. Value can range from 0 to 1. Default value: [code]0.8[/code]. </member> <member name="spread" type="float" setter="set_spread" getter="get_spread"> + Defines how reflective the imaginary room's walls are. Value can range from 0 to 1. Default value: [code]1[/code]. </member> <member name="wet" type="float" setter="set_wet" getter="get_wet"> + Output percent of modified sound. At 0, only original sound is outputted. Value can range from 0 to 1. Default value: [code]0.5[/code]. </member> </members> <constants> diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml index a38b2f61cf..8bff140bb4 100644 --- a/doc/classes/JSON.xml +++ b/doc/classes/JSON.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="JSON" inherits="Object" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Helper class for parsing JSON data. </brief_description> <description> + Helper class for parsing JSON data. </description> <tutorials> </tutorials> @@ -15,6 +17,7 @@ <argument index="0" name="json" type="String"> </argument> <description> + Parses a JSON encoded string and returns a [JSONParseResult] containing the result. </description> </method> <method name="print"> @@ -23,6 +26,7 @@ <argument index="0" name="value" type="Variant"> </argument> <description> + Converts a Variant var to JSON text and returns the result. Useful for serializing data to store or send over the network. </description> </method> </methods> diff --git a/doc/classes/JSONParseResult.xml b/doc/classes/JSONParseResult.xml index 6aeb614508..86edaaf1e6 100644 --- a/doc/classes/JSONParseResult.xml +++ b/doc/classes/JSONParseResult.xml @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="JSONParseResult" inherits="Reference" category="Core" version="3.0.alpha.custom_build"> <brief_description> + Data class wrapper for decoded JSON. </brief_description> <description> + Returned by [method JSON.parse], [JSONParseResult] contains decoded JSON or error information if JSON source not successfully parsed. You can check if JSON source was successfully parsed with [code]if json_result.error == 0[/code]. </description> <tutorials> </tutorials> @@ -68,12 +70,24 @@ </methods> <members> <member name="error" type="int" setter="set_error" getter="get_error" enum="Error"> + The error type if JSON source was not successfully parsed. See [@Global Scope]ERR_* constants. </member> <member name="error_line" type="int" setter="set_error_line" getter="get_error_line"> + The line number where the error occurred if JSON source was not successfully parsed. </member> <member name="error_string" type="String" setter="set_error_string" getter="get_error_string"> + The error message if JSON source was not successfully parsed. See [@Global Scope]ERR_* constants. </member> <member name="result" type="Variant" setter="set_result" getter="get_result"> + A [Variant] containing the parsed JSON. Use typeof() to check if it is what you expect. For exemple, if JSON source starts with braces [code]{}[/code] a [Dictionary] will be returned, if JSON source starts with array braces [code][][/code] an [Array] will be returned. + [i]Be aware that the JSON specification does not define integer or float types, but only a number type. Therefore, parsing a JSON text will convert all numerical values to float types.[/i] + [codeblock] + p = JSON.parse('["hello", "world", "!"]') + if typeof(p) == TYPE_ARRAY: + print(p[0]) # prints 'hello' + else: + print("unexpected results") + [/codeblock] </member> </members> <constants> diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py index 6b6b794f11..314f890bd7 100644 --- a/doc/tools/doc_status.py +++ b/doc/tools/doc_status.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import fnmatch import os import sys import re @@ -356,8 +357,13 @@ for file in input_file_list: class_names.sort() if len(input_class_list) < 1: - input_class_list = class_names + input_class_list = ['*'] +filtered_classes = set() +for pattern in input_class_list: + filtered_classes |= set(fnmatch.filter(class_names, pattern)) +filtered_classes = list(filtered_classes) +filtered_classes.sort() ################################################################################ # Make output table # @@ -369,10 +375,7 @@ table_column_chars = '|' total_status = ClassStatus('Total') -for cn in input_class_list: - if not cn in classes: - print('Cannot find class ' + cn + '!') - sys.exit(255) +for cn in filtered_classes: c = classes[cn] validate_tag(c, 'class') diff --git a/drivers/SCsub b/drivers/SCsub index 195f7ec438..34d6254578 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -13,6 +13,7 @@ SConscript('windows/SCsub') # Sounds drivers SConscript('alsa/SCsub') +SConscript('coreaudio/SCsub') SConscript('pulseaudio/SCsub') if (env["platform"] == "windows"): SConscript("rtaudio/SCsub") diff --git a/drivers/coreaudio/SCsub b/drivers/coreaudio/SCsub new file mode 100644 index 0000000000..233593b0f9 --- /dev/null +++ b/drivers/coreaudio/SCsub @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +Import('env') + +# Driver source files +env.add_source_files(env.drivers_sources, "*.cpp") + +Export('env') diff --git a/platform/osx/audio_driver_osx.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index 3b3ba60507..c531d6af9d 100644 --- a/platform/osx/audio_driver_osx.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* audio_driver_osx.cpp */ +/* audio_driver_coreaudio.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,27 +27,33 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef OSX_ENABLED +#ifdef COREAUDIO_ENABLED -#include "audio_driver_osx.h" +#include "audio_driver_coreaudio.h" #include "core/project_settings.h" #include "os/os.h" #define kOutputBus 0 +#ifdef OSX_ENABLED static OSStatus outputDeviceAddressCB(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *__nullable inClientData) { - AudioDriverOSX *driver = (AudioDriverOSX *)inClientData; + AudioDriverCoreAudio *driver = (AudioDriverCoreAudio *)inClientData; driver->reopen(); return noErr; } +#endif -Error AudioDriverOSX::initDevice() { +Error AudioDriverCoreAudio::initDevice() { AudioComponentDescription desc; zeromem(&desc, sizeof(desc)); desc.componentType = kAudioUnitType_Output; +#ifdef OSX_ENABLED desc.componentSubType = kAudioUnitSubType_HALOutput; +#else + desc.componentSubType = kAudioUnitSubType_RemoteIO; +#endif desc.componentManufacturer = kAudioUnitManufacturer_Apple; AudioComponent comp = AudioComponentFindNext(NULL, &desc); @@ -96,8 +102,10 @@ Error AudioDriverOSX::initDevice() { // Sample rate is independent of channels (ref: https://stackoverflow.com/questions/11048825/audio-sample-frequency-rely-on-channels) buffer_frames = closest_power_of_2(latency * mix_rate / 1000); +#ifdef OSX_ENABLED result = AudioUnitSetProperty(audio_unit, kAudioDevicePropertyBufferFrameSize, kAudioUnitScope_Global, kOutputBus, &buffer_frames, sizeof(UInt32)); ERR_FAIL_COND_V(result != noErr, FAILED); +#endif buffer_size = buffer_frames * channels; samples_in.resize(buffer_size); @@ -109,7 +117,7 @@ Error AudioDriverOSX::initDevice() { AURenderCallbackStruct callback; zeromem(&callback, sizeof(AURenderCallbackStruct)); - callback.inputProc = &AudioDriverOSX::output_callback; + callback.inputProc = &AudioDriverCoreAudio::output_callback; callback.inputProcRefCon = this; result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback)); ERR_FAIL_COND_V(result != noErr, FAILED); @@ -120,7 +128,7 @@ Error AudioDriverOSX::initDevice() { return OK; } -Error AudioDriverOSX::finishDevice() { +Error AudioDriverCoreAudio::finishDevice() { OSStatus result; if (active) { @@ -136,24 +144,26 @@ Error AudioDriverOSX::finishDevice() { return OK; } -Error AudioDriverOSX::init() { +Error AudioDriverCoreAudio::init() { OSStatus result; mutex = Mutex::create(); active = false; channels = 2; +#ifdef OSX_ENABLED outputDeviceAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice; outputDeviceAddress.mScope = kAudioObjectPropertyScopeGlobal; outputDeviceAddress.mElement = kAudioObjectPropertyElementMaster; result = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this); ERR_FAIL_COND_V(result != noErr, FAILED); +#endif return initDevice(); }; -Error AudioDriverOSX::reopen() { +Error AudioDriverCoreAudio::reopen() { bool restart = false; lock(); @@ -185,13 +195,13 @@ Error AudioDriverOSX::reopen() { return OK; } -OSStatus AudioDriverOSX::output_callback(void *inRefCon, +OSStatus AudioDriverCoreAudio::output_callback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { - AudioDriverOSX *ad = (AudioDriverOSX *)inRefCon; + AudioDriverCoreAudio *ad = (AudioDriverCoreAudio *)inRefCon; if (!ad->active || !ad->try_lock()) { for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) { @@ -227,7 +237,7 @@ OSStatus AudioDriverOSX::output_callback(void *inRefCon, return 0; }; -void AudioDriverOSX::start() { +void AudioDriverCoreAudio::start() { if (!active) { OSStatus result = AudioOutputUnitStart(audio_unit); if (result != noErr) { @@ -238,37 +248,41 @@ void AudioDriverOSX::start() { } }; -int AudioDriverOSX::get_mix_rate() const { +int AudioDriverCoreAudio::get_mix_rate() const { return mix_rate; }; -AudioDriver::SpeakerMode AudioDriverOSX::get_speaker_mode() const { +AudioDriver::SpeakerMode AudioDriverCoreAudio::get_speaker_mode() const { return get_speaker_mode_by_total_channels(channels); }; -void AudioDriverOSX::lock() { +void AudioDriverCoreAudio::lock() { if (mutex) mutex->lock(); }; -void AudioDriverOSX::unlock() { +void AudioDriverCoreAudio::unlock() { if (mutex) mutex->unlock(); }; -bool AudioDriverOSX::try_lock() { +bool AudioDriverCoreAudio::try_lock() { if (mutex) return mutex->try_lock() == OK; return true; } -void AudioDriverOSX::finish() { +void AudioDriverCoreAudio::finish() { + OSStatus result; + finishDevice(); - OSStatus result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this); +#ifdef OSX_ENABLED + result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &outputDeviceAddress, &outputDeviceAddressCB, this); if (result != noErr) { ERR_PRINT("AudioObjectRemovePropertyListener failed"); } +#endif AURenderCallbackStruct callback; zeromem(&callback, sizeof(AURenderCallbackStruct)); @@ -283,7 +297,7 @@ void AudioDriverOSX::finish() { } }; -AudioDriverOSX::AudioDriverOSX() { +AudioDriverCoreAudio::AudioDriverCoreAudio() { active = false; mutex = NULL; @@ -296,6 +310,6 @@ AudioDriverOSX::AudioDriverOSX() { samples_in.clear(); }; -AudioDriverOSX::~AudioDriverOSX(){}; +AudioDriverCoreAudio::~AudioDriverCoreAudio(){}; #endif diff --git a/platform/osx/audio_driver_osx.h b/drivers/coreaudio/audio_driver_coreaudio.h index a7e68c8141..33b3ba93ec 100644 --- a/platform/osx/audio_driver_osx.h +++ b/drivers/coreaudio/audio_driver_coreaudio.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* audio_driver_osx.h */ +/* audio_driver_coreaudio.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,20 +27,24 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef OSX_ENABLED +#ifdef COREAUDIO_ENABLED -#ifndef AUDIO_DRIVER_OSX_H -#define AUDIO_DRIVER_OSX_H +#ifndef AUDIO_DRIVER_COREAUDIO_H +#define AUDIO_DRIVER_COREAUDIO_H #include "servers/audio_server.h" #include <AudioUnit/AudioUnit.h> +#ifdef OSX_ENABLED #include <CoreAudio/AudioHardware.h> +#endif -class AudioDriverOSX : public AudioDriver { +class AudioDriverCoreAudio : public AudioDriver { AudioComponentInstance audio_unit; +#ifdef OSX_ENABLED AudioObjectPropertyAddress outputDeviceAddress; +#endif bool active; Mutex *mutex; @@ -62,7 +66,7 @@ class AudioDriverOSX : public AudioDriver { public: const char *get_name() const { - return "AudioUnit"; + return "CoreAudio"; }; virtual Error init(); @@ -76,8 +80,8 @@ public: bool try_lock(); Error reopen(); - AudioDriverOSX(); - ~AudioDriverOSX(); + AudioDriverCoreAudio(); + ~AudioDriverCoreAudio(); }; #endif diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 0ce6c73f92..eaf0b06664 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "rasterizer_scene_gles3.h" - +#include "math_funcs.h" #include "os/os.h" #include "project_settings.h" #include "rasterizer_canvas_gles3.h" @@ -2534,9 +2534,10 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index, const Transform float sign = li->light_ptr->negative ? -1 : 1; Color linear_col = li->light_ptr->color.to_linear(); - ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; - ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; - ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; + //compensate normalized diffuse range by multiplying by PI + ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI; + ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI; + ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI; ubo_data.light_color_energy[3] = 0; //omni, keep at 0 @@ -2674,9 +2675,9 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c float sign = li->light_ptr->negative ? -1 : 1; Color linear_col = li->light_ptr->color.to_linear(); - ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; - ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; - ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; + ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI; + ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI; + ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI; ubo_data.light_color_energy[3] = 0; Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin); @@ -2760,9 +2761,9 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c float sign = li->light_ptr->negative ? -1 : 1; Color linear_col = li->light_ptr->color.to_linear(); - ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; - ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; - ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY]; + ubo_data.light_color_energy[0] = linear_col.r * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI; + ubo_data.light_color_energy[1] = linear_col.g * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI; + ubo_data.light_color_energy[2] = linear_col.b * sign * li->light_ptr->param[VS::LIGHT_PARAM_ENERGY] * Math_PI; ubo_data.light_color_energy[3] = 0; Vector3 pos = p_camera_inverse_transform.xform(li->transform.origin); diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 5c7cfecf3e..41d5ef5bc9 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1,5 +1,6 @@ [vertex] +#define M_PI 3.14159265359 /* from VisualServer: @@ -166,7 +167,7 @@ out vec4 specular_light_interp; void light_compute(vec3 N, vec3 L,vec3 V, vec3 light_color,float roughness,inout vec3 diffuse, inout vec3 specular) { float dotNL = max(dot(N,L), 0.0 ); - diffuse += dotNL * light_color; + diffuse += dotNL * light_color / M_PI; if (roughness > 0.0) { @@ -932,7 +933,7 @@ LIGHT_SHADER_CODE vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) ); float B = 0.45 * sigma2 / (sigma2 + 0.09); - light_amount = diffuse_color * dotNL * (A + vec3(B) * s / t) / M_PI; + light_amount = dotNL * (A + vec3(B) * s / t) / M_PI; } #elif defined(DIFFUSE_TOON) @@ -952,7 +953,7 @@ LIGHT_SHADER_CODE float FD90 = 0.5 + 2.0 * LoH * LoH * roughness; float FdV = 1.0 + (FD90 - 1.0) * SchlickFresnel(NoV); float FdL = 1.0 + (FD90 - 1.0) * SchlickFresnel(NoL); - light_amount = ( (1.0 / M_PI) * FdV * FdL ); + light_amount = ( (1.0 / M_PI) * FdV * FdL ) * NoL; /* float energyBias = mix(roughness, 0.0, 0.5); float energyFactor = mix(roughness, 1.0, 1.0 / 1.51); @@ -965,11 +966,11 @@ LIGHT_SHADER_CODE } #else //lambert - light_amount = dotNL; + light_amount = dotNL / M_PI; #endif #if defined(TRANSMISSION_USED) - diffuse += light_color * diffuse_color * mix(vec3(light_amount),vec3(1.0),transmission) * attenuation; + diffuse += light_color * diffuse_color * mix(vec3(light_amount),vec3(M_PI),transmission) * attenuation; #else diffuse += light_color * diffuse_color * light_amount * attenuation; #endif @@ -1944,18 +1945,19 @@ FRAGMENT_SHADER_CODE //simplify for toon, as specular_light *= specular * metallic * albedo * 2.0; #else - //brdf approximation (Lazarov 2013) - float ndotv = clamp(dot(normal,eye_vec),0.0,1.0); - vec3 dielectric = vec3(0.034) * specular * 2.0; //energy conservation - vec3 f0 = mix(dielectric, albedo, metallic); + vec3 dielectric = vec3(0.034) * specular * 2.0; + vec3 specular_color = mix(dielectric, albedo, metallic); + // Environment brdf approximation (Lazarov 2013) + // see https://www.unrealengine.com/en-US/blog/physically-based-shading-on-mobile const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022); const vec4 c1 = vec4( 1.0, 0.0425, 1.04, -0.04); vec4 r = roughness * c0 + c1; + float ndotv = clamp(dot(normal,eye_vec),0.0,1.0); float a004 = min( r.x * r.x, exp2( -9.28 * ndotv ) ) * r.x + r.y; - vec2 brdf = vec2( -1.04, 1.04 ) * a004 + r.zw; + vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw; - specular_light *= min(1.0,50.0 * f0.g) * brdf.y + brdf.x * f0; + specular_light *= AB.x * specular_color + AB.y; #endif } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index c569f62b5b..a04ded7b5b 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -308,6 +308,10 @@ void EditorNode::_notification(int p_what) { } _update_scene_tabs(); + // debugger area + if (ScriptEditor::get_singleton()->get_debugger()->is_visible()) + bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")); + //_update_icons for (int i = 0; i < singleton->main_editor_buttons.size(); i++) { main_editor_buttons[i]->set_icon(gui_base->get_icon(singleton->main_editor_buttons[i]->get_name(), "EditorIcons")); @@ -4062,29 +4066,25 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) { ERR_FAIL_INDEX(p_idx, bottom_panel_items.size()); if (p_enable) { - // this is the debug panel wich uses tabs, so the top section should be smaller - if (ScriptEditor::get_singleton()->get_debugger() == bottom_panel_items[p_idx].control) { - Ref<StyleBoxFlat> style_panel_invisible_top = gui_base->get_stylebox("debugger_panel", "EditorStyles"); - bottom_panel->add_style_override("panel", style_panel_invisible_top); - } else { - bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); - } for (int i = 0; i < bottom_panel_items.size(); i++) { bottom_panel_items[i].button->set_pressed(i == p_idx); bottom_panel_items[i].control->set_visible(i == p_idx); } + if (ScriptEditor::get_singleton()->get_debugger() == bottom_panel_items[p_idx].control) { // this is the debug panel wich uses tabs, so the top section should be smaller + bottom_panel->add_style_override("panel", gui_base->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")); + } else { + bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); + } center_split->set_dragger_visibility(SplitContainer::DRAGGER_VISIBLE); center_split->set_collapsed(false); } else { bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer")); - for (int i = 0; i < bottom_panel_items.size(); i++) { bottom_panel_items[i].button->set_pressed(false); bottom_panel_items[i].control->set_visible(false); } - center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN); center_split->set_collapsed(true); } diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 2eb5879cad..08bb976bcc 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -426,19 +426,19 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { Ref<StyleBoxEmpty> style_empty = make_empty_stylebox(default_margin_size, default_margin_size, default_margin_size, default_margin_size); // Tabs - const int tab_default_margin_side = 10 * EDSCALE; Ref<StyleBoxFlat> style_tab_selected = style_widget->duplicate(); + style_tab_selected->set_border_width_all(border_width); style_tab_selected->set_border_width(MARGIN_BOTTOM, 0); style_tab_selected->set_border_color_all(dark_color_3); style_tab_selected->set_expand_margin_size(MARGIN_BOTTOM, border_width); - style_tab_selected->set_default_margin(MARGIN_LEFT, tab_default_margin_side); - style_tab_selected->set_default_margin(MARGIN_RIGHT, tab_default_margin_side); + style_tab_selected->set_default_margin(MARGIN_LEFT, 10 * EDSCALE); + style_tab_selected->set_default_margin(MARGIN_RIGHT, 10 * EDSCALE); style_tab_selected->set_bg_color(tab_color); Ref<StyleBoxFlat> style_tab_unselected = style_tab_selected->duplicate(); - style_tab_unselected->set_bg_color(Color(0.0, 0.0, 0.0, 0.0)); - style_tab_unselected->set_border_color_all(Color(0.0, 0.0, 0.0, 0.0)); + style_tab_unselected->set_draw_center(false); + style_tab_unselected->set_border_width_all(0); // Editor background theme->set_stylebox("Background", "EditorStyles", make_flat_stylebox(background_color, default_margin_size, default_margin_size, default_margin_size, default_margin_size)); @@ -688,29 +688,18 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width)); theme->set_stylebox("separator", "VSeparator", make_line_stylebox(separator_color, border_width, 0, true)); - // HACK Debuger panel - Ref<StyleBoxFlat> style_panel_debugger = style_content_panel->duplicate(); - const int v_offset = theme->get_font("font", "Tabs")->get_height() + style_tab_selected->get_minimum_size().height + default_margin_size * EDSCALE; - style_panel_debugger->set_expand_margin_size(MARGIN_TOP, -v_offset); - theme->set_stylebox("debugger_panel", "EditorStyles", style_panel_debugger); - // Debugger - Ref<StyleBoxFlat> style_debugger_contents = style_content_panel->duplicate(); - style_debugger_contents->set_default_margin(MARGIN_LEFT, 0); - style_debugger_contents->set_default_margin(MARGIN_BOTTOM, 0); - style_debugger_contents->set_default_margin(MARGIN_RIGHT, 0); - style_debugger_contents->set_border_width_all(0); - style_debugger_contents->set_expand_margin_size(MARGIN_TOP, -v_offset); - theme->set_constant("extra_margin", "DebuggerPanel", default_margin_size * EDSCALE + border_width); - theme->set_stylebox("DebuggerPanel", "EditorStyles", style_debugger_contents); - Ref<StyleBoxFlat> style_tab_fg_debugger = style_tab_selected->duplicate(); - style_tab_fg_debugger->set_expand_margin_size(MARGIN_LEFT, default_margin_size * EDSCALE + border_width); - style_tab_fg_debugger->set_default_margin(MARGIN_LEFT, tab_default_margin_side - default_margin_size * EDSCALE); - theme->set_stylebox("DebuggerTabFG", "EditorStyles", style_tab_fg_debugger); - Ref<StyleBoxFlat> style_tab_bg_debugger = style_tab_unselected->duplicate(); - style_tab_bg_debugger->set_expand_margin_size(MARGIN_LEFT, default_margin_size * EDSCALE + border_width); - style_tab_bg_debugger->set_default_margin(MARGIN_LEFT, tab_default_margin_side - default_margin_size * EDSCALE); - theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_bg_debugger); + + Ref<StyleBoxFlat> style_panel_debugger = style_content_panel->duplicate(); + style_panel_debugger->set_border_width(MARGIN_BOTTOM, 0); + theme->set_stylebox("DebuggerPanel", "EditorStyles", style_panel_debugger); + theme->set_stylebox("DebuggerTabFG", "EditorStyles", style_tab_selected); + theme->set_stylebox("DebuggerTabBG", "EditorStyles", style_tab_unselected); + + Ref<StyleBoxFlat> style_panel_invisible_top = style_content_panel->duplicate(); + int stylebox_offset = theme->get_font("tab_fg", "TabContainer")->get_height() + theme->get_stylebox("tab_fg", "TabContainer")->get_minimum_size().height + theme->get_stylebox("panel", "TabContainer")->get_default_margin(MARGIN_TOP); + style_panel_invisible_top->set_expand_margin_size(MARGIN_TOP, -stylebox_offset); + theme->set_stylebox("BottomPanelDebuggerOverride", "EditorStyles", style_panel_invisible_top); // LineEdit theme->set_stylebox("normal", "LineEdit", style_widget); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index b6b112b905..0de36df94a 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2668,13 +2668,13 @@ void CanvasItemEditor::_draw_viewport() { all_group = false; } else { for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { - if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_lock_")) { + if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_lock_")) { all_locked = false; break; } } for (List<Node *>::Element *E = selection.front(); E; E = E->next()) { - if (Object::cast_to<Control>(E->get()) && !Object::cast_to<Control>(E->get())->has_meta("_edit_group_")) { + if (Object::cast_to<CanvasItem>(E->get()) && !Object::cast_to<CanvasItem>(E->get())->has_meta("_edit_group_")) { all_group = false; break; } @@ -2704,6 +2704,7 @@ void CanvasItemEditor::_draw_viewport() { over_plugin_list->forward_draw_over_canvas(transform, viewport); } _draw_focus(); + _draw_bones(); } void CanvasItemEditor::_notification(int p_what) { @@ -4181,7 +4182,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & editor_data->get_undo_redo().add_do_property(child, property, texture); // make visible for certain node type - if (default_type == "Patch9Rect") { + if (default_type == "NinePatchRect") { editor_data->get_undo_redo().add_do_property(child, "rect/size", texture_size); } else if (default_type == "Polygon2D") { PoolVector<Vector2> list; @@ -4199,7 +4200,7 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & } Transform2D trans = canvas->get_canvas_transform(); Point2 target_position = (p_point - trans.get_origin()) / trans.get_scale().x - pos; - if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "Patch9Rect") { + if (default_type == "Polygon2D" || default_type == "TouchScreenButton" || default_type == "TextureRect" || default_type == "NinePatchRect") { target_position -= texture_size / 2; } // there's nothing to be used as source position so snapping will work as absolute if enabled @@ -4275,7 +4276,7 @@ void CanvasItemEditorViewport::_perform_drop_data() { child = memnew(TouchScreenButton); else if (default_type == "TextureRect") child = memnew(TextureRect); - else if (default_type == "Patch9Rect") + else if (default_type == "NinePatchRect") child = memnew(NinePatchRect); else child = memnew(Sprite); // default @@ -4437,7 +4438,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte types.push_back("TouchScreenButton"); // Control types.push_back("TextureRect"); - types.push_back("Patch9Rect"); + types.push_back("NinePatchRect"); target_node = NULL; editor = p_node; diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 3370ce51fd..0a7f3ff8f9 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -907,7 +907,7 @@ void TextureRegionEditorPlugin::edit(Object *p_object) { } bool TextureRegionEditorPlugin::handles(Object *p_object) const { - return p_object->is_class("Sprite") || p_object->is_class("Patch9Rect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture"); + return p_object->is_class("Sprite") || p_object->is_class("NinePatchRect") || p_object->is_class("StyleBoxTexture") || p_object->is_class("AtlasTexture"); } void TextureRegionEditorPlugin::make_visible(bool p_visible) { diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 8d3eb5974e..c968f4edd4 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -1045,6 +1045,8 @@ void ScriptEditorDebugger::_notification(int p_what) { tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles")); tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles")); + tabs->set_margin(MARGIN_LEFT, -EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + tabs->set_margin(MARGIN_RIGHT, EditorNode::get_singleton()->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); } break; } } @@ -1622,7 +1624,10 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("DebuggerPanel", "EditorStyles")); tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("DebuggerTabFG", "EditorStyles")); tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("DebuggerTabBG", "EditorStyles")); + tabs->set_anchors_and_margins_preset(Control::PRESET_WIDE); + tabs->set_margin(MARGIN_LEFT, -editor->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); + tabs->set_margin(MARGIN_RIGHT, editor->get_gui_base()->get_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); add_child(tabs); { //debugger diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 11856e4ffb..f0c09a3370 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -110,6 +110,7 @@ GDNativeLibrary::~GDNativeLibrary() { void GDNativeLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("set_library_path", "platform", "path"), &GDNativeLibrary::set_library_path); ClassDB::bind_method(D_METHOD("get_library_path", "platform"), &GDNativeLibrary::get_library_path); + ClassDB::bind_method(D_METHOD("get_active_library_path"), &GDNativeLibrary::get_active_library_path); ClassDB::bind_method(D_METHOD("is_singleton_gdnative"), &GDNativeLibrary::is_singleton_gdnative); ClassDB::bind_method(D_METHOD("set_singleton_gdnative", "singleton"), &GDNativeLibrary::set_singleton_gdnative); @@ -268,6 +269,7 @@ bool GDNative::initialize() { options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR); options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE); options.gd_native_library = (godot_object *)(get_library().ptr()); + options.active_library_path = (godot_string *)&path; library_init_fpointer(&options); diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 19dd030637..9134f1c581 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -243,6 +243,7 @@ typedef struct { uint64_t no_api_hash; godot_object *gd_native_library; // pointer to GDNativeLibrary that is being initialized const struct godot_gdnative_api_struct *api_struct; + const godot_string *active_library_path; } godot_gdnative_init_options; typedef struct { diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index 767ea29f3c..9df2823c35 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -469,7 +469,7 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a if (cmp == scr_B) { //inherits from script, all ok extends_ok = true; - OPCODE_BREAK; + break; } cmp = cmp->_base; diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index e27452354b..9c198ea98e 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -51,7 +51,7 @@ inline void change_nsvg_paint_color(NSVGpaint *p_paint, const uint32_t p_old, co if (p_paint->type == NSVG_PAINT_COLOR) { if (p_paint->color << 8 == p_old << 8) { - p_paint->color = p_new; + p_paint->color = (p_paint->color & 0xFF000000) | (p_new & 0x00FFFFFF); } } diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub index 998d0a3f0d..61798c5f87 100644 --- a/platform/iphone/SCsub +++ b/platform/iphone/SCsub @@ -5,7 +5,6 @@ Import('env') iphone_lib = [ 'os_iphone.cpp', - 'audio_driver_iphone.cpp', 'sem_iphone.cpp', 'gl_view.mm', 'main.m', diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index c7b65b476b..da6ceacdac 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -29,8 +29,8 @@ /*************************************************************************/ #import "app_delegate.h" -#include "audio_driver_iphone.h" #include "core/project_settings.h" +#include "drivers/coreaudio/audio_driver_coreaudio.h" #import "gl_view.h" #include "main/main.h" #include "os_iphone.h" @@ -736,8 +736,8 @@ static int frame_count = 0; }; // Fixed audio can not resume if it is interrupted cause by an incoming phone call - if (AudioDriverIphone::get_singleton() != NULL) - AudioDriverIphone::get_singleton()->start(); + if (AudioDriverCoreAudio::get_singleton() != NULL) + AudioDriverCoreAudio::get_singleton()->start(); } - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { diff --git a/platform/iphone/audio_driver_iphone.cpp b/platform/iphone/audio_driver_iphone.cpp deleted file mode 100644 index dbc5bdb654..0000000000 --- a/platform/iphone/audio_driver_iphone.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/*************************************************************************/ -/* audio_driver_iphone.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* 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 "audio_driver_iphone.h" - -Error AudioDriverIphone::init() { - - active = false; - channels = 2; - - AudioStreamBasicDescription strdesc; - strdesc.mFormatID = kAudioFormatLinearPCM; - strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; - strdesc.mChannelsPerFrame = channels; - strdesc.mSampleRate = 44100; - strdesc.mFramesPerPacket = 1; - strdesc.mBitsPerChannel = 16; - strdesc.mBytesPerFrame = - strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8; - strdesc.mBytesPerPacket = - strdesc.mBytesPerFrame * strdesc.mFramesPerPacket; - - AURenderCallbackStruct callback; - AudioComponentDescription desc; - const AudioUnitElement output_bus = 0; - const AudioUnitElement bus = output_bus; - const AudioUnitScope scope = kAudioUnitScope_Input; - - zeromem(&desc, sizeof(desc)); - desc.componentType = kAudioUnitType_Output; - desc.componentSubType = kAudioUnitSubType_RemoteIO; /* !!! FIXME: ? */ - AudioComponent comp = AudioComponentFindNext(NULL, &desc); - desc.componentManufacturer = kAudioUnitManufacturer_Apple; - - OSStatus result = AudioComponentInstanceNew(comp, &audio_unit); - ERR_FAIL_COND_V(result != noErr, FAILED); - ERR_FAIL_COND_V(comp == NULL, FAILED); - - result = AudioUnitSetProperty(audio_unit, - kAudioUnitProperty_StreamFormat, - scope, bus, &strdesc, sizeof(strdesc)); - ERR_FAIL_COND_V(result != noErr, FAILED); - - zeromem(&callback, sizeof(AURenderCallbackStruct)); - callback.inputProc = &AudioDriverIphone::output_callback; - callback.inputProcRefCon = this; - result = AudioUnitSetProperty(audio_unit, - kAudioUnitProperty_SetRenderCallback, - scope, bus, &callback, sizeof(callback)); - ERR_FAIL_COND_V(result != noErr, FAILED); - - result = AudioUnitInitialize(audio_unit); - ERR_FAIL_COND_V(result != noErr, FAILED); - - result = AudioOutputUnitStart(audio_unit); - ERR_FAIL_COND_V(result != noErr, FAILED); - - const int samples = 1024; - samples_in = memnew_arr(int32_t, samples); // whatever - buffer_frames = samples / channels; - - return FAILED; -}; - -OSStatus AudioDriverIphone::output_callback(void *inRefCon, - AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList *ioData) { - - AudioBuffer *abuf; - AudioDriverIphone *ad = (AudioDriverIphone *)inRefCon; - - bool mix = true; - - if (!ad->active) - mix = false; - else if (ad->mutex) { - mix = ad->mutex->try_lock() == OK; - }; - - if (!mix) { - for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) { - abuf = &ioData->mBuffers[i]; - zeromem(abuf->mData, abuf->mDataByteSize); - }; - return 0; - }; - - int frames_left; - - for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) { - - abuf = &ioData->mBuffers[i]; - frames_left = inNumberFrames; - int16_t *out = (int16_t *)abuf->mData; - - while (frames_left) { - - int frames = MIN(frames_left, ad->buffer_frames); - //ad->lock(); - ad->audio_server_process(frames, ad->samples_in); - //ad->unlock(); - - for (int i = 0; i < frames * ad->channels; i++) { - - out[i] = ad->samples_in[i] >> 16; - } - - frames_left -= frames; - out += frames * ad->channels; - }; - }; - - if (ad->mutex) - ad->mutex->unlock(); - - return 0; -}; - -void AudioDriverIphone::start() { - active = true; - // Resume audio - // iOS audio-thread stoped if it is interrupted cause by an incoming phone call - // Use AudioOutputUnitStart to re-create audio-thread - OSStatus result = AudioOutputUnitStart(audio_unit); - ERR_FAIL_COND(result != noErr); -}; - -int AudioDriverIphone::get_mix_rate() const { - return 44100; -}; - -AudioDriver::SpeakerMode AudioDriverIphone::get_speaker_mode() const { - return SPEAKER_MODE_STEREO; -}; - -void AudioDriverIphone::lock() { - - if (active && mutex) - mutex->lock(); -}; - -void AudioDriverIphone::unlock() { - if (active && mutex) - mutex->unlock(); -}; - -void AudioDriverIphone::finish() { - - memdelete_arr(samples_in); -}; - -AudioDriverIphone::AudioDriverIphone() { - - mutex = Mutex::create(); //NULL; -}; - -AudioDriverIphone::~AudioDriverIphone(){ - -}; diff --git a/platform/iphone/audio_driver_iphone.h b/platform/iphone/audio_driver_iphone.h deleted file mode 100644 index 930ed168f7..0000000000 --- a/platform/iphone/audio_driver_iphone.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************/ -/* audio_driver_iphone.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* 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 "servers/audio_server.h" - -#include <AudioUnit/AudioUnit.h> - -class AudioDriverIphone : public AudioDriver { - - AudioComponentInstance audio_unit; - bool active; - Mutex *mutex; - - int channels; - int32_t *samples_in; - int buffer_frames; - - static OSStatus output_callback(void *inRefCon, - AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList *ioData); - -public: - const char *get_name() const { - return "IPhone"; - }; - - virtual Error init(); - virtual void start(); - virtual int get_mix_rate() const; - virtual SpeakerMode get_speaker_mode() const; - virtual void lock(); - virtual void unlock(); - virtual void finish(); - - AudioDriverIphone(); - ~AudioDriverIphone(); -}; diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index dd4db0b1cd..00d8a59f74 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -148,7 +148,7 @@ def configure(env): env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate' env.Append(CPPPATH=['#platform/iphone']) - env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT']) + env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT', '-DCOREAUDIO_ENABLED']) # TODO: Move that to opus module's config if 'module_opus_enabled' in env and env['module_opus_enabled']: diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index 0e3eeed114..086cbe5010 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -35,7 +35,6 @@ #include "servers/visual/visual_server_raster.h" //#include "servers/visual/visual_server_wrap_mt.h" -#include "audio_driver_iphone.h" #include "main/main.h" #include "core/io/file_access_pack.h" @@ -124,9 +123,8 @@ void OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_ // reset this to what it should be, it will have been set to 0 after visual_server->init() is called RasterizerStorageGLES3::system_fbo = gl_view_base_fb; - audio_driver = memnew(AudioDriverIphone); - audio_driver->set_singleton(); - audio_driver->init(); + AudioDriverManager::add_driver(&audio_driver); + AudioDriverManager::initialize(p_audio_driver); // init physics servers physics_server = memnew(PhysicsServerSW); diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index 475dceebf2..3ebd5a74db 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -32,6 +32,7 @@ #ifndef OS_IPHONE_H #define OS_IPHONE_H +#include "drivers/coreaudio/audio_driver_coreaudio.h" #include "drivers/unix/os_unix.h" #include "os/input.h" @@ -46,8 +47,6 @@ #include "servers/visual/rasterizer.h" #include "servers/visual_server.h" -class AudioDriverIphone; - class OSIPhone : public OS_Unix { public: @@ -70,7 +69,7 @@ private: PhysicsServer *physics_server; Physics2DServer *physics_2d_server; - AudioDriverIphone *audio_driver; + AudioDriverCoreAudio audio_driver; #ifdef GAME_CENTER_ENABLED GameCenter *game_center; diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js index 552f5a7e02..99d1c20bbd 100644 --- a/platform/javascript/engine.js +++ b/platform/javascript/engine.js @@ -84,10 +84,10 @@ rtenvOpts.print = stdout; if (typeof stderr === 'function') rtenvOpts.printErr = stderr; - if (typeof WebAssembly === 'object' && initializer instanceof WebAssembly.Module) { + if (typeof WebAssembly === 'object' && initializer instanceof ArrayBuffer) { rtenvOpts.instantiateWasm = function(imports, onSuccess) { WebAssembly.instantiate(initializer, imports).then(function(result) { - onSuccess(result); + onSuccess(result.instance); }); return {}; }; @@ -241,7 +241,7 @@ return Promise.reject(new Error("Browser doesn't support WebAssembly")); // TODO cache/retrieve module to/from idb engineLoadPromise = loadPromise(basePath + '.wasm').then(function(xhr) { - return WebAssembly.compile(xhr.response); + return xhr.response; }); } else { var asmjsPromise = loadPromise(basePath + '.asm.js').then(function(xhr) { diff --git a/platform/osx/SCsub b/platform/osx/SCsub index 27bffbe80e..be3950bc6d 100644 --- a/platform/osx/SCsub +++ b/platform/osx/SCsub @@ -10,7 +10,6 @@ files = [ 'crash_handler_osx.mm', 'os_osx.mm', 'godot_main_osx.mm', - 'audio_driver_osx.cpp', 'sem_osx.cpp', 'dir_access_osx.mm', 'joypad_osx.cpp', diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 51da000712..f66c3f00da 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -103,7 +103,7 @@ def configure(env): ## Flags env.Append(CPPPATH=['#platform/osx']) - env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DAPPLE_STYLE_KEYS']) + env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED']) env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback']) env.Append(LIBS=['pthread']) diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 6c81da04f5..1f76b7f990 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -31,13 +31,11 @@ #define OS_OSX_H #include "crash_handler_osx.h" -#include "drivers/alsa/audio_driver_alsa.h" -#include "drivers/rtaudio/audio_driver_rtaudio.h" +#include "drivers/coreaudio/audio_driver_coreaudio.h" #include "drivers/unix/os_unix.h" #include "joypad_osx.h" #include "main/input_default.h" #include "os/input.h" -#include "platform/osx/audio_driver_osx.h" #include "power_osx.h" #include "servers/audio_server.h" #include "servers/physics_2d/physics_2d_server_sw.h" @@ -69,7 +67,7 @@ public: IP_Unix *ip_unix; - AudioDriverOSX audio_driver_osx; + AudioDriverCoreAudio audio_driver; InputDefault *input; JoypadOSX *joypad_osx; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 9a26adc155..16bef349dc 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1071,7 +1071,7 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au bool use_gl2 = p_video_driver != 1; - AudioDriverManager::add_driver(&audio_driver_osx); + AudioDriverManager::add_driver(&audio_driver); // only opengl support here... RasterizerGLES3::register_config(); diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 3518113130..a072572142 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -267,6 +267,8 @@ void VehicleWheel::_bind_methods() { ClassDB::bind_method(D_METHOD("set_roll_influence", "roll_influence"), &VehicleWheel::set_roll_influence); ClassDB::bind_method(D_METHOD("get_roll_influence"), &VehicleWheel::get_roll_influence); + ClassDB::bind_method(D_METHOD("get_skidinfo"), &VehicleWheel::get_skidinfo); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_traction"), "set_use_as_traction", "is_used_as_traction"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_as_steering"), "set_use_as_steering", "is_used_as_steering"); ADD_GROUP("Wheel", "wheel_"); @@ -303,6 +305,11 @@ bool VehicleWheel::is_used_as_steering() const { return steers; } +float VehicleWheel::get_skidinfo() const { + + return m_skidInfo; +} + VehicleWheel::VehicleWheel() { steers = false; diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h index eb661adb90..c642eb61b8 100644 --- a/scene/3d/vehicle_body.h +++ b/scene/3d/vehicle_body.h @@ -131,6 +131,8 @@ public: void set_roll_influence(float p_value); float get_roll_influence() const; + float get_skidinfo() const; + String get_configuration_warning() const; VehicleWheel(); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index b0eb12fb6b..0d3cccc2b5 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -941,17 +941,17 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { //too difficult to get right //set_zoom(zoom/ZOOM_SCALE); } - if (b->get_button_index() == BUTTON_WHEEL_UP) { - h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * b->get_factor() / 8); - } - if (b->get_button_index() == BUTTON_WHEEL_DOWN) { - h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * b->get_factor() / 8); + if (b->get_button_index() == BUTTON_WHEEL_UP && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { + v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8); } - if (b->get_button_index() == BUTTON_WHEEL_RIGHT) { + if (b->get_button_index() == BUTTON_WHEEL_DOWN && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * b->get_factor() / 8); } - if (b->get_button_index() == BUTTON_WHEEL_LEFT) { - v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8); + if (b->get_button_index() == BUTTON_WHEEL_RIGHT || (b->get_button_index() == BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) { + h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * b->get_factor() / 8); + } + if (b->get_button_index() == BUTTON_WHEEL_LEFT || (b->get_button_index() == BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) { + h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * b->get_factor() / 8); } } diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index da0f522ff3..2936df7a51 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -370,10 +370,10 @@ void SpatialMaterial::_update_shader() { case CULL_DISABLED: code += ",cull_disabled"; break; } switch (diffuse_mode) { + case DIFFUSE_BURLEY: code += ",diffuse_burley"; break; case DIFFUSE_LAMBERT: code += ",diffuse_lambert"; break; case DIFFUSE_LAMBERT_WRAP: code += ",diffuse_lambert_wrap"; break; case DIFFUSE_OREN_NAYAR: code += ",diffuse_oren_nayar"; break; - case DIFFUSE_BURLEY: code += ",diffuse_burley"; break; case DIFFUSE_TOON: code += ",diffuse_toon"; break; } switch (specular_mode) { @@ -1809,7 +1809,7 @@ void SpatialMaterial::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "vertex_color_is_srgb"), "set_flag", "get_flag", FLAG_SRGB_VERTEX_COLOR); ADD_GROUP("Parameters", "params_"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Lambert,Lambert Wrap,Oren Nayar,Burley,Toon"), "set_diffuse_mode", "get_diffuse_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "params_diffuse_mode", PROPERTY_HINT_ENUM, "Burley,Lambert,Lambert Wrap,Oren Nayar,Toon"), "set_diffuse_mode", "get_diffuse_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "params_specular_mode", PROPERTY_HINT_ENUM, "SchlickGGX,Blinn,Phong,Toon,Disabled"), "set_specular_mode", "get_specular_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "params_blend_mode", PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul"), "set_blend_mode", "get_blend_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "params_cull_mode", PROPERTY_HINT_ENUM, "Back,Front,Disabled"), "set_cull_mode", "get_cull_mode"); @@ -1991,10 +1991,10 @@ void SpatialMaterial::_bind_methods() { BIND_ENUM_CONSTANT(FLAG_TRIPLANAR_USE_WORLD); BIND_ENUM_CONSTANT(FLAG_MAX); + BIND_ENUM_CONSTANT(DIFFUSE_BURLEY); BIND_ENUM_CONSTANT(DIFFUSE_LAMBERT); BIND_ENUM_CONSTANT(DIFFUSE_LAMBERT_WRAP); BIND_ENUM_CONSTANT(DIFFUSE_OREN_NAYAR); - BIND_ENUM_CONSTANT(DIFFUSE_BURLEY); BIND_ENUM_CONSTANT(DIFFUSE_TOON); BIND_ENUM_CONSTANT(SPECULAR_SCHLICK_GGX); diff --git a/scene/resources/material.h b/scene/resources/material.h index cf190f0921..c0e007ac5f 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -185,10 +185,10 @@ public: }; enum DiffuseMode { + DIFFUSE_BURLEY, DIFFUSE_LAMBERT, DIFFUSE_LAMBERT_WRAP, DIFFUSE_OREN_NAYAR, - DIFFUSE_BURLEY, DIFFUSE_TOON, }; |