Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. brian.michael
    B
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 4
    • Best 0
    • Controversial 0
    • Groups 0

    brian.michael

    @brian.michael

    0
    Reputation
    2
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    brian.michael Unfollow Follow

    Latest posts made by brian.michael

    • Bake animation in the background

      I am doing something similar to the code shown in here by lasselauch - launched by a button in my dialog box. Since I am not super experienced with the c4d api, this might be a simple ask, but how would I go about running this code where the UI will update, or updating the scene so it does not feel like it locks everything up? Would I use the timer, or a thread, or c4d.EventAdd(), or something else?

      Update 31/10/2024 (i_mazlov): Forked from https://developers.maxon.net/forum/topic/11667/access-bake-objects-timeline-or-bake-animation-to-curves/4

      posted in Cinema 4D SDK python
      B
      brian.michael
    • RE: Multithreading/waiting for render to complete

      Thank you so much! That was it. I was thinking I would try to create this standalone, before moving it into creating a GUI, and I didn't know about the Timer in GeDialog. This is now working, and all I needed to do is remove the multithreading and change it to the timer.

      posted in Cinema 4D SDK
      B
      brian.michael
    • RE: Multithreading/waiting for render to complete

      The goal of the script is that there will be multiple items to set in my script, that then will take those items and loop through rendering. Batch, and deadline are on the list, but I also wanted something that the user is use as they use it all the time - the picture viewer. It would be sorta like Render all takes, but I would set the options between takes/ a bunch of different settings.

      In my script I was thinking that I would start a thread that will wait and watch the Picture viewer, and when done change some settings and do it again. I was trying to thread the waiting part of the script, and not the running picture viewer part. Problem is that the picture viewer doesn't do anything until the main thread is done - which makes sense. but when the main thread is done, it seems to kill my threaded thread if I remove thread.Wait() and thread.End().

      Looking into c4d.documents.RenderDocument looks promising but I still cant find how to get the feedback of seeing the render as it renders in picture viewer. Played quickly with RENDERFLAGS_CREATE_PICTUREVIEWER, and RENDERFLAGS_OPEN_PICTUREVIEWER - but neither opened the picture viewer. Only thing that did was - c4d.bitmaps.ShowBitmap(bmp) after the single frame was done.

      posted in Cinema 4D SDK
      B
      brian.michael
    • Multithreading/waiting for render to complete

      I am working on a script that will do some things, and then render to picture viewer, and then do more things and render to picture viewer again. I know I could save out files and submit to the render server or deadline - and that is an option - but I would like/really be nice to have this to be an option as well. So - below is a sudo code of what I have so far.

      class WaitForRender(c4d.threading.C4DThread):
      
          def Main(self):
              bc = c4d.BaseContainer()
              time.sleep(1) #added this to see if it will wait a couple seconds for render to start before checking, but locks up everything
              while c4d.CheckIsRunning(c4d.CHECKISRUNNING_EXTERNALRENDERING):
                  if self.TestBreak():
                      break
                  time.sleep(1)
                  self.End()
              
      class DoRender:
          def start_render(self):
              self.thread = WaitForRender(self)
              #wait for render to be done.
              self.thread.Start() # start up the waiting thread.
              c4d.CallCommand(self.PICTURE_VIEWER_COMMAND)  # Render to Picture Viewer
              c4d.EventAdd()  #tried this to see if it affects render/force render to start now - doesn't seem to.
              
              self.thread.Wait(False) #didnt really understand this, both true and false seem to have the same effect
              #close the thread
              thread.End()
              
          def process_shots(self):
                for loop through renderlist:
                      self.start_render()
      
      

      It seems Picture Viewer does not start until the whole script is finished - and holds up on the threaded sleep commands. I also tried to put the whole script into a thread, and call the picture viewer command - but picture viewer wouldn't seem to run/start when called from a threaded command. I am new to cinema, and their API's so I am probably missing something.

      posted in Cinema 4D SDK windows python 2024
      B
      brian.michael