Hi @flewis,
welcome to the forum and the Cinema 4D development community. Thank you for reaching out to us. The reason why you cannot frame a camera form within your thread is that you are there ultimately caught in its thread environment and these come with certain limitations; specifically to carry out anything GUI related and adding events, which you will need when trying to frame an object.
The solution to your problem would be to decouple your asynchronous from the interface layer, i.e., move the framing of objects into the main thread where you can do this. However, depending on the design of your code this might result in you having to wait so often for the main thread within your custom thread, that it might be more reasonable to:
- just either implement everything in the main thread or
- alternatively scrap the "constant live updating"-feature of your code in favour of running it asynchronously to the main thread (which has it limitations in Python anyways).
An alternative could be to try to use pipes or semaphores, i.e., something that is being shared between threads to convey information, but that can be tricky to be done from scratch and the ones provided by Python and intended for its asynchronous features probably won't work with Cinema 4D's threads (have not tried yet, I might be wrong). You might also be able to just get away with a carefully used BaseContainer
as a signal object, but this is pure speculation on my side.
Please also note, that we require users on this forum to tag their postings with support relevant tags like the version of Cinema, the used language and more. The feature is explained in the Forum Guildines. I have done some of it for you here, but you still need to add your Cinema version and OS.
Cheers,
Ferdinand