Skip to content

Commit

Permalink
Merge pull request #97 from suzuryg/fix/scenevew-setting-not-used
Browse files Browse the repository at this point in the history
fix: SceneView camera settings not used in ExpressionEditor
  • Loading branch information
suzuryg authored Dec 21, 2023
2 parents 4187b8b + 164a481 commit 31e09af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace Suzuryg.FaceEmo.AppMain
public class SubWindowManager : ISubWindowManager
{
private FaceEmoInstaller _installer;
private SceneView _lastActiveSceneView;

private object _lockFindObjects = new object();

Expand Down Expand Up @@ -62,7 +61,7 @@ public T Provide<T>() where T : EditorWindow, ISubWindow
if (window is ExpressionPreviewWindow expressionPreviewWindow)
{
var expressionEditor = _installer.Container.Resolve<ExpressionEditor>();
expressionPreviewWindow.Initialize(expressionEditor, _lastActiveSceneView);
expressionPreviewWindow.Initialize(expressionEditor);
}
}
else if (typeof(T) == typeof(CombineClipsDialog))
Expand Down Expand Up @@ -128,8 +127,6 @@ private T GetWindow<T>(Action<EditorWindow> initializeAction) where T : EditorWi

if (!window.IsInitialized)
{
_lastActiveSceneView = SceneView.lastActiveSceneView;

if (initializeAction is Action<EditorWindow>)
{
initializeAction(window);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,29 @@ public bool IsDocked
private Texture2D _renderCache;
private SceneView _lastActiveSceneViewCache;

public void Initialize(AV3.ExpressionEditor expressionEditor, SceneView lastActiveSceneView)
public void Initialize(AV3.ExpressionEditor expressionEditor)
{
// Dependencies
_expressionEditor = expressionEditor;

// Initialization
if (lastActiveSceneView != null && lastActiveSceneView.cameraSettings != null)
// _lastActiveSceneViewCache is set when this window is opened.
if (_lastActiveSceneViewCache != null && _lastActiveSceneViewCache.cameraSettings != null)
{
var copied = new CameraSettings();

copied.speed = lastActiveSceneView.cameraSettings.speed;
copied.speedNormalized = lastActiveSceneView.cameraSettings.speedNormalized;
copied.speedMin = lastActiveSceneView.cameraSettings.speedMin;
copied.speedMax = lastActiveSceneView.cameraSettings.speedMax;
copied.easingEnabled = lastActiveSceneView.cameraSettings.easingEnabled;
copied.easingDuration = lastActiveSceneView.cameraSettings.easingDuration;
copied.accelerationEnabled = lastActiveSceneView.cameraSettings.accelerationEnabled;
copied.fieldOfView = lastActiveSceneView.cameraSettings.fieldOfView;
copied.nearClip = lastActiveSceneView.cameraSettings.nearClip;
copied.farClip = lastActiveSceneView.cameraSettings.farClip;
copied.dynamicClip = lastActiveSceneView.cameraSettings.dynamicClip;
copied.occlusionCulling = lastActiveSceneView.cameraSettings.occlusionCulling;
copied.speed = _lastActiveSceneViewCache.cameraSettings.speed;
copied.speedNormalized = _lastActiveSceneViewCache.cameraSettings.speedNormalized;
copied.speedMin = _lastActiveSceneViewCache.cameraSettings.speedMin;
copied.speedMax = _lastActiveSceneViewCache.cameraSettings.speedMax;
copied.easingEnabled = _lastActiveSceneViewCache.cameraSettings.easingEnabled;
copied.easingDuration = _lastActiveSceneViewCache.cameraSettings.easingDuration;
copied.accelerationEnabled = _lastActiveSceneViewCache.cameraSettings.accelerationEnabled;
copied.fieldOfView = _lastActiveSceneViewCache.cameraSettings.fieldOfView;
copied.nearClip = _lastActiveSceneViewCache.cameraSettings.nearClip;
copied.farClip = _lastActiveSceneViewCache.cameraSettings.farClip;
copied.dynamicClip = _lastActiveSceneViewCache.cameraSettings.dynamicClip;
copied.occlusionCulling = _lastActiveSceneViewCache.cameraSettings.occlusionCulling;

cameraSettings = copied;
}
Expand Down

0 comments on commit 31e09af

Please sign in to comment.