@@ -36,6 +36,7 @@ public class LevelFrame : Frame
3636 private FramebufferRenderer ? renderer ;
3737 public LevelRenderer ? levelRenderer ;
3838 private RendererPayload rendererPayload ;
39+ private HashSet < Mission > selectedMissions = new HashSet < Mission > ( ) ;
3940 public Level level { get ; set ; }
4041 private bool enableCameraInfo = true ;
4142 public ShaderTable shaderTable ;
@@ -336,6 +337,24 @@ private void RenderMenuBar()
336337 ImGui . EndMenu ( ) ;
337338 }
338339
340+ if ( level . game == GameType . DL && level . missions . Count > 0 && ImGui . BeginMenu ( "Missions" ) )
341+ {
342+ foreach ( var mission in level . missions )
343+ {
344+ bool selected = selectedMissions . Contains ( mission ) ;
345+ if ( ImGui . Checkbox ( $ "Mission { mission . missionID } ", ref selected ) )
346+ {
347+ if ( selected )
348+ selectedMissions . Add ( mission ) ;
349+ else
350+ selectedMissions . Remove ( mission ) ;
351+
352+ RefreshMissionMobies ( ) ;
353+ }
354+ }
355+ ImGui . EndMenu ( ) ;
356+ }
357+
339358 ImGui . Separator ( ) ;
340359
341360 if ( interactiveSession )
@@ -611,7 +630,7 @@ private void LoadLevel(Level level)
611630 camera . SetRotation ( 0 , 0 ) ;
612631 }
613632 selectedObjects . Clear ( ) ;
614-
633+ activeMobies = level . mobs . ToList ( ) ;
615634 InvalidateView ( ) ;
616635 }
617636
@@ -1012,8 +1031,17 @@ protected void OnResize()
10121031 return level . shrubs . Find ( x => x . globalID == hitId ) ;
10131032 case RenderedObjectType . Tie :
10141033 return level . ties . Find ( x => x . globalID == hitId ) ;
1034+
10151035 case RenderedObjectType . Moby :
1016- return level . mobs . Find ( x => x . globalID == hitId ) ;
1036+ Moby ? foundMoby = level . mobs . Find ( x => x . globalID == hitId ) ;
1037+ if ( foundMoby != null ) return foundMoby ;
1038+ foreach ( var mission in selectedMissions )
1039+ {
1040+ Moby ? missionMoby = mission . mobies . Find ( x => x . globalID == hitId ) ;
1041+ if ( missionMoby != null ) return missionMoby ;
1042+ }
1043+ return null ;
1044+
10171045 case RenderedObjectType . Spline :
10181046 // Both "Splines" and "GrindPaths" use Spline objects.
10191047 // Search for a hit in the Splines first then look
@@ -1102,6 +1130,36 @@ private void ExportListOfProperties<T>(string path, IEnumerable<T> list, Func<T,
11021130 }
11031131 }
11041132
1133+ private List < Moby > activeMobies = new List < Moby > ( ) ;
1134+ private void RefreshMissionMobies ( )
1135+ {
1136+ if ( levelRenderer == null ) return ;
1137+
1138+ foreach ( var moby in activeMobies . ToList ( ) )
1139+ levelRenderer . Remove ( moby , level ) ;
1140+
1141+ var mobies = new List < Moby > ( level . mobs ) ;
1142+ foreach ( var mission in selectedMissions )
1143+ mobies . AddRange ( mission . mobies ) ;
1144+
1145+ foreach ( var moby in mobies )
1146+ {
1147+ Mission ? sourceMission = selectedMissions . FirstOrDefault ( m => m . mobies . Contains ( moby ) ) ;
1148+ if ( sourceMission != null )
1149+ {
1150+ bool isMissionModel = sourceMission . models . Exists ( m => m . id == moby . modelID ) ;
1151+ levelRenderer . Include ( moby , isMissionModel ? sourceMission . textures : level . textures ) ;
1152+ }
1153+ else
1154+ {
1155+ levelRenderer . Include ( moby ) ;
1156+ }
1157+ }
1158+
1159+ activeMobies = mobies ;
1160+ InvalidateView ( ) ;
1161+ }
1162+
11051163 protected void OnPaint ( )
11061164 {
11071165 rendererPayload . visibility . hideCameraMoby = interactiveSession && hookLiveUpdate && hookUpdateCamera ;
0 commit comments