Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenloader/intern/versioning_290.c')
-rw-r--r--source/blender/blenloader/intern/versioning_290.c156
1 files changed, 156 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 3b7e7c21b28..0a3a1a2f881 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -25,6 +25,7 @@
#include "DNA_brush_types.h"
#include "DNA_genfile.h"
+#include "DNA_gpencil_modifier_types.h"
#include "DNA_screen_types.h"
#include "BKE_collection.h"
@@ -38,6 +39,161 @@
/* Make preferences read-only, use versioning_userdef.c. */
#define U (*((const UserDef *)&U))
+void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports))
+{
+ if (!MAIN_VERSION_ATLEAST(bmain, 290, 1)) {
+ /* Patch old grease pencil modifiers material filter. */
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
+ switch (md->type) {
+ case eGpencilModifierType_Array: {
+ ArrayGpencilModifierData *gpmd = (ArrayGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Color: {
+ ColorGpencilModifierData *gpmd = (ColorGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Hook: {
+ HookGpencilModifierData *gpmd = (HookGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Lattice: {
+ LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Mirror: {
+ MirrorGpencilModifierData *gpmd = (MirrorGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Multiply: {
+ MultiplyGpencilModifierData *gpmd = (MultiplyGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Noise: {
+ NoiseGpencilModifierData *gpmd = (NoiseGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Offset: {
+ OffsetGpencilModifierData *gpmd = (OffsetGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Opacity: {
+ OpacityGpencilModifierData *gpmd = (OpacityGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Simplify: {
+ SimplifyGpencilModifierData *gpmd = (SimplifyGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Smooth: {
+ SmoothGpencilModifierData *gpmd = (SmoothGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Subdiv: {
+ SubdivGpencilModifierData *gpmd = (SubdivGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Texture: {
+ TextureGpencilModifierData *gpmd = (TextureGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ case eGpencilModifierType_Thick: {
+ ThickGpencilModifierData *gpmd = (ThickGpencilModifierData *)md;
+ if (gpmd->materialname[0] != '\0') {
+ gpmd->material = BLI_findstring(
+ &bmain->materials, gpmd->materialname, offsetof(ID, name) + 2);
+ gpmd->materialname[0] = '\0';
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Versioning code until next subversion bump goes here.
+ *
+ * \note Be sure to check when bumping the version:
+ * - #blo_do_versions_290 in this file.
+ * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend
+ * - "versioning_userdef.c", #do_versions_theme
+ *
+ * \note Keep this message at the bottom of the function.
+ */
+ {
+ /* Keep this block, even when empty. */
+ }
+}
+
void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
UNUSED_VARS(fd);