I've been playing with the framework and swapped the knob graphics.
The non-square graphics I used were not rendered with the correct aspect ratio which revealed two possible bugs:
in ConnectionKnob.cs
private float knobAspect { get { return knobTexture != null? knobTexture.width/ knobTexture.height : 1; } }
The line should be changed to:
private float knobAspect { get { return knobTexture != null? (float) knobTexture.width/ (float) knobTexture.height : 1; } }
The knobTexture.width and height need to be case to a float or the result otherwise the result is the result of dividing the two as integers (i.e. 48/30 would produce 1 not 1.6)
in ConnectionKnob.cs
In GetCanvasSpaceKnob, the calculation appears to be wrong.
Currently it is:
Vector2 knobSize = new Vector2 (NodeEditorGUI.knobSize * knobAspect,
NodeEditorGUI.knobSize / knobAspect );
This should be changed to:
Vector2 knobSize = new Vector2 (NodeEditorGUI.knobSize * knobAspect,
NodeEditorGUI.knobSize );
(The "/knobAspect" removed)
The aspect ratio value calculated here is used to multiply the horizontal to scale it up to keep the ratio correct for the vertical (to make sure the vertical is no bigger than "knobSize"), or divide the vertical by the aspect ratio to make sure the horizontal is no bigger than "knobSize", there is no need to do both.
I've tried it and it appears correct, so thought I'd add it as an issue.
Cheers,
xyzDave
I've been playing with the framework and swapped the knob graphics. The non-square graphics I used were not rendered with the correct aspect ratio which revealed two possible bugs:
in ConnectionKnob.cs private float knobAspect { get { return knobTexture != null? knobTexture.width/ knobTexture.height : 1; } } The line should be changed to: private float knobAspect { get { return knobTexture != null? (float) knobTexture.width/ (float) knobTexture.height : 1; } } The knobTexture.width and height need to be case to a float or the result otherwise the result is the result of dividing the two as integers (i.e. 48/30 would produce 1 not 1.6)
in ConnectionKnob.cs In GetCanvasSpaceKnob, the calculation appears to be wrong. Currently it is: Vector2 knobSize = new Vector2 (NodeEditorGUI.knobSize * knobAspect,
NodeEditorGUI.knobSize / knobAspect ); This should be changed to: Vector2 knobSize = new Vector2 (NodeEditorGUI.knobSize * knobAspect,
NodeEditorGUI.knobSize ); (The "/knobAspect" removed) The aspect ratio value calculated here is used to multiply the horizontal to scale it up to keep the ratio correct for the vertical (to make sure the vertical is no bigger than "knobSize"), or divide the vertical by the aspect ratio to make sure the horizontal is no bigger than "knobSize", there is no need to do both.
I've tried it and it appears correct, so thought I'd add it as an issue. Cheers, xyzDave