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

Terrain editor now edits *.tobj files in place #3199

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from

Commits on Nov 11, 2024

  1. Configuration menu
    Copy the full SHA
    7e9e801 View commit details
    Browse the repository at this point in the history
  2. 👼script: scripts updated to use new includes & game API.

    changes made:
    * added `*_utils`  namespaces (new convention for includes)
    * unified style of scripts: using global variables and functions instead of classes.
    * scripts auto-formatted by script_editor.as
    ohlidalp committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    c8d3fac View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2024

  1. 👼Script: restored Entity::setMaterialName()

    This reverts a line from caf88e5 - I wanted to be purist and force users to do `engity.getSubEntities(0).setMaterial()` but since OGRE has this convenience method and the skeletal posing example already uses it, let's just roll with it.
    ohlidalp committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    0409ebb View commit details
    Browse the repository at this point in the history

Commits on Nov 25, 2024

  1. 👼Script: added game.getMousePointedMovableObjects()

    Returns `array<Ogre::MovableObjects@>` in no particular order; works using bounding boxes so large/generated meshes like roads get matched all the time.
    
    comes with example script.
    ohlidalp committed Nov 25, 2024
    Configuration menu
    Copy the full SHA
    d38c6d2 View commit details
    Browse the repository at this point in the history
  2. script_editor.as: Fixed oversized save/load menus

    drawSelectableFileList() now Creates a child window with dynamic height (but clamped to hardcoded max value).
    		const int MAX_CHILD_HEIGHT = 300;
    		const int CHILD_WIDTH = 600;
    ohlidalp committed Nov 25, 2024
    Configuration menu
    Copy the full SHA
    8562e81 View commit details
    Browse the repository at this point in the history
  3. 👼Script: added camera controls example

    Also fixed typos in `get/setCameraOrientation()` function bindings - parameter was declared as `vector3`, should have been `quaternion`.
    Also fixed weird binding of global `game` object, preventing use of AngelScript delegates. Fixed to bind as non-counting reference because that's the sensible choice.
    ohlidalp committed Nov 25, 2024
    Configuration menu
    Copy the full SHA
    afd3f44 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    65c1baa View commit details
    Browse the repository at this point in the history
  5. 📐 Fileformats: ^Document+^^Ptr everything.

    Consistency++; Until now some document objects were named `^Document` (RigDef, GenericDocument), some `^File` (Odef, TObj) and some `^Def` (skin).
    
    Principal changes are in file 'ForwardDeclarations.h' - all document types and smart pointer typedefs are now here. The rest is pretty much all find&replace.
    ohlidalp committed Nov 25, 2024
    Configuration menu
    Copy the full SHA
    33c4eaf View commit details
    Browse the repository at this point in the history
  6. 📐 ^DocumentPtr also terrn2

    Consistency++;
    ohlidalp committed Nov 25, 2024
    Configuration menu
    Copy the full SHA
    ac7a3d4 View commit details
    Browse the repository at this point in the history
  7. 📐 Generic document ^Ptr aligned with others

    Consistency++;
    ohlidalp committed Nov 25, 2024
    Configuration menu
    Copy the full SHA
    a6c7bfc View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2024

  1. ✨ Terrain editor: tobj export to original files.

    The 'logs/editor_out.log' file is history. The game now edits *.tobj files directly, but only if the terrain is unzipped in a directory (= a project). Exiting terrain editor at a zipped terrain will show a console warning "cannot export - not a project".
    
    Known issues:
    * preloaded actors rotations are off
    * procedural road bridge types are not preserved.
    * The "Terrain editor mode" doesn't inform about projects. TBD: add a button to import zipped terrain as project (internals already exist, only UI needs to be updated).
    ohlidalp committed Nov 28, 2024
    Configuration menu
    Copy the full SHA
    153d25d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    31691d5 View commit details
    Browse the repository at this point in the history
  3. 💡 New procedural road type: "auto"

    In this mode, the road will automatically switch between solid base and bridge depending on current height above ground.
    Internally, this mode already existed, but was only activated when importing legacy blocky-road into procedural road.
    
    This fixes the new TOBJ export from terrain editor.
    ohlidalp committed Nov 28, 2024
    Configuration menu
    Copy the full SHA
    207361d View commit details
    Browse the repository at this point in the history
  4. Deleted dead code.

    ohlidalp committed Nov 28, 2024
    Configuration menu
    Copy the full SHA
    a07b35a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    edd8b9f View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2c1dec1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    97c05ed View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    38036aa View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    db33718 View commit details
    Browse the repository at this point in the history
  10. 👼Script: race converter now works perfectly.

    When loaded with a terrain containing races, it detects them and generates race-def files for each of them, also modifying the .terrn2 file.
    These files can't be processed yet, but they contain all info normally present in the race definition scripts.
    Example from Auriga:
    ```
    ; ~~ New 'race-def' format (file extension: .race). ~~
    ; Each race file specifies a single race
    ; In .terrn2 file, list the race files under new section [Races]
    ; Filenames must include extension and end with = (like scripts do)
    ; Race system supports alternating paths!
    ; Checkpoint format: checkpointNum(1+), altpathNum(1+), x, y, z, rotX, rotY, rotZ, objName(override, optional)
    ; By convention, the checkpoint meshes are oriented sideways (facing X axis)
    
    race_name 1 kilometer drag
    race_laps 0.000000
    race_checkpoint_object 31-checkpoint
    race_start_object 31-checkpoint
    race_finish_object 31-checkpoint
    
    begin_checkpoints
    1.000000,1.000000,1010.000000,9.000000,505.000000,0.000000,90.000000,0.000000
    2.000000,1.000000,10.000000,9.000000,505.000000,0.000000,90.000000,0.000000
    end_checkpoints
    ```
    ohlidalp committed Nov 28, 2024
    Configuration menu
    Copy the full SHA
    c363365 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3be291a View commit details
    Browse the repository at this point in the history
  12. 👼Script: GenericDoc examples moved from 'demo' to 'uniEditor'

    Since adding INT/FLOAT and removing NUMBER token types from GenericDocument, all copypasted viewers/editors in scripts are broken.
    This is 1st step to creating an unified viewer/editor as include, but not yet there.
    ohlidalp committed Nov 28, 2024
    Configuration menu
    Copy the full SHA
    09bed9d View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    2f93324 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    806cce2 View commit details
    Browse the repository at this point in the history
  15. 👼Script: new #include "genericdoc_utils.as"

    Implements `GenericDocEditor` which doesn't edit yet but has highlight+selection and can be shared by scripts.
    Currently only 'example_terrn2_raceConverter.as' was updated to use it.
    ohlidalp committed Nov 28, 2024
    Configuration menu
    Copy the full SHA
    9b5d5d4 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    1cdbd12 View commit details
    Browse the repository at this point in the history
  17. 🎮 Terrn importer script integrated to game.

    * 'terrain_project_importer.as' - Launched automatically with terrain-editor mode with a read-only (ZIPped) terrain, provides info and import controls.
    * 'terrain_editor.as' - Launched automatically with terrain-editor mode with a terrain project, provides mouse+gizmo editing controls and hints.
    
    KNOWN ISSUE: main menu doesn't appear after unloading terrain from script...
    ohlidalp committed Nov 28, 2024
    Configuration menu
    Copy the full SHA
    1ecd5d5 View commit details
    Browse the repository at this point in the history
  18. Fixed endless-loop hazzard in script engine.

    How I could trigger it:
    1. enter simple test Terrain (zipped)
    2. load 'script_editor.as' script.
    3. enter terrain-editor mode --> game launches 'terrain_project_importer.as' --> boom.
    
    May be related: There are 2 messages "cannot run function with ID -1" that seem to appear when the terrain import script starts, I dont know where they come from.
    ohlidalp committed Nov 28, 2024
    Configuration menu
    Copy the full SHA
    ac56fc8 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    3281e2f View commit details
    Browse the repository at this point in the history