Control Cinema through external programm



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 02/06/2012 at 07:27, xxxxxxxx wrote:

    Hey guys,

    i'm quite new to the topic of c4d-programming and i'm trying to figure out if it is possible to write a plugin/ script that lets me control cinema form a different python and and let these communicate through sockets. So when Cinema starts it should ask the other process why to do. I already saw that its possible to launch code on startup using the startupscript, but cinema doesn't completely start until the script is finished. So I think my code has to be executed as a plugin. Am I right? Is it possible to start a plugin on c4d-startup?? As i said I'm quite new to the topic and this thing is quite trivial. I appreciate your help.

    regards
    Hanso



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 02/06/2012 at 07:54, xxxxxxxx wrote:

    just to clarify. i think what i want to ask is:
    Is it possible to start a plugin on on c4d-startup and let it do stuff in the background??



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 02/06/2012 at 08:31, xxxxxxxx wrote:

    Ok just got it to work using c4d.threading.C4DThread. Is this the way to go here??



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 02/06/2012 at 11:14, xxxxxxxx wrote:

    Hi JohnnyJumper,

    you can either use c4d.threading.C4DThread or use the built-in threading module. Actually, I don't know if there are advantages on using the C4DThread.

    Here's what you could do for example:

    import socket  
    import threading  
      
    class MyThread(threading.Thread) :  
      
      def run(self) :  
          client = socket.socket()  
          client.connect(('localhost', 8080))  
      
          # make stuff with the connection  
          pass  
      
    def main() :  
      thread = MyThread()  
      thread.start()  
      
    if __name__ == "__main__":  
      main()
    

    Note that you can not make GUI operations in Cinema 4D from another thread.

    Cheers,
    Nik



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/06/2012 at 01:11, xxxxxxxx wrote:

    Thank you Nik,

    threading is better than C4DThread because it works with R12 too. Thanks for the note on Gui operations.
    _
    _
    regards
    Hanso


Log in to reply