THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/02/2012 at 11:20, xxxxxxxx wrote:
@Scott:
Imagine you have printed exactly 1000 lines to the console.
for i in xrange(1000) :
print "Current:", i
If you now print another one, the first line, which contains the string Current: 0, will be erased.
Next, why are you calling C4DThread.End() within the loop? It is intended to be used outside of the thread to notify you, while looping in the main, the thread should now exit.
import c4d
import time
class MyThread(c4d.threading.C4DThread) :
def Main(self) :
for i in xrange(100) :
if self.TestBreak() :
print "MyThread.TestBreak() returned True, leaving the loop.."
break
print "Current:", i
time.sleep(1/25.)
def main() :
thread = MyThread()
thread.Start()
time.sleep(1)
thread.End()
main()
As expected, this code runs until frame 25 (maybe 24 or 26, that depends on the machine) and then exits because we told it to exit after we've waited for a second.
Current: 0
Current: 1
Current: 2
Current: 3
Current: 4
Current: 5
Current: 6
Current: 7
Current: 8
Current: 9
Current: 10
Current: 11
Current: 12
Current: 13
Current: 14
Current: 15
Current: 16
Current: 17
Current: 18
Current: 19
Current: 20
Current: 21
Current: 22
Current: 23
Current: 24
Current: 25
MyThread.TestBreak() returned True, leaving the loop..
-Niklas
PS: What is up with my posts? I see scrollbars for it, never seen that before here..