Files
test2/source/blender/editors/space_action/action_buttons.cc
Bastien Montagne dd168a35c5 Refactor: Replace MEM_cnew with a type-aware template version of MEM_callocN.
The general idea is to keep the 'old', C-style MEM_callocN signature, and slowly
replace most of its usages with the new, C++-style type-safer template version.

* `MEM_cnew<T>` allocation version is renamed to `MEM_callocN<T>`.
* `MEM_cnew_array<T>` allocation version is renamed to `MEM_calloc_arrayN<T>`.
* `MEM_cnew<T>` duplicate version is renamed to `MEM_dupallocN<T>`.

Similar templates type-safe version of `MEM_mallocN` will be added soon
as well.

Following discussions in !134452.

NOTE: For now static type checking in `MEM_callocN` and related are slightly
different for Windows MSVC. This compiler seems to consider structs using the
`DNA_DEFINE_CXX_METHODS` macro as non-trivial (likely because their default
copy constructors are deleted). So using checks on trivially
constructible/destructible instead on this compiler/system.

Pull Request: https://projects.blender.org/blender/blender/pulls/134771
2025-03-05 16:35:09 +01:00

52 lines
1.5 KiB
C++

/* SPDX-FileCopyrightText: 2016 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup spaction
*/
#include <cfloat>
#include <cstring>
#include "BKE_screen.hh"
#include "action_intern.hh" /* own include */
/* ******************* action editor space & buttons ************** */
/* ******************* general ******************************** */
void action_buttons_register(ARegionType * /*art*/)
{
#if 0
PanelType *pt;
/* TODO: AnimData / Actions List */
pt = MEM_callocN<PanelType>("spacetype action panel properties");
STRNCPY(pt->idname, "ACTION_PT_properties");
STRNCPY(pt->label, N_("Active F-Curve"));
STRNCPY(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = action_anim_panel_properties;
pt->poll = action_anim_panel_poll;
BLI_addtail(&art->paneltypes, pt);
pt = MEM_callocN<PanelType>("spacetype action panel properties");
STRNCPY(pt->idname, "ACTION_PT_key_properties");
STRNCPY(pt->label, N_("Active Keyframe"));
STRNCPY(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = action_anim_panel_key_properties;
pt->poll = action_anim_panel_poll;
BLI_addtail(&art->paneltypes, pt);
pt = MEM_callocN(sizeof(PanelType), "spacetype action panel modifiers");
STRNCPY(pt->idname, "ACTION_PT_modifiers");
STRNCPY(pt->label, N_("Modifiers"));
STRNCPY(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = action_anim_panel_modifiers;
pt->poll = action_anim_panel_poll;
BLI_addtail(&art->paneltypes, pt);
#endif
}