Page 1 of 1

Indicator for Node script/condition/sequence

Posted: Sat May 16, 2020 10:06 am
by digiwombat
Hey! It's ya boi, digiwombat. Back at it again with another feature request posting.

NOTICE: This was added to the asset directly. No need to add it unless you're below the version that added it.

This one's also super simple (and I'll be providing code!)

I would really love to be able to see if a give node has a Script or a Condition or a Sequence attached to it. I think a series of colored circles at the bottom corner could be a good indicator to add the the nodes without having to make them taller and without .

It's a feature Chat Mapper has and I added to a dialogue editor I wrote and it saves me massive amounts of time when I rooting around for code to fix up or sequences that are misbehaving.

In the editor, if you go with my code, it'll look like this:

Image

You could also go pick some included icons to load from over here or you could include your own but I didn't feel like looking through the icons for all that long. STILL! Implementation is piss easy. Steps go like this:

1. Open DialogueEditorWindowConversationNodeEditor.cs

2. And add this code to DrawEntryNode(DialogueEntry entry) right before the if(showActorPortraits) block... or after it. Doesn't really matter.

Code: Select all

if(!string.IsNullOrWhiteSpace(entry.Sequence))
{ 
	GUI.color = Color.red;
	GUI.DrawTexture(new Rect((boxRect.x + boxRect.width) - 35, (boxRect.y + boxRect.height) - 12, 10, 10), EditorGUIUtility.FindTexture("d_winbtn_graph"));
	GUI.color = Color.white;
}

if(!string.IsNullOrWhiteSpace(entry.userScript))
{ 
	GUI.color = Color.yellow;
	GUI.DrawTexture(new Rect((boxRect.x + boxRect.width) - 25, (boxRect.y + boxRect.height) - 12, 10, 10), EditorGUIUtility.FindTexture("d_winbtn_graph"));
	GUI.color = Color.white;
}

if (!string.IsNullOrWhiteSpace(entry.conditionsString))
{
	GUI.color = Color.green;
	GUI.DrawTexture(new Rect((boxRect.x + boxRect.width) - 15, (boxRect.y + boxRect.height) - 12, 10, 10), EditorGUIUtility.FindTexture("d_winbtn_graph"));
	GUI.color = Color.white;
}
3. That's it.

EDIT: Whoops, hit submit instead of Preview. Code added.

Re: Indicator for Node script/condition/sequence

Posted: Sat May 16, 2020 10:12 am
by digiwombat
Also, It would probably make sense to pick some colors that don't have such ingrained meanings for UX purposes but I wanted this to be more illustrative than anything here. I'll probably pick some other colors for my own.

Re: Indicator for Node script/condition/sequence

Posted: Sat May 16, 2020 10:20 am
by Tony Li
Thanks! That's a lot more compact than the current implementation, which appends "[script]" etc. to the actual text. I'll get this implemented in the next update. I really appreciate your UI feedback.

Re: Indicator for Node script/condition/sequence

Posted: Sat May 16, 2020 10:26 am
by digiwombat
No worries! Happy to help out a bro that's been helping people with Unity for forever!

And really it's all just selfishly not wanting to have to re-implement my custom stuff when a new version comes out. Haha. Good luck finishing the sprint, man. :D