public void Paint(GTexturePainterArgs args)
        {
            IGTexturePainter p = ActivePainter;

            if (p == null)
            {
                return;
            }

            FillArgs(ref args);

#if UNITY_EDITOR
            List <GStylizedTerrain> overlappedTerrain = GPaintToolUtilities.CheckBrushOverlap(groupId, args.WorldPointCorners);
            if (args.MouseEventType == GPainterMouseEventType.Down ||
                args.MouseEventType == GPainterMouseEventType.Drag)
            {
                Editor_CreateInitialHistoryEntry(args, overlappedTerrain);
            }
#endif

            IEnumerator <GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
            while (terrains.MoveNext())
            {
                if (terrains.Current.GroupId != GroupId && GroupId >= 0)
                {
                    continue;
                }
                p.Paint(terrains.Current, args);
            }

#if UNITY_EDITOR
            EditedTerrains.UnionWith(overlappedTerrain);
            if (args.MouseEventType == GPainterMouseEventType.Up)
            {
                Editor_CreateHistory(args);
                currentInitialBackupName = null;
                InitialRecordedTerrains.Clear();
                EditedTerrains.Clear();
            }
#endif
        }
Exemplo n.º 2
0
        public void Paint(GFoliagePainterArgs args)
        {
            IGFoliagePainter p = ActivePainter;

            if (p == null)
            {
                return;
            }

            args.Radius        = BrushRadius;
            args.Rotation      = BrushRotation;
            args.Density       = BrushDensity;
            args.EraseRatio    = EraseRatio;
            args.ScaleStrength = ScaleStrength;
            args.TreeIndices   = SelectedTreeIndices;
            args.GrassIndices  = SelectedGrassIndices;

            args.CustomArgs = CustomPainterArgs;
            if (SelectedBrushMaskIndex >= 0 && SelectedBrushMaskIndex < BrushMasks.Count)
            {
                args.Mask = BrushMasks[SelectedBrushMaskIndex];
            }
            args.Filters           = GetComponents <GSpawnFilter>();
            args.EnableTerrainMask = EnableTerrainMask;

            ProcessBrushDynamic(ref args);
            Vector3[] corners = GCommon.GetBrushQuadCorners(args.HitPoint, args.Radius, args.Rotation);
            args.WorldPointCorners = corners;

#if UNITY_EDITOR
            List <GStylizedTerrain> overlappedTerrain = GPaintToolUtilities.CheckBrushOverlap(groupId, args.WorldPointCorners);
            if ((args.MouseEventType == GPainterMouseEventType.Down ||
                 args.MouseEventType == GPainterMouseEventType.Drag) &&
                args.ShouldCommitNow == false)
            {
                Editor_CreateInitialHistoryEntry(args, overlappedTerrain);
            }
#endif

            IEnumerator <GStylizedTerrain> terrains = GStylizedTerrain.ActiveTerrains.GetEnumerator();
            while (terrains.MoveNext())
            {
                if (terrains.Current.GroupId != GroupId && GroupId >= 0)
                {
                    continue;
                }
                GStylizedTerrain t = terrains.Current;
                p.Paint(t, args);
            }

#if UNITY_EDITOR
            EditedTerrains.UnionWith(overlappedTerrain);
            if (args.MouseEventType == GPainterMouseEventType.Up)
            {
                Editor_CreateHistory(args);
                currentInitialBackupName = null;
                InitialRecordedTerrains.Clear();
                EditedTerrains.Clear();
            }
#endif
        }