Giter Site home page Giter Site logo

godot-rive's Introduction

Godot Rive

An integration of Rive into Godot 4.1+ using GDExtension

Warning

This extension is in alpha. That means:

  • You may encounter some bugs
  • It's untested on many platforms
  • Most features are implemented, but the API may change a little

This extensions adds Rive support to Godot 4.

It makes use of the following third-party libraries:

Table of Contents

  1. Features
  2. Building
  3. Installation
  4. Roadmap
  5. Contributing
  6. Screenshots

Features

  • Load .riv files (artboards, animations, and state machines)
  • Listen for input events
  • Change state machine properties in-editor and in code
  • Robust API for runtime interaction
  • Optimized for Godot

Building

Important

These instructions are only tested on M1 MacOS. You may have to modify build/build.py or build/SConstruct for your system.

The following must be installed:

To build, run the following commands (from the root directory):

cd build
python build.py

To see the available options, run:

python build.py --help

Installation

Important

If you are not on M1 MacOS, you will need to build the extension yourself. Binaries are only provided for MacOS universal (debug and release). Eventually, binaries will be provided for other platforms.

  1. Copy demo/bin/, demo/icons/, and demo/rive.gdextension to your project folder
  2. Update the paths in rive.gdextension to match your project folder structure

Roadmap

  • Load .riv files
  • Run and play Rive animations
  • Raster image support
  • Input events (hover, pressed, etc.)
  • Alignment & size exported properties
  • Multiple scenes/artboards
  • Dynamic exported properties based on state machine
  • API for interaction during runtime
  • Add error handling
  • Add signals for event listeners (hover, pressed, etc)
  • Disable/enable event listeners (hover, pressed, etc) in API and editor
  • Optimization
  • Static editor preview
  • Animated editor preview
  • Add reset button
  • .riv ResourceLoader (thumbnails)
  • Other platform support
  • Any missing features

Contributing

Help would be MUCH appreciated testing and/or building for the following platforms:

  • Windows
  • Android
  • iOS
  • Linux
  • Web

Feel free to contribute bug fixes (see open issues), documentation, or features as well.

Screenshots

In-editor screenshot

godot-rive's People

Contributors

audse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

godot-rive's Issues

How can the project be used to make a working character in Godot

Hi @audse ,

Thank you for undertaking such a hugely demanded integration. Ive tried running the demo in godot 4.2 and it really displays the animations. I have experience with rive and flutter integration and ive looked really hard for an alternative to spline and was about to give up and go with skeleton2d godot native animation system when i stumbled upon your project and suddenly remembered Rive.

Did you have success implementing a basic usable character with it in Godot ? If yes can you give me pointers ?

Best regards.

Add `RiveViewer2D` class

The rive viewer extends Control โ€“ which means it can't easily be used as a child of Node2D.

  • Move RiveViewer logic into a separate class (e.g. RiveViewerBase)
  • Modify RiveViewer class to inherit Control and RiveViewerBase
  • Add RiveViewer2D class, inherit Node2D and RiveViewerBase

Multiple inheritance may not be possible, so composition is fine as an alternative.

Add trigger inputs

I'm not sure how to handle Rive's "trigger" input type.

I'm thinking:

  1. For runtime, add a function to RiveInput called trigger or fire or something
  2. For the editor, I think there are two options. Either:
    a. Add a boolean to the editor input list that does not save it's state, or
    b. Add a button to the editor input list (may require an editor plugin?)

Rive render opensource

Now that Rive Render is open-source, do you have plans to integrate with it? I would really like to work on a project using Rive and Godot. Currently, they don't have official support, but your library does a great job. It would be great if you could port it to their Render, which reportedly has excellent performance according to them. Rive Renderer

Add `*.riv` resource loader

The goals for this issue are:

  • Show *.riv files in the file system
  • Show a thumbnail for *.riv files
  • Move loading logic out of RiveFile class

Windows 11 Compilation error

Input args:

PS C:\Users\sande\Downloads\godot-rive-main\build> python build.py -p=windows -t=debug

Debug Log Output:

Running Rive's build script...
Platform: windows
Target: debug
---
fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
  File "C:\Users\sande\Downloads\godot-rive-main\build\build.py", line 236, in <module>
    build_rive(platform, target)
  File "C:\Users\sande\Downloads\godot-rive-main\build\build.py", line 75, in build_rive
    handle_fail(subprocess.call(args, cwd="../thirdparty/rive-cpp"))
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 349, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

same logs when -t=release is used too

Editor crashes when changing file path

Doesn't happen every time, possibly affected by the values of scene and artboard props. Probably a nullptr error in src/rive_extension.cpp or src/rive_controller.cpp.

Has anyone successfully built on Windows?

I got an error after trying to build
`
Traceback (most recent call last):
File "D:\Godot\Godot_v4.2.2-stable_mono_win64\godot-rive\build\build.py", line 236, in
build_rive(platform, target)
File "D:\Godot\Godot_v4.2.2-stable_mono_win64\godot-rive\build\build.py", line 75, in build_rive
handle_fail(subprocess.call(args, cwd="../thirdparty/rive-cpp"))
File "C:\Users\a1247\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 349, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\a1247\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\a1247\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1421, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2]
Process finished with exit code 1

`

`RiveViewer` sometimes doesn't render when resized

In demo/main.tscn, a couple rive viewers (res://examples/joystick.riv, res://examples/rating-animation.riv) don't re-render when the container/window is resized. They just disappear. I am guessing it's related to their interactivity; those are the only two nodes in the scene that listen for hover/click events.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.