46#include "RNA_prototypes.hh"
80 if (elem ==
nullptr) {
160 sub.
op(
"GRAPH_OT_frame_jump",
IFACE_(
"Cursor to Selection"), ICON_NONE);
161 sub.
op(
"GRAPH_OT_snap_cursor_value",
IFACE_(
"Cursor Value to Selection"), ICON_NONE);
191 icon = *optional_icon;
205 if (acf && acf->
name) {
206 acf->
name(ale, name);
210 icon = ICON_STATUS_ERROR;
218 name_col.
label(name, icon);
227 rna_col.
prop(&fcu_ptr,
"array_index",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
256 *r_bezt = *r_prevbezt =
nullptr;
266 *r_bezt = &fcu->
bezt[active_keyframe_index];
268 const int prev_index =
max_ii(active_keyframe_index - 1, 0);
269 *r_prevbezt = &fcu->
bezt[prev_index];
372 const int but_max_width = region->
winx;
404 split.label(
IFACE_(
"None for Enum/Boolean"), ICON_IPO_CONSTANT);
407 interpolation_col.
prop(&bezt_ptr,
"interpolation",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
412 interpolation_col.
prop(&bezt_ptr,
"easing",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
439 uiItemL_respect_property_split(&col,
IFACE_(
"Key Frame"), ICON_NONE);
440 but = uiDefButR(block,
455 uiItemL_respect_property_split(&col,
IFACE_(
"Value"), ICON_NONE);
456 but = uiDefButR(block,
470 button_unit_type_set(but, unit);
477 uiItemL_respect_property_split(&col,
IFACE_(
"Left Handle Type"), ICON_NONE);
478 but = uiDefButR(block,
490 "Type of left handle");
493 uiItemL_respect_property_split(&col,
IFACE_(
"Frame"), ICON_NONE);
494 but = uiDefButR(block,
509 uiItemL_respect_property_split(&col,
IFACE_(
"Value"), ICON_NONE);
510 but = uiDefButR(block,
524 button_unit_type_set(but, unit);
532 uiItemL_respect_property_split(&col,
IFACE_(
"Right Handle Type"), ICON_NONE);
533 but = uiDefButR(block,
545 "Type of right handle");
548 uiItemL_respect_property_split(&col,
IFACE_(
"Frame"), ICON_NONE);
549 but = uiDefButR(block,
564 uiItemL_respect_property_split(&col,
IFACE_(
"Value"), ICON_NONE);
565 but = uiDefButR(block,
579 button_unit_type_set(but, unit);
585 layout.
label(
RPT_(
"F-Curve only has F-Modifiers"), ICON_NONE);
586 layout.
label(
RPT_(
"See Modifiers panel below"), ICON_STATUS_INFO);
590 layout.
label(
RPT_(
"F-Curve does not have any keyframes as it only contains sampled points"),
594 layout.
label(
RPT_(
"No active keyframe on F-Curve"), ICON_NONE);
622 if (adt !=
nullptr) {
623 if (adt->
action !=
nullptr) {
626 if (adt->
tmpact !=
nullptr) {
656 layout.
label(
RPT_(
"It cannot be left blank"), ICON_STATUS_ERROR);
659 layout.
label(
RPT_(
"It cannot start with a number"), ICON_STATUS_ERROR);
662 layout.
label(
RPT_(
"It cannot start with a special character,"
663 " including '$', '@', '!', '~', '+', '-', '_', '.', or ' '"),
667 layout.
label(
RPT_(
"It cannot contain spaces (e.g. 'a space')"), ICON_STATUS_ERROR);
670 layout.
label(
RPT_(
"It cannot contain dots (e.g. 'a.dot')"), ICON_STATUS_ERROR);
673 layout.
label(
RPT_(
"It cannot contain special (non-alphabetical/numeric) characters"),
677 layout.
label(
RPT_(
"It cannot be a reserved keyword in Python"), ICON_STATUS_ERROR);
680 popup_menu_end(
C, pup);
712 row.
prop(dtar_ptr,
"fallback_value",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
715 layout.
prop(dtar_ptr,
"use_fallback_value",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
730 template_any_id(&row, &dtar_ptr,
"id",
"id_type",
IFACE_(
"Prop:"));
740 template_path_builder(&col,
765 Object *ob = id_cast<Object *>(dtar->
id);
768 col.
prop_search(&ptr,
"bone_target", &tar_ptr,
"bones",
"", ICON_BONE_DATA);
788 Object *ob = id_cast<Object *>(dtar->
id);
792 col.
prop_search(&ptr,
"bone_target", &tar_ptr,
"bones",
IFACE_(
"Bone"), ICON_BONE_DATA);
806 Object *ob = id_cast<Object *>(dtar->
id);
818 col.
prop_search(&dtar_ptr,
"bone_target", &tar_ptr,
"bones",
IFACE_(
"Bone"), ICON_BONE_DATA);
822 sub.
prop(&dtar_ptr,
"transform_type",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
847 row.
prop(&dtar_ptr,
"context_property",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
854 template_path_builder(&col,
889 TIP_(
"Let the driver determine this property's value"));
912 icon = *optional_icon;
928 row.
label(
"", ICON_RIGHTARROW);
929 row.
label(name, ICON_RNA);
936 const bool is_popover)
959 row.
label(valBuf, ICON_NONE);
968 bool bpy_data_expr_error = (strstr(driver->
expression,
"bpy.data.") !=
nullptr);
969 bool bpy_ctx_expr_error = (strstr(driver->
expression,
"bpy.context.") !=
nullptr);
977 expr_col.
prop(&driver_ptr,
"use_self",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
984 error_col.
label(
RPT_(
"Python restricted for security"), ICON_STATUS_ERROR);
985 error_col.
label(
RPT_(
"Slow Python expression"), ICON_STATUS_INFO);
988 error_col.
label(
RPT_(
"ERROR: Invalid Python expression"), ICON_STATUS_ERROR);
991 error_col.
label(
RPT_(
"Slow Python expression"), ICON_STATUS_INFO);
996 if (bpy_data_expr_error || bpy_ctx_expr_error) {
997 error_col.
label(
RPT_(
"WARNING: Driver expression may not work correctly"), ICON_HELP);
999 if (bpy_data_expr_error) {
1000 error_col.
label(
RPT_(
"TIP: Use variables instead of bpy.data paths (see below)"),
1001 ICON_STATUS_WARNING);
1003 if (bpy_ctx_expr_error) {
1004 error_col.
label(
RPT_(
"TIP: bpy.context is not safe for renderfarm usage"),
1005 ICON_STATUS_WARNING);
1014 col.
label(
RPT_(
"ERROR: Invalid target channel(s)"), ICON_STATUS_ERROR);
1024 col.
label(
RPT_(
"ERROR: Driver is useless without any inputs"), ICON_STATUS_ERROR);
1027 col.
label(
RPT_(
"TIP: Use F-Curves for procedural animation instead"), ICON_STATUS_INFO);
1028 col.
label(
RPT_(
"F-Modifiers can generate curves for those too"), ICON_STATUS_INFO);
1041 but = uiDefIconTextBut(
1045 IFACE_(
"Add Input Variable"),
1051 TIP_(
"Add a Driver Variable to keep track of an input used by the driver"));
1052 button_func_set(but, [
id, driver](
bContext &
C) {
1060 sub.
op(
"UI_OT_eyedropper_driver",
"", ICON_EYEDROPPER);
1068 sub.
op(
"GRAPH_OT_driver_variables_copy",
"", ICON_COPYDOWN);
1069 sub.
op(
"GRAPH_OT_driver_variables_paste",
"", ICON_PASTEDOWN);
1109 but = uiDefIconBut(block,
1119 TIP_(
"Invalid variable name, click here for details"));
1125 but = uiDefIconBut(block,
1135 TIP_(
"Delete target variable"));
1136 button_func_set(but, [
id, driver, dvar = &dvar](
bContext &
C) {
1145 switch (dvar.
type) {
1190 sub.
label(valBuf, ICON_NONE);
1200 but = uiDefIconTextBut(block,
1203 IFACE_(
"Update Dependencies"),
1209 TIP_(
"Force updates of dependencies - Only use this if drivers are not "
1210 "updating correctly"));
1211 button_func_set(but, [
id, fcu](
bContext &
C) {
1276 bool driven, special;
1279 const_cast<bContext *
>(
C), &ptr, prop,
index,
nullptr,
nullptr, &driven, &special);
1288 if (fcu && fcu->
driver) {
1295 layout.
label(
IFACE_(
"Driven Property:"), ICON_NONE);
1309 layout.
op(
"SCREEN_OT_drivers_editor_show",
IFACE_(
"Show in Drivers Editor"), ICON_DRIVER);
1321#define GRAPH_FMODIFIER_PANEL_PREFIX "GRAPH"
1359 sub.
op(
"GRAPH_OT_fmodifier_copy",
"", ICON_COPYDOWN);
1360 sub.
op(
"GRAPH_OT_fmodifier_paste",
"", ICON_PASTEDOWN);
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
#define BLI_STR_UTF8_DEGREE_SIGN
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define BLT_I18NCONTEXT_DEFAULT_BPYRNA
#define BLT_I18NCONTEXT_EDITOR_FILEBROWSER
#define FCURVE_ACTIVE_KEYFRAME_NONE
#define BEZT_ISSEL_ANY(bezt)
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define RNA_SUBTYPE_UNIT(subtype)
constexpr IndexRange()=default
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
PopupMenu * popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
Button * region_active_but_prop_get(const ARegion *region, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
size_t size_t size_t BLI_snprintf_utf8(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
@ DVAR_TYPE_TRANSFORM_CHAN
static bool graph_panel_poll(const bContext *C, PanelType *)
static void do_graph_dependency_change_cb(bContext *C, ID *id)
@ DRIVER_FLAG_PYTHON_BLOCKED
static void graph_panel_drivers_header(const bContext *C, Panel *panel)
static void graph_fmodifier_panel_id(void *fcm_link, char *r_name)
bool ED_operator_graphedit_active(bContext *C)
bool WM_paneltype_add(PanelType *pt)
static void graph_panel_driven_property(const bContext *C, Panel *panel)
const bAnimChannelType * ANIM_channel_get_typeinfo(const bAnimListElem *ale)
static void graphedit_activekey_right_handle_coord_cb(bContext *C, void *fcu_ptr, void *bezt_ptr)
static void graph_panel_driverVar__transChan(ui::Layout &layout, ID *id, DriverVar *dvar)
void BKE_nurb_bezt_handle_test(BezTriple *bezt, eBezTriple_Flag__Alias sel_flag, const eNurbHandleTest_Mode handle_mode, bool use_around_local)
PointerRNA RNA_id_pointer_create(ID *id)
void BKE_fcurve_update_handle_flag_from_opposite(BezTriple &key, HandleSide source_side)
StructRNA * ID_code_to_RNA_type(short idcode)
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
void driver_free_variable_ex(struct ChannelDriver *driver, struct DriverVar *dvar)
void ANIM_modifier_panels_register_graph_only(ARegionType *region_type, const char *modifier_panel_prefix, PanelTypePollFn poll_function)
static void graphedit_activekey_handle_right_cb(bContext *C, void *fcu_ptr, void *bezt_ptr)
MINLINE int max_ii(int a, int b)
@ DTAR_ROTMODE_QUATERNION
static void driver_add_var_cb(bContext *C, ChannelDriver *driver)
static void driver_dvar_invalid_name_query_cb(bContext *C, DriverVar *dvar)
AnimData * BKE_animdata_from_id(const ID *id)
static void graph_panel_cursor_header(const bContext *C, Panel *panel)
static void do_graph_region_driver_buttons(bContext *C, void *, int)
void DEG_id_tag_update_ex(Main *bmain, ID *id, unsigned int flags)
static bool graph_panel_drivers_popover_poll(const bContext *C, PanelType *)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
static void graph_panel_driverVar__contextProp(ui::Layout &layout, ID *id, DriverVar *dvar)
void BKE_fcurve_handles_recalc(FCurve &fcu)
static void graphedit_activekey_left_handle_coord_cb(bContext *C, void *fcu_ptr, void *bezt_ptr)
static void driver_update_flags_cb(FCurve *fcu)
void ANIM_fmodifier_panels(const bContext *C, ID *owner_id, ListBaseT< FModifier > *fmodifiers, uiListPanelIDFromDataFunc panel_id_fn)
@ DTAR_OPTION_USE_FALLBACK
void ED_undo_push(bContext *C, const char *str, UndoEncodeHints hints=UndoEncodeHints(0))
static void graphedit_activekey_handles_cb(bContext *C, void *fcu_ptr, void *bezt_ptr)
void graph_buttons_register(ARegionType *art)
static void graph_draw_driven_property_panel(ui::Layout &layout, ID *id, FCurve *fcu)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static void graph_draw_driven_property_enabled_btn(ui::Layout &layout, ID *id, FCurve *fcu, const char *label)
static void graphedit_activekey_handle_left_cb(bContext *C, void *fcu_ptr, void *bezt_ptr)
SpaceGraph * CTX_wm_space_graph(const bContext *C)
bAnimListElem * get_active_fcurve_channel(bAnimContext *ac)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
static void graph_panel_properties(const bContext *C, Panel *panel)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int RNA_struct_ui_icon(const StructRNA *type)
static void graphedit_activekey_update_cb(bContext *, void *fcu_ptr, void *)
static bool get_active_fcurve_keyframe_edit(const FCurve *fcu, BezTriple **r_bezt, BezTriple **r_prevbezt)
static void graph_panel_key_properties(const bContext *C, Panel *panel)
static void graph_draw_driver_settings_panel(ui::Layout &layout, ID *id, FCurve *fcu, const bool is_popover)
PropertySubType RNA_property_subtype(PropertyRNA *prop)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
int BKE_fcurve_active_keyframe_index(const FCurve *fcu)
FCurve * ANIM_graph_context_fcurve(const bContext *C)
std::optional< int > getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
ID_Type GS(const char *name)
static void graph_panel_modifiers(const bContext *C, Panel *panel)
void DEG_relations_tag_update(Main *bmain)
Scene * CTX_data_scene(const bContext *C)
bScreen * CTX_wm_screen(const bContext *C)
void ANIM_modifier_panels_register_graph_and_NLA(ARegionType *region_type, const char *modifier_panel_prefix, PanelTypePollFn poll_function)
static bool graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **fcu)
static void graph_panel_drivers_popover(const bContext *C, Panel *panel)
FCurve * BKE_fcurve_find_by_rna_context_ui(bContext *C, const PointerRNA *ptr, PropertyRNA *prop, int rnaindex, AnimData **r_animdata, bAction **r_action, bool *r_driven, bool *r_special)
static bool graph_panel_drivers_poll(const bContext *C, PanelType *)
static void graph_panel_cursor(const bContext *C, Panel *panel)
static void graph_panel_driverVar__locDiff(ui::Layout &layout, ID *id, DriverVar *dvar)
@ DTAR_FLAG_FALLBACK_USED
@ DVAR_FLAG_INVALID_HAS_DOT
@ DVAR_FLAG_INVALID_EMPTY
@ DVAR_FLAG_INVALID_HAS_SPECIAL
@ DVAR_FLAG_INVALID_PY_KEYWORD
@ DVAR_FLAG_INVALID_HAS_SPACE
@ DVAR_FLAG_INVALID_START_NUM
@ DVAR_FLAG_INVALID_START_CHAR
bool BKE_driver_has_simple_expression(struct ChannelDriver *driver)
static void driver_delete_var_cb(bContext *C, ChannelDriver *driver, DriverVar *dvar)
static void graph_panel_drivers(const bContext *C, Panel *panel)
bool RNA_path_resolve_property(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
ARegion * CTX_wm_region(const bContext *C)
const FModifierTypeInfo * get_fmodifier_typeinfo(int type)
static void graph_panel_driverVar__singleProp(ui::Layout &layout, ID *id, DriverVar *dvar)
struct DriverVar * driver_add_new_variable(struct ChannelDriver *driver)
void sort_time_fcurve(FCurve &fcu)
static void graph_panel_driverVar__rotDiff(ui::Layout &layout, ID *id, DriverVar *dvar)
static void graph_panel_driverVar_fallback(ui::Layout &layout, const DriverTarget *dtar, PointerRNA *dtar_ptr)
ListBaseT< PanelType > paneltypes
eBezTriple_Interpolation ipo
ListBaseT< DriverVar > variables
eDriverTarget_Options options
eDriverTarget_RotationMode rotation_mode
eDriverTarget_TransformChannels transChan
ListBaseT< FModifier > modifiers
eFCurve_Coloring color_mode
char translation_context[BKE_ST_MAXNAME]
void(*) draw(const bContext *C, Panel *panel)
char category[BKE_ST_MAXNAME]
bool(*) poll(const bContext *C, PanelType *pt)
void(*) draw_header(const bContext *C, Panel *panel)
char idname[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
void(*) name(bAnimListElem *ale, char *name)
void enabled_set(bool enabled)
void alignment_set(LayoutAlign alignment)
void prop_search(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop, PropertyRNA *item_searchpropname, std::optional< StringRefNull > name, int icon, bool results_are_suggestions)
void use_property_decorate_set(bool is_decorate)
void use_property_split_set(bool is_sep)
PointerRNA op_menu_enum(const bContext *C, wmOperatorType *ot, StringRefNull propname, std::optional< StringRefNull > name, int icon)
void label(StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
void context_set_from_but(const Button *but)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
void red_alert_set(bool red_alert)
void active_set(bool active)
Layout & split(float percentage, bool align)
Layout & column(bool align)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
void context_ptr_set(StringRef name, const PointerRNA *ptr)