playMaker

Author Topic: Editing FsmVar Element Names In CutomActionEditor  (Read 2166 times)

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Editing FsmVar Element Names In CutomActionEditor
« on: May 18, 2018, 09:35:31 AM »
Hi

I need to change the labels for FsmVar[] element names. Currently they are labeled as "Element 1", "Element 2" etc...

But I would want to change them to be unique, not incremental numbers at the end.

e.g. "Name", "Name zyz" etc...

Is this possible?

But more importantly im using [UIHint(UIHint.Variable)]. I have thought about adding in EditorGUILayout field, but i need boxes which im able to select local FSM variables from, from the action. But not been able to achieve this.

Nick

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Editing FsmVar Element Names In CutomActionEditor
« Reply #1 on: May 18, 2018, 09:58:56 AM »
Hi.
I do not think that that is possible as it uses arrays or lists
and the elements are the index numbers.

So you might want to look into using hash tables.

Arraymaker (package on the Ecosystem) has hashtables.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Editing FsmVar Element Names In CutomActionEditor
« Reply #2 on: May 22, 2018, 05:07:24 AM »

But more importantly im using [UIHint(UIHint.Variable)]. I have thought about adding in EditorGUILayout field, but i need boxes which im able to select local FSM variables from, from the action. But not been able to achieve this.

Nick

Hi,

 Can you give your action code, I'll have a look at what can be done to allow local fsm var selection.

 Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Editing FsmVar Element Names In CutomActionEditor
« Reply #3 on: May 25, 2018, 06:05:58 AM »
I will send the code later on as im not at my PC

but all im using in my action is

Code: [Select]
[ArrayEditor(VariableType.Array)
public FsmVar[] values;

and then in the custom action editor i want to replicate this just with custom labels next to each value. Maybe using a property field and a for each statement to return the label and field.
Code: [Select]
EditorGUILayout.PropertyField
Then i need some form of additional script to populate those fields with dropdown like the [UIHint(UIHint.Variable)] field in the action.




coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Editing FsmVar Element Names In CutomActionEditor
« Reply #4 on: May 29, 2018, 10:40:21 AM »
Hi Jean,

Any update on this?

Nick

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Editing FsmVar Element Names In CutomActionEditor
« Reply #5 on: May 30, 2018, 02:15:31 AM »
Hi,

 Can you send me your action and editor so far?

 Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Editing FsmVar Element Names In CutomActionEditor
« Reply #6 on: May 30, 2018, 02:43:13 AM »
I've attached it.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Editing FsmVar Element Names In CutomActionEditor
« Reply #7 on: June 11, 2018, 03:18:43 AM »
Hi,

 ok, sorry for the delay, was relaxing a bit last week...

 so, I think I have something for you, which is basically how I did it for XmlMaker.

- you create a class that extends FsmStateAction class and you maintain your list of fsmVar

- you use this class as a public property inside your action

-- I have modified the custom action editor to edit this class and populate fsmVar inside this class.

 This technic requires PlayMaker Utils set of tools, this removes a lot of the boiler plates needed to work with complex action editors. so I recommend you keep using these utils. Else you'll need to extract the various tools.


Let me know if this all make sense to you ok?

the major constraint as before is that the fsm var can only be the one from the fsm where the action is, not from the FsmOwnerDefault, in that case you'll need to use strings as the reference to the variable name on other fsms.

 Bye,

 Jean
« Last Edit: June 13, 2018, 04:20:51 AM by jeanfabre »

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Editing FsmVar Element Names In CutomActionEditor
« Reply #8 on: June 12, 2018, 10:34:58 AM »
Hi Jean

It's ok, hope you had a nice break.

I'll take a look later on thanks

Nick