Skip to content

Special field attribute allowing for I/O tooltip overrides (or hiding the result) - #220

Open
LumosX wants to merge 2 commits into
Siccity:masterfrom
LumosX:tooltip-override-attribute
Open

Special field attribute allowing for I/O tooltip overrides (or hiding the result)#220
LumosX wants to merge 2 commits into
Siccity:masterfrom
LumosX:tooltip-override-attribute

Conversation

@LumosX

@LumosX LumosX commented Dec 22, 2019

Copy link
Copy Markdown
Contributor

When using long, nested namespaces and nested classes, you can find yourself in ridiculous situations where your tooltips go out of screen. With these changes, you can use an attribute to remedy this.

As usual, "before" is to the left, "after" is to the right:
image
Additionally, hiding values is not necessary -- you may only rename if you so desire:
image
(The attribute also supports hiding the value only.)

Usage example for the first image:

[Output(dynamicPortList = true)]
public RootAxisLink[] axes;

// And the dummy linking class itself -- attribute is applied 
// bool parameter is whether the result should be hidden; leave string empty to NOT override tooltip.
[Serializable, OverrideTooltip("Root-Axis link", true)] public class RootAxisLink { };

NB: This commit uses modern C# features such as null coalescing. I'm not too clear on the backwards-compatibility policy of the repo, and will edit if necessary.

the use of an attribute applied to custom classes.
@Siccity

Siccity commented Dec 23, 2019

Copy link
Copy Markdown
Owner

Good feature but its usage is very specific. In order to get as much out of this feature as we can, we need to make a few changes.

  • Move it out of the editor namespace. User should be able to use this directly on his runtime classes
  • Let it work on individual fields as well.

I updated the contributing guidelines to include C# version backwards compatability and using concrete variable types instead of var.

@LumosX

LumosX commented Dec 23, 2019

Copy link
Copy Markdown
Contributor Author
  • Move it out of the editor namespace. User should be able to use this directly on his runtime classes
  • Let it work on individual fields as well.

Sure. I went with a class attribute because it's simpler to check whether the type has it, but it won't be too difficult to check the respective field for it.

@LumosX

LumosX commented Dec 25, 2019

Copy link
Copy Markdown
Contributor Author

image

[Output(dynamicPortList = true)]
[OverrideTooltip("test tooltip with value")]
public string[] baseOutputs;

[Output]
[OverrideTooltip("test tooltip, value hidden", true)]
public float floatOutput;

The attribute can now be applied to fields instead of classes, permitting overriding tooltips of any types. Works on dynamic port lists. Likely doesn't work on dynamic ports without lists, as they aren't bound to a field.

@LumosX LumosX changed the title Special class attribute allowing for I/O tooltip overrides (or hiding the result) Special field attribute allowing for I/O tooltip overrides (or hiding the result) Dec 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants