Page MenuHomeWildfire Games

Cinematic path node moving tool
ClosedPublic

Authored by vladislavbelov on Apr 22 2017, 3:21 AM.

Details

Reviewers
leper
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP19483: Cinematic path node moving tool for Atlas. Patch by Vladislav.
Trac Tickets
#3871
Summary
  1. Added the moving tool
  2. Possibility to add/delete selected nodes

Probably, the way of the tool render isn't clear.

Test Plan
  1. Run Atlas
  2. Create a path
  3. Add a node (select some and press Insert
  4. Delete a node (select some and press Delete

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 1245
Build 1963: Vulcan BuildJenkins

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Vulcan added a subscriber: Vulcan.Apr 22 2017, 5:25 AM

Build is green

Updating workspaces.
Build (release)...
In file included from ../../../source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp:20:0:
../../../source/tools/atlas/GameInterface/Handlers/MessageHandler.h:39:23: warning: unused parameter ‘msg’ [-Wunused-parameter]
  void f##t(prefix##t* msg)
                       ^
../../../source/tools/atlas/GameInterface/Handlers/MessageHandler.h:41:27: note: in expansion of macro ‘THINGHANDLER’
 #define MESSAGEHANDLER(t) THINGHANDLER(m, Message, t)
                           ^
../../../source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp:624:1: note: in expansion of macro ‘MESSAGEHANDLER’
 MESSAGEHANDLER(ClearPathNodePreview)
 ^
Build (debug)...
In file included from ../../../source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp:20:0:
../../../source/tools/atlas/GameInterface/Handlers/MessageHandler.h:39:23: warning: unused parameter ‘msg’ [-Wunused-parameter]
  void f##t(prefix##t* msg)
                       ^
../../../source/tools/atlas/GameInterface/Handlers/MessageHandler.h:41:27: note: in expansion of macro ‘THINGHANDLER’
 #define MESSAGEHANDLER(t) THINGHANDLER(m, Message, t)
                           ^
../../../source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp:624:1: note: in expansion of macro ‘MESSAGEHANDLER’
 MESSAGEHANDLER(ClearPathNodePreview)
 ^
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/851/ for more details.

Build is green

Updating workspaces.
Build (release)...
In file included from ../../../source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp:20:0:
../../../source/tools/atlas/GameInterface/Handlers/MessageHandler.h:39:23: warning: unused parameter ‘msg’ [-Wunused-parameter]
  void f##t(prefix##t* msg)
                       ^
../../../source/tools/atlas/GameInterface/Handlers/MessageHandler.h:41:27: note: in expansion of macro ‘THINGHANDLER’
 #define MESSAGEHANDLER(t) THINGHANDLER(m, Message, t)
                           ^
../../../source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp:624:1: note: in expansion of macro ‘MESSAGEHANDLER’
 MESSAGEHANDLER(ClearPathNodePreview)
 ^
Build (debug)...
In file included from ../../../source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp:20:0:
../../../source/tools/atlas/GameInterface/Handlers/MessageHandler.h:39:23: warning: unused parameter ‘msg’ [-Wunused-parameter]
  void f##t(prefix##t* msg)
                       ^
../../../source/tools/atlas/GameInterface/Handlers/MessageHandler.h:41:27: note: in expansion of macro ‘THINGHANDLER’
 #define MESSAGEHANDLER(t) THINGHANDLER(m, Message, t)
                           ^
../../../source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp:624:1: note: in expansion of macro ‘MESSAGEHANDLER’
 MESSAGEHANDLER(ClearPathNodePreview)
 ^
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/852/ for more details.

vladislavbelov edited edge metadata.

Fixed elexis's notes, and added more visible path nodes.

leper added inline comments.
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
509

And since paths is only used once you could just inline it.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/863/ for more details.

source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
509

Won't be the line too big?

leper added inline comments.Apr 23 2017, 12:19 AM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
509

It is 4 characters longer than the line with the assignment, and kills that line, so no it wouldn't be.

537

This loop is nearly identical to the one above, this slightly makes me wonder if we couldn't unify that (but I guess that would need a template solution, or a macro) and it isn't that bad, but still.

Renamed DrawTools, removed duplicated code.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/878/ for more details.

leper added inline comments.Apr 23 2017, 4:41 PM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
287

Could be static.

Don't we pass Vector2/3D as const refs elsewhere?

383

This whole thing above is used in most of these handlers, can we unify this?

537

Ah, so CCinemaPath is convertible to TNSpline? Seems even nicer :-)

vladislavbelov added inline comments.Apr 23 2017, 4:52 PM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
287

True.

383

Something like:

isNodeValid(node)

?

leper added inline comments.Apr 23 2017, 5:00 PM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
383

That would be an option, but I was talking about the whole function up to this point (or maybe even including the next one, but then we aren't talking about validation only.

Could very well be not that nice to actually implement or yield great results, but this sanity checking code does seem duplicated.

vladislavbelov added inline comments.Apr 23 2017, 6:01 PM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
383

But an intersection of these checks has only node and cmpCinemaManager checks.

Unify a node validation.

@leper I heard you are interested in C++ code and you've already read through the patch, do you want to complete the review?

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/884/ for more details.

leper edited reviewers, added: leper; removed: elexis.Apr 24 2017, 2:04 AM
In D369#15428, @elexis wrote:

@leper I heard you are interested in C++ code and you've already read through the patch, do you want to complete the review?

People telling stories again, huh? Someone told me you'd like to give D213 a go in return :P

elexis added inline comments.Apr 24 2017, 2:09 AM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
587

ENSURE(msg); would be a nicer way to mute the unused warning

leper edited edge metadata.Apr 25 2017, 9:30 PM

Some more comments (some already mentioned before).

Tool works, though it takes some getting used to and could get some improvements. We can do those after getting initial support merged though.

Some general comments (these are for later, as opposed to the inline comments):

  • Adding new nodes that are below ground level is a bit confusing (took me some time to figure out that they were below ground, might be a good idea using a different colour in that case).
  • I would have expected to be able to move the node the x/z plane by default without having to adjust each of them individually. I guess switching between x/z and y (up/down) movement as opposed to all three individually would make this much more user friendly.
  • I guess this doesn't really consider target nodes yet (I managed to mess up those slightly, but adding more might be a bit tricky)
  • Being able to preview paths right within atlas would be great!
  • There is some issue (most likely completely unrelated to the cinematics work) where the visibility isn't reset after ending playing the simulation in atlas.

Nice work so far!

source/graphics/CinemaManager.cpp
117

Yes, having both 1.0f and 0.f on the same line is inconsistent, I'd have gone with 1.f and 0.f though, see also the line above.

122–123

Same 1.f comment as above.

source/tools/atlas/AtlasUI/ScenarioEditor/Tools/TransformPath.cpp
27

\n before the wx includes.

source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
42

Could be 5.f.

287

const refs, static.

306

static, reference.

534

It's not an iterator, so naming it it is just lying, name it p.

548

static, const refs.

562

This line could be moved somewhere closer to where it is used (and thus after the early return).

582

It might be nice to allow moving in x/y (or x/z in our engine) direction at the same time, only needing some switching for up/down.

587

Or UNUSED2(msg).

Because if we'd ENSURE(msg) here, we should do the same thing in all oher handlers in here.

source/tools/atlas/GameInterface/SharedTypes.h
118

Unrelated to the diff at hand, but why is there commented out code here?

126

All of these members should be Shareable<T>.

source/tools/atlas/GameInterface/View.cpp
233

Shouldn't this one have an #if CONFIG_GLES block too?

leper requested changes to this revision.Apr 25 2017, 9:31 PM
This revision now requires changes to proceed.Apr 25 2017, 9:31 PM
In D369#15616, @leper wrote:
  • Adding new nodes that are below ground level is a bit confusing (took me some time to figure out that they were below ground, might be a good idea using a different colour in that case).

I used shifted value + 1.0f, but elexis said to don't increase it, so I made it visible even it's on ground, also it has lines between a spline and ground.

  • I would have expected to be able to move the node the x/z plane by default without having to adjust each of them individually. I guess switching between x/z and y (up/down) movement as opposed to all three individually would make this much more user friendly.

I've planned this feature.

  • I guess this doesn't really consider target nodes yet (I managed to mess up those slightly, but adding more might be a bit tricky)

What do you mean? You could control target nodes as usual position nodes.

  • Being able to preview paths right within atlas would be great!

Yeah, I have already it in some drafts.

  • There is some issue (most likely completely unrelated to the cinematics work) where the visibility isn't reset after ending playing the simulation in atlas.

Yep, I've noticed it too, it looks like more atlas issues, but need to look at it deeper.

vladislavbelov added inline comments.Apr 26 2017, 1:02 AM
source/tools/atlas/GameInterface/SharedTypes.h
118

There are many codes which don't work correctly or don't work at all. It was even before I've added paths.

126

Why it should be shareable? sCinemaPathNode already is. Also we don't write anything in these members.

In D369#15616, @leper wrote:
  • Adding new nodes that are below ground level is a bit confusing (took me some time to figure out that they were below ground, might be a good idea using a different colour in that case).

I used shifted value + 1.0f, but elexis said to don't increase it, so I made it visible even it's on ground, also it has lines between a spline and ground.

Yes, not moving it a lot, but at least using a different colour for the lines below ground would be nice, otherwise someone new to this might get confused. But as said not exactly an urgent issue, but fixing this at some point in the future would be nice.

  • I guess this doesn't really consider target nodes yet (I managed to mess up those slightly, but adding more might be a bit tricky)

What do you mean? You could control target nodes as usual position nodes.

Ah, I did play with those right at the start and might just have messed things up due to only figuring out the controls a bit later

  • There is some issue (most likely completely unrelated to the cinematics work) where the visibility isn't reset after ending playing the simulation in atlas.

Yep, I've noticed it too, it looks like more atlas issues, but need to look at it deeper.

Care to create a ticket?

In D369#15645, @leper wrote:

Yes, not moving it a lot, but at least using a different colour for the lines below ground would be nice, otherwise someone new to this might get confused. But as said not exactly an urgent issue, but fixing this at some point in the future would be nice.

Ok.

Care to create a ticket?

Yes, it's needed, I think, for an easier debugging.

leper added inline comments.Apr 26 2017, 1:12 AM
source/tools/atlas/GameInterface/SharedTypes.h
126

Because the members of something shareable need to be shareable, otherwise calling it that is a blatant lie. If we don't write anything there that still doesn't prevent mismatching implementations from accessing chunks of memory that they shouldn't access.

vladislavbelov added inline comments.Apr 26 2017, 1:16 AM
source/tools/atlas/GameInterface/SharedTypes.h
126

Ok, no problem. If we're talking about really random chunks of memory we always could break it even with Shareable.

vladislavbelov edited edge metadata.
vladislavbelov marked 12 inline comments as done.

Fixed @leper notes.

source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
582

I've planned it, so I used 1, 2, 4, not 1, 2, 3, because then I'll use it as mask.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/892/ for more details.

leper requested changes to this revision.Apr 26 2017, 7:03 PM
leper added inline comments.
source/tools/atlas/AtlasUI/ScenarioEditor/Tools/TransformPath.cpp
31

Could sort these alphabetically.

source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
336

Actually since we are duplicating at least path, cmpCinemaManager, and name in all these cases I guess going with a define could be cleaner...

Sorry for this back-and-forth, but sometimes you have to see the code first.

495

static

523

Should this be AtlasMessage::sCinemaPathNode node()? Else there isn't any initialization done and assigning that might not result in the expected thing.

582

I did suspect something like that, maybe using defines or enums once that happens could help with readability.

This revision now requires changes to proceed.Apr 26 2017, 7:03 PM
vladislavbelov added inline comments.Apr 26 2017, 7:20 PM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
336

Do want to hide the cmpCinemaManager check?

523

Why? It's classic C++ c-tor, but a compiler reads the 'type name(); string as the function declaration, so AtlasMessage::sCinemaPathNode node()` will get a compilation error.

leper added inline comments.Apr 26 2017, 8:08 PM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
336

I'd rather not duplicate all those variable assignments and the cmpCinemaManager check when we could have those only once.

523

Gah, right, dunno what kind of stupid struck me there, sorry for the noise.

vladislavbelov added inline comments.Apr 26 2017, 8:20 PM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
336

Do you suggest to do assignments before the check and pass these variables to the check?

523

That's all right.

leper added inline comments.Apr 26 2017, 8:23 PM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
336

I'd have put the whole thing into a macro and called it good enough.

You can't assign all things because in some cases you'd need to do the checks before that, and using out parameters seems ugly for just a few checks.

vladislavbelov added inline comments.Apr 26 2017, 8:24 PM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
336

Ah, macro, ok, I'll try.

vladislavbelov edited edge metadata.

Added a macro, axis enum.

vladislavbelov marked 2 inline comments as done.Apr 28 2017, 11:18 AM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/900/ for more details.

leper accepted this revision.May 1 2017, 1:44 AM

Code looks, thanks for the patch.

source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
413

I guess the actual values here don't really matter, do they?

This revision is now accepted and ready to land.May 1 2017, 1:44 AM
This revision was automatically updated to reflect the committed changes.
vladislavbelov added inline comments.May 1 2017, 1:47 AM
source/tools/atlas/GameInterface/Handlers/CinemaHandler.cpp
413

Yes, it's normalized, it'll matter when I'll add multi-axis moving.