Refactor: Pass Keyframe settings as arguments #115898
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115898
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChrisLend/blender:refactor_insert_vert_arguments"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
No functional changes.
Before this PR the interpolation mode of a new keyframe was read from the User Preference at the deepest level where the keyframe is created.
In case where this shouldn't be done, the flag
INSERTKEY_NO_USERPREF
was passed in. In this case it would fall back to some default values.In order to make these low level functions more flexible, the keyframe settings are now passed in.
I've made a new struct
KeyframeSettings
that holds theand a function
get_keyframe_settings
that allows you to quickly get this settings struct.This is a first step that will allow to pass in the interpolation mode from python in the future.
Part of: #113278: Anim: Keyframing Rework
@ -15,11 +15,21 @@ struct FCurve;
namespace blender::animrig {
typedef struct KeyframeSettings {
typedef
is unnecessary in C++@ -21,1 +21,4 @@
KeyframeSettings get_keyframe_settings(const bool from_userprefs)
{
KeyframeSettings settings = {.keyframe_type = BEZT_KEYTYPE_KEYFRAME,
Designated initializers are a C++ 20 feature and currently don't compile on Windows.
Usually you can do this:
Oh good to know. Just for my sanity: This used to be possible with C right?
Yes, and will be again when we can switch to C++ 20
I like this PR a lot:
Especially when only one setting was set by the flags, and the rest was supposed to come from the userprefs, the new code in this PR makes that so much clearer!
Just a few tiny nags that can be handled before landing.
@ -15,11 +15,21 @@ struct FCurve;
namespace blender::animrig {
struct KeyframeSettings {
Since this is not part of the keyframe itself (in DNA), but "just" a useful way to pass this info to various functions, it might be good to document that. Just to set expectations when people find this struct.
@ -18,0 +24,4 @@
/**
* Helper function to generate the KeyframeSettings struct.
*/
KeyframeSettings get_keyframe_settings(bool from_userprefs);
Document what is returned when
from_userprefs == false
.Story time: As a kid I was confused by the DOOM graphics setting "Use 8-Bit Textures". When it is ON it makes total sense. But what happens when it's off? Would it go for 4-bit textures? Or 16-bit textures?
good point, added a
\param
for it@ -36,2 +35,2 @@
insert_vert_fcurve(fcu, {2.0f, 13.0f}, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_NO_USERPREF);
insert_vert_fcurve(fcu, {3.0f, 19.0f}, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_NO_USERPREF);
KeyframeSettings settings = get_keyframe_settings(false);
About this block & similar blocks below: since
settings
is only used by the block of code directly following it, personally I'd remove the newline under theget_keyframe_settings()
call. No strong feelings either way, do with this as you please, I just wanted to voice a minor personal preference ;-)@ -128,3 +128,1 @@
fcu, {0.0f, 0.0f}, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_FAST | INSERTKEY_NO_USERPREF);
blender::animrig::insert_vert_fcurve(
fcu, {1.0f, 1.0f}, BEZT_KEYTYPE_KEYFRAME, INSERTKEY_FAST | INSERTKEY_NO_USERPREF);
KeyframeSettings settings = get_keyframe_settings(false);
Many of these lines can actually use
const KeyframeSettings settings = ...
addressed comments by
KeyframeSettings
structfrom_userprefs
KeyframeSettings settings
const where possiblesettings