blender/release/scripts/keyingsets/keyingsets_builtins.py
Joshua Leung 4ae515a4e5 Keying Sets: BuiltIn vs Absolute Tweaks
This commit clarifies the somewhat "murky" separation between "builtin" and "absolute" KeyingSets as a result of discussions with Cessen.

* "Builtin" Keying Sets are now just the Keying Sets which in the past have been known as PyKeyingSets or Relative KeyingSets. These are registered from Py Scripts at startup, and will use the context info to determine what data they should be keyframing. These are stored per Blender session, independent of files, since usually these will be coded specific to sets of rigs used at a studio.

* "Absolute" Keying Sets are the ones that you can create from the Scene buttons and/or KKEY or RMB over any property. They specify the exact set of properties which should always get keyframed together. These are stored in the scene. 

In relation to this, I've made it possible to now set one of the builtin Keying Set types as the active Keying Set. 
* For now, this can only be done via the box beside the insert/delete key operator buttons on the TimeLine header (now complete with an recycled icon - HINT TO ICON DESIGNERS, to make this a bit more obvious). Later on I'll commit an operator to set this via a hotkey.
* The "IKEY" menu will only show up when there is no active Keying Set. When there is one, keying will happen silently (with info notice at the top of the screen). Later on, I'll hook this menu up to a hotkey, so that that active Keying Set can be changed without inserting keyframes or clearing active Keying Set...
* By default, there isn't any default Keying Set enabled. IMO, this is probably a good default, though some might like to have LocRotScale instead.
* I'm not terribly impressed with the search menu for the items being SORTED (and of all things, alphabetically!) currently, since this does break muscle-memory with the menu (and jumbles up order of closely related vs not closely related).
* The Scene buttons for KeyingSets still need some changes to fully cope with users setting builtin KeyingSets as active sometimes. Controls which are useless or shouldn't be used when a builtin set is shown are being shown.

Builtin set registrations have been tweaked a bit:
* Renamed "bl_idname" to "bl_label" for consistency with rest of API. Note that this is the identifier used by Blender internally when searching for the KeyingSet, and is also what the user sees.
2010-03-23 11:59:34 +00:00

226 lines
5.5 KiB
Python

# Built-In Keying Sets
# None of these Keying Sets should be removed, as these
# are needed by various parts of Blender in order for them
# to work correctly.
import bpy
from keyingsets_utils import *
###############################
# Built-In KeyingSets
# Location
class BUILTIN_KSI_Location(bpy.types.KeyingSetInfo):
bl_label = "Location"
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
generate = RKS_GEN_location
# Rotation
class BUILTIN_KSI_Rotation(bpy.types.KeyingSetInfo):
bl_label = "Rotation"
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
generate = RKS_GEN_rotation
# Scale
class BUILTIN_KSI_Scaling(bpy.types.KeyingSetInfo):
bl_label = "Scaling"
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
generate = RKS_GEN_scaling
# ------------
# LocRot
class BUILTIN_KSI_LocRot(bpy.types.KeyingSetInfo):
bl_label = "LocRot"
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
def generate(self, context, ks, data):
# location
RKS_GEN_location(self, context, ks, data)
# rotation
RKS_GEN_rotation(self, context, ks, data)
# LocScale
class BUILTIN_KSI_LocScale(bpy.types.KeyingSetInfo):
bl_label = "LocScale"
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
def generate(self, context, ks, data):
# location
RKS_GEN_location(self, context, ks, data)
# scale
RKS_GEN_scaling(self, context, ks, data)
# LocRotScale
class BUILTIN_KSI_LocRotScale(bpy.types.KeyingSetInfo):
bl_label = "LocRotScale"
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
def generate(self, context, ks, data):
# location
RKS_GEN_location(self, context, ks, data)
# rotation
RKS_GEN_rotation(self, context, ks, data)
# scale
RKS_GEN_scaling(self, context, ks, data)
# RotScale
class BUILTIN_KSI_RotScale(bpy.types.KeyingSetInfo):
bl_label = "RotScale"
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
def generate(self, context, ks, data):
# rotation
RKS_GEN_rotation(self, context, ks, data)
# scaling
RKS_GEN_scaling(self, context, ks, data)
# ------------
# Location
class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo):
bl_label = "Visual Location"
insertkey_visual = True
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
generate = RKS_GEN_location
# Rotation
class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo):
bl_label = "Visual Rotation"
insertkey_visual = True
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
generate = RKS_GEN_rotation
# VisualLocRot
class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo):
bl_label = "Visual LocRot"
insertkey_visual = True
# poll - use predefined callback for selected bones/objects
poll = RKS_POLL_selected_items
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
def generate(self, context, ks, data):
# location
RKS_GEN_location(self, context, ks, data)
# rotation
RKS_GEN_rotation(self, context, ks, data)
# ------------
# Available
class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo):
bl_label = "Available"
# poll - use predefined callback for selected objects
# TODO: this should really check whether the selected object (or datablock)
# has any animation data defined yet
poll = RKS_POLL_selected_objects
# iterator - use callback for selected bones/objects
iterator = RKS_ITER_selected_item
# generator - use callback for location
generate = RKS_GEN_available
###############################
classes = [
BUILTIN_KSI_Location,
BUILTIN_KSI_Rotation,
BUILTIN_KSI_Scaling,
BUILTIN_KSI_LocRot,
BUILTIN_KSI_LocScale,
BUILTIN_KSI_LocRotScale,
BUILTIN_KSI_RotScale,
BUILTIN_KSI_VisualLoc,
BUILTIN_KSI_VisualRot,
BUILTIN_KSI_VisualLocRot,
BUILTIN_KSI_Available,
]
def register():
register = bpy.types.register
for cls in classes:
register(cls)
def unregister():
unregister = bpy.types.unregister
for cls in classes:
unregister(cls)
if __name__ == "__main__":
register()
###############################