mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
asynchronous load priorities
This commit is contained in:
parent
7dc6ea0356
commit
d4538bcfeb
@ -58,7 +58,7 @@ class Loader(DirectObject):
|
|||||||
# model loading funcs
|
# model loading funcs
|
||||||
def loadModel(self, modelPath, loaderOptions = None, noCache = None,
|
def loadModel(self, modelPath, loaderOptions = None, noCache = None,
|
||||||
allowInstance = False, okMissing = None,
|
allowInstance = False, okMissing = None,
|
||||||
callback = None, extraArgs = []):
|
callback = None, extraArgs = [], priority = None):
|
||||||
"""
|
"""
|
||||||
Attempts to load a model or models from one or more relative
|
Attempts to load a model or models from one or more relative
|
||||||
pathnames. If the input modelPath is a string (a single model
|
pathnames. If the input modelPath is a string (a single model
|
||||||
@ -101,7 +101,10 @@ class Loader(DirectObject):
|
|||||||
loading, the callback function will be invoked with the n
|
loading, the callback function will be invoked with the n
|
||||||
loaded models passed as its parameter list. It is possible
|
loaded models passed as its parameter list. It is possible
|
||||||
that the callback will be invoked immediately, even before
|
that the callback will be invoked immediately, even before
|
||||||
loadModel() returns.
|
loadModel() returns. If you use callback, you may also
|
||||||
|
specify a priority, which specifies the relative importance
|
||||||
|
over this model over all of the other asynchronous load
|
||||||
|
requests (higher numbers are loaded first).
|
||||||
|
|
||||||
True asynchronous model loading requires Panda to have been
|
True asynchronous model loading requires Panda to have been
|
||||||
compiled with threading support enabled (you can test
|
compiled with threading support enabled (you can test
|
||||||
@ -179,6 +182,8 @@ class Loader(DirectObject):
|
|||||||
i=0
|
i=0
|
||||||
for modelPath in modelList:
|
for modelPath in modelList:
|
||||||
request = self.loader.makeAsyncRequest(Filename(modelPath), loaderOptions)
|
request = self.loader.makeAsyncRequest(Filename(modelPath), loaderOptions)
|
||||||
|
if priority is not None:
|
||||||
|
request.setPriority(priority)
|
||||||
request.setDoneEvent(self.hook)
|
request.setDoneEvent(self.hook)
|
||||||
request.setPythonObject((cb, i))
|
request.setPythonObject((cb, i))
|
||||||
i+=1
|
i+=1
|
||||||
|
@ -1088,6 +1088,11 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
# region (see the comment in setupRender2d, above).
|
# region (see the comment in setupRender2d, above).
|
||||||
dr.setClearDepthActive(1)
|
dr.setClearDepthActive(1)
|
||||||
|
|
||||||
|
# Make any texture reloads on the gui come up first, before
|
||||||
|
# textures on the rest of the scene, and before the default
|
||||||
|
# asynchronous animation load priority (100).
|
||||||
|
dr.setTextureReloadPriority(200)
|
||||||
|
|
||||||
left, right, bottom, top = coords
|
left, right, bottom, top = coords
|
||||||
|
|
||||||
# Now make a new Camera node.
|
# Now make a new Camera node.
|
||||||
@ -1129,6 +1134,8 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
# Unlike render2d, we don't clear the depth buffer for
|
# Unlike render2d, we don't clear the depth buffer for
|
||||||
# render2dp. Caveat emptor.
|
# render2dp. Caveat emptor.
|
||||||
|
|
||||||
|
dr.setTextureReloadPriority(250)
|
||||||
|
|
||||||
left, right, bottom, top = coords
|
left, right, bottom, top = coords
|
||||||
|
|
||||||
# Now make a new Camera node.
|
# Now make a new Camera node.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user