8000 Define custom shapes by SjurdurS · Pull Request #158 · Smibu/elmanager · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Define custom shapes #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 204 commits into from
Mar 15, 2025
Merged

Define custom shapes #158

merged 204 commits into from
Mar 15, 2025

Conversation

SjurdurS
Copy link
Contributor
@SjurdurS SjurdurS commented Jan 24, 2025

This pull request adds a new Custom Shape Tool, called "Shape", to the Level Editor that allows you to quickly place predefined custom shapes into the current level.
Furthermore, this pull request also adds a new right click context menu option called "Save as shape..." which creates a new custom shape based on the current selection.

Custom shapes are saved as regular Elma levels (*.lev) on disk, and are grouped by sub-folders in the root folder for custom shapes. The root folder for custom shapes is called sle_shapes and will be created in the same directory as Elmanager.exe the first time a custom shape is saved.

The custom shape collection is just a folder structure with files, and therefore easily shareable / importable / exportable.

The following components can be added to custom shapes:

  • Polygons (always full polygons, if any vertex is selected on a polygon, the whole polygon is serialized).
  • Grass polygons
  • Objects (Apples, Killers, Flowers)
  • Pictures
  • Textures

The new Custom Shape Tool supports the following actions:

  • Right click to open the Shape Selection dialog
  • Anchoring using num 1-5 like Picture Tool.
  • Transformation
    • Mirroring - Vertical, Horizontal or Both (toggle with num 6)
    • Rotation - num 7 to rotate left, num 9 to rotate right, num 8 to reset rotation
    • Scaling - Resize using (+ / - ) on the keyboard
    • Reset anchoring and transformations: num 0
    • The transformation state is remembered between shapes, so if you rotate one shape, and select a different one, the same settings apply to the new shape as well.

Images

New Shape button, and Shape Selection dialog

Elmanager_6LHlIvoMYi

Shapes are grouped by folders.

Elmanager_ckvefUHXjf

Example shapes for quick testing

Here is an example collection of shapes you can use for trying it out.
Place the following sle_shapes folder in the same folder as the Elmanager.exe
sle_shapes.zip

@Smibu

This comment was marked as outdated.

Smibu

This comment was marked as resolved.

@SjurdurS

This comment was marked as resolved.

SjurdurS and others added 3 commits January 25, 2025 20:50
Co-authored-by: Mika Lehtinen <Smibu@users.noreply.github.com>
I haven't removed the support for deserialization of JSON  shapes to help with converting between the old JSON and the new LEV format.
@SjurdurS

This comment was marked as resolved.

@Smibu

This comment was marked as resolved.

@SjurdurS

This comment was marked as resolved.

@Smibu

This comment was marked as resolved.

@SjurdurS

This comment was marked as resolved.

@Smibu

This comment was marked as resolved.

@SjurdurS

This comment was marked as resolved.

@Smibu

This comment was marked as resolved.

@SjurdurS

This comment was marked as resolved.

@Smibu

This comment was marked as resolved.

@SjurdurS

This comment was marked as resolved.

Copy link
Owner
@Smibu Smibu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates, it's getting closer to finish line :) I added a few more comments here.

Found a bug (imo): if I place a shape, reopen form and cancel, it forgets the last selected shape. I think this used to work so maybe broke in refactoring.


if (!IsHandleCreated)
{
SharedContext = sharedContext; // Set shared context before initialization

This comment was marked as resolved.

@SjurdurS
Copy link
Contributor Author
SjurdurS commented Mar 6, 2025

Thanks for the updates, it's getting closer to finish line :) I added a few more comments here.

Found a bug (imo): if I place a shape, reopen form and cancel, it forgets the last selected shape. I think this used to work so maybe broke in refactoring.

Yeah I know, it happened after refactoring to storing the state in the _shapeSelection object. I left it for now but I can see if I can fix it. 8000

SjurdurS and others added 10 commits March 6, 2025 20:45
ExtraRendering shouldn't be needed because we have transient elements already and we don't have to render anything extra

Co-authored-by: Mika Lehtinen <Smibu@users.noreply.github.com>
Co-authored-by: Mika Lehtinen <Smibu@users.noreply.github.com>
The handle should never be able to be created at this point anyways
…election after closing Shape Selection From with the Cancel button
@SjurdurS
Copy link
Contributor Author
SjurdurS commented Mar 6, 2025

Thanks for the updates, it's getting closer to finish line :) I added a few more comments here.
Found a bug (imo): if I place a shape, reopen form and cancel, it forgets the last selected shape. I think this used to work so maybe broke in refactoring.

Yeah I know, it happened after refactoring to storing the state in the _shapeSelection object. I left it for now but I can see if I can fix it.

The bug has been fixed here: 3fe32b0

@Smibu Smibu marked this pull request as ready for review March 13, 2025 21:41
Copy link
Owner
@Smibu Smibu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This seems almost ready for merging. Can you update PR description to reflect current state? I will squash merge this, so PR title and description will be used as the commit message.

Co-authored-by: Mika Lehtinen <Smibu@users.noreply.github.com>
@SjurdurS
Copy link
Contributor Author

Thanks! This seems almost ready for merging. Can you update PR description to reflect current state? I will squash merge this, so PR title and description will be used as the commit message.

I've updated the pull request description (the first message in this pull request). Let me know if I should change anything :)

@Smibu
Copy link
Owner
Smibu commented Mar 15, 2025

Big thanks and congrats for getting this over the finish line. :)

I will create a build later today and announce in discord.

@Smibu Smibu merged commit 5ee3333 into Smibu:master Mar 15, 2025
2 checks passed
@SjurdurS
Copy link
Contributor Author

Thank you for all your help! Very much appreciated the time you put in to helping me get this finished :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0