Plasma Python API

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Plasma Python API

Postby diafero » Sat Mar 27, 2010 11:35 am

Quite some time ago I got a script from the web and adapted it to print all functions, classes and their methods of the Plasma module, including the help text Cyan wrote for them (of course this can be used for other modules, too).
Now most of this documentation could also be guessed from the name of the functions, but in some cases there's additional useful information. Plus, this is the actual list of available classes, whereas Plasma.py is just a dummy. For example, the ptCCRMgr does not actually exist, while PtLoadAvatarModel is not even mentioned in Plasma.py.
I also extended the script to print properties, but there are only two classes having those - still, this is information not available in Plasma.py.

Here's an example:
Code: Select all
     [Class: ptSceneobject]
         Method: addKey (Params: key;Mostly used internally.;Add another sceneobject ptKey)
         Method: animate
         Property: avatar
         Method: avatarVelocity
         Property: draw
         Method: fastForwardAttachedResponder (Params: state)
         Method: findObject (Params: name;Find a particular object in just the sceneobjects that are attached)
         Method: getKey (Get the ptKey of this sceneobject;If there are more then one attached, get the first one)
         Method: getLocalToParent
         Method: getLocalToWorld (Returns ptMatrix44 of the local to world transform for this sceneobject;- If there is more than one sceneobject attached, returns just the first one)
         Method: getName (Returns the name of the sceneobject (Max name);- If there are more than one sceneobject attached, return just the first one)
         Method: getParentToLocal
         Method: getPythonMods (Returns list of ptKeys of the python modifiers attached to this sceneobject)
         Method: getResponderState
         Method: getResponders (Returns list of ptKeys of the responders attached to this sceneobject)
         Method: getSoundIndex (Params: sndComponentName;Get the index of the requested sound component)
         Method: getWorldToLocal (Returns ptMatrix44 of the world to local transform for this sceneobject;- If there is more than one sceneobject attached, returns just the first one)
         Method: isAvatar
         Method: isHuman
         Method: isLocallyOwned (Returns true(1) if this object is locally own by this client;or returns false(0) if it is not or don't know)
         Method: netForce (Params: forceFlag;Specify whether this object needs to use messages that are forced to the network;- This is to be used if your Python program is running on only one client;Such as a game master, only running on the client that owns a particular object;- Setting the netForce flag on a sceneobject will also set the netForce flag on;its draw, physics, avatar, particle objects)
         Property: particle
         Property: physics
         Method: playAnimNamed (Params: animName)
         Method: popCamera (Params: avKey)
         Method: popCutsceneCamera (Params: avKey;Pop the camera stack and go back to previous camera.)
         Method: position
         Method: pushCamera (Params: avKey)
         Method: pushCameraCut (Params: avKey)
         Method: pushCutsceneCamera (Params: cutFlag,avKey;Switch to this object (assuming that it is actually a camera))
         Method: rewindAnimNamed (Params: animName)
         Method: right
         Method: runAttachedResponder (Params: state)
         Method: setSoundFilename (Params: index, filename, isCompressed;Sets the sound attached to this sceneobject to use the specified sound file.)
         Method: setTransform (Params: local2world,world2local)
         Method: stopAnimNamed (Params: animName)
         Method: up
         Method: view


Would this be useful for anyone and perhaps worth uploading somewhere onto the wiki?
I prefer e-mails to "diafero arcor de" (after adding the at and the dot) over PMs.

"Many people's horizon is a circle with a radius of zero. They call it their point of view."

Deep Island Shard | Offline KI
diafero
Deep Island Admin
 
Posts: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Plasma Python API

Postby Tsar Hoikas » Sat Mar 27, 2010 11:45 am

If you can sanely wikify it, then go for it! I'd be glad to help out.

I have a copy of similar documentation, somewhere... Might have been lost in one of my HD wipes though :\
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Plasma Python API

Postby diafero » Sat Mar 27, 2010 11:47 am

What do you mean by "sanely wikifying"? I could replace 4 spaces with a "*" to get a loooong dotted list. And if I replace Method by '''Method''' and so on, it could actually be quite readable.

EDIT: Here you go: http://www.guildofwriters.com/wiki/Plasma_Python_API
Feel free to put it into a different section on the main page, I wasn't sure where to add it
I prefer e-mails to "diafero arcor de" (after adding the at and the dot) over PMs.

"Many people's horizon is a circle with a radius of zero. They call it their point of view."

Deep Island Shard | Offline KI
diafero
Deep Island Admin
 
Posts: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Plasma Python API

Postby Tsar Hoikas » Sat Mar 27, 2010 12:10 pm

Oh, sorry, that's a pretty bad habit of mine.

Sanely wikifying means to make it look good on a wiki. Not necessarily just readable, but for it to be readable and to have a logical format, such that it is easy to navigate and understand. Back on the old COBBS Wiki, the formatting of pages was absolutely horrendous making it impossible to glean any useful information from it... For example, all of the PRP Objects were on one page.

Here is a sanely wikified page
This is not so good
The bad
The Ugly

In the "bad" cases, the formating or lack thereof impedes the user's understanding of the page. That's something that we avoid by sanely wikifying a page.
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Plasma Python API

Postby diafero » Sat Mar 27, 2010 1:18 pm

Ok, I guess mine is "ugly" then and the right way would be to have one caption (level 2 or 3) per class?
I prefer e-mails to "diafero arcor de" (after adding the at and the dot) over PMs.

"Many people's horizon is a circle with a radius of zero. They call it their point of view."

Deep Island Shard | Offline KI
diafero
Deep Island Admin
 
Posts: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Plasma Python API

Postby Tsar Hoikas » Sat Mar 27, 2010 3:46 pm

I'm not really sure... It's okay if the page starts out as ugly, you can always experiment and improve things incrementally. That's what a wiki is for after all :)
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Re: Plasma Python API

Postby Deledrius » Sat Mar 27, 2010 3:48 pm

Yeah, that is a very nice list, but it's way too big to not have a table of contents/structure.

Awesome resource though!
User avatar
Deledrius
Gehn Shard Admin
 
Posts: 1377
Joined: Mon Oct 01, 2007 1:21 pm

Re: Plasma Python API

Postby diafero » Sun Mar 28, 2010 5:52 am

Glad you like it :) . How do you think such a structure should look like? After all, this is already the shortest summary of an API - functions, classes with methods & properties, and short descriptions. And since it's on one page, you can use Ctrl+F to quickly find the function or class you are interested in, or to hopefully find a function doing what you need.

All I can think of is to use wiki headers for the class names, which would give us a long "table of contents" box at the top listing all classes, thereby adding some structure.
I prefer e-mails to "diafero arcor de" (after adding the at and the dot) over PMs.

"Many people's horizon is a circle with a radius of zero. They call it their point of view."

Deep Island Shard | Offline KI
diafero
Deep Island Admin
 
Posts: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Plasma Python API

Postby Chacal » Sun Mar 28, 2010 9:52 am

UML Class diagram?
Chacal


"The weak can never forgive. Forgiveness is an attribute of the strong."
-- Mahatma Gandhi
User avatar
Chacal
 
Posts: 2508
Joined: Tue Nov 06, 2007 2:45 pm
Location: Quebec, Canada

Re: Plasma Python API

Postby Tsar Hoikas » Sun Mar 28, 2010 3:15 pm

diafero wrote:Glad you like it :) . How do you think such a structure should look like? After all, this is already the shortest summary of an API - functions, classes with methods & properties, and short descriptions. And since it's on one page, you can use Ctrl+F to quickly find the function or class you are interested in, or to hopefully find a function doing what you need.

All I can think of is to use wiki headers for the class names, which would give us a long "table of contents" box at the top listing all classes, thereby adding some structure.


Perhaps something like

Code: Select all
=ptClassName=
==Methods==
blah(arg0, ...): A description, if it exists...

==Properties==
avatar


Though your coded doesn't list method arguments in the function... It uses a params list :\ I guess params and the each parameter could be a bulleted list, if that would make it easier.
Image
Tsar Hoikas
Councilor of Technical Direction
 
Posts: 2180
Joined: Fri Nov 16, 2007 9:45 pm
Location: South Georgia

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests