how to create a progressbar?


my game needs a while until all the models are loaded. does anybody know how to make a progress bar?

Yes, the manual does:

I’m not sure. According to the manual, you can call prepareScene() on a node and that node (and all children) will perform all of the necessary options needed to make it ready for render. (Such as load textures, creating buffers and shaders, etc.)

I would image you would initially load everything as normal, but stash/hide all children nodes (not clear on difference) so they aren’t actively rendered. Then, for each child of your scene graph, call prepareScene(). As you do so, update your loading bar.

but how can i query how much of my scene is being loaded? i need this to set the width of the progressbar… is there a function that is called by panda when a scene finished loading?

Loading the scene means calling loader.loadModel() repeatedly. Since you’re the one who’s making these calls, you’re the one who knows how far through you’ve come so far, and you’re the one who knows when you’re done.

I suggest you create your progress bar before you start to load all your models, and remove it after you’re done. In between calls to loader.loadModel() you can set the progress according to how many more calls you still have to make. You will also need to call base.graphicsEngine.renderFrame() to ensure the progress value you just set has a chance to be rendered immediately.