public static void DrawCTS(MatrixGenerators.CTSOutput200 gen) { #if CTS_PRESENT CTS.CTSProfile profile = GraphWindow.current.mapMagic?.globals.ctsProfile as CTS.CTSProfile; if (GraphWindow.current.mapMagic != null) { using (Cell.LineStd) { CTS.CTSProfile newProfile = Draw.ObjectField(profile, "Profile"); if (profile != newProfile) { GraphWindow.current.mapMagic.globals.ctsProfile = newProfile; profile = newProfile; } } } else { using (Cell.LinePx(18 + 18)) Draw.Label("Not assigned to current \nMapMagic object"); } // using (Cell.LineStd) // if (Draw.Button("Update Shader")) // CTS_UpdateShader(ctsProfile, MapMagic.instance.terrainSettings.material); //populating texture names if (profile != null) { List <CTS.CTSTerrainTextureDetails> textureDetails = profile.TerrainTextures; if (textureNames == null || textureNames.Length != textureDetails.Count) { textureNames = new string[textureDetails.Count]; } textureNames.Process(i => textureDetails[i].m_name); } #else using (Cell.LinePx(60)) Draw.Helpbox("CTS doesn't seem to be installed, or CTS compatibility is not enabled in settings"); #endif using (Cell.LinePx(20)) GeneratorDraw.DrawLayersAddRemove(gen, ref gen.layers, inversed: true, unlinkBackground: true); using (Cell.LinePx(0)) GeneratorDraw.DrawLayersThemselves(gen, gen.layers, inversed: true, layerEditor: DrawCTSLayer); }
public static void DrawCTS(MatrixGenerators.CTSOutput200 gen) { #if CTS_PRESENT CTS.CTSProfile profile = (CTS.CTSProfile)GraphWindow.current.mapMagic?.globals.ctsProfile; using (Cell.LineStd) { CTS.CTSProfile newProfile = Draw.ObjectField(profile, "Profile"); if (profile != newProfile) { if (GraphWindow.current.mapMagic != null) { GraphWindow.current.mapMagic.globals.ctsProfile = newProfile; } profile = newProfile; } } // using (Cell.LineStd) // if (Draw.Button("Update Shader")) // CTS_UpdateShader(ctsProfile, MapMagic.instance.terrainSettings.material); //populating texture names if (profile != null) { List <CTS.CTSTerrainTextureDetails> textureDetails = profile.TerrainTextures; if (textureNames == null || textureNames.Length != textureDetails.Count) { textureNames = new string[textureDetails.Count]; } textureNames.Process(i => textureDetails[i].m_name); } #else using (Cell.LinePx(60)) Draw.Helpbox("CTS doesn't seem to be installed, or CTS compatibility is not enabled in settings"); #endif }
public static void DrawCTSLayer(MatrixGenerators.CTSOutput200.CTSLayer layer, object[] arguments) { int num = (int)arguments[0]; MatrixGenerators.CTSOutput200 gen = (MatrixGenerators.CTSOutput200)arguments[1]; if (layer == null) { return; } #if CTS_PRESENT CTS.CTSProfile profile = (CTS.CTSProfile)GraphWindow.current.mapMagic?.globals.ctsProfile; #endif Cell.EmptyLinePx(3); using (Cell.LinePx(28)) { //Cell.current.margins = new Padding(0,0,0,1); //1-pixel more padding from the bottom since layers are 1 pixel overlayed if (num != 0) { using (Cell.RowPx(0)) GeneratorDraw.DrawInlet(layer, gen); } else //disconnecting last layer inlet if (GraphWindow.current.graph.IsLinked(layer)) { GraphWindow.current.graph.UnlinkInlet(layer); } Cell.EmptyRowPx(10); #if CTS_PRESENT //icon using (Cell.RowPx(28)) { Texture2D icon = null; if (profile != null) { List <CTS.CTSTerrainTextureDetails> textureDetails = profile.TerrainTextures; if (layer.channelNum < textureDetails.Count) { icon = textureDetails[layer.channelNum].Albedo; } } Draw.TextureIcon(icon); } //channel selector Cell.EmptyRowPx(5); using (Cell.Row) { Cell.EmptyLine(); using (Cell.LineStd) { if (textureNames != null) { Draw.PopupSelector(ref layer.channelNum, textureNames); } else { Draw.Field(ref layer.channelNum, "Channel"); } } Cell.EmptyLine(); } #else using (Cell.Row) Draw.Field(ref layer.channelNum, "Channel"); #endif Cell.EmptyRowPx(10); using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer); } Cell.EmptyLinePx(3); }