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

Implement Magic Wand Tool (#128) #854

Closed
wants to merge 15 commits into from
Closed

Implement Magic Wand Tool (#128) #854

wants to merge 15 commits into from

Conversation

HenryJia
Copy link
Contributor

@HenryJia HenryJia commented Jan 4, 2015

This implements the magic wand tool of #128

}

brushItem()->setTileRegion(mSelectedRegion);
document->setSelectedArea(mSelectedRegion);
Copy link
Member

Choose a reason for hiding this comment

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

This line seems wrong. The selected area is already applied to the document by the ChangeSelectedArea undo command created and pushed on the undo stack above.

Also, this seems like the wrong moment to set the tile region of the brush item. Shouldn't that be done in the tilePositionChanged function to provide a preview of the area that's going to be selected?

@bjorn
Copy link
Member

bjorn commented Jan 4, 2015

To fix the AppVeyor continuous-integration build you should add magicwandtool.cpp and magicwandtool.h to the files list in src/tiled/tiled.qbs.

@HenryJia
Copy link
Contributor Author

HenryJia commented Jan 4, 2015

OK, Done.

Add,
Subtract,
Intersect
};
Copy link
Member

Choose a reason for hiding this comment

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

You have these selection modes here but you're not using them. If the tool is working so far, why not try and implement that functionality like in the TileSelectionTool?

@HenryJia
Copy link
Contributor Author

HenryJia commented Jan 4, 2015

OK

@HenryJia
Copy link
Contributor Author

HenryJia commented Jan 4, 2015

I'm not fully sure how the selection modes work in the actual program (as in how you change it)

@bjorn
Copy link
Member

bjorn commented Jan 4, 2015

I'm not fully sure how the selection modes work in the actual program (as in how you change it)

Please see if you can just derive this by reading the code in TileSelectionTool.

@HenryJia
Copy link
Contributor Author

HenryJia commented Jan 4, 2015

Oh I see, through modifiers on the keyboard.

…tion Tool. However, the shift modifier does not work yet due to problems with TilePainter::computeFillRegion
@HenryJia
Copy link
Contributor Author

HenryJia commented Jan 4, 2015

I've added the keyboard modifiers. However the shift (add) modifiers doesn't work because computefillRegion only computes it within the selected region.

@bjorn
Copy link
Member

bjorn commented Jan 4, 2015

I've added the keyboard modifiers. However the shift (add) modifiers doesn't work because computefillRegion only computes it within the selected region.

Alright, that will require some changes to computeFillRegion then. Essentially, it needs to be optional whether it takes the selection into account because it does still need to do that for the fill tool. I will try to push a change for this sometime soon.

@HenryJia
Copy link
Contributor Author

HenryJia commented Jan 7, 2015

I forgot to say, the magic wand tool will also need a new icon for it. Currently I've just got the icon set to the same one as bucket fill.

@bjorn
Copy link
Member

bjorn commented Jan 7, 2015

I forgot to say, the magic wand tool will also need a new icon for it. Currently I've just got the icon set to the same one as bucket fill.

Fortunately, the GIMP also has a magic wand tool so we can just use the same icon. Most of the other icons are also taken from the GIMP.

@HenryJia
Copy link
Contributor Author

HenryJia commented Jan 8, 2015

Hmm, I don't know where to get the GIMP icons.

@toddcarnes
Copy link
Contributor

You should be able to find the source at gimp.org
On Jan 8, 2015 1:50 PM, "HenryJia" notifications@github.com wrote:

Hmm, I don't know where to get the GIMP icons.


Reply to this email directly or view it on GitHub
#854 (comment).

@HenryJia
Copy link
Contributor Author

HenryJia commented Jan 9, 2015

I've added the magic wand icon.

What shortcut key should I use for this?

protected:
void tilePositionChanged(const QPoint &tilePos);

//void updateStatusInfo();
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this commented line.

@HenryJia
Copy link
Contributor Author

Done

@bjorn
Copy link
Member

bjorn commented Feb 21, 2015

Thanks for your work on this tool! I've squashed your commits and pushed it as 57c27c1. I've then fixed the computefillRegion problem in change 4a6322f.

@bjorn bjorn closed this Feb 21, 2015
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.

3 participants