Skip to content

Commit 3a48e76

Browse files
julienamsellemEvergreen
authored andcommitted
[VFX] Keep activation slot visible when collapsing a block
Jira: UUM-59123 When a block is collapsed the activation slot is not visible anymore. Before: ![Unity_JyNrRODGTR](https://media.github.cds.internal.unity3d.com/user/4003/files/b9c5467d-f237-4e52-bd5c-2a9bad57bd26) After: ![Unity_2XV2CCHlve](https://media.github.cds.internal.unity3d.com/user/4003/files/c83c5751-7340-4546-8320-1a43bfd11d5a) Slack thread: https://unity.slack.com/archives/G1BTWN88Z/p1702479571472809
1 parent 7f43a17 commit 3a48e76

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ bool SyncAnchors(ReadOnlyCollection<VFXDataAnchorController> ports, VisualElemen
254254

255255
if (needsResync)
256256
{
257-
var existingAnchors = container.Children().Cast<VFXDataAnchor>().ToDictionary(t => t.controller, t => t);
257+
var existingAnchors = container.Children().Cast<VFXDataAnchor>()
258+
.Union(titleContainer.Query<VFXDataAnchor>().ToList())
259+
.ToDictionary(t => t.controller, t => t);
258260
container.Clear();
259261
for (int i = 0; i < ports.Count; ++i)
260262
{
@@ -292,8 +294,6 @@ private void UpdateActivationPortPosition(VFXDataAnchor anchor)
292294
if (anchor.controller.isSubgraphActivation)
293295
anchor.AddToClassList("subgraphblock");
294296

295-
var settingsCount = expanded ? m_Settings.Count : 0;
296-
anchor.style.top = -26 - settingsCount * 18 - (settingsCount > 0 ? 18 : 0);
297297
titleContainer.AddToClassList("activationslot");
298298
anchor.AddToClassList("activationslot");
299299
AddToClassList("activationslot");
@@ -307,6 +307,16 @@ private bool UpdateActivationPortPositionIfAny()
307307
var anchor = inputContainer.Children()
308308
.Cast<VFXDataAnchor>()
309309
.SingleOrDefault(x => x.controller == anchorController);
310+
311+
if (anchor != null)
312+
{
313+
anchor.RemoveFromHierarchy();
314+
titleContainer.Insert(0, anchor);
315+
}
316+
else
317+
{
318+
anchor = titleContainer.Q<VFXDataAnchor>();
319+
}
310320
if (anchor != null)
311321
{
312322
UpdateActivationPortPosition(anchor);
@@ -389,6 +399,11 @@ public IEnumerable<VFXDataAnchor> GetPorts(bool input, bool output)
389399
{
390400
yield return child;
391401
}
402+
403+
if (titleContainer.Q<VFXDataAnchor>() is { } activationSlot)
404+
{
405+
yield return activationSlot;
406+
}
392407
}
393408
if (output)
394409
{

Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXBlock.uss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ VFXEditableDataAnchor.activationslot > BoolPropertyRM > Label
9595
display: none;
9696
}
9797

98-
VFXContextUI .VFXNodeUI.node #node-border #title.activationslot > #title-label
99-
{
100-
margin-left: 44px;
101-
}
102-
10398
#block-container .activationslot.collapsed.VFXNodeUI.node #contents > #top > #input
10499
{
105100
padding-top: 0px;

Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXDataAnchor.uss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ VFXContextUI #output .VFXDataAnchor.port #connector
101101
right: -4px;
102102
}
103103

104+
.activationslot.VFXDataAnchor .propertyrm {
105+
margin-left: 10px;
106+
}
107+
.activationslot.VFXDataAnchor .propertyrm > #icon {
108+
display: none;
109+
}
110+
104111
.VFXDataAnchor.Output.hasDepth {
105112
border-left-width: 1px;
106113
margin-left: 9px;

Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXNode.uss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
.VFXNodeUI.node #node-border > #title > #title-label
2020
{
21+
margin-left: 54px;
2122
flex:1 1 auto;
2223
overflow:hidden;
2324
}

0 commit comments

Comments
 (0)