[Bf-committers] A patch to add an addObject() method to KX_Scene

José Ignacio jose.cyborg at gmail.com
Sun Feb 22 04:48:55 CET 2009


On Sun, Feb 22, 2009 at 12:37 AM, Mitchell Stokes <mitchell at daboys4u.com> wrote:
> I've created a patch to add an addObject() method to KX_Scene so that
> I could avoid using the add object actuator.
>
> Here's the link to the tracker entry:
> http://projects.blender.org/tracker/index.php?func=detail&aid=18309&group_id=9&atid=306
>
> The following is the description that's in the tracker:
>
> I got tired of using the Add Object Actuator, so I added an
> addObject() method to KX_Scene. Here is it's PyDoc entry:
>
> def addObject(object, other, time=0)
>        """
>        Adds an object to the scene like the Add Object Actuator would.
>
>        @param object: The object to add
>        @type object: L{KX_GameObject} or string
>        @param other: The object's center to use when adding the object
>        @type other: L{KX_GameObject} or string
>        @param time: How long (in seconds) that the new object will live

Fix:
        @param time: How long (in seconds) that the new object will
live, 0 meaning unlimited.

>        @type time: int
>        """
>
> An example:
>
> gl = GameLogic
> own = gl.getCurrentController().getOwner()
> scene = gl.getCurrentScene()
>
> ob = scene.addObject("Cube", own)
>
> print ob.name

^ ^


More information about the Bf-committers mailing list