Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LumosX
Copy link
Contributor

@LumosX LumosX commented Dec 22, 2019

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
Copy link
Owner

Siccity commented Dec 23, 2019

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
Copy link
Contributor Author

LumosX commented Dec 23, 2019

  • 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
Copy link
Contributor Author

LumosX commented Dec 25, 2019

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