Class ModelManager
java.lang.Object
net.mcreator.workspace.resources.ModelManager
Caches workspace model data that is expensive to load (e.g. texture mappings).
Code paths that modify model files in the workspace need to call
invalidateCache() or invalidateCache(File)
to ensure that the cache is updated on the next request.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTextureMappingsForModel(Model model) Returns texture mappings of the given model, loading them from the texture mappings file on the first request.voidInvalidates the model cache so model data is reloaded from the workspace on the next requestvoidinvalidateCache(File modelFile) Invalidates cached data of the given model so it is reloaded from the workspace on the next request
-
Constructor Details
-
ModelManager
-
-
Method Details
-
getTextureMappingsForModel
Returns texture mappings of the given model, loading them from the texture mappings file on the first request. The returned map is shared and must not be modified.- Parameters:
model- Model to get texture mappings for- Returns:
- Texture mappings keyed by mapping name or null if the model has no texture mappings
-
invalidateCache
Invalidates cached data of the given model so it is reloaded from the workspace on the next request- Parameters:
modelFile- Model file as returned byModel.getFile()
-
invalidateCache
public void invalidateCache()Invalidates the model cache so model data is reloaded from the workspace on the next request
-