diff options
-rw-r--r-- | CODEOWNERS | 87 | ||||
-rw-r--r-- | doc/classes/AnimatedTexture.xml | 22 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 2 | ||||
-rw-r--r-- | editor/editor_inspector.h | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 3 | ||||
-rw-r--r-- | editor/editor_resource_preview.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 19 | ||||
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 4 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 5 | ||||
-rw-r--r-- | scene/2d/animated_sprite.cpp | 2 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 2 |
12 files changed, 112 insertions, 38 deletions
diff --git a/CODEOWNERS b/CODEOWNERS index 27315f2c9d..3a973a100a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,36 +2,57 @@ # Each line is a file pattern followed by one or more owners. # Owners can be @users, @org/teams or emails -core/* @reduz - -doc/* @godotengine/documentation - -drivers/gles2/* @karroffel -drivers/gles3/* @reduz - -editor/icons/* @djrm - -main/* @reduz - -misc/* @akien-mga - -modules/bullet/* @AndreaCatania -modules/enet/* @godotengine/network -modules/gdnative/* @karroffel -modules/gdscript/* @reduz @vnen @bojidar-bg -modules/mbedtls/* @godotengine/network -modules/mobile_vr/* @BastiaanOlij -modules/mono/* @neikeq -modules/regex/* @LeeZH -modules/upnp/* @godotengine/network -modules/websocket/* @godotengine/network - -platform/javascript/* @eska014 -platform/uwp/* @vnen - -scene/main/* @reduz - -server/physics* @reduz @AndreaCatania -server/visual* @reduz @karroffel - -thirdparty/* @akien-mga +/core/ @reduz + +/doc/ @godotengine/documentation +doc_classes/* @godotengine/documentation + +# Rendering +/drivers/gl_context/ @reduz +/drivers/gles2/ @reduz +/drivers/gles3/ @reduz + +# Audio +/drivers/alsa/ @marcelofg55 +/drivers/alsamidi/ @marcelofg55 +/drivers/coreaudio/ @marcelofg55 +/drivers/coremidi/ @marcelofg55 +/drivers/pulseaudio/ @marcelofg55 +/drivers/rtaudio/ @marcelofg55 +/drivers/wasapi/ @marcelofg55 +/drivers/winmidi/ @marcelofg55 +/drivers/xaudio2/ @marcelofg55 + +# Porting +/drivers/unix/ @reduz @hpvb +/drivers/windows/ @reduz @hpvb + +/editor/icons/ @djrm + +/main/ @reduz + +/misc/ @akien-mga + +/modules/bullet/ @AndreaCatania +/modules/csg/ @reduz @BastiaanOlij +/modules/enet/ @godotengine/network +/modules/gdnative/ @karroffel +/modules/gdnative/*arvr/ @BastiaanOlij +/modules/gdscript/ @reduz @vnen @bojidar-bg +/modules/mbedtls/ @godotengine/network +/modules/mobile_vr/ @BastiaanOlij +/modules/mono/ @neikeq +/modules/opensimplex/ @JFonS +/modules/regex/ @LeeZH +/modules/upnp/ @godotengine/network +/modules/websocket/ @godotengine/network + +/platform/javascript/ @eska014 +/platform/uwp/ @vnen + +/scene/main/ @reduz + +/server/physics*/ @reduz @AndreaCatania +/server/visual*/ @reduz @karroffel + +/thirdparty/ @akien-mga diff --git a/doc/classes/AnimatedTexture.xml b/doc/classes/AnimatedTexture.xml index 9dc58ed195..08cd79e78f 100644 --- a/doc/classes/AnimatedTexture.xml +++ b/doc/classes/AnimatedTexture.xml @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimatedTexture" inherits="Texture" category="Core" version="3.1"> <brief_description> + Proxy texture for simple frame-based animations. </brief_description> <description> + [code]AnimatedTexture[/code] is a resource format for simple frame-based animations, where multiple frames textures can be chained automatically with a predefined delay for each frame. It's not a [Node], contrarily to [AnimationPlayer] or [AnimatedSprite], but has the advantage of being usable at any place where a [Texture] resource can be used, e.g. in a [TileSet]. + The playback of the animation is controlled by the [member fps] property as well as each frame's optional delay (see [method set_frame_delay]). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame. + [code]AnimatedTexture[/code] currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one. </description> <tutorials> </tutorials> @@ -15,6 +19,7 @@ <argument index="0" name="frame" type="int"> </argument> <description> + Retrieves the delayed assigned to the given [code]frame[/code] ID. </description> </method> <method name="get_frame_texture" qualifiers="const"> @@ -23,6 +28,7 @@ <argument index="0" name="frame" type="int"> </argument> <description> + Retrieves the [Texture] assigned to the given [code]frame[/code] ID. </description> </method> <method name="set_frame_delay"> @@ -33,6 +39,14 @@ <argument index="1" name="delay" type="float"> </argument> <description> + Defines an additional delay (in seconds) between this frame and the next one, that will be added to the time interval defined by [member fps]. By default, frames have no delay defined. If a delay value is defined, the final time interval between this frame and the next will be [code]1.0 / fps + delay[/code]. + For example, for an animation with 3 frames, 2 FPS and a frame delay on the second frame of 1.2, the resulting playback will be: + [codeblock] + Frame 0: 0.5 s (1 / fps) + Frame 1: 1.7 s (1 / fps + 1.2) + Frame 2: 0.5 s (1 / fps) + Total duration: 2.7 s + [/codeblock] </description> </method> <method name="set_frame_texture"> @@ -43,15 +57,23 @@ <argument index="1" name="texture" type="Texture"> </argument> <description> + Assigns a [Texture] to the given [code]frame[/code] ID. IDs start at 0 (so the first frame has ID 0, and the last frame of the animation has ID [member frames] - 1). + You can define any frame texture up to [constant MAX_FRAMES], but keep in mind that only frames from 0 to [member frames] - 1 will be part of the animation. </description> </method> </methods> <members> <member name="fps" type="float" setter="set_fps" getter="get_fps"> + Number of frames per second. This value defines the default time interval between two frames of the animation, and thus the overall duration of the animation loop based on the [member frames] property. A value of 0 means no predefined number of frames per second, the animation will play according to each frame's frame delay (see [method set_frame_delay]). Default value: 4. + For example, an animation with 8 frames, no frame delay and a [code]fps[/code] value of 2 will run over 4 seconds, with one frame each 0.5 seconds. </member> <member name="frames" type="int" setter="set_frames" getter="get_frames"> + Number of frames to use in the animation. While you can create the frames independently with [method set_frame_texture], you need to set this value for the animation to take new frames into account. The maximum number of frames is [constant MAX_FRAMES]. Default value: 1. </member> </members> <constants> + <constant name="MAX_FRAMES" value="256"> + The maximum number of frames supported by [code]AnimatedTexture[/code]. If you need more frames in your animation, use [AnimationPlayer] or [AnimatedSprite]. + </constant> </constants> </class> diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index d7e0302478..1078fabc2e 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -2010,7 +2010,7 @@ void EditorInspector::_property_changed(const String &p_path, const Variant &p_v } } -void EditorInspector::_property_changed_update_all(const String &p_path, const Variant &p_value) { +void EditorInspector::_property_changed_update_all(const String &p_path, const Variant &p_value, const String &p_name, bool p_changing) { update_tree(); } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 4fb3198e87..3d22cdb9a3 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -302,7 +302,7 @@ class EditorInspector : public ScrollContainer { void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field); void _property_changed(const String &p_path, const Variant &p_value, const String &p_name = "", bool changing = false); - void _property_changed_update_all(const String &p_path, const Variant &p_value); + void _property_changed_update_all(const String &p_path, const Variant &p_value, const String &p_name = "", bool p_changing = false); void _multiple_properties_changed(Vector<String> p_paths, Array p_values); void _property_keyed(const String &p_path, bool p_advance); void _property_keyed_with_value(const String &p_path, const Variant &p_value, bool p_advance); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 0ff0bca7ee..fe4369eb0f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -952,6 +952,9 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { } if (img.is_valid()) { + + img = img->duplicate(); + save.step(TTR("Creating Thumbnail"), 2); save.step(TTR("Creating Thumbnail"), 3); diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 368efbc48f..f77f31db80 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -159,6 +159,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref< small_thumbnail_size *= EDSCALE; Ref<Image> small_image = r_texture->get_data(); + small_image = small_image->duplicate(); small_image->resize(small_thumbnail_size, small_thumbnail_size, Image::INTERPOLATE_CUBIC); r_small_texture.instance(); r_small_texture->create_from_image(small_image); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index a42765df6b..c68023ee9b 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -174,6 +174,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const if (preview_images[i].is_video) { Ref<Image> overlay = get_icon("PlayOverlay", "EditorIcons")->get_data(); Ref<Image> thumbnail = p_image->get_data(); + thumbnail = thumbnail->duplicate(); Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width()) / 2, (thumbnail->get_height() - overlay->get_height()) / 2); thumbnail->lock(); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 00e551fa19..b2d2704f07 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3278,7 +3278,24 @@ void CanvasItemEditor::_notification(int p_what) { pivot_button->set_disabled(nb_having_pivot == 0); // Show / Hide the layout button - presets_menu->set_visible(nb_control > 0 && nb_control == selection.size()); + if (nb_control > 0 && nb_control == selection.size()) { + presets_menu->set_visible(true); + presets_menu->set_tooltip(TTR("Presets for the anchors and margins values of a Control node.")); + + // Disable if the selected node is child of a container + presets_menu->set_disabled(false); + for (List<CanvasItem *>::Element *E = selection.front(); E; E = E->next()) { + Control *control = Object::cast_to<Control>(E->get()); + if (!control || Object::cast_to<Container>(control->get_parent())) { + presets_menu->set_disabled(true); + presets_menu->set_tooltip(TTR("A child of a container gets its anchors and margins values overriden by its parent.")); + break; + } + } + + } else { + presets_menu->set_visible(false); + } // Update the viewport if bones changes for (Map<BoneKey, BoneList>::Element *E = bone_list.front(); E; E = E->next()) { diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 8464dfd0aa..4556b11708 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -99,12 +99,14 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2 } else { Ref<Texture> tex = p_from; img = tex->get_data(); + if (img.is_valid()) { + img = img->duplicate(); + } } if (img.is_null() || img->empty()) return Ref<Texture>(); - img = img->duplicate(); img->clear_mipmaps(); if (img->is_compressed()) { diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index d7ba454051..e820d07a2a 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -442,6 +442,9 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s if (texture.is_valid()) { image = texture->get_data(); + if (image.is_valid()) { + image->duplicate(); + } } if (!image.is_valid() && atlas_texture.is_valid()) { @@ -468,6 +471,8 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s ERR_FAIL_COND(!image.is_valid()); + image = image->duplicate(); + if (atlas_texture.is_valid()) image->crop_from_point( atlas_rect.position.x, diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index 707e95e271..28ddf6b5f8 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -395,8 +395,8 @@ void AnimatedSprite::_notification(int p_what) { int fc = frames->get_frame_count(animation); if (frame >= fc - 1) { if (frames->get_animation_loop(animation)) { - emit_signal(SceneStringNames::get_singleton()->animation_finished); frame = 0; + emit_signal(SceneStringNames::get_singleton()->animation_finished); } else { frame = fc - 1; if (!is_over) { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 26036c08a9..dcad70451e 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -2000,6 +2000,8 @@ void AnimatedTexture::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "frame_" + itos(i) + "/texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_frame_texture", "get_frame_texture", i); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "frame_" + itos(i) + "/delay_sec", PROPERTY_HINT_RANGE, "0.0,16.0,0.01", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_frame_delay", "get_frame_delay", i); } + + BIND_CONSTANT(MAX_FRAMES); } AnimatedTexture::AnimatedTexture() { |