On 19/06/2014 at 08:02, xxxxxxxx wrote:
Scott, why do you think it is not supported in Python?
import c4d
import datetime
from c4d.plugins import SetWorldPluginData, GetWorldPluginData
PLUGIN_ID = 100004 # TEST ID ONLY!
TIME_START = datetime.datetime(1970, 1, 1)
TIME_FORMAT = "%Y %B %d, %H:%M:%s"
def total_seconds(td) :
# datetime.timedelta.total_seconds() was added
# in Python 2.7
temp = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6)
return temp / 10**6
def main() :
bc = GetWorldPluginData(PLUGIN_ID) or c4d.BaseContainer()
if bc.GetType(1000) != c4d.DTYPE_NONE:
dt = TIME_START + datetime.timedelta(seconds=bc.GetLong(1000))
print "Last saved time:", dt.strftime(TIME_FORMAT)
bc.SetLong(1000, total_seconds((datetime.datetime.now() - TIME_START)))
SetWorldPluginData(PLUGIN_ID, bc, add=False)
if __name__ == "__main__":
main()
-Niklas