Browse Source

okMissing

David Rose 17 years ago
parent
commit
ac06fd3b4a
2 changed files with 17 additions and 21 deletions
  1. 15 15
      direct/src/actor/Actor.py
  2. 2 6
      direct/src/showbase/Transitions.py

+ 15 - 15
direct/src/actor/Actor.py

@@ -89,9 +89,10 @@ class Actor(DirectObject, NodePath):
         def __repr__(self):
         def __repr__(self):
             return 'Actor.SubpartDef(%s, %s)' % (repr(self.truePartName), repr(self.subset))
             return 'Actor.SubpartDef(%s, %s)' % (repr(self.truePartName), repr(self.subset))
 
 
-    def __init__(self, models=None, anims=None, other=None, copy=1,
-                 lodNode = None, flattenable = 1, setFinal = 0,
-                 mergeLODBundles = None, allowAsyncBind = None):
+    def __init__(self, models=None, anims=None, other=None, copy=True,
+                 lodNode = None, flattenable = True, setFinal = False,
+                 mergeLODBundles = None, allowAsyncBind = None,
+                 okMissing = None):
         """__init__(self, string | string:string{}, string:string{} |
         """__init__(self, string | string:string{}, string:string{} |
         string:(string:string{}){}, Actor=None)
         string:(string:string{}){}, Actor=None)
         Actor constructor: can be used to create single or multipart
         Actor constructor: can be used to create single or multipart
@@ -157,8 +158,6 @@ class Actor(DirectObject, NodePath):
         # initialize our NodePath essence
         # initialize our NodePath essence
         NodePath.__init__(self)
         NodePath.__init__(self)
 
 
-        self.__autoCopy = copy
-
         # Set the mergeLODBundles flag.  If this is true, all
         # Set the mergeLODBundles flag.  If this is true, all
         # different LOD's will be merged into a single common bundle
         # different LOD's will be merged into a single common bundle
         # (joint hierarchy).  All LOD's will thereafter share the same
         # (joint hierarchy).  All LOD's will thereafter share the same
@@ -251,13 +250,15 @@ class Actor(DirectObject, NodePath):
                             # iterate over both dicts
                             # iterate over both dicts
                             for modelName in models[lodName].keys():
                             for modelName in models[lodName].keys():
                                 self.loadModel(models[lodName][modelName],
                                 self.loadModel(models[lodName][modelName],
-                                               modelName, lodName, copy = copy)
+                                               modelName, lodName, copy = copy,
+                                               okMissing = okMissing)
                     # then if there is a dictionary of dictionaries of anims
                     # then if there is a dictionary of dictionaries of anims
                     elif (type(anims[anims.keys()[0]])==type({})):
                     elif (type(anims[anims.keys()[0]])==type({})):
                         # then this is a multipart actor w/o LOD
                         # then this is a multipart actor w/o LOD
                         for partName in models.keys():
                         for partName in models.keys():
                             # pass in each part
                             # pass in each part
-                            self.loadModel(models[partName], partName, copy = copy)
+                            self.loadModel(models[partName], partName,
+                                           copy = copy, okMissing = okMissing)
                     else:
                     else:
                         # it is a single part actor w/LOD
                         # it is a single part actor w/LOD
                         self.setLODNode(node = lodNode)
                         self.setLODNode(node = lodNode)
@@ -267,10 +268,11 @@ class Actor(DirectObject, NodePath):
                         for lodName in sortedKeys:
                         for lodName in sortedKeys:
                             self.addLOD(str(lodName))
                             self.addLOD(str(lodName))
                             # pass in dictionary of parts
                             # pass in dictionary of parts
-                            self.loadModel(models[lodName], lodName=lodName, copy = copy)
+                            self.loadModel(models[lodName], lodName=lodName,
+                                           copy = copy, okMissing = okMissing)
                 else:
                 else:
                     # else it is a single part actor
                     # else it is a single part actor
-                    self.loadModel(models, copy = copy)
+                    self.loadModel(models, copy = copy, okMissing = okMissing)
 
 
             # load anims
             # load anims
             # make sure the actor has animations
             # make sure the actor has animations
@@ -1805,12 +1807,10 @@ class Actor(DirectObject, NodePath):
 
 
         return controls
         return controls
 
 
-    def loadModel(self, modelPath, partName="modelRoot", lodName="lodRoot", copy = 1):
-        """loadModel(self, string, string="modelRoot", string="lodRoot",
-        bool = 0)
-        Actor model loader. Takes a model name (ie file path), a part
+    def loadModel(self, modelPath, partName="modelRoot", lodName="lodRoot",
+                  copy = True, okMissing = None):
+        """Actor model loader. Takes a model name (ie file path), a part
         name(defaults to "modelRoot") and an lod name(defaults to "lodRoot").
         name(defaults to "modelRoot") and an lod name(defaults to "lodRoot").
-        If copy is set to 0, do a loadModel instead of a loadModelCopy.
         """
         """
         assert partName not in self.__subpartDict
         assert partName not in self.__subpartDict
 
 
@@ -1836,7 +1836,7 @@ class Actor(DirectObject, NodePath):
             # get the skeleton model.  This only matters to model
             # get the skeleton model.  This only matters to model
             # files (like .mb) for which we can choose to extract
             # files (like .mb) for which we can choose to extract
             # either the skeleton or animation, or neither.
             # either the skeleton or animation, or neither.
-            model = loader.loadModel(modelPath, loaderOptions = loaderOptions)
+            model = loader.loadModel(modelPath, loaderOptions = loaderOptions, okMissing = okMissing)
 
 
         if (model == None):
         if (model == None):
             raise StandardError, "Could not load Actor model %s" % (modelPath)
             raise StandardError, "Could not load Actor model %s" % (modelPath)

+ 2 - 6
direct/src/showbase/Transitions.py

@@ -323,13 +323,9 @@ class Transitions:
             # Allow a custom look to the letterbox graphic.
             # Allow a custom look to the letterbox graphic.
 
 
             # TODO: This model isn't available everywhere.  We should
             # TODO: This model isn't available everywhere.  We should
-            # pass it in as a parameter.  In the meantime, at least
-            # set the LoaderOptions so there will be no error message
-            # if it fails to load.
-            options = LoaderOptions()
-            options.setFlags(options.getFlags() & ~options.LFReportErrors)
+            # pass it in as a parameter.
             button = loader.loadModel('models/gui/toplevel_gui',
             button = loader.loadModel('models/gui/toplevel_gui',
-                                      loaderOptions = options)
+                                      okMissing = True)
             
             
             barImage = None
             barImage = None
             if button:
             if button: