diff options
25 files changed, 310 insertions, 99 deletions
diff --git a/core/input_map.cpp b/core/input_map.cpp index 3a0f9596f5..09cb7ce426 100644 --- a/core/input_map.cpp +++ b/core/input_map.cpp @@ -232,64 +232,6 @@ bool InputMap::event_is_action(const InputEvent& p_event, const StringName& p_ac return _find_event(E->get().inputs,p_event)!=NULL; } -bool InputMap::event_is_joy_motion_action_pressed(const InputEvent& p_event) const { - - ERR_FAIL_COND_V(p_event.type!=InputEvent::JOYSTICK_MOTION,false); - bool pressed=false; - - //this could be optimized by having a separate list of joymotions? - - for (Map<StringName, Action>::Element *A=input_map.front();A;A=A->next()) { - - for (List<InputEvent>::Element *E=A->get().inputs.front();E;E=E->next()) { - - const InputEvent& e=E->get(); - if(e.type!=p_event.type) - continue; - if (e.type!=InputEvent::KEY && e.device!=p_event.device) - continue; - - switch(p_event.type) { - - case InputEvent::KEY: { - - if (e.key.scancode==p_event.key.scancode && e.key.mod == p_event.key.mod) - return e.key.pressed; - - } break; - case InputEvent::JOYSTICK_BUTTON: { - - if (e.joy_button.button_index==p_event.joy_button.button_index) { - return e.joy_button.pressed; - } - - } break; - case InputEvent::MOUSE_BUTTON: { - - if (e.mouse_button.button_index==p_event.mouse_button.button_index) { - return e.mouse_button.pressed; - } - - } break; - case InputEvent::JOYSTICK_MOTION: { - - if (e.joy_motion.axis==p_event.joy_motion.axis) { - if ( - (e.joy_motion.axis_value * p_event.joy_motion.axis_value >0) && //same axis - ABS(e.joy_motion.axis_value)>0.5 && ABS(p_event.joy_motion.axis_value)>0.5 ) - pressed=true; - } - - } break; - } - - } - } - - return pressed; - -} - const Map<StringName, InputMap::Action>& InputMap::get_action_map() const { return input_map; } diff --git a/core/input_map.h b/core/input_map.h index a224765d8c..21c479588d 100644 --- a/core/input_map.h +++ b/core/input_map.h @@ -72,7 +72,6 @@ public: const List<InputEvent> *get_action_list(const StringName& p_action); bool event_is_action(const InputEvent& p_event, const StringName& p_action) const; - bool event_is_joy_motion_action_pressed(const InputEvent& p_event) const; const Map<StringName, Action>& get_action_map() const; void load_from_globals(); diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 9d920724e1..9982767be1 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -204,7 +204,7 @@ bool InputEvent::is_pressed() const { case MOUSE_BUTTON: return mouse_button.pressed; case JOYSTICK_BUTTON: return joy_button.pressed; case SCREEN_TOUCH: return screen_touch.pressed; - case JOYSTICK_MOTION: return InputMap::get_singleton()->event_is_joy_motion_action_pressed(*this); + case JOYSTICK_MOTION: return ABS(joy_motion.axis_value) > 0.5; case ACTION: return action.pressed; default: {} } diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 8473fdcd19..5f052bce8e 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -346,6 +346,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_LOCALMEM0R(Vector2,angle); // VCALL_LOCALMEM1R(Vector2,cross); VCALL_LOCALMEM0R(Vector2,abs); + VCALL_LOCALMEM1R(Vector2,clamped); VCALL_LOCALMEM0R(Rect2,get_area); VCALL_LOCALMEM1R(Rect2,intersects); @@ -1457,6 +1458,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC1(VECTOR2,VECTOR2,Vector2,reflect,VECTOR2,"vec",varray()); //ADDFUNC1(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray()); ADDFUNC0(VECTOR2,VECTOR2,Vector2,abs,varray()); + ADDFUNC1(VECTOR2,VECTOR2,Vector2,clamped,REAL,"length",varray()); ADDFUNC0(RECT2,REAL,Rect2,get_area,varray()); ADDFUNC1(RECT2,BOOL,Rect2,intersects,RECT2,"b",varray()); diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 6865bb1378..ab4610d4f7 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -11697,6 +11697,13 @@ Get the general settings for the editor (the same window that appears in the Settings menu). </description> </method> + <method name="get_editor_viewport"> + <return type="Control"> + </return> + <description> + Get the main editor control. Use this as a parent for main screens. + </description> + </method> <method name="get_name" qualifiers="virtual"> <return type="String"> </return> @@ -42913,18 +42920,33 @@ </class> <class name="Tree" inherits="Control" category="Core"> <brief_description> + Control to show a tree of items. </brief_description> <description> + This shows a tree of items that can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like text editing, buttons and popups. It can be useful for structural displaying and interactions. + Trees are built via code, using [TreeItem] objects to create the structure. They have a single root but multiple root can be simulated if a dummy hidden root is added. + [codeblock] + func _ready(): + var tree = Tree.new() + var root = tree.create_item() + tree.set_hide_root(true) + var child1 = tree.create_item(root) + var child2 = tree.create_item(root) + var subchild1 = tree.create_item(child1) + subchild1.set_text(0, "Subchild1") + [/codeblock] </description> <methods> <method name="are_column_titles_visible" qualifiers="const"> <return type="bool"> </return> <description> + Get whether the column titles are being shown. </description> </method> <method name="clear"> <description> + Clear the tree. This erases all of the items. </description> </method> <method name="create_item"> @@ -42933,16 +42955,19 @@ <argument index="0" name="parent" type="TreeItem" default="NULL"> </argument> <description> + Create an item in the tree and add it as the last child of [code]parent[/code]. If parent is not given, it will be added as the last child of the root, or it'll the be the root itself if the tree is empty. </description> </method> <method name="ensure_cursor_is_visible"> <description> + Make the current selected item visible. This will scroll the tree to make sure the selected item is in sight. </description> </method> <method name="get_allow_rmb_select" qualifiers="const"> <return type="bool"> </return> <description> + Get whether a right click can select items. </description> </method> <method name="get_column_at_pos" qualifiers="const"> @@ -42951,6 +42976,7 @@ <argument index="0" name="pos" type="Vector2"> </argument> <description> + Get the column index under the given point. </description> </method> <method name="get_column_title" qualifiers="const"> @@ -42959,6 +42985,7 @@ <argument index="0" name="column" type="int"> </argument> <description> + Get the title of the given column. </description> </method> <method name="get_column_width" qualifiers="const"> @@ -42967,36 +42994,42 @@ <argument index="0" name="column" type="int"> </argument> <description> + Get the width of the given column in pixels. </description> </method> <method name="get_columns" qualifiers="const"> <return type="int"> </return> <description> + Get the amount of columns. </description> </method> <method name="get_custom_popup_rect" qualifiers="const"> <return type="Rect2"> </return> <description> + Get the rectangle for custom popups. Helper to create custom cell controls that display a popup. See [method TreeItem.set_cell_mode]. </description> </method> <method name="get_drop_mode_flags" qualifiers="const"> <return type="int"> </return> <description> + Get the flags of the current drop mode. </description> </method> <method name="get_edited" qualifiers="const"> <return type="TreeItem"> </return> <description> + Get the current edited item. This is only available for custom cell mode. </description> </method> <method name="get_edited_column" qualifiers="const"> <return type="int"> </return> <description> + Get the column of the cell for the current edited icon. This is only available for custom cell mode. </description> </method> <method name="get_item_area_rect" qualifiers="const"> @@ -43007,6 +43040,7 @@ <argument index="1" name="column" type="int" default="-1"> </argument> <description> + Get the rectangle area of the the specified item. If column is specified, only get the position and size of that column, otherwise get the rectangle containing all columns. </description> </method> <method name="get_item_at_pos" qualifiers="const"> @@ -43015,6 +43049,7 @@ <argument index="0" name="pos" type="Vector2"> </argument> <description> + Get the tree item at the specified position (relative to the tree origin position). </description> </method> <method name="get_next_selected"> @@ -43023,42 +43058,49 @@ <argument index="0" name="from" type="TreeItem"> </argument> <description> + Get the next selected item after the given one. </description> </method> <method name="get_pressed_button" qualifiers="const"> <return type="int"> </return> <description> + Get the index of the last pressed button. </description> </method> <method name="get_root"> <return type="TreeItem"> </return> <description> + Get the root item of the tree. </description> </method> <method name="get_scroll" qualifiers="const"> <return type="Vector2"> </return> <description> + Get the current scrolling position. </description> </method> <method name="get_selected" qualifiers="const"> <return type="TreeItem"> </return> <description> + Get the currently selected item. </description> </method> <method name="get_selected_column" qualifiers="const"> <return type="int"> </return> <description> + Get the column number of the current selection. </description> </method> <method name="get_single_select_cell_editing_only_when_already_selected" qualifiers="const"> <return type="bool"> </return> <description> + Get whether the editing of a cell should only happen when it is already selected. </description> </method> <method name="is_delayed_text_editor_enabled" qualifiers="const"> @@ -43071,12 +43113,14 @@ <return type="bool"> </return> <description> + Get whether the folding arrow is hidden. </description> </method> <method name="set_allow_rmb_select"> <argument index="0" name="allow" type="bool"> </argument> <description> + Set whether or not a right mouse button click can select items. </description> </method> <method name="set_column_expand"> @@ -43085,6 +43129,7 @@ <argument index="1" name="expand" type="bool"> </argument> <description> + Set whether a column will have the "Expand" flag of [Control]. </description> </method> <method name="set_column_min_width"> @@ -43093,6 +43138,7 @@ <argument index="1" name="min_width" type="int"> </argument> <description> + Set the minimum width of a column. </description> </method> <method name="set_column_title"> @@ -43101,18 +43147,21 @@ <argument index="1" name="title" type="String"> </argument> <description> + Set the title of a column. </description> </method> <method name="set_column_titles_visible"> <argument index="0" name="visible" type="bool"> </argument> <description> + Set whether the column titles visibility. </description> </method> <method name="set_columns"> <argument index="0" name="amount" type="int"> </argument> <description> + Set the amount of columns. </description> </method> <method name="set_delayed_text_editor"> @@ -43125,30 +43174,35 @@ <argument index="0" name="flags" type="int"> </argument> <description> + Set the drop mode as an OR combination of flags. See [code]DROP_MODE_*[/code] constants. </description> </method> <method name="set_hide_folding"> <argument index="0" name="hide" type="bool"> </argument> <description> + Set whether the folding arrow should be hidden. </description> </method> <method name="set_hide_root"> <argument index="0" name="enable" type="bool"> </argument> <description> + Set whether the root of the tree should be hidden. </description> </method> <method name="set_select_mode"> <argument index="0" name="mode" type="int"> </argument> <description> + Set the selection mode. Use one of the [code]SELECT_*[/code] constants. </description> </method> <method name="set_single_select_cell_editing_only_when_already_selected"> <argument index="0" name="enable" type="bool"> </argument> <description> + Set whether the editing of a cell should only happen when it is already selected. </description> </method> </methods> @@ -43161,32 +43215,38 @@ <argument index="2" name="id" type="int"> </argument> <description> + Emitted when a button on the tree was pressed (see [method TreeItem.add_button]). </description> </signal> <signal name="cell_selected"> <description> + Emitted when a cell is selected. </description> </signal> <signal name="custom_popup_edited"> <argument index="0" name="arrow_clicked" type="bool"> </argument> <description> + Emitted when a cell with the [code]CELL_MODE_CUSTOM[/code] is clicked to be edited. </description> </signal> <signal name="empty_tree_rmb_selected"> <argument index="0" name="pos" type="Vector2"> </argument> <description> + Emitted when the right mouse button is pressed if RMB selection is active and the tree is empty. </description> </signal> <signal name="item_activated"> <description> + Emitted when an item is activated (double-clicked). </description> </signal> <signal name="item_collapsed"> <argument index="0" name="item" type="Object"> </argument> <description> + Emitted when an item is collapsed by a click on the folding arrow. </description> </signal> <signal name="item_double_clicked"> @@ -43195,16 +43255,19 @@ </signal> <signal name="item_edited"> <description> + Emitted when an item is editted. </description> </signal> <signal name="item_rmb_selected"> <argument index="0" name="pos" type="Vector2"> </argument> <description> + Emitted when an item is selected with right mouse button. </description> </signal> <signal name="item_selected"> <description> + Emitted when an item is selected with right mouse button. </description> </signal> <signal name="multi_selected"> @@ -45231,136 +45294,160 @@ do_property]. </class> <class name="VideoPlayer" inherits="Control" category="Core"> <brief_description> + Control to play video files. </brief_description> <description> + This control has the ability to play video streams. The only format accepted is the OGV Theora, so any other format must be converted before using in a project. </description> <methods> <method name="get_audio_track" qualifiers="const"> <return type="int"> </return> <description> + Get the selected audio track (for multitrack videos). </description> </method> <method name="get_buffering_msec" qualifiers="const"> <return type="int"> </return> <description> + Get the amount of miliseconds to store in buffer while playing. </description> </method> <method name="get_stream" qualifiers="const"> <return type="VideoStream"> </return> <description> + Get the video stream. </description> </method> <method name="get_stream_name" qualifiers="const"> <return type="String"> </return> <description> + Get the name of the video stream. </description> </method> <method name="get_stream_pos" qualifiers="const"> <return type="float"> </return> <description> + Get the current position of the stream, in seconds. </description> </method> <method name="get_video_texture"> <return type="Texture"> </return> <description> + Get the current frame of the video as a [Texture]. </description> </method> <method name="get_volume" qualifiers="const"> <return type="float"> </return> <description> + Get the volume of the audio track as a linear value. </description> </method> <method name="get_volume_db" qualifiers="const"> <return type="float"> </return> <description> + Get the volume of the audio track in decibels. </description> </method> <method name="has_autoplay" qualifiers="const"> <return type="bool"> </return> <description> + Get whether or not the video is set as autoplay. </description> </method> <method name="has_expand" qualifiers="const"> <return type="bool"> </return> <description> + Get whether or not the expand property is set. </description> </method> <method name="is_paused" qualifiers="const"> <return type="bool"> </return> <description> + Get whether or not the video is paused. </description> </method> <method name="is_playing" qualifiers="const"> <return type="bool"> </return> <description> + Get whether or not the video is playing. </description> </method> <method name="play"> <description> + Start the video playback. </description> </method> <method name="set_audio_track"> <argument index="0" name="track" type="int"> </argument> <description> + Set the audio track (for multitrack videos). </description> </method> <method name="set_autoplay"> <argument index="0" name="enabled" type="bool"> </argument> <description> + Set whether this node should start playing automatically. </description> </method> <method name="set_buffering_msec"> <argument index="0" name="msec" type="int"> </argument> <description> + Set the amount of miliseconds to buffer during playback. </description> </method> <method name="set_expand"> <argument index="0" name="enable" type="bool"> </argument> <description> + Set the expand property. If enabled, the video will grow or shrink to fit the player size, otherwise it will play at the stream resolution. </description> </method> <method name="set_paused"> <argument index="0" name="paused" type="bool"> </argument> <description> + Set whether the video should pause the playback. </description> </method> <method name="set_stream"> <argument index="0" name="stream" type="VideoStream"> </argument> <description> + Set the video stream for this player. </description> </method> <method name="set_volume"> <argument index="0" name="volume" type="float"> </argument> <description> + Set the audio volume as a linear value. </description> </method> <method name="set_volume_db"> <argument index="0" name="db" type="float"> </argument> <description> + Set the audio volume in decibels. </description> </method> <method name="stop"> <description> + Stop the video playback. </description> </method> </methods> @@ -49760,14 +49847,17 @@ do_property]. </class> <class name="XMLParser" inherits="Reference" category="Core"> <brief_description> + Low-level class for creating parsers for XML files. </brief_description> <description> + This class can serve as base to make custom XML parsers. Since XML is a very flexible standard, this interface is low level so it can be applied to any possible schema. </description> <methods> <method name="get_attribute_count" qualifiers="const"> <return type="int"> </return> <description> + Get the amount of attributes in the current element. </description> </method> <method name="get_attribute_name" qualifiers="const"> @@ -49776,6 +49866,7 @@ do_property]. <argument index="0" name="idx" type="int"> </argument> <description> + Get the name of the attribute specified by the index in [code]idx[/code] argument. </description> </method> <method name="get_attribute_value" qualifiers="const"> @@ -49784,12 +49875,14 @@ do_property]. <argument index="0" name="idx" type="int"> </argument> <description> + Get the value of the attribute specified by the index in [code]idx[/code] argument. </description> </method> <method name="get_current_line" qualifiers="const"> <return type="int"> </return> <description> + Get the current line in the parsed file (currently not implemented). </description> </method> <method name="get_named_attribute_value" qualifiers="const"> @@ -49798,6 +49891,7 @@ do_property]. <argument index="0" name="name" type="String"> </argument> <description> + Get the value of a certain attribute of the current element by name. This will raise an error if the element has no such attribute. </description> </method> <method name="get_named_attribute_value_safe" qualifiers="const"> @@ -49806,30 +49900,35 @@ do_property]. <argument index="0" name="name" type="String"> </argument> <description> + Get the value of a certain attribute of the current element by name. This will return an empty [String] if the attribute is not found. </description> </method> <method name="get_node_data" qualifiers="const"> <return type="String"> </return> <description> + Get the contents of a text node. This will raise an error in any other type of node. </description> </method> <method name="get_node_name" qualifiers="const"> <return type="String"> </return> <description> + Get the name of the current element node. This will raise an error if the current node type is not [code]NODE_ELEMENT[/code] nor [code]NODE_ELEMENT_END[/code] </description> </method> <method name="get_node_offset" qualifiers="const"> <return type="int"> </return> <description> + Get the byte offset of the current node since the beginning of the file or buffer. </description> </method> <method name="get_node_type"> <return type="int"> </return> <description> + Get the type of the current node. Compare with [code]NODE_*[/code] constants. </description> </method> <method name="has_attribute" qualifiers="const"> @@ -49838,12 +49937,14 @@ do_property]. <argument index="0" name="name" type="String"> </argument> <description> + Check whether or not the current element has a certain attribute. </description> </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> <description> + Check whether the current element is empty (this only works for completely empty tags, e.g. <element \>). </description> </method> <method name="open"> @@ -49852,6 +49953,7 @@ do_property]. <argument index="0" name="file" type="String"> </argument> <description> + Open a XML file for parsing. This returns an error code. </description> </method> <method name="open_buffer"> @@ -49860,12 +49962,14 @@ do_property]. <argument index="0" name="buffer" type="RawArray"> </argument> <description> + Open a XML raw buffer for parsing. This returns an error code. </description> </method> <method name="read"> <return type="int"> </return> <description> + Read the next node of the file. This returns an error code. </description> </method> <method name="seek"> @@ -49874,27 +49978,36 @@ do_property]. <argument index="0" name="pos" type="int"> </argument> <description> + Move the buffer cursor to a certain offset (since the beginning) and read the next node there. This returns an error code. </description> </method> <method name="skip_section"> <description> + Skips the current section. If the node contains other elements, they will be ignored and the cursor will go to the closing of the current element. </description> </method> </methods> <constants> <constant name="NODE_NONE" value="0"> + There's no node (no file or buffer opened) </constant> <constant name="NODE_ELEMENT" value="1"> + Element (tag) </constant> <constant name="NODE_ELEMENT_END" value="2"> + End of element </constant> <constant name="NODE_TEXT" value="3"> + Text node </constant> <constant name="NODE_COMMENT" value="4"> + Comment node </constant> <constant name="NODE_CDATA" value="5"> + CDATA content </constant> <constant name="NODE_UNKNOWN" value="6"> + Unknown node </constant> </constants> </class> diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 8350fb0674..d5becc0bfc 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -4666,7 +4666,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const { enablers.push_back("#define USE_LIGHT_SHADER_CODE\n"); } if (light_flags.uses_shadow_color) { - enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n"); + enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n"); } if (light_flags.uses_time || fragment_flags.uses_time || vertex_flags.uses_time) { enablers.push_back("#define USE_TIME\n"); @@ -4709,7 +4709,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const { enablers.push_back("#define USE_TEXPIXEL_SIZE\n"); } if (light_flags.uses_shadow_color) { - enablers.push_back("#define USE_LIGHT_SHADOW_COLOR\n"); + enablers.push_back("#define USE_OUTPUT_SHADOW_COLOR\n"); } if (vertex_flags.uses_worldvec) { diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 3be0fdab17..d4636ed444 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -904,6 +904,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() { mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_VEC"]="light_vec"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_HEIGHT"]="light_height"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_COLOR"]="light"; + mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_SHADOW"]="light_shadow_color"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT_UV"]="light_uv"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["LIGHT"]="light_out"; mode_replace_table[ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT]["SHADOW"]="shadow_color"; diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 285abd30ff..5f4767940d 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -244,7 +244,7 @@ FRAGMENT_SHADER_CODE vec2 light_uv = light_uv_interp.xy; vec4 light = texture2D(light_texture,light_uv) * light_color; -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) vec4 shadow_color=vec4(0.0,0.0,0.0,0.0); #endif @@ -380,7 +380,7 @@ LIGHT_SHADER_CODE #endif -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) color=mix(shadow_color,color,shadow_attenuation); #else //color*=shadow_attenuation; diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl index fd778f3442..477a451f2f 100644 --- a/drivers/gles2/shaders/material.glsl +++ b/drivers/gles2/shaders/material.glsl @@ -1185,7 +1185,7 @@ FRAGMENT_SHADER_CODE vec3 mdiffuse = diffuse.rgb; vec3 light; -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) vec3 shadow_color=vec3(0.0,0.0,0.0); #endif @@ -1209,7 +1209,7 @@ LIGHT_SHADER_CODE #endif diffuse.rgb = const_light_mult * ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation; -#if defined(USE_LIGHT_SHADOW_COLOR) +#if defined(USE_OUTPUT_SHADOW_COLOR) diffuse.rgb += light * shadow_color * attenuation * (1.0 - shadow_attenuation); #endif diff --git a/drivers/vorbis/SCsub b/drivers/vorbis/SCsub index 87805cc2d8..4afafcc4ba 100644 --- a/drivers/vorbis/SCsub +++ b/drivers/vorbis/SCsub @@ -5,7 +5,7 @@ sources = [ ] sources_lib = [ - "vorbis/analysis.c", + #"vorbis/analysis.c", #"vorbis/barkmel.c", "vorbis/bitrate.c", "vorbis/block.c", @@ -27,7 +27,7 @@ sources_lib = [ "vorbis/smallft.c", "vorbis/synthesis.c", #"vorbis/tone.c", - "vorbis/vorbisenc.c", + #"vorbis/vorbisenc.c", "vorbis/vorbisfile.c", "vorbis/window.c", ] diff --git a/main/input_default.cpp b/main/input_default.cpp index 089772edc5..2020f7a5ad 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -849,6 +849,13 @@ uint32_t InputDefault::joy_axis(uint32_t p_last_id, int p_device, int p_axis, co return p_last_id; } + if (ABS(joy.last_axis[p_axis]) > 0.5 && joy.last_axis[p_axis] * p_value.value < 0) { + //changed direction quickly, insert fake event to release pending inputmap actions + JoyAxis jx; + jx.min = p_value.min; + jx.value = p_value.value < 0 ? 0.1 : -0.1; + p_last_id = joy_axis(p_last_id, p_device, p_axis, jx); + } joy.last_axis[p_axis] = p_value.value; float val = p_value.min == 0 ? -1.0f + 2.0f * p_value.value : p_value.value; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 90a8af9238..9e58199f35 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1191,24 +1191,28 @@ void LineEdit::menu_option(int p_option) { switch(p_option) { case MENU_CUT: { - cut_text(); + if (editable) { + cut_text(); + } } break; case MENU_COPY: { copy_text(); } break; case MENU_PASTE: { - - paste_text(); + if (editable) { + paste_text(); + } } break; case MENU_CLEAR: { - clear(); + if (editable) { + clear(); + } } break; case MENU_SELECT_ALL: { select_all(); } break; case MENU_UNDO: { - undo(); } break; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 9db0a66395..8a9ed98a5f 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2542,7 +2542,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { } break; case KEY_X: { - + if (readonly) { + break; + } if (!k.mod.command || k.mod.shift || k.mod.alt) { scancode_handled=false; break; @@ -2574,7 +2576,9 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { undo(); } break; case KEY_V: { - + if (readonly) { + break; + } if (!k.mod.command || k.mod.shift || k.mod.alt) { scancode_handled=false; break; @@ -4527,18 +4531,22 @@ void TextEdit::menu_option(int p_option) { switch( p_option ) { case MENU_CUT: { - - cut(); + if (!readonly) { + cut(); + } } break; case MENU_COPY: { copy(); } break; case MENU_PASTE: { - - paste(); + if (!readonly) { + paste(); + } } break; case MENU_CLEAR: { - clear(); + if (!readonly) { + clear(); + } } break; case MENU_SELECT_ALL: { select_all(); diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 40ae26ba5d..02faa9425d 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -1483,6 +1483,8 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT_COLOR.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT_COLOR.a","",SLOT_TYPE_SCALAR,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightHeight","LIGHT_HEIGHT","",SLOT_TYPE_SCALAR,SLOT_IN}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowColor","LIGHT_SHADOW.rgb","",SLOT_TYPE_VEC,SLOT_IN}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowAlpha","LIGHT_SHADOW.a","",SLOT_TYPE_SCALAR,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"TexPixelSize","vec3(TEXTURE_PIXEL_SIZE,0)","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var1","VAR1.rgb","",SLOT_TYPE_VEC,SLOT_IN}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"Var2","VAR2.rgb","",SLOT_TYPE_VEC,SLOT_IN}, @@ -1490,6 +1492,8 @@ const ShaderGraph::InOutParamInfo ShaderGraph::inout_param_info[]={ //canvas item light out {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightColor","LIGHT.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"LightAlpha","LIGHT.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowColor","SHADOW.rgb","",SLOT_TYPE_VEC,SLOT_OUT}, + {MODE_CANVAS_ITEM,SHADER_TYPE_LIGHT,"ShadowAlpha","SHADOW.a","",SLOT_TYPE_SCALAR,SLOT_OUT}, //end {MODE_MATERIAL,SHADER_TYPE_FRAGMENT,NULL,NULL,NULL,SLOT_TYPE_SCALAR,SLOT_OUT}, diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 09b3ada509..fdf3cb622d 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -1180,6 +1180,7 @@ const ShaderLanguage::BuiltinsDef ShaderLanguage::ci_light_builtins_defs[]={ { "LIGHT_HEIGHT", TYPE_FLOAT}, { "LIGHT_COLOR", TYPE_VEC4}, { "LIGHT_UV", TYPE_VEC2}, + { "LIGHT_SHADOW", TYPE_VEC4}, { "LIGHT", TYPE_VEC4}, { "SHADOW", TYPE_VEC4}, { "POINT_COORD", TYPE_VEC2}, diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 3b1e90a907..1ee0b93114 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3016,7 +3016,7 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) { for(int i=0;i<singleton->main_editor_buttons.size();i++) { - if (p_editor->get_name()==singleton->main_editor_buttons[i]->get_name()) { + if (p_editor->get_name()==singleton->main_editor_buttons[i]->get_text()) { memdelete( singleton->main_editor_buttons[i] ); singleton->main_editor_buttons.remove(i); @@ -6254,9 +6254,9 @@ EditorNode::EditorNode() { overridden_default_layout=-1; default_layout.instance(); - default_layout->set_value(docks_section, "dock_3", TTR("Scene")); - default_layout->set_value(docks_section, "dock_4", TTR("FileSystem")); - default_layout->set_value(docks_section, "dock_5", TTR("Inspector")); + default_layout->set_value(docks_section, "dock_3", TTR("FileSystem")); + default_layout->set_value(docks_section, "dock_5", TTR("Scene")); + default_layout->set_value(docks_section, "dock_6", TTR("Inspector")+","+TTR("Node")); for(int i=0;i<DOCK_SLOT_MAX/2;i++) default_layout->set_value(docks_section, "dock_hsplit_"+itos(i+1), 0); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 55f0e52c88..4b82d5e59c 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -71,6 +71,11 @@ void EditorPlugin::remove_control_from_bottom_panel(Control *p_control) { } +Control * EditorPlugin::get_editor_viewport() { + + return EditorNode::get_singleton()->get_viewport(); +} + void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Control *p_control) { switch(p_location) { @@ -315,6 +320,16 @@ Control *EditorPlugin::get_base_control() { return EditorNode::get_singleton()->get_gui_base(); } +void EditorPlugin::make_bottom_panel_item_visible(Control * p_item) { + + EditorNode::get_singleton()->make_bottom_panel_item_visible(p_item); +} + +void EditorPlugin::hide_bottom_panel() { + + EditorNode::get_singleton()->hide_bottom_panel(); +} + void EditorPlugin::inspect_object(Object *p_obj,const String& p_for_property) { EditorNode::get_singleton()->push_item(p_obj,p_for_property); @@ -333,6 +348,7 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("remove_control_from_bottom_panel","control:Control"),&EditorPlugin::remove_control_from_bottom_panel); ObjectTypeDB::bind_method(_MD("add_custom_type","type","base","script:Script","icon:Texture"),&EditorPlugin::add_custom_type); ObjectTypeDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type); + ObjectTypeDB::bind_method(_MD("get_editor_viewport:Control"), &EditorPlugin::get_editor_viewport); ObjectTypeDB::bind_method(_MD("add_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::add_import_plugin); ObjectTypeDB::bind_method(_MD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::remove_import_plugin); @@ -346,6 +362,9 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("inspect_object","object","for_property"),&EditorPlugin::inspect_object,DEFVAL(String())); ObjectTypeDB::bind_method(_MD("update_canvas"),&EditorPlugin::update_canvas); + ObjectTypeDB::bind_method(_MD("make_bottom_panel_item_visible","item:Control"), &EditorPlugin::make_bottom_panel_item_visible); + ObjectTypeDB::bind_method(_MD("hide_bottom_panel"), &EditorPlugin::hide_bottom_panel); + ObjectTypeDB::bind_method(_MD("get_base_control:Control"),&EditorPlugin::get_base_control); ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo); ObjectTypeDB::bind_method(_MD("get_selection:EditorSelection"),&EditorPlugin::get_selection); diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index 5b944cc27a..2700c49a6c 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -100,6 +100,7 @@ public: void add_control_to_dock(DockSlot p_slot,Control *p_control); void remove_control_from_docks(Control *p_control); void remove_control_from_bottom_panel(Control *p_control); + Control* get_editor_viewport(); virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial); virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform, const InputEvent& p_event); @@ -130,6 +131,9 @@ public: Control *get_base_control(); + void make_bottom_panel_item_visible(Control *p_item); + void hide_bottom_panel(); + void add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); void remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); diff --git a/tools/editor/icons/2x/icon_distraction_free.png b/tools/editor/icons/2x/icon_distraction_free.png Binary files differnew file mode 100644 index 0000000000..034239a4e7 --- /dev/null +++ b/tools/editor/icons/2x/icon_distraction_free.png diff --git a/tools/editor/icons/2x/icon_remote_transform.png b/tools/editor/icons/2x/icon_remote_transform.png Binary files differindex 9ee66bc70c..dad528615a 100644 --- a/tools/editor/icons/2x/icon_remote_transform.png +++ b/tools/editor/icons/2x/icon_remote_transform.png diff --git a/tools/editor/icons/icon_distraction_free.png b/tools/editor/icons/icon_distraction_free.png Binary files differindex 5896de6044..c6f8a08874 100644 --- a/tools/editor/icons/icon_distraction_free.png +++ b/tools/editor/icons/icon_distraction_free.png diff --git a/tools/editor/icons/icon_remote_transform.png b/tools/editor/icons/icon_remote_transform.png Binary files differindex deff925b53..2a8b5f4d0e 100644 --- a/tools/editor/icons/icon_remote_transform.png +++ b/tools/editor/icons/icon_remote_transform.png diff --git a/tools/editor/icons/source/icon_distraction_free.svg b/tools/editor/icons/source/icon_distraction_free.svg new file mode 100644 index 0000000000..4ae48b2fb6 --- /dev/null +++ b/tools/editor/icons/source/icon_distraction_free.svg @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 16 16" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png" + inkscape:export-xdpi="45" + inkscape:export-ydpi="45" + sodipodi:docname="icon_distraction_free.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="32.000001" + inkscape:cx="10.344519" + inkscape:cy="8.9631686" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="false" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:snap-midpoints="true" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true"> + <inkscape:grid + type="xygrid" + id="grid3336" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <path + style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 3.7578125 2.34375 L 2.34375 3.7578125 L 5.2929688 6.7070312 L 6.7070312 5.2929688 L 3.7578125 2.34375 z M 12.242188 2.34375 L 9.2929688 5.2929688 L 10.707031 6.7070312 L 13.65625 3.7578125 L 12.242188 2.34375 z M 5.2929688 9.2929688 L 2.34375 12.242188 L 3.7578125 13.65625 L 6.7070312 10.707031 L 5.2929688 9.2929688 z M 10.707031 9.2929688 L 9.2929688 10.707031 L 12.242188 13.65625 L 13.65625 12.242188 L 10.707031 9.2929688 z " + transform="translate(0,1036.3622)" + id="rect4137" /> + <path + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 1,1051.3622 0,-5 5,5 z" + id="path4155" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccc" /> + <path + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" + id="path4158" + d="m 15,1051.3622 0,-5 -5,5 z" + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 15,1037.3622 0,5 -5,-5 z" + id="path4160" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccc" /> + <path + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" + id="path4162" + d="m 1,1037.3622 0,5 5,-5 z" + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + </g> +</svg> diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 522ceba1dc..fd25843de9 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1362,10 +1362,8 @@ struct _ScriptEditorItemData { void ScriptEditor::_update_script_colors() { - bool enabled = EditorSettings::get_singleton()->get("text_editor/script_temperature_enabled"); + bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/script_temperature_enabled"); bool highlight_current = EditorSettings::get_singleton()->get("text_editor/highlight_current_script"); - if (!enabled) - return; int hist_size = EditorSettings::get_singleton()->get("text_editor/script_temperature_history_size"); Color hot_color=EditorSettings::get_singleton()->get("text_editor/script_temperature_hot_color"); @@ -1379,22 +1377,25 @@ void ScriptEditor::_update_script_colors() { continue; script_list->set_item_custom_bg_color(i,Color(0,0,0,0)); - if (!n->has_meta("__editor_pass")) { - continue; - } - - int pass=n->get_meta("__editor_pass"); - int h = edit_pass - pass; - if (h>hist_size) { - continue; - } - int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; - float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); bool current = tab_container->get_current_tab() == c; if (current && highlight_current) { script_list->set_item_custom_bg_color(i, EditorSettings::get_singleton()->get("text_editor/current_script_background_color")); - } else { + + } else if (script_temperature_enabled) { + + if (!n->has_meta("__editor_pass")) { + continue; + } + + int pass=n->get_meta("__editor_pass"); + int h = edit_pass - pass; + if (h>hist_size) { + continue; + } + int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; + float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); + script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); } } diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index aa66a2e0d9..3ab906f84e 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -2422,6 +2422,7 @@ void ShaderGraphView::_create_node(int p_id) { colors.push_back("Color"); colors.push_back("LightColor"); colors.push_back("Light"); + colors.push_back("ShadowColor"); colors.push_back("Diffuse"); colors.push_back("Specular"); colors.push_back("Emmision"); @@ -2434,6 +2435,7 @@ void ShaderGraphView::_create_node(int p_id) { reals.push_back("ShadeParam"); reals.push_back("SpecularExp"); reals.push_back("LightAlpha"); + reals.push_back("ShadowAlpha"); reals.push_back("PointSize"); reals.push_back("Discard"); |