Go to: Synopsis. Return value. Related. Flags. Python examples.

Synopsis

keyingGroup( objects , [activator=string], [addElement=name], [afterFilters=boolean], [category=string], [clear=name], [color=int], [copy=name], [edges=boolean], [editPoints=boolean], [empty=boolean], [excludeDynamic=boolean], [excludeRotate=boolean], [excludeScale=boolean], [excludeTranslate=boolean], [excludeVisibility=boolean], [facets=boolean], [flatten=name], [forceElement=name], [include=name], [intersection=name], [isIntersecting=name], [isMember=name], [layer=boolean], [minimizeRotation=boolean], [name=string], [noSurfaceShader=boolean], [noWarnings=boolean], [nodesOnly=boolean], [remove=name], [removeActivator=string], [renderable=boolean], [setActiveFilter=string], [size=boolean], [split=name], [subtract=name], [text=string], [union=name], [vertices=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

keyingGroup is undoable, queryable, and editable.

This command is used to manage the membership of a keying group. Keying groups allow users to effectively manage related keyframe data, allowing keys on attributes in the keying group to be set and edited as a single entity.

Return value

stringFor creation operations (name of the keying group that was created or edited)
string[]For query operation (names of items in the keying group)
booleanFor isMember operation

In query mode, return type is based on queried flag.

Related

sets

Flags

activator, addElement, afterFilters, category, clear, color, copy, edges, editPoints, empty, excludeDynamic, excludeRotate, excludeScale, excludeTranslate, excludeVisibility, facets, flatten, forceElement, include, intersection, isIntersecting, isMember, layer, minimizeRotation, name, noSurfaceShader, noWarnings, nodesOnly, remove, removeActivator, renderable, setActiveFilter, size, split, subtract, text, union, vertices
Long name (short name) Argument types Properties
name(n) string create
Assigns string as the name for a new set. This flag is only valid for operations that create a new set.
text(t) string createqueryedit
Defines an annotation string to be stored with the set.
empty(em) boolean create
Indicates that the set to be created should be empty. That is, it ignores any arguments identifying objects to be added to the set. This flag is only valid for operations that create a new set.
color(co) int createqueryedit
Defines the hilite color of the set. Must be a value in range [-1, 7] (one of the user defined colors). -1 marks the color has being undefined and therefore not having any affect. Only the vertices of a vertex set will be displayed in this color.
layer(l) boolean create
OBSOLETE. DO NOT USE.
vertices(v) boolean createquery
Indicates the new set can contain vertices only. This flag is for use in creation or query mode only. The default value is false.
edges(eg) boolean createquery
Indicates the new set can contain edges only. This flag is for use in creation or query mode only. The default value is false.
facets(fc) boolean createquery
Indicates the new set can contain facets only. This flag is for use in creation or query mode only. The default value is false.
editPoints(ep) boolean createquery
Indicates the new set can contain editPoints only. This flag is for use in creation or query mode only. The default value is false.
renderable(r) boolean createquery
This flag indicates that a special type of set should be created. This type of set (shadingEngine as opposed to objectSet) has certain restrictions on its membership in that it can only contain renderable elements such as lights and geometry. These sets are referred to as shading groups and are automatically connected to the "renderPartition" node when created (to ensure mutual exclusivity of the set's members with the other sets in the partition). This flag is for use in creation or query mode only. The default value is false which means a normal set is created.
noSurfaceShader(nss) boolean create
If set is renderable, do not connect it to the default surface shader. Flag has no meaning or effect for non renderable sets. This flag is for use in creation mode only. The default value is false.
copy(cp) name create
Copies the members of the given set to a new set. This flag is for use in creation mode only.
size(s) boolean query
Use the size flag to query the length of the set.
subtract(sub) name create
An operation between two sets which returns the members of the first set that are not in the second set.
union(un) name create
An operation that returns a list of all the members of all sets listed.
intersection(int) name create
An operation that returns a list of items which are members of all the sets in the list.
clear(cl) name edit
An operation which removes all items from the given set making the set empty.
flatten(fl) name edit
An operation that flattens the structure of the given set. That is, any sets contained by the given set will be replaced by its members so that the set no longer contains other sets but contains the other sets' members.
nodesOnly(no) boolean query
This flag is usable with the -q/query flag but is ignored if used with another queryable flags. This flag modifies the results of the set membership query such that when there are attributes (e.g. sphere1.tx) or components of nodes included in the set, only the nodes will be listed. Each node will only be listed once, even if more than one attribute or component of the node exists in the set.
isIntersecting(ii) name create
An operation which tests whether the sets in the list have common members.
isMember(im) name create
An operation which tests whether all the given items are members of the given set.
split(sp) name create
Produces a new set with the list of items and removes each item in the list of items from the given set.
noWarnings(nw) boolean create
Indicates that warning messages should not be reported such as when trying to add an invalid item to a set. (used by UI)
addElement(add) name edit
Adds the list of items to the given set. If some of the items cannot be added to the set because they are in another set which is in the same partition as the set to edit, the command will fail.
include(include) name edit
Adds the list of items to the given set. If some of the items cannot be added to the set, a warning will be issued. This is a less strict version of the -add/addElement operation.
remove(rm) name edit
Removes the list of items from the given set.
forceElement(fe) name edit
For use in edit mode only. Forces addition of the items to the set. If the items are in another set which is in the same partition as the given set, the items will be removed from the other set in order to keep the sets in the partition mutually exclusive with respect to membership.
afterFilters(af) boolean edit
Default state is false. This flag is valid in edit mode only. This flag is for use on sets that are acted on by deformers such as sculpt, lattice, blendShape. The default edit mode is to edit the membership of the group acted on by the deformer. If you want to edit the group but not change the membership of the deformer, set the flag to true.
excludeTranslate(et) boolean create
When creating the keying group, exclude translate attributes from transform-type nodes. For example, if your keying group contains joints only, perhaps you only want to include rotations in the keying group.
excludeRotate(er) boolean create
When creating the keying group, exclude rotate attributes from transform-type nodes.
excludeScale(es) boolean create
When creating the keying group, exclude scale attributes from transform-type nodes.
excludeVisibility(ev) boolean create
When creating the keying group, exclude visibility attribute from transform-type nodes.
excludeDynamic(ed) boolean create
When creating the keying group, exclude dynamic attributes.
activator(act) string queryedit
Sets the selected node(s) as activators for the given keying group. In query mode, returns list of objects that activate the given keying group
removeActivator(rac) string edit
Removes the selected node(s) as activators for the given keying group.
setActiveFilter(fil) string createqueryedit
Sets the global, active keying group filter, which will affect activation of keying groups. Only keying groups with categories that match the filter will be activated. If the setActiveFilter is set to "NoKeyingGroups", keying groups will not be activated at all. If the setActiveFilter is set to "AllKeyingGroups", we will activate any keying group rather than just those with matching categories.
category(cat) string createqueryedit
Sets the keying group's category. This is what the global, active keying group filter will use to match.
minimizeRotation(mr) boolean createqueryedit
This flag only affects the attribute contained in the immediate keyingGroup. It does not affect attributes in sub-keyingGroups. Those will need to set minimizeRotation on their respective keyingGroups

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

import maya.cmds as cmds

cmds.file(f=1, new=1)

# Create a keying group with keyable attrs of the currently selected
# object
#
cmds.polySphere(n='sphere1')
sphereKG = cmds.keyingGroup(n='sphereKG')

# Query the members: should return sphere1's visiblity and TRS
members = cmds.keyingGroup(sphereKG, q=True)

# Create a keying group which contains another keying group
parentKG = cmds.keyingGroup(sphereKG, n='parentKG')

# keying the parent KG should automatically key the sub KGs as well
cmds.select(parentKG)
cmds.setKeyframe(time=1)

# Add 2 other spheres to the sphereKG
cmds.polySphere(n='sphere2');
cmds.polySphere(n='sphere3');
cmds.keyingGroup('sphere2', 'sphere3', e=True, add=sphereKG)

# Make another object the activator for the sphereKG. So if
# this object is keyed, the sphereKG will be keyed
# Note: the activator itself does not have to be part of the
# keying group. If it is not part of the keyingGroup, it
# will not be keyed. So only the spheres will be keyed below.
# If the cube is to be keyed as well, execute:
# cmds.keyingGroup('cube1',e=True, add=sphereKG)
cmds.polyCube(n='cube1')
cmds.keyingGroup('cube1',e=True,activator=sphereKG)
cmds.select('cube1')
cmds.setKeyframe(t=10)