Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Project directories #2677

Closed
wants to merge 34 commits into from

Conversation

ohlidalp
Copy link
Member

@ohlidalp ohlidalp commented Feb 9, 2021

Until now, RoR wasn't very friendly to editing truck files. You had to manually unzip the mod, and even then, only the modified truck file would load, not added/edited resources.

This PR adds a new menu in top menubar: 'Projects'. From there, you can import existing mods for editing by one click. Projects are created in "MyDocuments\MyGames\RigsOfRods\projects" as subdirectories, each containing project JSON and truckfiles. Unlike regular mods, all resources within a project are always fully reloaded from disk, allowing modder to add/remove/change meshes/textures/other resources on the go.
image

FEATURES:

TBD LATER: Make Ulteq's N/B tool (#2298) modify the project.

  • I need to understand the feature better.

@tritonas00
Copy link
Collaborator

(possibly using https://github.com/SpartanJ/efsw)

no more dependencies please 😆

@ohlidalp ohlidalp force-pushed the project-directories-2021 branch 2 times, most recently from a82a8dc to 8ea184c Compare February 21, 2021 06:39
@ohlidalp ohlidalp force-pushed the project-directories-2021 branch from 3c9be45 to aa21aa1 Compare February 27, 2021 00:55
ohlidalp added 23 commits March 7, 2021 19:27
Added directory ROR_HOME/projects. Each subdir contains 'project.json', resources (meshes, materials, textures) and one or more truckfiles.
The ingame top menubar contains 'Projects' menu to spawn modified truckfiles and to import existing ones.
presets: `set_beam/node_defaults` and `set_default_minimass`
Status: import/export for nodes and beams

Added option to accept all ; as ;grp:
Parser: added *_set flags for all optional args
Spawner: respect *_set flags for all optional args
Serializer: don't write out un*_set flags
This fixes linux build by removing msvc-specific forward-declaration of enum, see EditorGroup
With this I abandon the 'RigDef' terminology.
This unifies fragmented code from CacheSystem.h/cpp, ContentManager.h/cpp and ActorEditor.h/cpp

Added message category 'PROJECT' to console (wrench icon).
Code changes:
* PlatformUtils: factored out CopyResourceFile() from CacheSystem
* CacheSystem.h: project contants moved to ProjectManager.h
Keep it simple!
* removed struct ProjectTruck, just truck file names suffice.
* removed project JSON, no practical use

ActorManager::FetchActorDef() now properly reloads project resources on spawn.
Null pointer `m_active_project->prj_trucks` in ImportTruckToProject()
... because 'file' sounds like an open file on disk which it isn't. Inspired by rapidjson::Document.

also:
Truck::File::Module became Truck::Module, added typedef ModulePtr.
Truck::File::EditorGroup became Truck::EditorGroup.
ActorManager: FetchActorDef became FetchTruckDocument, LoadActorDef became LoadTruckDocument.
also unified delimiters to ',' - no effect on functionality
all node-index variables now use NodeIdx_t and check against node_t::INVALID_IDX

Additional change: exhaust_t, flare_t, cparticle_t moved from SimData.h to GfxData.h and renamed to Exhaust/Flare/CParticle
ohlidalp and others added 11 commits March 7, 2021 19:27
Added CVar 'edi_file_watch_respawn'.
Renamed 'diag_import_grp_loose' to 'edi_import_grp_loose'.
`struct Project` moved to file "Project.h", instances are now managed by std::shared_ptr.
GameContext::ModifyActor() - fixed access to invalidated pointer
GameContext::DeleteActor() - prune msg queue to remove dangling actor pointers.
ProjectManager::ProjectManager::handleFileAction() - don't try to check a directory that was deleted.
ProjectManager::HandleFileSystemEvent() - respect cvar 'edi_file_watch_respawn' again, fixed NULL actor pointer in all RELOAD requests
@ohlidalp
Copy link
Member Author

ohlidalp commented Mar 13, 2021

Closing in favor of #2709 - this branch became messy and heavyweight.

I'll keep the branch and create separate PR for the parser fixes.

If there's interest, I'll reintroduce the file monitoring and projects menu features in different PRs.

@ohlidalp ohlidalp closed this Mar 13, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants