From: Eunki, Hong Date: Fri, 2 Aug 2024 07:06:12 +0000 (+0900) Subject: [NUI.Scene3D.Sample] Remove useless looping animation X-Git-Tag: submit/tizen/20240807.070632~1^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dbcfd1da7f75218fd6ab542dcebca47f4807a444;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI.Scene3D.Sample] Remove useless looping animation Since some useless animation was running internally until GC comes, CPU usage might be increased for this sample. To avoid useless rendering, let we ensurely dispose not-using animation. Signed-off-by: Eunki, Hong --- diff --git a/test/Tizen.NUI.Scene3D.Sample/Scene3DSample.cs b/test/Tizen.NUI.Scene3D.Sample/Scene3DSample.cs index ea1f7751a..8edc3412f 100644 --- a/test/Tizen.NUI.Scene3D.Sample/Scene3DSample.cs +++ b/test/Tizen.NUI.Scene3D.Sample/Scene3DSample.cs @@ -290,6 +290,13 @@ class Scene3DSample : NUIApplication } }; + if (mModelRotateAnimation != null) + { + mModelRotateAnimation.Stop(); + mModelRotateAnimation.Dispose(); + mModelRotateAnimation = null; + } + mModelRotateAnimation = new Animation(modelRotateAnimationDurationMilliseconds); mModelRotateAnimation.AnimateBy(mModel, "Orientation", new Rotation(new Radian(new Degree(360.0f)), Vector3.YAxis)); @@ -452,9 +459,9 @@ class Scene3DSample : NUIApplication } case "f": { - if (mModelAnimation?.State == Animation.States.Playing) + if (mModel != null && mModelLoadFinished) { - if (mModel != null && mModelLoadFinished) + if (mModelAnimation != null && mModelAnimation.State == Animation.States.Playing) { mMotionAnimation = mModel.GenerateMotionDataAnimation(mAnimateMotionData); @@ -479,7 +486,7 @@ class Scene3DSample : NUIApplication } else if (e.Key.State == Key.StateType.Up) { - if (mModelAnimation?.State == Animation.States.Stopped) + if (mModelAnimation != null && mModelAnimation.State == Animation.States.Stopped) { if (mMotionAnimation != null) { @@ -499,7 +506,7 @@ class Scene3DSample : NUIApplication public void Activate() { - mWindow = Window.Instance; + mWindow = Window.Default; mWindow.BackgroundColor = Color.DarkOrchid; mWindowSize = mWindow.WindowSize;