SonyWWS / ATF

Authoring Tools Framework (ATF) is a set of C#/.NET components for making tools on Windows. ATF has been in continuous development in Sony Computer Entertainment's (SCE) Worldwide Studios central tools group since early 2005. ATF has been used by most SCE first party studios to make many custom tools such as Naughty Dog’s level editor and shader editor for The Last of Us, Guerrilla Games’ sequence editor for Killzone games (including the Killzone: Shadow Fall PS4 launch title), an animation blending tool at Santa Monica Studio, a level editor at Bend Studio, a visual state machine editor for Quantic Dream, sound editing tools, and many others.
Apache License 2.0
1.89k stars 262 forks source link

FSM diagram for a non root node #10

Closed pdrasko closed 10 years ago

pdrasko commented 10 years ago

Hi,

I'm looking to adapt the FSM code in your sample project. The requirement would be to show a FSM editing context when a non-root node in the document is selected.

What is the best way to accomplish this provided that the XSD regarding the FSM nodes is identical to your sample project?

question

Ron2 commented 10 years ago

You would normally want just one editing context per document. The editing context typically owns the current selection and command history (undo/redo). If your child nodes are in the same physical document as the root nodes, then I'm pretty sure you would not want to mix up undo/redos between root nodes and child nodes.

It sounds like you're trying to build a hierarchical finite state machine. If so, the Statechart sample app provides an example of that, since it has hierarchical elements -- Statechart elements can be inside other Statechart elements. The Circuit Editor, too, has a hierarchy through the use of circuit groups which can contain child circuit groups and so on.

To show a FSM editing context in some circumstance, to me, that means that you want to change the active context. In the sample app, we only do that when a different document becomes active. You use the IContextRegistry and set the ActiveContext property. You could set the ActiveContext to a different EditingContext when a non-root node is selected. This sounds a little bit tricky because the FSM's EditingContext is also a selection context (it implements ISelectionContext), so you'll find that if you change the ActiveContext in response to a selection changed event, you'll probably immediately generate another selection changed event.

Did I understand your question correctly?