Skip to content

Commit 1aaf279

Browse files
Fixed output add button could become invisible (#6660)
* [Hack] Fixed output add button could become invisible This can happen when the scrollview is too small and the horizontal scrollbar is not at the right most position * Fixed an issue when there's no output category in the blackboard * Fixed formatting issue * Updated changelog
1 parent 95479ac commit 1aaf279

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

com.unity.visualeffectgraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1515
- Incorrect behavior of Tangent Space in ShaderGraph [Case 1363279](https://issuetracker.unity3d.com/product/unity/issues/guid/1363279/)
1616
- ShaderGraph made with new VFX SG integration where not listed when searching for a shader graph output [Case 1379523](https://issuetracker.unity3d.com/product/unity/issues/guid/1379523/)
1717
- Enable/disable state of VFX blocks and operators are preserved after copy/paste
18+
- Blackboard "Add" button for output could be hidden when the panel is too small (https://issuetracker.unity3d.com/product/unity/issues/guid/1389927/)
1819

1920

2021
## [13.1.2] - 2021-11-05

com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Linq;
32
using UnityEditor.Experimental.GraphView;
43
using UnityEngine;
@@ -133,6 +132,14 @@ public VFXBlackboard(VFXView view)
133132
m_AddButton.SetEnabled(false);
134133

135134
this.AddManipulator(new ContextualMenuManipulator(BuildContextualMenu));
135+
136+
// Workaround: output category is in a scrollview which can lead to get the Add button invisible (moved out of the visible viewport of the scrollviewer)
137+
var scrollView = this.Q<ScrollView>();
138+
if (scrollView != null)
139+
{
140+
scrollView.RegisterCallback<GeometryChangedEvent, ScrollView>(OnGeometryChanged, scrollView);
141+
scrollView.horizontalScroller.valueChanged += x => OnOutputCategoryScrollChanged(scrollView);
142+
}
136143
}
137144

138145
public void LockUI()
@@ -167,6 +174,23 @@ DropdownMenuAction.Status GetContextualMenuStatus()
167174
return DropdownMenuAction.Status.Disabled;
168175
}
169176

177+
void OnOutputCategoryScrollChanged(ScrollView scrollView)
178+
{
179+
OnGeometryChanged(null, scrollView);
180+
}
181+
182+
void OnGeometryChanged(GeometryChangedEvent evt, ScrollView scrollView)
183+
{
184+
if (scrollView != null)
185+
{
186+
var addOutputButton = scrollView.Q<Button>("addOutputButton");
187+
if (addOutputButton != null)
188+
{
189+
addOutputButton.style.left = -scrollView.horizontalScroller.highValue + scrollView.horizontalScroller.value;
190+
}
191+
}
192+
}
193+
170194
void BuildContextualMenu(ContextualMenuPopulateEvent evt)
171195
{
172196
evt.menu.AppendAction("Select All", (a) => SelectAll(), (a) => GetContextualMenuStatus());

0 commit comments

Comments
 (0)