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:
authorBrecht Van Lommel <brecht@blender.org>2020-08-04 13:52:04 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-09-09 18:01:17 +0300
commita1397a3cc69382a64ab97bb71e4769fc0add0791 (patch)
tree3ed860ff99a6a2469e6a11bc5de9304284d502d8 /source/blender/blenloader
parent565510bd7fd87ae146cabafb27f1dfd550450f58 (diff)
Geometry: use generic attributes for Hair and Point Clouds
Instead of custom data layer with special types, using general Vector and Float attributes. Ref T76659 Differential Revision: https://developer.blender.org/D8635
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_290.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 7dc1aab833e..73a4b1a9098 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -31,8 +31,10 @@
#include "DNA_genfile.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_types.h"
+#include "DNA_hair_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
+#include "DNA_pointcloud_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_screen_types.h"
#include "DNA_shader_fx_types.h"
@@ -251,6 +253,25 @@ static void panels_remove_x_closed_flag_recursive(Panel *panel)
}
}
+static void do_versions_point_attributes(CustomData *pdata)
+{
+ /* Change to generic named float/float3 attributes. */
+ const int CD_LOCATION = 43;
+ const int CD_RADIUS = 44;
+
+ for (int i = 0; i < pdata->totlayer; i++) {
+ CustomDataLayer *layer = &pdata->layers[i];
+ if (layer->type == CD_LOCATION) {
+ STRNCPY(layer->name, "Position");
+ layer->type = CD_PROP_FLOAT3;
+ }
+ else if (layer->type == CD_RADIUS) {
+ STRNCPY(layer->name, "Radius");
+ layer->type = CD_PROP_FLOAT;
+ }
+ }
+}
+
void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
UNUSED_VARS(fd);
@@ -555,6 +576,15 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ /* Hair and PointCloud attributes. */
+ for (Hair *hair = bmain->hairs.first; hair != NULL; hair = hair->id.next) {
+ do_versions_point_attributes(&hair->pdata);
+ }
+ for (PointCloud *pointcloud = bmain->pointclouds.first; pointcloud != NULL;
+ pointcloud = pointcloud->id.next) {
+ do_versions_point_attributes(&pointcloud->pdata);
+ }
+
/* Keep this block, even when empty. */
}
}