Possible to register AnimatableParameter manually on ActionClip?

Slate Forums Support Possible to register AnimatableParameter manually on ActionClip?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2449
    brodyb
    Participant

    Feel like I”m pushing ActionClips and AnimatableParameters to their limit and hitting a small snag.

    I’m working on an ActionClip that allows a user to add or remove AnimatableParameters as they’re needed. All the properties that these AnimatableParameters are driving are on the ActionClip class.

    The natural starting place to figure this code out is, of course, seeing how this is done on AnimateProperties. I managed to get manual creation of an AnimatableParameter done like so:
    this.TryAddParameter(typeof(MyActionClipClass), "PropertyToKey", "");

    This works as intended! However, the parameter fails to serialize onto the ActionClip; upon reloading the scene, the parameter is gone. I see in the AnimateProperties clip, you set animatedParametersTarget => actor with a comment that this is necessary for manual registration. But if I do this on my clip, it breaks all my existing parameters that target properties on my ActionClip class.

    Is there a way to get my manually-created AnimatableParameters to save without retargeting all my existing ones?

    Thanks!

    #2451
    Gavalakis
    Keymaster

    Hello there,

    Are the properties/fields that the parameters are targeting, decalred on your custom Action Clip? If so is there a reason you want to manually add those animatable parameters instead of placing the [AnimatableParameter] attribute on top of these properties/fields? Just want to clarify the use case 🙂

    With that said, there are indeed some code changes needed to be able to do this (manually adding animatable parameters that target properties/fields on the action clip itself), because there is the assumption/expectation that animatable parameters targeting the action clip are added with the said attribute instead.

    Let me know.

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #2453
    brodyb
    Participant

    Yeah, I figured this would push against some design assumptions haha

    Here’s the setup: I’ve made an ActionClip that has a lot of Animatable Parameters. There’s a lot for a user to sift through, and as a way to control that clutter and make things clearer in the Inspector, I want to only show Animatable Parameters for the user when they’re needed, based on settings on the clip. As an example of this, I have a list of “Effect Channels” the user can add or remove from. Each of these channels has an associated Animatable Parameter so they can key the range of effect on each of those Channels.

    Effect Channel list (add/remove buttons disabled for now)

    When the user adds to the list, it adds an Animatable Parameter to go along with it. When the user removes from the list, an Animatable Parameter is removed. This way there’s always the same number of parameters as there are Channels in the list.

    Animatable Parameters for the Effect Channels

    And with the technique I listed above, it works! It just…doesn’t serialize. For now I’ve removed the ability to add/remove Effect Channels and set the Animatable Parameters with the attribute as recommended, and this isn’t blocking me from making the tool useful. But if it’s possible to get working without much work, that would rule!

    #2455
    Gavalakis
    Keymaster

    Hello again,

    Thanks for the info provided. I understand the use case now. The easiest change that could be made in code would be to make the “ActionClip.handleParametersRegistrationManually” property virtual, then of course override this property and return TRUE in your custom action clip. If this works for you, please let me know and I will gladly make the property virtual for the next version as well. 🙂

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.