Blender V5.3
blender::ed::animrig Namespace Reference

Classes

struct  DegComponentIdentifier
struct  PasteFCurve
struct  PathValue
struct  TransformableRelations
struct  TransformFCurves

Typedefs

using ClipboardData = Map<StringRefNull, Array<FCurve *>>
using PasteMap = Map<AnimTransformable *, StringRefNull>

Enumerations

enum  AssetModifyMode { MODIFY_ADJUST = 0 , MODIFY_REPLACE , MODIFY_ADD , MODIFY_REMOVE }
enum class  AnimationPasteOffset { NONE , CURRENT_FRAME }

Functions

static const EnumPropertyItem * rna_asset_library_reference_itemf (bContext *, PointerRNA *, PropertyRNA *, bool *r_free)
static Vector< RNAPath > construct_pose_rna_paths (const PointerRNA &bone_pointer)
static blender::animrig::Action & extract_pose (Main &bmain, const Span< Object * > pose_objects)
static void ensure_asset_ui_visible (bContext &C)
static Vector< Object * > get_selected_pose_objects (bContext *C)
static wmOperatorStatus create_pose_asset_local (bContext *C, wmOperator *op, const StringRefNull name, const AssetLibraryReference lib_ref)
static wmOperatorStatus create_pose_asset_user_library (bContext *C, wmOperator *op, const char name[MAX_NAME], const AssetLibraryReference lib_ref)
static wmOperatorStatus pose_asset_create_exec (bContext *C, wmOperator *op)
static wmOperatorStatus pose_asset_create_invoke (bContext *C, wmOperator *op, const wmEvent *)
static bool pose_asset_create_poll (bContext *C)
static void visit_library_prop_catalogs_catalog_for_search_fn (const bContext *C, PointerRNA *ptr, PropertyRNA *, const char *edit_text, FunctionRef< void(StringPropertySearchVisitParams)> visit_fn)
static bAction * get_action_of_selected_asset (bContext *C)
static bool is_pose_asset_blend_editable (const bAction &action, ReportList *reports)
static bool pose_asset_potentially_editable_poll (bContext *C)
static Vector< PathValue > generate_path_values (Object &pose_object)
static void replace_pose_key (Main &bmain, blender::animrig::StripKeyframeData &strip_data, const blender::animrig::Slot &slot, const float2 time_value, const blender::animrig::FCurveDescriptor &fcurve_descriptor)
static void update_pose_action_from_scene (Main *bmain, blender::animrig::Action &pose_action, Object &pose_object, const AssetModifyMode mode)
static wmOperatorStatus pose_asset_modify_exec (bContext *C, wmOperator *op)
static bool pose_asset_modify_poll (bContext *C)
static std::string pose_asset_modify_description (bContext *, wmOperatorType *, PointerRNA *ptr)
static wmOperatorStatus pose_asset_delete_exec (bContext *C, wmOperator *op)
static wmOperatorStatus pose_asset_delete_invoke (bContext *C, wmOperator *op, const wmEvent *)
static void matrix_to_fcurves (const float4x4 &matrix, Span< FCurve * > fcurves, const int frame, const int key_index)
static float4x4 fcurves_to_matrix (const Span< const FCurve * > fcurves, const int key_index)
static Vector< ID * > get_unique_ids (const Span< AnimTransformable * > transformables)
static Vector< ID * > get_unique_ids (const Span< AnimTransformable > transformables)
static DegComponentIdentifier transformable_to_deg_identifier (const AnimTransformable &transformable)
static Array< TransformableRelations > build_transformable_relations (const Depsgraph *depsgraph, const MutableSpan< AnimTransformable * > transformables)
static Vector< AnimTransformable * > depsgraph_sorted_transformables (const Depsgraph *depsgraph, const MutableSpan< AnimTransformable * > transformables)
static void ensure_baked_fcurves (Main &bmain, const AnimTransformable &transformable, MutableSpan< PasteFCurve > fcus, blender::animrig::Channelbag &channelbag, const StringRefNull rna_path, const Bounds< int > range)
static bool is_fcurve_flat (FCurve &fcurve)
static void clean_baked_fcurves (AnimTransformable &transformable, AnimTransformable::PropertyType property_type, MutableSpan< PasteFCurve > fcurves, blender::animrig::Channelbag &channelbag)
static void recalculate_handles (MutableSpan< PasteFCurve > fcurves)
static Rotation set_keys_to_transform (TransformFCurves &t_fcus, const float4x4 &matrix, const Rotation &reference_rotation, const int paste_index)
Pose Asset Operators
void POSELIB_OT_create_pose_asset (wmOperatorType *ot)
void POSELIB_OT_asset_modify (wmOperatorType *ot)
void POSELIB_OT_asset_delete (wmOperatorType *ot)
void POSELIB_OT_screenshot_preview (wmOperatorType *ot)
World Space Copy Paste
void ANIM_OT_world_space_copy (wmOperatorType *ot)
void ANIM_OT_world_space_paste (wmOperatorType *ot)
Main Functions
static void copy_world_space (Main &bmain, Scene &scene, ViewLayer &view_layer, ReportList &reports, const Span< AnimTransformable > transformables, const Bounds< int > range)
static PasteMap generate_paste_mapping (const MutableSpan< AnimTransformable > transformables, const ClipboardData &clipboard_data)
static Array< TransformFCurves > build_fcurves_for_paste (Main &bmain, const Span< AnimTransformable * > transformables, const Bounds< int > range)
static bAction * read_action_from_clipboard (Main &clipboard_bmain, ReportList &reports)
static void paste_world_space (Main &bmain, Scene &scene, ViewLayer &view_layer, ReportList &reports, bAction &clipboard_dna_action, const MutableSpan< AnimTransformable > transformables, const AnimationPasteOffset offset)

Variables

static const EnumPropertyItem prop_asset_overwrite_modes []
constexpr const char * clipboard_name = "world_space_buffer.blend"

Operators

enum class  CopyRange : uint8_t { CUSTOM , PLAYBACK_RANGE }
const EnumPropertyItem rna_enum_copy_range_items []
const EnumPropertyItem rna_enum_animation_paste_offset_items []
static wmOperatorStatus world_space_copy_exec (bContext *C, wmOperator *op)
static bool world_space_copy_poll (bContext *C)
static bool has_constraints (const Span< AnimTransformable > transformables)
static wmOperatorStatus world_space_paste_exec (bContext *C, wmOperator *op)
static bool world_space_paste_poll (bContext *C)

Typedef Documentation

◆ ClipboardData

◆ PasteMap

Enumeration Type Documentation

◆ AnimationPasteOffset

Enumerator
NONE 

Paste data to the same frames it was copied from.

CURRENT_FRAME 

Paste keys starting at current frame.

Definition at line 112 of file world_space_copy.cc.

◆ AssetModifyMode

Enumerator
MODIFY_ADJUST 
MODIFY_REPLACE 
MODIFY_ADD 
MODIFY_REMOVE 

Definition at line 475 of file anim_asset_ops.cc.

◆ CopyRange

Enumerator
CUSTOM 
PLAYBACK_RANGE 

Definition at line 847 of file world_space_copy.cc.

Function Documentation

◆ ANIM_OT_world_space_copy()

◆ ANIM_OT_world_space_paste()

◆ build_fcurves_for_paste()

◆ build_transformable_relations()

◆ clean_baked_fcurves()

◆ construct_pose_rna_paths()

◆ copy_world_space()

void blender::ed::animrig::copy_world_space ( Main & bmain,
Scene & scene,
ViewLayer & view_layer,
ReportList & reports,
const Span< AnimTransformable > transformables,
const Bounds< int > range )
static

◆ create_pose_asset_local()

◆ create_pose_asset_user_library()

wmOperatorStatus blender::ed::animrig::create_pose_asset_user_library ( bContext * C,
wmOperator * op,
const char name[MAX_NAME],
const AssetLibraryReference lib_ref )
static

Definition at line 305 of file anim_asset_ops.cc.

References blender::AS_asset_library_load(), blender::ID::asset_data, blender::bke::asset_edit_id_save_as(), blender::ASSET_LIBRARY_CUSTOM, blender::ASSET_LIBRARY_USE_REMOTE_URL, blender::BKE_asset_metadata_catalog_id_set(), blender::BKE_id_free(), blender::BKE_preferences_asset_library_find_index(), blender::BKE_report(), blender::BLI_assert(), BLI_assert_msg, C, blender::asset_system::AssetCatalog::catalog_id, create_pose_asset_user_library(), blender::CTX_data_main(), blender::AssetLibraryReference::custom_library_index, ensure_asset_ui_visible(), extract_pose(), blender::bUserAssetLibrary::flag, blender::asset_system::AssetCatalogPath::from_user_input(), blender::G, blender::ed::asset::generate_preview(), get_selected_pose_objects(), blender::bAction::id, blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::ed::asset::library_ensure_catalogs_in_path(), blender::ed::asset::mark_id(), MAX_NAME, NA_ADDED, NC_ASSET, ND_ASSET_LIST, blender::OPERATOR_CANCELLED, blender::OPERATOR_FINISHED, blender::wmOperator::ptr, blender::ed::asset::refresh_asset_library(), blender::wmOperator::reports, blender::RNA_string_get(), blender::RPT_ERROR, blender::ed::asset::shelf::show_catalog_in_visible_shelves(), blender::asset_system::AssetCatalog::simple_name, blender::AssetLibraryReference::type, blender::U, and blender::WM_main_add_notifier().

Referenced by create_pose_asset_user_library(), and pose_asset_create_exec().

◆ depsgraph_sorted_transformables()

Vector< AnimTransformable * > blender::ed::animrig::depsgraph_sorted_transformables ( const Depsgraph * depsgraph,
const MutableSpan< AnimTransformable * > transformables )
static

◆ ensure_asset_ui_visible()

void blender::ed::animrig::ensure_asset_ui_visible ( bContext & C)
static

Check that the newly created asset is visible SOMEWHERE in Blender. If not already visible, open the asset shelf on the current 3D view. The reason for not always doing that is that it might be annoying in case you have 2 3D viewports open, but you want the asset shelf on only one of them, or you work out of the asset browser.

Definition at line 195 of file anim_asset_ops.cc.

References blender::bScreen::areabase, blender::BKE_area_find_region_type(), blender::SpaceFile::browse_mode, C, blender::CTX_wm_area(), blender::CTX_wm_manager(), blender::ED_region_visibility_change_update(), ensure_asset_ui_visible(), blender::FILE_BROWSE_MODE_ASSETS, blender::ARegion::flag, blender::RGN_FLAG_HIDDEN, blender::RGN_TYPE_ASSET_SHELF, blender::ARegion::runtime, blender::SPACE_FILE, blender::SPACE_VIEW3D, blender::ScrArea::spacedata, blender::SpaceType::spaceid, blender::ScrArea::type, blender::bke::ARegionRuntime::visible, and blender::WM_window_get_active_screen().

Referenced by create_pose_asset_local(), create_pose_asset_user_library(), and ensure_asset_ui_visible().

◆ ensure_baked_fcurves()

◆ extract_pose()

◆ fcurves_to_matrix()

float4x4 blender::ed::animrig::fcurves_to_matrix ( const Span< const FCurve * > fcurves,
const int key_index )
static

◆ generate_paste_mapping()

◆ generate_path_values()

◆ get_action_of_selected_asset()

bAction * blender::ed::animrig::get_action_of_selected_asset ( bContext * C)
static

Get the selected asset from the given bContext. If the asset is an Action, returns a pointer to that action, else returns a nullptr.

Note that this may open another .blend file and import the Action, which means it should not be used in poll functions.

See also
pose_asset_potentially_editable_poll() for use in poll functions.
is_pose_asset_blend_editable() to check if the asset is from an editable .asset.blend.

Definition at line 516 of file anim_asset_ops.cc.

References blender::bke::asset_edit_id_from_weak_reference(), C, blender::CTX_data_main(), blender::CTX_wm_asset(), get_action_of_selected_asset(), and blender::ID_AC.

Referenced by get_action_of_selected_asset(), pose_asset_delete_exec(), pose_asset_delete_invoke(), and pose_asset_modify_exec().

◆ get_selected_pose_objects()

◆ get_unique_ids() [1/2]

◆ get_unique_ids() [2/2]

◆ has_constraints()

bool blender::ed::animrig::has_constraints ( const Span< AnimTransformable > transformables)
static

◆ is_fcurve_flat()

bool blender::ed::animrig::is_fcurve_flat ( FCurve & fcurve)
static

◆ is_pose_asset_blend_editable()

bool blender::ed::animrig::is_pose_asset_blend_editable ( const bAction & action,
ReportList * reports )
static

Check that the .asset.blend file that contains the Action is suitable for modification.

Editable: return true Not: report and return false.

Definition at line 539 of file anim_asset_ops.cc.

References blender::bke::asset_edit_id_is_editable(), blender::bke::asset_edit_id_is_writable(), blender::BKE_reportf(), blender::bAction::id, is_pose_asset_blend_editable(), and blender::RPT_ERROR.

Referenced by is_pose_asset_blend_editable(), pose_asset_delete_exec(), pose_asset_delete_invoke(), and pose_asset_modify_exec().

◆ matrix_to_fcurves()

void blender::ed::animrig::matrix_to_fcurves ( const float4x4 & matrix,
Span< FCurve * > fcurves,
const int frame,
const int key_index )
static

◆ paste_world_space()

void blender::ed::animrig::paste_world_space ( Main & bmain,
Scene & scene,
ViewLayer & view_layer,
ReportList & reports,
bAction & clipboard_dna_action,
const MutableSpan< AnimTransformable > transformables,
const AnimationPasteOffset offset )
static

Definition at line 686 of file world_space_copy.cc.

References blender::AnimData::action, blender::Vector< T, InlineBufferCapacity, Allocator >::append(), blender::BKE_animdata_from_id(), blender::BKE_report(), blender::BKE_reportf(), blender::BLI_assert(), BLI_assert_msg, build_fcurves_for_paste(), blender::RenderData::cfra, blender::ed::animrig::TransformFCurves::channelbag, clean_baked_fcurves(), clipboard_name, CURRENT_FRAME, blender::DAG_EVAL_VIEWPORT, blender::DEG_evaluate_on_framechange(), blender::DEG_graph_build_from_ids(), blender::DEG_graph_free(), blender::DEG_graph_id_tag_update(), blender::DEG_graph_new(), depsgraph_sorted_transformables(), fcurves_to_matrix(), generate_paste_mapping(), blender::ed::AnimTransformable::get_rotation(), get_unique_ids(), blender::bAction::id, blender::ID_RECALC_ANIMATION, blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::keys(), blender::ed::AnimTransformable::LOCATION, blender::ed::animrig::TransformFCurves::location, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_or_add(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup_ptr(), blender::Bounds< T >::max, blender::Bounds< T >::min, blender::ed::AnimTransformable::OBJECT, blender::ed::AnimTransformable::owner_id(), paste_world_space(), blender::Scene::r, recalculate_handles(), blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::ed::AnimTransformable::ROTATION, blender::ed::animrig::TransformFCurves::rotation, blender::RPT_ERROR, blender::RPT_INFO, blender::ed::AnimTransformable::SCALE, blender::ed::animrig::TransformFCurves::scale, set_keys_to_transform(), blender::Array< T, InlineBufferCapacity, Allocator >::size(), blender::Bounds< T >::size(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::size(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::values(), and blender::ed::AnimTransformable::world_to_local().

Referenced by paste_world_space(), and world_space_paste_exec().

◆ pose_asset_create_exec()

◆ pose_asset_create_invoke()

◆ pose_asset_create_poll()

bool blender::ed::animrig::pose_asset_create_poll ( bContext * C)
static

◆ pose_asset_delete_exec()

◆ pose_asset_delete_invoke()

◆ pose_asset_modify_description()

std::string blender::ed::animrig::pose_asset_modify_description ( bContext * ,
wmOperatorType * ,
PointerRNA * ptr )
static

◆ pose_asset_modify_exec()

◆ pose_asset_modify_poll()

◆ pose_asset_potentially_editable_poll()

bool blender::ed::animrig::pose_asset_potentially_editable_poll ( bContext * C)
static

◆ POSELIB_OT_asset_delete()

◆ POSELIB_OT_asset_modify()

◆ POSELIB_OT_create_pose_asset()

◆ POSELIB_OT_screenshot_preview()

void blender::ed::animrig::POSELIB_OT_screenshot_preview ( wmOperatorType * ot)

◆ read_action_from_clipboard()

bAction * blender::ed::animrig::read_action_from_clipboard ( Main & clipboard_bmain,
ReportList & reports )
static

◆ recalculate_handles()

void blender::ed::animrig::recalculate_handles ( MutableSpan< PasteFCurve > fcurves)
static

◆ replace_pose_key()

◆ rna_asset_library_reference_itemf()

const EnumPropertyItem * blender::ed::animrig::rna_asset_library_reference_itemf ( bContext * ,
PointerRNA * ,
PropertyRNA * ,
bool * r_free )
static

◆ set_keys_to_transform()

◆ transformable_to_deg_identifier()

◆ update_pose_action_from_scene()

◆ visit_library_prop_catalogs_catalog_for_search_fn()

◆ world_space_copy_exec()

◆ world_space_copy_poll()

bool blender::ed::animrig::world_space_copy_poll ( bContext * C)
static

◆ world_space_paste_exec()

◆ world_space_paste_poll()

bool blender::ed::animrig::world_space_paste_poll ( bContext * C)
static

Variable Documentation

◆ clipboard_name

const char* blender::ed::animrig::clipboard_name = "world_space_buffer.blend"
constexpr

Definition at line 42 of file world_space_copy.cc.

Referenced by copy_world_space(), paste_world_space(), and world_space_paste_exec().

◆ prop_asset_overwrite_modes

const EnumPropertyItem blender::ed::animrig::prop_asset_overwrite_modes[]
static
Initial value:
= {
"ADJUST",
0,
"Adjust",
"Update existing channels in the pose asset but don't remove or add any channels"},
"REPLACE",
0,
"Replace with Selection",
"Completely replace all channels in the pose asset with the current selection"},
"ADD",
0,
"Add Selected Bones",
"Add channels of the selection to the pose asset. Existing channels will be updated"},
"REMOVE",
0,
"Remove Selected Bones",
"Remove channels of the selection from the pose asset"},
{0, nullptr, 0, nullptr, nullptr},
}

Definition at line 482 of file anim_asset_ops.cc.

Referenced by pose_asset_modify_description(), and POSELIB_OT_asset_modify().

◆ rna_enum_animation_paste_offset_items

const EnumPropertyItem blender::ed::animrig::rna_enum_animation_paste_offset_items[]
Initial value:
= {
"NONE",
0,
"No Offset",
"Paste data to the same frames they were copied from"},
"START",
0,
"Start at Current Frame",
"Paste data starting at current frame"},
{0, nullptr, 0, nullptr, nullptr},
}

Definition at line 1007 of file world_space_copy.cc.

Referenced by ANIM_OT_world_space_paste().

◆ rna_enum_copy_range_items

const EnumPropertyItem blender::ed::animrig::rna_enum_copy_range_items[]
Initial value:
= {
"CUSTOM",
0,
"Custom",
"Use the range provided in the operator properties"},
"PLAYBACK",
0,
"Playback Range",
"Use the playback range of the scene"},
{0, nullptr, 0, nullptr, nullptr},
}

Definition at line 854 of file world_space_copy.cc.

Referenced by ANIM_OT_world_space_copy().