PDA

View Full Version : Getting objects in the order they were selected?


eek
08-09-2010, 04:15 PM
This always returns the selection in the order they were imported into the scene, rather than the order in which they were selected. Any help?

from pyfbsdk import *

selectedModels = FBModelList()

FBGetSelectedModels ( selectedModels, None, True )

for each in selectedModels:print each.Name

bclark
08-10-2010, 04:59 AM
You just need to add one extra true to your command


from pyfbsdk import *
selectedModels = FBModelList()

FBGetSelectedModels ( selectedModels, None, True, True)

for each in selectedModels:print each.Name



pyfbsdk::FBGetSelectedModels ( FBModelList pList,

FBModel pParent = None,

bool (http://forums.cgsociety.org/classbool.html) pSelected = True,

bool (http://forums.cgsociety.org/classbool.html) pSortBySelectOrder = False
)



Find all models that are selected (if pSelected is true) Searches recursively from a root model for models that are selected, and adds them to a list (http://forums.cgsociety.org/classlist.html) of models.



Parameters:
pList List to add found models to.
pParent Root model to look from (default=NULL(root)).
pSelected true to find selected models, false to find unselected models(default=true).
pSortBySelectOrder true to sort the result by selection order, first selected model in the first part of the list (http://forums.cgsociety.org/classlist.html); false to sort the result by scene graph orderSee sample: FBGetSelectedModels.py. (http://forums.cgsociety.org/ms-its:MotionBuilder_SDK_Samples.chm::/Scripts/Samples/Utilities/FBGetSelectedModels.html)

eek
08-11-2010, 04:14 PM
This doesnt actually working in MB2009, any work-around? There is no bool for the selected order.



Find all models that are selected (if pSelected is True) Searches recursively from a root model for models that are selected, and adds them to a list (http://forums.cgsociety.org/mk:@MSITStore:C:Program%20FilesAutodeskMotionBuilder%202009helpMotionBuilder_PythonScripting_Help_Ref_Guide.chm::/classlist.html) of models.

Parameters: pList List to add found models to. pParent Root model to look from (default=None(root)). pSelected True to find selected models, False to find unselected models(default=True).

CGTalk Moderation
08-11-2010, 04:14 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.