|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| driving the voice device with Python
|
|
|
Hello,
Does anybody knows if it is possible to access the voice device using Python?
The only class i found in the python reference guide is FBDevice, but i didn’t get it to work;
FBDevice("test") produces an error: “This class cannot be instantiated from Python”
and, i’m not sure if it is the right class; seems to be more a generic one for all the devices
Thanks in advance
Cheers
Andrea A.
|
|
|
|
devices = FBSystem().Devices
voice = ''
for device in devices:
print device.Name
if device.Name == "Voice":
voice = device
voice.Online = True
-jason
|
|
|
|
here I am again :-)
ok, now i got how to set the voice device, attach wave files etc.
then i started the procedures to plot;
everything seems ok, except from that i’m not able to stop it;
I mean, once i record and then i play i want to wait until i get to let’s say frame 60;
so i set up a while condition:
duration = 60
system = FBSystem()
scene = system.Scene
while currentTime < duration:
scene.Evaluate()
currentTimeStr = system.LocalTime.GetTimeString()
currentTimeStr = currentTimeStr.rstrip('*')
currentTime = int(currentTimeStr)
so, before the while statement i start recording, then play and after it I stop the playerControl, in order to keep on going with the script;
it seems to work, but the voice device seems not to record anything; this may be the reason because I only get a key at first frame
once i plot on the character face
Does anybody have any idea on how to play the device wait until it stop and then plot; I think that the while solution is not really the ideal way?
Thanks!
Cheers
Andrea A.
|
|
|
|
I make a fast test with player start and stop. I will left to you making a tests with device - ok?
from pyfbsdk import * import time
durationFrames = 60
FBPlayerControl().Play()
while FBSystem().LocalTime.GetFrame(True) < durationFrames:
time.sleep(0.05)
FBPlayerControl().Stop()
I hope that you will not have to make scene evaluation in while, becouse this will be totaly inefficient. Also I do not know how other MB threads are working when python interpreter are called, and script is running.
|
|
|
|
Hi!
I’m doing several tests and basically it seems to work;
actually i realised that the voice device was working even before;
what is not working is the plotting just straight after the “while"condition;
basically , MB plays, the device record, then i select a node and plot:
system=FBSystem()
take = system.CurrentTake
take.Name = clip.Name
options = FBPlotOptions () options.ConstantKeyReducerKeepOneKey = True
options.PlotAllTakes = False
options.PlotOnFrame = True
options.PlotPeriod = FBTime ( 0, 0, 0, 1, 0, FBTimeMode.kFBTimeModeCustom, 15.0 ) options.PlotTranslationOnRootOnly = False
options.PreciseTimeDIscontinuities = False
options.RotationFilterToApply = FBRotationFilter.kFBRotationFilterUnroll
options.UseConstantKeyReducer = True
object = FBFindModelByName("my_node") object.Selected = True
take.PlotTakeOnSelected(options.PlotPeriod)
if i run the script without plotting at the end, and plot by hand from the interface it works properly;
but if i run the last command “PlotTakeOnSelected”, it kind of flush the memory of the recorded device and i get only one key plotted;
so, i think that basically even if the interface is not refreshing, the device is recording;
Does anybody have any idea? I Hope i’m doing something wrong :-)
Cheers
Andrea,
|
|
|
|
|
hi, did you manage to fix this problem, I have exactly the same issue in MB 2012, and I don’t know how to fix it.
Cyril.
Author: cyrilm
|
| Replied: 14 November 2011 01:10 AM
|
|
|
|
|
|
|