Cycle cell shapes per pattern in cinematic mode#10
Conversation
Mirrors the existing palette-cycling behavior: each new pattern in cinematic mode now also picks a random cell shape, avoiding the shape used in the previous cycle. The user's pre-cinematic shape is saved on Start() and restored on Stop() so toggling cinematic mode does not silently overwrite their working selection. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates cinematic mode to also cycle the rendered cell shape on each pattern transition, using the same “random but never repeat the previous selection” approach already used for palette cycling. It also preserves the user’s pre-cinematic shape choice by saving it on Start() and restoring it on Stop().
Changes:
- Save/restore
RenderSettings.Shapewhen entering/exiting cinematic mode. - Randomize
RenderSettings.Shapeon each cinematic cycle, avoiding consecutive repeats. - Track last-picked shape index to support non-repeating selection logic.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private int PickNextCellShapeIndex() | ||
| { | ||
| int n = Enum.GetValues<CellShape>().Length; | ||
| if (n <= 1) return 0; | ||
| if (_lastShapeIndex < 0) return Random.Shared.Next(n); | ||
| int next = Random.Shared.Next(n - 1); | ||
| if (next >= _lastShapeIndex) next++; | ||
| return next; | ||
| } |
There was a problem hiding this comment.
Good call — there was an asymmetry with PickNextPaletteIndex, which already indexes into the actual GradientPresets.Presets array. Fixed in c117d8c by caching Enum.GetValues<CellShape>() as a static AllCellShapes array and using Array.IndexOf / array indexing instead of int casts. Now correct even if the enum gains non-contiguous values.
Addresses Copilot review feedback on PR #10. Cache the CellShape values array once as a static field, then look up the previously-applied shape via Array.IndexOf and pick the next one by indexing into the array. This mirrors how PickNextPaletteIndex already works (indexing into GradientPresets.Presets) and stays correct if CellShape ever gains non-contiguous explicit values. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
CinematicController.PickNextPaletteIndex, so consecutive cycles always differ.RenderSettings.Shapeis saved onStart()and restored onStop(), matching howGradientStopsis preserved.All 9 shapes (Cube, BeveledCube, Tetrahedron, Octahedron, SquarePyramid, Icosahedron, Dodecahedron, Sphere, Capsule) are eligible. No changes outside
CinematicController.cs— the existing shape plumbing inRenderSettings,InstancedCellRenderer,ImGuiUI, andSessionManageris reused as-is.Test plan
dotnet buildsucceeds with no warningsP) and watch 3+ transitions — each shows a visibly different cell shape, no two consecutive shapes repeat, and palette cycling still works independentlyEscape— dropdown and rendered cells return to Capsule🤖 Generated with Claude Code