-
Notifications
You must be signed in to change notification settings - Fork 417
Dynamic Multi-Way Connection System #74
Comments
Can you tell me what you'd use it for? I know there are lot's of other use cases than the standard calculation but I can't imagine any that you couldn't accomplish with the current system... maybe with a few tweaks;) |
Well it could be useful even for standard calculation such as adding an
|
Ok, so just to be sure; What do you think will be the best implementation? With preprocessor checks to let the dev switch for their tool, applying this change to the whole framework, or by making an option in connection type or something similar dynamic per knob/node? |
I think both the input and the output knobs and having a boolean for allowing multiple connections in the constructor. |
Ok, doing scene saving and improvement of the save system right now, will work on that afterwards:) |
Facing several problems with this right now. |
hmmm. Well I have seen one other node editor that drew a button half way Alternatively (and this doesn't strike me as particularly elegant), if you Other than those two options I'm not sure if there is another cleaner way On Sun, Jun 12, 2016 at 6:30 AM, Levin G. [email protected] wrote:
|
First option will probably do for now, but only for curves where both knobs are allowed to have multiple connections. I don't know when I'll implement this, though, expect it to be weekend:/ |
Hi, very new to comment anything on this, so take my words with a grain of salt [i have to check the code also]. the requirement is very promising. So some suggestion that come to my mind for controls is
|
Would the concept described in #91 be an acceptable solution for you? Any feedback on that issue appreciated:) |
I think it would be best that in the future it is handled by the traversal system that is used (see #90), so you will be able to use your own and specify own rules. Basically all limitations are then lifted off the framework and you can customize anything that was previously restricted due to how some algorithms work:) |
|
@Nopey I got an idea on how to edit connections with multiple connections at both knob ends, which is a bit more practicable than the previous approaches.
I think implementing that is a bit easier, but needs a bit getting use to... |
The easiest method would be to do collision detection on a low resolution version of the bezier curve's line segments. theres fancier ways, but I have not yet learned some of the math used, so unless you have enough knowledge of math to really dabble with the research papers, I'm just gonna say we use line segments. |
Hi, sorry for not responding. Still processing your first response... Option 1 or 2 sounds better, although we would need to make a visual mockup first;) |
I think that using a hybrid between the first two may be the way forward,
because the the buckyball one is optimal before you run into more then 5?
connections, and then the frog feet becomes necessary. one (final?) option
would be to expand them into a flat array parallel to the nodes side. This
would only work with one knob expanded on a node at once, and is probably
the easiest to implement as it requires no angle Math.
…On Dec 30, 2016 4:31 PM, "Levin G." ***@***.***> wrote:
Hi, sorry for not responding. Still processing your first response...
Don't get into bezier click detection to fast. I don't think it will turn
out too intuitive for what it will take to implement. It is simple line
segment click detection, but still not optimal...
Option 1 or 2 sounds better, although we would need to make a visual
mockup first;)
Might be as simple as adding buttons like a few pixels along the curve,
although that could cause other clipping problems.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEVU-4puGSZ_GGJ9ygmci3fIO2GnEtm2ks5rNaJdgaJpZM4IuIcq>
.
|
Sorry for the late response. After the last merges I now have time to try and implement a prototype of 1. said structure of NodeKnob and subclasses and 2. editing interface for multiple connections :) |
Is this really such a huge problem? Like mjholtzem said, "if you |
Good point. For now, we can assume that this is the case to get most users satisfied, and then expand on that later. Because you never know how users end up using this framework, so we have to be prepared;) But still, very unlikely use case indeed... |
But still, when allowing one output connections and multiple input connections like in a dialogue editor case, I'd imagine the current approach isn't quite intuitive anymore. You'd have to drag the connection from output to input, the exact reverse way... |
I think it should always be possible to create a connection from output to input. |
That's the problem. When you have a multiple-single connection dependency, no matter which way, you currently only have one way to draw a new connection, from multiple to single, and only one way to edit a connection, from single. Both is done by simply dragging from the knob. When we want to allow it the other way around, we have to add additional options besides dragging. I want to avoid shortcuts (eg. Shift-drag) and especially when editing from a multiple connection knob, where the connection amount is variable, that won't work anymore. So the only way I see is some sort if graphical solution, a GUI popup that appears once clicked on a knob, where you can create (center) and edit multiple connections (fan around center), like we discussed above. |
Haha, now I understand:) Sorry... |
@Seneral I totaly see your point regarding the real world cable analogy and that might be the most intuitive one for people who have never worked with a computer interface. I just imagine myself working with these editors hundrets of hours and want to be able to use it as fast as possible. Thus I'd consider dragging the newbie approach and clicking the pro user approach. Therefore I think, it's ok to not be able to do all cases using the newbie approach. As I'm writing this, I'm recognizing that I should have pointed it out this way earlier. Please bare with me^^ Regarding structuring: I'm not sure, I understand Nopey's suggestions completely but the way I see it, those modifiers would also strip away connection types from the knob class, which I think is a good thing. Mainly because it is solely useful for calculation, which is just overhead for statemachine use-cases like mine. In fact, I'd love to see all the calculation stuff gone from the core. Finally one suggestion for "creating" knobs: Manual instantiation like that should be necessary only for dynamic knob counts. (For Example a user adding new choices in a dialog node). For static knobs, which always exist on that nodetype I'd like to add them as fields or properties with Attributes like
That way, it would be even more modular and readable. Plus you dont need to find your special knob in the knob list, when you need to do something with it. |
Yep, have also been thinking of attribute based knob creation. But then again, with so many attributes needed to specify a knob, this would be of no benefit. |
Yes that example would be a bit too much for me too, I just stressed it to the extreme to show, that nothing is missing from your example above. I imagine an ordinary Knob more like this:
What exactly do you mean by "match the principles of c#" ? |
The example I posted was an ordinary knob with features it needs in order to work like the current ones, so no extreme stress - in the end, definitely too long for a normal knob declaration. So we need to find a different way, maybe some kind of preset. This is what I meant with a mix between both. We could have a subclass of ConnectionType specify the modifiers it has and then use a single attribute and instantiate the knob based on the ConnectionType subclass (the attribute taking additional modifiers for flexibility sake:) ). That way we have the benefits of both sides combined, IMO. You can target ConnectionTypes strongly-typed if you want, have short and easy creation but still have the benefit of the modularity of the modifiers. |
I'm a little behind on following this issue but I'll go ahead and throw my thoughts out here as maybe they could influence some of the design for this. I've got a pretty different knob/connection and input system setup in my own framework but I solved the mutli-to-multi issue pretty easily I think. Knobs have an "expanded" state that is triggered on the first click, this causes all the positions for the connections to be fanned out next to the knob. On the second click, the knob initiates building a new connection (although this could be changed to say middle or right click or even a keyboard shortcut if I wanted). When a knob is expanded, the connection draws the curve from the offset position AND it draws its own "knob". Subknobs are sorted by the connections other knobs position, to ensure they are always neatly organized. When this "subknob" is clicked it deletes the connection. Heres a gif of making a number of connections: And what it looks like normally, ie when the knob doesn't have focus And finally another gif of the removal process, even with a messy multi-to-multi on the I think most of this could be accomplished with the current state of the code base in this project, although I don't know about input handling on the knobs and "subknobs"/connections. You'd probably want to basically make a copy of NodeKnob.GetGUIKnob that returns a connection specific location if the knob is selected, and update Node.DrawConnections to handle getting its specific location back. At least that's approximately how I solved it. I also have a |
Wow that's like exactly what we settled on (the expanded state of the knob with the connections fanning out). Really nice to see it working fine as I didn't have the time to create a mock-up yet. |
If I get some free time soon I can certainly take a look into seeing just how far I can get if you want since I've implemented this once before quick successfully; although I suspect I might hit some friction around clicking on the "subknobs" seeing as in my framework they are part of a |
Sorry @JoshAshby for not answering... Go ahead if you want:) |
I'm currently finally implementing this:) Let me tell you why. The complete modifier based connection knobs have the advantage of being super flexible, but it also is weakly typed, it needs complex, repeated setup for each and every knob and all routines accessing these knobs are fragile because they need to search a list to know a knobs property. Here's why: The concept of hard-coded Inputs and Outputs, however, is fully gone. Ports in general can have an input or output flag set but also none if desired. This is totally ok with the calculation routines, checking for input/output is no big deal. It also does not limit a certain port to have only one connection, this is later improved to get UI support ala @JoshAshby . Also, creating knobs in nodes is now way easier. The approach of declaring the Knobs (or just ports) in the node from @paintbox1 is taken, they are read in and created and kept up to date with their declaration in the node. This means adding/removing knobs in the source code will finally adjust existing saves. Dynamic knobs are seperately handled and do not underly such restrictions. Btw, the removal of the explicit Input/Output allows completely flexible routines to take place, passing values backwards up the graph, whatever. If you do not need to pass values, you can use ConnectionKnob and extend it yourself if need be. Hope that's clear and a good solution for all. The fully modular approach was a bit radical to me and had some flaws that we would probably later regret... |
Hi @Seneral, I'm surprised, you want to take the approach from my example. Have you found some sort of compromise with less attributes? In fact, I'm excited to see a code example of your new approach :) |
Well there are only three attributes with parameters, some core options, like type/value handling, which are based off the choice of subclass. |
So, although it is not fully implemented yet (especially the port creation from attributes), here's what the Calculation Node would now look like: public const string ID = "calcNode";
public override string GetID { get { return ID; } }
public override string Title { get { return "Calc Node"; } }
public override Vector2 DefaultSize { get { return new Vector2 (200, 100); } }
[ValueConnectionKnob("Input 1", Direction.In, "Float", ConnectionCount.Multi, NodeSide.Top)]
public ValueConnectionKnob input1Knob;
[ValueConnectionKnob("Input 2", Direction.In, "Float", ConnectionCount.Multi, NodeSide.Top)]
public ValueConnectionKnob input2Knob;
[ValueConnectionKnob("Output 1", Direction.Out, "Float", ConnectionCount.Multi, NodeSide.Bottom)]
public ValueConnectionKnob output1Knob;
protected override void Init ()
{
// Set up other stuff
} Do notice some other changes I made to the creation, all node properties are now actual overridden properties - this means, changes made to the source code now actually reflect in already created canvases, this includes the ConnectionPorts aswell since the knob declarations can be validated on each load easily. Feedback appreciated:) |
So I finally got together a working version yesterday, took a bit longer because of a startup error I had to find a workaround for (when window is open on unity startup, there seem to be two initialization stages with a weird reset in between which caused errors). Anyway, it is looking way better now. Node knob (or rather, port) definitions are now concrete because of the variable-based definition and attribute-based creation. |
Sorry to answer late. Those attributes look like a nice solution. How do the other base types look? Im particularly interested in these because of my dialog editor :) |
So you have a hierarchial structure with increasing features bit also complexity. Each has their own attribute for creation and their own styling level (all inherited). More on that later. |
Sounds very promising. I will check it out, when its done. |
Finished. Will create the PR tomorrow morning, need sleep now:) |
- Node is now defined through properties rather than with the Create function (see nodes), fixing #72 - Create has been replaced by the optional Init function - New ConnectionPort/ConnectionKnob/ValueConnectionKnob level-hierarchy for node connection ports: - ConnectionPort: Basic connection between nodes, straight line - ConnectionKnob: A Knob on the node that can connect to other knobs on other nodes through connections - ValueConnectionKnob: A Value-Knob defined by a type and designed to pass values to it's connections - ConnectionPorts are now defined through Attributes right on variables in the Node definitions (see nodes) - ConnectionPorts of all levels have preset-styling similar to ConnectionTypes previously, each with different settings - Inputs/Outputs are now weakly-typed, maximum connection counts are seperately specified - Currently not possible to edit Multi-Multi connection knobs due to interfacing, but structurally it's finally possible
Officially merged and committed:) |
Next up is multi-multi-connection editing. What do you think? |
… with the multi-connection changes Seneral#74 Modified all the BaseDialogNode derived classes to use the new connection system and define their own static and dynamic Connection Knobs added a common method in BaseDialogNode for all classes to use to check if a specific connection points to another node and get that node DialogNodeCanvas - I could not get the list of Dialog Start Nodes (_lstDialogStartNodes) to work, it kept getting "type mismatch" in unity, so I removed the list and dynamically get the list now. Dialog1.asset - created a new example as the existing one would not load tested with unity version 5.5.2f1 personal
Right now outputs can always have multiple connections and inputs can only have one connection. It would be nice if this were more flexible and you restrict an output to one connection or allow multiple connections for an input.
The text was updated successfully, but these errors were encountered: