Kraken Rigging Framework¶
Kraken provides a flexible, customizable and extendable framework that leverages Fabric Engine’s Splice API. Kraken deploys across 3D applications and because of its use of Fabric Engine Splice, maintains functionality no matter what DCC is used to build a rig.
Getting Started¶
License¶
Copyright (c) 2014, 2015, Eric Thivierge, Phil Taylor, Hybride Technologies Inc., Fabric Software Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of Kraken nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Installation¶
Softimage Pre-Requisites¶
- Core Pre-requisites
- PyWin32 (Softimage requirement)
- PyQtForSoftimage (PySide compatible version)
Un-Zip¶
Un-zip the Kraken archive to a folder of your choice. We DO NOT recommend putting it into the Program Files
directory on Windows as it is not in installed application. It is also HIGHLY recommended NOT to put it into the Fabric Engine directory.
Kraken is a stand alone application that relies on Fabric Engine but does not need to be in the same directory. Additionally, this also helps in the instance where you want to upgrade Fabric Engine but leave the current version of Kraken where it is.
Stand Alone Installation¶
Once the pre-requisites have been installed and Kraken has been un-zipped you can run the Kraken stand alone.
On Windows, you can do this by finding the sample launcher batch file in %KRAKEN_DIR/extras/launcher_scripts/windows
and copying it to the desktop. Then edit it to reflect the valid locations of the Fabric Engine environment.bat
and also the directory path for Kraken.
See also
Once complete you can double click the kraken_launcher.bat
to launch the Kraken stand alone application.
DCC Installation¶
Softimage Installation¶
Supported versions: 2015 SP2
Users must download the PyQtForSoftimage workgroup found here: http://www.steven-caron.com/downloads/tools/PyQtForSoftimage_beta6.xsiaddon
Once the pre-requisites have been installed, you need to connect to a few workgroups.
The order of the workgroups should be:
- Fabric Engine
- PyQtForSoftimage
- Kraken
See also
Maya Installation¶
Supported versions: 2015, 2016, 2017
Once the pre-requisites have been installed, you need to add Fabric Engine’s Maya plug-in path and the Kraken Maya plugin’s path to the MAYA_MODULE_PATH
environment variable.
This can be done in a few ways but we suggest using a *.bat
or *.sh
script to set the PYTHONPATH
AND MAYA_MODULE_PATH
environment variables and to also call Maya’s executable to launch it with the correct environment. See the example launcher script below or see the Maya documentation on how to add paths to the MAYA_MODULE_PATH
.
See also
Once you’ve launched Maya with the evironment variables set, you’ll have to activate the plug-ins by going to Window > Settings / Preferences > Plug-in Manager
. There you should activate:
- FabricSplice.mll
- kraken_maya.py
Environment Variables¶
-
KRAKEN_DCC
¶ The DCC that Kraken is being used by. This environment variable is used in a few places, mainly for acquiring the correct builder and synchronizer.
-
KRAKEN_PATH
¶ Base directory where Kraken is installed.
-
KRAKEN_PATHS
¶ Paths to custom components and configs.
-
KRAKEN_LOAD_MENU
¶ If set to False, the Kraken Menu will not load in the DCC’s. However the commands will still be registered.
Example Launcher Scripts¶
Example launcher scripts can be found in %KRAKEN_DIR%\extras\launcher_scripts\windows
Windows Standalone¶
call C:\Users\Eric\Documents\fabric\FabricEngine-2.2.0-Windows-x86_64\environment.bat
set KRAKEN_PATH=C:\Users\Eric\Documents\dev\kraken
set FABRIC_EXTS_PATH=%FABRIC_EXTS_PATH%;%KRAKEN_PATH%\Exts;
set FABRIC_DFG_PATH=%FABRIC_DFG_PATH%;%KRAKEN_PATH%\Presets\DFG;
set PYTHONPATH=%PYTHONPATH%;%KRAKEN_PATH%\Python;
cd /d %KRAKEN_PATH%\Python\kraken\ui
call cmd /k "python kraken_window.py"
PAUSE
Softimage 2015¶
@ECHO OFF
ECHO "Releasing The Kraken!"
set FABRIC_EXTS_PATH=C:\Users\Eric\Documents\CustomExts;
set FABRIC_DFG_PATH=C:\Users\Eric\Documents\CustomPresets;
call "C:\Program Files\Autodesk\Softimage 2015 SP1\Application\bin\XSI.bat"
echo OFF
Maya 2016¶
@ECHO OFF
ECHO "Releasing The Kraken!"
set FABRIC_EXTS_PATH=C:\Users\Eric\Documents\CustomExts
set FABRIC_DFG_PATH=C:\Users\Eric\Documents\CustomPresets
set MAYA_MODULE_PATH=C:\Users\Eric\Documents\fabric\FabricEngine-2.2.0-Windows-x86_64\DCCIntegrations\FabricMaya2016;C:\Users\Eric\Documents\dev\kraken\DCCIntegrations\maya;
start /d "C:\Program Files\Autodesk\Maya2016\bin" maya.exe
echo OFF
Release Notes¶
Release Versions¶
1.2.5¶
16 January 2017- new
coreKraken is now included with Fabric Engine 2.4. Those wishing to have custom version will need to modify their environment.bat and launcher files accordingly.
- new
uiUsing Qt.py module to have compatibility with PySide2 and Maya 2017.
Note: Kraken for Maya 2017 is functional, however additional work is needed to fix the node graph.
- new
mayaKraken uses custom
KrakenConstraint
Maya node to improve rig performance. Can revert to core Maya constraints viaUseMayaNativeConstraints
meta data in config. - new
presetssolversAdded 2 new solver presets for fk chain collision and spring arrays.
- new
coresolversSolvers can now have default values set when defining solvers in KL extensions.
- new
configKL, Canvas Ops, and Constraints can now be named via the config.
- new
objectsObjects now can now have flags set on creation using the
flags
keyword argument. - new
jointUsers can now set the joint radius via a keyword argument.
- new
utilitiesNew utility script to generate Kraken Canvas presets for KL extensions and Solvers.
- new
builderscoreBuilders now check and report if Solvers and Constraints don’t evaluate before build.
- new
coreKraken now uses KL auto namespacing.
- fixed
preferencesuiConfig name is now saved in the application QT preferences instead of an index.
*.krg
rig files also store and load the config if found. - fixed
coresynchronizerSkip syncing of Guide Settings.
- changed
coremathsMoved rotation order
Integer
toString
mapping to constants module. - changed
coremathsRotation Order indices updated and sync’d with changes in Fabric Core.
- changed
uiConform UX to Canvas interaction. Clicking on nodes move them to the foreground and push other nodes backwards.
- changed
componentscoreComponent
location
changed to a String Attribute allowing for the on changed callback. - changed
coreuiLogic to test if component ports can be connected moved from UI to core.
- changed
configcoreImplemented 330-HTMLColors. We now use the standard HTML color strings for defining colors in Kraken. No longer use Maya color indices.
- changed
componentsBetter debug drawing for the Dynamic Chain & FK Chain components, and Multipose Constraint solver.
- changed
coremayasoftimageCombined KL and CanvasOp methods to reduce duplicated code.
1.2.0¶
1 June 2016- new
mayasoftimageGeneric Biped Rig now buildable via the DCC plug-ins.
- new
buildercanvasCanvas Builder implemented *WIP*. Canvas nodes can now be generated from
*.krg
files and can be instanced in Canvas. - new
rigsGuide rig data used to build a rig is now stored on each rig as meta data. Users can re-generate guides from rigs now!
- new
KLbuilderKL Builder implemented *WIP*.
- new
uiSplash screen now shows KL loading progress via live logging from stdout.
- new
uiImplemented a proper logger via the Python logging module. Reports to stdout and UI output log.
- new
uiAdded preference to ensure that the already built rig will be deleted before re-building a new one.
- new
coreKraken now determines what plug-in to load based on the KRAKEN_DCC environment variable.
- new
coreTraverser class now properly determines the order in which to build objects within a rig. This ensures that objects are built and evaluated in the correct order to ensure that objects are in the correct place when building dependent objects.
- new
componentsTwist Component used for wrist twist and other parts of bipeds now included.
- new
KLunittestUnit tests for all KL based solvers were created.
- fixed
componentsTentacle component woulnd’t build due to port name restriction. Recently fix in Fabric.
- fixed
builderNeed to be able to connect object visibility to other attributes.
- fixed
mayauiKraken menu is removed when unloading the Kraken plug-in.
- fixed
mayaKraken plug-in will now load Fabric plug-in if not loaded when it itself is loaded.
- fixed
builderInline drawing ports are skipped when trying to make port connections.
- changed
coreBuilder acquisition code is now completely abstracted from the core modules. Now utilizes the plug-in structure.
- changed
componentsKnee deformer now added to the leg component.
- changed
componentsRe-designed the head and neck components.
- changed
componentsAdded hand component with more robust guide solver.
- changed
structureRe-organized components into biped and generic directories.
- changed
mayasoftimageDCC builders now set constraint offset values and don’t rely on DCC’s to set them.
- changed
extrasWhen launching Kraken, you know longer need to call the environment.bat / .sh and only need to set custom paths to custom extensions and dfg presets
1.1.0¶
15 January 2016- new
extrasAdded sample .bat launcher files.
- new
uiCore graph code extracted to PyflowGraph repo and added as a sub-tree.
- new
uiBackdrops have been added for grouping nodes.
- new
coreAdd Color Attribute
- new
coreControl object needs method “setShape”.
- new
coreuiAbility to refresh the Component list manually.
- new
uiUse resource file for images.
- new
uiSnap to Grid.
- new
uiNode color should be taken from component .py files.
- new
uiAdd Recent Files Menu.
- fixed
mayaKraken Maya plugin auto loads matrixNodes plugin automatically now.
- fixed
solversSpine pop fix.
- fixed
uiDoing Save As doesn’t update file path in title bar.
- fixed
uiKraken UI won’t open if one kraken path not found.
- fixed
uiKraken UI Slow, and slowing the host UI.
- fixed
coreUse KRAKEN_PATH instead of KRAKEN_DIR in core and in launcher scripts.
- fixed
uiComponent Library widget to folder tree widget.
- fixed
uiTracks opened file, save command simply saves file.
- fixed
uiWhen doing a save as / open, file name isn’t stored or restored next time.
- fixed
uiOutput log widget added to allow users to see the history.
- fixed
uiError message is now full length of window and stays on screen longer.
- fixed
coreRenamed KLExts and DFG folders to be consistent with how core Fabric Engine nodes are organized.
1.0.0¶
11 August 2015- new
uiAdded a PyQt based user interface for building rigs through nodes and connections.
- new
KLNew Kraken Solver KL extension implements the base inteface and object that all Kraken solvers will inherit. Kraken Arg also works hand in hand with this new object.
- new
coresynchronizerSynchronizer module allows synchronoization from DCC to the Python graph. This allows users to create guides, adjust them, then synch back to the graph to have those changes affect the final rig build.
Also allows saving guides / graphs out as a preset file.
- new
corekraken systemKraken System module is a singleton object used to provide an interface with the FabricEngine Core and RTVal system.
- new
profilerProfiler object is for debugging performance issues during builds. Provides timing and labels.
- new
mathMaths library now wraps the KL math library to ensure there is a one to one mapping between the types and that the math evaluates exactly the same way.
- new
rigRig object is sub-classed from the Container object and is used to load and save out presets of full rigs. Provided additional methods for doing so
- changed
mayaplug-insMaya plug-in now fully supported.
- changed
plug-inssoftimageSoftimage plug-in now fully supported.
- changed
configcontrolControl object now takes a shape argument and shapes are stored in the config.
- changed
configcontrolConfigs object now stores the valid colors, sides, mirror mapping, naming template, and control shapes. This object is a singleton and can be sub-classed to provide customized configurations per studio, per project, or even per asset.
- changed
object 3dscene_itemSwapped names of Object 3D and Scene Item. Scene Item is now the base object for most simple objects without transforms.
- changed
object 3dscene_itemRenamed srt buffer to ctrl space to be more intuitively named.
Integrations¶
Integrations¶
Kraken is able to be integrated with any 3D DCC that supports Fabric Engine and Python.
Current Integrations¶
Maya Integration¶
The Maya integration is composed of the Kraken plug-in for Maya but also the Maya plug-in that adds a menu entry for launching the Kraken UI.
See also
Maya Installation for installation and example Maya launcher scripts.
Softimage Integration¶
The Softimage integration is composed of the Kraken plug-in for Softimage but also the Softimage workgroup and plug-in that adds a menu entry for launching the Kraken UI. The functionality of Kraken is the same as the stand alone other than this integration creates Softimage objects with the current scene.
See also
Softimage Installation for installation and example Softimage launcher scripts.
Canvas Integration¶
Warning
This integration serves as an early concept / beta for this workflow. Work will continue on adding additional features and improving workflow.
The Canvas integration is composed of the Kraken plug-in along with the presetGen.py script that allows users to supply command line arguments to specify how the build is configured and is run. The Canvas plug-in generates presets and allows users to have a full rig defined as a single compound node in the Canvas Graph.
Users can manipulate the data within the rig such as control positions and settings to drive the rig.
See also
KL Integration¶
Warning
This integration serves as an early concept / beta for this work flow. Work will continue on adding additional features and improving work flow.
The KL integration is composed of the Kraken plug-in along with the presetGen.py script that allows users to supply command line arguments to specify how the build is configured and is run.
The builder in this plug-in creates a KL extension that hosts a KL struct that encompasses the entire rig. This KL based rig can then be used within Canvas or other integrations where KL objects can be instanced and manipulated.
See also
User Interface¶
User Interface¶
Kraken comes with a nodal inteface that allows for quickly prototyping rigs and re-using the configuration at a later time.
Table of Contents

Config Drop Down (2)¶
The config drop down allows the user to specify a configuration to use while building. Configurations allow you to customize naming, colors, and more.
See also
Rig Name (3)¶
The rig name widget allows you to quickly change the name of the rig that you’re currently working in. Double clicking on the widget displays an input box to change the name.
Component Library (4)¶
The component library is a list of registered components that you can instance into the graph. Using the KRAKEN_COMPONENTS
environment variable will allow you to register your custom components.
See also
Installation for information on how to add custom components.
Contextual Node list (5)¶
The contextual node list reflects the component library but is a floating widget that allows you to type in the name of the component you want and create it without having the component library visible. Type the name select from the list and hit enter.
Nodes & Graph (6)¶
The graph is where you instance components as nodes and create connections. You can only make connections between component ports which are of the same type. Only Vec3’s will connect to Vec3 ports for example. You can click and drag from a label or port to another port to connect it.
Keyboard Commands¶
Key Combo | Function |
---|---|
Ctrl+N | New Graph (Clears current graph) |
Ctrl+S | Save Graph |
Ctrl+L | Load Graph (Clears current graph) |
Ctrl+W | Closes the Interface |
Ctrl+C | Copy Selected Nodes |
Ctrl+V | Paste Copied Nodes |
Ctrl+Shift+V | Paste Copied Nodes with connections |
Ctrl+G | Builds the Guide Rig |
Ctrl+B | Builds the Rig |
Ctrl+H | Opens the Kraken Page |
Ctrl+Tab | Toggles the Component Library |
` (Tilde) | Opens the contextual node list over the graph |
Canvas Guide¶
Canvas Guide¶
This guide will walk you through how to use Canvas to create solvers for Kraken.
Sections¶
Canvas Library¶
Kraken ships with many Canvas presets used for both Guide components and Rig components.
Usage Documentation
Solvers¶
This solver simply draws planes between each input control and aligns on each of the Y axis. This preset also takes an array of sizes that determins the height of each grid. This allows users to be able to align the guide down the length of each finger and ensure that the alignment is correct in conjunction with the geometry being rigged.
-
DirectionConstraintSolver
(drawDebug, rigScale, controls, planeSizes)¶ Draws planes between each control aligned to the Y axis.
Parameters: - drawDebug (Boolean) – Whether to activate debug drawing or not.
- rigScale (Scalar[]) – Rig scale value for scaling results of the solver.
- position (Mat44) – The position from which to aim from / position the object.
- upVector (Mat44) – The transform to align the Y axis to.
- atVector (Mat44) – The transform to align the X axis to.
Usage Documentation
This solver simply draws planes between each input control and aligns on each of the Y axis. This preset also takes an array of sizes that determins the height of each grid. This allows users to be able to align the guide down the length of each finger and ensure that the alignment is correct in conjunction with the geometry being rigged.
-
BipedFingerGuideSolver
(drawDebug, rigScale, controls, planeSizes)¶ Draws planes between each control aligned to the Y axis.
Parameters: - drawDebug (Boolean) – Whether to activate debug drawing or not.
- rigScale (Scalar[]) – Rig scale value for scaling results of the solver.
- controls (Mat44[]) – Controls used in the guide for aligning each joint in the finger.
- planeSizes (Scalar[]) – Sizes for each of the planes drawn.
Usage Documentation
This solver usually rides on top of the Biped Foot Pivot Solver and drives the ankle and toe bones of the foot. It ensures the ankle and toe keeps their alignment with the foot controls in the rig. It also blends between the IK and FK controls.
-
BipedFootSolver
(drawDebug, rigScale, ikBlend, ankleLen, toeLen, legEnd, ankleIK, toeIK, ankleFK, toeFK)¶ Drives the ankle and toe bones of a foot between the IK and FK controls.
Parameters: - drawDebug (Boolean) – Whether to activate debug drawing or not.
- rigScale (Scalar) – Rig scale value for scaling results of the solver.
- ikBlend (Scalar) – Value 0-1 used to blend between IK and FK controls.
- ankleLen (Scalar) – Length of the ankle bone.
- toeLen (Scalar) – Length of the toe bone.
- legEnd (Mat44) – Matrix of the end of the leg component.
- ankleIK (Mat44) – Matrix of the Ankle IK control.
- toeIK (Mat44) – Matrix of the Toe IK control.
- ankleFK (Mat44) – Matrix of the ankle FK control.
- toeFK (Mat44) – Matrix of the toe FK control.
Returns: ankle_result
Returns: toe_result
Return type:
This solver allows users to control where the front, back, left, and right pivot points of the foot rock and banking occur. Giving users control over these pivot points allows for more dynamic animations and usability of the rig.
-
BipedFootPivotSolver
(drawDebug, rigScale, rightSide, footRock, footBank, pivotAll, backPivot, frontPivot, outerPivot, innerPivot)¶ Drives the ankle and toe bones of a foot between the IK and FK controls.
Parameters: - drawDebug (Boolean) – Whether to activate debug drawing or not.
- rigScale (Scalar) – Rig scale value for scaling results of the solver.
- rightSide (Boolean) – Whether the solver should compute the transforms for being on the right side of the character.
- footRock (Scalar) – Value driving the activation of the foot rock.
- footBank (Scalar) – Value driving the activation of the foot banking.
- pivotAll (Mat44) – Main foot pivot
- backPivot (Mat44) – Pivot at the back of the foot.
- frontPivot (Mat44) – Pivot at the fron tof the foot.
- outerPivot (Mat44) – Pivot on the outer side of the foot.
- innerPivot (Mat44) – Pivot on the inner side of the foot.
KL Guide¶
KL Guide¶
This guide will walk you through how to use Kraken’s KL library to build rigs.
Sections¶
KL Library¶
Usage Documentation
Core¶
This solver distributes objects along the bezier curve and interpolates the rotation between the base and tip input matrices. Typically used for the spines of bipedal characters.
-
BezierSpineSolver
(drawDebug, rigScale, length, base, baseHandle, tipHandle, tip, outputs)¶ Distributes objects along the bezier curve and interpolates the rotation between the base and tip input matrices.
Parameters: - drawDebug (Boolean) – Whether to activate debug drawing or not.
- rigScale (Scalar) – Rig scale value for scaling results of the solver.
- length (Scalar) – Initial length of the spine
- base (Mat44) – Base control matrix.
- baseHandle (Mat44) – Base handle control matrix.
- tipHandle (Mat44) – Tip handle control matrix.
- tip (Mat44) – Tip control matrix
- outputs (Mat44) – Distributed output matrices
Usage Documentation
Usage Documentation
Usage Documentation
Usage Documentation
Usage Documentation
Usage Documentation
Usage Documentation
Usage Documentation
Usage Documentation
Usage Documentation
This solver allows users to control where the front, back, left, and right pivot points of the foot rock and banking occur. Giving users control over these pivot points allows for more dynamic animations and usability of the rig.
-
BipedFootPivotSolver
(drawDebug, rigScale, rightSide, footRock, footBank, pivotAll, backPivot, frontPivot, outerPivot, innerPivot) Drives the 4 pivots for the front, back, left, and right side of the foot.
Parameters: - drawDebug (Boolean) – Whether to activate debug drawing or not.
- rigScale (Scalar) – Rig scale value for scaling results of the solver.
- rightSide (Boolean) – Whether the solver should compute the transforms for being on the right side of the character.
- footRock (Scalar) – Value driving the activation of the foot rock.
- footBank (Scalar) – Value driving the activation of the foot banking.
- pivotAll (Mat44) – Main foot pivot
- backPivot (Mat44) – Pivot at the back of the foot.
- frontPivot (Mat44) – Pivot at the fron tof the foot.
- outerPivot (Mat44) – Pivot on the outer side of the foot.
- innerPivot (Mat44) – Pivot on the inner side of the foot.
Usage Documentation
This solver usually rides on top of the Biped Foot Pivot Solver and drives the ankle and toe bones of the foot. It ensures the ankle and toe keeps their alignment with the foot controls in the rig. It also blends between the IK and FK controls.
-
BipedFootSolver
(drawDebug, rigScale, ikBlend, ankleLen, toeLen, legEnd, ankleIK, toeIK, ankleFK, toeFK) Drives the ankle and toe bones of a foot between the IK and FK controls.
Parameters: - drawDebug (Boolean) – Whether to activate debug drawing or not.
- rigScale (Scalar) – Rig scale value for scaling results of the solver.
- ikBlend (Scalar) – Value 0-1 used to blend between IK and FK controls.
- ankleLen (Scalar) – Length of the ankle bone.
- toeLen (Scalar) – Length of the toe bone.
- legEnd (Mat44) – Matrix of the end of the leg component.
- ankleIK (Mat44) – Matrix of the Ankle IK control.
- toeIK (Mat44) – Matrix of the Toe IK control.
- ankleFK (Mat44) – Matrix of the ankle FK control.
- toeFK (Mat44) – Matrix of the toe FK control.
Returns: ankle_result
Returns: toe_result
Return type:
Usage Documentation
Usage Documentation
Python Guide¶
Python Guide¶
This guide will walk you through how to use Kraken’s Python library to build rigs.
Sections¶
Python Library¶
Usage Documentation
Modules¶
The Core package contains modules and sub-packages that make up the Kraken Framework.
-
class
Builder
(debugMode=False)¶ Bases:
object
Core Builder class for building objects.
Note
Sub-class for each DCC in it’s plugin directory.
This builder traverses the graph and determines the the build order. Once the build order has been determined, the builder iterates through the list and builds each object type. Each object type has it’s own method for users to re-implement for each application.
-
_buildPhase_3DObjectsAttributes
¶ type
Description.
-
_buildPhase_AttributeConnections
¶ type
Description.
-
_buildPhase_ConstraintsOperators
¶ type
Description.
-
_buildPhase_3DObjectsAttributes
= 0
-
_buildPhase_AttributeConnections
= 1
-
_buildPhase_ConstraintsOperators
= 2
-
_buildPhase_lockAttributes
= 3¶
-
_buildPhase_lockTransformAttrs
= 4¶
-
__init__
(debugMode=False)¶
-
_registerSceneItemPair
(kSceneItem, dccSceneItem)¶ Registers a pairing between the kraken scene item and the dcc scene item for querying later.
Parameters: - kSceneItem (object) – kraken scene item that you want to pair.
- dccSceneItem (object) – dcc scene item that you want to pair.
Returns: True if successful.
Return type: bool
-
deleteBuildElements
()¶ Clear out all dcc built elements from the scene if exist.
-
getDCCSceneItem
(kSceneItem)¶ Given a kSceneItem, returns the built dcc scene item.
Parameters: kSceneItem (object) – kSceneItem to base the search. Returns: The DCC Scene Item that corresponds to the given scene item Return type: object
-
getDCCSceneItemPairs
()¶ Returns all of the built dcc scene item pairs.
Returns: An array of dicts with ‘src’ and ‘tgt’ key value pairs Return type: array
-
buildContainer
(kContainer, buildName)¶ Builds a container / namespace object.
Parameters: - kContainer (object) – kContainer that represents a container to be built.
- buildName (string) – The name to use on the built object.
Returns: DCC Scene Item that is created.
Return type: object
-
buildLayer
(kSceneItem, buildName)¶ Builds a layer object.
Parameters: - kSceneItem (object) – kSceneItem that represents a layer to be built.
- buildName (string) – The name to use on the built object.
Returns: DCC Scene Item that is created.
Return type: object
-
buildHierarchyGroup
(kSceneItem, buildName)¶ Builds a hierarchy group object.
Parameters: - kSceneItem (object) – kSceneItem that represents a group to be built.
- buildName (string) – The name to use on the built object.
Returns: DCC Scene Item that is created.
Return type: object
-
buildGroup
(kSceneItem, buildName)¶ Builds a group object.
Parameters: - kSceneItem (object) – kSceneItem that represents a group to be built.
- buildName (string) – The name to use on the built object.
Returns: DCC Scene Item that is created.
Return type: object
-
buildJoint
(kSceneItem, buildName)¶ Builds a joint object.
Parameters: - kSceneItem (object) – kSceneItem that represents a joint to be built.
- buildName (string) – The name to use on the built object.
Returns: DCC Scene Item that is created.
Return type: object
-
buildLocator
(kSceneItem, buildName)¶ Builds a locator / null object.
Parameters: - kSceneItem (object) – kSceneItem that represents a locator / null to be built.
- buildName (string) – The name to use on the built object.
Returns: DCC Scene Item that is created.
Return type: object
-
buildCurve
(kSceneItem, buildName)¶ Builds a Curve object.
Parameters: - kSceneItem (object) – kSceneItem that represents a curve to be built.
- buildName (string) – The name to use on the built object.
Returns: DCC Scene Item that is created.
Return type: object
-
buildControl
(kSceneItem, buildName)¶ Builds a Control object.
Parameters: - kSceneItem (object) – kSceneItem that represents a control to be built.
- buildName (string) – The name to use on the built object.
Returns: DCC Scene Item that is created.
Return type: object
-
buildBoolAttribute
(kAttribute)¶ Builds a Bool attribute.
Parameters: kAttribute (object) – kAttribute that represents a string attribute to be built. Returns: True if successful. Return type: object
-
buildScalarAttribute
(kAttribute)¶ Builds a Float attribute.
Parameters: kAttribute (object) – kAttribute that represents a string attribute to be built. Returns: True if successful. Return type: bool
-
buildIntegerAttribute
(kAttribute)¶ Builds a Integer attribute.
Parameters: kAttribute (object) – kAttribute that represents a string attribute to be built. Returns: True if successful. Return type: bool
-
buildStringAttribute
(kAttribute)¶ Builds a String attribute.
Parameters: kAttribute (object) – kAttribute that represents a string attribute to be built. Returns: True if successful. Return type: bool
-
buildAttributeGroup
(kAttributeGroup)¶ Builds attribute groups on the DCC object.
Parameters: kAttributeGroup (SceneObject) – kraken object to build the attribute group on. Returns: True if successful. Return type: bool
-
connectAttribute
(kAttribute)¶ Connects the driver attribute to this one.
Parameters: kAttribute (object) – attribute to connect. Returns: True if successful. Return type: bool
-
buildOrientationConstraint
(kConstraint, buildName)¶ Builds an orientation constraint represented by the kConstraint.
Parameters: kConstraint (object) – kraken constraint object to build. Returns: DCC Scene Item that was created. Return type: object
-
buildPoseConstraint
(kConstraint, buildName)¶ Builds an pose constraint represented by the kConstraint.
Parameters: kConstraint (object) – kraken constraint object to build. Returns: True if successful. Return type: bool
-
buildPositionConstraint
(kConstraint, buildName)¶ Builds an position constraint represented by the kConstraint.
Parameters: kConstraint (object) – kraken constraint object to build. Returns: True if successful. Return type: bool
-
buildScaleConstraint
(kConstraint, buildName)¶ Builds an scale constraint represented by the kConstraint.
Parameters: kConstraint (object) – kraken constraint object to build. Returns: True if successful. Return type: bool
-
buildKLOperator
(kKLOperator, buildName)¶ Builds Splice Operators on the components.
Note
Implement in DCC Plugins.
Parameters: kOperator (object) – kraken operator that represents a KL operator. Returns: True if successful. Return type: bool
-
buildCanvasOperator
(kOperator, buildName)¶ Builds Splice Operators on the components.
Note
Implement in DCC Plugins.
Parameters: kOperator (object) – kraken operator that represents a Canvas operator. Returns: True if successful. Return type: bool
-
build
(kSceneItem)¶ Builds a rig object.
We have to re-order component children by walking the graph to ensure that inputs objects are in place for the dependent components.
Parameters: kSceneItem (sceneitem) – The item to be built. Returns: DCC Scene Item that is created. Return type: object
-
lockAttribute
(kAttribute)¶ Locks attributes.
Parameters: kAttribute (object) – kraken attributes to lock. Returns: True if successful. Return type: bool
-
lockTransformAttrs
(kSceneItem)¶ Locks the transform attributes on an object.
Parameters: kSceneItem (object) – kraken object to lock the SRT attributes on. Returns: True if successful. Return type: Type
-
setVisibility
(kSceneItem)¶ Sets the visibility of the object after its been created.
Parameters: kSceneItem (object) – kraken object to set the visibility on. Returns: True if successful. Return type: bool
-
getBuildColor
(kSceneItem)¶ Gets the build color for the object.
Parameters: kSceneItem (object) – kraken object to get the color for. Returns: color to set on the object. Return type: str
-
setObjectColor
(kSceneItem)¶ Sets the color on the dccSceneItem.
Parameters: kSceneItem (object) – kraken object to set the color on. Returns: True if successful. Return type: bool
-
setTransform
(kSceneItem)¶ Translates the transform to Softimage transform.
Parameters: kSceneItem (object) – object to set the transform on. Returns: True if successful. Return type: bool
-
getConfig
()¶ Gets the current config for the builder.
Returns: config. Return type: object
-
setConfig
(config)¶ Sets the builder’s config.
Parameters: config (Config) – the config to use for this builder. Returns: True if successful. Return type: bool
-
_preBuild
(kSceneItem)¶ Protected Pre-Build method.
Parameters: kSceneItem (object) – kraken kSceneItem object to build. Returns: True if successful. Return type: bool
-
_postBuild
(kSceneItem)¶ Protected Post-Build method.
Parameters: kSceneItem (object) – kraken kSceneItem object to run post-build operations on. Returns: True if successful. Return type: bool
-
logOrphanedGraphItems
(kSceneItem)¶ Logs any objects that were left out from the build process.
Parameters: kSceneItem (object) – kraken kSceneItem object to recursively iterate on to find objects that weren’t built. Returns: True if successful. Return type: Type
-
checkEvaluatedOps
(kSceneItem, invalidOps)¶ Recursively checks for operators that haven’t been evaluated.
Parameters: - kSceneItem (Object3D) – Object to recursively check for invalid ops.
- invalidOps (list) – List invalid operators will be appended to.
Returns: True if successful.
Return type: bool
-
checkEvaluatedConstraints
(kSceneItem, invalidConstraints)¶ Recursively checks for constraints that haven’t been evaluated. Don’t include leaf nodes or nodes that are simply parents as these don’t need to be evaluated in the python graph, they can wait for the DCC
Parameters: - kSceneItem (Object3D) – Object to recursively check for invalid ops.
- invalidConstraints (list) – List invalid constraints will be appended to.
Returns: True if successful.
Return type: bool
-
_Builder__buildSceneItem
(kObject, phase)¶ Builds the DCC sceneitem for the supplied kObject.
Parameters: - kObject (object) – kraken object to build.
- phase (type) – Description.
Returns: DCC object that was created.
Return type: object
-
_Builder__buildSceneItemList
(kObjects, phase)¶ Builds the provided list of objects.
Parameters: - kObjects (list) – Objects to be built.
- phase (int) – Description.
Returns: True if successful.
Return type: Type
-
KrakenSystem - objects.kraken_core module.
Classes: KrakenSystem - Class for constructing the Fabric Engine Core client.
-
class
KrakenSystem
¶ Bases:
object
The KrakenSystem is a singleton object used to provide an interface with the FabricEngine Core and RTVal system.
-
__init__
()¶ Initializes the Kraken System object.
-
loadCoreClient
()¶ Loads the Fabric Engine Core Client
-
getCoreClient
()¶ Returns the Fabric Engine Core Client owned by the KrakenSystem
Returns: The Fabric Engine Core Client Return type: object
-
loadExtension
(extension)¶ Loads the given extension and updates the registeredTypes cache.
Parameters: extension (str) – The name of the extension to load.
-
convertFromRTVal
(target, RTTypeName=None)¶ Generates an RTVal object based on the simple type of target and passes target to constructor. Converts a property of an RTVal object to its own pytholn RTVal object
Parameters: - target (RTVal) – The RTVal object or property to cast
- RTTypeName (str) – The type of RTVal to convert to
Returns: The RTVal object
Return type: RTVal
-
constructRTVal
(dataType, defaultValue=None)¶ Constructs a new RTVal using the given name and optional devault value.
Parameters: - dataType (str) – The name of the data type to construct.
- defaultValue (value) – The default value to use to initialize the RTVal
Returns: The constructed RTval.
Return type: object
-
rtVal
(dataType, defaultValue=None)¶ Constructs a new RTVal using the given name and optional devault value.
Parameters: - dataType (str) – The name of the data type to construct.
- defaultValue (value) – The default value to use to initialize the RTVal
Returns: The constructed RTval.
Return type: object
-
isRTVal
(value)¶ Returns true if the given value is an RTVal.
Parameters: value (value) – value to test. Returns: True if successful. Return type: bool
-
getRTValTypeName
(rtval)¶ Returns the name of the type, handling extracting the name from KL RTVals.
Parameters: rtval (rtval) – The rtval to extract the name from. Returns: True if successful. Return type: bool
-
registerConfig
(configClass)¶ Registers a config Python class with the KrakenSystem so ti can be built by the rig builder.
Parameters: configClass (str) – The Python class of the config
-
getConfigClass
(className)¶ Returns the registered Python config class with the given name
Parameters: className (str) – The name of the Python config class Returns: The Python config class Return type: object
-
getConfigClassNames
()¶ Returns the names of the registered Python config classes
Returns: The array of config class names. Return type: list
-
registerComponent
(componentClass)¶ Registers a component Python class with the KrakenSystem so ti can be built by the rig builder.
Parameters: componentClass (str) – The Python class of the component
-
getComponentClass
(className)¶ Returns the registered Python component class with the given name
Parameters: className (str) – The name of the Python component class Returns: The Python component class Return type: object
-
getComponentClassNames
()¶ Returns the names of the registered Python component classes
Returns: The array of component class names. Return type: list
-
loadComponentModules
()¶ Loads all the component modules and configs specified in the ‘KRAKEN_PATHS’ environment variable.
The kraken_components are loaded at all times.
Returns: True if all components loaded, else False. Return type: bool
-
classmethod
getInstance
()¶ This class method returns the singleton instance for the KrakenSystem
Returns: The singleton instance. Return type: object
-
-
class
Profiler
¶ Bases:
object
Kraken profiler object for debugging performance issues.
-
__init__
()¶
-
reset
()¶ Resets the profiler for generating a new report
-
push
(label)¶ Adds a new child to the profiling tree and activates it.
Parameters: label (str) – The label of the next level of the stack.
-
pop
()¶ Deactivates the current item in the tree and returns the profiler to the parent item
-
generateReport
(listFunctionTotals=False)¶ Returns a report string containing all the data gathered turing profiling.
Parameters: listFunctionTotals (bool) – list information relating to the total time spent in each function. Returns: The profiler report. Return type: str
-
classmethod
getInstance
()¶ This class method returns the singleton instance for the Profiler
Returns: The singleton profiler instance. Return type: object
-
-
class
Synchronizer
(target=None)¶ Bases:
object
The Synchronizer is a singleton object used to synchronize data between Kraken objects and the DCC objects.
-
__init__
(target=None)¶ Initializes Synchronizer.
The target object’s hierarchy will be traversed and synchronized.
Parameters: target (object) – top Kraken object to synchronize.
-
getTarget
()¶ Gets the target object of the synchronizer.
Returns: The object that is the target of synchronization. Return type: object
-
setTarget
(target)¶ Sets the target for synchronization.
Parameters: target (object) – top Kraken object to synchronize. Returns: True if successful. Return type: bool
-
getHierarchyMap
()¶ Gets the hierarchy map from the Inspector.
Returns: The hierarhcy map. None if it hasn’t been created. Return type: dict
-
createHierarchyMap
(kObject)¶
-
clearHierarchyMap
()¶ Clears the hierarhcy map data.
Returns: True if successful. Return type: bool
-
sync
()¶ Synchronizes the target hierarchy with the matching objects in the DCC.
Returns: True if successful. Return type: bool
-
synchronize
(kObject)¶ Iteration method that traverses the hierarchy and syncs the different object types.
Parameters: kObject (object) – object to synchronize. Returns: True if successful. Return type: bool
-
getDCCItem
(kObject)¶ Gets the DCC Item from the full decorated path.
This should be re-implemented in the sub-classed synchronizer for each plugin.
Parameters: kObject (object) – The Kraken Python object that we must find the corresponding DCC item. Returns: None if it isn’t found. Return type: object
-
syncXfo
(kObject)¶ Syncs the xfo from the DCC object to the Kraken object.
This should be re-implemented in the sub-classed synchronizer for each plugin.
Parameters: kObject (object) – object to sync the xfo for. Returns: True if successful. Return type: bool
-
syncAttribute
(kObject)¶ Syncs the attribute value from the DCC object to the Kraken object.
This should be re-implemented in the sub-classed synchronizer for each plugin.
Parameters: kObject (object) – object to sync the attribute value for. Returns: True if successful. Return type: bool
-
syncCurveData
(kObject)¶ Syncs the curve data from the DCC object to the Kraken object.
This should be re-implemented in the sub-classed synchronizer for each plugin.
Parameters: kObject (object) – object to sync the curve data for. Returns: True if successful. Return type: bool
-
-
class
Traverser
(name='Traverser')¶ Bases:
object
Kraken base traverser for any scene item.
The traverser iterates through all root items and determines the dependencies between objects, building an ordered list as it goes. This order is then used by the builder to ensure that objects are created and evaluated in the correct order. Offset’s will then be reliable.
-
__init__
(name='Traverser')¶
-
rootItems
¶ Gets the root items of this Traverser.
Returns: The root items of this Traverser. Return type: list
-
addRootItem
(item)¶ Adds a new root object to this Traverser
Parameters: item (SceneItem) – The SceneItem to add as a root item. Returns: True if successful. Return type: bool
-
addRootItems
(items)¶ Adds a bunch of root items to this Traverser
Parameters: items (SceneItem[]) – The SceneItems to add as root items. Returns: True if successful. Return type: bool
-
items
¶ Gets the traversed items of this Traverser.
Returns: The traversed items of this Traverser. Return type: list
-
getItemsOfType
(typeNames)¶ Gets only the traversed items of a given type.
Parameters: typeName (str) – The name of the type to look for. Returns: The items in the total items list matching the given type. Return type: list
-
reset
()¶ Resets all internal structures of this Traverser.
-
traverse
(itemCallback=None, discoverCallback=None, discoveredItemsFirst=True)¶ Visits all objects within this Traverser based on the root items.
Parameters: - itemCallback (func) – A callback function to be invoked for each item visited.
- discoverCallback (func) – A callback to return an array of children for each item.
-
discoverChildren
(item)¶ Doc String.
Parameters: item (Type) – information. Returns: information. Return type: Type
-
discoverBySource
(item)¶ Doc String.
Parameters: item (Type) – information. Returns: information. Return type: Type
-
_Traverser__collectVisitedItem
(item, itemCallback)¶ Doc String.
Parameters: - item (Type) – information.
- itemCallback (Type) – information.
-
_Traverser__visitItem
(item, itemCallback, discoverCallback, discoveredItemsFirst)¶ Doc String.
Parameters: - item (Type) – information.
- itemCallback (Type) – information.
- discoverCallback (Type) – information.
- discoveredItemsFirst (Type) – information.
Returns: information.
Return type: Type
-
Kraken has a concept of configuration files that allow you to control how things are named, colored, control shapes, and more.
You can create custom config files by sub-classing the core Config class and redefining the methods within. This makes it easy to configure the builds per studios, per project or even per character if desired.
See also
Usage Documentation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # test_config.py
from kraken.core.configs.config import Config
class TestConfig(Config):
def __init__(self):
super(Config, self).__init__()
# ======================
# Color Mapping Methods
# ======================
def initColorMap(self):
# This maps different colors for the locations compared to the
# default ones.
colorMap = {
"Control": {
"default": "yellow",
"L": "blue",
"M": "orange",
"R": "green"
}
}
return colorMap
|
Note
When you import your custom config class and use the ‘’getInstance()’’ method before the builder, the builder will use your config instead of the built in one.
The config is cleared from the system after each build.
1 2 3 4 5 6 7 8 9 10 11 12 | from kraken import plugins
from kraken_examples.arm_component import ArmComponentGuide, ArmComponentRig
from test_config import TestConfig
config = TestConfig.getInstance()
arm = ArmComponentRig()
arm.loadData(armGuideData)
builder = plugins.getBuilder()
builder.build(arm)
|
-
class
Config
¶ Bases:
object
Base Configuration for Kraken builders.
-
__init__
()¶
-
getModulePath
()¶
-
initObjectSettings
()¶ Initializes default object settings to be applied when certain objects are created.
Returns: object settings. Return type: dict
-
getObjectSettings
()¶ Gets the colors defined in the config.
Returns: colors. Return type: dict
-
initColors
()¶ Initializes the color values.
Returns: color definitions. Return type: dict
-
getColors
()¶ Gets the colors defined in the config.
Returns: colors. Return type: dict
-
initColorMap
()¶ Initializes the color values.
Returns: color definitions. Return type: dict
-
getColorMap
()¶ Gets the color map defined in the config.
Returns: color map. Return type: dict
-
initNameTemplate
()¶ Initializes the name template.
Returns: name template. Return type: dict
-
getNameTemplate
()¶ Returns the naming template for this configuration.
Returns: naming template. Return type: dict
-
initControlShapes
()¶ Initializes the control shapes.
Returns: True if successful. Return type: bool
-
getControlShapes
()¶ Returns the control shapes for this configuration.
Returns: control shapes. Return type: dict
-
getExplicitNaming
()¶ Returns the value of the explicit naming attribute.
Returns: current value. Return type: bool
-
setExplicitNaming
(value)¶ Set the config to use explicit naming.
Parameters: value (bool) – whether to use explicit naming or not. Returns: True if successful. Return type: bool
-
getMetaData
(key, value=None)¶ Returns the value of a metaData flag.
Returns: current value or None for default value Return type: str
-
setMetaData
(key, value)¶ Set the config to contain a metaData flag.
Parameters: - key (str) – the key under which to store the value
- value (any) – the value to store for a given key
Returns: True if successful.
Return type: bool
-
classmethod
getInstance
()¶ This class method returns the singleton instance for the Config.
Returns: The singleton config instance. Return type: object
-
classmethod
makeCurrent
()¶ Sets this class t be the singleton instance Config.
Returns: The singleton config instance. Return type: object
-
classmethod
clearInstance
()¶ Clears the instance variable of the config.
Returns: True if successful. Return type: bool
-
The IO modules.
Usage Documentation
-
class
KrakenLoader
¶ Bases:
object
Kraken base object type for any 3D object.
-
__init__
()¶
-
getParentItem
()¶ Returns the item that was constructed prior to the current item.
Returns: The stored parent item. Return type: object
-
resolveSceneItem
(name)¶ Returns a constructed scene item based on the provided name.
Parameters: name (str) – name of the scene item to find. Returns: The resolved scene item. Return type: object
-
construct
(jsonData)¶ Returns a constructed scene item based on the provided json data.
Parameters: jsondata (dict) – the JSON data to use to decode into a Math value. Returns: The constructed scene item. Return type: object
-
registerItem
(item)¶ Register an item to the loader. If an item is constructed automatically, then it can be registered so the loader can provide it during resolveSceneItem.
Parameters: item (object) – an object constructed during the loading process.
-
registerConstructionCallback
(name, callback)¶ Register a callback to be invoked when the requested item is constructed.
-
Usage Documentation
-
class
KrakenSaver
¶ Bases:
object
Kraken base object type for any 3D object.
-
__init__
()¶
-
encodeValue
(value)¶ Doc String.
Parameters: value (MathObject) – The math object to be saved. Returns: True if successful. Return type: bool
-
This is the math library for Kraken. We wrap RTVal calls from KL to Python objects and expose the methods to keep our math library in line with the KL math types.
Usage Documentation
-
class
Color
(r=0.0, g=0.0, b=0.0, a=1.0)¶ Bases:
kraken.core.maths.math_object.MathObject
Vector 4 object.
-
__init__
(r=0.0, g=0.0, b=0.0, a=1.0)¶ Initializes r, g b and a values for Color object.
-
__str__
()¶ String representation of the Color object.
Returns: String representation of the Color object. Return type: str
-
r
¶ Gets red channel of this color.
Returns: red channel of this color. Return type: float
-
g
¶ Gets green channel of this color.
Returns: green channel of this color. Return type: float
-
b
¶ Gets blue channel of this color.
Returns: blue channel of this color. Return type: float
-
a
¶ Gets alpha channel of this color.
Returns: alpha channel of this color. Return type: float
-
__eq__
(other)¶
-
__ne__
(other)¶
-
__add__
(other)¶
-
__sub__
(other)¶
-
__mul__
(other)¶
-
__div__
(other)¶
-
set
(r, g, b, a)¶ Sets the r, g, b, and a value from the input values.
Parameters: - r (float) – Value to set the r channel to.
- g (float) – Value to set the g channel to.
- b (float) – Value to set the b channel to.
- a (float) – Value to set the a channel to.
Returns: True if successful.
Return type: bool
-
equal
(other)¶ Checks equality of this color with another.
Parameters: other (Color) – other color to check equality with. Returns: True if equal. Return type: bool
-
almostEqual
(other, precision)¶ Checks almost equality of this Color with another.
Parameters: - other (Color) – other value to check equality with.
- precision (float) – Precision value.
Returns: True if almost equal.
Return type: bool
-
component
(i)¶ Gets the component of this Color by index.
Parameters: i (int) – index of the component to return. Returns: component of this Color. Return type: float
-
setComponent
(i, v)¶ Sets the component of this Color by index.
Parameters: - i (int) – index of the component to set.
- v (float) – Value to set component as.
Returns: True if successful.
Return type: bool
-
add
(other)¶ Overload method for the add operator.
Parameters: other (Color) – other color to add to this one. Returns: New Color of the sum of the two Color’s. Return type: Color
-
subtract
(other)¶ Overload method for the subtract operator.
Parameters: other (Color) – other color to subtract from this one. Returns: New Color of the difference of the two Color’s. Return type: Color
-
multiply
(other)¶ Overload method for the multiply operator.
Parameters: other (Color) – other color to multiply from this one. Returns: New Color of the product of the two Color’s. Return type: Color
-
divide
(other)¶ Divides this color and an other.
Parameters: other (Color) – other color to divide by. Returns: Quotient of the division of this color by the other. Return type: Color
-
multiplyScalar
(other)¶ Product of this color and a scalar.
Parameters: other (float) – Scalar value to multiply this color by. Returns: Product of the multiplication of the scalar and this color. Return type: Color
-
divideScalar
(other)¶ Divides this color and a scalar.
Parameters: other (float) – Value to divide this color by. Returns: Quotient of the division of the color by the scalar. Return type: Color
-
linearInterpolate
(other, t)¶ Linearly interpolates this color with another one based on a scalar blend value (0.0 to 1.0).
Parameters: - other (Color) – color to blend to.
- t (float) – Blend value.
Returns: New color blended between this and the input color.
Return type:
-
classmethod
randomColor
(gammaAdjustment)¶ - Generates a random color based on a seed and offset with gamma adjustment.
Example:
# Generate a regular random color color = randomColor(seed)
# Generate a light random color color = randomColor(seed, 0.5)
# Generate a dark random color color = randomColor(seed, -0.5)
Parameters: gammaAdjustment (float) – A gamma adjustment to offset the range of the generated color. Returns: New random color. Return type: Color
-
Usage Documentation
-
class
Euler
(x=None, y=None, z=None, ro=None)¶ Bases:
kraken.core.maths.math_object.MathObject
Euler rotation object.
-
__init__
(x=None, y=None, z=None, ro=None)¶ Initialize values for x,y,z, and rotation order values.
-
__str__
()¶ String representation of Euler object.
-
x
¶ X parameter property.
Returns: Value of the X property. Return type: float
-
y
¶ Y parameter property.
Returns: Value of the Y property. Return type: float
-
z
¶ Z parameter property.
Returns: Value of the Z property. Return type: float
-
ro
¶ Rotation Order parameter property.
Returns: Rotation Order of this Euler. Return type: object
-
__eq__
(other)¶
-
__ne__
(other)¶
-
set
(x, y, z, ro=None)¶ Scalar component setter.
Parameters: - x (float) – x angle in radians.
- y (float) – y angle in radians.
- z (float) – z angle in radians.
- ro (int) – the rotation order to use in the euler angles.
Returns: True if successful.
Return type: bool
-
equal
(other)¶ Checks equality of this Euler with another.
Parameters: other (Euler) – Other value to check equality with. Returns: True if equal. Return type: bool
-
Usage Documentation
-
class
Mat33
(row0=None, row1=None, row2=None)¶ Bases:
kraken.core.maths.math_object.MathObject
3x3 Matrix object.
-
__init__
(row0=None, row1=None, row2=None)¶ Initialize and set values in the 3x3 matrix.
-
__str__
()¶ Return a string representation of the 3x3 matrix.
-
__eq__
(other)¶
-
__ne__
(other)¶
-
__add__
(other)¶
-
__sub__
(other)¶
-
__mul__
(other)¶
-
setRows
(row0, row1, row2)¶ Setter from vectors, row-wise.
Parameters: Returns: True if successful.
Return type: bool
-
setColumns
(col0, col1, col2)¶ Setter from vectors, column-wise.
Parameters: Returns: True if successful.
Return type: bool
-
setNull
()¶ Setting all components of the matrix to 0.0.
Returns: True if successful. Return type: bool
-
setIdentity
()¶ Sets this matrix to the identity matrix.
Returns: True if successful. Return type: bool
-
setDiagonal
(v)¶ Sets the diagonal components of this matrix to the components of a vector.
Parameters: v (Vec3) – Vector to set diagonals to. Returns: True if successful. Return type: bool
-
equal
(other)¶ Checks equality of this Matrix33 with another.
Parameters: other (Mat33) – Other matrix to check equality with. Returns: True if equal. Return type: bool
-
almostEqual
(other, precision=None)¶ Checks almost equality of this Matrix33 with another.
Parameters: - other (Mat33) – Other matrix to check equality with.
- precision (float) – precision value.
Returns: True if almost equal.
Return type: bool
-
add
(other)¶ Overload method for the add operator.
Parameters: other (Mat33) – Other matrix to add to this one. Returns: New Mat33 of the sum of the two Mat33’s. Return type: Mat33
-
subtract
(other)¶ Overload method for the subtract operator.
Parameters: other (Mat33) – Other matrix to subtract from this one. Returns: New Mat33 of the difference of the two Mat33’s. Return type: Mat33
-
multiply
(other)¶ Overload method for the multiply operator.
Parameters: other (Mat33) – Other matrix to multiply from this one. Returns: New Mat33 of the product of the two Mat33’s. Return type: Mat33
-
multiplyScalar
(other)¶ Product of this matrix and a scalar.
Parameters: other (float) – scalar value to multiply this matrix by. Returns: Product of the multiplication of the scalar and this matrix. Return type: Mat33
-
multiplyVector
(other)¶ Returns the product of this matrix and a vector.
Parameters: other (Vec3) – Vector to multiply this matrix by. Returns: product of the multiplication of the Vec3 and this matrix. Return type: Vec3
-
divideScalar
(other)¶ Divides this matrix and a scalar.
Parameters: other (float) – value to divide this matrix by. Returns: Quotient of the division of the matrix by the scalar. Return type: Mat33
-
determinant
()¶ Gets the determinant of this matrix.
Returns: Determinant of this matrix. Return type: float
-
adjoint
()¶ Gets the adjoint matrix of this matrix.
Returns: Adjoint of this matrix. Return type: Mat33
-
Usage Documentation
-
class
Mat44
(row0=None, row1=None, row2=None, row3=None)¶ Bases:
kraken.core.maths.math_object.MathObject
4x4 Matrix object.
-
__init__
(row0=None, row1=None, row2=None, row3=None)¶ Initialize and set values in the 3x3 matrix.
-
__str__
()¶ String representation of the 4x4 matrix.
Returns: String representation of the 4x4 matrix. Return type: str
-
__eq__
(other)¶
-
__ne__
(other)¶
-
__add__
(other)¶
-
__sub__
(other)¶
-
__mul__
(other)¶
-
setRows
(row0, row1, row2, row3)¶ Set from vectors, row-wise.
Parameters: Returns: True if successful.
Return type: bool
-
setColumns
(col0, col1, col2, col3)¶ Setter from vectors, column-wise.
Parameters: Returns: True if successful.
Return type: bool
-
setNull
()¶ Setting all components of the matrix to 0.0.
Returns: True if successful. Return type: bool
-
setIdentity
()¶ Sets this matrix to the identity matrix.
Returns: True if successful. Return type: bool
-
setDiagonal
(v)¶ Sets the diagonal components of this matrix to the components of a vector.
Parameters: v (Vec3) – vector to set diagonals to. Returns: True if successful. Return type: bool
-
equal
(other)¶ Checks equality of this Matrix44 with another.
Parameters: other (Mat44) – other matrix to check equality with. Returns: True if equal. Return type: bool
-
almostEqual
(other)¶ Checks almost equality of this Matrix44 with another (using a default precision).
Parameters: other (Mat44) – other matrix to check equality with. Returns: True if almost equal. Return type: bool
-
add
(other)¶ Overload method for the add operator.
Parameters: other (Mat44) – other matrix to add to this one. Returns: new Mat44 of the sum of the two Mat44’s. Return type: Mat44
-
subtract
(other)¶ Overload method for the subtract operator.
Parameters: other (Mat44) – other matrix to subtract from this one. Returns: new Mat44 of the difference of the two Mat44’s. Return type: Mat44
-
multiply
(other)¶ Overload method for the multiply operator.
Parameters: other (Mat44) – other matrix to multiply from this one. Returns: new Mat44 of the product of the two Mat44’s. Return type: Mat44
-
multiplyScalar
(other)¶ Product of this matrix and a scalar.
Parameters: other (float) – scalar value to multiply this matrix by. Returns: product of the multiplication of the scalar and this matrix. Return type: Mat44
-
multiplyVector
(other)¶ Returns the product of this matrix and a vector.
Parameters: other (Vec3) – vector to multiply this matrix by. Returns: product of the multiplication of the Vec3 and this matrix. Return type: Vec3
-
divideScalar
(other)¶ Divides this matrix and a scalar.
Parameters: other (float) – Value to divide this matrix by Returns: Quotient of the division of the matrix by the scalar. Return type: Mat44
-
determinant
()¶ Gets the determinant of this matrix.
Returns: Determinant of this matrix. Return type: float
-
adjoint
()¶ Gets the adjoint matrix of this matrix.
Returns: Adjoint of this matrix. Return type: Mat44
-
Usage Documentation
-
class
MathObject
¶ Bases:
object
MathObject object. A base class for all math types
-
__init__
()¶ Initialize the base math object.
-
getRTVal
()¶ Returns the internal RTVal object owned by the math object.
Returns: RTVal Return type: object
-
setRTVal
(rtval)¶ Sets the internal RTVal object owned by the math object.
Parameters: rtval (object) – The internal RTVal object owned by the math object.
-
jsonEncode
()¶ Encodes object to JSON.
Returns: Encoded object. Return type: dict
-
jsonDecode
(jsonData, decodeFn)¶ Encodes object to JSON.
Parameters: - jsonData (dict) – The JSON data used to populate the math object.
- decodeFn (func) – The Decode Function that can construct the math members.
Returns: True of the decode was successful
Return type: bool
-
Usage Documentation
-
class
Quat
(v=None, w=None)¶ Bases:
kraken.core.maths.math_object.MathObject
Quaternion Rotation object.
-
__init__
(v=None, w=None)¶ Initializes the Quaternion.
-
__str__
()¶ Return string version of the Quat object.
Returns: String representation of the Quat. Return type: str
-
w
¶ Gets scalar of this quaternion.
Returns: Scalar value of the quaternion. Return type: float
-
__eq__
(other)¶
-
__ne__
(other)¶
-
__add__
(other)¶
-
__sub__
(other)¶
-
__mul__
(other)¶
-
__div__
(other)¶
-
set
(v, w)¶ Sets the quaternion from vector and scalar values.
Parameters: - v (Vec3) – vector value.
- w (float) – scalar value.
Returns: True if successful.
Return type: bool
-
setIdentity
()¶ Sets this quaternion to the identity.
Returns: True if successful. Return type: bool
-
setFromEuler
(e)¶ Sets the quaternion from a euler rotation.
Parameters: e (Euler) – Euler rotation used to set the quaternion. Returns: New quaternion set from the euler argument. Return type: Quat
-
setFromEulerAnglesWithRotOrder
(angles, ro)¶ Sets this quat to a given angles vector (in radians) and a rotation order.
Parameters: - angles (Vec3) – Angle vector.
- ro (RotationOrder) – Rotation order to use.
Returns: New quaternion set from angles vector and rotation order.
Return type:
-
setFromEulerAngles
(angles)¶ Sets this quat to a given angles vector (in radians) using the default XYZ rotation order.
Parameters: angles (Vec3) – angle vector. Returns: New quaternion set from angles vector. Return type: Quat
-
setFromAxisAndAngle
(axis, angle)¶ Set this quat to a rotation defined by an axis and an angle (in radians).
Parameters: - axis (Vec3) – vector axis.
- angle (float) – angle value.
Returns: Set from axis and angle values.
Return type:
-
setFromMat33
(mat)¶ Set this quat to the rotation described by a 3x3 rotation matrix.
Parameters: mat (Mat33) – 3x3 matrix to set the quaternion from. Returns: New quaternion set from input Mat33. Return type: Quat
-
setFrom2Vectors
(sourceDirVec, destDirVec, arbitraryIfAmbiguous=True)¶ Set the quaternion to the rotation required to rotate the source vector to the destination vector.
Function taken from the ‘Game Programming Gems’ article ‘The Shortest Arc Quat’ by Stan Melax, both vectors must be units.
Parameters: Returns: New quaternion set from 2 vectors.
Return type:
-
setFromDirectionAndUpvector
(direction, upvector)¶ Set the quat to represent the direction as the Z axis and the upvector pointing along the XY plane.
Parameters: Returns: New quaternion set from direction and up vector.
Return type:
-
equal
(other)¶ Checks equality of this Quat with another.
Parameters: other (Mat33) – other matrix to check equality with. Returns: True if equal. Return type: bool
-
almostEqualWithPrecision
(other, precision)¶ Checks almost equality of this Quat with another using a custom precision value.
Parameters: - other (Mat33) – other matrix to check equality with.
- precision (float) – precision value.
Returns: True if almost equal.
Return type: bool
-
almostEqual
(other)¶ Checks almost equality of this Quat with another (using a default precision).
Parameters: other (Mat33) – other matrix to check equality with. Returns: True if almost equal. Return type: bool
-
add
(other)¶ Overload method for the add operator.
Parameters: other (Quat) – Other quaternion to add to this one. Returns: New Quat of the sum of the two Quat’s. Return type: Quat
-
subtract
(other)¶ Overload method for the subtract operator.
Parameters: other (Quat) – Other quaternion to subtract from this one. Returns: New Quat of the difference of the two Quat’s. Return type: Quat
-
multiply
(other)¶ Overload method for the multiply operator.
Parameters: other (Quat) – Other quaternion to multiply this one by. Returns: New Quat of the product of the two Quat’s. Return type: Quat
-
divide
(other)¶ Divides this quaternion by another.
Parameters: other (Quat) – Quaternion to divide this quaternion by. Returns: Quotient of the division of the quaternion by the other quaternion. Return type: Quat
-
multiplyScalar
(other)¶ Product of this quaternion and a scalar.
Parameters: other (float) – scalar value to multiply this quaternion by. Returns: Product of the multiplication of the scalar and this quaternion. Return type: Quat
-
divideScalar
(other)¶ Divides this quaternion and a scalar.
Parameters: other (float) – value to divide this quaternion by. Returns: Quotient of the division of the quaternion by the scalar. Return type: Quat
-
rotateVector
(v)¶ Rotates a vector by this quaterion. Don’t forget to normalize the quaternion unless you want axial translation as well as rotation..
Parameters: v (Vec3) – vector to rotate. Returns: New vector rotated by this quaternion. Return type: Vec3
-
dot
(other)¶ Gets the dot product of this quaternion and another.
Parameters: other (Quat) – Other quaternion. Returns: Dot product. Return type: float
-
conjugate
()¶ Get the conjugate of this quaternion.
Returns: Conjugate of this quaternion. Return type: Quat
-
lengthSquared
()¶ Get the squared lenght of this quaternion.
Returns: Squared length oft his quaternion. Return type: float
-
length
()¶ Gets the length of this quaternion.
Returns: Length of this quaternion. Return type: float
-
unit
()¶ Gets a unit quaternion of this one.
Returns: New unit quaternion from this one. Return type: Quat
-
unit_safe
()¶ Gets a unit quaternion of this one, no error reported if cannot be made unit.
Returns: New unit quaternion. Return type: Quat
-
setUnit
()¶ Sets this quaternion to a unit quaternion and returns the previous length.
Returns: This quaternion. Return type: Quat
-
inverse
()¶ Gets an inverse quaternion of this one.
Returns: Inverse quaternion to this one. Return type: Quat
-
alignWith
(other)¶ Aligns this quaternion with another one ensuring that the delta between the Quat values is the shortest path over the hypersphere.
Parameters: other (Quat) – Quaternion to align this one with. Returns: New quaternion aligned to the other. Return type: Quat
-
getAngle
()¶ Gets the angle of this quaternion (in radians).
Returns: Angle of this quaternion (in radians). Return type: float
-
mirror
(axisIndex)¶ Reflects this Quaternion according to the axis provided.
Parameters: axisIndex (int) – 0 for the X axis, 1 for the Y axis, and 2 for the Z axis. Returns: Mirrored quaternion. Return type: Quat
-
toMat33
()¶ Gets this quaternion as a 3x3 matrix.
Returns: Matrix derived from this quaternion. Return type: Mat33
-
toEuler
(ro)¶ Returns this quaternion as a Euler rotation giving a rotation order.
Parameters: ro (RotationOrder) – rotation order to use to derive the euler by. Returns: Euler rotation derived from this quaternion. Return type: Euler
-
toEulerAnglesWithRotOrder
(ro)¶ Gets this quaternion as Euler angles using the specified rotation order.
Parameters: ro (RotationOrder) – rotation order used to derive the euler angles. Returns: Euler angles derived from this quaternion. Return type: Vec3
-
toEulerAngles
()¶ Gets this quaternion as a Euler angles using the rotationorder XYZ.
Returns: Euler angles derived from this quaternion. Return type: Vec3
-
sphericalLinearInterpolate
(q2, t)¶ Interpolates two quaternions spherically (slerp) given a scalar blend value (0.0 to 1.0).
Note: This and q2 should be unit Quaternions.
Parameters: - q2 (Quat) – Quaternion to blend to.
- t (float) – blend value.
Returns: New quaternion blended between this and the input quaternion.
Return type:
-
linearInterpolate
(other, t)¶ Interpolates two quaternions lineally (lerp) with a given blend value (0.0 to 1.0).
Note: The interpolation of the 2 quaternions will result acceleration and deceleration. Use sphericalLinearInterpolate for an interpolation that does not introduce acceleration..
Parameters: - other (Quat) – Quaternion to blend to.
- t (float) – blend value.
Returns: New quaternion blended between this and the input quaternion.
Return type:
-
Usage Documentation
-
class
RotationOrder
(order=4)¶ Bases:
kraken.core.maths.math_object.MathObject
RotationOrder rotation object.
-
__init__
(order=4)¶ Initialize rotation order.
-
__str__
()¶ String representation of RotationOrder object.
Returns: String representation of the RotationOrder. Return type: str
-
order
¶ Gets order value of this Rotation Order.
Returns: Order value of this Rotation Order. Return type: float
-
__eq__
(other)¶
-
__ne__
(other)¶
-
clone
()¶ Returns a clone of the RotationOrder.
Returns: The cloned RotationOrder. Return type: RotationOrder
-
set
(order)¶ Sets the order value from the input values.
Parameters: order (int, str) – Value to set the order property as. Returns: True if successful. Return type: bool
-
isZYX
()¶ Checks if this Rotation Order is equal to ZYX.
Returns: True if this rotationorder is ZYX. Return type: bool
-
isXZY
()¶ Checks if this Rotation Order is equal to XZY.
Returns: True if this rotationorder is XZY. Return type: bool
-
isYXZ
()¶ Checks if this Rotation Order is equal to YXZ.
Returns: True if this rotationorder is YXZ. Return type: bool
-
isYZX
()¶ Checks if this Rotation Order is equal to YZX.
Returns: True if this rotationorder is YZX. Return type: bool
-
isXYZ
()¶ Checks if this Rotation Order is equal to XYZ.
Returns: True if this rotationorder is XYZ. Return type: bool
-
isZXY
()¶ Checks if this Rotation Order is equal to ZXY.
Returns: True if this rotationorder is ZXY. Return type: bool
-
isReversed
()¶ Checks if this Rotation Order is a reversed one.
Returns: True if this rotation order is one of the reversed ones (XZY, ZYX or YXZ). Return type: bool
-
setZYX
()¶ Sets this rotation order to be ZYX.
Returns: True if successful. Return type: bool
-
setXZY
()¶ Sets this rotation order to be XZY.
Returns: True if successful. Return type: bool
-
setYXZ
()¶ Sets this rotation order to be YXZ.
Returns: True if successful. Return type: bool
-
setYZX
()¶ Sets this rotation order to be YZX.
Returns: True if successful. Return type: bool
-
setXYZ
()¶ Sets this rotation order to be XYZ.
Returns: True if successful. Return type: bool
-
setZXY
()¶ Sets this rotation order to be ZXY.
Returns: True if successful. Return type: bool
-
Usage Documentation
-
class
Vec2
(x=0.0, y=0.0)¶ Bases:
kraken.core.maths.math_object.MathObject
Vector 2 object.
-
__init__
(x=0.0, y=0.0)¶ Initializes x, y values for Vec2 object.
-
__str__
()¶ String representation of the Vec2 object.
Returns: String representation of the Vec2 object. Return type: str
-
x
¶ Gets x value of this vector.
Returns: X value of this vector. Return type: float
-
y
¶ Gets y value of this vector.
Returns: Y value of this vector. Return type: float
-
__eq__
(other)¶
-
__ne__
(other)¶
-
__add__
(other)¶
-
__sub__
(other)¶
-
__mul__
(other)¶
-
__div__
(other)¶
-
set
(x, y)¶ Sets the x and y value from the input values.
Parameters: - x (float) – Value to set the x property as.
- y (float) – Value to set the x property as.
Returns: True if successful.
Return type: bool
-
setNull
()¶ Setting all components of the vec2 to 0.0.
Returns: True if successful. Return type: bool
-
equal
(other)¶ Checks equality of this vec2 with another.
Parameters: other (Vec2) – other vector to check equality with. Returns: True if equal. Return type: bool
-
almostEqual
(other)¶ Checks almost equality of this Vec2 with another (using a default precision).
Parameters: other (Vec2) – other vector to check equality with. Returns: True if almost equal. Return type: bool
-
component
(i)¶ Gets the component of this Vec2 by index.
Parameters: i (int) – index of the component to return. Returns: Component of this Vec2. Return type: float
-
setComponent
(i, v)¶ Sets the component of this Vec2 by index.
Parameters: - i (int) – index of the component to set.
- v (float) – Value to set component as.
Returns: True if successful.
Return type: bool
-
add
(other)¶ Overload method for the add operator.
Parameters: other (Vec2) – Other vector to add to this one. Returns: New Vec2 of the sum of the two Vec2’s. Return type: Vec2
-
subtract
(other)¶ Overload method for the subtract operator.
Parameters: other (Vec2) – other vector to subtract from this one. Returns: New Vec2 of the difference of the two Vec2’s. Return type: Vec2
-
multiply
(other)¶ Overload method for the multiply operator.
Parameters: other (Vec2) – other vector to multiply from this one. Returns: New Vec2 of the product of the two Vec2’s. Return type: Vec2
-
divide
(other)¶ Divides this vector and an other.
Parameters: other (Vec2) – other vector to divide by. Returns: Quotient of the division of this vector by the other. Return type: Vec2
-
multiplyScalar
(other)¶ Product of this vector and a scalar.
Parameters: other (float) – Scalar value to multiply this vector by. Returns: Product of the multiplication of the scalar and this vector. Return type: Vec2
-
divideScalar
(other)¶ Divides this vector and a scalar.
Parameters: other (float) – Value to divide this vector by. Returns: Quotient of the division of the vector by the scalar. Return type: Vec2
-
negate
()¶ Gets the negated version of this vector.
Returns: Negation of this vector. Return type: Vec2
-
dot
(other)¶ Gets the dot product of this vector and another.
Parameters: other (Vec2) – Other vector. Returns: Dot product. Return type: float
-
cross
(other)¶ Gets the cross product of this vector and another.
Parameters: other (Vec2) – Other vector. Returns: Dot product. Return type: Vec2
-
lengthSquared
()¶ Get the squared length of this vector.
Returns: Squared length oft his vector. Return type: float
-
length
()¶ Gets the length of this vector.
Returns: Length of this vector. Return type: float
-
unit_safe
()¶ Gets a unit vector of this one, no error reported if cannot be made unit.
Returns: New unit vector. Return type: Vec2
-
setUnit
()¶ Sets this vector to a unit vector and returns the previous length.
Returns: This vector. Return type: float
-
normalize
()¶ Gets a normalized vector from this vector.
Returns: Previous length. Return type: float
-
clamp
(min, max)¶ Clamps this vector per component by a min and max vector.
Parameters: - min (float) – Minimum value.
- max (float) – Maximum value.
Returns: True if successful.
Return type: bool
-
unitsAngleTo
(other)¶ Gets the angle (self, in radians) of this vector to another one note expects both vectors to be units (else use angleTo)
Parameters: other (Vec2) – other vector to get angle to. Returns: Angle. Return type: float
-
angleTo
(other)¶ Gets the angle (self, in radians) of this vector to another one.
Parameters: other (Vec2) – other vector to get angle to. Returns: Angle. Return type: float
-
distanceTo
(other)¶ Doc String.
Parameters: other (Vec2) – the other vector to measure the distance to. Returns: True if successful. Return type: bool
-
linearInterpolate
(other, t)¶ Linearly interpolates this vector with another one based on a scalar blend value (0.0 to 1.0).
Parameters: - other (Vec2) – vector to blend to.
- t (float) – Blend value.
Returns: New vector blended between this and the input vector.
Return type:
-
distanceToLine
(lineP0, lineP1)¶ Returns the distance of this vector to a line defined by two points on the line.
Parameters: Returns: Distance to the line.
Return type: float
-
Usage Documentation
-
class
Vec3
(x=0.0, y=0.0, z=0.0)¶ Bases:
kraken.core.maths.math_object.MathObject
Vector 3 object.
-
__init__
(x=0.0, y=0.0, z=0.0)¶ Initializes x, y, z values for Vec3 object.
-
__str__
()¶ String representation of the Vec3 object.
Returns: String representation of the Vec3 object. Return type: str
-
x
¶ Gets x value of this vector.
Returns: X value of this vector. Return type: float
-
y
¶ Gets y value of this vector.
Returns: Y value of this vector. Return type: float
-
z
¶ Gets z value of this vector.
Returns: Z value of this vector. Return type: float
-
__eq__
(other)¶
-
__ne__
(other)¶
-
__add__
(other)¶
-
__sub__
(other)¶
-
__mul__
(other)¶
-
__div__
(other)¶
-
set
(x, y, z)¶ Sets the x, y, and z value from the input values.
Parameters: - x (float) – Value to set the x property as.
- y (float) – Value to set the x property as.
- z (float) – Value to set the z property as.
Returns: True if successful.
Return type: bool
-
setNull
()¶ Setting all components of the vec3 to 0.0.
Returns: True if successful. Return type: bool
-
equal
(other)¶ Checks equality of this vec3 with another.
Parameters: other (Vec3) – other vector to check equality with. Returns: True if equal. Return type: bool
-
almostEqual
(other)¶ Checks almost equality of this Vec3 with another (using a default precision).
Parameters: other (Vec3) – other vector to check equality with. Returns: True if almost equal. Return type: bool
-
component
(i)¶ Gets the component of this Vec3 by index.
Parameters: i (int) – index of the component to return. Returns: Component of this Vec3. Return type: float
-
setComponent
(i, v)¶ Sets the component of this Vec3 by index.
Parameters: - i (int) – index of the component to set.
- v (float) – Value to set component as.
Returns: True if successful.
Return type: bool
-
add
(other)¶ Overload method for the add operator.
Parameters: other (Vec3) – other vector to add to this one. Returns: New Vec3 of the sum of the two Vec3’s. Return type: Vec3
-
subtract
(other)¶ Overload method for the subtract operator.
Parameters: other (Vec3) – other vector to subtract from this one. Returns: New Vec3 of the difference of the two Vec3’s. Return type: Vec3
-
multiply
(other)¶ Overload method for the multiply operator.
Parameters: other (Vec3) – other vector to multiply from this one. Returns: New Vec3 of the product of the two Vec3’s. Return type: Vec3
-
divide
(other)¶ Divides this vector and an other.
Parameters: other (Vec3) – other vector to divide by. Returns: Quotient of the division of this vector by the other. Return type: Vec3
-
multiplyScalar
(other)¶ Product of this vector and a scalar.
Parameters: other (float) – Scalar value to multiply this vector by. Returns: Product of the multiplication of the scalar and this vector. Return type: Vec3
-
divideScalar
(other)¶ Divides this vector and a scalar.
Parameters: other (float) – Value to divide this vector by. Returns: Quotient of the division of the vector by the scalar. Return type: Vec3
-
negate
()¶ Gets the negated version of this vector.
Returns: Negation of this vector. Return type: Vec3
-
dot
(other)¶ Gets the dot product of this vector and another.
Parameters: other (Vec3) – Other vector. Returns: Dot product. Return type: float
-
cross
(other)¶ Gets the cross product of this vector and another.
Parameters: other (Vec3) – Other vector. Returns: Dot product. Return type: Vec3
-
lengthSquared
()¶ Get the squared length of this vector.
Returns: Squared length oft his vector. Return type: float
-
length
()¶ Gets the length of this vector.
Returns: Length of this vector. Return type: float
-
unit_safe
()¶ Gets a unit vector of this one, no error reported if cannot be made unit.
Returns: New unit vector. Return type: Vec3
-
setUnit
()¶ Sets this vector to a unit vector and returns the previous length.
Returns: This vector. Return type: float
-
normalize
()¶ Gets a normalized vector from this vector.
Returns: Previous length. Return type: float
-
clamp
(min, max)¶ Clamps this vector per component by a min and max vector.
Parameters: - min (float) – Minimum value.
- max (float) – Maximum value.
Returns: True if successful.
Return type: bool
-
unitsAngleTo
(other)¶ Gets the angle (self, in radians) of this vector to another one note expects both vectors to be units (else use angleTo)
Parameters: other (Vec3) – other vector to get angle to. Returns: Angle. Return type: float
-
angleTo
(other)¶ Gets the angle (self, in radians) of this vector to another one.
Parameters: other (Vec3) – other vector to get angle to. Returns: Angle. Return type: float
-
distanceTo
(other)¶ Doc String.
Parameters: other (Vec3) – the other vector to measure the distance to. Returns: True if successful. Return type: bool
-
linearInterpolate
(other, t)¶ Linearly interpolates this vector with another one based on a scalar blend value (0.0 to 1.0).
Parameters: - other (Vec3) – vector to blend to.
- t (float) – Blend value.
Returns: New vector blended between this and the input vector.
Return type:
-
distanceToLine
(lineP0, lineP1)¶ Returns the distance of this vector to a line defined by two points on the line.
Parameters: Returns: Distance to the line.
Return type: float
-
Usage Documentation
-
class
Vec4
(x=0.0, y=0.0, z=0.0, t=0.0)¶ Bases:
kraken.core.maths.math_object.MathObject
Vector 4 object.
-
__init__
(x=0.0, y=0.0, z=0.0, t=0.0)¶ Initializes x, y z and t values for Vec4 object.
-
__str__
()¶ String representation of the Vec4 object.
Returns: String representation of the Vec4 object. Return type: str
-
x
¶ Gets x value of this vector.
Returns: x value of this vector. Return type: float
-
y
¶ Gets y value of this vector.
Returns: y value of this vector. Return type: float
-
z
¶ Gets z value of this vector.
Returns: z value of this vector. Return type: float
-
t
¶ Gets t value of this vector.
Returns: t value of this vector. Return type: float
-
__eq__
(other)¶
-
__ne__
(other)¶
-
__add__
(other)¶
-
__sub__
(other)¶
-
__mul__
(other)¶
-
__div__
(other)¶
-
set
(x, y, z, t)¶ Sets the x, y, z, and t value from the input values.
Parameters: - x (float) – Value to set the x property as.
- y (float) – Value to set the y property as.
- z (float) – Value to set the z property as.
- t (float) – Value to set the t property as.
Returns: True if successful.
Return type: bool
-
setNull
()¶ Setting all components of the vec4 to 0.0.
Returns: True if successful. Return type: bool
-
equal
(other)¶ Checks equality of this vec4 with another.
Parameters: other (Vec4) – other vector to check equality with. Returns: True if equal. Return type: bool
-
almostEqual
(other)¶ Checks almost equality of this Vec4 with another (using a default precision).
Parameters: other (Vec4) – other vector to check equality with. Returns: True if almost equal. Return type: bool
-
component
(i)¶ Gets the component of this Vec4 by index.
Parameters: i (int) – index of the component to return. Returns: component of this Vec4. Return type: float
-
setComponent
(i, v)¶ Sets the component of this Vec4 by index.
Parameters: - i (int) – index of the component to set.
- v (float) – Value to set component as.
Returns: True if successful.
Return type: bool
-
add
(other)¶ Overload method for the add operator.
Parameters: other (Vec4) – other vector to add to this one. Returns: New Vec4 of the sum of the two Vec4’s. Return type: Vec4
-
subtract
(other)¶ Overload method for the subtract operator.
Parameters: other (Vec4) – other vector to subtract from this one. Returns: New Vec4 of the difference of the two Vec4’s. Return type: Vec4
-
multiply
(other)¶ Overload method for the multiply operator.
Parameters: other (Vec4) – other vector to multiply from this one. Returns: New Vec4 of the product of the two Vec4’s. Return type: Vec4
-
divide
(other)¶ Divides this vector and an other.
Parameters: other (Vec4) – other vector to divide by. Returns: Quotient of the division of this vector by the other. Return type: Vec4
-
multiplyScalar
(other)¶ Product of this vector and a scalar.
Parameters: other (float) – Scalar value to multiply this vector by. Returns: Product of the multiplication of the scalar and this vector. Return type: Vec4
-
divideScalar
(other)¶ Divides this vector and a scalar.
Parameters: other (float) – Value to divide this vector by. Returns: Quotient of the division of the vector by the scalar. Return type: Vec4
-
negate
()¶ Gets the negated version of this vector.
Returns: Negation of this vector. Return type: Vec4
-
dot
(other)¶ Gets the dot product of this vector and another.
Parameters: other (Vec4) – other vector. Returns: dot product. Return type: float
-
cross
(other)¶ Gets the cross product of this vector and another.
Parameters: other (Vec4) – other vector. Returns: Dot product. Return type: Vec4
-
lengthSquared
()¶ Get the squared length of this vector.
Returns: squared length oft his vector. Return type: float
-
length
()¶ Gets the length of this vector.
Returns: length of this vector. Return type: float
-
unit_safe
()¶ Gets a unit vector of this one, no error reported if cannot be made unit.
Returns: New unit vector. Return type: Vec4
-
setUnit
()¶ Sets this vector to a unit vector and returns the previous length.
Returns: this vector. Return type: float
-
normalize
()¶ Gets a normalized vector from this vector.
Returns: previous length. Return type: float
-
clamp
(min, max)¶ Clamps this vector per component by a min and max vector.
Parameters: - min (float) – Minimum value.
- max (float) – Maximum value.
Returns: True if successful.
Return type: bool
-
unitsAngleTo
(other)¶ Gets the angle (self, in radians) of this vector to another one note expects both vectors to be units (else use angleTo)
Parameters: other (Vec4) – other vector to get angle to. Returns: angle. Return type: float
-
angleTo
(other)¶ Gets the angle (self, in radians) of this vector to another one.
Parameters: other (Vec4) – other vector to get angle to. Returns: angle. Return type: float
-
distanceTo
(other)¶ Doc String.
Parameters: other (Vec4) – the other vector to measure the distance to. Returns: True if successful. Return type: bool
-
linearInterpolate
(other, t)¶ Linearly interpolates this vector with another one based on a scalar blend value (0.0 to 1.0).
Parameters: - other (Vec4) – vector to blend to.
- t (float) – Blend value.
Returns: New vector blended between this and the input vector.
Return type:
-
distanceToLine
(lineP0, lineP1)¶ Returns the distance of this vector to a line defined by two points on the line.
Parameters: Returns: distance to the line.
Return type: float
-
Usage Documentation
-
class
Xfo
(tr=None, ori=None, sc=None)¶ Bases:
kraken.core.maths.math_object.MathObject
Transform object.
-
__init__
(tr=None, ori=None, sc=None)¶ Initializes tr, ori and sc values for Xfo object.
-
__str__
()¶ String representation of Transform.
Returns: String representation of Transform. Return type: str
-
tr
¶ Gets translation property of this transform.
Returns: Translation property of this transform. Return type: float
-
ori
¶ Gets orientation property of this transform.
Returns: Orientation property of this transform. Return type: float
-
sc
¶ Gets scaling property of this transform.
Returns: Scaling property of this transform. Return type: float
-
__eq__
(other)¶
-
__ne__
(other)¶
-
__mul__
(other)¶
-
clone
()¶ Returns a clone of the Xfo.
Returns: The cloned Xfo
-
set
(tr, ori, sc)¶ Setter from the translation, rotation and scaling.
Parameters: Returns: True if successful.
Return type: bool
-
setIdentity
()¶ Sets this transform to the identity.
Returns: True if successful. Return type: bool
-
setFromMat44
(m)¶ Sets this transform from the supplied matrix.
Parameters: m (Mat44) – 4x4 matrix to set the transform from. Returns: New transform set from input Mat44. Return type: Xfo
-
multiply
(xfo)¶ Overload method for the multiply operator.
Parameters: xfo (Xfo) – Other transform to multiply this one by. Returns: New Xfo of the product of the two Xfo’s. Return type: Xfo
-
transformVector
(v)¶ Transforms a vector by this transform.
Parameters: v (Vec3) – Vector to transform. Returns: New vector transformed by this transform. Return type: Vec3
-
transformRay
(ray)¶ Transforms a ray vector by this transform.
Parameters: ray (Vec3) – Ray vector to transform. Returns: New ray vector transformed by this transform. Return type: Ray
-
inverse
()¶ Get the inverse transform of this transform.
Returns: Inverse of this transform. Return type: Xfo
-
inverseTransformVector
(vec)¶ Transforms a vector with this xfo inversely
Note: We have ‘inverseTransformVector’ because Xfos with non-uniform scaling cannot be inverted as Xfos.
Parameters: vec (Vec3) – Vector to be inversely transformed. Returns: Inversely transformed vector. Return type: Vec3
-
linearInterpolate
(other, t)¶ Linearly interpolates this transform with another one based on a scalar blend value (0.0 to 1.0).
Parameters: - other (Xfo) – Transform to blend to.
- t (float) – Blend value.
Returns: New transform blended between this and the input transform.
Return type:
-
setFromVectors
(inVec1, inVec2, inVec3, translation)¶ Set Xfo values from 3 axis vectors and a translation vector.
Parameters: Returns: True if successful.
Return type: bool
-
Kraken - math module.
-
Math_radToDeg
(val)¶ Converts radians to degrees.
Parameters: val (float) – value to convert to degrees. Returns: Value in degrees. Return type: float
-
Math_degToRad
(val)¶ Converts degrees to radians.
Parameters: val (float) – value to convert to radians. Returns: Value in radians. Return type: float
-
decodeValue
(jsonData)¶ Returns a constructed math value based on the provided json data.
Parameters: jsondata (dict) – The JSON data to use to decode into a Math value. Returns: The constructed math value Return type: object
This package represents all of the base objects that Kraken can create.
Usage Documentation
-
class
Attribute
(name, value, parent=None, metaData=None)¶ Bases:
kraken.core.objects.scene_item.SceneItem
Attribute object.
-
__init__
(name, value, parent=None, metaData=None)¶
-
getValue
()¶ Returns the value of the attribute.
Returns: Attribute Value.
-
setValue
(value)¶ Sets attribute value.
Parameters: value – Value to set the attribute to. Returns: True if successful. Return type: bool
-
setValueChangeCallback
(callback)¶ Sets the value of the attribute.
Parameters: callback – Value to set the attribute to. Returns: True if successful. Return type: bool
-
getKeyable
()¶ Returns the keyable state of the attribute.
Parameters: argument (Type) – description. Returns: Keyable state of the attribute. Return type: bool
-
setKeyable
(value)¶ Sets the keyable state of the attribute.
Parameters: value (bool) – keyable state. Returns: True if successful. Return type: bool
-
getLock
()¶ Returns the Lock state of the attribute.
Returns: Lock state of the attribute. Return type: bool
-
setLock
(value)¶ Sets the lock state of the attribute..
Parameters: value (bool) – lock state. Returns: True if successful. Return type: bool
-
setAnimatable
(value)¶ Sets the animatable state of the attribute..
Parameters: value (bool) – animatable state. Returns: True if successful. Return type: bool
-
getAnimatable
()¶ Returns the animatable state of the attribute..
Returns: True if Animatable state of the attribute. Return type: bool
-
getRTVal
()¶ Returns and RTVal object for this attribute.
Note
This method should be re-implemented in concrete attribute classes.
Returns: RTVal object for this attribute. Return type: RTVal Raises: NotImplemented
– Must be implemented by concrete attribute classes.
-
validateValue
(value)¶ Validates the incoming value is the correct type.
Note
This method should be re-implemented in concrete attribute classes.
Parameters: value – value to check the type of. Returns: True if valid. Return type: bool Raises: NotImplemented
– This method should be re-implemented in concrete attribute classes.
-
isConnected
()¶ Returns whether the attribute is connected or not.
Returns: True if is connected. Return type: bool
-
getConnection
()¶ Returns the connected attribute..
Returns: attribute driving this attribute. Return type: Object
-
connect
(attribute)¶ Connects this attribute with another..
Parameters: attribute (Object) – attribute that will drive this one. Returns: True if successful. Return type: bool
-
disconnect
()¶ Clears the connection of this attribute..
Returns: True if successful. Return type: bool
-
jsonEncode
(saver)¶ Encodes the object to a JSON structure.
Parameters: saver (Object) – saver object. Returns: A JSON structure containing the data for this SceneItem. Return type: Dict
-
jsonDecode
(loader, jsonData)¶ Returns the color of the object..
Parameters: - loader (Object) – Loader object.
- jsonData (Dict) – JSON object structure.
Returns: True if successful.
Return type: bool
-
Usage Documentation
-
class
AttributeGroup
(name, parent=None, metaData=None)¶ Bases:
kraken.core.objects.scene_item.SceneItem
Attribute Group that attributes belong to.
-
__init__
(name, parent=None, metaData=None)¶
-
_checkAttributeIndex
(index)¶ Checks the supplied index is valid.
Parameters: index (int) – attribute index to check. Returns: True if valid. Return type: bool
-
addAttribute
(attribute)¶ Adds an attribute to this object..
Parameters: attribute (Object) – attribute object to add to this object. Returns: True if successful. Return type: bool
-
removeAttributeByIndex
(index)¶ Removes attribute at specified index..
Parameters: index (int) – index of the attribute to remove. Returns: True if successful. Return type: bool
-
removeAttributeByName
(name)¶ Removes the attribute with the specified name..
Parameters: name (str) – name of the attribute to remove. Returns: True if successful. Return type: bool
-
getNumAttributes
()¶ Returns the number of attributes as an integer.
Returns: Number of attributes on this object. Return type: int
-
getAttributeByIndex
(index)¶ Returns the attribute at the specified index..
Parameters: index (int) – index of the attribute to return. Returns: The attribute at the specified index. Return type: Attribute
-
getAttributeByName
(name)¶ Return the attribute with the specified name..
Parameters: name (str) – Name of the attribute to return. Returns: The attribute with the specified name. Return type: Attribute
-
jsonEncode
(saver)¶ Encodes the object to a JSON structure.
Parameters: saver (Object) – saver object. Returns: A JSON structure containing the data for this SceneItem. Return type: Dict
-
jsonDecode
(loader, jsonData)¶ Returns the color of the object..
Parameters: - loader (Object) – Loader object.
- jsonData (Dict) – JSON object structure.
Returns: True if successful.
Return type: bool
-
Usage Documentation
-
class
BoolAttribute
(name, value=False, parent=None, metaData=None)¶ Bases:
kraken.core.objects.attributes.attribute.Attribute
Boolean Attribute. Implemented value type checking and limiting.
-
__init__
(name, value=False, parent=None, metaData=None)¶
-
setValue
(value)¶ Sets the value of the attribute..
Parameters: value (bool) – Value to set the attribute to. Returns: True if successful. Return type: bool
-
getRTVal
()¶ Returns and RTVal object for this attribute.
Returns: RTVal object of the attribute. Return type: RTVal
-
getDataType
()¶ Returns the name of the data type for this attribute.
Note
This is a localized method specific to the Boolean Attribute.
Returns: String name of the attribute type. Return type: str
-
Usage Documentation
-
class
ColorAttribute
(name, value=None, parent=None, metaData=None)¶ Bases:
kraken.core.objects.attributes.attribute.Attribute
Color Attribute. Implemented value type checking.
-
__init__
(name, value=None, parent=None, metaData=None)¶
-
setValue
(color)¶ Sets the value of the attribute..
Parameters: value (dict) – Color values to set the attribute to. Returns: True if successful. Return type: bool
-
getRTVal
()¶ Returns and RTVal object for this attribute.
Returns: RTVal object of the attribute. Return type: RTVal
-
getDataType
()¶ Returns the name of the data type for this attribute.
Note
This is a localized method specific to the Color Attribute.
Returns: Color name of the attribute type. Return type: str
-
Usage Documentation
-
class
IntegerAttribute
(name, value=0, minValue=None, maxValue=None, keyable=None, parent=None, metaData=None)¶ Bases:
kraken.core.objects.attributes.number_attribute.NumberAttribute
Float Attribute. Implemented value type checking and limiting.
-
__init__
(name, value=0, minValue=None, maxValue=None, keyable=None, parent=None, metaData=None)¶
-
getRTVal
()¶ Returns and RTVal object for this attribute.
Returns: RTVal object of the attribute. Return type: RTVal
-
validateValue
(value)¶ Validates the incoming value is the correct type.
Note
This is a localized method specific to the Integer Attribute.
Parameters: value (int) – value to check the type of. Returns: True if valid. Return type: Boolean
-
getDataType
()¶ Returns the name of the data type for this attribute.
Note
This is a localized method specific to the Integer Attribute.
Returns: String name of the attribute type. Return type: str
-
Usage Documentation
-
class
NumberAttribute
(name, value=0, minValue=None, maxValue=None, parent=None, metaData=None)¶ Bases:
kraken.core.objects.attributes.attribute.Attribute
Number Attributee. Base class for number attribute types
-
__init__
(name, value=0, minValue=None, maxValue=None, parent=None, metaData=None)¶
-
setValue
(value)¶ Sets the value of the attribute..
Parameters: value – Value to set the attribute to. Returns: True if successful. Return type: bool
-
getMin
()¶ Gets the minimum value for this attribute.
Returns: minimum value. Return type: float, int
-
setMin
(minimum)¶ Sets the minimum value for the attribute.
Note
Only works on float or integer attributes.
Parameters: minimum (float, int) – minimum value the attribute can have. Returns: True if successful. Return type: bool
-
getMax
()¶ Gets the maximum value for this attribute.
Returns: maximum value. Return type: float, int
-
setMax
(maximum)¶ Sets the maximum value for the attribute.
Note
Only works on float or integer attributes.
Parameters: maximum (float, int) – maximum value the attribute can have. Returns: True if successful. Return type: bool
-
getUIMin
()¶ Gets the default minimum ui slider value for this attribute.
Returns: default minimum ui slider value. Return type: float, int
-
setUIMin
(minimum)¶ Sets the default minimum ui slider value for the attribute.
Note
Only works on float or integer attributes.
Parameters: minimum (float, int) – default minimum ui slider value. Returns: True if successful. Return type: bool
-
getUIMax
()¶ Gets the default maximum ui slider value for this attribute.
Returns: default maximum ui slider value. Return type: float, int
-
setUIMax
(maximum)¶ Sets the default maximum ui slider value for the attribute.
Note
Only works on float or integer attributes.
Parameters: maximum (float, int) – default maximum ui slider value. Returns: True if successful. Return type: bool
-
Usage Documentation
-
class
ScalarAttribute
(name, value=0.0, minValue=None, maxValue=None, parent=None, metaData=None)¶ Bases:
kraken.core.objects.attributes.number_attribute.NumberAttribute
Float Attribute. Implemented value type checking and limiting.
-
__init__
(name, value=0.0, minValue=None, maxValue=None, parent=None, metaData=None)¶
-
getRTVal
()¶ Returns and RTVal object for this attribute.
Returns: RTVal object of the attribute. Return type: RTVal
-
validateValue
(value)¶ Validates the incoming value is the correct type.
Note
This is a localized method specific to the Scalar Attribute.
Parameters: value (int) – value to check the type of. Returns: True if valid. Return type: bool
-
getDataType
()¶ Returns the name of the data type for this attribute.
Returns: String name of the attribute type. Return type: str
-
Usage Documentation
-
class
StringAttribute
(name, value='', parent=None, metaData=None)¶ Bases:
kraken.core.objects.attributes.attribute.Attribute
String Attribute. Implemented value type checking.
-
__init__
(name, value='', parent=None, metaData=None)¶
-
setValue
(value)¶ Sets the value of the attribute..
Parameters: value – Value to set the attribute to. Returns: True if successful. Return type: bool
-
getRTVal
()¶ Returns and RTVal object for this attribute.
Returns: RTVal object of the attribute. Return type: RTVal
-
getDataType
()¶ Returns the name of the data type for this attribute.
Note
This is a localized method specific to the String Attribute.
Returns: String name of the attribute type. Return type: str
-
Usage Documentation
-
class
Component
(name, parent=None, location='M', metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
Kraken Component object.
-
__init__
(name, parent=None, location='M', metaData=None)¶
-
getNameDecoration
()¶ Gets the decorated name of the object.
Returns: Decorated name of the object. Return type: str
-
getComponentColor
()¶ Gets the color assigned to this component.
Returns: R, G, B, A values. Return type: tuple
-
setComponentColor
(r, g, b, a)¶ Sets the componetn color by the rgba values.
Parameters: - r (int) – Red value.
- g (int) – Green value.
- b (int) – Blue value.
- a (int) – Alpha value.
Returns: True if successful.
Return type: bool
-
getLocation
()¶ Returns the location of the component as a string.
Returns: Location of the component. Return type: str
-
setLocation
(location)¶ Sets the location of the component.
Parameters: location (str) – Location that the component is on. Returns: True if successful. Return type: bool
-
getGraphPos
()¶ Returns the graphPos of the component as a string.
Returns: The graphPos of the component. Return type: str
-
setGraphPos
(graphPos)¶ Sets the graphPos of the component.
Parameters: graphPos (Vec2) – The position in the graph where this node is placed. Returns: True if successful. Return type: bool
-
getLayer
(name)¶ Retrieves a layer from the owning container.
Parameters: name (str) – Name of the layer to find. Returns: The layer from the container. Return type: Layer
-
getOrCreateLayer
(name)¶ Retrieves a layer from the owning container, or generates a layer (and warning message)
Parameters: name (str) – Name of the layer to retrieve or create. Returns: The layer from the container, or generated layer. Return type: Layer
-
addItem
(name, item)¶ Adds a child to the component and sets the object’s component attribute.
Parameters: child (Object) – Object to add as a child. Returns: True if successful. Return type: bool
-
getItems
()¶ Returns all items for this component.
Returns: Items for this component. Return type: list
-
addChild
(child)¶ Adds a child to the component and sets the object’s component attribute.
Parameters: child (Object) – Object to add as a child. Returns: True if successful. Return type: bool
-
getHierarchyNodes
(classType='', inheritedClass=False)¶ Returns a nodeList with all children in component hierarchy that matches classType.
Parameters: - classType (str) – Optional Class type to match.
- inheritedClass (bool) – Optional Match nodes that is a sub-class of type.
Returns: Nodes that match the class type.
Return type: list
-
getInputs
()¶ Returns all inputs for this component.
Returns: Inputs for this component. Return type: list
-
checkInputIndex
(index)¶ Checks the supplied index is valid.
Parameters: index (int) – Input index to check. Returns: True if successful. Return type: bool
-
createInput
(name, dataType, **kwargs)¶ Creates an input object and also a connected target object that matches the data type that is passed.
Parameters: - name (str) – Name of the input to create.
- dataType (str) – Data type of the input.
Returns: The connected target object for the input.
Return type: Object
-
addInput
(name, dataType)¶ Add input port Object to this object.
Parameters: - name (str) – Name of the input to create.
- dataType (str) – Data type of the input.
Returns: New input object.
Return type: Object
-
removeInputByIndex
(index)¶ Remove ComponentInputPort at specified index.
Parameters: index (int) – Index of the ComponentInputPort to remove. Returns: True if successful. Return type: bool
-
removeInputByName
(name)¶ Removes a input from this object by name.
Parameters: name (str) – Name of input to remove. Returns: True if successful. Return type: bool
-
getNumInputs
()¶ Returns the number of inputs this component has.
Returns: number of inputs of this object. Return type: int
-
getInputByIndex
(index)¶ Returns the input object at specified index.
Parameters: index (int) – Index of the input to return. Returns: Input object at specified index. Return type: Object
-
getInputByName
(name)¶ Returns the input object with the specified name.
Parameters: name (str) – Name of the input to return. Returns: Input object. Return type: Object
-
getOutputs
()¶ Returns all outputs for this component.
Returns: Outputs for this component. Return type: list
-
checkOutputIndex
(index)¶ Checks the supplied index is valid.
Parameters: index (int) – Output index to check. Returns: True if successful. Return type: bool
-
createOutput
(name, dataType, **kwargs)¶ Creates an output object and also a connected target object that matches the data type that is passed.
Parameters: - name (str) – Name of the output to create.
- dataType (str) – Data type of the output.
Returns: The connected target object for the output.
Return type: Object
-
addOutput
(name, dataType)¶ Add output port Object to this object.
Parameters: - name (str) – Name of the output to create.
- dataType (str) – Data type of the output.
Returns: New output object.
Return type: Object
-
getNumOutputs
()¶ Returns the number of outputs this component has.
Returns: Number of outputs of this object. Return type: int
-
getOutputByIndex
(index)¶ Returns the output object at specified index.
Parameters: index (int) – Index of the output to return. Returns: Output object at specified index.
-
getOutputByName
(name)¶ Returns the output object with the specified name.
Parameters: name (str) – Name of the output to return. Returns: Output object. Return type: Object
-
evalOperators
()¶ Evaluates all component operators in order they were created.
Returns: True if no errors during evaluation. Return type: bool
-
checkOperatorIndex
(index)¶ Checks the supplied index is valid.
Parameters: index (int) – operator index to check. Returns: True if the index is valid. Return type: bool
-
addOperator
(operator)¶ Adds a operator to this object.
Parameters: operator (Object) – Object that will be a operator of this object. Returns: True if successful. Return type: bool
-
removeOperatorByIndex
(index)¶ Removes a operator from this object by index.
Parameters: index (int) – Index of operator to remove. Returns: True if successful. Return type: bool
-
removeOperatorByName
(name)¶ Removes a operator from this object by name.
Parameters: name (str) – Name of operator to remove. Returns: True if successful. Return type: bool
-
getNumOperators
()¶ Returns the number of operators this object has.
Returns: Number of operators of this object. Return type: int
-
getOperatorByIndex
(index)¶ Returns the operator object at specified index.
Parameters: index (int) – Index of the operator to return. Returns: Operator object at specified index. Return type: Object
-
getOperatorByName
(name)¶ Returns the operator object with the specified name.
Parameters: name (str) – Name of the operator to return. Returns: Operator if found. Return type: Object
-
getOperatorByType
(childType)¶ Returns all children that are of the specified type.
Parameters: childType (str) – The object type to search for. Returns: Array of operator objects of the specified type. Return type: list
-
getOperatorIndex
(operator)¶ Return the index of the specified operator.
Parameters: operator (Object) – Operator to find the index of. Returns: Operator if found. Return type: Object
-
moveOperatorToIndex
(operator, index)¶ Moves an operator to the specified index.
Parameters: - operator (Object) – Operator to move.
- index (int) – Index position to move the operator to.
Returns: True if successful.
Return type: bool
-
getOperators
()¶ Returns all operators for this component.
Returns: Outputs for this component. Return type: list
-
saveData
()¶ Save the data for the component to be persisted.
Returns: The JSON data object Return type: dict
-
loadData
(data)¶ Load a saved guide representation from persisted data.
Parameters: data (dict) – The JSON data object. Returns: True if successful. Return type: bool
-
copyData
()¶ Copy the data for the component to our clipboard.
Returns: The JSON data object Return type: dict
-
pasteData
(data, setLocation=True)¶ Paste a copied guide representation.
Parameters: - data (dict) – The JSON data object.
- setLocation (bool) – Whether to set the location after pasting data.
Returns: True if successful.
Return type: bool
-
saveAllObjectData
(data, classType='Control', inheritedClass=False)¶ Stores the Guide data for all objects of this type in the component.
Parameters: - data (dict) – The JSON rig data object.
- classType (str) – The class of the type of object we want to store to data
- inheritedClass (bool) – Also include all objects that are inherited from classType
Returns: The JSON rig data object.
Return type: dict
-
saveObjectData
(data, objectList)¶ Stores the Guide data for component objects in this list. Guide data is xfo and curve information
Parameters: - data (dict) – The JSON rig data object.
- objectList (list) – list of Object3D objects
Returns: The JSON rig data object.
Return type: dict
-
loadAllObjectData
(data, classType='Control', inheritedClass=False)¶ Stores the Guide data for all objects of this type in the component.
Parameters: - data (dict) – The JSON rig data object.
- classType (type) – The class of the type of object we want to store to data
- inheritedClass (bool) – Also include all objects that are inherited from classType
Returns: The JSON rig data object.
Return type: dict
-
loadObjectData
(data, objectList)¶ Loads the Guide data for component objects in this list. Guide data is xfo and curve information
Parameters: - data (dict) – The JSON rig data object.
- objectList (list) – list of Object3D objects
-
getRigBuildData
()¶ Returns the Guide data used by the Rig Component to define the layout of the final rig..
Returns: The JSON rig data object. Return type: dict
-
detach
()¶ Detaches component from container.
Raises: NotImplemented
– This method should be implemented in sub-classes.
-
attach
(container)¶ Attaches component to container.
Parameters: container (object) – container to attach to. Raises: NotImplemented
– This method should be implemented in sub-classes.
-
classmethod
getComponentType
()¶ Enables introspection of the class prior to construction to determine if it is a guide component.
Note
This is a localized method specific to the Component object.
Returns: String name of the Component type. Return type: str
-
Usage Documentation
This base component automatically sets up a hierarchy which includes a control Layer with a Hierarchy Group for inputs and one for outputs. This is done for convenience to have a base component setup to not only demonstrate how to create a default hierarchy but also to demonstrate how to setup the attach and detach methods.
The attach()
and detach()
are methods that are only invoked through the user interface. Since components can be dynamically added and removed from a Container through the UI, these methods are necessary in order keep the graph clean.
-
class
BaseExampleComponent
(name='', parent=None, metaData=None, *args, **kwargs)¶ Bases:
kraken.core.objects.components.component.Component
Example Component Base
-
__init__
(name='', parent=None, metaData=None, *args, **kwargs)¶
-
detach
()¶ Detaches component from container. This method undoes the actions performed in the constructor. It removes all elements that were added to the rig. It is invoked by the UI when deleting components from a guide rig.
-
attach
(container)¶ Attaches component to container.
Parameters: container (object) – container to attach to.
-
Usage Documentation
-
class
ComponentInput
(name, parent=None, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
ComponentInput object.
-
__init__
(name, parent=None, metaData=None)¶
-
Usage Documentation
-
class
ComponentInputPort
(name, parent, dataType, metaData=None)¶ Bases:
kraken.core.objects.scene_item.SceneItem
Component Input Object.
-
__init__
(name, parent, dataType, metaData=None)¶
-
setDataType
(dataType)¶ Sets the data type for this input.
Parameters: dataType (str) – Type of input source. Returns: True if successful. Return type: bool
-
getDataType
()¶ Returns the data type for this input.
Returns: Data type of this input. Return type: str
-
isConnected
()¶ Checks if there is a connection.
Returns: Whether it is connected or not. Return type: bool
-
getConnection
()¶ Gets the connection of this input.
Returns: Connection object or None if not set.
-
setConnection
(connectionObj, index=0)¶ Sets the connection to the component output.
Parameters: connectionObj (ComponentOutput) – Output object to connect to. Returns: True if successful. Return type: bool
-
removeConnection
()¶ Removes the connection to the component output.
Returns: True if successful. Return type: bool
-
canConnectTo
(otherPort)¶ Tests whether or not this port can connect to the other port.
Parameters: otherPort (Port) – Port to test if able to connect to. Returns: True if can connect, false otherwise. Return type: bool
-
setTarget
(target)¶ Sets the target for this input.
Parameters: target (Object) – Kraken object that is the target of this input. Returns: True if successful. Return type: bool
-
getTarget
()¶ Returns the target of the input.
Returns: Object, the target of the input.
-
getIndex
()¶ Gets the index of the connection.
Returns: Integer, the index of the connection.
-
_ComponentInputPort__setIndex
(index)¶ Sets the index of the connection.
Parameters: index (int) – The index to set this to. Returns: True if successful. Return type: bool
-
Usage Documentation
-
class
ComponentOutput
(name, parent=None, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
ComponentOutput object.
-
__init__
(name, parent=None, metaData=None)¶
-
Usage Documentation
-
class
ComponentOutputPort
(name, parent, dataType, metaData=None)¶ Bases:
kraken.core.objects.scene_item.SceneItem
Component Output Object.
-
__init__
(name, parent, dataType, metaData=None)¶
-
setDataType
(dataType)¶ Sets the data type for this input.
Parameters: dataType (str) – type of input source. Returns: True if successful. Return type: bool
-
getDataType
()¶ Returns the data type for this input.
Returns: Data type of this input. Return type: str
-
isConnected
()¶ Checks if there is a connection.
Returns: Whether there are any output connections. Return type: bool
-
getConnection
(index)¶ Gets the connection of this input.
Parameters: index (int) – Index of connection to return. Returns: Connection object or None if not set. Return type: object
-
getNumConnections
()¶ Gets the number of connections for this output port.
Returns: Number of connections. Return type: int
-
_addConnection
(connectionObj)¶ Adds a connection to the output.
Parameters: connectionObj (object) – Object to set as a connection. Returns: True if successful. Return type: bool
-
_removeConnection
(connectionObj)¶ Removes a connection.
Parameters: connectionObj (object) – Object to remove the connection for. Returns: True if successful. Return type: bool
-
canConnectTo
(otherPort)¶ Tests whether or not this port can connect to the other port.
Parameters: otherPort (Port) – Port to test if able to connect to. Returns: True if can connect, false otherwise. Return type: bool
-
setTarget
(target)¶ Sets the taret for this input.
Parameters: target (object) – Kraken object that is the target of this input. Returns: True if successful. Return type: bool
-
getTarget
()¶ Returns the target of the input.
Returns: Object, the target of the input.
-
Usage Documentation
-
class
Constraint
(name, parent=None, metaData=None)¶ Bases:
kraken.core.objects.scene_item.SceneItem
Constraint object.
-
__init__
(name, parent=None, metaData=None)¶
-
getBuildName
()¶ Returns the build name for the object.
Returns: Name to be used in the DCC. Return type: str
-
setFlag
(name)¶ Sets the flag of the specified name.
Returns: True if successful. Return type: bool
-
testFlag
(name)¶ Tests if the specified flag is set.
Parameters: name (str) – Name of the flag to test. Returns: True if flag is set. Return type: bool
-
clearFlag
(name)¶ Clears the flag of the specified name.
Parameters: name (str) – Name of the flag to clear. Returns: True if successful. Return type: bool
-
getFlags
()¶ Returns all flags set on this object.
Returns: Flags set on this object. Return type: list
-
getSources
()¶ Returns the sources of the object.
Returns: All sources of this object. Return type: list
-
getMaintainOffset
()¶ Returns the whether the constraint should maintain offset when it’s built or not.
Returns: Whether the constraint should maintain offset or not. Return type: bool
-
setMaintainOffset
(value)¶ Sets the constraint to maintain offset when creating the constraint.
Parameters: value (bool) – Whether the constraint should maintain offset or not. Returns: True if successful. Return type: bool
-
setConstrainee
(constrainee)¶ Sets the constrainee object for this constraint.
Parameters: constrainee (Object) – Object that will be constrained. Returns: True if successful. Return type: bool
-
getConstrainee
()¶ Returns the constrainee object for this constraint.
Returns: True if successful. Return type: bool
-
addConstrainer
(kObject3D)¶ Adds a constrainer object to this constraint.
Parameters: kObject3D (Object) – kObject3D that will constrain the constrainee. Returns: True if successful. Return type: bool
-
setConstrainer
(kObject3D, index=0)¶ Sets the constrainer at the specified index.
Parameters: - kObject3D (object) – Kraken 3D object.
- index (int) – index of the constraint to set.
Returns: True if successful.
Return type: bool
-
removeConstrainerByIndex
(index)¶ Removes a constrainer object by its index.
Parameters: index (int) – Index of the constrainer you want to remove. Returns: True if successful. Return type: bool
-
getConstrainers
()¶ Returns the constrainers of this constraint.
Returns: Constrainer objects. Return type: list
-
compute
()¶ invokes the constraint and returns the resulting transform
Returns: The result of the constraint in global space. Return type: xfo
-
computeOffset
()¶ Invokes the constraint and computes the offset
Returns: The offset to be used for the constraint. Return type: xfo
-
evaluate
()¶ Invokes the constraint causing the output value to be computed.
Returns: True if successful. Return type: bool
-
jsonEncode
(saver)¶ Encodes the object to a JSON structure.
Parameters: saver (Object) – saver object. Returns: A JSON structure containing the data for this SceneItem. Return type: Dict
-
jsonDecode
(loader, jsonData)¶ Returns the color of the object..
Parameters: - loader (Object) – Loader object.
- jsonData (Dict) – JSON object structure.
Returns: True if successful.
Return type: bool
-
Usage Documentation
-
class
OrientationConstraint
(name, metaData=None)¶ Bases:
kraken.core.objects.constraints.constraint.Constraint
Orientation Constraint.
-
__init__
(name, metaData=None)¶
-
Usage Documentation
-
class
PoseConstraint
(name, metaData=None)¶ Bases:
kraken.core.objects.constraints.constraint.Constraint
Pose Constraint.
-
__init__
(name, metaData=None)¶
-
Usage Documentation
-
class
PositionConstraint
(name, metaData=None)¶ Bases:
kraken.core.objects.constraints.constraint.Constraint
Position Constraint.
-
__init__
(name, metaData=None)¶
-
Usage Documentation
-
class
ScaleConstraint
(name, metaData=None)¶ Bases:
kraken.core.objects.constraints.constraint.Constraint
Scale Constraint.
-
__init__
(name, metaData=None)¶
-
Usage Documentation
-
class
Operator
(name, parent=None, metaData=None)¶ Bases:
kraken.core.objects.scene_item.SceneItem
Operator representation.
-
__init__
(name, parent=None, metaData=None)¶
-
getBuildName
()¶ Returns the build name for the object.
Returns: Name to be used in the DCC. Return type: str
-
setFlag
(name)¶ Sets the flag of the specified name.
Returns: True if successful. Return type: bool
-
testFlag
(name)¶ Tests if the specified flag is set.
Parameters: name (str) – Name of the flag to test. Returns: True if flag is set. Return type: bool
-
clearFlag
(name)¶ Clears the flag of the specified name.
Parameters: name (str) – Name of the flag to clear. Returns: True if successful. Return type: bool
-
getFlags
()¶ Returns all flags set on this object.
Returns: Flags set on this object. Return type: list
-
getSources
()¶ Returns the sources of the object.
Returns: All sources of this object. Return type: list
-
resizeInput
(name, count)¶ Resizes and array output to a given size.
Parameters: - name (str) – Name of the output.
- count (Object) – Output object.
Returns: True if successful.
Return type: bool
-
setInput
(name, operatorInput, index=0)¶ Sets the input by the given name.
Parameters: - name (str) – Name of the input.
- operatorInput (Object) – Input object.
Returns: True if successful.
Return type: bool
-
getInput
(name)¶ Returns the input with the specified name.
Parameters: name (str) – Name of the input to get. Returns: Input object. Return type: object
-
getInputType
(name)¶ Returns the type of input with the specified name.
-
getInputNames
()¶ Returns the names of all inputs.
Returns: Names of all inputs. Return type: list
-
resizeOutput
(name, count)¶ Resizes and array output to a given size.
Parameters: - name (str) – Name of the output.
- count (object) – Output object.
Returns: True if successful.
Return type: bool
-
setOutput
(name, operatorOutput, index=0)¶ Sets the output by the given name.
Parameters: - name (str) – Name of the output.
- operatorOutput (object) – Output object.
Returns: True if successful.
Return type: bool
-
getOutput
(name)¶ Returns the output with the specified name.
Parameters: name (str) – Name of the output to get. Returns: Output object. Return type: object
-
getOutputType
(name)¶ Returns the type of input with the specified name.
-
getOutputNames
()¶ Returns the names of all outputs.
Returns: Names of all outputs. Return type: list
-
updateTargets
()¶ Updates all targets so that they have a hold on this operator.
-
evaluate
()¶ Invokes the operator causing the output values to be computed.
Returns: True if successful. Return type: bool
-
Usage Documentation
-
class
CanvasOperator
(name, canvasPresetPath, metaData=None)¶ Bases:
kraken.core.objects.operators.operator.Operator
Canvas Operator representation.
-
__init__
(name, canvasPresetPath, metaData=None)¶
-
getDefaultValue
(name, RTValDataType, mode='port')¶ Returns the default RTVal value for this argument Only print debug if setting default inputs. Don’t care about outputs, really
Parameters: - name (str) – Name of the input to get.
- mode (str) – “inputs” or “outputs”
Returns: RTVal
-
getPresetPath
()¶ Returns the preset path within the Canvas library for the node used by this operator.
Returns: Path of the preset files used by this operator. Return type: str
-
getGraphDesc
()¶ Returns the json description of the node used by this operator
Returns: A json dict containing the description the operator. Return type: object
-
getInput
(name)¶ Returns the input with the specified name.
Parameters: name (str) – Name of the input to get. Returns: Input object. Return type: object
-
getInputType
(name)¶ Returns the type of input with the specified name.
-
getOutputType
(name)¶ Returns the type of output with the specified name.
-
evaluate
()¶ Invokes the Canvas node causing the output values to be computed.
Returns: True if successful. Return type: bool
-
Usage Documentation
-
class
KLOperator
(name, solverTypeName, extension, metaData=None)¶ Bases:
kraken.core.objects.operators.operator.Operator
KL Operator representation.
-
__init__
(name, solverTypeName, extension, metaData=None)¶
-
getSolverTypeName
()¶ Returns the solver type name for this operator.
Returns: Name of the solver type this operator uses. Return type: str
-
getExtension
()¶ Returns the extention this operator uses.
Returns: Name of the extension this solver uses. Return type: str
-
getSolverArgs
()¶ Returns the args array defined by the KL Operator.
Returns: Args array defined by the KL Operator. Return type: RTValArray
-
getInputType
(name)¶ Returns the type of input with the specified name.
-
getOutputType
(name)¶ Returns the type of output with the specified name.
-
getDefaultValue
(name, RTValDataType, mode='arg')¶ Returns the default RTVal value for this argument Only print debug if setting default inputs. Don’t care about outputs, really
Parameters: - name (str) – Name of the input to get.
- mode (str) – “inputs” or “outputs”
Returns: RTVal
-
getInput
(name)¶ Returns the input with the specified name.
If there is no input value, it get the default RTVal and converts to python data
Parameters: name (str) – Name of the input to get. Returns: Input object. Return type: object
-
generateSourceCode
()¶ Returns the source code for a stub operator that will invoke the KL operator
Returns: The source code for the stub operator. Return type: str
-
evaluate
()¶ Invokes the KL operator causing the output values to be computed.
Returns: True if successful. Return type: bool
-
Usage Documentation
-
class
ComponentGroup
(name, component, parent=None, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
ComponentGroup object.
-
__init__
(name, component, parent=None, metaData=None)¶
-
getName
()¶ Gets the decorated name of the object.
Returns: Decorated name of the object. Return type: str
-
getNameDecoration
()¶ Gets the decorated name of the object.
Returns: Decorated name of the object. Return type: str
-
Usage Documentation
-
class
Container
(name, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
Container object.
-
__init__
(name, metaData=None)¶
-
addItem
(name, item)¶ Adds a child to the component and sets the object’s component attribute.
Parameters: child (Object) – Object to add as a child. Returns: True if successful. Return type: bool
-
getItems
()¶ Returns all items for this component.
Returns: Items for this component. Return type: list
-
Usage Documentation
-
class
Control
(name, parent=None, shape='null', scale=1.0, flags=None, metaData=None)¶ Bases:
kraken.core.objects.curve.Curve
Base Control object.
-
__init__
(name, parent=None, shape='null', scale=1.0, flags=None, metaData=None)¶ Initializes control object.
Parameters: - name (str) – Name of the constraint.
- parent (Object) – Parent object of this object.
-
getShape
()¶ Returns the shape that the control was set to.
Returns: Name of the shape that was set. Return type: str
-
setShape
(shape)¶ Sets the shape of the control to the one specified.
Parameters: shape (str) – the desired shape of the control. Returns: True if successful. Return type: bool
-
alignOnXAxis
(negative=False)¶ Aligns the control shape on the X axis.
Parameters: negative (bool) – Whether to align the control on the negative X axis. Returns: True if successful. Return type: bool
-
alignOnYAxis
(negative=False)¶ Aligns the control shape on the Y axis.
Parameters: negative (bool) – Whether to align the control on the negative Y axis. Returns: True if successful. Return type: bool
-
alignOnZAxis
(negative=False)¶ Aligns the control shape on the Z axis.
Parameters: negative (bool) – Whether to align the control on the negative Z axis. Returns: True if successful. Return type: bool
-
scalePointsOnAxis
(scale, scaleAxis='POSX')¶ Scales the point positions from it’s center along the given axis only.
Parameters: - scale – scale value to apply to the points.
- scaleAxis – which axes to scale and by what direction
Returns: True if successful.
Return type: bool
-
scalePoints
(scaleVec)¶ Scales the point positions from it’s center.
Parameters: scaleVec (Vec3) – scale value to apply to the points. Returns: True if successful. Return type: bool
-
rotatePoints
(xRot, yRot, zRot)¶ Rotates the points by the input values.
Parameters: - xRot (float) – Euler x rotate value.
- yRot (float) – Euler y rotate value.
- zRot (float) – Euler z rotate value.
Returns: True if successful.
Return type: bool
-
translatePoints
(translateVec)¶ Translates the control points.
Parameters: translateVec (Vec3) – Translation values to apply to the points. Returns: True if successful. Return type: bool
-
insertCtrlSpace
(name=None)¶ Adds a CtrlSpace object above this object
Parameters: name (string) – optional name for this CtrlSpace, default is same as this object Returns: New CtrlSpace object Return type: object
-
Usage Documentation
-
class
CtrlSpace
(name, parent=None, flags=None, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
CtrlSpace object.
-
__init__
(name, parent=None, flags=None, metaData=None)¶
-
Usage Documentation
-
class
Curve
(name, parent=None, flags=None, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
Curve object.
-
__init__
(name, parent=None, flags=None, metaData=None)¶
-
getCurveData
()¶ Returns the data of the curve.
Returns: Dictionaries defining each sub-curve of this curve. Return type: list
-
setCurveData
(data)¶ Sets the curve data.
Arguments: data (list): Dictionaries defining each sub-curve of this curve.
Returns: True if successful. Return type: bool
-
appendCurveData
(data)¶ Appends sub-curve data to this curve.
Arguments: data (list): Dictionaries defining each sub-curve being added to this curve.
Returns: True if successful. Return type: bool
-
checkSubCurveIndex
(index)¶ Checks the supplied index is valid.
Parameters: index (int) – Sub-curve index to check.
-
getNumSubCurves
()¶ Returns the number of sub-curves on this object.
Returns: Number of sub-curves in this object. Return type: int
-
getSubCurveClosed
(index)¶ Returns whether the sub-curve is closed or not.
Parameters: index (int) – Index of the sub-curve to query. Returns: True if the sub-curve is closed. Return type: bool
-
getSubCurveData
(index)¶ Get the sub-curve data by it’s index.
Parameters: index (int) – Index of the sub-curve to get the data for. Returns: Data defining the sub-curve. Return type: dict
-
setSubCurveData
(index, data)¶ Sets the sub-curve data.
Parameters: - index (int) – Index of the sub-curve to get the data for.
- data (dict) – Defining the sub-curve data.
Returns: True if successful.
Return type: bool
-
removeSubCurveByIndex
(index)¶ Removes a sub-curve by its index.
Parameters: index (int) – Index of the sub-curve to remove. Returns: True if successful. Return type: bool
-
Usage Documentation
-
class
HierarchyGroup
(name, parent=None, flags=None, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
HierarchyGroup object.
-
__init__
(name, parent=None, flags=None, metaData=None)¶
-
Usage Documentation
-
class
Joint
(name, parent=None, flags=None, metaData=None, **kwargs)¶ Bases:
kraken.core.objects.object_3d.Object3D
Joint object.
-
__init__
(name, parent=None, flags=None, metaData=None, **kwargs)¶
-
getRadius
()¶ Gets the radius of the joint.
Returns: Radius of the joint. Return type: float
-
setRadius
(radius)¶ Sets the radius of the joint.
Parameters: radiu (float) – Radius to set the joint to. Returns: True if successful. Return type: bool
-
Usage Documentation
-
class
Layer
(name, parent=None, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
Layer object.
-
__init__
(name, parent=None, metaData=None)¶
-
Usage Documentation
-
class
Locator
(name, parent=None, flags=None, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
Locator object.
-
__init__
(name, parent=None, flags=None, metaData=None)¶
-
Usage Documentation
-
class
Object3D
(name, parent=None, flags=None, metaData=None)¶ Bases:
kraken.core.objects.scene_item.SceneItem
Kraken base object type for any 3D object.
-
__init__
(name, parent=None, flags=None, metaData=None)¶
-
ro
¶ Gets Rotation Order property of this Object3D.
Returns: Rotation Order property of this Object3D. Return type: RotationOrder
-
getBuildName
()¶ Returns the build name for the object.
Returns: Name to be used in the DCC. Return type: str
-
setName
(name)¶ Sets the name of the object with a string.
Parameters: name (str) – The new name for the item. Returns: True if successful. Return type: bool
-
getContainer
()¶ Returns the Container the object belongs to.
Returns: Container. Return type: Object
-
getLayer
()¶ Returns the Layer the object belongs to.
Returns: Layer this object belongs to. Return type: Object
-
hasChild
(child)¶ Checks the supplied item is a child
Parameters: child (Object) – Object to check if is is a child of this object.
-
_checkChildIndex
(index)¶ Checks the supplied index is valid.
Parameters: index (int) – Child index to check.
-
addChild
(child)¶ Adds a child to this object.
Note
We allow for duplicate child names as long as the types differ.
Parameters: child (Object) – Object that will be a child of this object. Returns: True if successful. Return type: bool
-
setParent
(parent)¶ Sets the parent of this object.
Arguments: parent (Object): Object that is the parent of this one.
Returns: True if successful. Return type: bool
-
removeChildByIndex
(index)¶ Removes a child from this object by index.
Parameters: index (int) – Index of child to remove. Returns: True if successful. Return type: bool
-
removeChildByName
(name)¶ Removes a child from this object by name.
Parameters: name (str) – Name of child to remove. Returns: True if successful. Return type: bool
-
removeChild
(child)¶ Removed the child as an child item of this object.
Returns: True if successful. Return type: bool
-
getDescendents
(nodeList=None, classType=None, inheritedClass=False)¶ Gets the children of this object.
Parameters: - nodeList – (list): optional list to append children to
- classType (str) – Name of the type of class to limit the search to
- inheritedClass (bool) – Match nodes that is a sub-class of type.
Returns: Child objects.
Return type: list
-
getChildren
()¶ Gets the children of this object.
Returns: Child objects. Return type: list
-
getNumChildren
()¶ Returns the number of children this object has.
Returns: Number of children of this object. Return type: int
-
getChildByIndex
(index)¶ Returns the child object at specified index.
Parameters: index (int) – Index of the child to find. Returns: Child object at specified index. Return type: Object
-
getChildByName
(name)¶ Returns the child object with the specified name.
Parameters: name (str) – Name of the child to return. Returns: Object if found. Return type: Object
-
getChildByDecoratedName
(decoratedName)¶ Returns the child object with the specified name.
Parameters: decoratedName (str) – Decorated name of the child to find. Returns: Object if found. Return type: Object
-
getChildrenByType
(childType)¶ Returns all children that are of the specified type.
Parameters: childType (str) – Type of children to find. Returns: Array of child objects of the specified type. Return type: list
-
_checkAttributeGroupIndex
(index)¶ Checks the supplied index is valid.
Parameters: index (int) – Attribute index to check. Returns: True if successful. Return type: bool
-
addAttributeGroup
(attributeGroup)¶ Adds an attributeGroup to this object.
Parameters: attributeGroup (Object) – Attribute Group object to add to this object. Returns: True if successful. Return type: bool
-
removeAttributeGroupByIndex
(index)¶ Removes attribute at specified index.
Parameters: index (int) – Index of attribute to remove. Returns: True if successful. Return type: bool
-
removeAttributeGroupByName
(name)¶ Removes the attribute with the specified name.
Parameters: name (str) – Name of the attribute to remove. Returns: True if successful. Return type: bool
-
getNumAttributeGroups
()¶ Returns the number of attributeGroups as an integer.
Returns: Number of attributeGroups on this object. Return type: int
-
getAttributeGroupByIndex
(index)¶ Returns the attribute at the specified index.
Parameters: index (int) – Index of the attribute to return. Returns: Attribute Group at the specified index. Return type: AttributeGroup
-
getAttributeGroupByName
(name)¶ Return the attribute group with the specified name.
Parameters: name (str) – Name of the attribute group to return. Returns: Attribute with the specified name. Return type: Attribute
-
checkConstraintIndex
(index)¶ Checks the supplied index is valid.
Parameters: index (int) – Constraint index to check. Returns: True if successful. Return type: bool
-
constrainTo
(constrainers, constraintType='Pose', maintainOffset=False, name=None)¶ Adds an constraint to this object.
Parameters: - constrainers (Object or Object list) – Constraint object to add to this object or objects.
- constraintType (str) – String name of the constraint type.
- maintainOffset (bool) – Sets the constraint to maintain offset when creating the constraint.
- name (str) – Name of the constraint. If set to None, a name is automatically generated.
Returns: Constraint object
Return type: string
-
addConstraint
(constraint)¶ Adds an constraint to this object.
Parameters: constraint (Object) – Constraint object to add to this object. Returns: True if successful. Return type: bool
-
removeConstraintByIndex
(index)¶ Removes constraint at specified index.
Parameters: index (int) – Index of constraint to remove. Returns: True if successful. Return type: bool
-
removeConstraintByName
(name)¶ Removes the constraint with the specified name.
Parameters: name (str) – Name of the constraint to remove. Returns: True if successful. Return type: bool
-
removeAllConstraints
()¶ Removes all of the constraints for this object.
Returns: True if successful. Return type: bool
-
getNumConstraints
()¶ Returns the number of constraints as an integer.
Returns: Number of constraints on this object. Return type: int
-
getConstraintByIndex
(index)¶ Returns the constraint at the specified index.
Parameters: index (int) – Index of the constraint to return. Returns: Constraint at the specified index. Return type: Constraint
-
getConstraintByName
(name)¶ Return the constraint group with the specified name.
Parameters: name (str) – Name of the constraint group to return. Returns: Attribute with the specified name. Return type: Attribute
-
getVisibilityAttr
()¶ Returns the Visibility attribute object.
Returns: Attribute that holds the value of the visibility. Return type: BoolAttribute
-
getVisibility
()¶ Returns the visibility status of the scene item.
Returns: Visible or not. Return type: bool
-
setVisibility
(value)¶ Sets the visibility of the scene object.
Parameters: value (bool) – value of the visibility of the object. Returns: True if successful. Return type: bool
-
getShapeVisibilityAttr
()¶ Returns the Shape Visibility attribute object.
Returns: Attribute that holds the value of the shape visibility. Return type: BoolAttribute
-
getShapeVisibility
()¶ Returns the shape visibility status of the scene item.
Returns: Visible or not. Return type: bool
-
setShapeVisibility
(value)¶ Sets the shape visibility of the scene object.
Parameters: value (bool) – Value of the visibility of the object. Returns: True if successful. Return type: bool
-
setColor
(color)¶ Sets the color of this object.
Parameters: color (str, Color) – Name of the color from the Config or a Color() object. Returns: True if successful. Return type: bool
-
getColor
()¶ Returns the color of the object.
Returns: Color of the object. Return type: str
-
lockRotation
(x=False, y=False, z=False)¶ Sets flags for locking rotation parameters.
Parameters: - x (bool) – Lock x axis.
- y (bool) – Lock y axis.
- z (bool) – Lock z axis.
Returns: True if successful.
Return type: bool
-
lockScale
(x=False, y=False, z=False)¶ Sets flags for locking scale parameters.
Parameters: - x (bool) – Lock x axis.
- y (bool) – Lock y axis.
- z (bool) – Lock z axis.
Returns: True if successful.
Return type: bool
-
lockTranslation
(x=False, y=False, z=False)¶ Sets flags for locking translation parameters.
Parameters: - x (bool) – Lock x axis.
- y (bool) – Lock x axis.
- z (bool) – Lock x axis.
Returns: True if successful.
Return type: bool
-
jsonEncode
(saver)¶ Encodes the object to a JSON structure.
Parameters: saver (Object) – saver object. Returns: A JSON structure containing the data for this SceneItem. Return type: Dict
-
jsonDecode
(loader, jsonData)¶ Returns the color of the object..
Parameters: - loader (Object) – Loader object.
- jsonData (Dict) – JSON object structure.
Returns: True if successful.
Return type: bool
-
Usage Documentation
-
class
Rig
(name='rig', metaData=None)¶ Bases:
kraken.core.objects.container.Container
Rig object.
-
__init__
(name='rig', metaData=None)¶
-
writeRigDefinitionFile
(filepath)¶ Load a rig definition from a file on disk.
Parameters: filepath (str) – The file path of the rig definition file. Returns: True if successful. Return type: bool
-
loadRigDefinitionFile
(filepath)¶ Load a rig definition from a file on disk.
Parameters: filepath (str) – The file path of the rig definition file. Returns: True if successful. Return type: bool
-
_loadComponents
(componentsJson)¶ Loads components from a JSON dict.
Parameters: componentsJson (dict) – Dictionary of components to load.
-
_makeConnections
(connectionsJson)¶ Makes connections based on JSON dict.
Parameters: connectionsJson (dict) – Dictionary of connections to make.
-
loadRigDefinition
(jsonData)¶ Load a rig definition from a JSON structure.
Parameters: jsonData (dict) – JSON data containing the rig definition. Returns: True if successful. Return type: bool
-
writeGuideDefinitionFile
(filepath)¶ Writes a rig definition to a file on disk.
Parameters: filepath (str) – The file path of the rig definition file. Returns: True if successful. Return type: bool
-
getData
()¶ Get the graph definition of the rig. This method is used to save the state of the guide itself.
Returns: The JSON data struture of the rig data Return type: dict
-
getRigBuildData
()¶ Get the graph definition of the guide for building the final rig.
Returns: The JSON data struture of the guide rig data Return type: dict
-
Usage Documentation
-
class
SceneItem
(name, parent=None, metaData=None)¶ Bases:
object
Kraken base object type for any 3D object.
-
__init__
(name, parent=None, metaData=None)¶
-
getId
()¶ Returns the unique Id of this object.
Returns: Unique id. Return type: int
-
getTypeName
()¶ Returns the class name of this object.
Returns: True if successful. Return type: bool
-
getTypeHierarchyNames
()¶ Returns the class name of this object.
Returns: True if successful. Return type: bool
-
isTypeOf
(typeName)¶ Returns the class name of this object.
Parameters: typeName (str) – Name to check against. Returns: True if the scene item is of the given type. Return type: bool
-
isOfAnyType
(typeNames)¶ Returns true if this item has any of the given type names
Parameters: typeNames (tuple) – Type names to check against. Returns: True if the scene item is of the given type. Return type: bool
-
getName
()¶ Returns the name of the object as a string.
Returns: Object’s name. Return type: str
-
setName
(name)¶ Sets the name of the object with a string.
Parameters: name (str) – The new name for the item. Returns: True if successful. Return type: bool
-
getPath
()¶ Returns the full hierarchical path to this object.
Returns: Full name of the object. Return type: str
-
getNameDecoration
()¶ Gets the decorated name of the object.
Returns: Decorated name of the object. Return type: str
-
getDecoratedName
()¶ Gets the decorated name of the object.
Returns: Decorated name of the object. Return type: str
-
getDecoratedPath
()¶ Gets the decorated path of the object.
Returns: Decorated path of the object. Return type: str
-
getParent
()¶ Returns the parent of the object as an object.
Returns: Parent of this object. Return type: Object
-
setParent
(parent)¶ Sets the parent attribute of this object.
Arguments: parent (Object): Object that is the parent of this one.
Returns: True if successful. Return type: bool
-
getSources
()¶ Returns the sources of the object.
Returns: All sources of this object. Return type: list
-
getCurrentSource
()¶ Returns the source of the object which is currently driving it.
Returns: source of this object Return type: Object
-
addSource
(source)¶ Adds another source to this object.
Arguments: source (Object): Object that is the source of this one.
Returns: Index of the source used Return type: int
-
removeSource
(source)¶ Removes a source from this object.
Arguments: source (Object): Object that is no longer a source of this one.
-
setSource
(index, source)¶ Sets the source of this object.
Arguments: index (int): The index of the source to update. source (Object): Object that is the source of this one.
-
getDepends
()¶ Returns the objects that depend on this object.
Returns: All depending objects of this object. Return type: list
-
getComponent
()¶ Returns the component of the object as an object.
Returns: Component of this object. Return type: Object
-
setComponent
(component)¶ Sets the component attribute of this object.
Parameters: component (Object) – Object that is the component of this one. Returns: True if successful. Return type: bool
-
setFlag
(name)¶ Sets the flag of the specified name.
Returns: True if successful. Return type: bool
-
testFlag
(name)¶ Tests if the specified flag is set.
Parameters: name (str) – Name of the flag to test. Returns: True if flag is set. Return type: bool
-
clearFlag
(name)¶ Clears the flag of the specified name.
Parameters: name (str) – Name of the flag to clear. Returns: True if successful. Return type: bool
-
getFlags
()¶ Returns all flags set on this object.
Returns: Flags set on this object. Return type: list
-
getMetaData
()¶ Gets the meta data from the rig.
Returns: Extra data stored on the rig. Return type: dict
-
getMetaDataItem
(name)¶ Returns an item in the meta data by the key name.
Parameters: - name (String) – Name of the key in the meta data dictionary to get
- for. (data) –
Returns: Data from the specified key, None if not present.
-
_SceneItem__maxId
= 0¶
-
setMetaDataItem
(name, data)¶ Sets meta data on the rig.
Parameters: data (dict) – Extra data needed to persist the rig / graph. Returns: True if successful. Return type: bool
-
Usage Documentation
-
class
Transform
(name, parent=None, flags=None, metaData=None)¶ Bases:
kraken.core.objects.object_3d.Object3D
Transform object.
-
__init__
(name, parent=None, flags=None, metaData=None)¶
-
Usage Documentation
-
logHierarchy
(kObject)¶ Traverses the given Kraken hierarchy and logs the names of all the objects.
Parameters: Object – The object to start logging on.
-
__convertFromJSON
(jsonData)¶
-
prepareToLoad
(jsonData)¶ Prepares the json data for loading into kraken.
Parameters: jsonData (dict) – The JSON data to be prepared. Returns: The prepared JSON hierarchy. Return type: dict
-
__convertToJSON
(jsonData)¶
-
prepareToSave
(jsonData)¶ Prepares the json data for serialization.
Parameters: jsonData (dict) – The JSON data to be prepared. Returns: The prepared JSON hierarchy. Return type: dict
-
__mirrorData
(jsonData, plane)¶
-
mirrorData
(jsonData, plane)¶ Prepares the json data for serialization.
Parameters: jsonData (dict) – The JSON data to be prepared. Returns: The prepared JSON hierarchy. Return type: dict
Kraken uses the Python logging
module for reporting messages from the Kraken Framework to both stdout
and to the Kraken User Interface.
-
class
WidgetHandler
¶ Bases:
logging.Handler
Logging Handler for Sending Messages to Widgets.
-
__init__
()¶
-
addWidget
(widget)¶
-
removeWidget
(widget)¶
-
clearWidgets
()¶
-
emit
(record)¶
-
acquire
()¶ Acquire the I/O thread lock.
-
addFilter
(filter)¶ Add the specified filter to this handler.
-
close
()¶ Tidy up any resources used by the handler.
This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses should ensure that this gets called from overridden close() methods.
-
createLock
()¶ Acquire a thread lock for serializing access to the underlying I/O.
-
filter
(record)¶ Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero.
-
flush
()¶ Ensure all logging output has been flushed.
This version does nothing and is intended to be implemented by subclasses.
-
format
(record)¶ Format the specified record.
If a formatter is set, use it. Otherwise, use the default formatter for the module.
-
get_name
()¶
-
handle
(record)¶ Conditionally emit the specified logging record.
Emission depends on filters which may have been added to the handler. Wrap the actual emission of the record with acquisition/release of the I/O thread lock. Returns whether the filter passed the record for emission.
-
handleError
(record)¶ Handle errors which occur during an emit() call.
This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method.
-
name
¶
-
release
()¶ Release the I/O thread lock.
-
removeFilter
(filter)¶ Remove the specified filter from this handler.
-
setFormatter
(fmt)¶ Set the formatter for this handler.
-
setLevel
(level)¶ Set the logging level of this handler.
-
set_name
(name)¶
-
Kraken has a simple plug-in mechanism that allows anyone to integrate Kraken intoa a 3D DCC by simply sub-classing a few classes and writing the appropriate python code to build the specific objects.
The Maya Kraken plug-in.
This builder class is simply a sub-class of the base Kraken Builder class that re-implements each method as needed for creating the specified objects in Maya.
See also
Usage Documentation
This synchronizer class is simply a sub-class of the base Kraken Synchronizer class that re-implements each method as needed for creating the specified objects in Maya.
See also
Usage Documentation
This module hosts a method used to retrieve a pointer to the Fabric client within the DCC. Specific commands for the DCC are called to retrieve information such as the contextID.
Usage Documentation
-
getClient
()¶ Gets the Fabric client from the DCC. This ensures that the same client is used, instead of a new one being created each time one is requiredself.
Returns: Fabric Client.
This module hosts a class that remaps the standard logging calls to the DCC specific calls for reporting messages, warnings, and errors.
Usage Documentation
-
class
DCCHandler
(level=0)¶ Bases:
logging.Handler
Logging Handler for Maya.
-
emit
(record)¶ Maps the logger calls to call the specific Maya logging calls so the messages appear in the DCC as well.
Note
- Calls to these Maya specific methods are executed:
- om.MGlobal.displayError
- om.MGlobal.displayWarning
- om.MGlobal.displayInfo
-
The Maya Kraken plug-in utils.
Usage Documentation
-
curveToKraken
() Converts a curve in Maya to a valid definition for Kraken.
Parameters: curve (object) – Maya nurbs curve Object. Returns: The curve definition in kraken format. Return type: list
The Softimage Kraken plug-in.
This builder class is simply a sub-class of the base Kraken Builder class that re-implements each method as needed for creating the specified objects in Softimage.
See also
Usage Documentation
This synchronizer class is simply a sub-class of the base Kraken Synchronizer class that re-implements each method as needed for creating the specified objects in Softimage.
See also
Usage Documentation
This module hosts a method used to retrieve a pointer to the Fabric client within the DCC. Specific commands for the DCC are called to retrieve information such as the contextID.
Usage Documentation
-
getClient
()¶ Gets the Fabric client from the DCC. This ensures that the same client is used, instead of a new one being created each time one is requiredself.
Returns: Fabric Client.
This module hosts a class that remaps the standard logging calls to the DCC specific calls for reporting messages, warnings, and errors.
Usage Documentation
-
class
DCCHandler
(level=0)¶ Bases:
logging.Handler
Logging Handler for Softimage.
-
emit
(record)¶ Maps the logger calls to call the specific Maya logging calls so the messages appear in the DCC as well.
Note
- Calls to these Softimage specific methods are executed:
- Application.LogMessage
-
The Softimage Kraken plug-in utils.
Usage Documentation
-
curveToKraken
()¶ Converts a curve in Softimage to a valid definition for Kraken.
Parameters: curve (object) – Softimage nurbs curve Object. Returns: The curve definition in kraken format. Return type: list
Kraken Softimage Plug-in.
-
dccTest
()¶ Returns true or false after checking if the KRAKEN_DCC environment variable is set to use this plugin.
Note
The variable value to activate the Softimage plugin is: Softimage.
Returns: True if the environment variable is set to use this plugin. Return type: bool
The Canvas Kraken plug-in.
This builder class is simply a sub-class of the base Kraken Builder class that re-implements each method as needed for creating the specified objects in Canvas.
See also
Usage Documentation
This module hosts a method used to retrieve a pointer to the Fabric client within the DCC. Specific commands for the DCC are called to retrieve information such as the contextID.
Usage Documentation
-
getClient
()¶ Gets the Fabric client from the DCC. This ensures that the same client is used, instead of a new one being created each time one is requiredself.
Returns: Fabric Client.
The Canvas Graph Manager.
-
class
GraphManager
¶ Bases:
object
Manager object for taking care of all low level Canvas tasks
-
__init__
()¶
-
setTitle
(title)¶
-
getUniqueTitle
(path, title)¶
-
addExtDep
(extDep)¶
-
hasNode
(path, title=None)¶
-
hasNodeSI
(kSceneItem, title=None)¶
-
getNode
(path, title=None)¶
-
getNodeSI
(kSceneItem, title=None)¶
-
getNodeAndPort
(path, asInput=True)¶
-
getNodeAndPortSI
(kSceneItem, asInput=True)¶
-
setNodeAndPort
(path, node, port, asInput=False)¶
-
setNodeAndPortSI
(kSceneItem, node, port, asInput=False)¶
-
getExec
()¶
-
getSubExec
(node)¶
-
hasArgument
(name)¶
-
getOrCreateArgument
(name, dataType=None, defaultValue=None, portType='In')¶
-
removeArgument
(name)¶
-
createNodeFromPreset
(path, preset, title=None, **metaData)¶
-
createNodeFromPresetSI
(kSceneItem, preset, title=None, **metaData)¶
-
createFunctionNode
(path, title, **metaData)¶
-
createFunctionNodeSI
(kSceneItem, title, **metaData)¶
-
createVariableNode
(path, title, dataType, extension='', **metaData)¶
-
createVariableNodeSI
(kSceneItem, title, dataType, extension='', **metaData)¶
-
removeNode
(path, title=None)¶
-
removeNodeSI
(kSceneItem, title=None)¶
-
connectNodes
(nodeA, portA, nodeB, portB)¶
-
connectArg
(argA, argB, argC)¶
-
replaceConnections
(oldNode, oldPort, newNode, newPort)¶
-
removeConnection
(node, port)¶
-
getConnections
(node, port, targets=True)¶
-
getNodeMetaData
(path, key, defaultValue=None, title=None)¶
-
getNodeMetaDataSI
(kSceneItem, key, defaultValue=None, title=None)¶
-
setNodeMetaData
(path, key, value, title=None)¶
-
setNodeMetaDataSI
(kSceneItem, key, value, title=None)¶
-
setNodeMetaDataFromDict
(node, metaData)¶
-
computeCurrentPortValue
(node, port)¶
-
computeCurrentPortValueSI
(kSceneItem)¶
-
setPortDefaultValue
(node, port, value)¶
-
getNodePortResolvedType
(node, port)¶
-
getCurrentGroup
()¶
-
getAllGroupNames
()¶
-
getNodesInGroup
(group)¶
-
setCurrentGroup
(group)¶
-
getAllNodeNames
()¶
-
getNodeConnections
(nodeName)¶
-
_GraphManager__addNodeToGroup
(node)¶
-
_GraphManager__dfgArgs
= None¶
-
_GraphManager__dfgBinding
= None¶
-
_GraphManager__dfgConnections
= None¶
-
_GraphManager__dfgCurrentGroup
= None¶
-
_GraphManager__dfgExec
= None¶
-
_GraphManager__dfgGroupNames
= None¶
-
_GraphManager__dfgGroups
= None¶
-
_GraphManager__dfgHost
= None¶
-
_GraphManager__dfgNodeAndPortMap
= None¶
-
_GraphManager__dfgNodes
= None¶
-
getAllNodeConnections
()¶
-
getNumPorts
(node)¶
-
hasInputConnections
(node)¶
-
hasOutputConnections
(node)¶
-
getPortIndex
(node, port)¶
-
getMinConnectionPortIndex
(sourceNode, targetNode)¶
-
getAllNodePortIndices
()¶
-
getAllInputConnections
()¶
-
implodeNodesByGroup
()¶
-
saveToFile
(filePath)¶
-
The Canvas Graph Manager.
Kraken Canvas - Hash module.
-
makeHash
(o)¶ Makes a hash from a dictionary, list, tuple or set to any level, that contains only other hashable types (including any lists, tuples, sets, and dictionaries).
Parameters: o (object) – Object to hash. Returns: Hash of the object. Return type: hash
This synchronizer class is simply a sub-class of the base Kraken Synchronizer class that re-implements each method as needed for creating the specified objects in Maya.
See also
Usage Documentation
This module hosts a class that remaps the standard logging calls to the DCC specific calls for reporting messages, warnings, and errors.
Usage Documentation
-
class
DCCHandler
(*args, **kwargs)¶ Bases:
logging.StreamHandler
Logging Handler for Canvas.
-
__init__
(*args, **kwargs)¶
-
Kraken Canvas Plug-in.
-
dccTest
()¶ Returns true or false after checking if the KRAKEN_DCC environment variable is set to use this plugin.
Note
The variable value to activate the Canvas plugin is: Canvas.
Returns: True if the environment variable is set to use this plugin. Return type: bool
The KL Kraken plug-in.
This builder class is simply a sub-class of the base Kraken Builder class that re-implements each method as needed for creating the specified objects in KL.
See also
Usage Documentation
This module hosts a method used to retrieve a pointer to the Fabric client within the DCC. Specific commands for the DCC are called to retrieve information such as the contextID.
Usage Documentation
-
getClient
()¶ Gets the Fabric client from the DCC. This ensures that the same client is used, instead of a new one being created each time one is requiredself.
Returns: Fabric Client.
This synchronizer class is simply a sub-class of the base Kraken Synchronizer class that re-implements each method as needed for creating the specified objects in Maya.
See also
Usage Documentation
This module hosts a class that remaps the standard logging calls to the DCC specific calls for reporting messages, warnings, and errors.
Usage Documentation
-
class
DCCHandler
(stream=None)¶ Bases:
logging.StreamHandler
Logging Handler for KL.
-
__init__
(stream=None)¶
-
emit
(record)¶
-