|
Poser Remote Proceedure Call (PRPC) Project
| |
Downloads |
Note: This project will only work with Windows versions of Poser that have Python support (ProPack, Poser5 and Poser6) |
Security Note |
Introduction
The basic results of this project allow you to load or save Poser library content to or from an active Poser session using other Windows applications
like Windows Explorer, SenoSoft's P3dO Explorer and Dizzi's Advanced Library.
Shown here is a screenshot where I am about to load a pose file into Poser using Windows Explorer.
This project started with my frustration with Poser's library interface. I have many directories that contain
large numbers of poser files and using Poser's library interface was very slow
and cumbersome. I began to use SenoSoft's P3dO Explorer to browse my Poser
libraries so I could quickly find the directories where a specific file was
located, then I would go to that directory using the Poser library interface and
load it. This was not a perfect solution, but it did speed up finding files.
I kept thinking how nice it would be to bypass Poser's library interface altogether. Then it dawned on me that I could use the networking features of Python
(the programming language in Poser ProPack, Poser5 and Poser6) to load files directly from P3dO Explorer.
Poser Remote Proceedure Call Server Daemon (PRPCd)
I figured out a way to do this by writing a 'server daemon' in Python that runs in Poser. Now I hardly ever use Poser's library interface for loading content.
The method developed should work with any external Windows program that supports the right-click 'Send To' context menu.
You can load content from any folder/directory, even outside of Poser's runtime folder. You can also create Window's "shortcuts" (.lnk files) that point to Poser content and the content can be loaded into Poser. You can select multiple files and have them all loaded into Poser at the same time and while they're loading in Poser you can keep browsing for more files.
After the initial release of this project, I began to get frustrated when I wanted to 'Save' Poser content because I still had to use the Poser library interface for saving. So, I extended the server daemon to allow saving of Poser content (although with quite a few limitations).
Client Modules
An added bonus that comes from this method of loading Poser content is that a file can be pre-processed before loading. The server daemon supports 'client modules' that can register for filenames based on their type (pose, character, lights, ...). When the server daemon gets a filename of a registered type, it will pass it to the client module. The client module can then do anything it wants with it.
How it works
There are two main components of this method.
- A python script (PRPCd.py) running in Poser to create a 'Server Daemon'.
- This server daemon listens for an incomming tcp/ip connection, expecting to receive the filename of some Poser library content.
- When it receives a filename it checks to see if it exists, if it is a file and if the file extension is Poser library content (pz2, p2z, cr2, ....).
- If So it assumes a 'Load Request', it then it asks Poser to load the file by calling one of Poser's built-in Poser Python library load methods.
- If Not, the server daemon checks to see if the filename is a directory or folder.
- If So it assumes a 'Save Request', it then asks you what type of content you want to save (Pose, Character, Hand,...)
- Then it presents a 'Save As' dialog window set to the directory or folder that was sent to the server daemon for you to select a filename for the Poser content you wish to save.
- It then asks Poser to save the file by calling one of Poser's built-in library save methods.
- A way to send a filename to the listening 'Server Daemon' (PRPCd.py) in Poser.
- An external Windows application needs to send the server daemon a filename over a tcp/ip connection.
- I provide a utility (snd2sock.exe) which and be used to create a generic "Send To" entry in Window's right-click context menu for sending filenames
to the server daemon running in Poser. This is how library content loading is accomplished using Windows Exporer. Any other application that supports
the generic right-click 'Send To' menu can also use this method.
- Or, an application can call the above utility with the filename as a parameter.
- Or, an application can open a tcp/ip socket and send the filename to the server daemon directly itself.
Installation, Usage and Options
Installation
Following are instructions for an installation of the basic right-click 'Send To' method.
- Download the most recent public version and unzip it's contents to a directory/folder of your choice.
A good place would be somewhere in Poser's "poserScripts" directory/folder.
- Start up Windows Explorer and navigate to the directory/folder you choose in the previous step.
- Create a "Send To" entry in Window's right-click context menu for sending filenames to Poser for loading using the below procedure.
- Double click (to run) the file named "snd2sock". You will see a console window open describing the "snd2sock" utility and it's usage,
followed by a prompt asking if you wish to proceed with the setup.
- Press the "Y" key to continue with the setup. You should now see some informational messages. The last one should say "Link created."
- Done! You should now have a new entry named 'ip127.0.0.1port49160' in your Windows right-click 'Send To' context menu.
Usage
Following are brief basic usage instructions for using the Windows Explorer 'Send To' method.
- Start up Poser.
- Run the server daemon script (PRPCd.py).
- Click on Poser's 'File' menu.
- Select 'Run python script...'
- Navigate to where you unzipped the files during the installation of this package.
- Double-click (to open/run) the PRPCd.py file.
You should now see the 'Poser Remote Procedure Call Daemon' window on top of your Poser session.
If you want you can minimize the server daemon's window to the task bar and it will still run properly.
- Run Windows Explorer.
- Navagate to some content in your Poser runtime library.
- Load a file into Poser.
- Right-click once on a file you wish to load.
- Click on 'Send To'
- Then click on 'ip127.0.0.1port49160'.
The file should have loaded into Poser.
- Save library content from Poser.
- Right-click once on a directory or folder you wish to save content into.
- Click on 'Send To'
- Then click on 'ip127.0.0.1port49160'.
The server daemon will initiate a save operation as described in the above 'How it works' section.
Options
Following is a basic explanation of the options visible on the server daemon interface.
- Enable multi-tasking python script mode
- Leave this option unchecked to maintain compatibility with most python scripts.
If new python script is run and this option is unchecked, all currently running python scripts (including the server daemon) will stop running until the until the new script finishes execution.
- If this option is checked, then all python scripts will be running at the same time.
Some python scripts require this type mode to function properly.
- (todo) Here is a list of python scripts that have been categorized as to what mode they need. (link to be added later)
- Enable remote python script execution
- Enabling this option allows the server daemon to run python scripts whose filename was sent by an external application (like Windows Explorer, P3dO, Advanced Library).
- Because running a malicous python could have detrimental results, this is left unchecked as an extra (extremely conservative) security feature.
- Enable (check) this option if you wish to execute python scripts thru and external application.
- Please read the "Security Note" further down on this page.
- with confirmation
- When enabled (checked) this option will prompt you to confirm the running of a python script whose filename was sent to the server daemon by an external application.
- Enabling this option makes you to confirm any python script before the server daemon runs it. It's a kind of "Sanity Check", to give you peace of mind.
Downloads
The most of this work is released under the GNU General Public License
Some supporting python classes are released under the GNU Lessor Public License
The following links will take you to SourceForge.net, where all files for this project are located.
Applications that use or support PRPC
Well, the Windows Explorer method is not really that friendly. You have to visually find the filename that corresponds to
the image file (.png) that you see. You have to avoid any .rsr files and it can be frustrating to have to pay attention to all
this when all you really want to do is load content into Poser.
I know of two windows applications that make specific use of this project's results. They are a much better alternative to using Windows Explorer.
Both of these applications are able to display only the image (.png or .rsr) and send the real content filename to the server daemon. They both have
other great features and I highly recommend you use one or both of them.
- P3dO Explorer by SenoSoft
- This program offers many advantages to other file managers/viewers when it comes to Poser library content.
SenoSoft offers a 'Free' and a 'Pro' version of P3dO Explorer, both versions fully support this Poser content loading method via the
PoserPython Plugin they distribute (separate free download). P3dO has a highly customizable
interface here is a screenshot (70Kb) showing my favorite (although simple) setup with Poser 6 and P3dO.
- Setup and usage is described in the PoserPython help file contained in the 'Poser plugin pack'.
The PoserPython plugin calls 'snd2sock.exe' directly, so you don't need to setup the 'Send To' method described earlier on this page. It contains two
versions of the server daemon. One does not support remote python script execution (see my security note) and the other includes support.
- Advanced Library by Dizzi
- Dizzi has created a unique library management tool for Poser library content. It is extremely useful in organizing and
categorizing content without changing the original Poser runtime structure. This application is free.
- Setup and usage is described at his web site.
Advanced Library sends filenames directly to the server daemon, so there is no need to setup the 'Send To' method described earlier on this page.
- Windows Explorer by Microsoft
- Although this program is not specialized for Poser content. It can be useful at times. The main difficulty with using it is that Poser's thumbnails and content are in separate
files making it difficult to locate the 'real' content file you need to send. To help get around this problem, I created a client module;
prpcThumb2File . See the link for more information.
- Setup and usage for Windows Explorer has been discussed in this document under the Installation, Usage and Options Section.
Limitations, Bugs and other Issues
Some of these are Poser version specific issues, others are issues with all versions. Others are issues that I might
be able to fix or work around, but have not been able to as yet.
NOTE: This section is currently incomplete. I'll try and have it finished soon.
- General Issues and Notes
- You should close any running python scripts before starting the server daemon (PRPCd.py).
- You should close the server daemon before using the 'Exit' or 'Close' file menu commands in Poser.
- If you forget to do this, Poser will appear to 'hang'. In this case, goto your task bar,
right click on the server daemon and click on 'Close'. The server daemon should close and
Poser will proceed as expected.
- Note: There is no need to use the 'Close' file menu command. Instead you should use
the 'New', 'Open' or 'Exit' file menu commands. Poser will prompt you to save your scene before
continuing. For 'New and 'Open' the server daemon will continue to run while Poser creates a new scene
or opens an existing document/scene.
- Do not automatically load the server daemon (PRPCd.py) when Poser first starts up.
- I tried auto loading the server daemon using poserStartup.py and the server daemon crashes (and burns).
There is not a valid 'scene' at this point. A valid scene is needed when the server daemon initializes.
- Some python scripts may not run properly while the server daemon is running.
- I had to take some drastic measures to keep python scripts from crashing the server daemon.
There may be some python scripts that do things that I haven't taken into account and they may not work properly.
- You can only load uncompressed scenes (.pz3 files).(Poser-Python method limitation)
- Note: This is not recommended in Poser 6. See Poser 6 section below.
- Some Poser 'hot keys' do not work properly while the server daemon is running.
- If you 'minimize' the server daemon's window to the task bar, it should help to mitigate this issue.
- (placeholder)
- Poser 6 Issues and Notes
- You should install the lastest Service Release Pack.
- Note: The below issue was resolved in version 1.34.33
You should not load scenes (pz3 files) thru the server daemon.
- A bug was introduced with Poser 6 Service Release 2 and 3 which broke the server daemon's
ability to load document properly. Hopefully, this will be fixed in a later Service Release.
Nothing bad will happen, you will just see an empty preview window (Service Release 1) or
figures will be 'zeroed' in the center of the scene (Service Release 2).
- You should open scenes (pz3 files) using Poser's 'Open' file menu command.
From an external application you can Drag-and-Drop or right-click 'Open with' menu command.
- Certain Poser confirmation dialog windows do not display and return 'OK' automatically.
- This can be a nasty one. I haven't figured out what causes the behavior or how to work around it.
Following is a list of Poser confirmations that I know of that do not display.
- When you delete animation frames.
- When you load content and Poser can't find something, it asks if you
want to continue looking for missing files.
- Note: If you discover any others, please report them to me
(TromNek).
- (placeholder)
Saving Content Issues
- Cannot save a prop as a 'Smart (parented) Prop'. (Poser-Python method limitation)
- Cannot save a prop as 'Hair' content. (Poser-Python method limitation)
- Cannot save a sub-set of animation frames. (Poser-Python method bug)
- Cannot select a sub-set of a figure to save (Poser-Python method limitation)
- This is an issue when you have a number of things parented and/or conformed to a figure. You can only save the "Whole Group".
The Poser-Python method to save figures does not support sub-selection.
- (placeholder)
Questions and Answers
I might have answered some in the following forum threads.
Renerosity Poser Forum public release announcement for this project.
Security Note
The server daemon can (optionally) accept python script filenames and execute them.
Python script execution can have inherent security risks.
Users wishing to allow the server daemon to execute
python scripts will need to enable it using the checkbox provided. There is an
addtional checkbox that will enable a popup dialog asking for confirmation anytime the server
daemon receives a python script filename.
These options have no effect on the normal running of python scripts thru Poser's menus.
(a little more explanation)
The server daemon opens a tcp/ip socket on the loopback (lo) network interface. Then it
listens for a connection that will deliver a filename to be loaded.
It will only accept a connection from the loopback interface so it is pretty
safe from attacks that may come from the internet or your local network.
However, if a virus or trojan infects your computer, it could send data over
your local loopback interface to the server daemon.
Since this script supports the execution of other python scripts, a virus or trojan
that targets this feature (however unlikely) can present a security risk.
Having given the above warning let me say that I feel that the security risks are very low
(and I'm very conservative). Particularly if you have the 'with confirmation' check box enabled
(that's what I do). Then if the confirmation dialog pops up when you know didn't try to remotely
load a python script, you can click 'No' and try to run down a possible virus attack. If you are
really worried about all this then just don't check the 'Enable remote python script execution' checkbox.
The truth is that a worm or virus needs to install itself on your computer, install a malicious python
script, wait for you to run Poser and PRPCd.py, then attack. If it could do all that prepatory work, then
it didn't really need PRPCd.py and the limited python implementation in Poser for anything. It has
much more freedom and power running natively in Windows than in the Poser's python environment.
Like I said, I think the risks are very low, however, these days it's a good idea to understand
what is going on with your computer setup that could have security implications.
I just feel that it is important for me to point out this possibility. The truth is that you
already probably have a huge number of security holes in you system that you don't even know about.
Future Developement
Below are some things I hope to get around to someday
- Enhance the sample client module.
- Make more client modules for other features
- Enable receipt of raw data in the server daemon.
- Enable receipt of commands in the server daemon (true remote proceedure call).
- Add two-way communications in the server daemon.
- Enable network rendering of Poser animations.
- Develope a similar project for e-Frontier's Shade product.
- Develope two-way Python communications with Shade.
- Develope a similar project for e-ion's Vue Infinite product..
Developers and users can contact me (tromnek) thru the Rendersosity web site.
Python developers might want to post a message to the Renersosity Python Forum.
Acknowledgements
All the persons on the Renderosity Poser-Python Forum for their comments, suggestions and assistance.
Ockham, who's code and assistance has helped many of us learn Python and the Poser Python interface.
Yarp, from SenoSoft for his P3dO Explorer program and generous assistance with this project.
Schlabber, for the huge number of free and affordable high quality poses he created (this is what really started this project).
My son Matthew, for reminding me that I should spend
more time playing with Poser than coding in Python.
Finally
That's it for now. I'll put up more information on this project as I get time.
Have fun and enjoy,
tromnek