Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
adp001 wrote a script called poser_fake to allow for this check out his page
look for :Script Fake_poser3.py Class and Method headers to support editors while writing Python scripts.
Locked Out
If you declare poser = None, what do you expect PyCharm should find in something that is nothing?
Some things you may have to know:
Poser-Python is directly implemented into Poser. Not reachable from the outside world. Also not from PyCharm. "POSER_FAKE.py" is a library you can "import" from a Python script like any other library with Python. Use it insteed of Poser Pythons own lib "poser" like so:
import POSERFAKE as poser
Or even better:
try:
import poser
except ImportError:
import POSERFAKE as poser
Make sure you saved the lib in a folder PyCharm (and your actual script) can reach while you develop.
Thanks. I'm making incremental progress. The thing I am still confused about is how the actual program becomes involved. If I click on the forearm in the Poser window, how do I get PyCharm to return that Actor with CurrentActor()? Another example, I have Poser open now with 30 key frames:
Yet, when I run my .py file which imports your fake Poser library, the number of frames is returned as 1:
My main goal is to calculate joint positions of the Poser skeleton in time, and then animate the skeleton using matplotlib.
Seems like you misunderstand some fundamental things.
There is no way to connect Poser directly to an external Python editor. The lib mentioned here only supports creating a script without Poser being involved (which is already a great help since the description of the functions is also shown).
The closest thing to your wishes is the Python shell built into Poser. It is not suitable for writing whole scripts, but you can access Poser's elements directly.
The shell can be found in the main menu under Scripts->Python Shell.
AHHHH - I missunderstood you.
What you did wrong is to import POSER_FAKE while you actually needed poser!
use this:
try:
import poser
except ImportError:
import POSER_FAKE as poser
With this the external lib POSER_FAKE is only imported if the "real" poser is not available. And that is exactly what you want.
I see. If there is no way to connect poser directly to an external editor, then what is the point of the try: import poser statement?
Otherwise, I do see the value of the fake poser library, as using PyCharm is a lot easier than writing Python scripts in a text editor. I guess I should save my .py files from PyCharm in the Python scripts directory for Poser, and call my script directly from Poser.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Hi,
I am brand new to Poser Python. I have successfully written scripts using text editors to get data that I want. However, I would like to use PyCharm to edit my .py files. I am struggling to do things like importing the poser module and just getting access to the poser methods. I need to get over this hump and get PyCharm at least running so that I can learn more on my own. For now, I am just stuck setting it up. Is there a how-to on getting PyCharm to interact with poser?
I have read these threads:
https://www.renderosity.com/mod/forumpro/?thread_id=2941326
https://www.renderosity.com/mod/forumpro?thread_id=2942414
However, it is just a little too advanced for me to understand what I am doing. I have also bought the Python manual from Phil Cooke, which has aided me in getting started writing scripts in a text editor.
Thank you.