Playmaker Forum
PlayMaker Feedback => Feature Requests => Topic started by: Thore on September 09, 2019, 01:10:50 PM
-
I find the (experimental) AutoName feature quite useful. However many actions don't have autoName code (including some of mine). Below are a few instances I found. Maybe others can chime in and add some too, so that we can quickly get the catalog covered.
But before, I also suggest some general improvements.
In ActionHelpers.cs, line 784, remove space before colon, but add one afterwards. Like so:
var autoName = actionName + ": ";
This results in "ActionName: Some Stuff Here".
Next, I propose to add a general function (howOften in my example) that captures the everyFrame boolean present in most actions and puts it into a string to be added at the end. Here's a snipped for SetBoolValue.cs that has no autoNaming yet.
#if UNITY_EDITOR
string howOften;
public override string AutoName()
{
if (everyFrame) howOften = " /updated"; else howOften = " /once";
if (boolValue.Name == "") return ActionHelpers.AutoName(this) + "'" + boolVariable.Name + "' to " + boolValue + howOften;
else return ActionHelpers.AutoName(this) + "'" + boolVariable.Name + "' to '" + boolValue.Name + "' (" + boolValue + ")" + howOften;
}
#endif
This results in
SetBoolValue: 'Variable' to False /once or
SetBoolValue: 'Variable' to 'otherVariable' (True) /updated
In SendEvent.cs, line 73, replace the hardcoded strings like so:
return ActionHelpers.AutoName(this) + (eventTarget.target != FsmEventTarget.EventTarget.Self ? eventTarget.target + " ": "")
Though, it's not great yet (it still just says GameObject instead of owner etc).
In GoToStateByName.cs, autonaming is missing. A suggestion:
#if UNITY_EDITOR
public override string AutoName()
{
return ActionHelpers.AutoName(this) + " in '" + fsmName + "' to '" + stateName + "'";
}
#endif
There's a lot more, but I wanted to start it up and see the response. :)
-
Since the resulting string is going to have a few common elements, it would be good to reduce the hardcoded naming. For example, maybe any string variable can always be placed within " " (or ' '); maybe all variable names could stand out with a different font type, e.g. italics. Maybe the elements can be colour coded, like in a scripting editor. And finally, as I suggested above, some common elements like everyFrame could be their own function that attaches a /once or /updated (my example) at the end.
Example for a nicer format.
SetBoolValue: Variable to False /once
SetBoolValue: Variable to otherVariable (True) /updated
Studied the ActionHelpers.cs a bit more: Something like this would be nice:
public static string updated(bool everyFrame)
{
string howOften;
if (everyFrame) howOften = " /updated"; else howOften = " /once";
return howOften;
}
Then, appending
+ ActionHelpers.updated(everyFrame);
... would add the /once or /updated to the AutoName.
-
GetFSMVariables proposal.
#if UNITY_EDITOR
public override string AutoName()
{
return ActionHelpers.AutoName(this) + "from " + fsmName.Value + " (" + getVariables.Length +")";
}
#endif
Results in: GetFsmVariables: from myFSM (3)
Similar: GetAxis.cs and GetAxisRaw.cs (https://hutonggames.com/playmakerforum/index.php?topic=19333.msg84249#msg84249)
#if UNITY_EDITOR
public override string AutoName()
{
return ActionHelpers.AutoName(this) + "from " + axisName.Value + " (" + store.Value + ")";
}
#endif