[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48708] branches/soc-2012-swiss_cheese/doc /python_api/rst: Documenting the new KX_LibLoadStatus object.

Mitchell Stokes mogurijin at gmail.com
Sat Jul 7 09:01:59 CEST 2012


Revision: 48708
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48708
Author:   moguri
Date:     2012-07-07 07:01:59 +0000 (Sat, 07 Jul 2012)
Log Message:
-----------
Documenting the new KX_LibLoadStatus object.

Modified Paths:
--------------
    branches/soc-2012-swiss_cheese/doc/python_api/rst/bge.logic.rst
    branches/soc-2012-swiss_cheese/doc/python_api/rst/bge.types.rst

Modified: branches/soc-2012-swiss_cheese/doc/python_api/rst/bge.logic.rst
===================================================================
--- branches/soc-2012-swiss_cheese/doc/python_api/rst/bge.logic.rst	2012-07-07 06:44:45 UTC (rev 48707)
+++ branches/soc-2012-swiss_cheese/doc/python_api/rst/bge.logic.rst	2012-07-07 07:01:59 UTC (rev 48708)
@@ -189,6 +189,10 @@
    :arg async: Whether or not to do the loading asynchronously (in another thread)
    :type async: bool
    
+   :rtype: :class:`bge.types.KX_LibLoadStatus`
+
+   .. note:: Asynchronously loaded libraries will not be available immediately after LibLoad() returns. Use the returned KX_LibLoadStatus to figure out when the libraries are ready.
+
 .. function:: LibNew(name, type, data)
 
    Uses existing datablock data and loads in as a new library.

Modified: branches/soc-2012-swiss_cheese/doc/python_api/rst/bge.types.rst
===================================================================
--- branches/soc-2012-swiss_cheese/doc/python_api/rst/bge.types.rst	2012-07-07 06:44:45 UTC (rev 48707)
+++ branches/soc-2012-swiss_cheese/doc/python_api/rst/bge.types.rst	2012-07-07 07:01:59 UTC (rev 48708)
@@ -1670,6 +1670,50 @@
 
       :type: boolean
 
+.. class:: KX_LibLoadStatus(PyObjectPlus)
+
+   An object providing information about a LibLoad() operation.
+
+   .. code-block:: python
+
+      # Print a message when an async LibLoad is done
+      import bge
+
+      def finished_cb(status):
+          print("Library (%s) loaded in %.2fms." % (status.libraryName, status.timeTaken))
+
+      bge.logic.LibLoad('myblend.blend', 'Scene', async=True).onFinish = finished_cb
+
+   .. attribute:: onFinish
+
+      A callback that gets called when the lib load is done.
+
+      :type: callable
+
+   .. attribute:: onProgress
+
+      A callback that gets called when the lib load progress changes.
+
+      :type: callable
+
+   .. attribute:: progress
+
+      The current progress of the lib load as a normalized value from 0.0 to 1.0.
+
+      :type: float
+
+   .. attribute:: libraryName
+
+      The name of the library being loaded (the first argument to LibLoad).
+
+      :type: string
+
+   .. attribute:: timeTaken
+
+      The amount of time, in seconds, the lib load took (0 until the operation is complete).
+
+      :type: float
+
 .. class:: KX_LightObject(KX_GameObject)
 
    A Light object.




More information about the Bf-blender-cvs mailing list