Blender V4.3
blender::animrig::Slot Class Reference

#include <ANIM_action.hh>

Inherits ActionSlot.

Public Types

enum class  Flags : uint8_t { Expanded = (1 << 0) , Selected = (1 << 1) , Active = (1 << 2) }
 

Public Member Functions

 Slot ()
 
 Slot (const Slot &other)
 
 ~Slot ()
 
void blend_read_post ()
 
std::string name_prefix_for_idtype () const
 
StringRefNull name_without_prefix () const
 
bool is_suitable_for (const ID &animated_id) const
 
bool has_idtype () const
 
Flags flags () const
 
bool is_expanded () const
 
void set_expanded (bool expanded)
 
bool is_selected () const
 
void set_selected (bool selected)
 
bool is_active () const
 
Span< ID * > users (Main &bmain) const
 
Vector< ID * > runtime_users ()
 
void users_add (ID &animated_id)
 
void users_remove (ID &animated_id)
 

Static Public Member Functions

static void users_invalidate (Main &bmain)
 

Static Public Attributes

static constexpr slot_handle_t unassigned = 0
 
static constexpr int name_length_min = 3
 
static constexpr int name_length_max = MAX_ID_NAME
 

Protected Member Functions

void name_ensure_prefix ()
 
void set_active (bool active)
 

Protected Attributes

friend Action
 

Additional Inherited Members

- Public Attributes inherited from ActionSlot
char name [66]
 
uint8_t _pad0 [2]
 
int idtype
 
int32_t handle
 
int8_t slot_flags
 
uint8_t _pad1 [3]
 
ActionSlotRuntimeHandleruntime
 

Detailed Description

Identifier for a sub-set of the animation data inside an Action.

An animatable ID specifies both an Action* and an ActionSlot::handle to identify which F-Curves (and in the future other animation data) it will be animated by.

This is called a 'slot' because it binds the animatable ID to the sub-set of animation data that should animate it.

See also
AnimData::slot_handle

Definition at line 605 of file ANIM_action.hh.

Member Enumeration Documentation

◆ Flags

Enumerator
Expanded 

Expanded/collapsed in animation editors.

Selected 

Selected in animation editors.

Active 

The active Slot for this Action. Set via a method on the Action.

Definition at line 655 of file ANIM_action.hh.

Constructor & Destructor Documentation

◆ Slot() [1/2]

blender::animrig::Slot::Slot ( )

Definition at line 982 of file animrig/intern/action.cc.

References ActionSlot::runtime.

◆ Slot() [2/2]

blender::animrig::Slot::Slot ( const Slot & other)
explicit

Definition at line 988 of file animrig/intern/action.cc.

References ActionSlot::runtime.

◆ ~Slot()

blender::animrig::Slot::~Slot ( )

Definition at line 994 of file animrig/intern/action.cc.

References ActionSlot::runtime.

Member Function Documentation

◆ blend_read_post()

void blender::animrig::Slot::blend_read_post ( )

Update the Slot after reading it from a blend file.

This is a low-level function and should not typically be used. It's only here to let blenkernel allocate the runtime struct when reading a Slot from disk, without having to share the struct definition itself.

Definition at line 999 of file animrig/intern/action.cc.

References BLI_assert, and ActionSlot::runtime.

◆ flags()

Slot::Flags blender::animrig::Slot::flags ( ) const

Definition at line 1022 of file animrig/intern/action.cc.

References ActionSlot::slot_flags.

◆ has_idtype()

bool blender::animrig::Slot::has_idtype ( ) const

◆ is_active()

bool blender::animrig::Slot::is_active ( ) const

◆ is_expanded()

bool blender::animrig::Slot::is_expanded ( ) const

Definition at line 1026 of file animrig/intern/action.cc.

References Expanded, and ActionSlot::slot_flags.

Referenced by animfilter_action_slot().

◆ is_selected()

bool blender::animrig::Slot::is_selected ( ) const

◆ is_suitable_for()

bool blender::animrig::Slot::is_suitable_for ( const ID & animated_id) const

◆ name_ensure_prefix()

void blender::animrig::Slot::name_ensure_prefix ( )
protected

Ensure the first two characters of the name match the ID type.

Note
This does NOT ensure name uniqueness within the Action. That is the responsibility of the caller.

Definition at line 1129 of file animrig/intern/action.cc.

References BLI_assert, has_idtype(), ActionSlot::idtype, ActionSlot::name, name_length_min, and size().

◆ name_prefix_for_idtype()

std::string blender::animrig::Slot::name_prefix_for_idtype ( ) const

Return the name prefix for the Slot's type.

This is the ID name prefix, so "OB" for objects, "CA" for cameras, etc.

Definition at line 1107 of file animrig/intern/action.cc.

References has_idtype(), ActionSlot::idtype, and ActionSlot::name.

Referenced by blender::animrig::tests::TEST_F(), and version_legacy_actions_to_layered().

◆ name_without_prefix()

StringRefNull blender::animrig::Slot::name_without_prefix ( ) const

Return the name without the prefix, also known as the "display name".

See also
name_prefix_for_idtype

Definition at line 1118 of file animrig/intern/action.cc.

References BLI_assert, name_length_min, and size().

Referenced by version_legacy_actions_to_layered().

◆ runtime_users()

Vector< ID * > blender::animrig::Slot::runtime_users ( )

Directly return the runtime users vector.

This function does not refresh the users cache, so it may be out of date.

This is a low-level function, and should only be used when calling users(bmain) is not appropriate.

See also
#Slot::users(Main &bmain)

Definition at line 1077 of file animrig/intern/action.cc.

References BLI_assert_msg, and ActionSlot::runtime.

Referenced by blender::animrig::nla::tests::TEST_F(), blender::animrig::nla::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ set_active()

void blender::animrig::Slot::set_active ( bool active)
protected

Set the 'Active' flag. Only allowed to be called by Action.

Definition at line 1058 of file animrig/intern/action.cc.

References Active, and ActionSlot::slot_flags.

Referenced by blender::animrig::Action::slot_active_set().

◆ set_expanded()

void blender::animrig::Slot::set_expanded ( bool expanded)

Definition at line 1030 of file animrig/intern/action.cc.

References Expanded, and ActionSlot::slot_flags.

Referenced by blender::animrig::tests::TEST_F().

◆ set_selected()

void blender::animrig::Slot::set_selected ( bool selected)

◆ users()

◆ users_add()

void blender::animrig::Slot::users_add ( ID & animated_id)

Register this ID as animated by this Slot.

This is a low-level function and should not typically be used. Use #Action::assign_id(slot, animated_id) instead.

Definition at line 1083 of file animrig/intern/action.cc.

References BLI_assert, and ActionSlot::runtime.

Referenced by BKE_nla_tweakmode_exit(), and blender::animrig::generic_assign_action_slot().

◆ users_invalidate()

void blender::animrig::Slot::users_invalidate ( Main & bmain)
static

Mark the users cache as 'dirty', triggering a full rebuild next time it is accessed.

This is typically not necessary, and only called from low-level code.

Note
This static method invalidates all user caches of all Action Slots.
See also
blender::animrig::internal::rebuild_slot_user_cache()

Definition at line 1102 of file animrig/intern/action.cc.

References Main::is_action_slot_to_id_map_dirty.

Referenced by blender::bke::action_foreach_id(), and BKE_animdata_copy_in_lib().

◆ users_remove()

void blender::animrig::Slot::users_remove ( ID & animated_id)

Register this ID as no longer animated by this Slot.

This is a low-level function and should not typically be used. Use #Action::assign_id(nullptr, animated_id) instead.

Definition at line 1089 of file animrig/intern/action.cc.

References BLI_assert, blender::Vector< T, InlineBufferCapacity, Allocator >::first_index_of_try(), ActionSlot::runtime, and users.

Referenced by blender::animrig::generic_assign_action_slot().

Member Data Documentation

◆ Action

friend blender::animrig::Slot::Action
protected

Definition at line 715 of file ANIM_action.hh.

◆ name_length_max

int blender::animrig::Slot::name_length_max = MAX_ID_NAME
staticconstexpr

Definition at line 630 of file ANIM_action.hh.

Referenced by blender::animrig::generic_assign_action_slot().

◆ name_length_min

int blender::animrig::Slot::name_length_min = 3
staticconstexpr

Slot names consist of a two-character ID code, then the display name. This means that the minimum length of a valid name is 3 characters.

Definition at line 628 of file ANIM_action.hh.

Referenced by name_ensure_prefix(), name_without_prefix(), and blender::animrig::Action::slot_name_define().

◆ unassigned


The documentation for this class was generated from the following files: