@@ -191,6 +191,9 @@ await RenderThread.Dispatcher.InvokeAsync(async () =>
191
191
_logger . LogInformation ( "Using encoding controller: {Controller}" , controller ) ;
192
192
}
193
193
194
+ // キャッシュ無効化
195
+ OutputViewModel . DisableAllCache ( ) ;
196
+
194
197
// フレームプロバイダー作成
195
198
// using var renderer = new SceneRenderer(scene);
196
199
var renderer = _editViewModel . Renderer . Value ;
@@ -206,11 +209,6 @@ await RenderThread.Dispatcher.InvokeAsync(async () =>
206
209
using ( frameProgress . CombineLatest ( sampleProgress )
207
210
. Subscribe ( t => ProgressValue . Value = t . Item1 . TotalSeconds + t . Item2 . TotalSeconds ) )
208
211
{
209
- RenderNodeCacheContext cacheContext = renderer . GetCacheContext ( ) ;
210
- cacheContext . CacheOptions = RenderCacheOptions . Disabled ;
211
- // FrameCacheも無効化
212
- _editViewModel . FrameCacheManager . Value . Clear ( ) ;
213
-
214
212
await controller . Encode ( frameProvider , sampleProvider , _lastCts . Token ) ;
215
213
}
216
214
}
@@ -226,8 +224,7 @@ await RenderThread.Dispatcher.InvokeAsync(async () =>
226
224
}
227
225
finally
228
226
{
229
- _editViewModel . Renderer . Value . GetCacheContext ( ) . CacheOptions =
230
- RenderCacheOptions . CreateFromGlobalConfiguration ( ) ;
227
+ OutputViewModel . EnableAllCache ( ) ;
231
228
_progress . Value = 0 ;
232
229
ProgressMax . Value = 0 ;
233
230
ProgressValue . Value = 0 ;
@@ -239,6 +236,30 @@ await RenderThread.Dispatcher.InvokeAsync(async () =>
239
236
}
240
237
}
241
238
239
+ private static void DisableAllCache ( )
240
+ {
241
+ foreach ( EditorTabItem item in EditorService . Current . TabItems )
242
+ {
243
+ if ( item . Context . Value is EditViewModel editViewModel )
244
+ {
245
+ editViewModel . Renderer . Value . GetCacheContext ( ) . CacheOptions = RenderCacheOptions . Disabled ;
246
+ editViewModel . FrameCacheManager . Value . Clear ( ) ;
247
+ }
248
+ }
249
+ }
250
+
251
+ private static void EnableAllCache ( )
252
+ {
253
+ foreach ( EditorTabItem item in EditorService . Current . TabItems )
254
+ {
255
+ if ( item . Context . Value is EditViewModel editViewModel )
256
+ {
257
+ editViewModel . Renderer . Value . GetCacheContext ( ) . CacheOptions =
258
+ RenderCacheOptions . CreateFromGlobalConfiguration ( ) ;
259
+ }
260
+ }
261
+ }
262
+
242
263
public void CancelEncode ( )
243
264
{
244
265
_logger . LogInformation ( "Encoding process cancellation requested." ) ;
0 commit comments