poselib package

Submodules

poselib.capturewidget module

class poselib.capturewidget.CaptureFrameRangeWidget(parent)

Bases: sphinx.ext.autodoc.importer._MockObject

Widget for capturing frame ranges used for generating clips and thumbnails.

endFrame()

Return the end frame captured by this widget.

showEvent(event)

Handle the show event.

startFrame()

Return the start frame captured by this widget.

class poselib.capturewidget.CaptureWidget(poselib)

Bases: sphinx.ext.autodoc.importer._MockObject

Widget containing capture pose controls.

closeEvent(event)

Close options dialog if Pose Library is closed.

hideOptions()

Closes options dialog. Called when leaving Edit Mode.

openClipOptions()

Opens Pose Library Clip Capture options dialog. Close other options dialog if it is open.

openPoseOptions()

Opens Pose Library Pose Capture options dialog. Close other options dialog if it is open.

reset()

Reset the capture widget to its default state.

poselib.character module

class poselib.character.Character(node, callback)
applyClip(clip, chop=True, root=None)

Applies a pose to the character.

@param chop: True if a separate CHOP Network should be generated

applyPose(clip, commit=True)

Applies a pose to the character.

blendPose(clip, amount, commit=True)
captureBlend()
captureClip(start, end, bake_clip, sample_rate)

Captures clip of character in provided range of frames.

@param bake_clip: True if baking clip as key frames @param sample_rate: Determines sample rate for generating key frames. Only used if bake_clip is true.

capturePose(frame, keyframe)

Captures current pose of character.

Returns hou.Pose object.

nodeEvent(**kwargs)
removeCallbacks()
scopedChannels()

poselib.chopdata module

class poselib.chopdata.ChopData
add(parm_name, chop)
apply(start, root, name)
capture(start, end)
hasData()
jsonDict()
setJSONDict(json_dict)

poselib.grid module

class poselib.grid.Grid(lib_widget, name, unsaved)

Bases: sphinx.ext.autodoc.importer._MockObject

Represents a group of poses/clips in the form of a grid in the library UI.

DEFAULT_ENTRY_ICON_HEIGHT

Used by autodoc_mock_imports.

DEFAULT_ENTRY_ICON_WIDTH

Used by autodoc_mock_imports.

DEFAULT_ENTRY_LABEL_HEIGHT

Used by autodoc_mock_imports.

ENTRY_BORDER_SIZE

Used by autodoc_mock_imports.

ENTRY_SPACING = 5
GRID_MARGIN = 5
addEntry(name, image, animated, pose)

Create a new pose entry and add it to the grid.

deleteEntry()
dragEnterEvent(event)
dragSwap(src, dest)
dropEvent(event)
exportToPath(save_path)

Exports grid entries to the given directory.

getUntitledClipCount()
getUntitledPoseCount()
gridContextMenuRequested

Used by autodoc_mock_imports.

gridEntryBorderSize()

Return the border size of a grid entry.

gridEntryHeight()

Return the height of a grid entry.

gridEntryIconHeight()

Return the height of just the icon portion of a grid entry.

gridEntryIconWidth()

Return the width of just the icon portion of a grid entry.

gridEntryLabelHeight()

Return the height of just the text portion of a grid entry.

gridEntrySizeChanged

Used by autodoc_mock_imports.

gridEntryWidth()

Return the width of a grid entry.

incrementNameCounters(name)
isCurrent()

Return True if this is the current grid in the Pose Library and False otherwise.

isInEditMode()

Convenience function for grid entries to determine if the Pose Library is in Edit Mode or not.

makeCurrent()

Make this grid the current grid.

moveEntry(entry, new_row, new_col)
removeEntry(entry)
resizeEvent(event)
showIcons(show)
showLabels(show)
tabName()

Accessor for the grid/tab name.

toJSON(include_entries=True)

Return a JSON representation of this pose grid.

undoEntry()

poselib.gridentry module

class poselib.gridentry.GridEntry(grid, name, image, animated, col, row, pose)

Bases: sphinx.ext.autodoc.importer._MockObject

Represents a pose/clip in the Pose Library grid interface.

animated()
blendChanged

Used by autodoc_mock_imports.

blendEnded

Used by autodoc_mock_imports.

blendStarted

Used by autodoc_mock_imports.

changeIcon(image_data, is_animated, image_file=None)

Change the entry’s icon with the given image data.

createSaveDirectory(save_path)

Create directory where this pose’s file resources will be stored.

Return True if directory was created successfully.

deleteRequested

Used by autodoc_mock_imports.

dragEnterEvent(event)
editingFinished()
enterEvent(event)
enterRenameState()

Show the name input field allowing the user to rename the pose entry.

entryContextMenuRequested

Used by autodoc_mock_imports.

exportPoseDataToFile(save_path)

Export only pose data to given path.

Return name of file pose was saved to, or None if save failed.

exportThumbnailToFile(save_path)

Export image data to given path.

Return name of file image was saved to, or None if save failed.

exportToFile()

Export this entry to a chosen file.

exportToHDA()

Saves the poses to an HDA

exportToPath(save_path)

Export this entry into the given directory.

Return name of folder pose was saved into, or None if pose failed to save.

imageData()

Accessor to entry’s icon image data.

leaveEvent(event)
mouseMoveEvent(event)

Handle mouse move events.

mousePressEvent(event)

Handle mouse press events.

mouseReleaseEvent(event)

Handle mouse release events.

name()
notifyEditModeChange()

Propagate the new Edit Mode state to the widgets in this grid entry.

poseApplied

Used by autodoc_mock_imports.

poseData()

Accessor to entry’s pose data.

requestDeletion()

Handle a request to delete this entry.

showEntryIcon(show)
showEntryLabel(show)
toJSON()

Return a JSON representation of this grid entry.

updateCoordinates(row, col)

poselib.librarywidget module

class poselib.librarywidget.LibraryWidget(poselib)

Bases: sphinx.ext.autodoc.importer._MockObject

The interface containing the loaded poses/clips.

addPose(name, image, animated, pose)

Add a new pose to the current grid.

addTab(name=None, unsaved=True)

Adds a new tab to the pose widget

clear()

Clear the entries in the library.

closeEvent(event)
currentGrid()

Return the current grid.

Return None if there is current grid.

ensureTabExists()

Checks if at least one tab is present in the poselib.

If there are no tabs then prompt the user to add one. Return True if there is at least one tab in the library and False otherwise.

globalSettings()

Convenience method for getting the Pose Library global settings.

handleNewPoseLibrary(load_from_existing=False, load_type=None, load_path=None)

Handle a request to create a new Pose Library.

importFromFile()

Handle a request to import entries into the current grid.

importFromHDA(clear_tabs=False, warn=True)

Import poses from an HDA into the current grid.

isPoseLibraryLoaded()

Returns True if pose/clip library has either a file, HDA, or directory source.

isSavingToHDA()

Return True if the library widget is currently saving to the source HDA definition and False otherwise.

keyPressEvent(event)
libraryDirectories()

Return directories referenced by library.

libraryName()

Return name of library.

loadFromDirectory(path=None)

Loads poses from a directory.

loadFromFile()

Loads poses from a JSON file.

loadFromHDA(hda_node=None)

Loads poses from an HDA.

loadFromTemp()

Loads poses from the temp directory.

mergeFromFile()

Merges poses from a JSON file.

mergeFromHDA()

Merge poses from an HDA.

poseLib()

Convenience method for accessing the root Pose Library widget.

promptToSave()

Prompt the user to save if there are unsaved changes.

If there are no unsaved changes then do nothing.

removeCurrentTab()

Closes the current tab, if one exists

removeTabs()

Removes all tabs and their contents from the pose library

reset()

Clear the current contents in the library widget and re-populate it with a default tab.

save()

Saves the current poses to whereever they were loaded from.

If there are no poses, create an empty pose/clip library source.

If the current poses do not have a source then prompt the user for a save location.

saveIfNeeded(grid_index=None)

Prompt the user to save the library if there are unsaved changes.

Return True if the library was saved successfully or if there are no unsaved changes. Return False otherwise.

You can optionally pass in a grid index so that unsaved changes are checked only for a particular grid.

saveToDirectory(save_path=None, save_file=None)

Saves the poses to a directory.

saveToFile(save_path=None)

Saves the poses to a file in JSON format

saveToHDA(hda_def=None)

Saves the poses to an HDA

sourceHDA()

Return the HDA definition that the current library is saved to.

Return None if the library is not saved to an HDA.

toJSON()

Return the JSON representation of the Pose Library’s state.

poselib.plglobals module

poselib.plglobals.chooseAndLoadPoseLibraryDirectory(prompt_title)
Prompt the user to choose a directory and load the pose library contained
in the directory.

Return a 2-tuple of the chosen save path and the pose library (JSON structure) that it contains. Return a 2-tuple of (None, None) if no directory was chosen or if the pose library could not be loaded from the file.

poselib.plglobals.chooseAndLoadPoseLibraryFile(prompt_title)
Prompt the user to choose a file and load the pose library contained in
the file.

Return a 2-tuple of the chosen file path and the pose library (JSON structure) that it contains. Return a 2-tuple of (None, None) if no file was chosen or if the pose library could not be loaded from the file.

poselib.plglobals.chooseAndLoadPoseLibraryHDA()
Prompt the user to choose a node and load the Pose Library contained in
the node’s HDA definition.

Return the pose library or None if there is a failure.

poselib.plglobals.chooseHDANode()

Prompt the user to choose a node that has an HDA definition.

Return the HDA node if one was selected. Return None otherwise.

poselib.plglobals.chooseOverwriteDirectory(output_path)

Choose whether to overwrite an existing directory.

poselib.plglobals.chooseOverwriteOrMergeFile(output_path, allow_merge)

Choose whether to overwrite or merge into an existing file.

poselib.plglobals.choosePoseLibrarySaveDirectory(prompt_title, default_directory_name)

Choose a save directory for the pose library.

Return the chosen save path. Return None if no path was chosen.

poselib.plglobals.choosePoseLibrarySaveFile(prompt_title, default_file_name)

Choose a save file for the pose library.

Return the chosen save path. Return None if no path was chosen.

poselib.plglobals.choosePoseLibrarySaveHDA()

Choose an HDA definition to save pose library data to.

Return the chosen HDA definition. Return None if no path was chosen.

poselib.plglobals.choosePoseLibrarySaveOrMergeFile(prompt_title, default_file_name)

Choose a save file for the pose library.

Return a 2-tuple containing the chosen save path and a boolean that is set to True if a merge action should be performed instead of a save.

The returned save path is None if no file was chosen.

poselib.plglobals.choosePoseLibrarySaveOrMergeHDA()

Choose an HDA definition to save pose library data to.

Return a 2-tuple containing the chosen HDA definition and a boolean that is set to True if a merge action should be performed instead of a save.

The returned HDA definition is None if no definition was chosen.

poselib.plglobals.clearAutosaveDirectory()

Clears pose library autosave directory.

poselib.plglobals.confirmDialog(message)

Create a confirm dialog with the options of “Save”, “Discard” and “Cancel”. Returns the option number chosen.

poselib.plglobals.errorDialog(main_message, additional_message=None)

Create an error dialog with the given message(s) and return if OK was pressed.

poselib.plglobals.getAvailableSavePath(save_path)

Gets an unused file name name by adding a number to end of given path and incrementing until a unique save path is obtained.

poselib.plglobals.getSceneViewerSelected()
poselib.plglobals.getViewportGif(frame_start, frame_end, include_all_objects=False, character_path=None)

Returns a QByteArray whose content is an animated gif that captures the animation of the current viewport from frame_start to frame_end. Ensure that frame_end - frame_start >= 2.0 is true before calling this.

poselib.plglobals.getViewportImage(frame=None, include_all_objects=False, character_path=None)

Returns a still image of the current viewport as a Base64 encoded string.

poselib.plglobals.inputDialog(text, title, initial_contents='')

Create a popup dialog with the given properties and return the result or None.

poselib.plglobals.jsonToStr(json_struct, pretty_print=False)

Converts a JSON structure to string.

poselib.plglobals.loadPoseLibraryDirectory(library_path)

Load the pose library from the pose library file at the given path.

Return None if the pose library could not be loaded.

poselib.plglobals.loadPoseLibraryFile(file_path)

Load the pose library contained in the specified file.

Return None if the pose library could not be loaded.

poselib.plglobals.loadPoseLibraryHDA(hda_def)
Return the Pose Library (JSON structure) stored in the specified HDA
definition.

Return None if the node does not a Pose Library in its HDA definition.

poselib.plglobals.loadThumbnailFromFile(image_path)

Loads image file at the given path.

Returns a 2-tuple containing the image data and a boolean which is set to True if the image is animated.

poselib.plglobals.nodeHasPoseLibrary(node)

Return True if the specified node has a Pose Library stored in its HDA definition and False otherwise.

poselib.plglobals.saveOptionsDialog(message)

Create a save options dialog where the user can choose to save the layout to HDA or to file, or cancel. Returns the option number chosen.

poselib.plglobals.warningDialog(message, true_button='OK', false_button='Cancel', show_cancel=True)

Create a warning dialog with the given properties and return if true_button or Ok was pressed.

poselib.pose module

class poselib.pose.Clip(pose_list, single_frame=False, chop_data=None)
posesJSON()

Return JSON representation of pose list.

toJSON()

Return a JSON representation of this pose/clip.

class poselib.pose.Pose(key=None, value=None, frame=None, chop=False)
jsonDict()
parmDict()
setJSONDict(json_dict)

poselib.poselib module

class poselib.poselib.PoseLibrary

Bases: sphinx.ext.autodoc.importer._MockObject

Main pose library widget.

CLEAR_HISTORY = '<Clear History>'
NO_HISTORY = '<No History>'
cleanup()

This is called by the Python Panel when the interface is about to be destroyed.

closeEvent(event)

Ensures all option-dialogs are closed if Pose Library is closed.

ensureCharacterSelected()
Checks if a valid character is present and prompts the user to
select one if needed.

Return True if there is a selected character and False otherwise.

eventFilter(widget, event)
globalSettings()

Accessor for global settings.

handleHDAEvent(event_type, **kwargs)

Callback handler for HDA events.

handleHipFileEvent(event_type)

Callback handler for .hip file events.

handleLibrarySourceChanged(source_exists)

Handle a change of the pose library source.

libraryUI()

Accessor for the library widget.

nodeEvent(**kwargs)
reset()

Resets the pose library to its default state.

selectedCharacter()
Return the selected character that the Pose Library is currently
bound to.

Return None if there is no selected character.

setCharacter(path)

Sets the selected character in the Pose Library.

Poses/clips in the library widget are applied to the selected character. Return the True if the character was successfully selected and False otherwise.

showHelp()

poselib.settings module

class poselib.settings.Settings

Bases: sphinx.ext.autodoc.importer._MockObject

This class contains the global settings in the Pose Library.

DEFAULT_ZOOM_INDEX = 4
ZOOM_MULTIPLIERS = [0.5, 0.67, 0.75, 0.9, 1.0, 1.1, 1.25, 1.5, 1.75, 2.0]
decrementZoomMultiplier()

Decrement the zoom multiplier to the next smaller setting.

editModeChanged

Used by autodoc_mock_imports.

incrementZoomMultiplier()

Increment the zoom multiplier to the next larger setting.

isInEditMode()

Return True if the Pose Library is in edit mode and False otherwise.

resetZoomMultiplier()

Reset zoom multiplier.

setIsInEditMode(on)

Set whether the Pose Library is in Edit Mode or not.

setShowPoseIcons(on)

Set whether the pose entry icons should be displayed.

setShowPoseNames(on)

Set whether the pose entry names should be displayed.

showPoseIcons()

Return True if pose entry icons should be displayed and False otherwise.

showPoseIconsChanged

Used by autodoc_mock_imports.

showPoseNames()

Return True if pose names should be displayed and False otherwise.

showPoseNamesChanged

Used by autodoc_mock_imports.

zoomMultiplier()

Return the zoom multiplier for displaying pose entries.

zoomMultiplierChanged

Used by autodoc_mock_imports.

Module contents