pymel.core.windows.contentBrowser¶
- contentBrowser(*args, **kwargs)¶
This command is used to edit and query a Content Browser. The Content Browser is a unique panel, so only one instance of it can exist at a given time. The optional argument is the name of the control.
Flags:
Long Name / Short Name Argument Types Properties addContentPath / acp unicode Adds the given path(s) to the libraries displayed on the Examples tab. Also updates the corresponding MAYA_CONTENT_PATH environment variable. context / ctx unicode, unicode, unicode Sets the default location for the given context. The two optional arguments (Python only) are the category (tab) and location. To clear the content use empty strings for category and location. In query mode, it returns the context of the content browser in an array of 3 strings : the name of the context, the default category name, the default location. control / ctl bool Query only. Returns the top level control for this editor. Usually used for getting a parent to attach popup menus. Caution: It is possible for an editor to exist without a control. The query will return NONEif no control is present. defineTemplate / dt unicode Puts the command in a mode where any other flags and arguments are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template. docTag / dtg unicode Attaches a tag to the editor. exists / ex bool Returns whether the specified object exists or not. Other flags are ignored. filter / f unicode Specifies the name of an itemFilter object to be used with this editor. This filters the information coming onto the main list of the editor. forceMainConnection / fmc unicode Specifies the name of a selectionConnection object that the editor will use as its source of content. The editor will only display items contained in the selectionConnection object. This is a variant of the -mainListConnection flag in that it will force a change even when the connection is locked. This flag is used to reduce the overhead when using the -unlockMainConnection , -mainListConnection, -lockMainConnection flags in immediate succession. highlightConnection / hlc unicode Specifies the name of a selectionConnection object that the editor will synchronize with its highlight list. Not all editors have a highlight list. For those that do, it is a secondary selection list. location / loc unicode Switches to the Examples tab and selects the given library location. lockMainConnection / lck bool Locks the current list of objects within the mainConnection, so that only those objects are displayed within the editor. Further changes to the original mainConnection are ignored. mainListConnection / mlc unicode Specifies the name of a selectionConnection object that the editor will use as its source of content. The editor will only display items contained in the selectionConnection object. panel / pnl unicode Specifies the panel for this editor. By default if an editor is created in the create callback of a scripted panel it will belong to that panel. If an editor does not belong to a panel it will be deleted when the window that it is in is deleted. parent / p unicode Specifies the parent layout for this editor. This flag will only have an effect if the editor is currently un-parented. preview / pv bool Shows / hides the preview panel. Note: this flag will not affect the currently opened Content Browser, but only any subsequently opened ones. refreshTreeView / rtv bool Forces a refresh of the Examples tab tree view pane. removeContentPath / rcp unicode Removes the given path(s) from the libraries displayed on the Examples tab. Also updates the corresponding MAYA_CONTENT_PATH environment variable. saveCurrentContext / scc bool Saves the context for the current Content Browser tab. selectionConnection / slc unicode Specifies the name of a selectionConnection object that the editor will synchronize with its own selection list. As the user selects things in this editor, they will be selected in the selectionConnection object. If the object undergoes changes, the editor updates to show the changes. stateString / sts bool Query only flag. Returns the MEL command that will create an editor to match the current editor state. The returned command string uses the string variable $editorName in place of a specific name. thumbnailView / th bool Shows / hides the thumbnail panel. Note: this flag will not affect the currently opened Content Browser, but only any subsequently opened ones. treeView / tr bool Shows / hides the tree view panel. Note: this flag will not affect the currently opened Content Browser, but only any subsequently opened ones. unParent / up bool Specifies that the editor should be removed from its layout. This cannot be used in query mode. unlockMainConnection / ulk bool Unlocks the mainConnection, effectively restoring the original mainConnection (if it is still available), and dynamic updates. updateMainConnection / upd bool Causes a locked mainConnection to be updated from the orginal mainConnection, but preserves the lock state. useTemplate / ut unicode Forces the command to use a command template other than the current one. Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.contentBrowser
Example:
- ::
import pymel.core as pm
import maya.cmds as cmds
# Create the Content Browser and select library in the Examples tab. pm.scriptedPanel(‘contentBrowserPanel1’, edit=True, tearOff=True, label=’Content Browser’) # Result: [ui.ScriptedPanel(‘contentBrowserPanel1’)] # panelNames = pm.getPanel(scriptType=’contentBrowserPanel’) panelName = panelNames[0] panelCompleteName = panelName + ‘ContentBrowser’ pm.contentBrowser(panelCompleteName, edit=True, location=’Examples/FX/Fluids/Ocean Examples’) # Result: u’contentBrowserPanel1ContentBrowser’ #
# Hide the preview pane. pm.contentBrowser(panelCompleteName, edit=True, preview=False) # Result: u’contentBrowserPanel1ContentBrowser’ # pm.scriptedPanel(‘contentBrowserPanel1’, edit=True, tearOff=True, label=’Content Browser’) # Result: ui.ScriptedPanel(‘contentBrowserPanel1’) #