Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@SteelFill
Copy link
Contributor

@SteelFill SteelFill commented Jul 5, 2025

Split from #1072

Discussion thread
Related Trello card

This PR adds the "ShapeHierarchy" feature currently only present in lights #917 to particle emitters, freight animations, sounds, camera views, and interior views. This allows said addons to be attached to parts of a 3D model other than the MAIN body, so a freight animation attached to a bogie (using ShapeHierarchy( BOGIE1 )) will move as the bogie moves. This can be used on any sub object, even silly things like attaching a particle emitter to a wheel (in which case, the particles will spin around wildly). If the given matrix name doesn't exist in the model, a warning will be added to the log and the addon will attach to the MAIN sub object (use any sort of shape viewer to see the names of sub objects).

  • To attach these addons to different sub-objects use ORTSShapeHierarchy ( MATRIXNAME ) in a Light ( block (existing feature), Stream ( block (in an .sms file), ORTS3DCab ( ORTSAlternate3DCabViewPoint ( Inside ( ORTSAlternatePassengerViewPoint ( blocks for 3D interiors, FreightAnimStatic ( FreightAnimContinuous ( blocks for ORTS freight animations (MSTS freight animations are not supported), HeadOut ( block for head out views (note that ORTS specific parameter in the HeadOut ( block must come AFTER the x y z position numbers!), in any particle FX subblock (again, the ORTS specific parameters must be placed AFTER the position, direction, and radius numbers!), and in the Tr_CabViewFile ( header of a .cvf file (for a .cvf file, ORTSShapeHierarchy must be included once for each view point, which also means each viewpoint can have a different attachment).
  • A lot of addons were also missing the ability to reposition the location of the addon relative to the sub object to which it is attached. For a Stream ( in the .sms file, use ORTSPosition ( x y z ) to define the position of the stream's sound emitter, ORTS3DCab ( ORTSAlternate3DCabViewPoint ( Inside ( ORTSAlternatePassengerViewPoint ( blocks all now accept an ORTSShapeOffset ( x y z ) input to allow shifting the position of the interior shape file (note that this will NOT shift the view point, make sure to update the view point location if shape offset is used), FreightAnimContinuous ( blocks now accept the Offset ( x y z ) and Flip () parameters, which function the same as the counterparts in a static freight animation

Also includes some refactoring needed for this to work as intended. Rolling stock animations are now processed before updating attached object positions to ensure nothing gets one frame out of sync. Each poseable shape now keeps track of its resultant matrices each frame so that doesn't need to be calculated separately by each system that needs a resultant matrix (if you need the position of a sub-object, please use PoseableShape.ResultMatrices[MAT_IDX] from here on out). Audio management reorganized slightly in a way that seems simpler and avoids some multithread nonsense.

@SteelFill SteelFill added the enhancement New feature or request label Jul 5, 2025
@SteelFill SteelFill added the for-unstable Special label to include a pull request in the Unstable Version label Jul 6, 2025
@SteelFill SteelFill removed the for-unstable Special label to include a pull request in the Unstable Version label Jul 7, 2025
twpol pushed a commit that referenced this pull request Jul 14, 2025
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc)
- Pull request #1091 at 7fc8de1: Automatic speed control
- Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception
- Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached
- Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing
- Pull request #1121 at 91d2d26: Manually Override Articulation
- Pull request #1126 at 3bb081e: ShapeHierarchy Attachment for More Wagon Addons
- Pull request #1130 at 251a677: Fix F9 points to an incorrect car ID.
- Pull request #1132 at 934d29e: Fixes For Correct Questionable Braking Parameters
- Pull request #1133 at 8dc00d5: Minor Fix for Brake Pipe Charging
- Pull request #1136 at 6f1b82f: Fix Curve Resistance Calculation
- Pull request #1082 at 5845a1a: Allow variable water level in glass gauge
- Pull request #1081 at 689494b: Brake cuts power unification
- Pull request #1124 at fab5457: Built-in PBL2 brake controller
twpol pushed a commit that referenced this pull request Jul 14, 2025
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc)
- Pull request #1091 at 7fc8de1: Automatic speed control
- Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception
- Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached
- Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing
- Pull request #1121 at 91d2d26: Manually Override Articulation
- Pull request #1126 at 3bb081e: ShapeHierarchy Attachment for More Wagon Addons
- Pull request #1130 at 251a677: Fix F9 points to an incorrect car ID.
- Pull request #1132 at 934d29e: Fixes For Correct Questionable Braking Parameters
- Pull request #1133 at 8dc00d5: Minor Fix for Brake Pipe Charging
- Pull request #1136 at 6f1b82f: Fix Curve Resistance Calculation
- Pull request #1137 at c2c9e2a: Apply brakes at startup on minimal reduction
- Pull request #1082 at 5845a1a: Allow variable water level in glass gauge
- Pull request #1081 at 689494b: Brake cuts power unification
- Pull request #1124 at fab5457: Built-in PBL2 brake controller
twpol pushed a commit that referenced this pull request Jul 15, 2025
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc)
- Pull request #1091 at aa72c13: Automatic speed control
- Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception
- Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached
- Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing
- Pull request #1121 at 91d2d26: Manually Override Articulation
- Pull request #1126 at 3bb081e: ShapeHierarchy Attachment for More Wagon Addons
- Pull request #1130 at 251a677: Fix F9 points to an incorrect car ID.
- Pull request #1132 at 934d29e: Fixes For Correct Questionable Braking Parameters
- Pull request #1133 at 8dc00d5: Minor Fix for Brake Pipe Charging
- Pull request #1136 at 6f1b82f: Fix Curve Resistance Calculation
- Pull request #1137 at c2c9e2a: Apply brakes at startup on minimal reduction
- Pull request #1082 at 5845a1a: Allow variable water level in glass gauge
- Pull request #1081 at 689494b: Brake cuts power unification
- Pull request #1124 at fab5457: Built-in PBL2 brake controller
twpol pushed a commit that referenced this pull request Jul 15, 2025
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc)
- Pull request #1091 at aa72c13: Automatic speed control
- Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception
- Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached
- Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing
- Pull request #1121 at 91d2d26: Manually Override Articulation
- Pull request #1126 at 3bb081e: ShapeHierarchy Attachment for More Wagon Addons
- Pull request #1130 at 251a677: Fix F9 points to an incorrect car ID.
- Pull request #1132 at 934d29e: Fixes For Correct Questionable Braking Parameters
- Pull request #1133 at 8dc00d5: Minor Fix for Brake Pipe Charging
- Pull request #1136 at 6f1b82f: Fix Curve Resistance Calculation
- Pull request #1137 at c2c9e2a: Apply brakes at startup on minimal reduction
- Pull request #1138 at 6397400: Calculate wheel speed in simple adhesion
- Pull request #1082 at 5845a1a: Allow variable water level in glass gauge
- Pull request #1081 at 689494b: Brake cuts power unification
- Pull request #1124 at fab5457: Built-in PBL2 brake controller
twpol pushed a commit that referenced this pull request Sep 19, 2025
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1086 at d8d61eb: Add Settings Exporter tool (copy settings to INI, etc)
- Pull request #1091 at e813c42: Automatic speed control
- Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached
- Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing
- Pull request #1121 at 91d2d26: Manually Override Articulation
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1126 at 95e884f: ShapeHierarchy Attachment for More Wagon Addons
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler
- Pull request #1082 at 5845a1a: Allow variable water level in glass gauge
twpol pushed a commit that referenced this pull request Sep 21, 2025
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1086 at d8d61eb: Add Settings Exporter tool (copy settings to INI, etc)
- Pull request #1091 at e813c42: Automatic speed control
- Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached
- Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing
- Pull request #1121 at 91d2d26: Manually Override Articulation
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1126 at 95e884f: ShapeHierarchy Attachment for More Wagon Addons
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler
- Pull request #1161 at 6cfe4e2: Fix string trim in .ini files
- Pull request #1082 at 5845a1a: Allow variable water level in glass gauge
@SteelFill SteelFill added the not-for-unstable Special label to exclude a pull request from the Unstable Version label Sep 22, 2025
@SteelFill
Copy link
Contributor Author

SteelFill commented Sep 22, 2025

Removing from unstable so #1160 can be added to unstable builds.

This is still ready for review and I have no additional features planned. It would be helpful to free up the changes here to give room for everything else to change these associated files.

Edit: #1160 is merged and conflicts resolved, this PR is open for testing once more.

@SteelFill SteelFill removed the not-for-unstable Special label to exclude a pull request from the Unstable Version label Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

1 participant