Merge branch 'master' into blender2.8

This commit is contained in:
Sybren A. Stüvel 2017-05-23 17:35:45 +02:00
commit 99c6601a1f
9 changed files with 280 additions and 210 deletions

View File

@ -331,6 +331,9 @@ void BlenderSync::sync_integrator()
integrator->ao_bounces = get_int(cscene, "ao_bounces_render");
}
}
else {
integrator->ao_bounces = 0;
}
if(integrator->modified(previntegrator))
integrator->tag_update(scene);

View File

@ -227,48 +227,6 @@ using Alembic::AbcGeom::IC3fGeomParam;
using Alembic::AbcGeom::IC4fGeomParam;
using Alembic::AbcGeom::IV2fGeomParam;
static void read_mcols(const CDStreamConfig &config, void *data,
const C3fArraySamplePtr &c3f_ptr, const C4fArraySamplePtr &c4f_ptr)
{
MCol *cfaces = static_cast<MCol *>(data);
MPoly *polys = config.mpoly;
MLoop *mloops = config.mloop;
if (c3f_ptr) {
for (int i = 0; i < config.totpoly; ++i) {
MPoly *p = &polys[i];
MCol *cface = &cfaces[p->loopstart + p->totloop];
MLoop *mloop = &mloops[p->loopstart + p->totloop];
for (int j = 0; j < p->totloop; ++j) {
cface--;
mloop--;
const Imath::C3f &color = (*c3f_ptr)[mloop->v];
cface->a = FTOCHAR(color[0]);
cface->r = FTOCHAR(color[1]);
cface->g = FTOCHAR(color[2]);
cface->b = 255;
}
}
}
else if (c4f_ptr) {
for (int i = 0; i < config.totpoly; ++i) {
MPoly *p = &polys[i];
MCol *cface = &cfaces[p->loopstart + p->totloop];
MLoop *mloop = &mloops[p->loopstart + p->totloop];
for (int j = 0; j < p->totloop; ++j) {
cface--;
mloop--;
const Imath::C4f &color = (*c4f_ptr)[mloop->v];
cface->a = FTOCHAR(color[0]);
cface->r = FTOCHAR(color[1]);
cface->g = FTOCHAR(color[2]);
cface->b = FTOCHAR(color[3]);
}
}
}
}
static void read_uvs(const CDStreamConfig &config, void *data,
const Alembic::AbcGeom::V2fArraySamplePtr &uvs,
@ -294,57 +252,108 @@ static void read_uvs(const CDStreamConfig &config, void *data,
}
}
static void read_custom_data_ex(const ICompoundProperty &prop,
const PropertyHeader &prop_header,
const CDStreamConfig &config,
const Alembic::Abc::ISampleSelector &iss,
int data_type)
static void read_custom_data_mcols(const ICompoundProperty &arbGeomParams,
const PropertyHeader &prop_header,
const CDStreamConfig &config,
const Alembic::Abc::ISampleSelector &iss)
{
if (data_type == CD_MLOOPCOL) {
C3fArraySamplePtr c3f_ptr = C3fArraySamplePtr();
C4fArraySamplePtr c4f_ptr = C4fArraySamplePtr();
C3fArraySamplePtr c3f_ptr = C3fArraySamplePtr();
C4fArraySamplePtr c4f_ptr = C4fArraySamplePtr();
bool use_c3f_ptr;
bool is_facevarying;
if (IC3fGeomParam::matches(prop_header)) {
IC3fGeomParam color_param(prop, prop_header.getName());
IC3fGeomParam::Sample sample;
color_param.getIndexed(sample, iss);
/* Find the correct interpretation of the data */
if (IC3fGeomParam::matches(prop_header)) {
IC3fGeomParam color_param(arbGeomParams, prop_header.getName());
IC3fGeomParam::Sample sample;
BLI_assert(!strcmp("rgb", color_param.getInterpretation()));
c3f_ptr = sample.getVals();
}
else if (IC4fGeomParam::matches(prop_header)) {
IC4fGeomParam color_param(prop, prop_header.getName());
IC4fGeomParam::Sample sample;
color_param.getIndexed(sample, iss);
color_param.getIndexed(sample, iss);
is_facevarying = sample.getScope() == kFacevaryingScope &&
config.totloop == sample.getIndices()->size();
c4f_ptr = sample.getVals();
}
void *cd_data = config.add_customdata_cb(config.user_data,
prop_header.getName().c_str(),
data_type);
read_mcols(config, cd_data, c3f_ptr, c4f_ptr);
c3f_ptr = sample.getVals();
use_c3f_ptr = true;
}
else if (data_type == CD_MLOOPUV) {
IV2fGeomParam uv_param(prop, prop_header.getName());
else if (IC4fGeomParam::matches(prop_header)) {
IC4fGeomParam color_param(arbGeomParams, prop_header.getName());
IC4fGeomParam::Sample sample;
BLI_assert(!strcmp("rgba", color_param.getInterpretation()));
if (!uv_param.isIndexed()) {
return;
}
color_param.getIndexed(sample, iss);
is_facevarying = sample.getScope() == kFacevaryingScope &&
config.totloop == sample.getIndices()->size();
IV2fGeomParam::Sample sample;
uv_param.getIndexed(sample, iss);
if (uv_param.getScope() != kFacevaryingScope) {
return;
}
void *cd_data = config.add_customdata_cb(config.user_data,
prop_header.getName().c_str(),
data_type);
read_uvs(config, cd_data, sample.getVals(), sample.getIndices());
c4f_ptr = sample.getVals();
use_c3f_ptr = false;
}
else {
/* this won't happen due to the checks in read_custom_data() */
return;
}
BLI_assert(c3f_ptr || c4f_ptr);
/* Read the vertex colors */
void *cd_data = config.add_customdata_cb(config.user_data,
prop_header.getName().c_str(),
CD_MLOOPCOL);
MCol *cfaces = static_cast<MCol *>(cd_data);
MPoly *mpolys = config.mpoly;
MLoop *mloops = config.mloop;
size_t face_index = 0;
size_t color_index;
for (int i = 0; i < config.totpoly; ++i) {
MPoly *poly = &mpolys[i];
MCol *cface = &cfaces[poly->loopstart + poly->totloop];
MLoop *mloop = &mloops[poly->loopstart + poly->totloop];
for (int j = 0; j < poly->totloop; ++j, ++face_index) {
--cface;
--mloop;
color_index = is_facevarying ? face_index : mloop->v;
if (use_c3f_ptr) {
const Imath::C3f &color = (*c3f_ptr)[color_index];
cface->a = FTOCHAR(color[0]);
cface->r = FTOCHAR(color[1]);
cface->g = FTOCHAR(color[2]);
cface->b = 255;
}
else {
const Imath::C4f &color = (*c4f_ptr)[color_index];
cface->a = FTOCHAR(color[0]);
cface->r = FTOCHAR(color[1]);
cface->g = FTOCHAR(color[2]);
cface->b = FTOCHAR(color[3]);
}
}
}
}
static void read_custom_data_uvs(const ICompoundProperty &prop,
const PropertyHeader &prop_header,
const CDStreamConfig &config,
const Alembic::Abc::ISampleSelector &iss)
{
IV2fGeomParam uv_param(prop, prop_header.getName());
if (!uv_param.isIndexed()) {
return;
}
IV2fGeomParam::Sample sample;
uv_param.getIndexed(sample, iss);
if (uv_param.getScope() != kFacevaryingScope) {
return;
}
void *cd_data = config.add_customdata_cb(config.user_data,
prop_header.getName().c_str(),
CD_MLOOPUV);
read_uvs(config, cd_data, sample.getVals(), sample.getIndices());
}
void read_custom_data(const ICompoundProperty &prop, const CDStreamConfig &config, const Alembic::Abc::ISampleSelector &iss)
@ -367,7 +376,7 @@ void read_custom_data(const ICompoundProperty &prop, const CDStreamConfig &confi
continue;
}
read_custom_data_ex(prop, prop_header, config, iss, CD_MLOOPUV);
read_custom_data_uvs(prop, prop_header, config, iss);
continue;
}
@ -377,7 +386,7 @@ void read_custom_data(const ICompoundProperty &prop, const CDStreamConfig &confi
continue;
}
read_custom_data_ex(prop, prop_header, config, iss, CD_MLOOPCOL);
read_custom_data_mcols(prop, prop_header, config, iss);
continue;
}
}

View File

@ -76,7 +76,7 @@ void AbcHairWriter::do_write()
return;
}
DerivedMesh *dm = mesh_create_derived_view(m_scene, m_object, CD_MASK_MESH);
DerivedMesh *dm = mesh_create_derived_render(m_scene, m_object, CD_MASK_MESH);
DM_ensure_tessface(dm);
std::vector<Imath::V3f> verts;
@ -251,44 +251,38 @@ void AbcHairWriter::write_hair_child_sample(DerivedMesh *dm,
for (int p = 0; p < m_psys->totchild; ++p, ++pc) {
path = cache[p];
if (part->from == PART_FROM_FACE) {
if (part->childtype == PART_CHILD_PARTICLES || !mtface) {
/* Face index is unknown for these particles, so just take info
* from the parent. */
uv_values.push_back(uv_values[pc->parent]);
norm_values.push_back(norm_values[pc->parent]);
if (part->from == PART_FROM_FACE &&
part->childtype != PART_CHILD_PARTICLES &&
mtface) {
const int num = pc->num;
if (num < 0) {
ABC_LOG(m_settings.logger)
<< "Warning, child particle of hair system " << m_psys->name
<< " has unknown face index of geometry of "<< (m_object->id.name + 2)
<< ", skipping child hair." << std::endl;
continue;
}
else {
const int num = pc->num;
if (num < 0) {
ABC_LOG(m_settings.logger)
<< "Warning, child particle of hair system " << m_psys->name
<< " has unknown face index of geometry of "<< (m_object->id.name + 2)
<< ", skipping child hair." << std::endl;
continue;
}
MFace *face = static_cast<MFace *>(dm->getTessFaceData(dm, num, CD_MFACE));
MTFace *tface = mtface + num;
MFace *face = static_cast<MFace *>(dm->getTessFaceData(dm, num, CD_MFACE));
MTFace *tface = mtface + num;
float r_uv[2], tmpnor[3], mapfw[4], vec[3];
float r_uv[2], tmpnor[3], mapfw[4], vec[3];
psys_interpolate_uvs(tface, face->v4, pc->fuv, r_uv);
uv_values.push_back(Imath::V2f(r_uv[0], r_uv[1]));
psys_interpolate_uvs(tface, face->v4, pc->fuv, r_uv);
uv_values.push_back(Imath::V2f(r_uv[0], r_uv[1]));
psys_interpolate_face(mverts, face, tface, NULL, mapfw, vec, tmpnor, NULL, NULL, NULL, NULL);
psys_interpolate_face(mverts, face, tface, NULL, mapfw, vec, tmpnor, NULL, NULL, NULL, NULL);
/* Convert Z-up to Y-up. */
norm_values.push_back(Imath::V3f(tmpnor[0], tmpnor[2], -tmpnor[1]));
}
/* Convert Z-up to Y-up. */
norm_values.push_back(Imath::V3f(tmpnor[0], tmpnor[2], -tmpnor[1]));
}
else {
ABC_LOG(m_settings.logger)
<< "Unknown particle type " << part->from
<< " for child hair of system " << m_psys->name
<< std::endl;
uv_values.push_back(uv_values[pc->parent]);
norm_values.push_back(norm_values[pc->parent]);
if (uv_values.size()) {
uv_values.push_back(uv_values[pc->parent]);
}
if (norm_values.size()) {
norm_values.push_back(norm_values[pc->parent]);
}
}
int steps = path->segments + 1;

View File

@ -916,8 +916,12 @@ static bool offset_meet_edge(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, float meetc
return false;
}
cross_v3_v3v3(fno, dir1, dir2);
if (dot_v3v3(fno, v->no) < 0.0f)
if (dot_v3v3(fno, v->no) < 0.0f) {
ang = 2.0f * (float)M_PI - ang; /* angle is reflex */
if (r_angle)
*r_angle = ang;
return false;
}
if (r_angle)
*r_angle = ang;

View File

@ -1964,7 +1964,7 @@ int ED_path_extension_type(const char *path)
else if (BLI_testextensie(path, ".py")) {
return FILE_TYPE_PYSCRIPT;
}
else if (BLI_testextensie_n(path, ".txt", ".glsl", ".osl", ".data", NULL)) {
else if (BLI_testextensie_n(path, ".txt", ".glsl", ".osl", ".data", ".pov", ".ini", ".mcr", ".inc", NULL)) {
return FILE_TYPE_TEXT;
}
else if (BLI_testextensie_n(path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", NULL)) {

View File

@ -56,16 +56,16 @@ static int txtfmt_pov_find_keyword(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "declare", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "default", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "end", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "error", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fclose", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fopen", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "for", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ifdef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ifndef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ifdef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "include", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "local", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "macro", len)) i = len;
@ -85,38 +85,27 @@ static int txtfmt_pov_find_keyword(const char *string)
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
}
static int txtfmt_pov_find_reserved(const char *string)
static int txtfmt_pov_find_reserved_keywords(const char *string)
{
int i, len;
/* POV-Ray Built-in Variables
* list is from...
* http://www.povray.org/documentation/view/3.7.0/212/
*/
if (STR_LITERAL_STARTSWITH(string, "clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock_on", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "frame_number", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "initial_clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "initial_frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_height", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "input_file_name", len)) i = len;
/* Language Keywords */
else if (STR_LITERAL_STARTSWITH(string, "aa_level", len)) i = len;
if (STR_LITERAL_STARTSWITH(string, "aa_level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aa_threshold", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "absorption", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "accuracy", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "adc_bailout", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "albedo", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "all", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "all_intersections", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "all", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "alpha", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "altitude", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "always_sample", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ambient", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ambient_light", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ambient", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "angle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "aperture", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "arc_angle", len)) i = len;
@ -144,8 +133,8 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "cutaway_textures", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "diffuse", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "direction", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dispersion", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dispersion_samples", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dispersion", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dist_exp", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "distance", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "eccentricity", len)) i = len;
@ -157,8 +146,8 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "exterior", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "extinction", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "face_indices", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "falloff", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "falloff_angle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "falloff", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "file_gamma", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "finish", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "flatness", len)) i = len;
@ -182,8 +171,8 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "internal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "intervals", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ior", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "irid", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "irid_wavelength", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "irid", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "load_file", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "location", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "look_at", len)) i = len;
@ -196,8 +185,8 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "max_intersections", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_iteration", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_sample", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_trace", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_trace_level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "max_trace", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "maximum_reuse", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "metallic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "method", len)) i = len;
@ -213,8 +202,8 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "orientation", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pass_through", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pattern", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "phong", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "phong_size", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "phong", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "point_at", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pot", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "precision", len)) i = len;
@ -229,8 +218,8 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "ratio", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "reciprocal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "recursion_limit", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "reflection", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "reflection_exponent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "reflection", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "refraction", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "repeat", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "right", len)) i = len;
@ -270,28 +259,48 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "vertex_vectors", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "water_level", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "width", len)) i = len;
/* Built-in Vectors */
else if (STR_LITERAL_STARTSWITH(string, "t", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "u", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "v", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "x", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "y", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "z", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "definate") no match */
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
}
static int txtfmt_pov_find_reserved_builtins(const char *string)
{
int i, len;
/* POV-Ray Built-in Variables
* list is from...
* http://www.povray.org/documentation/view/3.7.0/212/
*/
if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock_on", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "frame_number", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "initial_clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "initial_frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_height", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_width", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "input_file_name", len)) i = len;
/* Color Identifiers */
else if (STR_LITERAL_STARTSWITH(string, "blue", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "filter", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "gray", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "green", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "red", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgb", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgbf", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgbft", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgbf", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgbt", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "rgb", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "srgb", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sRGB", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "SRGB", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "srgbf", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "srgbft", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "srgbf", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "srgbt", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "transmit", len)) i = len;
/* Patterns */
@ -359,8 +368,8 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "light_group", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "light_source", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "merge", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mesh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mesh2", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "mesh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "object", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ovus", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "parametric", len)) i = len;
@ -374,8 +383,8 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "rainbow", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sky_sphere", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "smooth_triangle", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sphere", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sphere_sweep", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sphere", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "spline", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "superellipsoid", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sor", len)) i = len;
@ -424,6 +433,13 @@ static int txtfmt_pov_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "panoramic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "perspective", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ultra_wide_angle", len)) i = len;
/* Built-in Vectors */
else if (STR_LITERAL_STARTSWITH(string, "t", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "u", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "v", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "x", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "y", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "z", len)) i = len;
else i = 0;
@ -432,7 +448,6 @@ static int txtfmt_pov_find_reserved(const char *string)
}
/* Checks the specified source string for a POV modifiers. This
* name must start at the beginning of the source string and must be followed
* by a non-identifier (see text_check_identifier(char)) or null character.
@ -457,15 +472,15 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "circular", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clipped_by", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "color", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "color_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "colour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "color", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "colour_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "colour", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "control0", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "control1", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cubic_wave", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "density", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "density_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "density", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "double_illuminate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fade_color", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fade_colour", len)) i = len;
@ -475,15 +490,15 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "global_lights", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "hollow", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "image_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "interior", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "interior_texture", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "interior", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "interpolate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "inverse", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "jitter", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "lambda", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "map_type", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "material", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "material_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "material", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "matrix", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "media", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "media_attenuation", len)) i = len;
@ -496,8 +511,8 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "no_reflection", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "no_shadow", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "noise_generator", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "normal", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "octaves", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "omega", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "once", len)) i = len;
@ -505,8 +520,8 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "parallel", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "phase", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "photons", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pigment", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pigment_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "pigment", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "poly_wave", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "projected_through", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "quick_color", len)) i = len;
@ -519,8 +534,8 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "sine_wave", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "slope_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "subsurface", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "texture", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "texture_map", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "texture", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "transform", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "translate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "triangle_wave", len)) i = len;
@ -531,23 +546,41 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "uv_mapping", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "warp", len)) i = len;
/* Vector Functions */
else if (STR_LITERAL_STARTSWITH(string, "max_extent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "min_extent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "trace", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vaxis_rotate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vcross", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vnormalize", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vrotate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vturbulence", len)) i = len;
/* String Functions */
else if (STR_LITERAL_STARTSWITH(string, "chr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "concat", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "datetime", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "str", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strlwr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strupr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "substr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vstr", len)) i = len;
/* Float Functions */
else if (STR_LITERAL_STARTSWITH(string, "abs", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "acos", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "acosh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "acos", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "asc", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "asin", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "asinh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "atan", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "asin", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "atan2", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "atand", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "atanh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "atan", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bitwise_and", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bitwise_or", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "bitwise_xor", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ceil", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cos", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cosh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "cos", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "defined", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "degrees", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "dimension_size", len)) i = len;
@ -568,35 +601,17 @@ static int txtfmt_pov_find_specialvar(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "rand", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "seed", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "select", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sin", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sinh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sqr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sin", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sqrt", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "sqr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strcmp", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strlen", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tan", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tanh", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "tan", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "val", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vdot", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vlength", len)) i = len;
/* Vector Functions */
else if (STR_LITERAL_STARTSWITH(string, "max_extent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "min_extent", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "trace", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vaxis_rotate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vcross", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vnormalize", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vrotate", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vturbulence", len)) i = len;
/* String Functions */
else if (STR_LITERAL_STARTSWITH(string, "chr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "concat", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "datetime", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "str", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strlwr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "strupr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "substr", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "vstr", len)) i = len;
else i = 0;
/* If next source char is an identifier (eg. 'i' in "definate") no match */
@ -624,10 +639,11 @@ static int txtfmt_pov_find_bool(const char *string)
static char txtfmt_pov_format_identifier(const char *str)
{
char fmt;
if ((txtfmt_pov_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL;
else if ((txtfmt_pov_find_keyword(str)) != -1) fmt = FMT_TYPE_KEYWORD;
else if ((txtfmt_pov_find_reserved(str)) != -1) fmt = FMT_TYPE_RESERVED;
else fmt = FMT_TYPE_DEFAULT;
if ((txtfmt_pov_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL;
else if ((txtfmt_pov_find_keyword(str)) != -1) fmt = FMT_TYPE_KEYWORD;
else if ((txtfmt_pov_find_reserved_keywords(str)) != -1) fmt = FMT_TYPE_RESERVED;
else if ((txtfmt_pov_find_reserved_builtins(str)) != -1) fmt = FMT_TYPE_RESERVED;
else fmt = FMT_TYPE_DEFAULT;
return fmt;
}
@ -748,9 +764,10 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_
else {
/* Special vars(v) or built-in keywords(b) */
/* keep in sync with 'txtfmt_pov_format_identifier()' */
if ((i = txtfmt_pov_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL;
else if ((i = txtfmt_pov_find_keyword(str)) != -1) prev = FMT_TYPE_KEYWORD;
else if ((i = txtfmt_pov_find_reserved(str)) != -1) prev = FMT_TYPE_RESERVED;
if ((i = txtfmt_pov_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL;
else if ((i = txtfmt_pov_find_keyword(str)) != -1) prev = FMT_TYPE_KEYWORD;
else if ((i = txtfmt_pov_find_reserved_keywords(str)) != -1) prev = FMT_TYPE_RESERVED;
else if ((i = txtfmt_pov_find_reserved_builtins(str)) != -1) prev = FMT_TYPE_RESERVED;
if (i > 0) {
text_format_fill_ascii(&str, &fmt, prev, i);

View File

@ -56,16 +56,16 @@ static int txtfmt_ini_find_keyword(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "declare", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "default", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "end", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "error", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fclose", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "fopen", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "for", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ifdef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "ifndef", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "include", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "local", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "macro", len)) i = len;
@ -104,9 +104,9 @@ static int txtfmt_ini_find_reserved(const char *string)
* list is from...
* http://www.povray.org/documentation/view/3.7.0/212/
*/
if (STR_LITERAL_STARTSWITH(string, "clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) i = len;
if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock_on", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_clock", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "final_frame", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "frame_number", len)) i = len;
@ -127,13 +127,13 @@ static int txtfmt_ini_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "Start_Row", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "End_Column", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "End_Row", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Test_Abort", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Test_Abort_Count", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Test_Abort", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Continue_Trace", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Create_Continue_Trace_Log", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Create_Ini", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Display", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Display_Gamma", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Display", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Pause_When_Done", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Verbose", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Preview_Start_Size", len)) i = len;
@ -145,8 +145,8 @@ static int txtfmt_ini_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "Output_Alpha", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Bits_Per_Color", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Compression", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Dither", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Dither_Method", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Dither", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Pre_Scene_Command", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Pre_Frame_Command", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Post_Scene_Command", len)) i = len;
@ -174,11 +174,9 @@ static int txtfmt_ini_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "Statistic_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Warning_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "All_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "All_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "All_File", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Quality", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Bounding", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Bounding_Threshold", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Bounding", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Light_Buffer", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Vista_Buffer", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Remove_Bounds", len)) i = len;
@ -186,8 +184,8 @@ static int txtfmt_ini_find_reserved(const char *string)
else if (STR_LITERAL_STARTSWITH(string, "Antialias", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Sampling_Method", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Antialias_Threshold", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Jitter", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Jitter_Amount", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Jitter", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "Antialias_Depth", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "CheckNewVersion", len)) i = len;
else if (STR_LITERAL_STARTSWITH(string, "RunCount", len)) i = len;

View File

@ -1838,7 +1838,7 @@ static void object_simplify_update(Object *ob)
}
}
static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *sce = ptr->id.data;
Scene *sce_iter;
@ -1849,6 +1849,7 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), Poi
object_simplify_update(base->object);
WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
DAG_id_tag_update(&scene->id, 0);
}
static void rna_Scene_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)

View File

@ -31,7 +31,7 @@ import bpy
args = None
class SimpleImportTest(unittest.TestCase):
class AbstractAlembicTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.testdir = args.testdir
@ -43,6 +43,18 @@ class SimpleImportTest(unittest.TestCase):
# Make sure we always start with a known-empty file.
bpy.ops.wm.open_mainfile(filepath=str(self.testdir / "empty.blend"))
def assertAlmostEqualFloatArray(self, actual, expect, places=6, delta=None):
"""Asserts that the arrays of floats are almost equal."""
self.assertEqual(len(actual), len(expect),
'Actual array has %d items, expected %d' % (len(actual), len(expect)))
for idx, (act, exp) in enumerate(zip(actual, expect)):
self.assertAlmostEqual(act, exp, places=places, delta=delta,
msg='%f != %f at index %d' % (act, exp, idx))
class SimpleImportTest(AbstractAlembicTest):
def test_import_cube_hierarchy(self):
res = bpy.ops.wm.alembic_import(
filepath=str(self.testdir / "cubes-hierarchy.abc"),
@ -158,6 +170,38 @@ class SimpleImportTest(unittest.TestCase):
self.assertEqual('CubeShape', bpy.data.objects['Cube'].data.name)
class VertexColourImportTest(AbstractAlembicTest):
def test_import_from_houdini(self):
# Houdini saved "face-varying", and as RGB.
res = bpy.ops.wm.alembic_import(
filepath=str(self.testdir / "vertex-colours-houdini.abc"),
as_background_job=False)
self.assertEqual({'FINISHED'}, res)
ob = bpy.context.active_object
layer = ob.data.vertex_colors['Cf'] # MeshLoopColorLayer
# Test some known-good values.
self.assertAlmostEqualFloatArray(layer.data[0].color, (0, 0, 0))
self.assertAlmostEqualFloatArray(layer.data[98].color, (0.9019607, 0.4745098, 0.2666666))
self.assertAlmostEqualFloatArray(layer.data[99].color, (0.8941176, 0.4705882, 0.2627451))
def test_import_from_blender(self):
# Blender saved per-vertex, and as RGBA.
res = bpy.ops.wm.alembic_import(
filepath=str(self.testdir / "vertex-colours-blender.abc"),
as_background_job=False)
self.assertEqual({'FINISHED'}, res)
ob = bpy.context.active_object
layer = ob.data.vertex_colors['Cf'] # MeshLoopColorLayer
# Test some known-good values.
self.assertAlmostEqualFloatArray(layer.data[0].color, (1.0, 0.0156862, 0.3607843))
self.assertAlmostEqualFloatArray(layer.data[98].color, (0.0941176, 0.1215686, 0.9137254))
self.assertAlmostEqualFloatArray(layer.data[99].color, (0.1294117, 0.3529411, 0.7529411))
def main():
global args
import argparse