add command to rebuild mapmodel registry
While the mapmodel registry works fully automatically for all auto- downloaded models, it does not check for manual changes to the filesystem. To clear models from the list that have been deleted from the profile directory and to add models that have been downloaded outside the game, this new menu entry can be used. mapmodelregistryclear deletes all loaded mapmodel attributes loadallmapmodels checks the filesystem for mapmodels and loads them (all trees below packages/models/mapmodels, in home, zips, mods, install) Both together rebuild the whole mapmodel database. DOCREF mapmodelregistryclear
This commit is contained in:
@@ -15,6 +15,7 @@ menuitem "Map config operations..." [ showmenu [Map config operations] ]
|
||||
menuitem "Map checks and statistics..." [ showmenu [Map checks and statistics] ]
|
||||
menuitem "Bots..." [ showmenu [Creating bot waypoints] ]
|
||||
menuitem "Settings..." [ showmenu [Editing settings] ]
|
||||
menuitem "Misc..." [ showmenu [Editing misc] ]
|
||||
menuitem "Keys..." [ showmenu [Editing keys] ]
|
||||
menuitem "Deleted entities" [ showmenu "deleted entities" ]
|
||||
|
||||
@@ -692,13 +693,14 @@ menuitemcheckbox "Show mapmodel clippings: " "$showmodelclipping" [ showmodelcl
|
||||
menuitemcheckbox "Show ladder entities: " "$showladderentities" [ showladderentities $arg1 ]
|
||||
menuitemcheckbox "Show all playerstarts (spawn points): " "$showplayerstarts" [ showplayerstarts $arg1 ]
|
||||
menuitemslider "Fly speeds multiplier: " 1 5 "$flyspeed" 1 [] [ flyspeed $arg1 ]
|
||||
menuitem "" -1
|
||||
menuitem "Load batch map conversion tools" load_convmap
|
||||
menuitem "Load extra map editing scripts" load_mapeditscripts
|
||||
// opt/autosave.cfg may add some entries
|
||||
|
||||
newmenu [Editing keys]
|
||||
newmenu [Editing misc]
|
||||
menuitem "Load batch map conversion tools" load_convmap [] "\f4(checking and editing of entire map collections)"
|
||||
menuitem "Load extra map editing scripts" load_mapeditscripts [] "\f4(expert tools for hardcore map optimisations)"
|
||||
menuitem "Rebuild list of mapmodels" [ echo "\f1This will take a few seconds..." ; sleep 99 [ mapmodelregistryclear ; loadallmapmodels ; echo "\f1Done." ] ] [] "\f2Use this after manually adding or removing mapmodels\nfrom your profile directory. May throw some errors."
|
||||
|
||||
newmenu [Editing keys]
|
||||
menuitem "Select an action and press ENTER to bind a new key:" -1
|
||||
menuitem "" -1
|
||||
menuitem "\f2Mousewheel editing:" -1
|
||||
|
||||
@@ -349,8 +349,20 @@ void mapmodelregister_(char **args, int numargs) // read model attributes witho
|
||||
}
|
||||
COMMANDN(mapmodelregister, mapmodelregister_, "v");
|
||||
|
||||
void mapmodelregistryclear()
|
||||
{
|
||||
enumerate(mdlregistry, mapmodelattributes *, m,
|
||||
loopi(MMA_NUM) DELSTRING(m->n[i]);
|
||||
DELETEP(m);
|
||||
);
|
||||
mdlregistry.clear();
|
||||
mapmodelchanged = 1;
|
||||
}
|
||||
COMMAND(mapmodelregistryclear, "");
|
||||
|
||||
hashtable<const char *, model *> mdllookup;
|
||||
hashtable<const char *, char> mdlnotfound;
|
||||
bool silentmodelloaderror = false;
|
||||
|
||||
model *loadmodel(const char *name, int i, bool trydl) // load model by name (optional) or from mapmodels[i]
|
||||
{
|
||||
@@ -383,7 +395,7 @@ model *loadmodel(const char *name, int i, bool trydl) // load model by name
|
||||
if(trydl && !strncmp(name, mmpath, strlen(mmpath))) requirepackage(PCK_MAPMODEL, name);
|
||||
else
|
||||
{
|
||||
conoutf("\f3failed to load model %s", name);
|
||||
if(!silentmodelloaderror) conoutf("\f3failed to load model %s", name);
|
||||
mdlnotfound.access(newstring(name), 0); // do not search for this name again
|
||||
}
|
||||
}
|
||||
@@ -1096,11 +1108,13 @@ void loadallmapmodels() // try to find all mapmodels in packages/models/mapmode
|
||||
loopvrev(files) if(!strchr(files[i], '/')) delstring(files.remove(i)); // require minimum path depth of two
|
||||
files.sort(stringsort);
|
||||
loopvrev(files) if(files.inrange(i + 1) && !strcmp(files[i], files[i + 1])) delstring(files.remove(i + 1)); // remove doubles
|
||||
silentmodelloaderror = true;
|
||||
loopv(files)
|
||||
{
|
||||
const char *mn = files[i] + strlen("packages/models/");
|
||||
clientlogf("loadallmaps: %s %s", mn, loadmodel(mn) ? "loaded" : "failed to load");
|
||||
delstring(files[i]);
|
||||
}
|
||||
silentmodelloaderror = false;
|
||||
}
|
||||
COMMAND(loadallmapmodels, "");
|
||||
|
||||
Reference in New Issue
Block a user