private static void DrawMicroSplatLayer(Generator tgen, int num) { MicroSplatOutput200 gen = (MicroSplatOutput200)tgen; MicroSplatOutput200.MicroSplatLayer layer = gen.layers[num]; if (layer == null) { return; } Material microSplatMat = null; if (GraphWindow.current.mapMagic != null) { microSplatMat = GraphWindow.current.mapMagic.terrainSettings.material; } 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); //icon Texture2DArray icon = null; if (microSplatMat != null && microSplatMat.HasProperty("_Diffuse")) { icon = (Texture2DArray)microSplatMat?.GetTexture("_Diffuse"); } using (Cell.RowPx(28)) { if (icon != null) { Draw.TextureIcon(icon, layer.channelNum); } } //index using (Cell.Row) { Cell.EmptyLine(); using (Cell.LineStd) { int newIndex = Draw.Field(layer.channelNum, "Index"); if (newIndex >= 0 && (icon == null || newIndex < icon.depth)) { layer.channelNum = newIndex; } } Cell.EmptyLine(); } Cell.EmptyRowPx(10); using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer); } Cell.EmptyLinePx(3); }
private static void DrawMicroSplatLayer(Generator tgen, int num) { MicroSplatOutput200 gen = (MicroSplatOutput200)tgen; MicroSplatOutput200.MicroSplatLayer layer = gen.layers[num]; if (layer == null) { return; } Material microSplatMat = null; if (GraphWindow.current.mapMagic != null) { microSplatMat = GraphWindow.current.mapMagic.terrainSettings.material; } 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); //icon Texture2DArray iconsArr = null; if (microSplatMat != null && microSplatMat.HasProperty("_Diffuse")) { iconsArr = (Texture2DArray)microSplatMat?.GetTexture("_Diffuse"); } using (Cell.RowPx(28)) { if (iconsArr != null) { Draw.TextureIcon(iconsArr, layer.channelNum); } } Cell.EmptyRowPx(10); //index using (Cell.Row) { Cell.EmptyLine(); using (Cell.LineStd) { int newIndex = Draw.Field(layer.channelNum, "Index"); if (newIndex >= 0 && (iconsArr == null || newIndex < iconsArr.depth)) { layer.channelNum = newIndex; layer.prototype = null; } } Cell.EmptyLine(); } //terrain layer (if enabled) if (GraphWindow.current.mapMagic != null && GraphWindow.current.mapMagic.globals.microSplatApplyType != Globals.MicroSplatApplyType.Textures) //no need to create layers for textures-only mode { TerrainLayer tlayer = layer.prototype; if (tlayer == null) { tlayer = new TerrainLayer(); layer.prototype = tlayer; } if (tlayer.diffuseTexture == null) { tlayer.diffuseTexture = iconsArr.GetTexture(num); } } Cell.EmptyRowPx(10); using (Cell.RowPx(0)) GeneratorDraw.DrawOutlet(layer); } Cell.EmptyLinePx(3); }