Python Reference Guide
 
Loading...
Searching...
No Matches
FBGenericMenu Class Reference

A GenericMenu class. More...

#include <pyfbsdk_generated.h>

Inheritance diagram for FBGenericMenu:

Public Member Functions

 FBGenericMenu ()
 Default constructor.
 
 DeleteItem (FBGenericMenuItem pToDelete)
 Remove a menu item from the menu and delete it.
 
FBGenericMenuItem Execute (int pX, int pY, bool pRightAlign=True)
 Starts the menu as a pop-up menu at a specific location on screen.
 
 FBDelete ()
 Virtual FBDelete function.
 
FBGenericMenuItem GetFirstItem ()
 Returns the first menu item (if existing) in this menu.
 
FBGenericMenuItem GetItem (int pItemId)
 Returns the menu item corresponding to an id.
 
FBGenericMenuItem GetLastItem ()
 Returns the last menu item (if existing) in this menu.
 
FBGenericMenuItem GetNextItem (FBGenericMenuItem pItem)
 Returns the menu item following an other item.
 
FBGenericMenuItem GetPrevItem (FBGenericMenuItem pItem)
 Returns the menu item preceding an other item.
 
FBGenericMenuItem InsertAfter (FBGenericMenuItem pBeforeItem, str pItemName, int pItemId, FBGenericMenu pMenu=None)
 Inserts a new menu Item AFTER another item.
 
FBGenericMenuItem InsertBefore (FBGenericMenuItem pAfterItem, str pItemName, int pItemId, FBGenericMenu pMenu=None)
 Inserts a new menu Item BEFORE another item.
 
FBGenericMenuItem InsertFirst (str pItemName, int pItemId, FBGenericMenu pMenu=None)
 Inserts a new menu Item at the first position in the menu list.
 
FBGenericMenuItem InsertLast (str pItemName, int pItemId, FBGenericMenu pMenu=None)
 Inserts a new menu Item at the last position in the menu list.
 
- Public Member Functions inherited from FBComponent
 FBComponent ()
 Constructor.
 
str ClassName ()
 Get the class name.
 
 DisableObjectFlags (FBObjectFlag pFlags)
 Disable a specific Object Flags.
 
 EnableObjectFlags (FBObjectFlag pFlags)
 Enable a specific Object Flags.
 
bool FBCreate ()
 Open Reality Creation function.
 
 FBDelete ()
 Open Reality deletion function.
 
 FBDestroy ()
 Open Reality destruction function.
 
FBObjectFlag GetObjectFlags ()
 Get all Object Flags (concatenated).
 
bool GetObjectStatus (FBObjectStatus pStatus)
 Check to see if an object status is enabled.
 
FBFileReference GetOwnerFileReference (p0)
 Get the owner FileReference object.
 
 HardSelect ()
 HardSelect.
 
bool HasObjectFlags (FBObjectFlag pFlags)
 Check whether a specific object flag is enabled.
 
bool Is (int pTypeId)
 Returns true if object is of type TypeId.
 
bool ProcessNamespaceHierarchy (FBNamespaceAction pNamespaceAction, str pNamespaceName, str pReplaceTo=None, bool pAddRight=True)
 ProcessNamespaceHierarchy.
 
bool ProcessObjectNamespace (FBNamespaceAction pNamespaceAction, str pNamespaceName, str pReplaceTo=None, bool pAddRight=True)
 ProcessObjectNamespace.
 
int PropertyAdd (FBProperty pProperty)
 Add a property to the component's property manager.
 
bool PropertyAddReferenceProperty (FBProperty pReferenceProperty)
 Add a reference property to the component's property manager.
 
FBProperty PropertyCreate (str pName, FBType pType, str pDataType, bool pAnimatable, bool pIsUser=False, FBProperty pReferenceSource=None)
 Create user or dynamic property.
 
 PropertyGetModifiedList (FBArrayTemplate< FB > pPropList, FBPlugModificationFlag pModificationFlags)
 Get list of properties which have been modified since last loading.
 
 PropertyRemove (FBProperty pProperty)
 Remove a Property from the component's Property manager.
 
 SetObjectFlags (FBObjectFlag pFlags)
 SetObjectFlags.
 
 SetObjectStatus (FBObjectStatus pStatus, bool pValue)
 Enable/Disable a specific Object Status.
 

Public Attributes

FBEvent OnMenuActivate
 Event Property: Register on this property to be notified when a menu item is clicked by the user.

 
- Public Attributes inherited from FBComponent
FBListComponent Components
 List: List of components.

 
str LongName
 Read Write Property: Name and namespace for object.

 
str Name
 Read Write Property: Unique name of object. See sample: RemoveSuffixFromNameOfSceneElements.py.
 
FBListComponent Parents
 List: Parents.

 
FBManager PropertyList
 Read Only Property: Manages all of the properties for the component.

 
bool Selected
 Read Write Property: Selected property.

 
int TypeInfo
 Contains the Type information of the object.

 
- Public Attributes inherited from FBPlug
str ClassGroupName
 ClassGroupName of the object.

 
int TypeInfo
 TypeInfo.

 

Detailed Description

A GenericMenu class.


You can use this class either to create a new menu in the menu bar (or in a menuitem in the menu bar) or you can use this class to create a pop-up menu.

#to start a pop up menu use the Execute method
def mouseClick(x, y):
item = menu.Execute(x, y)
if item.Id == 10:
[do this]
else if item.Id == 100:
[do that...]
FBGenericMenuItem Execute(int pX, int pY, bool pRightAlign=True)
Starts the menu as a pop-up menu at a specific location on screen.

There are 4 ways to insert new item in a menu. Each method needs the name of the menuitem as well as it's unique id. You can also optionally sets a new menu for a specific item.

embeededMenu = FBGenericMenu()
menu.InsertLast("new new item", 67, embeddedMenu)
#A genericMenu contains a GenericMenuItem for each entry. You can iterate on the different menuitem
#using GetFirstITem/GetNextItem or if you already know the id of the item you can get it with GetItem.
item = menu.GetFirstItem()
while item:
print item.Name
item = menu.GetNextItem(item)
str Name
Read Write Property: Unique name of object. See sample: RemoveSuffixFromNameOfSceneElements....
Definition: pyfbsdk_generated.h:4711
FBGenericMenuItem InsertLast(str pItemName, int pItemId, FBGenericMenu pMenu=None)
Inserts a new menu Item at the last position in the menu list.
FBGenericMenu()
Default constructor.
# This example shows how to list the Caption/Id of all the menu items of the Edit menu
menuManager = FBMenuManager()
editMenu = menuManager.GetMenu( "Edit" )
item = editMenu.GetFirstItem()
while item:
print "'" + item.Caption + "' (id: " + str( item.Id ) + ")"
item = editMenu.GetNextItem( item )
FBGenericMenuItem GetNextItem(FBGenericMenuItem pItem)
Returns the menu item following an other item.
FBGenericMenuItem GetFirstItem()
Returns the first menu item (if existing) in this menu.
The menu manager allows access to MotionBuilder menu bar.
Definition: pyfbsdk_generated.h:10723
Python built-in string class.
Definition: pyfbsdk.h:77

You can also delete a Menu item: this will remove the item from the menu as well as freeing its memory.To be notified when a menuitem is clicked, you can register using OnMenuActivate. This will send a FBEventMenu containing the name and the Id of the menu item that was clicked.

See sample: FBMenu.py.

Constructor & Destructor Documentation

◆ FBGenericMenu()

Default constructor.

Used to create embedded menu (inside another menu item) or pop-up menu.

Member Function Documentation

◆ DeleteItem()

DeleteItem ( FBGenericMenuItem  pToDelete)

Remove a menu item from the menu and delete it.

Parameters
pToDeleteThe item to remove.

◆ Execute()

FBGenericMenuItem Execute ( int  pX,
int  pY,
bool  pRightAlign = True 
)

Starts the menu as a pop-up menu at a specific location on screen.

It returns the item that was clicked by the user.

Parameters
pXX location in pixel on screen where the menu is to be popped.
pYY location in pixel on screen where the menu is to be popped.
pRightAlignAll menu item will be align to the right justified (if true) or left justified (if false)
Returns
The selected item by the user. Null if the user clicks outside the menu.

◆ FBDelete()

FBDelete ( )

Virtual FBDelete function.

See sample: DeleteHierarchy.py.

◆ GetFirstItem()

FBGenericMenuItem GetFirstItem ( )

Returns the first menu item (if existing) in this menu.

You can then use GetNextItem to iterate on other menu items.

Returns
The first menu item in this Menu.

◆ GetItem()

FBGenericMenuItem GetItem ( int  pItemId)

Returns the menu item corresponding to an id.

Parameters
pItemIdId of the item we are looking for.
Returns
Will return the Item corresponding to an id (null if not found).

◆ GetLastItem()

FBGenericMenuItem GetLastItem ( )

Returns the last menu item (if existing) in this menu.

You can then use GetPrevItem to reverse iterate on other menu items.

Returns
The last menu item in this Menu.

◆ GetNextItem()

FBGenericMenuItem GetNextItem ( FBGenericMenuItem  pItem)

Returns the menu item following an other item.

Returns null if this is the last item in menu.

Parameters
pItemWill return the item after pItem
Returns
Will return the item after pItem. Null if pItem is the last item.

◆ GetPrevItem()

FBGenericMenuItem GetPrevItem ( FBGenericMenuItem  pItem)

Returns the menu item preceding an other item.

Returns null if this is the first item in menu.

Parameters
pItemWill return the item BEFORE pItem
Returns
Will return the item BEFORE pItem. Null if pItem is the first item.

◆ InsertAfter()

FBGenericMenuItem InsertAfter ( FBGenericMenuItem  pBeforeItem,
str  pItemName,
int  pItemId,
FBGenericMenu  pMenu = None 
)

Inserts a new menu Item AFTER another item.

Parameters
pBeforeItemThe reference item. We will create a new item AFTER this one.
pItemNameCaption of the newly added item.
pItemIdUnique id of this menu item.
pMenuOptional. If this Item leads to another menu (embedded) it can be specified here.
Returns
Will return the menu item created from this insertion.

◆ InsertBefore()

FBGenericMenuItem InsertBefore ( FBGenericMenuItem  pAfterItem,
str  pItemName,
int  pItemId,
FBGenericMenu  pMenu = None 
)

Inserts a new menu Item BEFORE another item.

Parameters
pAfterItemThe reference item. We will create a new item BEFORE this one.
pItemNameCaption of the newly added item.
pItemIdUnique id of this menu item.
pMenuOptional. If this Item leads to another menu (embedded) it can be specified here.
Returns
Will return the menu item created from this insertion.

◆ InsertFirst()

FBGenericMenuItem InsertFirst ( str  pItemName,
int  pItemId,
FBGenericMenu  pMenu = None 
)

Inserts a new menu Item at the first position in the menu list.

Parameters
pItemNameCaption of the newly added item.
pItemIdUnique id of this menu item.
pMenuOptional. If this Item leads to another menu (embedded) it can be specified here.
Returns
Will return the menu item created from this insertion.

◆ InsertLast()

FBGenericMenuItem InsertLast ( str  pItemName,
int  pItemId,
FBGenericMenu  pMenu = None 
)

Inserts a new menu Item at the last position in the menu list.

Parameters
pItemNameCaption of the newly added item.
pItemIdUnique id of this menu item.
pMenuOptional. If this Item leads to another menu (embedded) it can be specified here.
Returns
Will return the menu item created from this insertion.

Member Data Documentation

◆ OnMenuActivate

FBEvent OnMenuActivate

Event Property: Register on this property to be notified when a menu item is clicked by the user.