2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2016 Blender Foundation.
19 * All rights reserved.
22 * Contributor(s): Blender Foundation, Joshua Leung
24 * ***** END GPL LICENSE BLOCK *****
27 /** \file blender/editors/space_action/action_buttons.c
37 #include "DNA_anim_types.h"
38 #include "DNA_object_types.h"
39 #include "DNA_scene_types.h"
41 #include "MEM_guardedalloc.h"
44 #include "BLI_blenlib.h"
45 #include "BLI_utildefines.h"
47 #include "BLT_translation.h"
49 #include "BKE_context.h"
50 #include "BKE_curve.h"
51 #include "BKE_depsgraph.h"
52 #include "BKE_fcurve.h"
54 #include "BKE_global.h"
55 #include "BKE_screen.h"
62 #include "RNA_access.h"
64 #include "ED_anim_api.h"
65 #include "ED_keyframing.h"
66 #include "ED_screen.h"
68 #include "UI_interface.h"
69 #include "UI_resources.h"
71 #include "action_intern.h" // own include
73 /* ******************* action editor space & buttons ************** */
75 /* ******************* general ******************************** */
77 void action_buttons_register(ARegionType *UNUSED(art))
82 // TODO: AnimData / Actions List
84 pt = MEM_callocN(sizeof(PanelType), "spacetype action panel properties");
85 strcpy(pt->idname, "ACTION_PT_properties");
86 strcpy(pt->label, N_("Active F-Curve"));
87 strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
88 pt->draw = action_anim_panel_properties;
89 pt->poll = action_anim_panel_poll;
90 BLI_addtail(&art->paneltypes, pt);
92 pt = MEM_callocN(sizeof(PanelType), "spacetype action panel properties");
93 strcpy(pt->idname, "ACTION_PT_key_properties");
94 strcpy(pt->label, N_("Active Keyframe"));
95 strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
96 pt->draw = action_anim_panel_key_properties;
97 pt->poll = action_anim_panel_poll;
98 BLI_addtail(&art->paneltypes, pt);
100 pt = MEM_callocN(sizeof(PanelType), "spacetype action panel modifiers");
101 strcpy(pt->idname, "ACTION_PT_modifiers");
102 strcpy(pt->label, N_("Modifiers"));
103 strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
104 pt->draw = action_anim_panel_modifiers;
105 pt->poll = action_anim_panel_poll;
106 BLI_addtail(&art->paneltypes, pt);
110 static int action_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
112 ScrArea *sa = CTX_wm_area(C);
113 ARegion *ar = action_has_buttons_region(sa);
116 ED_region_toggle_hidden(C, ar);
118 return OPERATOR_FINISHED;
121 void ACTION_OT_properties(wmOperatorType *ot)
123 ot->name = "Properties";
124 ot->idname = "ACTION_OT_properties";
125 ot->description = "Toggle display properties panel";
127 ot->exec = action_properties_toggle_exec;
128 ot->poll = ED_operator_action_active;