MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Plot selected properties

6 REPLIES 6
Reply
Message 1 of 7
nils.lerin
1856 Views, 6 Replies

Plot selected properties

Hi

So I want to write a script that plots the animation on selected properties on selected models in selected takes but I'm kind of stuck. I can plot the animation on selected models on selected takes but not without constans key reducer or specifying which properties to plot. This what I've got so far:


from pyfbsdk import *

def plotSelectedOnSelectedTakes():
#Loop trough all selected takes
for take in :
#Apparently the take has to be currently used for plot to work
FBSystem().CurrentTake = take
FBSystem().CurrentTake.PlotTakeOnSelected( FBTime(0,0,0,1) )

plotSelectedOnSelectedTakes()
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: nils.lerin

hi,
take a look about the FBPlotOptions Class, you will find all you need
also in the FBTake Class, FBCharacter Class and so on ....
and a little on the FBBatchOptions Class if you need too
searsh by keyword, exemple: plot

... annyway ...
basically you have to instance the FBPlotOptions Class and set the options you wish ...

myPlotOptions=FBPlotOptions()
myPlotOptions.ConstantKeyReducerKeepOneKey=True
myPlotOptions.PlotAllTakes=False
and so on ...

and finaly inside your loop you can iterate the take and apply the plot with your options ...
hum ... something like that ...

for t in FBSystem().Scene.Takes:
FBSystem().CurrentTake = t
FBSystem.CurrentTake.PlotTakeOnSelected(myPlotOption.PlotPeriod)

# you can define several plot rule, for object, Characters ect ...
lCharacter.PlotAnimation(FBCharacterPlotWhere.kFBCharacterPlotOnSkeleton, myPlotOptions )
# don't forget to reasign the Character imput and set it active if you ahve many take to plot ...

for more info take a big look on the documentatio, even if she are not the best documentation is possible to see is beter than nothing 🙂

hope the help ...
Message 3 of 7
Anonymous
in reply to: nils.lerin

oups ... sorry
i have write fast, some error writing is inside ny post, error you will find easyly ...
exemple :
miss () after FBSystem
miss a "s" at myPlotOptions
the loop for is not indanted ...
Message 4 of 7
Anonymous
in reply to: nils.lerin

llullu, I haven't tried this, but won't setting the plot options only work on characters, not regular objects? I see you use the plot period as an argument for the PlotTakeOnSelected, but that isn't going to provide it with the options such as the constant key reducer. If this works then great, I had no idea, but I only thought you can plot on the selected objects with unchangeable options (constant key reducer on, all properties). So correct me if I am wrong or missing something.


nilslerin, what I would do as a possible solution (again I haven't tried this nor do I have time to test this right now) but you could in theory do this.
1. Get the animation node of that custom property you created and animated that you want to plot.
2. Loop through your frame range and do a KeyInsert(FBTime) on the FCurve so it will set a key on that property for every frame, leaving all other properties and curves alone
3. Change the take and repeat

thats just an idea and should work (in theory)

If you need a code example, I can try to cook something up quickly, but I'm very busy lately which is why I can't make one right now,
Scott
Message 5 of 7
Anonymous
in reply to: nils.lerin

I'm running into a similar issue.
What I have in the scene is a skeleton with some animation that I need replotted with the gimbal killer filter.
In the GUI I would go through Animation/Plot Selected (All Properties). This is what I am looking to do with Python.
The Take.PlotTakeOnSelected () seems to be what I need however as mentioned above there is no way to pass PlotOptions to that method. It seems to take the latest options you had in the GUI. So the question is can I set those global options somehow?

The other option would be to characterize the skeleton and use the FBCharacter.PlotAnimation (kFBCharacterPlotOnSkeleton, PlotOptions). This however fails to deliver the expected results for me. It doesn't seem to like plotting on itself.

Any help would be appreciated.
Message 6 of 7
_KxL_
in reply to: nils.lerin

I maybe be wrong, but I never saw a way to get selected property. So even if there would be option for plotting animatable property, we would not be able to find which one was selected.

Sorry.
Message 7 of 7
Anonymous
in reply to: Anonymous

The solution for this problem is to create a function that creates a temporary dummy character, set the plot options you want on this dummy character, plot the dummy character, then delete the character.

It's a pretty ridiculous work-around and Autodesk ought to add functionality to set the global plot properties.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report