Merge branch 'master' into blender2.8
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "blender/blender_util.h"
|
||||
|
||||
#include "util/util_foreach.h"
|
||||
#include "util/util_hash.h"
|
||||
#include "util/util_logging.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
@@ -565,12 +566,12 @@ static void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CDa
|
||||
return;
|
||||
|
||||
Attribute *attr_intercept = NULL;
|
||||
Attribute *attr_index = NULL;
|
||||
Attribute *attr_random = NULL;
|
||||
|
||||
if(mesh->need_attribute(scene, ATTR_STD_CURVE_INTERCEPT))
|
||||
attr_intercept = mesh->curve_attributes.add(ATTR_STD_CURVE_INTERCEPT);
|
||||
if(mesh->need_attribute(scene, ATTR_STD_CURVE_INDEX))
|
||||
attr_index = mesh->curve_attributes.add(ATTR_STD_CURVE_INDEX);
|
||||
if(mesh->need_attribute(scene, ATTR_STD_CURVE_RANDOM))
|
||||
attr_random = mesh->curve_attributes.add(ATTR_STD_CURVE_RANDOM);
|
||||
|
||||
/* compute and reserve size of arrays */
|
||||
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
|
||||
@@ -615,8 +616,8 @@ static void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CDa
|
||||
num_curve_keys++;
|
||||
}
|
||||
|
||||
if(attr_index != NULL) {
|
||||
attr_index->add(num_curves);
|
||||
if(attr_random != NULL) {
|
||||
attr_random->add(hash_int_01(num_curves));
|
||||
}
|
||||
|
||||
mesh->add_curve(num_keys, CData->psys_shader[sys]);
|
||||
@@ -625,15 +626,6 @@ static void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CDa
|
||||
}
|
||||
}
|
||||
|
||||
if(attr_index != NULL) {
|
||||
/* Normalize index to 0..1 range. */
|
||||
float *curve_index = attr_index->data_float();
|
||||
const float norm_factor = 1.0f / (float)num_curves;
|
||||
for(int i = 0; i < num_curves; ++i) {
|
||||
curve_index[i] *= norm_factor;
|
||||
}
|
||||
}
|
||||
|
||||
/* check allocation */
|
||||
if((mesh->curve_keys.size() != num_keys) || (mesh->num_curves() != num_curves)) {
|
||||
VLOG(1) << "Allocation failed, clearing data";
|
||||
|
Reference in New Issue
Block a user