playMaker

Author Topic: Dynamic actions (that reveal their content based on vars' values)  (Read 63 times)

Broken Stylus

  • Junior Playmaker
  • **
  • Posts: 78
    • View Profile
Hi,

Is it possible to code action scripts wherein the contents of the action can adapt visually to what the dev uses, so that for example an entire section of parameters would reveal itself if the user ticks a boolean or something?
Something like a UIHint with a collapse/reveal function that checks for a specific value of a given variable, in the editor (not at runtime).
The only case I know of in 1.8.8 is anything that involves expandable lists of items such as in Build String ..... although the UI could be more responsive here because the action's appearance updates (brutally) itself only when the user clicks somewhere else. Now the vast majority of modern UIs have smooth transitions, LERPs and... but I digress.

I want to make an action where the action has a bool that has a [Title("Use fancy stuff?")] and if the user ticks the box, it reveals a whole list of parameters. If the box is not ticked, these parameters and their relative methods will be skipped.
Because the action is a sort of all in one toolbox.

If it's not possible, I will have to divide this super action into plenty of smaller actions but, well, I thought it would be more elegant to have all stuff crammed into one.

I read somewhere that it's possible to make a UI script that monitors the appearance of a specific action and can update it. Can't remember where and can't guarantee that I got the gist of it either.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 13401
  • Official Playmaker Support
    • View Profile
Re: Dynamic actions (that reveal their content based on vars' values)
« Reply #1 on: October 11, 2018, 01:48:25 AM »
Hi,

 yes, for this you need to implement a custom inspector for your custom action, and then you control what's being presented.

you can see it in action, in the action GetAnimatorBool

this action has a custom editor class GetAnimatorBoolActionEditor

and in there, there is a EditEveryFrameField method ( in the base class), which will show different content based on the user choices of the everyframe option.

 Bye,

 Jean

Broken Stylus

  • Junior Playmaker
  • **
  • Posts: 78
    • View Profile
Re: Dynamic actions (that reveal their content based on vars' values)
« Reply #2 on: October 11, 2018, 04:16:33 AM »
Ok thx. I've seen there's a new HideIf action attribute since 1.9. Is it somehow similar?