Blender
V3.3
|
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "CLG_log.h"
#include "BLI_array_utils.h"
#include "BLI_utildefines.h"
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_undo_system.h"
#include "BKE_vfont.h"
#include "DEG_depsgraph.h"
#include "ED_curve.h"
#include "ED_object.h"
#include "ED_undo.h"
#include "WM_api.h"
#include "WM_types.h"
#include "BLI_array_store.h"
#include "BLI_array_store_utils.h"
#include "BLI_listbase.h"
Go to the source code of this file.
Classes | |
struct | UndoFont |
struct | FontUndoStep |
Macros | |
#define | USE_ARRAY_STORE |
#define | ARRAY_CHUNK_SIZE 32 |
#define | STATE_COMPACT(uf, id, len) |
#define | STATE_EXPAND(uf, id, len) |
#define | STATE_FREE(uf, id) |
Typedefs | |
Undo Conversion | |
typedef struct UndoFont | UndoFont |
Functions | |
static void | undofont_to_editfont (UndoFont *uf, Curve *cu) |
static void * | undofont_from_editfont (UndoFont *uf, Curve *cu) |
static void | undofont_free_data (UndoFont *uf) |
static Object * | editfont_object_from_context (bContext *C) |
Variables | |
static CLG_LogRef | LOG = {"ed.undo.font"} |
Implements ED Undo System | |
typedef struct FontUndoStep | FontUndoStep |
static bool | font_undosys_poll (bContext *C) |
static bool | font_undosys_step_encode (struct bContext *C, struct Main *bmain, UndoStep *us_p) |
static void | font_undosys_step_decode (struct bContext *C, struct Main *bmain, UndoStep *us_p, const eUndoStepDir UNUSED(dir), bool UNUSED(is_final)) |
static void | font_undosys_step_free (UndoStep *us_p) |
static void | font_undosys_foreach_ID_ref (UndoStep *us_p, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data) |
void | ED_font_undosys_type (UndoType *ut) |
Array Store | |
struct { | |
struct BArrayStore_AtSize bs_stride | |
int users | |
ListBase local_links | |
} | uf_arraystore = {{NULL}} |
static void | uf_arraystore_compact_ex (UndoFont *uf, const UndoFont *uf_ref, bool create) |
static void | uf_arraystore_compact (UndoFont *um, const UndoFont *uf_ref) |
static void | uf_arraystore_compact_with_info (UndoFont *um, const UndoFont *uf_ref) |
static void | uf_arraystore_expand_clear (UndoFont *um) |
static void | uf_arraystore_expand (UndoFont *uf) |
static void | uf_arraystore_free (UndoFont *uf) |
#define ARRAY_CHUNK_SIZE 32 |
Definition at line 42 of file editfont_undo.c.
#define USE_ARRAY_STORE |
Definition at line 35 of file editfont_undo.c.
typedef struct FontUndoStep FontUndoStep |
Export for ED_undo_sys.
Definition at line 394 of file editfont_undo.c.
References UndoType::flags, font_undosys_foreach_ID_ref(), font_undosys_poll(), font_undosys_step_decode(), font_undosys_step_encode(), font_undosys_step_free(), UndoType::name, UndoType::poll, UndoType::step_decode, UndoType::step_encode, UndoType::step_foreach_ID_ref, UndoType::step_free, UndoType::step_size, and UNDOTYPE_FLAG_NEED_CONTEXT_FOR_ENCODE.
Referenced by ED_undosys_type_init().
Definition at line 308 of file editfont_undo.c.
References C, CTX_data_view_layer(), Object::data, Curve::editfont, NULL, OB_FONT, OBEDIT_FROM_VIEW_LAYER, and Object::type.
Referenced by font_undosys_poll(), and font_undosys_step_encode().
|
static |
Definition at line 386 of file editfont_undo.c.
References FontUndoStep::obedit_ref, and user_data.
Referenced by ED_font_undosys_type().
Definition at line 335 of file editfont_undo.c.
References C, editfont_object_from_context(), and NULL.
Referenced by ED_font_undosys_type(), and font_undosys_step_decode().
|
static |
Definition at line 353 of file editfont_undo.c.
References BLI_assert, C, CTX_data_scene(), CTX_data_view_layer(), FontUndoStep::data, Object::data, DEG_id_tag_update(), ED_undo_object_editmode_restore_helper(), ED_undo_object_set_active_or_warn(), Curve::editfont, font_undosys_poll(), Curve::id, ID_RECALC_GEOMETRY, Main::is_memfile_undo_flush_needed, LOG, UndoStep::name, NC_GEOM, ND_DATA, EditFont::needs_flush_to_id, NULL, FontUndoStep::obedit_ref, undofont_to_editfont(), and WM_event_add_notifier().
Referenced by ED_font_undosys_type().
|
static |
Definition at line 340 of file editfont_undo.c.
References C, FontUndoStep::data, UndoStep::data_size, Curve::editfont, editfont_object_from_context(), Main::is_memfile_undo_flush_needed, EditFont::needs_flush_to_id, FontUndoStep::obedit_ref, FontUndoStep::step, UndoFont::undo_size, and undofont_from_editfont().
Referenced by ED_font_undosys_type().
Definition at line 380 of file editfont_undo.c.
References FontUndoStep::data, and undofont_free_data().
Referenced by ED_font_undosys_type().
Move data from allocated arrays to de-duplicated states and clear arrays.
Definition at line 120 of file editfont_undo.c.
References uf_arraystore_compact_ex().
Referenced by uf_arraystore_compact_with_info().
create | When false, only free the arrays. This is done since when reading from an undo state, they must be temporarily expanded. then discarded afterwards, having this argument avoids having 2x code paths. |
Definition at line 88 of file editfont_undo.c.
References blender::bke::idprop::create(), UndoFont::len, STATE_COMPACT, and uf_arraystore.
Referenced by uf_arraystore_compact(), and uf_arraystore_expand_clear().
Definition at line 125 of file editfont_undo.c.
References BLI_array_store_at_size_calc_memory_usage(), double(), uf_arraystore, and uf_arraystore_compact().
Referenced by undofont_from_editfont().
Definition at line 166 of file editfont_undo.c.
References UndoFont::len, and STATE_EXPAND.
Referenced by undofont_to_editfont().
Remove data we only expanded for temporary use.
Definition at line 161 of file editfont_undo.c.
References NULL, and uf_arraystore_compact_ex().
Referenced by undofont_to_editfont().
Definition at line 185 of file editfont_undo.c.
References BLI_array_store_at_size_clear(), BLI_assert, STATE_FREE, and uf_arraystore.
Referenced by undofont_free_data().
Definition at line 289 of file editfont_undo.c.
References BLI_findptr(), BLI_remlink(), data, MEM_freeN, UndoFont::textbuf, UndoFont::textbufinfo, uf_arraystore, and uf_arraystore_free().
Referenced by font_undosys_step_free().
Definition at line 245 of file editfont_undo.c.
References BLI_addtail(), BLI_array_is_zeroed, BLI_assert, BLI_genericNodeN(), Curve::editfont, EditFont::len, UndoFont::len, MEM_get_memory_in_use, MEM_mallocN, NULL, EditFont::pos, UndoFont::pos, EditFont::selend, UndoFont::selend, EditFont::selstart, UndoFont::selstart, EditFont::textbuf, UndoFont::textbuf, EditFont::textbufinfo, UndoFont::textbufinfo, uf_arraystore, uf_arraystore_compact_with_info(), and UndoFont::undo_size.
Referenced by font_undosys_step_encode().
Definition at line 219 of file editfont_undo.c.
References Curve::editfont, EditFont::len, UndoFont::len, EditFont::pos, UndoFont::pos, EditFont::selend, UndoFont::selend, EditFont::selstart, UndoFont::selstart, EditFont::textbuf, UndoFont::textbuf, EditFont::textbufinfo, UndoFont::textbufinfo, uf_arraystore_expand(), and uf_arraystore_expand_clear().
Referenced by font_undosys_step_decode().
struct BArrayStore_AtSize bs_stride |
Definition at line 61 of file editfont_undo.c.
Referenced by BLI_array_store_at_size_calc_memory_usage(), BLI_array_store_at_size_clear(), BLI_array_store_at_size_ensure(), and BLI_array_store_at_size_get().
ListBase local_links |
Definition at line 79 of file editfont_undo.c.
|
static |
Only needed this locally.
Definition at line 46 of file editfont_undo.c.
Referenced by font_undosys_step_decode().
struct { ... } uf_arraystore |
int users |
Definition at line 76 of file editfont_undo.c.
Referenced by LightManager::add_ies(), BLI_array_store_is_valid(), buttons_texture_modifier_foreach(), buttons_texture_modifier_geonodes_users_add(), buttons_texture_modifier_gpencil_foreach(), buttons_texture_user_node_add(), buttons_texture_user_property_add(), buttons_texture_user_socket_property_add(), buttons_texture_users_find_nodetree(), buttons_texture_users_from_context(), LightManager::device_update_ies(), ED_object_iter_other(), blender::fn::find_varying_fields(), and LightManager::remove_ies().