Skip to content

Commit

Permalink
Revert "svg: add Lottie resource importer using ThorVG"
Browse files Browse the repository at this point in the history
This reverts commit 4f773b5.
  • Loading branch information
beicause committed Jan 29, 2025
1 parent 272e188 commit 55fb3bc
Show file tree
Hide file tree
Showing 67 changed files with 1 addition and 28,896 deletions.
21 changes: 0 additions & 21 deletions editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

#include "core/config/project_settings.h"
#include "core/input/input.h"
#include "core/io/resource_importer.h"
#include "core/os/keyboard.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/editor_main_screen.h"
Expand All @@ -49,7 +48,6 @@
#include "editor/scene_tree_dock.h"
#include "editor/themes/editor_scale.h"
#include "editor/themes/editor_theme_manager.h"
#include "scene/2d/animated_sprite_2d.h"
#include "scene/2d/audio_stream_player_2d.h"
#include "scene/2d/polygon_2d.h"
#include "scene/2d/skeleton_2d.h"
Expand All @@ -64,7 +62,6 @@
#include "scene/gui/view_panner.h"
#include "scene/main/canvas_layer.h"
#include "scene/main/window.h"
#include "scene/resources/atlas_texture.h"
#include "scene/resources/packed_scene.h"
#include "scene/resources/style_box_texture.h"

Expand Down Expand Up @@ -5947,23 +5944,6 @@ void CanvasItemEditorViewport::_create_texture_node(Node *p_parent, Node *p_chil
Vector2(0, texture_size.height)
};
undo_redo->add_do_property(p_child, "polygon", list);
} else if (Object::cast_to<AnimatedSprite2D>(p_child)) {
Dictionary meta = ResourceFormatImporter::get_singleton()->get_resource_metadata(p_path);
Ref<SpriteFrames> frames;
frames.instantiate();
frames->set_animation_speed(SceneStringName(default_), meta.get("fps", 5));
Size2i sprite_size = meta["sprite_size"];
for (int i = 0; i < (int)meta["frame_count"]; i++) {
int x = i % (int)meta["columns"] * sprite_size.width;
int y = i / (int)meta["columns"] * sprite_size.height;
Ref<AtlasTexture> atlas_texture;
atlas_texture.instantiate();
atlas_texture->set_atlas(texture);
atlas_texture->set_region(Rect2(x, y, sprite_size.width, sprite_size.height));
frames->add_frame(SceneStringName(default_), atlas_texture);
}
undo_redo->add_do_property(p_child, SceneStringName(autoplay), SceneStringName(default_));
undo_redo->add_do_property(p_child, "sprite_frames", frames);
}

// Compute the global position
Expand Down Expand Up @@ -6369,7 +6349,6 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(CanvasItemEditor *p_canvas_it
texture_node_types.push_back("GPUParticles2D");
texture_node_types.push_back("Polygon2D");
texture_node_types.push_back("TouchScreenButton");
texture_node_types.push_back("AnimatedSprite2D");
// Control
texture_node_types.push_back("TextureRect");
texture_node_types.push_back("TextureButton");
Expand Down
25 changes: 1 addition & 24 deletions modules/svg/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,6 @@ thirdparty_sources = [
"src/renderer/sw_engine/tvgSwStroke.cpp",
]

if env.editor_build:
thirdparty_sources += [
"src/renderer/tvgAnimation.cpp",
# Lottie loader
"src/loaders/lottie/tvgLottieAnimation.cpp",
"src/loaders/lottie/tvgLottieBuilder.cpp",
"src/loaders/lottie/tvgLottieInterpolator.cpp",
"src/loaders/lottie/tvgLottieLoader.cpp",
"src/loaders/lottie/tvgLottieModel.cpp",
"src/loaders/lottie/tvgLottieModifier.cpp",
"src/loaders/lottie/tvgLottieParser.cpp",
"src/loaders/lottie/tvgLottieParserHandler.cpp",
]

if env["module_webp_enabled"]:
thirdparty_sources += ["src/loaders/external_webp/tvgWebpLoader.cpp"]
env_svg.Append(CPPDEFINES=["THORVG_WEBP_LOADER_SUPPORT"])
Expand All @@ -84,9 +70,6 @@ env_svg.Prepend(CPPPATH=[thirdparty_dir + "inc"])
# Enable ThorVG static object linking.
env_svg.Append(CPPDEFINES=["TVG_STATIC"])

if env.editor_build:
env_svg.Append(CPPDEFINES=["THORVG_LOTTIE_LOADER_SUPPORT", "LOTTIE_ENABLED"])

env_thirdparty = env_svg.Clone()
env_thirdparty.disable_warnings()
env_thirdparty.Prepend(
Expand All @@ -100,9 +83,6 @@ env_thirdparty.Prepend(
thirdparty_dir + "src/loaders/jpg",
]
)

if env.editor_build:
env_thirdparty.Prepend(CPPPATH=[thirdparty_dir + "src/loaders/lottie"])
if env["builtin_libpng"]:
env_thirdparty.Prepend(CPPPATH=["#thirdparty/libpng"])
if env["module_webp_enabled"]:
Expand All @@ -117,10 +97,7 @@ env.modules_sources += thirdparty_obj

module_obj = []

env_svg.add_source_files(module_obj, ["register_types.cpp", "image_loader_svg.cpp"])
if env.editor_build:
env_svg.add_source_files(module_obj, "editor/*.cpp")

env_svg.add_source_files(module_obj, "*.cpp")
env.modules_sources += module_obj

# Needed to force rebuilding the module files when the thirdparty library is updated.
Expand Down
10 changes: 0 additions & 10 deletions modules/svg/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,3 @@ def can_build(env, platform):

def configure(env):
pass


def get_doc_classes():
return [
"ResourceImporterLottie",
]


def get_doc_path():
return "doc_classes"
127 changes: 0 additions & 127 deletions modules/svg/doc_classes/ResourceImporterLottie.xml

This file was deleted.

Loading

0 comments on commit 55fb3bc

Please sign in to comment.