Hello guys,
I started learning Python few days ago and I definitly need help from the pyhton dev community !
I wish to insert a "delay time" that can be inputed by the user for each loop I created. How can I do that ?
Here is my code :
import c4d
import math
import time
import threading
from c4d.modules import mograph as mo
#Welcome to the world of Python Fields
def Sample(op, inputs, outputs, info):
"""Calculate the output values for the specified set
of input points. Allocations should be avoided in Sample
to maximize performance.
Return false on error to cancel sampling.
NOTE: Sample function is mandatory, PythonField cannot
function without it.
Keyword arguments:
BaseObject -- the python field.
FieldInput -- the points to sample.
FieldOutput -- the sampling output arrays (pre-allocated).
FieldInfo -- the sampling informations.
"""
NbObjFamily = 5
flight_time = 5
delay = 5*(doc.GetTime().Get())
# Wave "0"
for i in range(0, inputs._blockCount, NbObjFamily):
value = (doc.GetTime().Get())
offsetValue = value / flight_time
outputs.SetValue(i, offsetValue)
# Wave "1"
for i in range(1, inputs._blockCount, NbObjFamily):
value = (doc.GetTime().Get())
offsetValue = (value + 0.0) / flight_time
outputs.SetValue(i, offsetValue)
# Wave "2"
for i in range(2, inputs._blockCount, NbObjFamily):
value = (doc.GetTime().Get())
offsetValue = (value + 0.0) / flight_time
outputs.SetValue(i, offsetValue)
# Wave "3"
for i in range(3, inputs._blockCount, NbObjFamily):
value = (doc.GetTime().Get())
offsetValue = (value + 0.0) / flight_time
outputs.SetValue(i, offsetValue)
# Wave "4"
for i in range(4, inputs._blockCount, NbObjFamily):
value = (doc.GetTime().Get())
offsetValue = (value + 0.0) / flight_time
outputs.SetValue(i, offsetValue)
# Return false to cancel further sampling.
return True
Any Idea ?
Thank you