Skip to content

Commit e600d59

Browse files
iTris666GitHub Enterprise
authored andcommitted
Fix vfx view not beeing framed at launch (#79)
* Fix vfx view not beeing framed at launch * safer implementation * Update CHANGELOG.md
1 parent 2981e68 commit e600d59

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

com.unity.visualeffectgraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ The version number for this package has increased due to a version update of a r
136136
- Make VisualEffect created from the GameObject menu have unique names [Case 1262989](https://issuetracker.unity3d.com/product/unity/issues/guid/1262989/)
137137
- Missing System Seed in new dynamic built-in operator.
138138
- Prefab highlight missing for initial event name toggle [Case 1263012](https://issuetracker.unity3d.com/product/unity/issues/guid/1263012/)
139+
- Correctly frame the whole graph, when opening the Visual Effect Editor
139140
- Optimize display of inspector when there is a lot of exposed VFX properties.
140141
- fixes the user created vfx default resources that were ignored unless loaded
141142
- fix crash when creating a loop in subgraph operators [Case 1251523](https://issuetracker.unity3d.com/product/unity/issues/guid/1251523/)

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,8 @@ public void FrameNewController()
749749

750750
void FrameAfterAWhile()
751751
{
752+
753+
752754
var rectToFit = contentViewContainer.layout;
753755
var frameTranslation = Vector3.zero;
754756
var frameScaling = Vector3.one;
@@ -760,7 +762,16 @@ void FrameAfterAWhile()
760762
return;
761763
}
762764

763-
CalculateFrameTransform(rectToFit, layout, 30, out frameTranslation, out frameScaling);
765+
Rect rectAvailable = layout;
766+
767+
float validateFloat = rectAvailable.x + rectAvailable.y + rectAvailable.width + rectAvailable.height;
768+
if (float.IsInfinity(validateFloat) || float.IsNaN(validateFloat))
769+
{
770+
schedule.Execute(FrameAfterAWhile);
771+
return;
772+
}
773+
774+
CalculateFrameTransform(rectToFit, rectAvailable, 30, out frameTranslation, out frameScaling);
764775

765776
Matrix4x4.TRS(frameTranslation, Quaternion.identity, frameScaling);
766777

0 commit comments

Comments
 (0)