Jump to content

Best way to create plastic plugins for DCC? (&how to properly use the rest API)


JulienH
 Share

Recommended Posts

Hi, 

I am working on building a Blender add-on that can interacts with multiple versions control systems. 

In this specific situation,  I am writing the add-on in python. 

I was wondering what is the best way to interact with Plastic from my plugin. 

 

So far I chose to use the "cm" CLI to do that,  starting sub-processes in python and reading the outputs. 

I am wondering if using the Rest api would be a better solution? 

If it is,  how would you do it? As far as I know,  I would need to manually start the Plastic server using "cm api",  but I already some possible issues here :

-It looks like only one rest API can be started at a time.  If multiple software/add-ons/plugins start to use the rest API,  this can leads to problem: if the server runs as a subprocess of one of the plugin it could be terminated while another plugin is accessing it.  One plugin could start the server with a specific port and the other plugins would not be able to connect to it nor to start a new server... (Would it not be nice if the rest server was started automatically as a service,  and plugins could query the used port via the cli?) 

Then,  the practicality: Would you recommend to start the rest server when the plugin starts,  and kill the process when the plugin stops? To keep the process running indefinitely? Or to start it just when the plugin needs to interact with plastic and kill it right after? (last one sounds too slow) 

 

 

Thank you! 

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

All of your CI plugins (Jenkins, Bamboo, TeamCity) are based on the "cm". Instead of running individual commands, please use "cm shell --help" you don't need to start "cm" every time you need to run a commands. It will make the intergration much more faster. It shouldm work for your custom add-on.

Can you let us know more details of the integration? Is it a private project?

Best regards,

Carlos.

 

Link to comment
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
 Share

×
×
  • Create New...