diff options
author | Germano Cavalcante <mano-wii> | 2021-04-01 16:41:12 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-04-01 16:54:49 +0300 |
commit | f674976edd884d7a9a409042708f2b1169fd4e98 (patch) | |
tree | 1b2b293170e06d635aa6d3145db61bd4f6d4e535 /source/blender/blenloader | |
parent | 7a757662bc0a99b6f4720bb0e92735e54f9a1441 (diff) |
Curve: Remove 'CU_2D' flag used for nurbs
This fixes T86440
As the CU_2D flag is set for nurbs, a Curve can have 2D nurbs mixed with 3D.
But the UI does not allow this mixing. It updates all nurbs to 2D or 3D when set.
So remove this specific flag for nurbs.
This may break old files, since 2D curves with mixed 3D are now set as 3D.
Differential Revision: https://developer.blender.org/D10738
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_250.c | 1 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 21 |
2 files changed, 21 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 467fd8b0399..6338dc95aba 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -779,7 +779,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) Nurb *nu; for (nu = cu->nurb.first; nu; nu = nu->next) { - nu->flag |= (nu->type & CU_2D); nu->type &= CU_TYPE; } } diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 4997639de5e..0d59845e934 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -57,6 +57,7 @@ #include "BKE_collection.h" #include "BKE_colortools.h" #include "BKE_cryptomatte.h" +#include "BKE_curve.h" #include "BKE_fcurve.h" #include "BKE_gpencil.h" #include "BKE_lib_id.h" @@ -1983,5 +1984,25 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* The CU_2D flag has been removed. */ + LISTBASE_FOREACH (Curve *, cu, &bmain->curves) { +#define CU_2D (1 << 3) + ListBase *nurbs = BKE_curve_nurbs_get(cu); + bool is_2d = true; + + LISTBASE_FOREACH (Nurb *, nu, nurbs) { + if (nu->flag & CU_2D) { + nu->flag &= ~CU_2D; + } + else { + is_2d = false; + } + } +#undef CU_2D + if (!is_2d && CU_IS_2D(cu)) { + cu->flag |= CU_3D; + } + } } } |