CATROID-1645 Replace peripheral-specific arc/go-through bricks with shared blue motion bricks#5192
Open
wslany wants to merge 8 commits intoCatrobat:developfrom
Open
CATROID-1645 Replace peripheral-specific arc/go-through bricks with shared blue motion bricks#5192wslany wants to merge 8 commits intoCatrobat:developfrom
wslany wants to merge 8 commits intoCatrobat:developfrom
Conversation
catroid/src/main/java/org/catrobat/catroid/content/actions/PlotArcAction.kt
Dismissed
Show dismissed
Hide dismissed
catroid/src/main/java/org/catrobat/catroid/content/bricks/ArcBrick.kt
Dismissed
Show dismissed
Hide dismissed
catroid/src/main/java/org/catrobat/catroid/content/bricks/GoThroughBrick.kt
Dismissed
Show dismissed
Hide dismissed
catroid/src/main/java/org/catrobat/catroid/embroidery/DSTHeader.kt
Dismissed
Show dismissed
Hide dismissed
catroid/src/main/java/org/catrobat/catroid/ui/fragment/CategoryBricksFactory.kt
Dismissed
Show dismissed
Hide dismissed
catroid/src/main/java/org/catrobat/catroid/ui/fragment/CategoryBricksFactory.kt
Dismissed
Show dismissed
Hide dismissed
catroid/src/main/java/org/catrobat/catroid/ui/fragment/CategoryBricksFactory.kt
Dismissed
Show dismissed
Hide dismissed
catroid/src/main/java/org/catrobat/catroid/ui/fragment/CategoryBricksFactory.kt
Dismissed
Show dismissed
Hide dismissed
catroid/src/test/java/org/catrobat/catroid/test/plot/PlotTest.kt
Dismissed
Show dismissed
Hide dismissed
catroid/src/androidTest/java/org/catrobat/catroid/test/content/bricks/BrickCategoryTest.java
Fixed
Show fixed
Hide fixed
catroid/src/androidTest/java/org/catrobat/catroid/test/content/bricks/BrickCategoryTest.java
Fixed
Show fixed
Hide fixed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates previously peripheral-specific (unreleased) arc/go-through motion bricks into shared blue motion bricks (ArcBrick, GoThroughBrick), and updates motion/render/export/lifecycle code paths so arc and bezier “go through” behave consistently across normal motion, pen, embroidery, plotter, and laser cutter.
Changes:
- Replace peripheral-specific arc/go-through bricks and layouts with shared motion equivalents, and wire them into the relevant brick categories.
- Update arc/go-through actions to compute intermediate motion + direction consistently, including embroidery/plot implications.
- Fix/verify export + live rendering alignment issues (plot queues, SVG Y inversion, DST header formatting) and add regression tests.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| catroid/src/main/java/org/catrobat/catroid/content/ActionFactory.java | Switch plot-arc factory API to ArcBrick.Directions. |
| catroid/src/main/java/org/catrobat/catroid/content/Look.java | Trigger running-stitch updates on position changes (respecting simultaneousMovementXY). |
| catroid/src/main/java/org/catrobat/catroid/content/actions/PlotArcAction.kt | Rework arc path + direction updates using motion direction. |
| catroid/src/main/java/org/catrobat/catroid/content/actions/PlotThroughAction.kt | Rework bezier “go through” to use doubles + update direction along the curve. |
| catroid/src/main/java/org/catrobat/catroid/content/bricks/ArcBrick.kt | Rename/convert plot arc brick to shared motion ArcBrick + new layout ids. |
| catroid/src/main/java/org/catrobat/catroid/content/bricks/GoThroughBrick.kt | Introduce shared motion GoThroughBrick with visual placement support. |
| catroid/src/main/java/org/catrobat/catroid/embroidery/DSTHeader.kt | Kotlin rewrite + fixed-width header formatting for negative extents. |
| catroid/src/main/java/org/catrobat/catroid/plot/Plot.kt | Prevent shared-mutable-point corruption between render queue and export data. |
| catroid/src/main/java/org/catrobat/catroid/plot/SVGPlotGenerator.kt | Invert Y axis so SVG output matches stage coordinates. |
| catroid/src/main/java/org/catrobat/catroid/stage/EmbroideryActor.kt | Kotlin rewrite; ensure ShapeRenderer uses batch projection/transform matrices. |
| catroid/src/main/java/org/catrobat/catroid/stage/StageLifeCycleController.java | Reset sprite drawing state on stage destroy to ensure clean restarts. |
| catroid/src/main/java/org/catrobat/catroid/ui/fragment/CategoryBricksFactory.kt | Add shared motion bricks to motion + peripheral categories via helper list. |
| catroid/src/main/res/layout/brick_arc.xml | Shared motion arc brick layout (motion styling + ids). |
| catroid/src/main/res/layout/brick_go_through.xml | Shared motion go-through layout (motion styling + ids). |
| catroid/src/main/res/values/strings.xml | Add shared strings for arc/go-through brick UI text. |
| catroid/src/androidTest/java/org/catrobat/catroid/test/BricksHelpUrlTest.java | Update help URL mappings to new shared bricks. |
| catroid/src/androidTest/java/org/catrobat/catroid/test/content/bricks/BrickCategoryTest.java | Update expected category brick lists (motion/peripheral include shared bricks). |
| catroid/src/test/java/org/catrobat/catroid/stage/EmbroideryActorProjectionTest.kt | Regression test for using batch matrices when rendering embroidery. |
| catroid/src/test/java/org/catrobat/catroid/stage/StageLifeCycleControllerTest.kt | Regression test ensuring destroy resets pen/plot/stitch state for fresh starts. |
| catroid/src/test/java/org/catrobat/catroid/test/content/actions/EmbroideryArcActionTest.kt | Regression tests for embroidery arc stitch output + direction behavior. |
| catroid/src/test/java/org/catrobat/catroid/test/content/actions/PlotArcActionTest.kt | Regression tests for arc movement/direction normalization. |
| catroid/src/test/java/org/catrobat/catroid/test/content/actions/PlotThroughActionTest.kt | Regression tests for bezier end direction + zig-zag stitch direction updates. |
| catroid/src/test/java/org/catrobat/catroid/test/content/bricks/GoThroughBrickTest.kt | Verify GoThroughBrick implements visual placement defaults. |
| catroid/src/test/java/org/catrobat/catroid/test/content/sprite/LookTest.java | Verify running-stitch updates are not duplicated for combined XY set. |
| catroid/src/test/java/org/catrobat/catroid/test/embroidery/DSTHeaderTest.kt | Verify DST header alignment + negative extents formatting. |
| catroid/src/test/java/org/catrobat/catroid/test/embroidery/EmbroideryExportIsolationTest.kt | Ensure export stream isn’t affected by mutations of rendered pattern list. |
| catroid/src/test/java/org/catrobat/catroid/test/plot/PlotTest.kt | Tests for SVG Y inversion + render/export queue isolation + immediate rendering. |
| catroid/src/test/java/org/catrobat/catroid/test/ui/fragment/PeripheralMotionCategoryBricksTest.kt | Verifies peripheral categories include requested shared motion bricks in order. |
| catroid/src/main/java/org/catrobat/catroid/content/bricks/EmbroideryArcBrick.kt | Removed (replaced by shared ArcBrick). |
| catroid/src/main/java/org/catrobat/catroid/content/bricks/EmbroideryThroughBrick.kt | Removed (replaced by shared GoThroughBrick). |
| catroid/src/main/java/org/catrobat/catroid/content/bricks/LaserArcBrick.kt | Removed (replaced by shared ArcBrick). |
| catroid/src/main/java/org/catrobat/catroid/content/bricks/PlotThroughBrick.kt | Removed (replaced by shared GoThroughBrick). |
| catroid/src/main/java/org/catrobat/catroid/embroidery/DSTHeader.java | Removed (Kotlin rewrite). |
| catroid/src/main/java/org/catrobat/catroid/stage/EmbroideryActor.java | Removed (Kotlin rewrite). |
| catroid/src/main/res/layout/brick_embroider_arc.xml | Removed (replaced by shared motion brick_arc.xml). |
| catroid/src/main/res/layout/brick_embroidery_through.xml | Removed (replaced by shared motion brick_go_through.xml). |
| catroid/src/main/res/layout/brick_laser_through.xml | Removed (replaced by shared motion brick_go_through.xml). |
| catroid/src/main/res/layout/brick_plot_arc.xml | Removed (replaced by shared motion brick_arc.xml). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
This PR replaces the six unreleased peripheral-specific motion bricks
EmbroideryArcBrickEmbroideryThroughBrickLaserArcBrickLaserThroughBrickPlotArcBrickPlotThroughBrickwith two shared blue motion bricks:
ArcBrickGoThroughBrickThe new shared bricks work consistently for normal motion, pen, embroidery, laser cutting, and plotting. This removes a substantial amount of duplicated brick and layout code and keeps the motion behavior in one place.
Because the six old bricks have not been released publicly, there are no backward-compatibility or migration concerns for existing projects.
Ticket
What Changed
1. Unified arc and go-through into shared blue motion bricks
PlotArcBrick->ArcBrickLaserThroughBrick->GoThroughBrickActionFactoryand the shared motion actions so the same motion logic is used across normal motion, pen, embroidery, plotting, and cutting.2. Added the shared motion bricks to peripheral brick menus
The embroidery, laser cutter, and plotter menus now expose the shared blue motion bricks directly, since they are especially useful in those categories.
Added to those menus:
Place atSet X toSet Y toChange X byChange Y byMove _ stepsTurn leftTurn rightPoint in directionGo in arcGo through3. Added numeric visual placement support
GoThroughBricknow supports the same visual-placement behavior for plain numeric coordinates that users expect from the other motion bricks.4. Restored and generalized correct arc / go-through behavior
Additional Fixes Included
While manually testing the branch, several follow-up bugs were found and fixed so that stage rendering and exported files stay aligned.
Export and rendering fixes
Live stage fixes
Lifecycle / restart fixes
Implementation Notes
EmbroideryActor.java->EmbroideryActor.ktDSTHeader.java->DSTHeader.ktMain Files
Production
catroid/src/main/java/org/catrobat/catroid/content/ActionFactory.javacatroid/src/main/java/org/catrobat/catroid/content/Look.javacatroid/src/main/java/org/catrobat/catroid/content/actions/PlotArcAction.ktcatroid/src/main/java/org/catrobat/catroid/content/actions/PlotThroughAction.ktcatroid/src/main/java/org/catrobat/catroid/content/bricks/ArcBrick.ktcatroid/src/main/java/org/catrobat/catroid/content/bricks/GoThroughBrick.ktcatroid/src/main/java/org/catrobat/catroid/plot/Plot.ktcatroid/src/main/java/org/catrobat/catroid/plot/SVGPlotGenerator.ktcatroid/src/main/java/org/catrobat/catroid/stage/EmbroideryActor.ktcatroid/src/main/java/org/catrobat/catroid/stage/StageLifeCycleController.javacatroid/src/main/java/org/catrobat/catroid/embroidery/DSTHeader.ktcatroid/src/main/java/org/catrobat/catroid/ui/fragment/CategoryBricksFactory.ktLayout / resources
catroid/src/main/res/layout/brick_arc.xmlcatroid/src/main/res/layout/brick_go_through.xmlcatroid/src/main/res/values/strings.xmlTests
catroid/src/test/java/org/catrobat/catroid/test/content/actions/EmbroideryArcActionTest.ktcatroid/src/test/java/org/catrobat/catroid/test/content/actions/PlotArcActionTest.ktcatroid/src/test/java/org/catrobat/catroid/test/content/actions/PlotThroughActionTest.ktcatroid/src/test/java/org/catrobat/catroid/test/content/bricks/GoThroughBrickTest.ktcatroid/src/test/java/org/catrobat/catroid/test/plot/PlotTest.ktcatroid/src/test/java/org/catrobat/catroid/test/embroidery/EmbroideryExportIsolationTest.ktcatroid/src/test/java/org/catrobat/catroid/test/embroidery/DSTHeaderTest.ktcatroid/src/test/java/org/catrobat/catroid/stage/EmbroideryActorProjectionTest.ktcatroid/src/test/java/org/catrobat/catroid/stage/StageLifeCycleControllerTest.ktcatroid/src/test/java/org/catrobat/catroid/test/ui/fragment/PeripheralMotionCategoryBricksTest.ktcatroid/src/androidTest/java/org/catrobat/catroid/test/content/bricks/BrickCategoryTest.javaTesting
Focused tests run during development included:
Concrete commands run included:
Independent Embroidery Designer APKs were also built repeatedly for manual device testing while addressing the follow-up bugs.
Reviewer Notes
Your checklist for this pull request
Please review the contributing guidelines and wiki pages of this repository.