GoGeneral node port positioning


Can any one help me out, how to keep input ports at right side and out ports at left side of a GoGeneral node.

I think you’ll need to customize the GoGeneralNode class by overriding GoGeneralNode.CreatePort so that the instances of GoGeneralNodePort that it creates have a few different property values.

I haven’t tried this, but maybe something like:

protected override GoGeneralNodePort CreatePort(bool input) {
  GoGeneralNodePort p = new GoGeneralNodePort();
  p.Style = GoPortStyle.TriangleMiddleLeft;
  p.LeftSide = input;
  p.IsValidFrom = input;
  p.IsValidTo = !input;
  p.FromSpot = GoObject.MiddleLeft;
  p.ToSpot = GoObject.MiddleRight;
  return p;

But I may have missed some properties.

I have tried the same before contacting you, with the above properties changes and behave as expected but orientation of the link is not getting changed.

So you are getting the appearance of the node the way that you want, but not how the links are routed? Could you show a small screenshot showing what you have now and sketch how it should be instead?

This is what I have

In the above screen shot Red link is drawn as expected, but blue link is not expected, rather it should be a straight.

Attaching the expected behaviour screen shot

This is what expected.

You want to use the default GoGeneralNode port setup for standard output-on-the-right and input-on-the-left cases. That’s the case you seem to have wrong here.

So how can I solve my problem, is there any alternative way I can solve this issue. Please suggest me if any.

Well, it looks like you don’t have enough info in CreatePort to do the job, since “input” parameter doesn’t tell which “side” the port will be on (the code assumes input=true is side=left).

So I think you’ll have to just do the normal Initialize() and then go through all the ports and set them to be the way you really want them (which is really just flipping all the ones that are right side input or left side output).

Here is the basics of how to iterate all the ports (for the left side)

  int num = this.LeftPortsCount;
  for (int i = 0; i < num; i++) {
      GoGeneralNodePort p = GetLeftPort(i);

      ...  set the params that are initialized in CreatePort here if you need them to be different than the default.


and… get rid of your CreatePort override.