Cleanup: trailing space

This commit is contained in:
Campbell Barton 2018-11-30 08:38:25 +11:00
parent 3c767cecce
commit 8ac2d85d2f
42 changed files with 232 additions and 242 deletions

View File

@ -14,7 +14,7 @@ Module to access logic functions, imported automatically into the python control
# To get the controller thats running this python script:
cont = bge.logic.getCurrentController() # bge.logic is automatically imported
# To get the game object this controller is on:
obj = cont.owner
@ -59,7 +59,7 @@ You can also access actuators linked to the controller
# + Python +--+ Actuator "actuatorname" |
# +--------+ +-------------------------+
actuator = co.actuators["actuatorname"]
# Activate an actuator
controller.activate(actuator)
@ -67,7 +67,7 @@ See the actuator's reference for available methods
.. hlist::
:columns: 3
* :class:`~bge.types.BL_ActionActuator`
* :class:`~bge.types.KX_CameraActuator`
* :class:`~bge.types.KX_ConstraintActuator`
@ -139,21 +139,21 @@ General functions
.. function:: getCurrentController()
Gets the Python controller associated with this Python script.
:rtype: :class:`bge.types.SCA_PythonController`
.. function:: getCurrentScene()
Gets the current Scene.
:rtype: :class:`bge.types.KX_Scene`
.. function:: getSceneList()
Gets a list of the current scenes loaded in the game engine.
:rtype: list of :class:`bge.types.KX_Scene`
.. note:: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes.
.. function:: loadGlobalDict()
@ -167,7 +167,7 @@ General functions
.. function:: startGame(blend)
Loads the blend file.
:arg blend: The name of the blend file
:type blend: string
@ -178,11 +178,11 @@ General functions
.. function:: restartGame()
Restarts the current game by reloading the .blend file (the last saved version, not what is currently running).
.. function:: LibLoad(blend, type, data, load_actions=False, verbose=False, load_scripts=True, async=False)
Converts the all of the datablocks of the given type from the given blend.
:arg blend: The path to the blend file (or the name to use for the library if data is supplied)
:type blend: string
:arg type: The datablock type (currently only "Action", "Mesh" and "Scene" are supported)
@ -194,36 +194,36 @@ General functions
:arg verbose: Whether or not to print debugging information (e.g., "SceneName: Scene")
:type verbose: bool
:arg load_scripts: Whether or not to load text datablocks as well (can be disabled for some extra security)
:type load_scripts: bool
:type load_scripts: bool
:arg async: Whether or not to do the loading asynchronously (in another thread). Only the "Scene" type is currently supported for this feature.
: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.
:arg name: A unique library name used for removal later
:type name: string
:arg type: The datablock type (currently only "Mesh" is supported)
:type type: string
:arg data: A list of names of the datablocks to load
:type data: list of strings
.. function:: LibFree(name)
Frees a library, removing all objects and meshes from the currently active scenes.
:arg name: The name of the library to free (the name used in LibNew)
:type name: string
.. function:: LibList()
Returns a list of currently loaded libraries.
:rtype: list [str]
.. function:: addScene(name, overlay=1)
@ -244,7 +244,7 @@ General functions
.. function:: sendMessage(subject, body="", to="", message_from="")
Sends a message to sensors in any active scene.
:arg subject: The subject of the message
:type subject: string
:arg body: The body of the message (optional)
@ -257,7 +257,7 @@ General functions
.. function:: setGravity(gravity)
Sets the world gravity.
:arg gravity: gravity vector
:type gravity: Vector((fx, fy, fz))
@ -265,28 +265,28 @@ General functions
Returns a 512 point list from the sound card.
This only works if the fmod sound driver is being used.
:rtype: list [float], len(getSpectrum()) == 512
.. function:: getMaxLogicFrame()
Gets the maximum number of logic frames per render frame.
:return: The maximum number of logic frames per render frame
:rtype: integer
.. function:: setMaxLogicFrame(maxlogic)
Sets the maximum number of logic frames that are executed per render frame.
This does not affect the physic system that still runs at full frame rate.
This does not affect the physic system that still runs at full frame rate.
:arg maxlogic: The new maximum number of logic frames per render frame. Valid values: 1..5
:type maxlogic: integer
.. function:: getMaxPhysicsFrame()
Gets the maximum number of physics frames per render frame.
:return: The maximum number of physics frames per render frame
:rtype: integer
@ -296,43 +296,43 @@ General functions
Higher value allows physics to keep up with realtime even if graphics slows down the game.
Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate)
maxphysics/ticrate is the maximum delay of the renderer that physics can compensate.
:arg maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5.
:type maxphysics: integer
.. function:: getLogicTicRate()
Gets the logic update frequency.
:return: The logic frequency in Hz
:rtype: float
.. function:: setLogicTicRate(ticrate)
Sets the logic update frequency.
The logic update frequency is the number of times logic bricks are executed every second.
The default is 60 Hz.
:arg ticrate: The new logic update frequency (in Hz).
:type ticrate: float
.. function:: getPhysicsTicRate()
Gets the physics update frequency
:return: The physics update frequency in Hz
:rtype: float
.. warning: Not implimented yet
.. function:: setPhysicsTicRate(ticrate)
Sets the physics update frequency
The physics update frequency is the number of times the physics system is executed every second.
The default is 60 Hz.
:arg ticrate: The new update frequency (in Hz).
:type ticrate: float
@ -380,13 +380,13 @@ General functions
.. function:: setRender(render)
Sets the global flag that controls the render of the scene.
Sets the global flag that controls the render of the scene.
If True, the render is done after the logic frame.
If False, the render is skipped and another logic frame starts immediately.
.. note::
GPU VSync no longer limits the number of frame per second when render is off,
GPU VSync no longer limits the number of frame per second when render is off,
but the *Use Frame Rate* option still regulates the fps. To run as many frames
as possible, untick this option (Render Properties, System panel).
@ -468,7 +468,7 @@ Time related functions
enough to run at least the next logic step).
:arg new_time: the next value of the BGE clock (in second).
*****************
Utility functions
@ -520,7 +520,7 @@ Utility functions
.. function:: getProfileInfo()
Returns a Python dictionary that contains the same information as the on screen profiler. The keys are the profiler categories and the values are tuples with the first element being time taken (in ms) and the second element being the percentage of total time.
*********
Constants
*********
@ -535,7 +535,7 @@ Constants
=======
Sensors
=======
=======
.. _sensor-status:
@ -561,31 +561,31 @@ See :class:`bge.types.KX_ArmatureSensor.type`
Detect that the constraint is changing state (active/inactive)
:value: 0
.. data:: KX_ARMSENSOR_LIN_ERROR_BELOW
Detect that the constraint linear error is above a threshold
:value: 1
.. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE
Detect that the constraint linear error is below a threshold
:value: 2
.. data:: KX_ARMSENSOR_ROT_ERROR_BELOW
Detect that the constraint rotation error is above a threshold
:value: 3
.. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE
Detect that the constraint rotation error is below a threshold
:value: 4
.. _logic-property-sensor:
@ -602,25 +602,25 @@ Property Sensor
.. data:: KX_PROPSENSOR_NOTEQUAL
Activate when the property is not equal to the sensor value.
:value: 2
.. data:: KX_PROPSENSOR_INTERVAL
Activate when the property is between the specified limits.
:value: 3
.. data:: KX_PROPSENSOR_CHANGED
Activate when the property changes
Activate when the property changes
:value: 4
.. data:: KX_PROPSENSOR_EXPRESSION
Activate when the expression matches
:value: 5
.. data:: KX_PROPSENSOR_LESSTHAN
@ -686,7 +686,7 @@ Armature Actuator
-----------------
.. _armatureactuator-constants-type:
See :class:`bge.types.BL_ArmatureActuator.type`
.. data:: KX_ACT_ARMATURE_RUN
@ -694,7 +694,7 @@ See :class:`bge.types.BL_ArmatureActuator.type`
Just make sure the armature will be updated on the next graphic frame.
This is the only persistent mode of the actuator:
it executes automatically once per frame until stopped by a controller
:value: 0
.. data:: KX_ACT_ARMATURE_ENABLE
@ -712,7 +712,7 @@ See :class:`bge.types.BL_ArmatureActuator.type`
.. data:: KX_ACT_ARMATURE_SETTARGET
Change target and subtarget of constraint.
:value: 3
.. data:: KX_ACT_ARMATURE_SETWEIGHT
@ -740,7 +740,7 @@ See :class:`bge.types.KX_ConstraintActuator.option`
.. data:: KX_CONSTRAINTACT_NORMAL
Activate alignment to surface
.. data:: KX_CONSTRAINTACT_DISTANCE
Activate distance control
@ -760,7 +760,7 @@ See :class:`bge.types.KX_ConstraintActuator.option`
.. data:: KX_CONSTRAINTACT_MATERIAL
Detect material rather than property
.. data:: KX_CONSTRAINTACT_PERMANENT
No deactivation if ray does not hit target
@ -772,7 +772,7 @@ See :class:`bge.types.KX_ConstraintActuator.limit`
.. data:: KX_CONSTRAINTACT_LOCX
Limit X coord.
.. data:: KX_CONSTRAINTACT_LOCY
Limit Y coord
@ -780,7 +780,7 @@ See :class:`bge.types.KX_ConstraintActuator.limit`
.. data:: KX_CONSTRAINTACT_LOCZ
Limit Z coord
.. data:: KX_CONSTRAINTACT_ROTX
Limit X rotation
@ -788,11 +788,11 @@ See :class:`bge.types.KX_ConstraintActuator.limit`
.. data:: KX_CONSTRAINTACT_ROTY
Limit Y rotation
.. data:: KX_CONSTRAINTACT_ROTZ
Limit Z rotation
.. data:: KX_CONSTRAINTACT_DIRNX
Set distance along negative X axis
@ -800,11 +800,11 @@ See :class:`bge.types.KX_ConstraintActuator.limit`
.. data:: KX_CONSTRAINTACT_DIRNY
Set distance along negative Y axis
.. data:: KX_CONSTRAINTACT_DIRNZ
Set distance along negative Z axis
.. data:: KX_CONSTRAINTACT_DIRPX
Set distance along positive X axis
@ -812,35 +812,35 @@ See :class:`bge.types.KX_ConstraintActuator.limit`
.. data:: KX_CONSTRAINTACT_DIRPY
Set distance along positive Y axis
.. data:: KX_CONSTRAINTACT_DIRPZ
Set distance along positive Z axis
.. data:: KX_CONSTRAINTACT_ORIX
Set orientation of X axis
.. data:: KX_CONSTRAINTACT_ORIY
Set orientation of Y axis
.. data:: KX_CONSTRAINTACT_ORIZ
Set orientation of Z axis
.. data:: KX_CONSTRAINTACT_FHNX
Set force field along negative X axis
.. data:: KX_CONSTRAINTACT_FHNY
Set force field along negative Y axis
.. data:: KX_CONSTRAINTACT_FHNZ
Set force field along negative Z axis
.. data:: KX_CONSTRAINTACT_FHPX
Set force field along positive X axis
@ -848,7 +848,7 @@ See :class:`bge.types.KX_ConstraintActuator.limit`
.. data:: KX_CONSTRAINTACT_FHPY
Set force field along positive Y axis
.. data:: KX_CONSTRAINTACT_FHPZ
Set force field along positive Z axis
@ -936,29 +936,29 @@ See :class:`bge.types.KX_SceneActuator`
--------------
Sound Actuator
--------------
See :class:`bge.types.KX_SoundActuator`
.. data:: KX_SOUNDACT_PLAYSTOP
:value: 1
.. data:: KX_SOUNDACT_PLAYEND
:value: 2
.. data:: KX_SOUNDACT_LOOPSTOP
:value: 3
.. data:: KX_SOUNDACT_LOOPEND
:value: 4
.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL
:value: 5
.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
:value: 6
@ -1014,69 +1014,69 @@ Various
.. data:: RAS_2DFILTER_BLUR
:value: 2
.. data:: RAS_2DFILTER_CUSTOMFILTER
Customer filter, the code code is set via shaderText property.
:value: 12
.. data:: RAS_2DFILTER_DILATION
:value: 4
.. data:: RAS_2DFILTER_DISABLED
Disable the filter that is currently active
:value: -1
.. data:: RAS_2DFILTER_ENABLED
Enable the filter that was previously disabled
:value: -2
.. data:: RAS_2DFILTER_EROSION
:value: 5
.. data:: RAS_2DFILTER_GRAYSCALE
:value: 9
.. data:: RAS_2DFILTER_INVERT
:value: 11
.. data:: RAS_2DFILTER_LAPLACIAN
:value: 6
.. data:: RAS_2DFILTER_MOTIONBLUR
Create and enable preset filters
:value: 1
.. data:: RAS_2DFILTER_NOFILTER
Disable and destroy the filter that is currently active
:value: 0
.. data:: RAS_2DFILTER_PREWITT
:value: 8
.. data:: RAS_2DFILTER_SEPIA
:value: 10
.. data:: RAS_2DFILTER_SHARPEN
:value: 3
.. data:: RAS_2DFILTER_SOBEL
:value: 7
@ -1156,7 +1156,7 @@ See :class:`bge.types.BL_ArmatureConstraint.type`
.. _armatureconstraint-constants-ik-type:
See :class:`bge.types.BL_ArmatureConstraint.ik_type`
.. data:: CONSTRAINT_IK_COPYPOSE
constraint is trying to match the position and eventually the rotation of the target.
@ -1190,7 +1190,7 @@ See :class:`bge.types.BL_ArmatureConstraint.ik_flag`
Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
:value: 16
.. data:: CONSTRAINT_IK_FLAG_POS
Set when the constraint tries to match the position of the target.
@ -1212,7 +1212,7 @@ See :class:`bge.types.BL_ArmatureConstraint.ik_mode`
The constraint tries to keep the bone outside ik_dist of the target
:value: 1
.. data:: CONSTRAINT_IK_MODE_ONSURFACE
The constraint tries to keep the bone exactly at ik_dist of the target.
@ -1258,19 +1258,19 @@ See :class:`bge.types.KX_GameObject.playAction`
.. data:: KX_ACTION_MODE_PLAY
Play the action once.
:value: 0
.. data:: KX_ACTION_MODE_LOOP
Loop the action (repeat it).
:value: 1
.. data:: KX_ACTION_MODE_PING_PONG
Play the action one direct then back the other way when it has completed.
:value: 2
.. _gameobject-playaction-blend:
@ -1310,11 +1310,11 @@ Navigation Mesh Draw Modes
.. data:: RM_POLYS
Draw only polygons.
.. data:: RM_TRIS
Draw triangle mesh.
------
Shader
------
@ -1393,7 +1393,7 @@ See :class:`bge.types.KX_StateActuator.operation`
Copy state mask
:value: 1
.. data:: KX_STATE_OP_NEG
Invert bits to state mask

View File

@ -105,7 +105,7 @@ Types
.. class:: RASOffScreen
An off-screen render buffer object.
An off-screen render buffer object.
Use :func:`offScreenCreate` to create it.
Currently it can only be used in the :class:`bge.texture.ImageRender`
@ -183,7 +183,7 @@ Functions
monitor). Can return the size of the entire view, so the
combination of all monitors; for example, ``(3840, 1080)`` for two
side-by-side 1080p monitors.
:rtype: tuple (width, height)
.. function:: makeScreenshot(filename)
@ -416,10 +416,9 @@ Functions
:arg samples: the number of multisample for anti-aliasing (MSAA), 0 to disable MSAA
:type samples: integer
:arg target: the pixel storage: :data:`RAS_OFS_RENDER_BUFFER` to render on RenderBuffers (the default),
:data:`RAS_OFS_RENDER_TEXTURE` to render on texture.
:data:`RAS_OFS_RENDER_TEXTURE` to render on texture.
The later is interesting if you want to access the texture directly (see :attr:`RASOffScreen.color`).
Otherwise the default is preferable as it's more widely supported by GPUs and more efficient.
If the GPU does not support MSAA+Texture (e.g. Intel HD GPU), MSAA will be disabled.
:type target: integer
:rtype: :class:`RASOffScreen`

View File

@ -32,9 +32,9 @@ base class --- :class:`SCA_IActuator`
The object that this actuator will set as secondary target to the constraint it controls.
:type: :class:`KX_GameObject`.
.. note::
Currently, the only secondary target is the pole target for IK constraint.
.. attribute:: weight
@ -44,11 +44,11 @@ base class --- :class:`SCA_IActuator`
:type: float.
.. note::
Currently only the IK constraint has a weight. It must be a value between 0 and 1.
.. note::
A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`)
.. attribute:: influence

View File

@ -81,8 +81,8 @@ base class --- :class:`PyObjectPlus`
:type: matrix [4][4]
.. note::
This matrix has no scale part.
This matrix has no scale part.
.. attribute:: bone_mat

View File

@ -88,11 +88,11 @@ base class --- :class:`PyObjectPlus`
:type: vector [X, Y, Z].
.. note::
You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
.. note::
Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`).
.. attribute:: scale
@ -102,11 +102,11 @@ base class --- :class:`PyObjectPlus`
:type: vector [sizeX, sizeY, sizeZ].
.. note::
An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
.. note::
Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
.. attribute:: rotation_quaternion
@ -116,11 +116,11 @@ base class --- :class:`PyObjectPlus`
:type: vector [qr, qi, qj, qk].
.. note::
This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
.. note::
Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
.. attribute:: rotation_euler
@ -130,11 +130,11 @@ base class --- :class:`PyObjectPlus`
:type: vector [X, Y, Z].
.. note::
This field is only used if rotation_mode is > 0. You must always pass the angles in [X, Y, Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation.
.. note::
Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
.. attribute:: rotation_mode
@ -152,7 +152,7 @@ base class --- :class:`PyObjectPlus`
.. attribute:: pose_matrix
pose matrix in armature space, read-only,
pose matrix in armature space, read-only,
This field is updated after the graphic render, it represents the current pose.
:type: matrix [4][4]
@ -257,19 +257,19 @@ base class --- :class:`PyObjectPlus`
* 3DoF joint X+Y+Z: treated as a revolute joint. The [x, y, z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose.
:type: vector [x, y, z]
.. note::
The bone must be part of an IK chain if you want to set the ik_dof_x/ik_dof_y/ik_dof_z attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target) the IK solver will not run but the IK panel will show up on the UI for each bone in the chain.
.. note::
[0, 0, 0] always corresponds to the rest pose.
.. note::
You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see :data:`BL_ArmatureObject.update`).
.. note::
You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute.

View File

@ -9,16 +9,16 @@ base class --- :class:`PyObjectPlus`
Obtained through :class:`BL_ArmatureObject`.constraints.
.. note::
Not all armature constraints are supported in the GE.
.. attribute:: type
Type of constraint, (read-only).
Use one of :ref:`these constants<armatureconstraint-constants-type>`.
:type: integer, one of CONSTRAINT_TYPE_* constants
.. attribute:: name
@ -42,7 +42,7 @@ base class --- :class:`PyObjectPlus`
:type: float.
.. note::
Only used if the target is a bone (i.e target object is an armature.
.. attribute:: lin_error
@ -82,9 +82,9 @@ base class --- :class:`PyObjectPlus`
True if the constraint is active.
:type: boolean
.. note::
An inactive constraint does not update lin_error and rot_error.
.. attribute:: ik_weight
@ -100,13 +100,13 @@ base class --- :class:`PyObjectPlus`
Type of IK constraint, (read-only).
Use one of :ref:`these constants<armatureconstraint-constants-ik-type>`.
:type: integer.
.. attribute:: ik_flag
Combination of IK constraint option flags, read-only.
Use one of :ref:`these constants<armatureconstraint-constants-ik-flag>`.
:type: integer
@ -120,7 +120,7 @@ base class --- :class:`PyObjectPlus`
.. attribute:: ik_mode
Use one of :ref:`these constants<armatureconstraint-constants-ik-mode>`.
Additional mode for IK constraint. Currently only used for Distance constraint:
:type: integer

View File

@ -214,10 +214,10 @@ base class --- :class:`PyObjectPlus`
.. method:: setUniformEyef(name)
Set a uniform with a float value that reflects the eye being render in stereo mode:
Set a uniform with a float value that reflects the eye being render in stereo mode:
0.0 for the left eye, 0.5 for the right eye. In non stereo mode, the value of the uniform
is fixed to 0.0. The typical use of this uniform is in stereo mode to sample stereo textures
containing the left and right eye images in a top-bottom order.
containing the left and right eye images in a top-bottom order.
:arg name: the uniform name
:type name: string

View File

@ -16,7 +16,7 @@ base class --- :class:`CPropValue`
Add an item to the list (like pythons append)
.. warning::
Appending values to the list can cause crashes when the list is used internally by the game engine.
.. method:: count(val)
@ -52,7 +52,7 @@ base class --- :class:`CPropValue`
Example:
.. code-block:: python
myObID=id(gameObject)
ob= scene.objects.from_id(myObID)

View File

@ -12,4 +12,3 @@ base class --- :class:`PyObjectPlus`
The name of this CValue derived object (read-only).
:type: string

View File

@ -10,7 +10,7 @@ base class --- :class:`SCA_ISensor`
.. attribute:: type
The type of measurement that the sensor make when it is active.
Can be one of :ref:`these constants <armaturesensor-type>`
:type: integer.
@ -22,7 +22,7 @@ base class --- :class:`SCA_ISensor`
:type: :class:`BL_ArmatureConstraint`
.. attribute:: value
The threshold used in the comparison with the constraint error
The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver
The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver
@ -31,4 +31,3 @@ base class --- :class:`SCA_ISensor`
The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller.
:type: float

View File

@ -8,19 +8,19 @@ base class --- :class:`PyObjectPlus`
This is the interface to materials in the game engine.
Materials define the render state to be applied to mesh objects.
The example below shows a simple GLSL shader setup allowing to dynamically mix two texture channels
in a material. All materials of the object executing this script should have two textures using
separate UV maps in the two first texture channels.
The code works for both Multitexture and GLSL rendering modes.
.. code-block:: python
from bge import logic
vertex_shader = """
void main(void)
{
// simple projection of the vertex position to view space
@ -31,7 +31,7 @@ base class --- :class:`PyObjectPlus`
gl_TexCoord[1] = gl_MultiTexCoord1;
}
"""
fragment_shader ="""
uniform sampler2D texture_0;
@ -47,7 +47,7 @@ base class --- :class:`PyObjectPlus`
"""
object = logic.getCurrentController().owner
for mesh in object.meshes:
for material in mesh.materials:
shader = material.getShader()
@ -143,7 +143,7 @@ base class --- :class:`PyObjectPlus`
Set the pixel color arithmetic functions.
:arg src: Specifies how the red, green, blue, and alpha source blending factors are computed, one of...
* :data:`~bgl.GL_ZERO`
* :data:`~bgl.GL_ONE`
* :data:`~bgl.GL_SRC_COLOR`
@ -155,11 +155,11 @@ base class --- :class:`PyObjectPlus`
* :data:`~bgl.GL_DST_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_DST_ALPHA`
* :data:`~bgl.GL_SRC_ALPHA_SATURATE`
:type src: int
:arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed, one of...
* :data:`~bgl.GL_ZERO`
* :data:`~bgl.GL_ONE`
* :data:`~bgl.GL_SRC_COLOR`
@ -171,7 +171,7 @@ base class --- :class:`PyObjectPlus`
* :data:`~bgl.GL_DST_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_DST_ALPHA`
* :data:`~bgl.GL_SRC_ALPHA_SATURATE`
:type dest: int
.. method:: getMaterialIndex()

View File

@ -78,8 +78,8 @@ base class --- :class:`KX_GameObject`
This camera's 4x4 projection matrix.
.. note::
This is the identity matrix prior to rendering the first frame (any Python done on frame 1).
This is the identity matrix prior to rendering the first frame (any Python done on frame 1).
:type: 4x4 Matrix [[float]]
@ -90,7 +90,7 @@ base class --- :class:`KX_GameObject`
:type: 4x4 Matrix [[float]]
.. note::
This matrix is regenerated every frame from the camera's position and orientation. Also, this is the identity matrix prior to rendering the first frame (any Python done on frame 1).
.. attribute:: camera_to_world
@ -100,7 +100,7 @@ base class --- :class:`KX_GameObject`
:type: 4x4 Matrix [[float]]
.. note::
This matrix is regenerated every frame from the camera's position and orientation.
.. attribute:: world_to_camera
@ -110,11 +110,11 @@ base class --- :class:`KX_GameObject`
:type: 4x4 Matrix [[float]]
.. note::
Regenerated every frame from the camera's position and orientation.
.. note::
This is camera_to_world inverted.
.. attribute:: useViewport
@ -143,7 +143,7 @@ base class --- :class:`KX_GameObject`
from bge import logic
cont = logic.getCurrentController()
cam = cont.owner
# A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]
if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):
# Sphere is inside frustum !
@ -160,7 +160,7 @@ base class --- :class:`KX_GameObject`
:return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT`
.. note::
When the camera is first initialized the result will be invalid because the projection matrix has not been set.
.. code-block:: python
@ -179,13 +179,13 @@ base class --- :class:`KX_GameObject`
box.append([ 1.0, -1.0, 1.0])
box.append([ 1.0, 1.0, -1.0])
box.append([ 1.0, 1.0, 1.0])
if (cam.boxInsideFrustum(box) != cam.OUTSIDE):
# Box is inside/intersects frustum !
# Do something useful !
else:
# Box is outside the frustum !
.. method:: pointInsideFrustum(point)
Tests the given point against the view frustum.
@ -196,7 +196,7 @@ base class --- :class:`KX_GameObject`
:rtype: boolean
.. note::
When the camera is first initialized the result will be invalid because the projection matrix has not been set.
.. code-block:: python
@ -297,4 +297,3 @@ base class --- :class:`KX_GameObject`
# Gets an object with a property "wall" in front of the camera within a distance of 100:
target = camera.getScreenRay(0.5, 0.5, 100, "wall")

View File

@ -72,5 +72,3 @@ base class --- :class:`SCA_IActuator`
type of constraint. Use one of the :ref:`these constants <constraint-actuator-limit>`
:type: integer.

View File

@ -112,7 +112,7 @@ base class --- :class:`PyObjectPlus`
:return: position
:rtype: float
axis = 3..5 are relative constraint (Euler) angles in radians
axis = 3..5 are relative constraint (Euler) angles in radians
* 3: X axis angle
* 4: Y axis angle
* 5: Z axis angle

View File

@ -473,7 +473,7 @@ base class --- :class:`SCA_IObject`
If true, the object's and children's debug properties will be displayed on screen.
:type: boolean
.. attribute:: currentLodLevel
The index of the level of detail (LOD) currently used by this object (read-only).

View File

@ -157,5 +157,5 @@ base class --- :class:`KX_GameObject`
:type: float in [0 - 1]
.. note::
Higher values result in a more focused light source.

View File

@ -31,7 +31,7 @@ base class --- :class:`SCA_IObject`
#. They are the same color, for example: a cube has 24 vertices: 6 faces with 4 vertices per face.
The correct method of iterating over every :class:`KX_VertexProxy` in a game object
.. code-block:: python
from bge import logic

View File

@ -5,7 +5,7 @@ base class --- :class:`KX_GameObject`
.. class:: KX_NavMeshObject(KX_GameObject)
Python interface for using and controlling navigation meshes.
Python interface for using and controlling navigation meshes.
.. method:: findPath(start, goal)

View File

@ -5,7 +5,7 @@ base class --- :class:`SCA_IActuator`
.. class:: KX_ObjectActuator(SCA_IActuator)
The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement,
The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement,
velocity, or angular velocity to an object.
Servo control allows to regulate force to achieve a certain speed target.
@ -50,9 +50,9 @@ base class --- :class:`SCA_IActuator`
The angular displacement vector applied by the actuator
:type: Vector((x, y, z))
.. note::
Since the displacement is applied every frame, you must adjust the displacement based on the frame rate, or you game experience will depend on the player's computer speed.
.. attribute:: useLocalDRot
@ -72,9 +72,9 @@ base class --- :class:`SCA_IActuator`
A flag specifying if the linear velocity is local.
:type: boolean
.. note::
This is the target speed for servo controllers.
.. attribute:: angV

View File

@ -37,5 +37,5 @@ base class --- :class:`KX_NearSensor`
:type: integer from 0 to 5
KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z

View File

@ -13,8 +13,8 @@ base class --- :class:`SCA_IActuator`
.. code-block:: none
Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer)
Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer)
.. attribute:: object
the object this actuator adds.

View File

@ -14,7 +14,7 @@ base class --- :class:`SCA_IActuator`
This will generate a warning in the console
.. code-block:: none
Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object
.. code-block:: python
@ -33,18 +33,18 @@ base class --- :class:`SCA_IActuator`
(".Med", -15.0, -50.0),
(".Lo", -40.0, -100.0)
)
cont = logic.getCurrentController()
object = cont.owner
actuator = cont.actuators["LOD." + obj.name]
camera = logic.getCurrentScene().active_camera
def Depth(pos, plane):
return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3]
# Depth is negative and decreasing further from the camera
depth = Depth(object.position, camera.world_to_camera[2])
newmesh = None
curmesh = None
# Find the lowest detail mesh for depth
@ -53,7 +53,7 @@ base class --- :class:`SCA_IActuator`
newmesh = mesh
if "ME" + object.name + mesh[0] == actuator.getMesh():
curmesh = mesh
if newmesh != None and "ME" + object.name + newmesh[0] != actuator.mesh:
# The mesh is a different mesh - switch it.
# Check the current mesh is not a better fit.
@ -64,7 +64,7 @@ base class --- :class:`SCA_IActuator`
.. attribute:: mesh
:class:`MeshProxy` or the name of the mesh that will replace the current one.
Set to None to disable actuator.
:type: :class:`MeshProxy` or None if no mesh is set

View File

@ -76,9 +76,9 @@ base class --- :class:`PyObjectPlus`
The current active camera.
:type: :class:`KX_Camera`
.. note::
This can be set directly from python to avoid using the :class:`KX_SceneActuator`.
.. attribute:: world

View File

@ -14,7 +14,7 @@ base class --- :class:`SCA_IActuator`
This will generate a warning in the console:
.. code-block:: none
Error: GameObject 'Name' has a SceneActuator 'ActuatorName' (SetScene) without scene
.. attribute:: scene
@ -28,9 +28,9 @@ base class --- :class:`SCA_IActuator`
the camera to change to.
:type: :class:`KX_Camera` on read, string or :class:`KX_Camera` on write
.. note::
When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera.
.. attribute:: useRestart

View File

@ -10,7 +10,7 @@ base class --- :class:`SCA_IActuator`
.. attribute:: operation
Type of bit operation to be applied on object state mask.
You can use one of :ref:`these constants <state-actuator-operation>`
:type: integer

View File

@ -8,7 +8,7 @@ base class --- :class:`SCA_IActuator`
Edit Object actuator in Track To mode.
.. warning::
Track To Actuators will be ignored if at game start, the object to track to is invalid.
This will generate a warning in the console:

View File

@ -8,11 +8,11 @@ PyObjectPlus
.. attribute:: invalid
Test if the object has been freed by the game engine and is no longer valid.
Normally this is not a problem but when storing game engine data in the GameLogic module,
Normally this is not a problem but when storing game engine data in the GameLogic module,
KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data.
Calling an attribute or method on an invalid object will raise a SystemError.
The invalid attribute allows testing for this case without exception handling.
:type: boolean

View File

@ -5,7 +5,7 @@ base class --- :class:`SCA_ISensor`
.. class:: SCA_DelaySensor(SCA_ISensor)
The Delay sensor generates positive and negative triggers at precise time,
The Delay sensor generates positive and negative triggers at precise time,
expressed in number of frames. The delay parameter defines the length of the initial OFF period. A positive trigger is generated at the end of this period.
The duration parameter defines the length of the ON period following the OFF period.

View File

@ -10,13 +10,13 @@ base class --- :class:`SCA_ILogicBrick`
.. attribute:: state
The controllers state bitmask. This can be used with the GameObject's state to test if the controller is active.
:type: int bitmask
.. attribute:: sensors
A list of sensors linked to this controller.
:type: sequence supporting index/string lookups and iteration.
.. note::
@ -24,13 +24,13 @@ base class --- :class:`SCA_ILogicBrick`
The sensors are not necessarily owned by the same object.
.. note::
When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
.. attribute:: actuators
A list of actuators linked to this controller.
:type: sequence supporting index/string lookups and iteration.
.. note::
@ -38,15 +38,15 @@ base class --- :class:`SCA_ILogicBrick`
The sensors are not necessarily owned by the same object.
.. note::
When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
.. attribute:: useHighPriority
When set the controller executes always before all other controllers that dont have this set.
:type: boolen
.. note::
Order of execution between high priority controllers is not guaranteed.

View File

@ -16,11 +16,11 @@ base class --- :class:`CValue`
.. attribute:: owner
The game object this logic brick is attached to (read-only).
:type: :class:`KX_GameObject` or None in exceptional cases.
.. attribute:: name
The name of this logic brick (read-only).
:type: string

View File

@ -10,13 +10,13 @@ base class --- :class:`SCA_ILogicBrick`
.. attribute:: usePosPulseMode
Flag to turn positive pulse mode on and off.
:type: boolean
.. attribute:: useNegPulseMode
Flag to turn negative pulse mode on and off.
:type: boolean
.. attribute:: frequency
@ -44,7 +44,7 @@ base class --- :class:`SCA_ILogicBrick`
.. attribute:: tap
When enabled only sensors that are just activated will send a positive event,
When enabled only sensors that are just activated will send a positive event,
after this they will be detected as negative by the controllers.
This will make a key thats held act as if its only tapped for an instant.
note: mutually exclusive with :data:`level`, enabling will disable :data:`level`.
@ -54,31 +54,31 @@ base class --- :class:`SCA_ILogicBrick`
.. attribute:: invert
Flag to set if this sensor activates on positive or negative events.
:type: boolean
.. attribute:: triggered
True if this sensor brick is in a positive state. (read-only).
:type: boolean
.. attribute:: positive
True if this sensor brick is in a positive state. (read-only).
:type: boolean
.. attribute:: pos_ticks
The number of ticks since the last positive pulse (read-only).
:type: int
.. attribute:: neg_ticks
The number of ticks since the last negative pulse (read-only).
:type: int
.. attribute:: status
@ -88,7 +88,7 @@ base class --- :class:`SCA_ILogicBrick`
:type: int
.. note::
This convenient attribute combines the values of triggered and positive attributes.
.. method:: reset()

View File

@ -28,7 +28,7 @@ base class --- :class:`SCA_ISensor`
:type: integer
.. note::
Only use this for "Single Axis" type sensors otherwise it will raise an error.
.. attribute:: hatValues

View File

@ -29,7 +29,7 @@ base class --- :class:`SCA_ISensor`
.. method:: getButtonStatus(button)
Get the mouse button status.
:arg button: The code that represents the key you want to get the state of, use one of :ref:`these constants<mouse-keys>`
:type button: int
:return: The state of the given key, can be one of :ref:`these constants<input-status>`

View File

@ -5,7 +5,7 @@ base class --- :class:`SCA_IController`
.. class:: SCA_PythonController(SCA_IController)
A Python controller uses a Python script to activate it's actuators,
A Python controller uses a Python script to activate it's actuators,
based on it's sensors.
.. attribute:: owner
@ -22,9 +22,9 @@ base class --- :class:`SCA_IController`
* When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts.
:type: string
.. note::
Once this is set the script name given for warnings will remain unchanged.
.. attribute:: mode

View File

@ -18,7 +18,7 @@ base class --- :class:`PyObjectPlus`
a dictionary containing the status of only the active mouse events. (read-only).
:type: dictionary {:ref:`keycode<mouse-keys>`::ref:`status<input-status>`, ...}
.. attribute:: position
The normalized x and y position of the mouse cursor.
@ -28,5 +28,5 @@ base class --- :class:`PyObjectPlus`
.. attribute:: visible
The visibility of the mouse cursor.
:type: boolean

View File

@ -21,7 +21,7 @@ base class --- :class:`SCA_IActuator`
:type: float, read-only.
Refer to the documentation of the generator types for the meaning of this value.
Refer to the documentation of the generator types for the meaning of this value.
.. attribute:: para2
@ -120,5 +120,5 @@ base class --- :class:`SCA_IActuator`
Generate negative-exponentially distributed numbers.
The half-life 'time' is characterized by half_life.
:type half_life: float

View File

@ -298,4 +298,3 @@ then copied :kbd:`Control-C`, usually to paste in the text editor or python cons
zooming the view for example isn't so useful to repeat so its excluded from the output.
To display *every* operator that runs see :ref:`Show All Operators <info_show_all_operators>`

View File

@ -297,13 +297,13 @@ Here are 3 ways of joining multiple strings into one string for writing.
This also applies to any area of your code that involves a lot of string joining.
``String addition`` -
``String addition`` -
this is the slowest option, *don't use if you can help it, especially when writing data in a loop*.
>>> file.write(str1 + " " + str2 + " " + str3 + "\n")
``String formatting`` -
``String formatting`` -
use this when you are writing string data from floats and ints.
>>> file.write("%s %s %s\n" % (str1, str2, str3))
@ -392,4 +392,3 @@ While developing a script it is good to time it to be aware of any changes in pe
# do something...
print("My Script Finished: %.4f sec" % (time.time() - time_start))

View File

@ -205,8 +205,8 @@ Support Overview
* - Usage
- :class:`bpy.types.MeshPolygon`
- :class:`bpy.types.MeshTessFace`
- :class:`bmesh.types.BMFace`
- :class:`bpy.types.MeshTessFace`
- :class:`bmesh.types.BMFace`
* - Import/Create
- Poor *(inflexible)*
- Good *(supported as upgrade path)*
@ -317,7 +317,7 @@ Example using :class:`bpy.types.EditBone` in armature editmode:
This is only possible in edit mode.
>>> bpy.context.object.data.edit_bones["Bone"].head = Vector((1.0, 2.0, 3.0))
>>> bpy.context.object.data.edit_bones["Bone"].head = Vector((1.0, 2.0, 3.0))
This will be empty outside of editmode.
@ -362,7 +362,7 @@ Examples using :class:`bpy.types.PoseBone` in object or pose mode:
.. code-block:: python
# Gets the name of the first constraint (if it exists)
bpy.context.object.pose.bones["Bone"].constraints[0].name
bpy.context.object.pose.bones["Bone"].constraints[0].name
# Gets the last selected pose bone (pose mode only)
bpy.context.active_pose_bone
@ -407,7 +407,7 @@ This can cause bugs when you add some data (normally imported) then reference it
.. code-block:: python
bpy.data.meshes.new(name=meshid)
# normally some code, function calls...
bpy.data.meshes[meshid]
@ -417,7 +417,7 @@ Or with name assignment...
.. code-block:: python
obj.name = objname
# normally some code, function calls...
obj = bpy.data.meshes[objname]
@ -437,12 +437,12 @@ this way you don't run this risk of referencing existing data from the blend fil
# typically declared in the main body of the function.
mesh_name_mapping = {}
mesh = bpy.data.meshes.new(name=meshid)
mesh_name_mapping[meshid] = mesh
# normally some code, or function calls...
# use own dictionary rather than bpy.data
mesh = mesh_name_mapping[meshid]

View File

@ -125,7 +125,7 @@ its attributes can be accessed much like you would change a setting using the gr
In fact, the tooltip for each button also displays the Python attribute
which can help in finding what settings to change in a script.
>>> bpy.data.objects[0].name
>>> bpy.data.objects[0].name
'Camera'
>>> bpy.data.scenes["Scene"]
@ -267,7 +267,7 @@ Operator Poll()
^^^^^^^^^^^^^^^
Many operators have a "poll" function which may check that the cursor
is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
When an operator's poll function fails within Python, an exception is raised.
For example, calling ``bpy.ops.view3d.render_border()`` from the console raises the following error:
@ -477,4 +477,3 @@ Using Low-Level Functions:
fcu_z.keyframe_points.add(2)
fcu_z.keyframe_points[0].co = 10.0, 0.0
fcu_z.keyframe_points[1].co = 20.0, 1.0

View File

@ -320,4 +320,3 @@ enable the CMake build option ``WITH_PYTHON_SAFETY``.
This enables data tracking which makes data access about 2x slower
which is why the option isn't enabled in release builds.

View File

@ -133,7 +133,7 @@ string NamedNestedSampleStats::full_report(int indent_level, uint64_t total_samp
sum_seconds,
self_percent,
self_seconds);
string result = indent + info;
string result = indent + info;
sort(entries.begin(), entries.end(), namedTimeSampleEntryComparator);
foreach(NamedNestedSampleStats& entry, entries) {