playMaker

Author Topic: Set the default value directly when creating a new variable  (Read 3442 times)

Deek

  • Full Member
  • ***
  • Posts: 133
Set the default value directly when creating a new variable
« on: April 14, 2018, 07:38:27 PM »
I just came up with a great idea that would drastically improve managing variables and save quite a lot of time:

Directly setting the variable value when creating a new one in any action


(emphasis on the field between "animDelay" and the "Create Variable" button)

So whenever you want to add a new local or global variable or convert a hard-coded value to one, you can immediately set the value in the same small pop-up that allows you to set the name of the variable (a similar example would be the pop-up when adding an aspect ratio to the game view where you can specify multiple values).

Like that you wouldn't need to switch to the variables tab, search for the variable, select the variable and select the value field of the variable. That's more than 3 clicks and can add up to quite a lot of time when dealing with lots of variables every user would save with that option. And if you want to replace something with an FsmVariable you would also have to copy over that value to the variable-field in the variables tab, which is neither ideal nor any fun.


If you consider implementing this, here are additional suggestions that would make this most useful:
- the value field should match the type of variable to add (should be even enough space for the 3 fields of an FsmVector3 variable and you don't need to add any label next to it anyway)
- the default value for the variable type should be pre-set, so that it's complete optional to set the value directly
- on an object-field it should detect the type of object to be put in, if defined (e.g. Collider, AudioSource, ...);  it should also be possible to drag and drop matching objects into that field
« Last Edit: April 14, 2018, 07:40:56 PM by Deek »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Set the default value directly when creating a new variable
« Reply #1 on: April 15, 2018, 04:48:25 AM »
This is an awesome idea, so simple and so convenient.
Available for Playmaker work

Marc Saubion

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 79
Re: Set the default value directly when creating a new variable
« Reply #2 on: April 15, 2018, 08:21:49 AM »
I feel bad I didn't thought of this before. My favorite mistake is to create a variable to replace an existing value and forgetting to set it back up with it. :P

This could be added to your idea, have the default variable's value be whatever your are replacing if it's not empty.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Set the default value directly when creating a new variable
« Reply #3 on: April 15, 2018, 09:43:48 AM »
Great ideas! The only tricky part is dragging Objects into an Object field. Right now the New Variable window is a popup that disappears if it loses focus. So we would need to keep it around somehow... but should be possible...

Deek

  • Full Member
  • ***
  • Posts: 133
Re: Set the default value directly when creating a new variable
« Reply #4 on: April 15, 2018, 11:46:44 AM »
@Marc Saubion
I though of that too and had that initially in the additional suggestion list, but the problem with that is, that you have to first set a field to 'None' before creating a new variable, which deletes/resets the value in that field.

Marc Saubion

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 79
Re: Set the default value directly when creating a new variable
« Reply #5 on: April 15, 2018, 01:14:14 PM »
@Deek, good point. I guess a right click -> set as variable would work. Like we already have for making a global variable from a local one.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Set the default value directly when creating a new variable
« Reply #6 on: April 17, 2018, 03:38:00 AM »
Hi.

+1

And maybe also have the option in there to 'check' inspector and Category

it would really speed up workflow and you don't need to switch tabs any more.

Another option would be, to be able to have the variable tab and the event tab in a separate window
Similar to globals but then showing the focused fsm variables and events.