1
2
3
4
5
6
7
8
9
10
11from pyfbsdk import *
12import os
13import tempfile
14import time
15
19
20
21gProfiler.ActiveSampling = True
22
23
24gPlayer.Goto(
FBTime(0,0,0,0) )
25gPlayer.Play()
26while FBSystem().LocalTime.GetFrame() < 50:
27 gApp.FlushEventQueue()
28
29
30gPlayer.Stop()
31while gPlayer.IsPlaying:
32 gApp.FlushEventQueue()
33
34
35gProfiler.ActiveSampling = False
36
37lSamplesCount = gProfiler.GetEventSampleCount()
38print("Number of samples collected: %d\n" % lSamplesCount)
39
40if lSamplesCount > 0:
41 logPath = os.path.join( tempfile.gettempdir(), "EventsLog.txt" )
42 f = open(logPath, 'wt')
43
44 for i in range(lSamplesCount):
45 lEvent = gProfiler.GetEventSample(i)
46 lEndEvent = gProfiler.GetEndEventSample(i)
47 lColor = lEvent.GetColor()
48
49 if lEvent.IsSingleEvent():
50 lString = "%s;%s;%f %f %f %d %d\n" % (lEvent.GetComment(),lEvent.GetTypeName(),lColor[0],lColor[1],lColor[2],lEvent.GetThreadID(), lEvent.GetTime().Get())
51 f.write(lString)
52 elif lEndEvent:
53 lString = "%s;%s;%f %f %f %d %d %d\n" % (lEvent.GetComment(),lEvent.GetTypeName(),lColor[0],lColor[1],lColor[2],lEvent.GetThreadID(), lEvent.GetTime().Get(), lEndEvent.GetTime().Get())
54 f.write(lString)
55 f.close()
56
57 print("File successfully saved to %s" % logPath)
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Player control.
Definition: pyfbsdk_generated.h:13745
FBProfiler.
Definition: pyfbsdk_generated.h:14561
Provides access to the underlying system, and the MotionBuilder scene.
Definition: pyfbsdk_generated.h:18771
Time data structure.
Definition: pyfbsdk_generated.h:19596