diff --git a/.rive_head b/.rive_head index 29b2afd9..dd5879ce 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -cd6210f42d644de3cc1c83fa65b3d4e1f790cece +8a538c243fcc5b72159388a7e63669f1e6998dda diff --git a/dev/core_generator/lib/src/definition.dart b/dev/core_generator/lib/src/definition.dart index eeac8987..5a04630f 100644 --- a/dev/core_generator/lib/src/definition.dart +++ b/dev/core_generator/lib/src/definition.dart @@ -557,6 +557,22 @@ class Definition { ctxCode.writeln('default:return false;'); ctxCode.writeln('}}'); + // static bool objectSupportsProperty(Core* object, uint32_t propertyKey) { return true; } + ctxCode.writeln(''' + static bool objectSupportsProperty(Core* object, uint32_t propertyKey) { + switch(propertyKey) {'''); + for (final fieldType in usedFieldTypes.keys) { + var properties = getSetFieldTypes[fieldType]; + if (properties != null) { + for (final property in properties) { + ctxCode.writeln('case ${property.definition.name}Base' + '::${property.name}PropertyKey:'); + ctxCode + .writeln('return object->is<${property.definition.name}Base>();'); + } + } + } + ctxCode.writeln('}return false;}'); ctxCode.writeln('};}'); var output = generatedHppPath; diff --git a/include/rive/generated/core_registry.hpp b/include/rive/generated/core_registry.hpp index a0c8df9a..c306c1fe 100644 --- a/include/rive/generated/core_registry.hpp +++ b/include/rive/generated/core_registry.hpp @@ -2055,6 +2055,541 @@ class CoreRegistry return false; } } + static bool objectSupportsProperty(Core* object, uint32_t propertyKey) + { + switch (propertyKey) + { + case ComponentBase::namePropertyKey: + return object->is(); + case AnimationBase::namePropertyKey: + return object->is(); + case StateMachineComponentBase::namePropertyKey: + return object->is(); + case KeyFrameStringBase::valuePropertyKey: + return object->is(); + case OpenUrlEventBase::urlPropertyKey: + return object->is(); + case TextValueRunBase::textPropertyKey: + return object->is(); + case CustomPropertyStringBase::propertyValuePropertyKey: + return object->is(); + case AssetBase::namePropertyKey: + return object->is(); + case FileAssetBase::cdnBaseUrlPropertyKey: + return object->is(); + case ComponentBase::parentIdPropertyKey: + return object->is(); + case DrawTargetBase::drawableIdPropertyKey: + return object->is(); + case DrawTargetBase::placementValuePropertyKey: + return object->is(); + case TargetedConstraintBase::targetIdPropertyKey: + return object->is(); + case DistanceConstraintBase::modeValuePropertyKey: + return object->is(); + case TransformSpaceConstraintBase::sourceSpaceValuePropertyKey: + return object->is(); + case TransformSpaceConstraintBase::destSpaceValuePropertyKey: + return object->is(); + case TransformComponentConstraintBase::minMaxSpaceValuePropertyKey: + return object->is(); + case IKConstraintBase::parentBoneCountPropertyKey: + return object->is(); + case DrawableBase::blendModeValuePropertyKey: + return object->is(); + case DrawableBase::drawableFlagsPropertyKey: + return object->is(); + case NestedArtboardBase::artboardIdPropertyKey: + return object->is(); + case NestedAnimationBase::animationIdPropertyKey: + return object->is(); + case SoloBase::activeComponentIdPropertyKey: + return object->is(); + case ListenerFireEventBase::eventIdPropertyKey: + return object->is(); + case LayerStateBase::flagsPropertyKey: + return object->is(); + case ListenerInputChangeBase::inputIdPropertyKey: + return object->is(); + case ListenerInputChangeBase::nestedInputIdPropertyKey: + return object->is(); + case AnimationStateBase::animationIdPropertyKey: + return object->is(); + case NestedInputBase::inputIdPropertyKey: + return object->is(); + case KeyedObjectBase::objectIdPropertyKey: + return object->is(); + case BlendAnimationBase::animationIdPropertyKey: + return object->is(); + case BlendAnimationDirectBase::inputIdPropertyKey: + return object->is(); + case BlendAnimationDirectBase::blendSourcePropertyKey: + return object->is(); + case TransitionConditionBase::inputIdPropertyKey: + return object->is(); + case KeyedPropertyBase::propertyKeyPropertyKey: + return object->is(); + case StateMachineListenerBase::targetIdPropertyKey: + return object->is(); + case StateMachineListenerBase::listenerTypeValuePropertyKey: + return object->is(); + case StateMachineListenerBase::eventIdPropertyKey: + return object->is(); + case KeyFrameBase::framePropertyKey: + return object->is(); + case InterpolatingKeyFrameBase::interpolationTypePropertyKey: + return object->is(); + case InterpolatingKeyFrameBase::interpolatorIdPropertyKey: + return object->is(); + case KeyFrameIdBase::valuePropertyKey: + return object->is(); + case ListenerBoolChangeBase::valuePropertyKey: + return object->is(); + case ListenerAlignTargetBase::targetIdPropertyKey: + return object->is(); + case TransitionValueConditionBase::opValuePropertyKey: + return object->is(); + case StateTransitionBase::stateToIdPropertyKey: + return object->is(); + case StateTransitionBase::flagsPropertyKey: + return object->is(); + case StateTransitionBase::durationPropertyKey: + return object->is(); + case StateTransitionBase::exitTimePropertyKey: + return object->is(); + case StateTransitionBase::interpolationTypePropertyKey: + return object->is(); + case StateTransitionBase::interpolatorIdPropertyKey: + return object->is(); + case StateTransitionBase::randomWeightPropertyKey: + return object->is(); + case StateMachineFireEventBase::eventIdPropertyKey: + return object->is(); + case StateMachineFireEventBase::occursValuePropertyKey: + return object->is(); + case LinearAnimationBase::fpsPropertyKey: + return object->is(); + case LinearAnimationBase::durationPropertyKey: + return object->is(); + case LinearAnimationBase::loopValuePropertyKey: + return object->is(); + case LinearAnimationBase::workStartPropertyKey: + return object->is(); + case LinearAnimationBase::workEndPropertyKey: + return object->is(); + case ElasticInterpolatorBase::easingValuePropertyKey: + return object->is(); + case BlendState1DBase::inputIdPropertyKey: + return object->is(); + case BlendStateTransitionBase::exitBlendAnimationIdPropertyKey: + return object->is(); + case StrokeBase::capPropertyKey: + return object->is(); + case StrokeBase::joinPropertyKey: + return object->is(); + case TrimPathBase::modeValuePropertyKey: + return object->is(); + case FillBase::fillRulePropertyKey: + return object->is(); + case PathBase::pathFlagsPropertyKey: + return object->is(); + case ClippingShapeBase::sourceIdPropertyKey: + return object->is(); + case ClippingShapeBase::fillRulePropertyKey: + return object->is(); + case PolygonBase::pointsPropertyKey: + return object->is(); + case ImageBase::assetIdPropertyKey: + return object->is(); + case DrawRulesBase::drawTargetIdPropertyKey: + return object->is(); + case ArtboardBase::defaultStateMachineIdPropertyKey: + return object->is(); + case JoystickBase::xIdPropertyKey: + return object->is(); + case JoystickBase::yIdPropertyKey: + return object->is(); + case JoystickBase::joystickFlagsPropertyKey: + return object->is(); + case JoystickBase::handleSourceIdPropertyKey: + return object->is(); + case OpenUrlEventBase::targetValuePropertyKey: + return object->is(); + case WeightBase::valuesPropertyKey: + return object->is(); + case WeightBase::indicesPropertyKey: + return object->is(); + case TendonBase::boneIdPropertyKey: + return object->is(); + case CubicWeightBase::inValuesPropertyKey: + return object->is(); + case CubicWeightBase::inIndicesPropertyKey: + return object->is(); + case CubicWeightBase::outValuesPropertyKey: + return object->is(); + case CubicWeightBase::outIndicesPropertyKey: + return object->is(); + case TextModifierRangeBase::unitsValuePropertyKey: + return object->is(); + case TextModifierRangeBase::typeValuePropertyKey: + return object->is(); + case TextModifierRangeBase::modeValuePropertyKey: + return object->is(); + case TextModifierRangeBase::runIdPropertyKey: + return object->is(); + case TextStyleFeatureBase::tagPropertyKey: + return object->is(); + case TextStyleFeatureBase::featureValuePropertyKey: + return object->is(); + case TextVariationModifierBase::axisTagPropertyKey: + return object->is(); + case TextModifierGroupBase::modifierFlagsPropertyKey: + return object->is(); + case TextStyleBase::fontAssetIdPropertyKey: + return object->is(); + case TextStyleAxisBase::tagPropertyKey: + return object->is(); + case TextBase::alignValuePropertyKey: + return object->is(); + case TextBase::sizingValuePropertyKey: + return object->is(); + case TextBase::overflowValuePropertyKey: + return object->is(); + case TextBase::originValuePropertyKey: + return object->is(); + case TextValueRunBase::styleIdPropertyKey: + return object->is(); + case FileAssetBase::assetIdPropertyKey: + return object->is(); + case AudioEventBase::assetIdPropertyKey: + return object->is(); + case CustomPropertyNumberBase::propertyValuePropertyKey: + return object->is(); + case ConstraintBase::strengthPropertyKey: + return object->is(); + case DistanceConstraintBase::distancePropertyKey: + return object->is(); + case TransformComponentConstraintBase::copyFactorPropertyKey: + return object->is(); + case TransformComponentConstraintBase::minValuePropertyKey: + return object->is(); + case TransformComponentConstraintBase::maxValuePropertyKey: + return object->is(); + case TransformComponentConstraintYBase::copyFactorYPropertyKey: + return object->is(); + case TransformComponentConstraintYBase::minValueYPropertyKey: + return object->is(); + case TransformComponentConstraintYBase::maxValueYPropertyKey: + return object->is(); + case FollowPathConstraintBase::distancePropertyKey: + return object->is(); + case TransformConstraintBase::originXPropertyKey: + return object->is(); + case TransformConstraintBase::originYPropertyKey: + return object->is(); + case WorldTransformComponentBase::opacityPropertyKey: + return object->is(); + case TransformComponentBase::rotationPropertyKey: + return object->is(); + case TransformComponentBase::scaleXPropertyKey: + return object->is(); + case TransformComponentBase::scaleYPropertyKey: + return object->is(); + case NodeBase::xPropertyKey: + return object->is(); + case NodeBase::yPropertyKey: + return object->is(); + case NestedLinearAnimationBase::mixPropertyKey: + return object->is(); + case NestedSimpleAnimationBase::speedPropertyKey: + return object->is(); + case AdvanceableStateBase::speedPropertyKey: + return object->is(); + case BlendAnimationDirectBase::mixValuePropertyKey: + return object->is(); + case StateMachineNumberBase::valuePropertyKey: + return object->is(); + case CubicInterpolatorBase::x1PropertyKey: + return object->is(); + case CubicInterpolatorBase::y1PropertyKey: + return object->is(); + case CubicInterpolatorBase::x2PropertyKey: + return object->is(); + case CubicInterpolatorBase::y2PropertyKey: + return object->is(); + case TransitionNumberConditionBase::valuePropertyKey: + return object->is(); + case CubicInterpolatorComponentBase::x1PropertyKey: + return object->is(); + case CubicInterpolatorComponentBase::y1PropertyKey: + return object->is(); + case CubicInterpolatorComponentBase::x2PropertyKey: + return object->is(); + case CubicInterpolatorComponentBase::y2PropertyKey: + return object->is(); + case ListenerNumberChangeBase::valuePropertyKey: + return object->is(); + case KeyFrameDoubleBase::valuePropertyKey: + return object->is(); + case LinearAnimationBase::speedPropertyKey: + return object->is(); + case ElasticInterpolatorBase::amplitudePropertyKey: + return object->is(); + case ElasticInterpolatorBase::periodPropertyKey: + return object->is(); + case NestedNumberBase::nestedValuePropertyKey: + return object->is(); + case NestedRemapAnimationBase::timePropertyKey: + return object->is(); + case BlendAnimation1DBase::valuePropertyKey: + return object->is(); + case LinearGradientBase::startXPropertyKey: + return object->is(); + case LinearGradientBase::startYPropertyKey: + return object->is(); + case LinearGradientBase::endXPropertyKey: + return object->is(); + case LinearGradientBase::endYPropertyKey: + return object->is(); + case LinearGradientBase::opacityPropertyKey: + return object->is(); + case StrokeBase::thicknessPropertyKey: + return object->is(); + case GradientStopBase::positionPropertyKey: + return object->is(); + case TrimPathBase::startPropertyKey: + return object->is(); + case TrimPathBase::endPropertyKey: + return object->is(); + case TrimPathBase::offsetPropertyKey: + return object->is(); + case VertexBase::xPropertyKey: + return object->is(); + case VertexBase::yPropertyKey: + return object->is(); + case MeshVertexBase::uPropertyKey: + return object->is(); + case MeshVertexBase::vPropertyKey: + return object->is(); + case StraightVertexBase::radiusPropertyKey: + return object->is(); + case CubicAsymmetricVertexBase::rotationPropertyKey: + return object->is(); + case CubicAsymmetricVertexBase::inDistancePropertyKey: + return object->is(); + case CubicAsymmetricVertexBase::outDistancePropertyKey: + return object->is(); + case ParametricPathBase::widthPropertyKey: + return object->is(); + case ParametricPathBase::heightPropertyKey: + return object->is(); + case ParametricPathBase::originXPropertyKey: + return object->is(); + case ParametricPathBase::originYPropertyKey: + return object->is(); + case RectangleBase::cornerRadiusTLPropertyKey: + return object->is(); + case RectangleBase::cornerRadiusTRPropertyKey: + return object->is(); + case RectangleBase::cornerRadiusBLPropertyKey: + return object->is(); + case RectangleBase::cornerRadiusBRPropertyKey: + return object->is(); + case CubicMirroredVertexBase::rotationPropertyKey: + return object->is(); + case CubicMirroredVertexBase::distancePropertyKey: + return object->is(); + case PolygonBase::cornerRadiusPropertyKey: + return object->is(); + case StarBase::innerRadiusPropertyKey: + return object->is(); + case ImageBase::originXPropertyKey: + return object->is(); + case ImageBase::originYPropertyKey: + return object->is(); + case CubicDetachedVertexBase::inRotationPropertyKey: + return object->is(); + case CubicDetachedVertexBase::inDistancePropertyKey: + return object->is(); + case CubicDetachedVertexBase::outRotationPropertyKey: + return object->is(); + case CubicDetachedVertexBase::outDistancePropertyKey: + return object->is(); + case ArtboardBase::widthPropertyKey: + return object->is(); + case ArtboardBase::heightPropertyKey: + return object->is(); + case ArtboardBase::xPropertyKey: + return object->is(); + case ArtboardBase::yPropertyKey: + return object->is(); + case ArtboardBase::originXPropertyKey: + return object->is(); + case ArtboardBase::originYPropertyKey: + return object->is(); + case JoystickBase::xPropertyKey: + return object->is(); + case JoystickBase::yPropertyKey: + return object->is(); + case JoystickBase::posXPropertyKey: + return object->is(); + case JoystickBase::posYPropertyKey: + return object->is(); + case JoystickBase::originXPropertyKey: + return object->is(); + case JoystickBase::originYPropertyKey: + return object->is(); + case JoystickBase::widthPropertyKey: + return object->is(); + case JoystickBase::heightPropertyKey: + return object->is(); + case BoneBase::lengthPropertyKey: + return object->is(); + case RootBoneBase::xPropertyKey: + return object->is(); + case RootBoneBase::yPropertyKey: + return object->is(); + case SkinBase::xxPropertyKey: + return object->is(); + case SkinBase::yxPropertyKey: + return object->is(); + case SkinBase::xyPropertyKey: + return object->is(); + case SkinBase::yyPropertyKey: + return object->is(); + case SkinBase::txPropertyKey: + return object->is(); + case SkinBase::tyPropertyKey: + return object->is(); + case TendonBase::xxPropertyKey: + return object->is(); + case TendonBase::yxPropertyKey: + return object->is(); + case TendonBase::xyPropertyKey: + return object->is(); + case TendonBase::yyPropertyKey: + return object->is(); + case TendonBase::txPropertyKey: + return object->is(); + case TendonBase::tyPropertyKey: + return object->is(); + case TextModifierRangeBase::modifyFromPropertyKey: + return object->is(); + case TextModifierRangeBase::modifyToPropertyKey: + return object->is(); + case TextModifierRangeBase::strengthPropertyKey: + return object->is(); + case TextModifierRangeBase::falloffFromPropertyKey: + return object->is(); + case TextModifierRangeBase::falloffToPropertyKey: + return object->is(); + case TextModifierRangeBase::offsetPropertyKey: + return object->is(); + case TextVariationModifierBase::axisValuePropertyKey: + return object->is(); + case TextModifierGroupBase::originXPropertyKey: + return object->is(); + case TextModifierGroupBase::originYPropertyKey: + return object->is(); + case TextModifierGroupBase::opacityPropertyKey: + return object->is(); + case TextModifierGroupBase::xPropertyKey: + return object->is(); + case TextModifierGroupBase::yPropertyKey: + return object->is(); + case TextModifierGroupBase::rotationPropertyKey: + return object->is(); + case TextModifierGroupBase::scaleXPropertyKey: + return object->is(); + case TextModifierGroupBase::scaleYPropertyKey: + return object->is(); + case TextStyleBase::fontSizePropertyKey: + return object->is(); + case TextStyleBase::lineHeightPropertyKey: + return object->is(); + case TextStyleBase::letterSpacingPropertyKey: + return object->is(); + case TextStyleAxisBase::axisValuePropertyKey: + return object->is(); + case TextBase::widthPropertyKey: + return object->is(); + case TextBase::heightPropertyKey: + return object->is(); + case TextBase::originXPropertyKey: + return object->is(); + case TextBase::originYPropertyKey: + return object->is(); + case TextBase::paragraphSpacingPropertyKey: + return object->is(); + case DrawableAssetBase::heightPropertyKey: + return object->is(); + case DrawableAssetBase::widthPropertyKey: + return object->is(); + case ExportAudioBase::volumePropertyKey: + return object->is(); + case TransformComponentConstraintBase::offsetPropertyKey: + return object->is(); + case TransformComponentConstraintBase::doesCopyPropertyKey: + return object->is(); + case TransformComponentConstraintBase::minPropertyKey: + return object->is(); + case TransformComponentConstraintBase::maxPropertyKey: + return object->is(); + case TransformComponentConstraintYBase::doesCopyYPropertyKey: + return object->is(); + case TransformComponentConstraintYBase::minYPropertyKey: + return object->is(); + case TransformComponentConstraintYBase::maxYPropertyKey: + return object->is(); + case IKConstraintBase::invertDirectionPropertyKey: + return object->is(); + case FollowPathConstraintBase::orientPropertyKey: + return object->is(); + case FollowPathConstraintBase::offsetPropertyKey: + return object->is(); + case NestedSimpleAnimationBase::isPlayingPropertyKey: + return object->is(); + case KeyFrameBoolBase::valuePropertyKey: + return object->is(); + case ListenerAlignTargetBase::preserveOffsetPropertyKey: + return object->is(); + case NestedBoolBase::nestedValuePropertyKey: + return object->is(); + case LinearAnimationBase::enableWorkAreaPropertyKey: + return object->is(); + case LinearAnimationBase::quantizePropertyKey: + return object->is(); + case StateMachineBoolBase::valuePropertyKey: + return object->is(); + case ShapePaintBase::isVisiblePropertyKey: + return object->is(); + case StrokeBase::transformAffectsStrokePropertyKey: + return object->is(); + case PointsPathBase::isClosedPropertyKey: + return object->is(); + case RectangleBase::linkCornerRadiusPropertyKey: + return object->is(); + case ClippingShapeBase::isVisiblePropertyKey: + return object->is(); + case CustomPropertyBooleanBase::propertyValuePropertyKey: + return object->is(); + case ArtboardBase::clipPropertyKey: + return object->is(); + case TextModifierRangeBase::clampPropertyKey: + return object->is(); + case NestedTriggerBase::firePropertyKey: + return object->is(); + case EventBase::triggerPropertyKey: + return object->is(); + case KeyFrameColorBase::valuePropertyKey: + return object->is(); + case SolidColorBase::colorValuePropertyKey: + return object->is(); + case GradientStopBase::colorValuePropertyKey: + return object->is(); + } + return false; + } }; } // namespace rive diff --git a/src/animation/keyed_object.cpp b/src/animation/keyed_object.cpp index 3666199f..bb54f886 100644 --- a/src/animation/keyed_object.cpp +++ b/src/animation/keyed_object.cpp @@ -18,13 +18,19 @@ void KeyedObject::addKeyedProperty(std::unique_ptr property) StatusCode KeyedObject::onAddedDirty(CoreContext* context) { // Make sure we're keying a valid object. - if (context->resolve(objectId()) == nullptr) + Core* coreObject = context->resolve(objectId()); + if (coreObject == nullptr) { return StatusCode::MissingObject; } for (auto& property : m_keyedProperties) { + // Validate coreObject supports propertyKey + if (!CoreRegistry::objectSupportsProperty(coreObject, property->propertyKey())) + { + return StatusCode::InvalidObject; + } StatusCode code; if ((code = property->onAddedDirty(context)) != StatusCode::Ok) {