playMaker

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

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
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: 15500
  • Official Playmaker Support
Re: Dynamic actions (that reveal their content based on vars' values)
« Reply #1 on: October 11, 2018, 04: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

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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Dynamic actions (that reveal their content based on vars' values)
« Reply #3 on: October 18, 2018, 02:06:49 AM »
Hi,

 yes indeed.

 Bye,

 Jean