|
|
|
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®
|
|
Is there a way for me to get a selection and keep the selection order that the user made? When i query the selection list, it automatically sorts the list by the scene order.
So if character A is merged into the scene after character B, even if i select A first and then B, it returns B, then A.
currently i am using
selectedModels = FBModelList()
|
|
|
|
We dont keep the selection order in the FBModelList.
I dont know if this can help, but python list can be sorted…
Ie:
selectedModels.sort(lambda x,y: cmp(x.Name,y.Name))
CHARLES PAULIN | SQA AUTOMATION ANALYST
AUTODESK Media & Entertainment
|
|
|
|
Thanks for the reply,
I dont think that would do anything in this case, as i am looking for the users specific order of operations, not the alphabetized version. I just dont have any way of telling which item they selected first and which they selected second.
|
|
|
|
Did anyone ever find a solution to this problem. I’m working on a constraint script but to find which object is the child and parent requires a selection order. I could just have the user load each object into the GUI into a text field but that’s about the same as doing it the regular way in Motion Builder.
http://www.danielmccrummen.com
|
|
|
|
Not much of a solution, but more of a hack:
def getSelection():
lModelList = FBModelList()
FBGetSelectedModels( lModelList )
selectedModels = []
selectedNames = []
for l in lModelList:
selectedModels.append(l)
selectedNames.append(l.Name)
return selectedModels, selectedNames
def getOrderedSelection():
lUndo = FBUndoManager()
sel, selNames = getSelection()
selectionSize = len(sel)
orderedSeletion = []
if len(sel):
for i in range(selectionSize):
lUndo.Undo()
newSel, newNames = getSelection()
for s in range(selectionSize):
if selNames[s] not in newNames:
orderedSeletion.append( sel.pop(s) )
selNames.pop(s)
break
for i in range(selectionSize):
lUndo.Redo()
orderedSeletion.reverse()
return orderedSeletion
sel = getOrderedSelection()
I’ve had this in my snippets for a while. I copied the ol’ undo trick for ordered component selection from Maya that Anders Egleus wrote. It requires that you pick one node at a time though. Maybe useful?
Stev
|
|
|
|
|
That is a very nice hack. I was thinking and wanted to look at scene events, but this is for sure better idea!
Thanks for sharing!
Author: KxL
|
| Replied: 06 August 2009 06:19 PM
|
|
|
|
|
Wow, way to get creative! Too bad we need to go through this method.
|
|
|
|
|
|