forked from blender/blender
main sync #3
@ -387,7 +387,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_range)
|
||||
/* Curve samples. */
|
||||
const int sample_start = 1;
|
||||
const int sample_end = 20;
|
||||
fcurve_store_samples(fcu, NULL, sample_start, sample_end, fcurve_samplingcb_evalcurve);
|
||||
fcurve_store_samples(fcu, nullptr, sample_start, sample_end, fcurve_samplingcb_evalcurve);
|
||||
|
||||
success = BKE_fcurve_calc_range(fcu, &min, &max, true);
|
||||
EXPECT_TRUE(success) << "FCurve samples should have a range.";
|
||||
@ -421,8 +421,11 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
|
||||
bool success;
|
||||
|
||||
/* All keys. */
|
||||
success = BKE_fcurve_calc_bounds(
|
||||
fcu, false /* select only */, false /* include handles */, NULL /* frame range */, &bounds);
|
||||
success = BKE_fcurve_calc_bounds(fcu,
|
||||
false /* select only */,
|
||||
false /* include handles */,
|
||||
nullptr /* frame range */,
|
||||
&bounds);
|
||||
EXPECT_TRUE(success) << "A non-empty FCurve should have bounds.";
|
||||
EXPECT_FLOAT_EQ(fcu->bezt[0].vec[1][0], bounds.xmin);
|
||||
EXPECT_FLOAT_EQ(fcu->bezt[4].vec[1][0], bounds.xmax);
|
||||
@ -430,16 +433,22 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
|
||||
EXPECT_FLOAT_EQ(fcu->bezt[2].vec[1][1], bounds.ymax);
|
||||
|
||||
/* Only selected. */
|
||||
success = BKE_fcurve_calc_bounds(
|
||||
fcu, true /* select only */, false /* include handles */, NULL /* frame range */, &bounds);
|
||||
success = BKE_fcurve_calc_bounds(fcu,
|
||||
true /* select only */,
|
||||
false /* include handles */,
|
||||
nullptr /* frame range */,
|
||||
&bounds);
|
||||
EXPECT_FALSE(success)
|
||||
<< "Using selected keyframes only should not find bounds if nothing is selected.";
|
||||
|
||||
fcu->bezt[1].f2 |= SELECT;
|
||||
fcu->bezt[3].f2 |= SELECT;
|
||||
|
||||
success = BKE_fcurve_calc_bounds(
|
||||
fcu, true /* select only */, false /* include handles */, NULL /* frame range */, &bounds);
|
||||
success = BKE_fcurve_calc_bounds(fcu,
|
||||
true /* select only */,
|
||||
false /* include handles */,
|
||||
nullptr /* frame range */,
|
||||
&bounds);
|
||||
EXPECT_TRUE(success) << "Selected keys should have been found.";
|
||||
EXPECT_FLOAT_EQ(fcu->bezt[1].vec[1][0], bounds.xmin);
|
||||
EXPECT_FLOAT_EQ(fcu->bezt[3].vec[1][0], bounds.xmax);
|
||||
@ -447,8 +456,11 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
|
||||
EXPECT_FLOAT_EQ(fcu->bezt[3].vec[1][1], bounds.ymax);
|
||||
|
||||
/* Including handles. */
|
||||
success = BKE_fcurve_calc_bounds(
|
||||
fcu, false /* select only */, true /* include handles */, NULL /* frame range */, &bounds);
|
||||
success = BKE_fcurve_calc_bounds(fcu,
|
||||
false /* select only */,
|
||||
true /* include handles */,
|
||||
nullptr /* frame range */,
|
||||
&bounds);
|
||||
EXPECT_TRUE(success) << "A non-empty FCurve should have bounds including handles.";
|
||||
EXPECT_FLOAT_EQ(fcu->bezt[0].vec[0][0], bounds.xmin);
|
||||
EXPECT_FLOAT_EQ(fcu->bezt[4].vec[2][0], bounds.xmax);
|
||||
@ -499,10 +511,13 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
|
||||
/* Curve samples. */
|
||||
const int sample_start = 1;
|
||||
const int sample_end = 20;
|
||||
fcurve_store_samples(fcu, NULL, sample_start, sample_end, fcurve_samplingcb_evalcurve);
|
||||
fcurve_store_samples(fcu, nullptr, sample_start, sample_end, fcurve_samplingcb_evalcurve);
|
||||
|
||||
success = BKE_fcurve_calc_bounds(
|
||||
fcu, false /* select only */, false /* include handles */, NULL /* frame range */, &bounds);
|
||||
success = BKE_fcurve_calc_bounds(fcu,
|
||||
false /* select only */,
|
||||
false /* include handles */,
|
||||
nullptr /* frame range */,
|
||||
&bounds);
|
||||
EXPECT_TRUE(success) << "FCurve samples should have a range.";
|
||||
|
||||
EXPECT_FLOAT_EQ(sample_start, bounds.xmin);
|
||||
|
@ -63,18 +63,12 @@ TEST(math_rotation_types, Euler3Order)
|
||||
/* Asserts those match.
|
||||
* Do not do it in the header to avoid including the DNA header everywhere.
|
||||
*/
|
||||
BLI_STATIC_ASSERT(
|
||||
static_cast<int>(EulerOrder::XYZ) == static_cast<int>(eRotationModes::ROT_MODE_XYZ), "");
|
||||
BLI_STATIC_ASSERT(
|
||||
static_cast<int>(EulerOrder::XZY) == static_cast<int>(eRotationModes::ROT_MODE_XZY), "");
|
||||
BLI_STATIC_ASSERT(
|
||||
static_cast<int>(EulerOrder::YXZ) == static_cast<int>(eRotationModes::ROT_MODE_YXZ), "");
|
||||
BLI_STATIC_ASSERT(
|
||||
static_cast<int>(EulerOrder::YZX) == static_cast<int>(eRotationModes::ROT_MODE_YZX), "");
|
||||
BLI_STATIC_ASSERT(
|
||||
static_cast<int>(EulerOrder::ZXY) == static_cast<int>(eRotationModes::ROT_MODE_ZXY), "");
|
||||
BLI_STATIC_ASSERT(
|
||||
static_cast<int>(EulerOrder::ZYX) == static_cast<int>(eRotationModes::ROT_MODE_ZYX), "");
|
||||
BLI_STATIC_ASSERT(int(EulerOrder::XYZ) == int(eRotationModes::ROT_MODE_XYZ), "");
|
||||
BLI_STATIC_ASSERT(int(EulerOrder::XZY) == int(eRotationModes::ROT_MODE_XZY), "");
|
||||
BLI_STATIC_ASSERT(int(EulerOrder::YXZ) == int(eRotationModes::ROT_MODE_YXZ), "");
|
||||
BLI_STATIC_ASSERT(int(EulerOrder::YZX) == int(eRotationModes::ROT_MODE_YZX), "");
|
||||
BLI_STATIC_ASSERT(int(EulerOrder::ZXY) == int(eRotationModes::ROT_MODE_ZXY), "");
|
||||
BLI_STATIC_ASSERT(int(EulerOrder::ZYX) == int(eRotationModes::ROT_MODE_ZYX), "");
|
||||
|
||||
EXPECT_EQ(float3(Euler3(0, 1, 2, EulerOrder::XYZ).ijk()), float3(0, 1, 2));
|
||||
EXPECT_EQ(float3(Euler3(0, 1, 2, EulerOrder::XZY).ijk()), float3(0, 2, 1));
|
||||
|
@ -112,12 +112,12 @@ void *GPU_debug_capture_scope_create(const char *name)
|
||||
{
|
||||
/* GPU Frame capture is only enabled when --debug-gpu is specified. */
|
||||
if (!(G.debug & G_DEBUG_GPU)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Context *ctx = Context::get();
|
||||
if (!ctx) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return ctx->debug_capture_scope_create(name);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ static ImBuf *get_oiio_ibuf(ImageInput *in, const ReadContext &ctx, char colorsp
|
||||
if (x_res > 0.0f && y_res > 0.0f) {
|
||||
double scale = 1.0;
|
||||
auto unit = spec.get_string_attribute("ResolutionUnit", "");
|
||||
if (unit == "in" || unit == "inch") {
|
||||
if (ELEM(unit, "in", "inch")) {
|
||||
scale = 100.0 / 2.54;
|
||||
}
|
||||
else if (unit == "cm") {
|
||||
|
@ -102,30 +102,30 @@ void importer_main(Main *bmain,
|
||||
Vector<std::string> words{};
|
||||
splitstr(line, words, " ");
|
||||
|
||||
if (strcmp(words[0].c_str(), "format") == 0) {
|
||||
if (strcmp(words[1].c_str(), "ascii") == 0) {
|
||||
if (STREQ(words[0].c_str(), "format")) {
|
||||
if (STREQ(words[1].c_str(), "ascii")) {
|
||||
header.type = PlyFormatType::ASCII;
|
||||
}
|
||||
else if (strcmp(words[1].c_str(), "binary_big_endian") == 0) {
|
||||
else if (STREQ(words[1].c_str(), "binary_big_endian")) {
|
||||
header.type = PlyFormatType::BINARY_BE;
|
||||
}
|
||||
else if (strcmp(words[1].c_str(), "binary_little_endian") == 0) {
|
||||
else if (STREQ(words[1].c_str(), "binary_little_endian")) {
|
||||
header.type = PlyFormatType::BINARY_LE;
|
||||
}
|
||||
}
|
||||
else if (strcmp(words[0].c_str(), "element") == 0) {
|
||||
else if (STREQ(words[0].c_str(), "element")) {
|
||||
header.elements.append(std::make_pair(words[1], std::stoi(words[2])));
|
||||
if (strcmp(words[1].c_str(), "vertex") == 0) {
|
||||
if (STREQ(words[1].c_str(), "vertex")) {
|
||||
header.vertex_count = std::stoi(words[2]);
|
||||
}
|
||||
else if (strcmp(words[1].c_str(), "face") == 0) {
|
||||
else if (STREQ(words[1].c_str(), "face")) {
|
||||
header.face_count = std::stoi(words[2]);
|
||||
}
|
||||
else if (strcmp(words[1].c_str(), "edge") == 0) {
|
||||
else if (STREQ(words[1].c_str(), "edge")) {
|
||||
header.edge_count = std::stoi(words[2]);
|
||||
}
|
||||
}
|
||||
else if (strcmp(words[0].c_str(), "property") == 0) {
|
||||
else if (STREQ(words[0].c_str(), "property")) {
|
||||
std::pair<std::string, PlyDataTypes> property;
|
||||
property.first = words[2];
|
||||
property.second = from_string(words[1]);
|
||||
|
@ -187,7 +187,7 @@ int get_index(const PlyHeader *header, std::string property, PlyDataTypes dataty
|
||||
std::pair<std::string, PlyDataTypes> pair = {property, datatype};
|
||||
const std::pair<std::string, blender::io::ply::PlyDataTypes> *it = std::find(
|
||||
header->properties[0].begin(), header->properties[0].end(), pair);
|
||||
return (int)(it - header->properties[0].begin());
|
||||
return int(it - header->properties[0].begin());
|
||||
}
|
||||
|
||||
Vector<std::string> explode(const StringRef str, const char &ch)
|
||||
|
@ -971,6 +971,7 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
|
||||
|
||||
/* must recalculate normals with vgroups since they can displace unevenly #26888. */
|
||||
if (BKE_mesh_vert_normals_are_dirty(mesh) || do_rim || dvert) {
|
||||
/* Pass. */
|
||||
}
|
||||
else if (do_shell) {
|
||||
uint i;
|
||||
|
Loading…
Reference in New Issue
Block a user