Skip to content

defSearch


=== Author: Assaf Ben Zur ===

Core MNS Utility UI

This UI will allow the user to search though all available function within a given library and build a dynamic UI for it, based on it's arguments and keyword arguments drawen as 'type' QObjects into a new UI window.

This UI class will search thorugh the default library (mns), although has functionallity to add any library into the search.

IMPORTANT: Any given custom library needs to follow the mns code structure convension in order to work and sraw properly. Please refer to some code examples.

The main process of this UI class is:

  • Load the UI

  • procedurally look through the given libraries and add any found python defenition into the UI list.

  • Uppon a 'UI creation' call (via the button or souble-click):

    - Deconstruct the selected defenition into mandatory arguments and keyword arguments

    - Build a new UI based on the parameters got.

  • Uppon a 'Run' call:

    - Re-construct the function's argument based on the UI fields and recompile into a string

    - Call the selected function using the complied arguent string

Features:

  • Prefs tab to control the UI's behavior.

  • Directory addition

  • Indepentent custom '.py' files add

  • Library reload

  • 'Default Prefs restore'

  • Settings export/import

  • Function 'pinning' (Global, session independent)

  • UI features - Search, Case-Sensative display, Pinned view only, clear all pinns

  • 'dev mode':

    - When set to False (default) the UI call will create a new UI only if it han't been created before-

    meaning that the UI objects are kept within the UI class, and when closed will not lose their user-set values.

    When called again, the UI will simply re-load- not re-create to keep previous set values. The function will not be read again to build.

    When set to True, instead of re-loading of a previously created UI- it will be deleted- and recreated, READING THE FUNCTION AGAIN.

    This allows the user to re-read a function every time the UI is called- that means that all previous value set will be lost- as the UI rebuilds it will set all items to default value.

    This gives a very fast way of developing a function- not needing to re-load maya after edit-

    The UI will rebuild based on any change made to the defenition code, adding any new items or running a different fuctionallity every run call.

    Use this feature when writing or developing a new fuction.


Classes


MnsDefSearch [Class]

Main UI Class


Constructor: MnsDefSearch(parent(str) ; [default: mnsUIUtils.get_maya_window()])
Inherits from: form_class, base_class
Class Members:
    • pinnedFilePath
Methods:

MnsDefSearch methods


addModuleToResults [MnsDefSearch class method]


Module add method trigger.

Constructor: addModuleToResults(self, module)
Return: None
Arguments:
  • self
  • module
Optional Arguments:

addPackageToResults [MnsDefSearch class method]


Package addition method trigger.

Constructor: addPackageToResults(self, package)
Return: None
Arguments:
  • self
  • package
Optional Arguments:

clearPins [MnsDefSearch class method]


Clear all pinns method trigger.

Constructor: clearPins(self)
Return: None
Arguments:
  • self
Optional Arguments:

clearResults [MnsDefSearch class method]


Clear Serach method trigger.

Constructor: clearResults(self)
Return: None
Arguments:
  • self
Optional Arguments:

connectSignals [MnsDefSearch class method]


Connect all UI signals

Constructor: connectSignals(self)
Return: None
Arguments:
  • self
Optional Arguments:

createUI [MnsDefSearch class method]


Main dynamic UI creation method trigger based on current selection.

Constructor: createUI(self)
Return: None
Arguments:
  • self
Optional Arguments:

importModules [MnsDefSearch class method]


Import modules wrapper.

Constructor: importModules(self)
Return: None
Arguments:
  • self
Optional Arguments:

import_submodules [MnsDefSearch class method]


Recursive method to walk thorugh a given package and sub-packages to store all sub-directories within.

Constructor: import_submodules(self, package, recursive=True)
Return: dict
Arguments:
  • self
  • package
  • recursive(bool) ; [default: True]
Optional Arguments:

initializePinnedDir [MnsDefSearch class method]

Constructor: initializePinnedDir(self)
Return: None
Arguments:
  • self
Optional Arguments:

loadList [MnsDefSearch class method]


Main list load method.

A wrapper to filter all functions based on prefs selected and update the UI.

Constructor: loadList(self)
Return: None
Arguments:
  • self
Optional Arguments:

loadWindow [MnsDefSearch class method]


Main UI load

Constructor: loadWindow(self)
Return: None
Arguments:
  • self
Optional Arguments:

pin [MnsDefSearch class method]


Pin call method trigger based on current selection.

Constructor: pin(self)
Return: None
Arguments:
  • self
Optional Arguments:

pinnedOnlyView [MnsDefSearch class method]


Pinned only view trigger method.

Constructor: pinnedOnlyView(self, state)
Return: None
Arguments:
  • self
  • state
Optional Arguments:

reloadResults [MnsDefSearch class method]


Wrapper re-load method.

Constructor: reloadResults(self)
Return: None
Arguments:
  • self
Optional Arguments:

updateResults [MnsDefSearch class method]


Main UI view update method trigger.

The UI list will be updated from this method based on the current UI state and prefs

Constructor: updateResults(self)
Return: None
Arguments:
  • self
Optional Arguments:


Defenitions


loadDefSearch

Load the Def Serach UI from globals, avoid UI duplication.


Constructor: loadDefSearch()
Return: None
Arguments:
Keyword Arguments: