Create Model Graph without A12 Server

Currently we are using HttpModelLoader as part of our application setup and within the integration of 2023.06-ext5 I tried to swap it for the NewHttpModelLoader. Usage of the new ModelLoader API requires initialization of the Model Graph during application startup. The only example in the documentation of how to load it describes a use case of loading it from the A12 Server Redirecting…
However, in our project we are not using the A12 Server, but use our custom server, that statically provides the models as part of its resource server. How can I create a Model Graph without the A12 Server? Or maybe there is a way of bypassing the requirement of having a Model Graph when using the new API? We have very few A12 models and it would not cause any issues for us if we were to load them sequentially.

Hi,

I think both options are possible here:

  1. Providing the modelgraph yourself

Since your models are statically available, you could write a script that collects all these models on startup once and looks at their headers to construct the graph with it.

During construction, you would need to make sure that you put each model in the “correct” property of the graph (document models belong to the documentModels prop, all UI models belong to genericModels prop and so on…).

Then you can just store the resulting graph next to where your models are and load it as a json file from your server as well.

  1. Provide your own ModelLoader implementation

The requirement of Client for a ModelGraph comes from the fact that when attempting to load the required models for a scene, Client might need to load more models than specified in your appmodel (e.g. in the simplest case, your scene specifies a form model, so Client need to load it and the corresponding document model for it).

If there is no graph, Client would only try to load the form model on its own and then fail to process it (because the document model for it would be missing).

This means that in case sequential loading is not “problematic” for your use case, you can write your own ModelLoader implementation that basically restores the old sequential behavior:

  • load all models that are given
  • after loaded, check for each model if it contains references in the model header
  • if there are some, load them as well (creating the waterfall cascade of requests :slight_smile:)
  • if finally everything is loaded, post-process the models as needed

This approach is also documented here GetA12 Login