(→A Simple Python Property Class) |
|||
| Line 1: | Line 1: | ||
= Introduction = | = Introduction = | ||
| + | |||
| + | This is documentation for the future python property class system. | ||
= A Simple Python Property Class = | = A Simple Python Property Class = | ||
| Line 17: | Line 19: | ||
CEL_IMPLEMENT_FACTORY(RotatePropClass,"pcrotate") | CEL_IMPLEMENT_FACTORY(RotatePropClass,"pcrotate") | ||
| + | |||
| + | </source> | ||
| + | |||
| + | = Receiving Messages = | ||
| + | |||
| + | <source lang="python"> | ||
| + | |||
| + | |||
| + | class RotatePropClass(pyPcCommon,pyMessageReceiver): | ||
| + | def __init__(self,oreg): | ||
| + | pyPcCommon.__init__(self,oreg) | ||
| + | PhysicalLayer.CallbackEveryFrame(self,CEL_EVENT_PRE) | ||
| + | @pycel.message("cel.foo.bar") | ||
| + | def DoBar(self,sender,args): | ||
| + | return 0 | ||
| + | def TickEveryFrame(self): | ||
| + | mov = celMesh(self.GetEntity()).Mesh.GetMovable() | ||
| + | rot = csYRotMatrix3(0.1) | ||
| + | mov.Transform(rot) | ||
| + | mov.UpdateMove() | ||
| + | |||
| + | |||
| + | </source> | ||
| + | |||
| + | |||
| + | = Sending Messages = | ||
| + | |||
| + | <source lang="python"> | ||
| + | |||
| + | |||
| + | entity.MessageChannel.CreateMessageDispatcher(self,"cel.foo.bar").SendMessage(pars) | ||
| + | |||
| + | or | ||
| + | |||
| + | entity.MessageChannel.SendMessage("cel.foo.bar",self,pars) | ||
| + | |||
</source> | </source> | ||
Revision as of 21:59, 11 February 2008
Contents |
Introduction
This is documentation for the future python property class system.
A Simple Python Property Class
from pycel import * class RotatePropClass(pyPcCommon): def __init__(self,oreg): pyPcCommon.__init__(self,oreg) PhysicalLayer.CallbackEveryFrame(self,CEL_EVENT_PRE) def TickEveryFrame(self): mov = celMesh(self.GetEntity()).Mesh.GetMovable() rot = csYRotMatrix3(0.1) mov.Transform(rot) mov.UpdateMove() CEL_IMPLEMENT_FACTORY(RotatePropClass,"pcrotate")
Receiving Messages
class RotatePropClass(pyPcCommon,pyMessageReceiver): def __init__(self,oreg): pyPcCommon.__init__(self,oreg) PhysicalLayer.CallbackEveryFrame(self,CEL_EVENT_PRE) @pycel.message("cel.foo.bar") def DoBar(self,sender,args): return 0 def TickEveryFrame(self): mov = celMesh(self.GetEntity()).Mesh.GetMovable() rot = csYRotMatrix3(0.1) mov.Transform(rot) mov.UpdateMove()
Sending Messages
entity.MessageChannel.CreateMessageDispatcher(self,"cel.foo.bar").SendMessage(pars) or entity.MessageChannel.SendMessage("cel.foo.bar",self,pars)
