Skip to content

Commit

Permalink
Fix vfx view not beeing framed at launch (#79)
Browse files Browse the repository at this point in the history
* Fix vfx view not beeing framed at launch

* safer implementation

* Update CHANGELOG.md
  • Loading branch information
iTris666 authored and GitHub Enterprise committed Aug 27, 2020
1 parent 2981e68 commit e600d59
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions com.unity.visualeffectgraph/CHANGELOG.md
Expand Up @@ -136,6 +136,7 @@ The version number for this package has increased due to a version update of a r
- Make VisualEffect created from the GameObject menu have unique names [Case 1262989](https://issuetracker.unity3d.com/product/unity/issues/guid/1262989/)
- Missing System Seed in new dynamic built-in operator.
- Prefab highlight missing for initial event name toggle [Case 1263012](https://issuetracker.unity3d.com/product/unity/issues/guid/1263012/)
- Correctly frame the whole graph, when opening the Visual Effect Editor
- Optimize display of inspector when there is a lot of exposed VFX properties.
- fixes the user created vfx default resources that were ignored unless loaded
- fix crash when creating a loop in subgraph operators [Case 1251523](https://issuetracker.unity3d.com/product/unity/issues/guid/1251523/)
Expand Down
13 changes: 12 additions & 1 deletion com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs
Expand Up @@ -749,6 +749,8 @@ public void FrameNewController()

void FrameAfterAWhile()
{


var rectToFit = contentViewContainer.layout;
var frameTranslation = Vector3.zero;
var frameScaling = Vector3.one;
Expand All @@ -760,7 +762,16 @@ void FrameAfterAWhile()
return;
}

CalculateFrameTransform(rectToFit, layout, 30, out frameTranslation, out frameScaling);
Rect rectAvailable = layout;

float validateFloat = rectAvailable.x + rectAvailable.y + rectAvailable.width + rectAvailable.height;
if (float.IsInfinity(validateFloat) || float.IsNaN(validateFloat))
{
schedule.Execute(FrameAfterAWhile);
return;
}

CalculateFrameTransform(rectToFit, rectAvailable, 30, out frameTranslation, out frameScaling);

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

Expand Down

0 comments on commit e600d59

Please sign in to comment.