RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
1.03k stars 178 forks source link

Failed to identify animation source #3033

Open CuriousMike56 opened 1 year ago

CuriousMike56 commented 1 year ago

In version 2022.12+ command-triggered add_animation lines are no longer parsed correctly, showing Failed to identify animation source in the log: https://forum.rigsofrods.org/resources/centerline-40t-rigid-neck-lowbed.720/ image

;Animations
129,131,133,0.0,0.0,0.0,180,0,-90,  Centerline40T-flag.mesh
add_animation  0.1, -18.0,0.0, source: event, mode: x-offset,   noflip,  autoanimate,  event: COMMANDS_15
add_animation -0.1, -18.0,0.0, source: event,  mode: x-offset,   noflip,  autoanimate,  event: COMMANDS_16
135,137,139,0.0,0.0,0.0,180,0,-90,  Centerline40T-flag.mesh
add_animation  0.1, -18.0,0.0, source: event, mode: x-offset,   noflip,  autoanimate,  event: COMMANDS_15
add_animation -0.1, -18.0,0.0, source: event,  mode: x-offset,   noflip,  autoanimate,  event: COMMANDS_16
130,132,134,0.0,0.0,0.0,180,0,-90,  Centerline40T-flag2.mesh
add_animation  0.1, -18.0,0.0, source: event, mode: x-offset,   noflip,  autoanimate,  event: COMMANDS_15
add_animation -0.1, -18.0,0.0, source: event,  mode: x-offset,   noflip,  autoanimate,  event: COMMANDS_16
136,138,140,0.0,0.0,0.0,180,0,-90,  Centerline40T-flag2.mesh
add_animation  0.1, -18.0,0.0, source: event, mode: x-offset,   noflip,  autoanimate,  event: COMMANDS_15
add_animation -0.1, -18.0,0.0, source: event,  mode: x-offset,   noflip,  autoanimate,  event: COMMANDS_16

The flags on this trailer are supposed to move to their correct locations when pressing CTRL+F3/F4 (2022.04):

https://user-images.githubusercontent.com/46073351/229202841-226b2da8-4d26-43a6-94cd-71d74fab1ad1.mp4

This issue primarily affects Negativeice's mods. Another example: https://forum.rigsofrods.org/resources/komatsu-d39ex.416/ Strangely enough, the joystick animations on the D39EX still function despite throwing the same error.

CuriousMike56 commented 1 year ago

It seems any "event" source is affected by this issue: https://forum.rigsofrods.org/resources/tatum-class-1-buggy.325/

1, 19, 46, 0.5, 0, 0, 0, 0, 0,      class1buggy-pulleys.mesh
add_animation   5,  0,  0,      source: tacho,  mode: z-rotation
add_animation   0.05, 0, 0,         source:event,   mode:y-offset, event:TRUCK_STARTER, eventlock
ohlidalp commented 1 year ago

I just took a quick look, it got broken here: https://github.com/RigsOfRods/rigs-of-rods/pull/2949 - specifically this commit https://github.com/RigsOfRods/rigs-of-rods/commit/e583df2cb35197fc7bdc9326908eb9a8aae3cf00.

There are actually 2 bugs there:

CuriousMike56 commented 10 months ago

Other trailers with the same problem as the Centerline: https://forum.rigsofrods.org/resources/trout-river-live-bottom.104/ https://forum.rigsofrods.org/resources/55-ton-fontaine-eagerbeaver-rgn.621/

image image

CuriousMike56 commented 8 months ago

Turns out the animations work as intended if a truck is attached and you activate the commands from the truck:

https://github.com/RigsOfRods/rigs-of-rods/assets/46073351/efcf5dab-7cca-4385-9ae2-f61c5ea50aa5

ohlidalp commented 5 months ago

Turns out the animations work as intended if a truck is attached and you activate the commands from the truck:

@CuriousMike56 I don't really understand how this is working; either way, is there anything I need to fix or can this be closed?

CuriousMike56 commented 5 months ago

@ohlidalp The problem is that the animations only work when a truck is attached, they should function regardless of connection. And there's also the misleading "Failed to identify animation source" error that spams the console.

ohlidalp commented 5 months ago

@CuriousMike56

The problem is that the animations only work when a truck is attached, they should function regardless of connection.

Ah, thanks for clarifying, I wasn't sure if that quirk is undesirable or mods use it. Very puzzling, tho.

And there's also the misleading "Failed to identify animation source" error that spams the console.

I was sure I fixed that one bit long ago... I guess not. Let me take a look. UPDATE: Sure enough, I can't reproduce it.

ohlidalp commented 5 months ago

Got it. The anims don't activate because they're event-triggered, and input events are only evaluated for trucks (with engine), not trailers.

The check is here: https://github.com/RigsOfRods/rigs-of-rods/blob/8d3914b8e0152f1a289c8822ffde16bbc8db8b92/source/main/main.cpp#L1144-L1147 - trailers have type NOT_DRIVEABLE, not TRUCK.

The whole enumeration is https://github.com/RigsOfRods/rigs-of-rods/blob/8d3914b8e0152f1a289c8822ffde16bbc8db8b92/source/main/physics/SimData.h#L99-L109 - there is no 'TRAILER' category.

The identification is done when generating modcache: https://github.com/RigsOfRods/rigs-of-rods/blob/8d3914b8e0152f1a289c8822ffde16bbc8db8b92/source/main/resources/CacheSystem.cpp#L903-L906

I could add a TRAILER actor type, the question is how should it be recognized. I could check for fileinfo category 117 (Trailers) and make sure it has at least 2 wheels (because i.e. Neg's RockPack also uses 117, probably by accident).