Skip to content

Commit c79036d

Browse files
julienf-unityEvergreen
authored andcommitted
[VFX] Misc subgraph fixes
Misc subgraph fixes: - Fix a regression (https://jira.unity3d.com/browse/UUM-69798) that prevented blocks to be added to subgraph context. - Fix https://jira.unity3d.com/browse/UUM-556, not by reenabling compilation for subgraph (which makes no sense as they are not compiled) but by disabling the compile menu. Expected workflow is to save for subgraph dependencies to be recompiled.
1 parent f861668 commit c79036d

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCompileDropdownButton.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ protected override void OnOpenPopup()
7575
bool enableToggles = (!m_VFXView.controller.graph.GetResource()?.isSubgraph) ?? false; // for subgraph we disable auto reinit
7676

7777
m_AutoCompileToggle.value = VFXViewWindow.GetWindowNoShow(m_VFXView).autoCompile;
78+
m_AutoCompileToggle.SetEnabled(enableToggles);
7879

7980
m_AutoReinitToggle.value = enableToggles ? VFXViewWindow.GetWindowNoShow(m_VFXView).autoReinit : false;
8081
m_AutoReinitToggle.SetEnabled(enableToggles);

Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,8 @@ public bool HasCustomAttributeConflicts(IEnumerable<VFXAttribute> customAttribut
551551
readonly Texture2D m_UnlinkedIcon;
552552
readonly VFXVCSDropdownButton m_VCSDropDown;
553553

554+
private VFXCompileDropdownButton m_CompileDropDownButton;
555+
554556
VFXNodeProvider m_NodeProvider;
555557
bool m_IsRuntimeMode;
556558
bool m_ForceShaderDebugSymbols;
@@ -619,8 +621,8 @@ public VFXView()
619621
var saveDropDownButton = new VFXSaveDropdownButton(this);
620622
m_Toolbar.Add(saveDropDownButton);
621623

622-
var compileDropDownButton = new VFXCompileDropdownButton(this);
623-
m_Toolbar.Add(compileDropDownButton);
624+
m_CompileDropDownButton = new VFXCompileDropdownButton(this);
625+
m_Toolbar.Add(m_CompileDropDownButton);
624626

625627
m_LinkedIcon = EditorGUIUtility.LoadIcon(Path.Combine(EditorResources.iconsPath, "Linked.png"));
626628
m_UnlinkedIcon = EditorGUIUtility.LoadIcon(Path.Combine(EditorResources.iconsPath, "UnLinked.png"));
@@ -794,6 +796,7 @@ internal void ToggleShaderValidationChanged()
794796
private void SetToolbarEnabled(bool enabled)
795797
{
796798
ToolbarElementsToDisableWhenNoAsset.ForEach(x => m_Toolbar.Q<VisualElement>(x).SetEnabled(enabled));
799+
797800
}
798801

799802
public void UpdateBadges(IVFXErrorReporter report)
@@ -1290,8 +1293,10 @@ void NewControllerSet()
12901293
m_NoAssetElement.RemoveFromHierarchy();
12911294
SetToolbarEnabled(true);
12921295

1293-
m_AttachDropDownButton.SetEnabled(this.controller.graph.visualEffectResource.subgraph == null);
1294-
m_LockToggle.SetEnabled(this.controller.graph.visualEffectResource.subgraph == null);
1296+
bool isSubGraph = this.controller.model.isSubgraph;
1297+
m_CompileDropDownButton.SetEnabled(!isSubGraph);
1298+
m_AttachDropDownButton.SetEnabled(!isSubGraph);
1299+
m_LockToggle.SetEnabled(!isSubGraph);
12951300

12961301
OnFocus();
12971302
}

Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXBlockSubgraphContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public enum ContextType
2121
UpdateAndOutput = Update | Output
2222
}
2323

24-
public VFXBlockSubgraphContext() : base(VFXContextType.None, VFXDataType.None, VFXDataType.None)
24+
public VFXBlockSubgraphContext() : base(VFXContextType.BlockSubgraph, VFXDataType.None, VFXDataType.None)
2525
{
2626
}
2727

Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ enum VFXContextType
2424
SpawnerGPU = 1 << 6,
2525
Subgraph = 1 << 7,
2626
Filter = 1 << 8,
27+
BlockSubgraph = 1 << 9,
2728

2829
InitAndUpdate = Init | Update,
2930
InitAndUpdateAndOutput = Init | Update | Output,
3031
UpdateAndOutput = Update | Output,
3132
All = Init | Update | Output | Spawner | Subgraph,
3233

33-
CanHaveBlocks = ~(OutputEvent | Event | SpawnerGPU),
34+
CanHaveBlocks = ~(OutputEvent | Event | SpawnerGPU | Subgraph),
3435
};
3536

3637
[Flags]

0 commit comments

Comments
 (0)