Skip to content

heppocogne/godot-svgsprite

Repository files navigation

godot-svgsprite

GDNative addon for dynamic svg rendering.
Please use "gdextension" branch for Godot 4.

How to use

Build

  1. Clone this repository
    (Current directory=project root)

    git clone https://github.com/heppocogne/godot-svgsprite --recursive
    cd godot-svgsprite
    
  2. Build godot-cpp library
    For more information, please check the official documentation.
    (Current directory=project root)

    cd cpp/godot-cpp
    scons platform=<platform> generate_bindings=yes target=debug/release
    

    (wait a minute)

    cd ../
    
  3. Build lunasvg library
    (Current directory=cpp/)

    mkdir lunasvg_build
    cd lunasvg_build
    cmake -DCMAKE_BUILD_TYPE=Debug/Release -G Ninja ../lunasvg
    ninja
    cd ../../
    
  4. Build godot-svgsprite library
    (Current directory=project root)

    mkdir bin
    scons platform=<platform> target_name=libgodot-svgsprite target=debug/release
    

Enjoy the demo project!

Install addon

  1. Copy "addons" and "bin" folders to your project folder
    image
  2. Project > ProjectSetting > Plugins: Activate SVGSprite plugin
    image

Export project

When you export your project or resource package(*.pck,*.zip), make sure to add "_rawsvg/*" folder as a "non-resource folder". image

Note

Note that this addon uses lunasvg for svg rasterization, but godot3.x uses nanosvg, so the rendering result may not be the same.