Blender
V3.3
|
#include <string.h>
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "MEM_guardedalloc.h"
#include "BLT_translation.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
#include "BKE_screen.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_prototypes.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "ED_anim_api.h"
#include "ED_undo.h"
#include "DEG_depsgraph.h"
Go to the source code of this file.
Classes | |
struct | FModifierDeleteContext |
Typedefs | |
typedef void(* | PanelDrawFn) (const bContext *, struct Panel *) |
Functions | |
Panel Registering and Panel Callbacks | |
static ListBase * | fmodifier_list_space_specific (const bContext *C) |
static PointerRNA * | fmodifier_get_pointers (const bContext *C, const Panel *panel, ID **r_owner_id) |
static void | fmodifier_reorder (bContext *C, Panel *panel, int new_index) |
static short | get_fmodifier_expand_flag (const bContext *UNUSED(C), Panel *panel) |
static void | set_fmodifier_expand_flag (const bContext *UNUSED(C), Panel *panel, short expand_flag) |
static PanelType * | fmodifier_panel_register (ARegionType *region_type, eFModifier_Types type, PanelDrawFn draw, PanelTypePollFn poll, const char *id_prefix) |
static PanelType * | fmodifier_subpanel_register (ARegionType *region_type, const char *name, const char *label, PanelDrawFn draw_header, PanelDrawFn draw, PanelTypePollFn poll, PanelType *parent) |
Generator Modifier | |
static void | generator_panel_draw (const bContext *C, Panel *panel) |
static void | panel_register_generator (ARegionType *region_type, const char *id_prefix, PanelTypePollFn poll_fn) |
Function Generator Modifier | |
static void | fn_generator_panel_draw (const bContext *C, Panel *panel) |
static void | panel_register_fn_generator (ARegionType *region_type, const char *id_prefix, PanelTypePollFn poll_fn) |
Cycles Modifier | |
static void | cycles_panel_draw (const bContext *C, Panel *panel) |
static void | panel_register_cycles (ARegionType *region_type, const char *id_prefix, PanelTypePollFn poll_fn) |
Noise Modifier | |
static void | noise_panel_draw (const bContext *C, Panel *panel) |
static void | panel_register_noise (ARegionType *region_type, const char *id_prefix, PanelTypePollFn poll_fn) |
Envelope Modifier | |
static void | fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *UNUSED(arg)) |
static void | fmod_envelope_deletepoint_cb (bContext *UNUSED(C), void *fcm_dv, void *ind_v) |
static void | envelope_panel_draw (const bContext *C, Panel *panel) |
static void | panel_register_envelope (ARegionType *region_type, const char *id_prefix, PanelTypePollFn poll_fn) |
Limits Modifier | |
static void | limits_panel_draw (const bContext *C, Panel *panel) |
static void | panel_register_limits (ARegionType *region_type, const char *id_prefix, PanelTypePollFn poll_fn) |
Stepped Interpolation Modifier | |
static void | stepped_panel_draw (const bContext *C, Panel *panel) |
static void | panel_register_stepped (ARegionType *region_type, const char *id_prefix, PanelTypePollFn poll_fn) |
Panel Creation | |
void | ANIM_fmodifier_panels (const bContext *C, ID *owner_id, ListBase *fmodifiers, uiListPanelIDFromDataFunc panel_id_fn) |
void | ANIM_modifier_panels_register_graph_and_NLA (ARegionType *region_type, const char *modifier_panel_prefix, PanelTypePollFn poll_function) |
void | ANIM_modifier_panels_register_graph_only (ARegionType *region_type, const char *modifier_panel_prefix, PanelTypePollFn poll_function) |
General UI Callbacks and Drawing | |
#define | UI_FLT_MAX 10000.0f |
#define | B_REDR 1 |
#define | B_FMODIFIER_REDRAW 20 |
typedef struct FModifierDeleteContext | FModifierDeleteContext |
static void | fmodifier_panel_header (const bContext *C, Panel *panel) |
static void | delete_fmodifier_cb (bContext *C, void *ctx_v, void *fcm_v) |
static void | fmodifier_influence_draw (uiLayout *layout, PointerRNA *ptr) |
static void | fmodifier_frame_range_header_draw (const bContext *C, Panel *panel) |
static void | fmodifier_frame_range_draw (const bContext *C, Panel *panel) |
Copy / Paste Buffer Code | |
For now, this is also defined in this file so that it can be shared between the graph editor and the NLA editor. | |
static ListBase | fmodifier_copypaste_buf = {NULL, NULL} |
void | ANIM_fmodifiers_copybuf_free (void) |
bool | ANIM_fmodifiers_copy_to_buf (ListBase *modifiers, bool active) |
bool | ANIM_fmodifiers_paste_from_buf (ListBase *modifiers, bool replace, FCurve *curve) |
#define B_FMODIFIER_REDRAW 20 |
Definition at line 232 of file fmodifier_ui.c.
#define B_REDR 1 |
Definition at line 231 of file fmodifier_ui.c.
#define UI_FLT_MAX 10000.0f |
Definition at line 229 of file fmodifier_ui.c.
typedef struct FModifierDeleteContext FModifierDeleteContext |
User Interface for F-Modifiers
This file defines templates and some editing callbacks needed by the interface for F-Modifiers, as used by F-Curves in the Graph Editor and NLA-Strips in the NLA Editor.
Definition at line 46 of file fmodifier_ui.c.
void ANIM_fmodifier_panels | ( | const bContext * | C, |
ID * | owner_id, | ||
ListBase * | fmodifiers, | ||
uiListPanelIDFromDataFunc | panel_id_fn | ||
) |
Definition at line 879 of file fmodifier_ui.c.
References BLI_assert, C, CTX_wm_region(), ListBase::first, PanelType::flag, LISTBASE_FOREACH, MAX_NAME, MEM_mallocN, FModifier::next, Panel::next, NULL, PANEL_TYPE_INSTANCED, ARegion::panels, RNA_pointer_create(), Panel::type, UI_panel_add_instanced(), UI_panel_custom_data_set(), UI_panel_list_matches_data(), and UI_panels_free_instanced().
Referenced by graph_panel_modifiers(), and nla_panel_modifiers().
Copy the given F-Modifiers to the buffer, returning whether anything was copied or not assuming that the buffer has been cleared already with ANIM_fmodifiers_copybuf_free()
active | Only copy the active modifier. |
Definition at line 960 of file fmodifier_ui.c.
References blender::compositor::active, BLI_addtail(), copy_fmodifier(), copy_fmodifiers(), ELEM, find_active_fmodifier(), ListBase::first, fmodifier_copypaste_buf, and NULL.
Referenced by graph_fmodifier_copy_exec(), and nla_fmodifier_copy_exec().
Free the copy/paste buffer.
Definition at line 954 of file fmodifier_ui.c.
References fmodifier_copypaste_buf, and free_fmodifiers().
Referenced by graph_fmodifier_copy_exec(), nla_fmodifier_copy_exec(), and WM_exit_ex().
'Paste' the F-Modifier(s) from the buffer to the specified list
replace | Free all the existing modifiers to leave only the pasted ones. |
Definition at line 989 of file fmodifier_ui.c.
References BKE_fcurve_handles_recalc(), BKE_fcurve_is_cyclic(), BLI_addtail(), copy_fmodifier(), curve, FModifier::curve, ListBase::first, FModifier::flag, fmodifier_copypaste_buf, FMODIFIER_FLAG_ACTIVE, free_fmodifiers(), FModifier::next, and NULL.
Referenced by graph_fmodifier_paste_exec(), and nla_fmodifier_paste_exec().
void ANIM_modifier_panels_register_graph_and_NLA | ( | ARegionType * | region_type, |
const char * | modifier_panel_prefix, | ||
PanelTypePollFn | poll_function | ||
) |
Definition at line 921 of file fmodifier_ui.c.
References panel_register_envelope(), panel_register_fn_generator(), panel_register_generator(), panel_register_limits(), panel_register_noise(), and panel_register_stepped().
Referenced by graph_buttons_register(), and nla_buttons_register().
void ANIM_modifier_panels_register_graph_only | ( | ARegionType * | region_type, |
const char * | modifier_panel_prefix, | ||
PanelTypePollFn | poll_function | ||
) |
Definition at line 933 of file fmodifier_ui.c.
References panel_register_cycles().
Referenced by graph_buttons_register().
Definition at line 494 of file fmodifier_ui.c.
References C, col, fmodifier_get_pointers(), fmodifier_influence_draw(), IFACE_, Panel::layout, NULL, ptr, uiItemR(), uiLayoutColumn(), uiLayoutSetPropDecorate(), and uiLayoutSetPropSep().
Referenced by panel_register_cycles().
Definition at line 240 of file fmodifier_ui.c.
References C, DEG_id_tag_update(), ED_undo_push(), ID_RECALC_ANIMATION, FModifierDeleteContext::modifiers, NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, FModifierDeleteContext::owner_id, remove_fmodifier(), and WM_event_add_notifier().
Referenced by fmodifier_panel_header().
Definition at line 666 of file fmodifier_ui.c.
References B_FMODIFIER_REDRAW, C, col, FModifier::data, PointerRNA::data, fmod_envelope_addpoint_cb(), fmod_envelope_deletepoint_cb(), fmodifier_get_pointers(), fmodifier_influence_draw(), IFACE_, Panel::layout, NULL, POINTER_FROM_INT, ptr, RNA_pointer_create(), TIP_, UI_block_align_begin(), UI_BTYPE_BUT, UI_but_func_set(), UI_UNIT_X, UI_UNIT_Y, uiDefBut(), uiDefIconBut(), uiItemR(), uiLayoutColumn(), uiLayoutGetBlock(), uiLayoutRow(), uiLayoutSetPropDecorate(), and uiLayoutSetPropSep().
Referenced by panel_register_envelope().
Definition at line 581 of file fmodifier_ui.c.
References BKE_fcm_envelope_find_index(), C, RenderData::cfra, CTX_data_scene(), FMod_Envelope::data, FCM_EnvelopeData::f1, FCM_EnvelopeData::f2, float(), if(), FCM_EnvelopeData::max, MEM_callocN, MEM_freeN, FCM_EnvelopeData::min, Scene::r, scene, FCM_EnvelopeData::time, and FMod_Envelope::totvert.
Referenced by envelope_panel_draw().
Definition at line 637 of file fmodifier_ui.c.
References FMod_Envelope::data, MEM_callocN, MEM_freeN, MEM_SAFE_FREE, POINTER_AS_INT, and FMod_Envelope::totvert.
Referenced by envelope_panel_draw().
Definition at line 277 of file fmodifier_ui.c.
References C, col, PointerRNA::data, FModifier::flag, FMODIFIER_FLAG_RANGERESTRICT, fmodifier_get_pointers(), IFACE_, Panel::layout, NULL, ptr, uiItemR(), uiLayoutColumn(), uiLayoutSetActive(), uiLayoutSetPropDecorate(), and uiLayoutSetPropSep().
Referenced by panel_register_cycles(), panel_register_envelope(), panel_register_fn_generator(), panel_register_generator(), panel_register_limits(), panel_register_noise(), and panel_register_stepped().
Definition at line 268 of file fmodifier_ui.c.
References C, fmodifier_get_pointers(), Panel::layout, NULL, ptr, and uiItemR().
Referenced by panel_register_cycles(), panel_register_envelope(), panel_register_fn_generator(), panel_register_generator(), panel_register_limits(), panel_register_noise(), and panel_register_stepped().
|
static |
Get a pointer to the panel's FModifier, and also its owner ID if r_owner_id is not NULL. Also in the graph editor, gray out the panel if the FModifier's FCurve has modifiers turned off.
Definition at line 79 of file fmodifier_ui.c.
References ANIM_graph_context_fcurve(), C, CTX_wm_space_graph(), FCURVE_MOD_OFF, FCurve::flag, Panel::layout, NULL, PointerRNA::owner_id, ptr, UI_panel_custom_data_get(), and uiLayoutSetActive().
Referenced by cycles_panel_draw(), envelope_panel_draw(), fmodifier_frame_range_draw(), fmodifier_frame_range_header_draw(), fmodifier_panel_header(), fmodifier_reorder(), fn_generator_panel_draw(), generator_panel_draw(), get_fmodifier_expand_flag(), limits_panel_draw(), noise_panel_draw(), set_fmodifier_expand_flag(), and stepped_panel_draw().
|
static |
Definition at line 255 of file fmodifier_ui.c.
References PointerRNA::data, FModifier::flag, FMODIFIER_FLAG_USEINFLUENCE, IFACE_, ptr, uiItemR(), uiItemS(), uiLayoutRow(), uiLayoutRowWithHeading(), and uiLayoutSetActive().
Referenced by cycles_panel_draw(), envelope_panel_draw(), fn_generator_panel_draw(), generator_panel_draw(), limits_panel_draw(), noise_panel_draw(), and stepped_panel_draw().
Get the list of FModifiers from the context (either the NLA or graph editor).
Definition at line 56 of file fmodifier_ui.c.
References ANIM_graph_context_fcurve(), ANIM_nla_context_strip(), blender::compositor::area(), BLI_assert, C, CTX_wm_area(), FCurve::modifiers, NlaStrip::modifiers, NULL, SPACE_GRAPH, and SPACE_NLA.
Referenced by fmodifier_panel_header(), and fmodifier_reorder().
Definition at line 299 of file fmodifier_ui.c.
References B_REDR, BLI_assert, C, PointerRNA::data, delete_fmodifier_cb(), fmodifier_get_pointers(), fmodifier_get_typeinfo(), fmodifier_list_space_specific(), IFACE_, Panel::layout, MEM_mallocN, FModifierDeleteContext::modifiers, NULL, FModifierDeleteContext::owner_id, ptr, TIP_, UI_BTYPE_BUT, UI_but_funcN_set(), UI_EMBOSS_NONE, UI_ITEM_R_ICON_ONLY, UI_LAYOUT_ALIGN_LEFT, UI_LAYOUT_ALIGN_RIGHT, UI_UNIT_X, UI_UNIT_Y, uiDefIconBut(), uiItemL(), uiItemR(), uiItemS(), uiLayoutGetBlock(), uiLayoutRow(), uiLayoutSetAlignment(), and uiLayoutSetEmboss().
Referenced by fmodifier_panel_register().
|
static |
Definition at line 155 of file fmodifier_ui.c.
References BKE_ST_MAXNAME, BLI_addtail(), BLI_snprintf(), BLI_strncpy(), BLT_I18NCONTEXT_DEFAULT_BPYRNA, PanelType::category, PanelType::draw, PanelType::draw_header, PanelType::flag, fmodifier_panel_header(), fmodifier_reorder(), get_fmodifier_expand_flag(), get_fmodifier_typeinfo(), PanelType::get_list_data_expand_flag, PanelType::idname, MEM_callocN, FModifierTypeInfo::name, PANEL_TYPE_HEADER_EXPAND, PANEL_TYPE_INSTANCED, ARegionType::paneltypes, PanelType::poll, PanelType::reorder, set_fmodifier_expand_flag(), PanelType::set_list_data_expand_flag, PanelType::translation_context, and type.
Referenced by panel_register_cycles(), panel_register_envelope(), panel_register_fn_generator(), panel_register_generator(), panel_register_limits(), panel_register_noise(), and panel_register_stepped().
Move an FModifier to the index it's moved to after a drag and drop.
Definition at line 98 of file fmodifier_ui.c.
References BLI_assert, BLI_findindex(), BLI_listbase_link_move(), C, PointerRNA::data, DEG_id_tag_update(), ED_undo_push(), ListBase::first, FMI_REQUIRES_ORIGINAL_DATA, fmodifier_get_pointers(), fmodifier_list_space_specific(), get_fmodifier_typeinfo(), ID_RECALC_ANIMATION, NA_EDITED, NC_ANIMATION, ND_KEYFRAME, NULL, ptr, FModifierTypeInfo::requires, RPT_ERROR, FModifier::type, WM_event_add_notifier(), and WM_report().
Referenced by fmodifier_panel_register().
|
static |
Add a child panel to the parent.
Definition at line 191 of file fmodifier_ui.c.
References BKE_ST_MAXNAME, BLI_addtail(), BLI_assert, BLI_genericNodeN(), BLI_snprintf(), BLI_strncpy(), BLT_I18NCONTEXT_DEFAULT_BPYRNA, PanelType::category, PanelType::children, PanelType::draw, PanelType::draw_header, PanelType::flag, PanelType::idname, PanelType::label, label, MEM_callocN, NULL, PANEL_TYPE_DEFAULT_CLOSED, ARegionType::paneltypes, PanelType::parent, PanelType::parent_id, PanelType::poll, and PanelType::translation_context.
Referenced by panel_register_cycles(), panel_register_envelope(), panel_register_fn_generator(), panel_register_generator(), panel_register_limits(), panel_register_noise(), and panel_register_stepped().
Definition at line 449 of file fmodifier_ui.c.
References C, col, fmodifier_get_pointers(), fmodifier_influence_draw(), Panel::layout, NULL, ptr, uiItemR(), uiLayoutColumn(), uiLayoutSetPropDecorate(), and uiLayoutSetPropSep().
Referenced by panel_register_fn_generator().
Definition at line 364 of file fmodifier_ui.c.
References BLI_snprintf(), BLI_strncpy(), C, col, data, FModifier::data, PointerRNA::data, FCM_GENERATOR_POLYNOMIAL, FCM_GENERATOR_POLYNOMIAL_FACTORISED, fmodifier_get_pointers(), fmodifier_influence_draw(), IFACE_, Panel::layout, N_, NULL, ptr, RNA_struct_find_property(), blender::io::alembic::split(), uiItemFullR(), uiItemL(), uiItemR(), uiLayoutColumn(), uiLayoutRow(), uiLayoutSetPropDecorate(), uiLayoutSetPropSep(), and uiLayoutSplit().
Referenced by panel_register_generator().
Definition at line 139 of file fmodifier_ui.c.
References PointerRNA::data, fmodifier_get_pointers(), NULL, ptr, and FModifier::ui_expand_flag.
Referenced by fmodifier_panel_register().
Definition at line 764 of file fmodifier_ui.c.
References C, col, fmodifier_get_pointers(), fmodifier_influence_draw(), IFACE_, Panel::layout, NULL, ptr, RNA_boolean_get(), uiItemR(), uiLayoutColumn(), uiLayoutRowWithHeading(), uiLayoutSetActive(), uiLayoutSetPropDecorate(), and uiLayoutSetPropSep().
Referenced by panel_register_limits().
Definition at line 538 of file fmodifier_ui.c.
References C, col, fmodifier_get_pointers(), fmodifier_influence_draw(), Panel::layout, NULL, ptr, uiItemR(), uiLayoutColumn(), uiLayoutSetPropDecorate(), and uiLayoutSetPropSep().
Referenced by panel_register_noise().
|
static |
Definition at line 517 of file fmodifier_ui.c.
References cycles_panel_draw(), fmodifier_frame_range_draw(), fmodifier_frame_range_header_draw(), fmodifier_panel_register(), fmodifier_subpanel_register(), and FMODIFIER_TYPE_CYCLES.
Referenced by ANIM_modifier_panels_register_graph_only().
|
static |
Definition at line 743 of file fmodifier_ui.c.
References envelope_panel_draw(), fmodifier_frame_range_draw(), fmodifier_frame_range_header_draw(), fmodifier_panel_register(), fmodifier_subpanel_register(), and FMODIFIER_TYPE_ENVELOPE.
Referenced by ANIM_modifier_panels_register_graph_and_NLA().
|
static |
Definition at line 473 of file fmodifier_ui.c.
References fmodifier_frame_range_draw(), fmodifier_frame_range_header_draw(), fmodifier_panel_register(), fmodifier_subpanel_register(), FMODIFIER_TYPE_FN_GENERATOR, and fn_generator_panel_draw().
Referenced by ANIM_modifier_panels_register_graph_and_NLA().
|
static |
Definition at line 428 of file fmodifier_ui.c.
References fmodifier_frame_range_draw(), fmodifier_frame_range_header_draw(), fmodifier_panel_register(), fmodifier_subpanel_register(), FMODIFIER_TYPE_GENERATOR, and generator_panel_draw().
Referenced by ANIM_modifier_panels_register_graph_and_NLA().
|
static |
Definition at line 805 of file fmodifier_ui.c.
References fmodifier_frame_range_draw(), fmodifier_frame_range_header_draw(), fmodifier_panel_register(), fmodifier_subpanel_register(), FMODIFIER_TYPE_LIMITS, and limits_panel_draw().
Referenced by ANIM_modifier_panels_register_graph_and_NLA().
|
static |
Definition at line 560 of file fmodifier_ui.c.
References fmodifier_frame_range_draw(), fmodifier_frame_range_header_draw(), fmodifier_panel_register(), fmodifier_subpanel_register(), FMODIFIER_TYPE_NOISE, and noise_panel_draw().
Referenced by ANIM_modifier_panels_register_graph_and_NLA().
|
static |
Definition at line 858 of file fmodifier_ui.c.
References fmodifier_frame_range_draw(), fmodifier_frame_range_header_draw(), fmodifier_panel_register(), fmodifier_subpanel_register(), FMODIFIER_TYPE_STEPPED, and stepped_panel_draw().
Referenced by ANIM_modifier_panels_register_graph_and_NLA().
|
static |
Definition at line 147 of file fmodifier_ui.c.
References PointerRNA::data, fmodifier_get_pointers(), NULL, ptr, and FModifier::ui_expand_flag.
Referenced by fmodifier_panel_register().
Definition at line 826 of file fmodifier_ui.c.
References C, col, fmodifier_get_pointers(), fmodifier_influence_draw(), IFACE_, Panel::layout, NULL, ptr, RNA_boolean_get(), uiItemR(), uiLayoutColumn(), uiLayoutRowWithHeading(), uiLayoutSetActive(), uiLayoutSetPropDecorate(), and uiLayoutSetPropSep().
Referenced by panel_register_stepped().
Definition at line 950 of file fmodifier_ui.c.
Referenced by ANIM_fmodifiers_copy_to_buf(), ANIM_fmodifiers_copybuf_free(), and ANIM_fmodifiers_paste_from_buf().