Skip to content

Commit

Permalink
🎮 Converted editor scripts to gadgets.
Browse files Browse the repository at this point in the history
This should make the mature tools (script editor, road editor) a lot more accessible and advertised via TopMenubar/Tools menu/[Browse gadgets...] button.
Most of the scripts are alpha prototypes (previously example_*.as scripts), but they're something to show anyway.

The 'gadget_description' directive was updated: it can now be used multiple times to create multiline description (not possible before because linebreaks in string are illegal).
  • Loading branch information
ohlidalp committed Mar 1, 2025
1 parent 02ca86b commit 3816c27
Show file tree
Hide file tree
Showing 27 changed files with 149 additions and 3 deletions.
Binary file added resources/gadgets/engine_tool-mini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
17 changes: 17 additions & 0 deletions resources/gadgets/engine_tool.gadget
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; This is a .gadget mod - basically a script wrapped as a modcache entry.
; The .gadget file must be present (even if empty) to get recognized.
; The script must have same base filename, i.e. 'foo.gadget' -> 'foo.as'
; Any extra include scripts or other resources can be bundled.
; -----------------------------------------------------------------------

; Name to display in Selector UI.
gadget_name "Engine Tool (alpha)"

; Authors (Syntax: <credit>, <forumID>, <name>, [<email>]) - multiple authors can be given.
gadget_author "base script" 351 ohlidalp

; Description to display in Selector UI.
gadget_description "In-game engine diag and adjustment."

; Category for Selector UI (300 = Generic gadgets, 301 = Actor gadgets, 302 = Terrain gadgets).
gadget_category 301
Binary file added resources/gadgets/odef_browser-mini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
17 changes: 17 additions & 0 deletions resources/gadgets/odef_browser.gadget
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; This is a .gadget mod - basically a script wrapped as a modcache entry.
; The .gadget file must be present (even if empty) to get recognized.
; The script must have same base filename, i.e. 'foo.gadget' -> 'foo.as'
; Any extra include scripts or other resources can be bundled.
; -----------------------------------------------------------------------

; Name to display in Selector UI.
gadget_name "ODEF browser (alpha)"

; Authors (Syntax: <credit>, <forumID>, <name>, [<email>]) - multiple authors can be given.
gadget_author "base script" 351 ohlidalp

; Description to display in Selector UI.
gadget_description "Lists .odef files from 'resources/meshes.zip' and sorts/displays/spawns/deletes them."

; Category for Selector UI (300 = Generic gadgets, 301 = Actor gadgets, 302 = Terrain gadgets).
gadget_category 302
Binary file added resources/gadgets/overlay_editor-mini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
17 changes: 17 additions & 0 deletions resources/gadgets/overlay_editor.gadget
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; This is a .gadget mod - basically a script wrapped as a modcache entry.
; The .gadget file must be present (even if empty) to get recognized.
; The script must have same base filename, i.e. 'foo.gadget' -> 'foo.as'
; Any extra include scripts or other resources can be bundled.
; -----------------------------------------------------------------------

; Name to display in Selector UI.
gadget_name "Overlay editor (alpha)"

; Authors (Syntax: <credit>, <forumID>, <name>, [<email>]) - multiple authors can be given.
gadget_author "base script" 351 ohlidalp

; Description to display in Selector UI.
gadget_description "Shows how OGRE overlays can be created dynamically."

; Category for Selector UI (300 = Generic gadgets, 301 = Actor gadgets, 302 = Terrain gadgets).
gadget_category 300
Binary file added resources/gadgets/rig_editor-mini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
17 changes: 17 additions & 0 deletions resources/gadgets/rig_editor.gadget
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; This is a .gadget mod - basically a script wrapped as a modcache entry.
; The .gadget file must be present (even if empty) to get recognized.
; The script must have same base filename, i.e. 'foo.gadget' -> 'foo.as'
; Any extra include scripts or other resources can be bundled.
; -----------------------------------------------------------------------

; Name to display in Selector UI.
gadget_name "Rig editor (alpha)"

; Authors (Syntax: <credit>, <forumID>, <name>, [<email>]) - multiple authors can be given.
gadget_author "base script" 351 ohlidalp

; Description to display in Selector UI.
gadget_description "In-game editing of rig definition (aka truck) files."

; Category for Selector UI (300 = Generic gadgets, 301 = Actor gadgets, 302 = Terrain gadgets).
gadget_category 301
Binary file added resources/gadgets/road_editor-mini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
18 changes: 18 additions & 0 deletions resources/gadgets/road_editor.gadget
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; This is a .gadget mod - basically a script wrapped as a modcache entry.
; The .gadget file must be present (even if empty) to get recognized.
; The script must have same base filename, i.e. 'foo.gadget' -> 'foo.as'
; Any extra include scripts or other resources can be bundled.
; -----------------------------------------------------------------------

; Name to display in Selector UI.
gadget_name "Road editor"

; Authors (Syntax: <credit>, <forumID>, <name>, [<email>]) - multiple authors can be given.
gadget_author "base script" 351 ohlidalp

; Description to display in Selector UI - use repeatedly for multiline description (note the Loader UI only displays top 3 lines).
gadget_description "Interactive editor of procedural roads."
gadget_description "You must enter editor mode (Ctrl+Y) to use it."

; Category for Selector UI (300 = Generic gadgets, 301 = Actor gadgets, 302 = Terrain gadgets).
gadget_category 302
Binary file added resources/gadgets/script_editor-mini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
17 changes: 17 additions & 0 deletions resources/gadgets/script_editor.gadget
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; This is a .gadget mod - basically a script wrapped as a modcache entry.
; The .gadget file must be present (even if empty) to get recognized.
; The script must have same base filename, i.e. 'foo.gadget' -> 'foo.as'
; Any extra include scripts or other resources can be bundled.
; -----------------------------------------------------------------------

; Name to display in Selector UI.
gadget_name "Script editor"

; Authors (Syntax: <credit>, <forumID>, <name>, [<email>]) - multiple authors can be given.
gadget_author "base script" 351 ohlidalp

; Description to display in Selector UI.
gadget_description "Handy text editor with error highlighting, code folding, examples, tutorial."

; Category for Selector UI (300 = Generic gadgets, 301 = Actor gadgets, 302 = Terrain gadgets).
gadget_category 300
Binary file added resources/gadgets/shock_tool-mini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
17 changes: 17 additions & 0 deletions resources/gadgets/shock_tool.gadget
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
; This is a .gadget mod - basically a script wrapped as a modcache entry.
; The .gadget file must be present (even if empty) to get recognized.
; The script must have same base filename, i.e. 'foo.gadget' -> 'foo.as'
; Any extra include scripts or other resources can be bundled.
; -----------------------------------------------------------------------

; Name to display in Selector UI.
gadget_name "Shock Tool (alpha)"

; Authors (Syntax: <credit>, <forumID>, <name>, [<email>]) - multiple authors can be given.
gadget_author "base script" 351 ohlidalp

; Description to display in Selector UI.
gadget_description "Shows spring/damp of shocks as adjustable graphs"

; Category for Selector UI (300 = Generic gadgets, 301 = Actor gadgets, 302 = Terrain gadgets).
gadget_category 301
Binary file added resources/gadgets/terrn_batcher-mini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
18 changes: 18 additions & 0 deletions resources/gadgets/terrn_batcher.gadget
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; This is a .gadget mod - basically a script wrapped as a modcache entry.
; The .gadget file must be present (even if empty) to get recognized.
; The script must have same base filename, i.e. 'foo.gadget' -> 'foo.as'
; Any extra include scripts or other resources can be bundled.
; -----------------------------------------------------------------------

; Name to display in Selector UI.
gadget_name "TerrnBatcher (alpha)"

; Authors (Syntax: <credit>, <forumID>, <name>, [<email>]) - multiple authors can be given.
gadget_author "base script" 351 ohlidalp

; Description to display in Selector UI - use repeatedly for multiline description (note the Loader UI only displays top 3 lines).
gadget_description "Tool to merge static meshes & materials for FPS boost."
gadget_description "PROTOTYPE: displays UI, implements selection but not the batching yet."

; Category for Selector UI (300 = Generic gadgets, 301 = Actor gadgets, 302 = Terrain gadgets).
gadget_category 302
1 change: 0 additions & 1 deletion resources/scripts/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ FOR DEVELOPERS: Visit https://developer.rigsofrods.org/ and click "Script-side A

Conventions:
* Scripts named 'example_*.as' are short introductory scripts that perform one thing, usually showing UI with tips and controls. You can run them using 'loadscript'.
* Scripts named '*_editor.as' are complete tools. You can run them using 'loadscript'.
* Scripts named '*_utils.as' are includes - running them via 'loadscript' does nothing, they are to be `#include`-d into other scripts.

Special scripts:
Expand Down
9 changes: 8 additions & 1 deletion source/main/resources/CacheSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,14 @@ void CacheSystem::FillGadgetDetailInfo(CacheEntryPtr& entry, Ogre::DataStreamPtr
}
else if (ctx->isTokKeyword() && ctx->getTokKeyword() == "gadget_description" && ctx->isTokString(1))
{
entry->description = ctx->getTokString(1);
if (entry->description == "")
{
entry->description = ctx->getTokString(1);
}
else
{
entry->description += "\n" + ctx->getTokString(1);
}
}
else if (ctx->isTokKeyword() && ctx->getTokKeyword() == "gadget_category" && ctx->isTokInt(1))
{
Expand Down
4 changes: 3 additions & 1 deletion source/main/resources/ContentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,10 @@ void ContentManager::InitModCache(CacheValidity validity)
ResourceGroupManager::getSingleton().addResourceLocation(PathCombine(App::sys_process_dir->getStr(), "content") , "FileSystem", RGN_CONTENT);
std::string objects = PathCombine("resources", "beamobjects.zip");
ResourceGroupManager::getSingleton().addResourceLocation(PathCombine(App::sys_process_dir->getStr(), objects) , "Zip" , RGN_CONTENT);
std::string dashboards = PathCombine("resources", "dashboards.zip"); // To find 'default.dashboard' mod
std::string dashboards = PathCombine("resources", "dashboards.zip");
ResourceGroupManager::getSingleton().addResourceLocation(PathCombine(App::sys_process_dir->getStr(), dashboards), "Zip", RGN_CONTENT);
std::string gadgets = PathCombine("resources", "gadgets.zip");
ResourceGroupManager::getSingleton().addResourceLocation(PathCombine(App::sys_process_dir->getStr(), gadgets), "Zip", RGN_CONTENT);

// Create RGN_TEMP in recursive mode to find all subdirectories.

Expand Down

0 comments on commit 3816c27

Please sign in to comment.