rive-app / rive-cpp Goto Github PK
View Code? Open in Web Editor NEWC++ runtime for Rive
License: MIT License
C++ runtime for Rive
License: MIT License
How can you make text inside a Rive animation dynamic? Eg use Rive for UI? Have a template that text can be loaded in by host language, etc?
TIA
Hi,
I was willing to try playing with rive-cpp, so I just added it to my third party cmake, added all cpp files and encountered two errors when building with Visual Studio 2019 :
binary_reader.cpp
, readString()
method line 45, MSVC does not like the char rawValue[length];
. I replaced the code bystd::string result;
result.resize(length);
auto readBytes = decode_string(length, m_Position, m_End, result.data());
and it seems ok (at least it compiles). It might not be the best way to handle that if you want to avoid micro allocations so it might not be the best fix.
shapes/star.cpp
, M_PI
is not defined. With MSVC, one needs to add _USE_MATH_DEFINES
before including math.h
. I defined it globally with cmake, but adding the definition before the first cmath
include would make more sense.Update StateInstance::advance to take the StateMachineInstance as an arguments instead of SMIInput** and use StateMachineInstance::input to get a range checked input.
Allow instancing an artboard so it can be shown on the screen multiple times with different states.
I need to do some testing but I think objects that don't successfully import (for whatever reason) will get leaked. @umberto-sonnino's memory leak cleanup made me realize this.
Line 217 in ef3c98a
Our current implementation tries to set a target bitrate but it appears to not force it. It is probably doing some computation to evaluate what's needed and setting the bitrate accordingly.
When we specify a bitrate for the exporter, we want to make sure that value is used in the encoding process.
Is there a plan for building runtime for python. there is already a project for skia-python.
Is it even possible?
This will enable python users to render rive animations for desktop applications,
Hi there,
How do I hide the background of the artboard once loaded?
I'd like to hide (make the color transparent, or remove it etc) by default, and allow the user to enable it manually if required.
artboard = file->artboard();
// What to do here to hide background?
Ideally of course the user would create their own assets with transparent background, but this isn't always possible if using third-party assets :)
Cheers,
Peter
Hi there,
I'm trying to get rive and skia working in a GLFW window but am having trouble. I've only got the old flare examples to go on that I've been able to find. However, a lot seems to have changed since these were written.
Do you have a simple example of at least rendering a rive file to a surface using skia?
Thank you!
As requested by SimpleClub
One shot animations with a work area immediately jump to the end of the animation:
One shots without a work area are fine.
nested_artboard.cpp:87: m_Artboard == nullptr || m_Instance.get()
While building, there are some warnings printed:
In file included from ../submodule/rive-cpp/include/rive/artboard.hpp:6,
from ../submodule/rive-cpp/include/rive/animation/linear_animation_instance.hpp:4,
from ../viewer/viewer.cpp:15:
../submodule/rive-cpp/include/rive/core_context.hpp:9:11: warning: ‘class rive::CoreContext’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
9 | class CoreContext {
| ^~~~~~~~~~~
In file included from ../submodule/rive-cpp/include/rive/artboard.hpp:11,
from ../submodule/rive-cpp/include/rive/animation/linear_animation_instance.hpp:4,
from ../viewer/viewer.cpp:15:
../submodule/rive-cpp/include/rive/shapes/shape_paint_container.hpp:14:11: warning: ‘class rive::ShapePaintContainer’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
14 | class ShapePaintContainer {
| ^~~~~~~~~~~~~~~~~~~
In file included from ../submodule/rive-cpp/include/rive/animation/linear_animation_instance.hpp:4,
from ../viewer/viewer.cpp:15:
../submodule/rive-cpp/include/rive/artboard.hpp:28:11: warning: base class ‘class rive::CoreContext’ has accessible non-virtual destructor [-Wnon-virtual-dtor]
28 | class Artboard : public ArtboardBase, public CoreContext, public ShapePaintContainer {
| ^~~~~~~~
../submodule/rive-cpp/include/rive/artboard.hpp:28:11: warning: base class ‘class rive::ShapePaintContainer’ has accessible non-virtual destructor [-Wnon-virtual-dtor]
In file included from ../submodule/rive-cpp/include/rive/file.hpp:7,
from ../viewer/viewer.cpp:22:
../submodule/rive-cpp/include/rive/file_asset_resolver.hpp:9:11: warning: ‘class rive::FileAssetResolver’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
9 | class FileAssetResolver {
| ^~~~~~~~~~~~~~~~~
../viewer/viewer.cpp: In function ‘void initAnimation(int)’:
../viewer/viewer.cpp:96:29: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
96 | if (index >= 0 && index < artboardInstance->animationCount()) {
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use a base class for the video renderer and the PNG sequence renderer: they'll share the resources and some of the functionality they both need.
Is this the base repo for the Rive Unity Runtime? Are there any early examples we can play with? It wouldn't take much to determine if Rive is right for my team. Thanks so much!
Hi all,
I'm creating static debug builds of all the libraries I'm using (MTd) with LLVM clang, and have it working for all libraries so far except Rive. I've been trying different things for a couple of days. Any help appreciated!
This is my linker output:
1>lld-link : error : /failifmismatch: mismatch detected for '_ITERATOR_DEBUG_LEVEL':
1>>>> skia.lib(skia.SkColorSpace.obj) has value 2
1>>>> rive.lib(binary_reader.o) has value 0
This is my current (part of) premake lua:
filter "configurations:debug"
buildoptions {"-MTd"}
debuglevel (2)
symbols "On"
This is an example of the generated command:
clang++ -MMD -MP -D_USE_MATH_DEFINES -I../include -m64 -g -std=c++17 -Wall -fno-exceptions -fno-rtti -MTd -o \"obj/debug/artboard.o\" -MF \"obj/debug/artboard.d\" -c \"../src/artboard.cpp\""
Note that I don't think debuglevel (2) has done anything (the command has the same arguments if I leave it off).
Note that all my libraries are built with debug level of 2, but whatever I do I cannot get Rive to build with this level.
Any help appreciated!
Hi, I'm one of rive users.
I'm wondering the compatibility of flare(flr) animation by new Rive runtime(rive-cpp).
Do you have any plan to support flare animation in this runtime?
There are a plenty of flare animation design resources in community and wondering if they are usable or not here.
The attached .riv contains a couple JPEG assets. This is the first test of allowing designers to keep their assets in this format.
TODO:
Hello all. Do we have any online chat channel for discussion?
Such as => https://gitter.im/thorvg/community
Otherwise, how about create gitter one?
Opened this issue as a discussion.
I'm not sure if this is reproducible on newer Ubuntu versions (our build server uses 16.04 still).
The problem is X11.h (much like Window.h) adds names to the global namespace, that may fail consequent code.
Although I was able to move the inclusion of X11.h later, I suspect it might not always be as easy for others.
On Ubuntu (16.04), if you happen to include X11.h before the rive headers, you'll get these errors:
In file included from upload/defold-rive/pluginsrc/plugin.cpp:9:
In file included from upload/defold-rive/include/artboard.hpp:6:
In file included from upload/defold-rive/include/generated/artboard_base.hpp:3:
In file included from upload/defold-rive/include/container_component.hpp:3:
In file included from upload/defold-rive/include/generated/container_component_base.hpp:3:
In file included from upload/defold-rive/include/component.hpp:3:
upload/defold-rive/include/component_dirt.hpp:9:3: error: expected identifier
None = 0,
^
/usr/include/X11/X.h:115:30: note: expanded from macro 'None'
#define None 0L /* universal null resource or null atom */
I'm not sure what a good solution is here, but perhaps a name change to e.g. Empty
, Clear
, Nil
or something similar is acceptable.
In order to support generating image sequences, we're going to need a zipping library for compressing and setting up the output.
When we build skia(lib) as a dependency (which we do all over the place) we need to support passing in 'debug' or 'release', so the skialib will 'match' the setting in our tool/app.
This is important not just for performance (release is faster), but occasionally for correctness too ... A header might declare an object differently in those two modes, and if we're not consistent, we could break the ABI at runtime.
I want to get the node bounds (x,y,w,h) in the rive animation to cover user interaction scenario.
but It seems that there are no interfaces for getting bounds area.
Are there any interfaces for getting bounds area of the node?
Ex) The bound aera of face node is calculated in web design tool already, can I get the same bounds area in rive-cpp runtime?
@luigi-rosso
Hi,
Im getting error on readme when access this file:
https://github.com/rive-app/rive-cpp/blob/master/skia/renderer/src/skia_renderer.cpp
Thanks.
To change the instance color during the runtime I named Fills and Strokes as "mycolor" and "mystroke".
but the instance I found is unmatched. (however m_Objects vector container in artboard has the object which I named.)
How can I get the exact instance which I named?
rive::SolidColorBase* fill = (rive::SolidColorBase*)artboard->find("mycolor");
fill->colorValue(rive::colorARGB(255, 0, 0 255));
rive::SolidColorBase* stroke = (rive::SolidColorBase*)artboard->find("mystroke");
stroke->colorValue(rive::colorARGB(255, 0, 255, 255));
Hi all,
I'm building a release build of rive as a static library.
Compiling using Visual Studio with default toolset (msvc) I get a static lib of 14MB.
Still compiling with VS, but with the clang-cl toolset I get 16MB.
I have a version of rive.lib that I compiled earlier in 2021 that is 1.7MB. I just cannot figure out why it is so big now.!
Just the first underlying utility -- given a Shape -- did a mouse X,Y intersect it (with tolerance)
So far I've only been able to configure a 32+64 bit library build using the visual studio solution.
That is also generating only Win32, so you have to clone the config, create a x64 config.
Lastly, you also have to change the dynamic linkage to static.
I think it would be beneficial if it would be possible to use the platform/arch with the build script, e.g.:
build.sh release Win32
/ build.sh release Win64
So I have created an animation with rive and thinking it to integrate with OBS studio where my chat
using commands can change the state of rive animation. So is there any possible way to do the same or if someone can come up with some hint it will be very helpful too. Thanks.
What does it use for rendering - OpenGL, Vulkan?
Can I use my renderer?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.