static public void ShowWindow() { instance = (PreviewWindow)GetWindow(typeof(PreviewWindow)); instance.position = new Rect(100, 100, instance.position.width, instance.position.height); instance.titleContent = new GUIContent("Preview"); instance.Show(); }
static public void ShowWindow(IMapMagic mapMagic) { instance = (PreviewWindow)GetWindow(typeof(PreviewWindow)); //PreviewWindow window = new PreviewWindow(); // instance.mapMagic = mapMagic; instance.position = new Rect(100, 100, instance.position.width, instance.position.height); instance.titleContent = new GUIContent("Preview"); instance.Show(); }
void PreviewOutput (Generator gen, Generator.Output output, bool inWindow) { PreviewOutput previewOutput = MapMagic.instance.gens.GetGenerator<PreviewOutput>(); //removing an old one preview generator if (previewOutput != null) MapMagic.instance.gens.DeleteGenerator(previewOutput); //do nothing else if it is a 'clear' command (gen is null) if (gen==null || output==null) { PreviewWindow.CloseWindow(); MapMagic.instance.gens.ChangeGenerator(null); return; } //creating new preview and connecting it previewOutput = (PreviewOutput)MapMagic.instance.gens.CreateGenerator(typeof(PreviewOutput), gen.guiRect.position + new Vector2(200,10)); previewOutput.input.Link(output, gen); if (inWindow) { previewOutput.inWindow = true; PreviewWindow.ShowWindow(); } else previewOutput.onTerrain = true; MapMagic.instance.gens.ChangeGenerator(previewOutput); /*if (gen==null) { MapMagic.instance.previewInWindow=false; MapMagic.instance.previewOnTerrain=false; MapMagic.instance.previewGenerator=null; MapMagic.instance.previewOutput=null; if (MapMagic.instance.generators.GetOutput<SplatOutput>() != null) OnGeneratorChanged(MapMagic.instance.generators.GetOutput<SplatOutput>()); else foreach (MapMagic.Chunk chunk in MapMagic.instance.terrains.Objects()) chunk.terrain.terrainData.splatPrototypes = new SplatPrototype[] { new SplatPrototype() { texture = Extensions.ColorTexture(2,2,new Color(0.5f, 0.5f, 0.5f, 0f)) } }; return; } RecordGeneratorUndo(); MapMagic.instance.previewGenerator = gen; MapMagic.instance.previewOutput = previewOutput; if (inWindow) { MapMagic.instance.previewInWindow = true; PreviewWindow.ShowWindow(); } else { MapMagic.instance.previewOnTerrain = true; } OnGeneratorChanged(gen);*/ }
void PreviewOutput (Generator gen, Generator.Output output, bool inWindow) { MapMagic.instance.previewGenerator = gen; MapMagic.instance.previewOutput = output; if (gen==null || output==null) { MapMagic.instance.previewGenerator=null; MapMagic.instance.previewOutput=null; } //should be defined both - or none if (gen!=null) MapMagic.instance.guiGens.ChangeGenerator(null); if (inWindow) { //previewOutput.inWindow = true; PreviewWindow.ShowWindow(); } SceneView.RepaintAll(); }