It's hard to know what you are doing from the picture...
If you want to select all mesh/geometry objects, this should work...
"""
Find all FBModel objects
Check component is not a camera
Check component has geometry (FBMesh, FBSurface, FBNurbs, FBPatch)
Check geometry isn't system geometry (Motion Blend Result)
Select
"""
for component in FBSystem().Scene.Components:
if component.Is(FBModel.TypeInfo)\
and not component.Is(FBCamera.TypeInfo)\
and component.Geometry\
and not component.Geometry.HasObjectFlags(FBObjectFlag.kFBFlagSystem):
component.Selected = TrueIf you wanted to select all geo in a character hierachy, you could switch the search from all components in the scene, to all coponenets in a hierachy.
Hope this helps,
Here is something I quickly created based on a previous post we had in this forum:
from pyfbsdk import *
from pyfbsdk_additions import *
def bSelOtherObjWithSameNameSpaceCallBack(control, event):
selModels = FBModelList()
FBGetSelectedModels (selModels, None, True)
if len(selModels)>0:
objNameSpaces = []
for model in selModel:
nameSpace = str(model.LongName.rsplit(':', 1)[0])
objNameSpaces.append( nameSpace )
for namespace in objNameSpaces:
FBSystem().Scene.NamespaceSelectContent(namespace, True)
def PopulateTool(t):
bSelOtherObjWithSameNameSpace = FBButton()
x = FBAddRegionParam(5,FBAttachType.kFBAttachTop,"")
y = FBAddRegionParam(5,FBAttachType.kFBAttachLeft,"")
w = FBAddRegionParam(-5,FBAttachType.kFBAttachRight,"")
h = FBAddRegionParam(-5,FBAttachType.kFBAttachBottom,"")
t.AddRegion("bSelOtherObjWithSameNameSpace","bSelOtherObjWithSameNameSpace", x, y, w, h)
t.SetControl("bSelOtherObjWithSameNameSpace", bSelOtherObjWithSameNameSpace)
bSelOtherObjWithSameNameSpace.Caption = "Select Obj With Same Name Space"
bSelOtherObjWithSameNameSpace.Style = FBButtonStyle.kFBPushButton
bSelOtherObjWithSameNameSpace.Justify = FBTextJustify.kFBTextJustifyCenter
bSelOtherObjWithSameNameSpace.Look = FBButtonLook.kFBLookNormal
bSelOtherObjWithSameNameSpace.OnClick.Add(bSelOtherObjWithSameNameSpaceCallBack)
def CreateTool():
t = FBCreateUniqueTool("Select Objects With Same NameSpace")
t.StartSizeX = 250
t.StartSizeY = 65
PopulateTool(t)
ShowTool(t)
CreateTool()
A lot depends on how your character and scene is setup...
Like Vic said, you can use namespace (usually best/safest option). But as Aragon is in a single hierarchy, you can also select everything in the hierarchy with something like this:
from pyfbsdk import *
def select_entire_hierarchy(rootObject):
"""
Select all objects in Hierarchy
"""
def _select_all_children(model):
model.Selected = True
for childModel in model.Children:
_select_all_children(childModel)
_select_all_children(rootObject)
def get_selected_root_obj():
"""
Get root object in selected hierarchy
"""
def _get_root_obj(model):
if not model.Parent:
rootObj = model
else:
rootObj = _get_root_obj(model.Parent)
return rootObj
selectedModelList = FBModelList()
FBGetSelectedModels(selectedModelList)
if selectedModelList:
selectedObj = selectedModelList[0]
selectedRootObj = _get_root_obj(selectedObj)
else:
print "ERROR:Nothing Selected"
selectedRootObj = None
return selectedRootObj
rootObj = get_selected_root_obj()
if rootObj:
select_entire_hierarchy(rootObj)Then you can filter the "select_entire_hierarchy" for whatever you want, e.g. mesh, skeleton, etc.
Good luck,