Skip to content

Commit f149fb4

Browse files
committed
direct: big formatting changes for the benefit of API reference
Part of the effort to move the API reference to Sphinx, see panda3d/panda3d-docs#21
1 parent ffeb893 commit f149fb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+961
-758
lines changed

direct/src/actor/Actor.py

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -104,45 +104,43 @@ def __init__(self, models=None, anims=None, other=None, copy=True,
104104
lodNode = None, flattenable = True, setFinal = False,
105105
mergeLODBundles = None, allowAsyncBind = None,
106106
okMissing = None):
107-
"""__init__(self, string | string:string{}, string:string{} |
108-
string:(string:string{}){}, Actor=None)
109-
Actor constructor: can be used to create single or multipart
107+
"""Actor constructor: can be used to create single or multipart
110108
actors. If another Actor is supplied as an argument this
111109
method acts like a copy constructor. Single part actors are
112110
created by calling with a model and animation dictionary
113-
(animName:animPath{}) as follows:
111+
``(animName:animPath{})`` as follows::
114112
115-
a = Actor("panda-3k.egg", {"walk":"panda-walk.egg" \
113+
a = Actor("panda-3k.egg", {"walk":"panda-walk.egg",
116114
"run":"panda-run.egg"})
117115
118-
This could be displayed and animated as such:
116+
This could be displayed and animated as such::
119117
120118
a.reparentTo(render)
121119
a.loop("walk")
122120
a.stop()
123121
124122
Multipart actors expect a dictionary of parts and a dictionary
125-
of animation dictionaries (partName:(animName:animPath{}){}) as
126-
below:
123+
of animation dictionaries ``(partName:(animName:animPath{}){})``
124+
as below::
127125
128126
a = Actor(
129127
130128
# part dictionary
131-
{"head":"char/dogMM/dogMM_Shorts-head-mod", \
132-
"torso":"char/dogMM/dogMM_Shorts-torso-mod", \
133-
"legs":"char/dogMM/dogMM_Shorts-legs-mod"}, \
129+
{"head": "char/dogMM/dogMM_Shorts-head-mod",
130+
"torso": "char/dogMM/dogMM_Shorts-torso-mod",
131+
"legs": "char/dogMM/dogMM_Shorts-legs-mod"},
134132
135133
# dictionary of anim dictionaries
136-
{"head":{"walk":"char/dogMM/dogMM_Shorts-head-walk", \
137-
"run":"char/dogMM/dogMM_Shorts-head-run"}, \
138-
"torso":{"walk":"char/dogMM/dogMM_Shorts-torso-walk", \
139-
"run":"char/dogMM/dogMM_Shorts-torso-run"}, \
140-
"legs":{"walk":"char/dogMM/dogMM_Shorts-legs-walk", \
141-
"run":"char/dogMM/dogMM_Shorts-legs-run"} \
134+
{"head":{"walk": "char/dogMM/dogMM_Shorts-head-walk",
135+
"run": "char/dogMM/dogMM_Shorts-head-run"},
136+
"torso":{"walk": "char/dogMM/dogMM_Shorts-torso-walk",
137+
"run": "char/dogMM/dogMM_Shorts-torso-run"},
138+
"legs":{"walk": "char/dogMM/dogMM_Shorts-legs-walk",
139+
"run": "char/dogMM/dogMM_Shorts-legs-run"}
142140
})
143141
144142
In addition multipart actor parts need to be connected together
145-
in a meaningful fashion:
143+
in a meaningful fashion::
146144
147145
a.attach("head", "torso", "joint-head")
148146
a.attach("torso", "legs", "joint-hips")
@@ -151,7 +149,7 @@ def __init__(self, models=None, anims=None, other=None, copy=True,
151149
# ADD LOD COMMENT HERE!
152150
#
153151
154-
Other useful Actor class functions:
152+
Other useful Actor class functions::
155153
156154
#fix actor eye rendering
157155
a.drawInFront("joint-pupil?", "eyes*")
@@ -1135,7 +1133,7 @@ def stopJoint(self, partName, jointName, lodName="lodRoot"):
11351133
def getJoints(self, partName = None, jointName = '*', lodName = None):
11361134
""" Returns the list of all joints, from the named part or
11371135
from all parts, that match the indicated jointName. The
1138-
jointName may include pattern characters like *. """
1136+
jointName may include pattern characters like \\*. """
11391137

11401138
joints=[]
11411139
pattern = GlobPattern(jointName)
@@ -2439,15 +2437,15 @@ def actorInterval(self, *args, **kw):
24392437
return ActorInterval.ActorInterval(self, *args, **kw)
24402438

24412439
def getAnimBlends(self, animName=None, partName=None, lodName=None):
2442-
""" Returns a list of the form:
2443-
2444-
[ (lodName, [(animName, [(partName, effect), (partName, effect), ...]),
2445-
(animName, [(partName, effect), (partName, effect), ...]),
2446-
...]),
2447-
(lodName, [(animName, [(partName, effect), (partName, effect), ...]),
2448-
(animName, [(partName, effect), (partName, effect), ...]),
2449-
...]),
2450-
... ]
2440+
"""Returns a list of the form::
2441+
2442+
[ (lodName, [(animName, [(partName, effect), (partName, effect), ...]),
2443+
(animName, [(partName, effect), (partName, effect), ...]),
2444+
...]),
2445+
(lodName, [(animName, [(partName, effect), (partName, effect), ...]),
2446+
(animName, [(partName, effect), (partName, effect), ...]),
2447+
...]),
2448+
... ]
24512449
24522450
This list reports the non-zero control effects for each
24532451
partName within a particular animation and LOD. """

direct/src/cluster/ClusterClient.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""ClusterClient: Master for mutli-piping or PC clusters. """
1+
"""ClusterClient: Master for multi-piping or PC clusters."""
22

33
from panda3d.core import *
44
from .ClusterMsgs import *
@@ -8,6 +8,7 @@
88
from direct.task import Task
99
import os
1010

11+
1112
class ClusterClient(DirectObject.DirectObject):
1213
notify = DirectNotifyGlobal.directNotify.newCategory("ClusterClient")
1314
MGR_NUM = 1000000

direct/src/cluster/ClusterConfig.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11

22
from .ClusterClient import *
33

4-
# A dictionary of information for various cluster configurations.
5-
# Dictionary is keyed on cluster-config string
6-
# Each dictionary contains a list of display configurations, one for
7-
# each display in the cluster
8-
# Information that can be specified for each display:
9-
# display name: Name of display (used in Configrc to specify server)
10-
# display type: Used to flag client vs. server
11-
# pos: positional offset of display's camera from main cluster group
12-
# hpr: orientation offset of display's camera from main cluster group
13-
# focal length: display's focal length (in mm)
14-
# film size: display's film size (in inches)
15-
# film offset: offset of film back (in inches)
16-
# Note: Note, this overrides offsets specified in DirectCamConfig.py
17-
# For now we only specify frustum for first display region of configuration
18-
# TODO: Need to handle multiple display regions per cluster node and to
19-
# generalize to non cluster situations
20-
4+
#: A dictionary of information for various cluster configurations.
5+
#: Dictionary is keyed on cluster-config string
6+
#: Each dictionary contains a list of display configurations, one for
7+
#: each display in the cluster
8+
#:
9+
#: Information that can be specified for each display:
10+
#:
11+
#: - display name: Name of display (used in Configrc to specify server)
12+
#: - display type: Used to flag client vs. server
13+
#: - pos: positional offset of display's camera from main cluster group
14+
#: - hpr: orientation offset of display's camera from main cluster group
15+
#: - focal length: display's focal length (in mm)
16+
#: - film size: display's film size (in inches)
17+
#: - film offset: offset of film back (in inches)
18+
#:
19+
#: Note: this overrides offsets specified in DirectCamConfig.py
20+
#: For now we only specify frustum for first display region of configuration
21+
#:
22+
#: TODO: Need to handle multiple display regions per cluster node and to
23+
#: generalize to non cluster situations
2124
ClientConfigs = {
2225
'single-server': [{'display name': 'display0',
2326
'display mode': 'client',

direct/src/controls/ControlManager.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
from direct.task import Task
1616
from panda3d.core import ConfigVariableBool
1717

18-
CollisionHandlerRayStart = 4000.0 # This is a hack, it may be better to use a line instead of a ray.
18+
# This is a hack, it may be better to use a line instead of a ray.
19+
CollisionHandlerRayStart = 4000.0
20+
1921

2022
class ControlManager:
2123
notify = DirectNotifyGlobal.directNotify.newCategory("ControlManager")
@@ -52,14 +54,14 @@ def __str__(self):
5254
return 'ControlManager: using \'%s\'' % self.currentControlsName
5355

5456
def add(self, controls, name="basic"):
55-
"""
56-
controls is an avatar control system.
57-
name is any key that you want to use to refer to the
58-
the controls later (e.g. using the use(<name>) call).
57+
"""Add a control instance to the list of available control systems.
5958
60-
Add a control instance to the list of available control systems.
59+
Args:
60+
controls: an avatar control system.
61+
name (str): any key that you want to use to refer to the controls
62+
later (e.g. using the use(<name>) call).
6163
62-
See also: use().
64+
See also: :meth:`use()`.
6365
"""
6466
assert self.notify.debugCall(id(self))
6567
assert controls is not None
@@ -77,15 +79,14 @@ def get(self, name):
7779
return self.controls.get(name)
7880

7981
def remove(self, name):
80-
"""
81-
name is any key that was used to refer to the
82-
the controls when they were added (e.g.
83-
using the add(<controls>, <name>) call).
82+
"""Remove a control instance from the list of available control
83+
systems.
8484
85-
Remove a control instance from the list of
86-
available control systems.
85+
Args:
86+
name: any key that was used to refer to the controls when they were
87+
added (e.g. using the add(<controls>, <name>) call).
8788
88-
See also: add().
89+
See also: :meth:`add()`.
8990
"""
9091
assert self.notify.debugCall(id(self))
9192
oldControls = self.controls.pop(name,None)
@@ -108,7 +109,7 @@ def use(self, name, avatar):
108109
109110
Use a previously added control system.
110111
111-
See also: add().
112+
See also: :meth:`add()`.
112113
"""
113114
assert self.notify.debugCall(id(self))
114115
if __debug__ and hasattr(self, "ignoreUse"):

direct/src/controls/DevWalker.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
DevWalker.py is for avatars.
33
44
A walker control such as this one provides:
5-
- creation of the collision nodes
6-
- handling the keyboard and mouse input for avatar movement
7-
- moving the avatar
5+
6+
- creation of the collision nodes
7+
- handling the keyboard and mouse input for avatar movement
8+
- moving the avatar
89
910
it does not:
10-
- play sounds
11-
- play animations
1211
13-
although it does send messeges that allow a listener to play sounds or
12+
- play sounds
13+
- play animations
14+
15+
although it does send messages that allow a listener to play sounds or
1416
animations based on walker events.
1517
"""
1618

direct/src/controls/GhostWalker.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
GhostWalker.py is for avatars.
33
44
A walker control such as this one provides:
5-
- creation of the collision nodes
6-
- handling the keyboard and mouse input for avatar movement
7-
- moving the avatar
5+
6+
- creation of the collision nodes
7+
- handling the keyboard and mouse input for avatar movement
8+
- moving the avatar
89
910
it does not:
10-
- play sounds
11-
- play animations
1211
13-
although it does send messeges that allow a listener to play sounds or
12+
- play sounds
13+
- play animations
14+
15+
although it does send messages that allow a listener to play sounds or
1416
animations based on walker events.
1517
"""
1618

direct/src/controls/GravityWalker.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
GravityWalker.py is for avatars.
33
44
A walker control such as this one provides:
5-
- creation of the collision nodes
6-
- handling the keyboard and mouse input for avatar movement
7-
- moving the avatar
5+
6+
- creation of the collision nodes
7+
- handling the keyboard and mouse input for avatar movement
8+
- moving the avatar
89
910
it does not:
10-
- play sounds
11-
- play animations
1211
13-
although it does send messeges that allow a listener to play sounds or
12+
- play sounds
13+
- play animations
14+
15+
although it does send messages that allow a listener to play sounds or
1416
animations based on walker events.
1517
"""
1618
from direct.directnotify.DirectNotifyGlobal import directNotify

direct/src/controls/InputState.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,16 @@ def releaseInputs(self, name):
135135

136136
def watch(self, name, eventOn, eventOff, startState=False, inputSource=None):
137137
"""
138-
This returns a token; hold onto the token and call token.release() when you
139-
no longer want to watch for these events.
140-
141-
# set up
142-
token = inputState.watch('forward', 'w', 'w-up', inputSource=inputState.WASD)
143-
...
144-
# tear down
145-
token.release()
138+
This returns a token; hold onto the token and call token.release() when
139+
you no longer want to watch for these events.
140+
141+
Example::
142+
143+
# set up
144+
token = inputState.watch('forward', 'w', 'w-up', inputSource=inputState.WASD)
145+
...
146+
# tear down
147+
token.release()
146148
"""
147149
assert self.debugPrint(
148150
"watch(name=%s, eventOn=%s, eventOff=%s, startState=%s)"%(
@@ -191,15 +193,16 @@ def force(self, name, value, inputSource):
191193
"""
192194
Force isSet(name) to return 'value'.
193195
194-
This returns a token; hold onto the token and call token.release() when you
195-
no longer want to force the state.
196+
This returns a token; hold onto the token and call token.release() when
197+
you no longer want to force the state.
196198
197-
example:
198-
# set up
199-
token=inputState.force('forward', True, inputSource='myForwardForcer')
200-
...
201-
# tear down
202-
token.release()
199+
Example::
200+
201+
# set up
202+
token = inputState.force('forward', True, inputSource='myForwardForcer')
203+
...
204+
# tear down
205+
token.release()
203206
"""
204207
token = InputStateForceToken(self)
205208
self._token2forceInfo[token] = (name, inputSource)

direct/src/controls/NonPhysicsWalker.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
NonPhysicsWalker.py is for avatars.
33
44
A walker control such as this one provides:
5-
- creation of the collision nodes
6-
- handling the keyboard and mouse input for avatar movement
7-
- moving the avatar
5+
6+
- creation of the collision nodes
7+
- handling the keyboard and mouse input for avatar movement
8+
- moving the avatar
89
910
it does not:
10-
- play sounds
11-
- play animations
1211
13-
although it does send messeges that allow a listener to play sounds or
12+
- play sounds
13+
- play animations
14+
15+
although it does send messages that allow a listener to play sounds or
1416
animations based on walker events.
1517
"""
1618

direct/src/controls/ObserverWalker.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
ObserverWalker.py is for avatars.
33
44
A walker control such as this one provides:
5-
- creation of the collision nodes
6-
- handling the keyboard and mouse input for avatar movement
7-
- moving the avatar
5+
6+
- creation of the collision nodes
7+
- handling the keyboard and mouse input for avatar movement
8+
- moving the avatar
89
910
it does not:
10-
- play sounds
11-
- play animations
1211
13-
although it does send messeges that allow a listener to play sounds or
12+
- play sounds
13+
- play animations
14+
15+
although it does send messages that allow a listener to play sounds or
1416
animations based on walker events.
1517
"""
1618

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy