public static void AddLayerBeforeLast(this ModelApplicationBase application, ModelApplicationBase layer) { ModelApplicationBase lastLayer = application.LastLayer; if (lastLayer.Id != "After Setup" && lastLayer.Id != "UserDiff") throw new ArgumentException("LastLayer.Id", lastLayer.Id); application.RemoveLayer(lastLayer); application.AddLayer(layer); application.AddLayer(lastLayer); }
public static void ReInitLayers(this ModelApplicationBase modelApplicationBase) { var lastLayer = modelApplicationBase.LastLayer; while (lastLayer.Id != "Unchanged Master Part") { modelApplicationBase.RemoveLayer(lastLayer); lastLayer = modelApplicationBase.LastLayer; } var afterSetupLayer = modelApplicationBase.CreatorInstance.CreateModelApplication(); afterSetupLayer.Id = "After Setup"; modelApplicationBase.AddLayer(afterSetupLayer); }
/// <summary> /// Builds the background for the given scene. /// </summary> /// <param name="manipulator">The current scene manipulator.</param> /// <param name="backgroundTexture">The link to the background texture file.</param> public static void BuildBackground(this SceneManipulator manipulator, ResourceLink backgroundTexture) { backgroundTexture.EnsureNotNull("backgroundTexture"); // Create the background layer (if necessary) if (!manipulator.ContainsLayer(Constants.GFX_LAYER_BACKGROUND)) { SceneLayer bgLayer = manipulator.AddLayer(Constants.GFX_LAYER_BACKGROUND); manipulator.SetLayerOrderID( bgLayer, Constants.GFX_LAYER_BACKGROUND_ORDERID); } // Load the background var resBackgroundTexture = manipulator.AddTexture(backgroundTexture); manipulator.Add( new TexturePainter(resBackgroundTexture) { AccentuationFactor = 1f }, Constants.GFX_LAYER_BACKGROUND); }