mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 21:21:17 +01:00
* make file ref counted * migrate File to refcnt * add bindable artboard class to keep file reference * feat(unity): support rcp file and BindableArtboard class (#10228) * refactor(apple): use updated file bindable artboard apis (#10229) * update command queue to support bindable artboards * use bindable artboards on command queue * self manage view model instances in js runtime * change remaining viewModelInstanceRuntimes to rcp * refactor(apple): update view model instances to use rcp (#10298) * refactor(unity): support rcp ViewModelInstanceRuntime (#10309) * rebase fix * deprecate getArtboard in favor of getBindableArtboard * fix merge * remove unused lambda capture * fix rive binding * feat(Android): RCP File, VMI, and add bindable artboards (#10456) * refactor: C++ refactors - Import from long (incorrect) -> jlong - Header clang-tidy fix - Use reinterpret_cast instead of C-style cast - Break out some variables instead of long one liners - Use auto - Remove unused env and thisObj # Conflicts: # packages/runtime_android/kotlin/src/main/cpp/src/helpers/general.cpp * docs: Improve documentation on the File class * feat: Support bindable artboard type and RCP VMIs # Conflicts: # packages/runtime_android/kotlin/src/androidTest/java/app/rive/runtime/kotlin/core/RiveDataBindingTest.kt * feat: Support RCP files * refactor: Change from +1/-1 ref to just release * fix: Moved to the more appropriate null pointer for GetStringUTFChars * replace unref with release Co-authored-by: Adam <67035612+damzobridge@users.noreply.github.com> Co-authored-by: David Skuza <david@rive.app> Co-authored-by: Erik <erik@rive.app> Co-authored-by: hernan <hernan@rive.app>
68 lines
2.2 KiB
C++
68 lines
2.2 KiB
C++
#ifndef _RIVE_DATA_BIND_HPP_
|
|
#define _RIVE_DATA_BIND_HPP_
|
|
#include "rive/component_dirt.hpp"
|
|
#include "rive/generated/data_bind/data_bind_base.hpp"
|
|
#include "rive/viewmodel/viewmodel_instance_value.hpp"
|
|
#include "rive/data_bind/data_context.hpp"
|
|
#include "rive/data_bind/converters/data_converter.hpp"
|
|
#include "rive/data_bind/data_values/data_type.hpp"
|
|
#include "rive/dirtyable.hpp"
|
|
#include "rive/file.hpp"
|
|
#include <stdio.h>
|
|
namespace rive
|
|
{
|
|
class DataBindContextValue;
|
|
#ifdef WITH_RIVE_TOOLS
|
|
class DataBind;
|
|
typedef void (*DataBindChanged)();
|
|
#endif
|
|
class DataBind : public DataBindBase, public Dirtyable
|
|
{
|
|
public:
|
|
~DataBind();
|
|
StatusCode onAddedDirty(CoreContext* context) override;
|
|
StatusCode import(ImportStack& importStack) override;
|
|
virtual void updateSourceBinding(bool invalidate = false);
|
|
virtual void update(ComponentDirt value);
|
|
Core* target() const { return m_target; };
|
|
void target(Core* value) { m_target = value; };
|
|
virtual void bind();
|
|
virtual void unbind();
|
|
ComponentDirt dirt() { return m_Dirt; };
|
|
void dirt(ComponentDirt value) { m_Dirt = value; };
|
|
void addDirt(ComponentDirt value, bool recurse) override;
|
|
DataConverter* converter() const { return m_dataConverter; };
|
|
void converter(DataConverter* value) { m_dataConverter = value; };
|
|
ViewModelInstanceValue* source() const { return m_Source; };
|
|
void source(ViewModelInstanceValue* value);
|
|
void clearSource();
|
|
bool toSource();
|
|
bool toTarget();
|
|
bool canSkip();
|
|
bool isMainToSource();
|
|
bool sourceToTargetRunsFirst();
|
|
bool advance(float elapsedTime);
|
|
void suppressDirt(bool value) { m_suppressDirt = value; };
|
|
void file(File* value);
|
|
File* file() const;
|
|
DataType outputType();
|
|
DataType sourceOutputType();
|
|
|
|
protected:
|
|
ComponentDirt m_Dirt = ComponentDirt::Filthy;
|
|
Core* m_target = nullptr;
|
|
ViewModelInstanceValue* m_Source = nullptr;
|
|
DataBindContextValue* m_ContextValue = nullptr;
|
|
DataConverter* m_dataConverter = nullptr;
|
|
bool bindsOnce();
|
|
bool m_suppressDirt = false;
|
|
File* m_file;
|
|
#ifdef WITH_RIVE_TOOLS
|
|
public:
|
|
void onChanged(DataBindChanged callback) { m_changedCallback = callback; }
|
|
DataBindChanged m_changedCallback = nullptr;
|
|
#endif
|
|
};
|
|
} // namespace rive
|
|
|
|
#endif |