Page 1 of 1

Python/Plasma integration (New developer getting started)

PostPosted: Mon Jul 13, 2015 10:45 pm
by dybs
I'm starting to look through the Plasma and MOUL scripts from Github, but I'm a tad bit overwhelmed getting started. I've managed to get all the libraries and SDKs installed, and I can build and run the plClient utility, but I'm having some difficulty figuring out how the Python scripts integrate with the Plasma code. Could someone please give me a couple of pointers on how best to familiarize myself with the code (short of just reading it one file at a time)? I've seen wiki posts on how to get everything to compile and run, and some posts on age development, but right now I'm mostly interested in understanding the general structure of the code. Any guidance would be greatly appreciated.

(FYI, I have several years experience programming in C# and C++, a some rudimentary Python experience - I've just never dealt with a project quite this large before.)

Re: Python/Plasma integration (New developer getting started

PostPosted: Tue Jul 14, 2015 10:31 am
by Tsar Hoikas
That's a good question. I'd suggest grabbing a copy of PRPShop if you haven't already--it helps to be able to view real-world example of the data :)

Inside the engine, there is a class called plPythonFileMod that can be attached to many objects. Like it says, it specifies a Python file name. It also has a list of attributes that matches up with the "ptAttrib"s that you see at the top of the Python file. In Cyan's 3ds Max plugin, those attributes are interpreted and allow the artist to input POD or object references, as appropriate. At runtime, they are filled in with those values. The attributes are all defined in PlasmaTypes.py, but that code is kind of nasty and unpythonic.

There are a handful of callbacks that are defined in the engine and executed during plPythonFileMod::MsgReceive. The most interesting of those are:
  • OnServerInitComplete - runs whenever the initial age state is received from the server ([H'uru ONLY] or the modifier is loaded and the age state is already loaded)
  • OnFirstUpdate - when the first frame is rendered in the age AND the modifier is loaded
  • OnSDLNotify - when a state variable changes -- you must register for this notification. xAgeSDLBoolShowHide.py is a simple example of this
  • OnNotify - when a plNotifyMsg is received by the modifier. The events correspond to the message's proEventData (yikes). It's much easier to compare the id with attribute ids.
There are of course a lot more than this, but those are the ones that are the most used by far.

I hope this helped :)

This is the biggest project I've ever worked on as well...