buildModules
=== Author: Assaf Ben Zur ===
This is the core BLOCK Build-Modules class library.
This package contains the three main classes for BLOCK:
-
MnsBuildModuleBtn
-
MnsRig
-
MnsBuildModule
Most core function are defined within the classes, although any external functionality is maintained in 'blockUtility' py module.
The objective of these classes are mainly effeciant data gathering, constructing and deconstructing modules within a rig group.
Classes
MnsBuildModule [Class]
This class is the data store class for any mns 'build-module'.
This class contains the actual creation and deletion of the module, guides and controls.
This class will be initialized through the MnsRig class, althogh process functions regarding the modules are store in this class only.
This class is purely procedular, and so it should remain.
As the main goal of the rig is maintaining dynamic abilities, and easy creation of modules,
this class should remain completely independent of any specific build module.
Guides creation is partlly procedural, as any "main-guides" creation is fully automatic,
although custom-guides creation isn't- as it is module specific, hence it is store within the buildModule directory.
Interp Joint Structure creation is procedural, although its essence is also defined within each build-module directory, althogh it is not mandatory.
As the build modules are very specific and have to be created manually, guide creation is kept independent.
This for easily creating modules, not needing to worrie about the handeling of guides, consruction and deconstruction.
The actual flow of the build is independent of the modules setup internals.
Constructor: | MnsBuildModule(MnsBuildModuleButton,**kwargs) |
Inherits from: | MnsRig |
Class Members: |
|
Methods: |
|
MnsBuildModule methods
buildGuideObjects [MnsBuildModule class method]
A simple method to gather the amount of needed guides to create, and calling the creation accordingly.
Constructor: | buildGuideObjects(self, **kwargs) |
Return: | None |
Arguments: |
|
Optional Arguments: |
|
buildGuides [MnsBuildModule class method]
This method is the initialize method for new guides creation.
This method will be called first (before 'createGuides') and will also load the modules creation settings window if neccessary.
Constructor: | buildGuides(self, MnsBuildModuleButton, **kwargs) |
Return: | None |
Arguments: |
|
Optional Arguments: |
|
collecteModuleSettings [MnsBuildModule class method]
Constructor: | collecteModuleSettings(self, rootGuide = None) |
Return: | None |
Arguments: |
|
Optional Arguments: |
connectVisChannels [MnsBuildModule class method]
This method will connect this module into it's related vis channel in the puppet root control.
Constructor: | connectVisChannels(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
construct [MnsBuildModule class method]
The main construct method.
The actual 'Construct' method within the build module directory is being called here.
Flow:
- make sure the module isn't built
- get the puppet root
- try and find the related 'construct' method within the build module directory (or package).
- construct the module, feeding the construct method with all of the requested module settings.
this will transfer the related joints to their new ctrl authority.
- connect a vis channel to the new module group created.
- re-collect relations for the module (post build).
- Set colors for all built controls.
- parent the new bm top group in the puppet group.
- try restore defaults if there are any.
Constructor: | construct(self) |
Return: | MnsBuildModule (self, this buildModule class) |
Arguments: |
|
Optional Arguments: |
constructAttrHostCtrl [MnsBuildModule class method]
Constructor: | constructAttrHostCtrl(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
constructAttrHostSpace [MnsBuildModule class method]
Constructor: | constructAttrHostSpace(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
constructSpaces [MnsBuildModule class method]
This method is the spaces construction processing.
This method is seperated from the main construct method in order to run it after an entire construction.
Because the spaces within the module are dependent of other modules, a first loop is run to construct the modules,
after, another loop is running through the built modules, calling this method, trying to construct all of it's spaces.
Constructor: | constructSpaces(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
createAttrHostCustomGuide [MnsBuildModule class method]
Constructor: | createAttrHostCustomGuide(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
createExtraChannels [MnsBuildModule class method]
Constructor: | createExtraChannels(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
createGuides [MnsBuildModule class method]
This is the main guide creation method.
This method contains all the steps needed to gather a module data, and create the guides for it.
This method will return the built guides, as well as store it in this class 'builtGuides' attribute.
Constructor: | createGuides(self, **kwargs) |
Return: | list (bbuiltGuides) |
Arguments: |
|
Optional Arguments: |
|
createIsolatedInterpJointsControls [MnsBuildModule class method]
Constructor: | createIsolatedInterpJointsControls(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
createModuleTopNode [MnsBuildModule class method]
This method is used to create the genric 'module top group' on module construction.
Constructor: | createModuleTopNode(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
deconstruct [MnsBuildModule class method]
This is the main module deconstruction method.
Flow:
- Make sure the module is constructed
- In case a deconstruvt method (non mandatory method) is found within the build-module's directory, run it.
- Transfer all joint authoities back to the guides.
- Remove the related vis channel from puppet root (Needed in case a partial deconstruction was called).
- Delete the build module.
- Set the construction state for the build module.
Constructor: | deconstruct(self, mnsRig) |
Return: | MnsBuildModule (self, this buildModule class) |
Arguments: |
|
Optional Arguments: |
filterValidSpacs [MnsBuildModule class method]
Constructor: | filterValidSpacs(self, sourceSpaces = [], **kwargs) |
Return: | None |
Arguments: |
|
Optional Arguments: |
gatherAllDependecies [MnsBuildModule class method]
Gather all scene object dependecies for the buildModule.
A simple wrapper containing 'gatherRelatedGuides' method & gatherRelatedCtrls method.
Constructor: | gatherAllDependecies(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
gatherRelatedCtrls [MnsBuildModule class method]
This method will collect and store the build-module related control objects from the rig.
Constructor: | gatherRelatedCtrls(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
gatherRelatedGuides [MnsBuildModule class method]
This method will gather the buildModules related guides from the rig.
collected objects:
- rootGuide
- guides
- customGuides
The data collected is stored in their related class attributes:
- rootGuide - 'rootGuide'
- guides - 'guideControls'
- custom guides - 'cGuideControls'
Constructor: | gatherRelatedGuides(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
getRigTop [MnsBuildModule class method]
get the rigTop nameStd from current selection.
If it doesn't exist, initiate a new rig top creation.
Constructor: | getRigTop(self) |
Return: | MnsNameStd (rigTop) |
Arguments: |
|
Optional Arguments: |
reCollectControlsFromLocals [MnsBuildModule class method]
Re-initialize the 'allControls' attribute of this class, based on the current rig state.
Constructor: | reCollectControlsFromLocals(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
removeIsolatedInterpJointsControls [MnsBuildModule class method]
Constructor: | removeIsolatedInterpJointsControls(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
restoreCustomDefaults [MnsBuildModule class method]
This method will attempt to restore any pre-stored 'defaults' set a newly created control.
related method: storeCustomDefaults.
Constructor: | restoreCustomDefaults(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
splitControlsBasedOnType [MnsBuildModule class method]
Constructor: | splitControlsBasedOnType(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
storeCustomDefaults [MnsBuildModule class method]
This method stores any custom 'defaults' set for the entire module.
The collection is stored within the rootGuide node.
This is important beacuse when the module is deconstructed, the ctrls containing the 'defaults' attribute are eventually deleted.
So, in order to keep the information on deletion, this method runs thorugh the modules controls,
and storing the set 'defaults' attribute within the rootGuide, in order to restore them when a reconstruction is called.
related method: restoreCustomDefaults
Constructor: | storeCustomDefaults(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
updateCreationArgsToSymmetryMode [MnsBuildModule class method]
This method will alter the current setting to their symmetry mode,
In case the 'symmetrize' flag was passed into the buildGuides method.
Altered attributes:
- side (or blkSide)
- spaces- if a side related space was found, symmetrize the space as well.
Constructor: | updateCreationArgsToSymmetryMode(self, optArgs) |
Return: | dict (optionalArguments) |
Arguments: |
|
Optional Arguments: |
MnsBuildModuleBtn [Class]
The procedural 'module' button class.
This class is being called and constructed procedurally from the file system based on folder contents.
The class itself isn't inhereting from QPushButton, as it only exists to contain build location information.
The class contains a constuctor only, which initializes the following information:
-
The full-path to the buildModule
-
The layout Parent of the button
-
The group of the button, based on the folder structure of which the bm is located in.
-
The 'settings' file-path.
-
Short-Name
-
The obselete - 'isMayaNative' attribute.
This information will be accessed once the related QPushButton will be triggered.
Constructor: | MnsBuildModuleBtn(path,**kwargs) |
Inherits from: | object |
Class Members: |
|
MnsRig [Class]
This is the main 'RIG' data class.
This class's constructor will initialize and build all relevant information regarding the 'rig' top top group.
As The rig topGrp has pre-defined structure, and many dependencies, all basic information will be checked every time this class is constructed.
The essence of this class is first of all to build the predefined rigGroup,
then, to store and parse all relevant data from the scene, as well as validating it and rebuilding any sub-components if necessary.
The procedural settings UI build will be initiated if a rig top wasn't found in the current scene selection (or if there is no selection).
In case a rigTop already exists, it will first be validated, then it's setting will be read and parsed, initiating the the same UI draw, in "edit" mode.
MnsRig methods
collectBuildModules [MnsRig class method]
Collect all build modules guide hierarchy into the 'modules' attribure of this class.
This method will run through the rig, and attempt to collect it's guide heirarchy, validating the modules while collecting.
Constructor: | collectBuildModules(self, **kwargs) |
Return: | None |
Arguments: |
|
Optional Arguments: |
connectLODs [MnsRig class method]
Constructor: | connectLODs(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
constructRig [MnsRig class method]
This method is the main 'Construction' call for a mnsRig.
Flow:
- Log, and set Timer
- Collect all relevant data from the rig
- Collect modules to build
- Loop through the 'modules' dict attribute of this class:
- Initiate the 'Construct' method for every buildModule class within the collection.
Constructor: | constructRig(self, **kwargs) |
Return: | None |
Arguments: |
|
Optional Arguments: |
createNewRigTop [MnsRig class method]
Create the main rig group, with all of its sub-Components within.
Constructor: | createNewRigTop(self, **kwargs) |
Return: | None |
Arguments: |
|
Optional Arguments: |
createPickerCam [MnsRig class method]
Create the predefined "picker Layout View" camera within the rig.
This camera will be used as the view camera when an "edit picker layout" trigger was initiated from BlockUI.
The camera is orthographic, and will be used in a seperate display (Maya-Panel).
This to allow easy view of the picker layout, and easy manipulation of PLG shapes and controls.
Constructor: | createPickerCam(self, rigTop, pickerLayoutBase, **kwargs) |
Return: | MnsNameStd (Picker Layout Camera) |
Arguments: |
|
Optional Arguments: |
createPickerGuideGrp [MnsRig class method]
Create the main Picker-Layout-Guides sub-component.
Constructor: | createPickerGuideGrp(self, rigTop, pickerLayoutBase, **kwargs) |
Return: | MnsNameStd (guidesGrp) |
Arguments: |
|
Optional Arguments: |
createPickerLayoutBase [MnsRig class method]
Create Picker Layout Base control, and construct all of it's predefined attributes.
The predefined attributes for the PLG base is the following:
- width - Will define the width of the rig's picker window
- height- Will define the height of the rig's picker window
- titleVis - vis attr for the title-group
- titleSize - a global scalar for all mnsAnnotate PLG titles.
This group also contains a few vis control channels to allow easier edit for the PLGs:
- bodyPrimaries
- bodySecondaries
- bodyTertiaries
- facialPrimaries
- facialSecondaries
- facialTertiaries
These sub-vis channels will be controled by a global toggle attribute:
- pickerMode
This will dictate the picker's scene vis mode, the toggle is between 'body' and 'facial' modes.
As the picker inhabits to tabs - body and facial, these attributes will allow better manipulation of PLG, grouping them according to the actual picker window tab grouping.
Constructor: | createPickerLayoutBase(self, rigTop, **kwargs) |
Return: | MnsNameStd (baseLayoutGuide) |
Arguments: |
|
Optional Arguments: |
createPickerProjectionCam [MnsRig class method]
Create the predefined "PLG Projection" camera within the rig.
A dedicated mns node is used here - 'mnsCamreGateRatio':
This dedicated node was written in order to control the camera shape 'gateRatio' attribute.
Because this attribute isn't connectable (internal callback within the camera shape),
mnsCameraGateRatio inserts a custom maya-callback into itself, in-order to refresh the camera-gate in a "live" fashion,
This will allow the user to edit the width and height of the projection camera, seeing a live feed of it's gate in the view.
As the projection is based on the camera gate, it is very important for the user to see the actual gate used, while projecting PLG's.
Constructor: | createPickerProjectionCam(self, rigTop, pickerLayoutBase) |
Return: | MnsNameStd (Picker Projection Camera) |
Arguments: |
|
Optional Arguments: |
createPickerTitleGrp [MnsRig class method]
Create the Picker Layout 'titles' sub-component.
This group contains the mnsAnnotate locators to toggle PLG view between it's shape and it's title.
Constructor: | createPickerTitleGrp(self, rigTop, pickerLayoutBase,**kwargs) |
Return: | MnsNameStd (titleGrp) |
Arguments: |
|
Optional Arguments: |
createPredefinedCnsControls [MnsRig class method]
Constructor: | createPredefinedCnsControls(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
createPuppetRootCtrl [MnsRig class method]
Create the rig's predefined "puppetRoot" or "worldControl".
This depends on the rootGuide of course, and transfer the rigs "Root-Joint" Authority from the rootGuide, to the new puppetRoot control.
This method will return the new control, as well as store it in the 'puppetTopCtrl' attribute of this class.
Constructor: | createPuppetRootCtrl(self, rigTop, **kwargs) |
Return: | MnsNameStd (Root Guide) |
Arguments: |
|
Optional Arguments: |
createRigInfo [MnsRig class method]
Constructor: | createRigInfo(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
createRootGuide [MnsRig class method]
Create the "world control guide", or "rigRootGuide".
This rootGuide will be locked completely and will define the predefined "world" control for the puppet.
This entity is mandatory.
Constructor: | createRootGuide(self, rigTopNameStd, **kwargs) |
Return: | MnsNameStd (Root Guide) |
Arguments: |
|
Optional Arguments: |
createSubGroupForRigTop [MnsRig class method]
Create the predefined "guideGrp" or "freeJointsGrp" within the rig.
Guides Group - Contains the module main guides.
Free Joints Group - Contains the interpLocs intermediate matricies for the interJnts in the main jointStructure
Constructor: | createSubGroupForRigTop(self, rigTopNameStd, **kwargs) |
Return: | MnsNameStd (guideGrp/freeJointsGrp) |
Arguments: |
|
Optional Arguments: |
|
createSubGrpsForRigTop [MnsRig class method]
This wrapper creates all the sub-group components for a given main rigTop group.
The sub-groups defenition is the following:
- guideGrp - Guides group component
- puppetGrp - The Puppet group.
- jointStructGrp - Joint Structure group
- pickerLayoutGrp - Picker Layout guiides group.
- controlShapesGrp - Stored custom shapes group.
- freeJointsGrp - "Free joints" group, containing interLocs as intermediate objects to the interJoints in the main joint structure.
Constructor: | createSubGrpsForRigTop(self, rigTop = None) |
Return: | None |
Arguments: |
|
Optional Arguments: |
createVisEnumAndConnect [MnsRig class method]
For any given slave MnsNameStd group passed in, create a generic vis channel and connect it.
The Enums of the generic vis channels are the following:
- hidden
- normal
- template
- reference
Constructor: | createVisEnumAndConnect(self, masterStd, slaveStd, **kwargs) |
Return: | PyAttribute (created attribute) |
Arguments: |
|
Optional Arguments: |
|
cunstructRigSpaces [MnsRig class method]
Attempt to construct spaces for all 'modules' within the rig.
Constructor: | cunstructRigSpaces(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
deconstructRig [MnsRig class method]
This is the main deconstruction method for the rig.
Flow:
- Log, and set Timer
- Collect all relevant data from the rig
- Collect modules to build
- Loop through the 'modules' dict attribute of this class:
- Initiate the 'Deconstruct' method for every buildModule class within the collection.
Constructor: | deconstructRig(self, **kwargs) |
Return: | None |
Arguments: |
|
Optional Arguments: |
destroyPuppetRootCtrl [MnsRig class method]
This method will destroy the rig's puppetRoot control, and transfer the rig's root-joint authority back to it's rootGuide.
Constructor: | destroyPuppetRootCtrl(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
executeCustomScripts [MnsRig class method]
for the given 'customScripts' attribute: compile the run files, and execute (if set).
Constructor: | executeCustomScripts(self, attrName = None) |
Return: | bool (Execution success) |
Arguments: |
|
Optional Arguments: |
failedConstructionCommand [MnsRig class method]
A global method to display and return a message dialog whenever a build fails.
This method displays 3 options and returns a paraller state:
- 0: 'Continue'
- 1: 'Abort'
- 2: 'Revert-Construction'
Constructor: | failedConstructionCommand(self, fileName = "") |
Return: | int (state/button clicked) |
Arguments: |
|
Optional Arguments: |
getGlobalConstructionState [MnsRig class method]
Gey the current rig construction state from rigTop attributes.
Constructor: | getGlobalConstructionState(self) |
Return: | int (mode) |
Arguments: |
|
Optional Arguments: |
loadSettingsWindow [MnsRig class method]
Load the dynamic "setting window" for the current rig.
Constructor: | loadSettingsWindow(self, **kwargs) |
Return: | None |
Arguments: |
|
Optional Arguments: |
restorePuppetBaseDefaults [MnsRig class method]
On reconstruction, attempt to restore the 'defaults' attribute for the puppet root, if there are any.
related method: storePuppetBaseDefaults
Constructor: | restorePuppetBaseDefaults(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
setConstructionMode [MnsRig class method]
Set the construction state attribute of the current rig.
Constructor: | setConstructionMode(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
setVisChannelsBasedOnCunstructMode [MnsRig class method]
A simple method to set the vis mode of the current rig based on it's construction state.
The construction mode is read from the rigTop attribues.
Construction modes:
0: Guides - guideGrpVis = True, puppetGrpVis = False
1: Intermediate (Partially built rig) - guideGrpVis = True, puppetGrpVis = True
2: Puppet - guideGrpVis = False, puppetGrpVis = True
Constructor: | setVisChannelsBasedOnCunstructMode(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
storePuppetBaseDefaults [MnsRig class method]
This method is used to store the current 'Defaults' set for the puppet-root control on deconstruction.
As deconstruction deletes all the controls, including the puppet-root, if any custom-defaults were set,
its essential to store them, in order to re-create them on re-construction.
This is a specific case for the root-control, as it isn't a 'build-module' hence, the generic defaults store for the build modules doesn't apply.
related method: restorePuppetBaseDefaults
Constructor: | storePuppetBaseDefaults(self) |
Return: | None |
Arguments: |
|
Optional Arguments: |
Defenitions
createModuleCompound
Constructor: | createModuleCompound(compoundMaster, moduleName, bmButtonList, parent, settings) |
Return: | None |
Arguments: |
|
Keyword Arguments: |
updateModules
Constructor: | updateModules(blkWin = None, rigTop = None, buildModulesBtns = [], **kwargs) |
Return: | None |
Arguments: |
|
Keyword Arguments: |
updateRig
Constructor: | updateRig(blkWin = None, buildModulesBtns = [], **kwargs) |
Return: | None |
Arguments: |
|
Keyword Arguments: |
updateRigTopAttrs
Constructor: | updateRigTopAttrs(rigTop = None) |
Return: | None |
Arguments: |
|
Keyword Arguments: |
updateRigTopStruct
Constructor: | updateRigTopStruct(rigTop = None, buildModulesBtns = []) |
Return: | None |
Arguments: |
|
Keyword Arguments: |