Jump to content


SFXP

Can you turn a xpresso rig into a plugin

Recommended Posts

SFXP    1

The question is simple. I know how to convert a python script or a protoype into a plugin. But that doesn't seem to work with xpresso tags. Is that not possible? How would I go about this?

 

Thanks!

Share this post


Link to post
Share on other sites

borg    22

Good one. I would like to know that to  :)

 

I don't think it's possible, without first converting that xpresso setup somehow to python. If your xpresso just does calculations, this schould be fairly easy to do.

If on the other hand your script uses a lot of different nodes, than that could pose a problem. I could be wrong though. 

 

Some of the Guru's here will know for sure..

 

Share this post


Link to post
Share on other sites
SFXP    1
  • Topic Author
  • Yeah, I'm learning Python now and probably can convert it over soon. Just thought would be cool if I didn't have to convert it :D

    Share this post


    Link to post
    Share on other sites
    jed    305

    XPresso nodes like compare, rangemap, clamp etc have equivalents in Python, but you have to watch out for data type. XPresso is quite forgiving when connecting say real to string, but Python is more strict.

     

    Also be aware that integer division gives integer result in Python eg

     

    3 / 2 = 1

     

    have to specify real eg

     

    3.0 / 2 = 1.5

     

    this can trip you up when using current frame as a value, and is due to C4D using 2.7 Python

    Share this post


    Link to post
    Share on other sites
    SFXP    1
  • Topic Author
  • Thanks for the tips, I will keep that in mind. Appreciate it!

    Share this post


    Link to post
    Share on other sites
    SFXP    1
  • Topic Author
  • 3 hours ago, jed said:

    @SFXP some Python stuff for you - rangemap etc

     

    cheatsheets.zip

     

    BTW I wouldn't recommend learning Python inside C4D - too easy to lock up the program. I use the free Pycharm.

     

    https://www.jetbrains.com/pycharm/

     

    Thank you @jed

     

    Really cool! Yeah, I already successfully made Cinema crash with my script :D
    I made the python work (yay), but when I export it as a Plugin "doc" and "op" are not available anymore... now I have to figure that out... the documentation is like one of the worst ever. Shame on you MAXON :( I'm pretty good with Javascript, but I have a hard time with that documentation...

    • Like 1

    Share this post


    Link to post
    Share on other sites
    jed    305

    I thought doc was a built-in variable, although

     

    c4d.documents.GetActiveDocument()

     

    must exist for a reason - I've seen people include it. I'm with you re MAXON Python SDK - hard going to say the least.

    Share this post


    Link to post
    Share on other sites
    SFXP    1
  • Topic Author
  • Yep, after a few hours of searching and trial & error, I made it work.

    c4d.documents.GetActiveDocument() is correct.

    I learned a lot on the way and next time will be easier. Thanks!

    Share this post


    Link to post
    Share on other sites
    SFXP    1
  • Topic Author
  • lol good one jed:D haha!

    Share this post


    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×