Proposal - Physics Custom Mask Editor Changes

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Mon Jan 04, 2010 12:40 am

Just to be clear, this isn't a feature request, rather it's a proposal to merge some changes I've made to the physics behavior's custom collision mask editor with the version on the SVN. These changes are all usability related, simplifying the mask creation process with some nifty new features.

All of the changes take place in two files, Edittime.cpp and Main.h. Here's a download link to the altered files and a compiled version of the plugin:

Physics Changes

[CHANGE] - The first and last vertices are marked; the first vertex has a red minus symbol inside while the last vertex has a blue plus symbol inside. This is so users will know better where the next point will be placed.

[ADDITION] - Vertex dragging. If a user left clicks and holds the mouse over a vertex, the vertex can be dragged around. All newly placed vertices are also placed in drag mode. Holding the control key will disable this, allowing the user to place vertices on top of one another and place many points quickly without worrying about dragging them.

[ADDITION] - Rick clicking on any vertex will delete it, instead of having to delete all the vertices after it sequentially just to delete it.

[ADDITION] - Holding down the shift key will display lines running from the first and last vertices to the mouse, showing where new collision lines will run if a point is placed.

Variable and function additions in the code include:

POINTF* dragPoint in the EditExt class in Main.h - This is a pointer to the vertex currently being dragged.

bool setWindowFocus in the EditExt class in Main.h - This is set to true when first starting the mask editor. If the value equals true, the focus is set on the frame editor and the value is set to false.

bool MouseOverPoint(bool deletePoint) function in EditTime.cpp - This is used to detect if the mouse is hovering over a vertex and for deleting any such vertices if specified as true through deletePoint. Also, if a vertex is being hovered over, dragPoint will be pointed to it.

Most of the feature additions are contained in EditExt::OnMessage() and MouseOverPoint(). These are where point dragging and point deletion are handled. The shift key preview is contained in EditExt::Draw().

So, there it is for your consideration. I've tested everything and it all seems to work properly, but since I don't entirely know how parts of the plugin work, some of it may not be properly handled -- mostly these concerns lie in the point deletion aspect of MouseOverPoint().

Cheers. :)
Moderator
B
99
S
37
G
19
Posts: 1,584
Reputation: 17,842

Post » Mon Jan 04, 2010 11:33 am

This sounds awesome. You've got some good changes there, I hope they can make it into a build :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Jan 04, 2010 11:47 am

indeed it does sound awesome.
are the additions and changes clear enough
that id be able to update future versions of the physics plugin with your code if the devs decide not to include this?
Spriter Dev
B
88
S
21
G
12
Posts: 3,240
Reputation: 16,486

Post » Mon Jan 04, 2010 1:55 pm

Lucid, go ahead, it'd save us some time!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,620

Post » Mon Jan 04, 2010 3:22 pm

Thanks for the code changes, I added it into physics and made a few changes so the dragging doesn't happen at the centre of the point but accounts for the mouse offset etc. Oh and i made it that clicking a point makes it so any more points you add afterwards are from that point on etc. Oh and I made it whiten the layout editor a little so if your adding points around a dark object they dont get lost.
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Mon Jan 04, 2010 9:18 pm

Sweet, thanks, David! :) I'm glad I've reached a point where I can actually contribute -- even if they're little things -- to this project rather than just requesting stuff. :P

The changes you made were all things I never got around to, so it's nice to see you put them in there.
Moderator
B
99
S
37
G
19
Posts: 1,584
Reputation: 17,842


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 1 guest