Customise DialogueEntry editor window?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ModestFacialHair
Posts: 13
Joined: Thu Sep 19, 2024 1:17 pm

Customise DialogueEntry editor window?

Post by ModestFacialHair »

Hi Tony,

I can add fields to a DialogueEntry using a Template, and edit them in All Fields: this works nicely. But I have a couple of very frequently used fields that I'd like to add above the fold. Is there a place I can hook in a subclass so I can do that without directly editing Dialogue System editor classes?

Thanks!
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

Re: Customise DialogueEntry editor window?

Post by Tony Li »

Hi,

No need to hook in a subclass. Just tick the field's "Main" checkbox in the Templates section and it'll appear in the dialogue entry inspector's main section.

If you want to further customize the appearance of the dialogue entry inspector or the Dialogue Editor's node view, see Customizing the Dialogue Editor.
ModestFacialHair
Posts: 13
Joined: Thu Sep 19, 2024 1:17 pm

Re: Customise DialogueEntry editor window?

Post by ModestFacialHair »

Ideal, thank you!
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

Re: Customise DialogueEntry editor window?

Post by Tony Li »

Happy to help! You can customize the editor quite a lot with those hooks. If you ever encounter any area where you can't customize what you need to, let me know and I'll add a hook. It's safer than directly modifying Dialogue System code because otherwise you'd lose your direct modifications whenever you updated the Dialogue System.
ModestFacialHair
Posts: 13
Joined: Thu Sep 19, 2024 1:17 pm

Re: Customise DialogueEntry editor window?

Post by ModestFacialHair »

You know, I swear I searched the docs, and I didn't see that big juicy chunk of info you linked to. Maybe I was searching for 'modify'. Or 'customise' :)

> If you ever encounter any area where you can't customize what you need to, let me know and I'll add a hook.

I will bear that in mind! I have stuck religiously to subclassing for exactly this reason, but obviously that has its limits.

A follow-up question. I would like to add something to validate my Lua code immediately after editing a conversation node, because I habitually misspell function names when I type them and don't notice until I hit Play.

(i) is there any functionalityin the system that already does anything like that, or
(ii)if not, any advice on where to add this kind of hook? customDrawDialogueEntryInspector ?

thanking you!
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

Re: Customise DialogueEntry editor window?

Post by Tony Li »

Hi,

customDrawDialogueEntryInspector would be the place. Unlike Sequence fields, where we can add a Check button to check syntax because we know what sequencer commands are available ahead of time, Lua is more flexible. You could define new functions and structures in the Dialogue Editor's Database Properties > Global User Script, for example, that the entry wouldn't know about until runtime. So it's a bit more challenging to validate Lua. You could do it with a bit of work, though!
ModestFacialHair
Posts: 13
Joined: Thu Sep 19, 2024 1:17 pm

Re: Customise DialogueEntry editor window?

Post by ModestFacialHair »

cheers!

Yes, I think proper validation is going to be beyond me. But I also think I really just want a common sense check with a string match on 'does this function even exist', and I'll take my chances with whether the arguments are valid. It looks like registering a custom method just puts the method info in the environment LuaTable? That contains other Lua methods too, right?
User avatar
Tony Li
Posts: 23250
Joined: Thu Jul 18, 2013 1:27 pm

Re: Customise DialogueEntry editor window?

Post by Tony Li »

Yes, you got it.

It may help to set up a CustomLuaFunctionInfo asset and use the "..." when possible to help prevent typos.
Post Reply