Skip to content
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

Temp eraser POC #154

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Temp eraser POC #154

wants to merge 3 commits into from

Conversation

Nocxr
Copy link

@Nocxr Nocxr commented Jun 16, 2022

godot_J48fCZsOeV

Discussion issue: #152

Pull requested for initial commit of temporary eraser function, just wanted to add it for easier code comparison then having to go to my fork

Copy link
Owner

@mbrlabs mbrlabs left a comment

Choose a reason for hiding this comment

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

Great feature! I left some comments.

Comment on lines +14 to +22
enum ToolNames {
BrushTool,
RectangleTool,
CircleTool,
LineTool,
EraserTool,
SelectionTool,
}

Copy link
Owner

Choose a reason for hiding this comment

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

I don't understand why this is needed. Can't you resuse the Types.Tool enum?


# --------------------------------------------------------------------------------------------------
func _on_eraser_pressed():
_eraser_last_tool_active = _canvas._active_tool.get_class()
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of doing this, you should keep an internal Tool.Types variable in the InfiniteCanvas class and expose a get_active_tool_type() method. Then us this here .This way you can get rid of all the get_class() methods and the ToolNames enum

Comment on lines +62 to +63
# -------------------------------------------------------------------------------------------------
func get_class(): return "BrushTool"
Copy link
Owner

@mbrlabs mbrlabs Jun 16, 2022

Choose a reason for hiding this comment

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

Get rid of this and all other get_class methods. See reasoning in other comment

@@ -21,6 +21,9 @@ onready var _edit_palette_dialog: EditPaletteDialog = $EditPaletteDialog

var _ui_visible := true
var _player_enabled := false
var _eraser_pressed_start: float
var _eraser_last_tool_active
var _eraser_swap_min_time: float = 400
Copy link
Owner

Choose a reason for hiding this comment

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

This should be a constant

@Nocxr
Copy link
Author

Nocxr commented Jul 7, 2022

Hey thanks for the feedback! Sorry for the delay, I just got back from a trip I left on right after I submitted this and it went a little longer than I thought it would. I'll go over my code tonight/tomorrow and try to implement your suggestions in and get it back to you.

@mbrlabs
Copy link
Owner

mbrlabs commented Jul 8, 2022

Don't worry, take your time :)

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.

None yet

2 participants