Cleanup: use low level edit-object access functions for undo

Use OBEDIT_FROM_VIEW_LAYER macro for curve & fonts (matching edit-mesh).

While the difference isn't significant at the moment,
there are no reason these should be different between undo systems.
This commit is contained in:
Campbell Barton
2021-02-25 12:14:30 +11:00
parent 72370b92be
commit 3ed6d9f966
2 changed files with 5 additions and 2 deletions

View File

@@ -173,7 +173,8 @@ static void undocurve_free_data(UndoCurve *uc)
static Object *editcurve_object_from_context(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
if (BKE_curve_editNurbs_get(cu) != NULL) {

View File

@@ -28,6 +28,7 @@
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_context.h"
#include "BKE_font.h"
@@ -314,7 +315,8 @@ static void undofont_free_data(UndoFont *uf)
static Object *editfont_object_from_context(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
if (obedit && obedit->type == OB_FONT) {
Curve *cu = obedit->data;
EditFont *ef = cu->editfont;