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

The menu manager allows access to MotionBuilder menu bar. More...

#include <pyfbsdk_generated.h>

Inheritance diagram for FBMenuManager:

Public Member Functions

 FBMenuManager ()
 Constructor.
 
bool ExecuteMenuItem (str pMenuPath, int pMenuItemID)
 Execute a particular menu item.
 
bool ExecuteMenuItemFromFullPath (str pMenuItemFullPath)
 Execute a particular menu item.
 
FBGenericMenu GetMenu (str pPath)
 Get the Menu (NOT menu item) corresponding to a menu path.
 
FBGenericMenuItem InsertAfter (str pMenuPath, str pBeforeMenuName, str pMenuName)
 Insert a new menu at a specific path AFTER another item.
 
FBGenericMenuItem InsertBefore (str pMenuPath, str pAfterMenuName, str pMenuName)
 Insert a new menu at a specific path BEFORE another item.
 
FBGenericMenuItem InsertFirst (str pMenuPath, str pMenuName)
 Insert a new menu at the first position of a specific path.
 
FBGenericMenuItem InsertLast (str pMenuPath, str pMenuName)
 Insert a new menu at the last position of a specific path.
 
bool IsItemEnable (str pMenuPath, int pItemId)
 Check if a particular item is enabled or disabled.
 
 SetItemEnable (str pMenuPath, int pItemId, bool pEnable)
 Enable or disable a specific menu item.
 
- 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.
 

Additional Inherited Members

- 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

The menu manager allows access to MotionBuilder menu bar.


It can be used to retrieve the item corresponding to a menu path in the menu bar. A menu path is similar to a file path but it specifies the location of menu item in a hierarchy of menu. ex: to retrieve the item corresponding to MoBu Save item: item = menuMgr.GetMenu("File/Save")Other menu items in MoBu menu bar include the following: "File", "Edit","Animation","Window","Settings", "Layout","Help"The menu manager can be used to insert new menu item in the menubar. You have to specify the menu path at which to insert the menu (to insert a new root menu, use NULL or None as the menu path)

#Insert a new Root Menu before the Help menu
menuMgr.InsertBefore(None, "Help", "before menu")
#Insert a new Root Menu after the Help menu
menuMgr.InsertAfter(None, "Help", "After menu")

As a convenience operation, you can from the menu manager enable and disable menu item (instead of retrieving their corresponding item).

See sample: FBMenu.py.

Constructor & Destructor Documentation

◆ FBMenuManager()

Constructor.

There is only one MenuManager in MotionBuilder, creating multiple FBMenuManager always return the same handle to the same global menu manager.

Member Function Documentation

◆ ExecuteMenuItem()

bool ExecuteMenuItem ( str  pMenuPath,
int  pMenuItemID 
)

Execute a particular menu item.

The menu path specifies the menu containing the menu item to execute. The ID specifies which menu item to execute in the menu.

Parameters
pMenuPathPath containing the menu item to execute.
pMenuItemIDUnique ID of the menu item to execute.
Returns
True if the menu item has been executed, false otherwise. It could returns false if the menu item cannot be found or if the menu item is found but is disabled or is a separator.

◆ ExecuteMenuItemFromFullPath()

bool ExecuteMenuItemFromFullPath ( str  pMenuItemFullPath)

Execute a particular menu item.

The menu path specifies the menu item (NOT menu) to execute. Don't forget that most menu path already in MotionBuilder have a "&" as the first letter of their name. You have to use the "/" character as a separator in the specified menu path (ex: "Settings/&Preferences..."), and exactly what is written in the menu item (ex: "Edit/D&eselect\tShift+D").

# This example shows how to display the About Box, as if the user opened it via the main menu Help > About MotionBuilder:
menuManager = FBMenuManager()
aboutBoxFullPath = "Help/&About MotionBuilder"
menuManager.ExecuteMenuItemFromFullPath( aboutBoxFullPath )
bool ExecuteMenuItemFromFullPath(str pMenuItemFullPath)
Execute a particular menu item.
FBMenuManager()
Constructor.
Parameters
pMenuItemFullPathPath of the menu item to execute.
Returns
True if the menu item has been executed, false otherwise. It could returns false if the menu item cannot be found or if the menu item is found but is disabled or is a separator.

◆ GetMenu()

FBGenericMenu GetMenu ( str  pPath)

Get the Menu (NOT menu item) corresponding to a menu path.

Don't forget that most menu path already in MotionBuilder have a "&" character as the first letter of their name. You have to use the "/" character as a separator in the specified menu path (ex: "Help/&Communities").

Parameters
pPathPath of the menu to retrieve
Returns
the FBGenericMenu at this path./

◆ InsertAfter()

FBGenericMenuItem InsertAfter ( str  pMenuPath,
str  pBeforeMenuName,
str  pMenuName 
)

Insert a new menu at a specific path AFTER another item.

Parameters
pMenuPathPath where to insert the menu. If this is NULL (None) it will insert a new root menu.
pBeforeMenuNameName of the menu item AFTER which we will insert the new item.
Returns
Returns the menu item corresponding to the newly inserted menu.

◆ InsertBefore()

FBGenericMenuItem InsertBefore ( str  pMenuPath,
str  pAfterMenuName,
str  pMenuName 
)

Insert a new menu at a specific path BEFORE another item.

Parameters
pMenuPathPath where to insert the menu. If this is NULL (None) it will insert a new root menu.
pAfterMenuNameName of the menu item BEFORE which we will insert the new item.
Returns
Returns the menu item corresponding to the newly inserted menu.

◆ InsertFirst()

FBGenericMenuItem InsertFirst ( str  pMenuPath,
str  pMenuName 
)

Insert a new menu at the first position of a specific path.

Parameters
pMenuPathPath where to insert the menu. If this is NULL (None) it will insert a new root menu.
pMenuNameName (Caption) of the newly inserted menu.
Returns
Returns the menu item corresponding to the newly inserted menu.

◆ InsertLast()

FBGenericMenuItem InsertLast ( str  pMenuPath,
str  pMenuName 
)

Insert a new menu at the last position of a specific path.

Parameters
pMenuPathPath where to insert the menu. If this is NULL (None) it will insert a new root menu.
pMenuNameName (Caption) of the newly inserted menu.
Returns
Returns the menu item corresponding to the newly inserted menu.

◆ IsItemEnable()

bool IsItemEnable ( str  pMenuPath,
int  pItemId 
)

Check if a particular item is enabled or disabled.

The menu path specifies the menu where we find the item to be enabled/disabled. The Id specifies which item in the menu.

Parameters
pMenuPathPath where to find the menu to check
pItemIdId of the item to check.
Returns
Is the item enable or not.

◆ SetItemEnable()

SetItemEnable ( str  pMenuPath,
int  pItemId,
bool  pEnable 
)

Enable or disable a specific menu item.

The menu path specifies the menu where we find the item to be enabled/disabled. The Id specifies which item in the menu.

Parameters
pMenuPathPath where to find the menu to enable/disable
pItemIdId of the item in the menu to disable.
pEnableEnable (true) or disable (false) a menu item.