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:
authorCampbell Barton <ideasman42@gmail.com>2018-08-29 18:36:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-08-29 18:38:16 +0300
commit0efecba957eea45621c004217a76448f11f0376d (patch)
tree26a11c55c969a8c4389f9797f5e46b3d7ed186fc /source/blender
parent21105e1b1f1266a3846462588bdbe840d09758ea (diff)
parent39eb05161690510ecec4c30129a9f8d5532d39c9 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/pointcache.c179
-rw-r--r--source/blender/blenloader/intern/readfile.c594
-rw-r--r--source/blender/compositor/intern/COM_Debug.cpp3
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_render.c10
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c6
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c8
-rw-r--r--source/blender/editors/physics/particle_edit.c6
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp32
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp22
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp183
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp216
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp106
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp120
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp16
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp124
-rw-r--r--source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp3
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.h2
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp3
-rw-r--r--source/blender/makesrna/intern/rna_brush.c4
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c8
-rw-r--r--source/blender/render/intern/source/bake_api.c3
-rw-r--r--source/blender/render/intern/source/render_result.c3
-rw-r--r--source/blender/render/intern/source/render_texture.c358
23 files changed, 1029 insertions, 980 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index df3a87b0a99..81d645aac4b 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2996,117 +2996,116 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
/* clear all files in the temp dir with the prefix of the ID and the ".bphys" suffix */
switch (mode) {
- case PTCACHE_CLEAR_ALL:
- case PTCACHE_CLEAR_BEFORE:
- case PTCACHE_CLEAR_AFTER:
- if (pid->cache->flag & PTCACHE_DISK_CACHE) {
- ptcache_path(pid, path);
-
- dir = opendir(path);
- if (dir==NULL)
- return;
+ case PTCACHE_CLEAR_ALL:
+ case PTCACHE_CLEAR_BEFORE:
+ case PTCACHE_CLEAR_AFTER:
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
+ ptcache_path(pid, path);
+
+ dir = opendir(path);
+ if (dir==NULL)
+ return;
+
+ len = ptcache_filename(pid, filename, cfra, 0, 0); /* no path */
+ /* append underscore terminator to ensure we don't match similar names
+ * from objects whose names start with the same prefix
+ */
+ if (len < sizeof(filename) - 2) {
+ BLI_strncpy(filename + len, "_", sizeof(filename) - 2 - len);
+ len += 1;
+ }
- len = ptcache_filename(pid, filename, cfra, 0, 0); /* no path */
- /* append underscore terminator to ensure we don't match similar names
- * from objects whose names start with the same prefix
- */
- if (len < sizeof(filename) - 2) {
- BLI_strncpy(filename + len, "_", sizeof(filename) - 2 - len);
- len += 1;
- }
+ BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext);
- BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext);
-
- while ((de = readdir(dir)) != NULL) {
- if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
- if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */
- if (mode == PTCACHE_CLEAR_ALL) {
- pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
- BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
- BLI_delete(path_full, false, false);
- }
- else {
- /* read the number of the file */
- const int frame = ptcache_frame_from_filename(de->d_name, ext);
-
- if (frame != -1) {
- if ((mode == PTCACHE_CLEAR_BEFORE && frame < cfra) ||
- (mode == PTCACHE_CLEAR_AFTER && frame > cfra))
- {
-
- BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
- BLI_delete(path_full, false, false);
- if (pid->cache->cached_frames && frame >=sta && frame <= end)
- pid->cache->cached_frames[frame-sta] = 0;
+ while ((de = readdir(dir)) != NULL) {
+ if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
+ if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */
+ if (mode == PTCACHE_CLEAR_ALL) {
+ pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
+ BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
+ BLI_delete(path_full, false, false);
+ }
+ else {
+ /* read the number of the file */
+ const int frame = ptcache_frame_from_filename(de->d_name, ext);
+
+ if (frame != -1) {
+ if ((mode == PTCACHE_CLEAR_BEFORE && frame < cfra) ||
+ (mode == PTCACHE_CLEAR_AFTER && frame > cfra))
+ {
+ BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
+ BLI_delete(path_full, false, false);
+ if (pid->cache->cached_frames && frame >=sta && frame <= end)
+ pid->cache->cached_frames[frame-sta] = 0;
+ }
}
}
}
}
}
- }
- closedir(dir);
-
- if (mode == PTCACHE_CLEAR_ALL && pid->cache->cached_frames)
- memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames));
- }
- else {
- PTCacheMem *pm= pid->cache->mem_cache.first;
- PTCacheMem *link= NULL;
-
- if (mode == PTCACHE_CLEAR_ALL) {
- /*we want startframe if the cache starts before zero*/
- pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
- for (; pm; pm=pm->next) {
- ptcache_data_free(pm);
- ptcache_extra_free(pm);
- }
- BLI_freelistN(&pid->cache->mem_cache);
+ closedir(dir);
- if (pid->cache->cached_frames)
+ if (mode == PTCACHE_CLEAR_ALL && pid->cache->cached_frames)
memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames));
}
else {
- while (pm) {
- if ((mode == PTCACHE_CLEAR_BEFORE && pm->frame < cfra) ||
- (mode == PTCACHE_CLEAR_AFTER && pm->frame > cfra))
- {
- link = pm;
- if (pid->cache->cached_frames && pm->frame >=sta && pm->frame <= end)
- pid->cache->cached_frames[pm->frame-sta] = 0;
+ PTCacheMem *pm= pid->cache->mem_cache.first;
+ PTCacheMem *link= NULL;
+
+ if (mode == PTCACHE_CLEAR_ALL) {
+ /*we want startframe if the cache starts before zero*/
+ pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
+ for (; pm; pm=pm->next) {
ptcache_data_free(pm);
ptcache_extra_free(pm);
- pm = pm->next;
- BLI_freelinkN(&pid->cache->mem_cache, link);
}
- else
- pm = pm->next;
+ BLI_freelistN(&pid->cache->mem_cache);
+
+ if (pid->cache->cached_frames)
+ memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames));
+ }
+ else {
+ while (pm) {
+ if ((mode == PTCACHE_CLEAR_BEFORE && pm->frame < cfra) ||
+ (mode == PTCACHE_CLEAR_AFTER && pm->frame > cfra))
+ {
+ link = pm;
+ if (pid->cache->cached_frames && pm->frame >=sta && pm->frame <= end)
+ pid->cache->cached_frames[pm->frame-sta] = 0;
+ ptcache_data_free(pm);
+ ptcache_extra_free(pm);
+ pm = pm->next;
+ BLI_freelinkN(&pid->cache->mem_cache, link);
+ }
+ else
+ pm = pm->next;
+ }
}
}
- }
- break;
+ break;
- case PTCACHE_CLEAR_FRAME:
- if (pid->cache->flag & PTCACHE_DISK_CACHE) {
- if (BKE_ptcache_id_exist(pid, cfra)) {
- ptcache_filename(pid, filename, cfra, 1, 1); /* no path */
- BLI_delete(filename, false, false);
+ case PTCACHE_CLEAR_FRAME:
+ if (pid->cache->flag & PTCACHE_DISK_CACHE) {
+ if (BKE_ptcache_id_exist(pid, cfra)) {
+ ptcache_filename(pid, filename, cfra, 1, 1); /* no path */
+ BLI_delete(filename, false, false);
+ }
}
- }
- else {
- PTCacheMem *pm = pid->cache->mem_cache.first;
+ else {
+ PTCacheMem *pm = pid->cache->mem_cache.first;
- for (; pm; pm=pm->next) {
- if (pm->frame == cfra) {
- ptcache_data_free(pm);
- ptcache_extra_free(pm);
- BLI_freelinkN(&pid->cache->mem_cache, pm);
- break;
+ for (; pm; pm=pm->next) {
+ if (pm->frame == cfra) {
+ ptcache_data_free(pm);
+ ptcache_extra_free(pm);
+ BLI_freelinkN(&pid->cache->mem_cache, pm);
+ break;
+ }
}
}
- }
- if (pid->cache->cached_frames && cfra >= sta && cfra <= end)
- pid->cache->cached_frames[cfra-sta] = 0;
- break;
+ if (pid->cache->cached_frames && cfra >= sta && cfra <= end)
+ pid->cache->cached_frames[cfra-sta] = 0;
+ break;
}
BKE_ptcache_update_info(pid);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index fb9739d8842..1d030610bf2 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8125,32 +8125,32 @@ static void lib_link_linestyle(FileData *fd, Main *main)
for (m = linestyle->color_modifiers.first; m; m = m->next) {
switch (m->type) {
- case LS_MODIFIER_DISTANCE_FROM_OBJECT:
- {
- LineStyleColorModifier_DistanceFromObject *cm = (LineStyleColorModifier_DistanceFromObject *)m;
- cm->target = newlibadr(fd, linestyle->id.lib, cm->target);
- }
- break;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ {
+ LineStyleColorModifier_DistanceFromObject *cm = (LineStyleColorModifier_DistanceFromObject *)m;
+ cm->target = newlibadr(fd, linestyle->id.lib, cm->target);
+ }
+ break;
}
}
for (m = linestyle->alpha_modifiers.first; m; m = m->next) {
switch (m->type) {
- case LS_MODIFIER_DISTANCE_FROM_OBJECT:
- {
- LineStyleAlphaModifier_DistanceFromObject *am = (LineStyleAlphaModifier_DistanceFromObject *)m;
- am->target = newlibadr(fd, linestyle->id.lib, am->target);
- }
- break;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ {
+ LineStyleAlphaModifier_DistanceFromObject *am = (LineStyleAlphaModifier_DistanceFromObject *)m;
+ am->target = newlibadr(fd, linestyle->id.lib, am->target);
+ }
+ break;
}
}
for (m = linestyle->thickness_modifiers.first; m; m = m->next) {
switch (m->type) {
- case LS_MODIFIER_DISTANCE_FROM_OBJECT:
- {
- LineStyleThicknessModifier_DistanceFromObject *tm = (LineStyleThicknessModifier_DistanceFromObject *)m;
- tm->target = newlibadr(fd, linestyle->id.lib, tm->target);
- }
- break;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ {
+ LineStyleThicknessModifier_DistanceFromObject *tm = (LineStyleThicknessModifier_DistanceFromObject *)m;
+ tm->target = newlibadr(fd, linestyle->id.lib, tm->target);
+ }
+ break;
}
}
for (int a = 0; a < MAX_MTEX; a++) {
@@ -8173,171 +8173,171 @@ static void lib_link_linestyle(FileData *fd, Main *main)
static void direct_link_linestyle_color_modifier(FileData *fd, LineStyleModifier *modifier)
{
switch (modifier->type) {
- case LS_MODIFIER_ALONG_STROKE:
- {
- LineStyleColorModifier_AlongStroke *m = (LineStyleColorModifier_AlongStroke *)modifier;
- m->color_ramp = newdataadr(fd, m->color_ramp);
- }
- break;
- case LS_MODIFIER_DISTANCE_FROM_CAMERA:
- {
- LineStyleColorModifier_DistanceFromCamera *m = (LineStyleColorModifier_DistanceFromCamera *)modifier;
- m->color_ramp = newdataadr(fd, m->color_ramp);
- }
- break;
- case LS_MODIFIER_DISTANCE_FROM_OBJECT:
- {
- LineStyleColorModifier_DistanceFromObject *m = (LineStyleColorModifier_DistanceFromObject *)modifier;
- m->color_ramp = newdataadr(fd, m->color_ramp);
- }
- break;
- case LS_MODIFIER_MATERIAL:
- {
- LineStyleColorModifier_Material *m = (LineStyleColorModifier_Material *)modifier;
- m->color_ramp = newdataadr(fd, m->color_ramp);
- }
- break;
- case LS_MODIFIER_TANGENT:
- {
- LineStyleColorModifier_Tangent *m = (LineStyleColorModifier_Tangent *)modifier;
- m->color_ramp = newdataadr(fd, m->color_ramp);
- }
- break;
- case LS_MODIFIER_NOISE:
- {
- LineStyleColorModifier_Noise *m = (LineStyleColorModifier_Noise *)modifier;
- m->color_ramp = newdataadr(fd, m->color_ramp);
- }
- break;
- case LS_MODIFIER_CREASE_ANGLE:
- {
- LineStyleColorModifier_CreaseAngle *m = (LineStyleColorModifier_CreaseAngle *)modifier;
- m->color_ramp = newdataadr(fd, m->color_ramp);
- }
- break;
- case LS_MODIFIER_CURVATURE_3D:
- {
- LineStyleColorModifier_Curvature_3D *m = (LineStyleColorModifier_Curvature_3D *)modifier;
- m->color_ramp = newdataadr(fd, m->color_ramp);
- }
- break;
+ case LS_MODIFIER_ALONG_STROKE:
+ {
+ LineStyleColorModifier_AlongStroke *m = (LineStyleColorModifier_AlongStroke *)modifier;
+ m->color_ramp = newdataadr(fd, m->color_ramp);
+ }
+ break;
+ case LS_MODIFIER_DISTANCE_FROM_CAMERA:
+ {
+ LineStyleColorModifier_DistanceFromCamera *m = (LineStyleColorModifier_DistanceFromCamera *)modifier;
+ m->color_ramp = newdataadr(fd, m->color_ramp);
+ }
+ break;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ {
+ LineStyleColorModifier_DistanceFromObject *m = (LineStyleColorModifier_DistanceFromObject *)modifier;
+ m->color_ramp = newdataadr(fd, m->color_ramp);
+ }
+ break;
+ case LS_MODIFIER_MATERIAL:
+ {
+ LineStyleColorModifier_Material *m = (LineStyleColorModifier_Material *)modifier;
+ m->color_ramp = newdataadr(fd, m->color_ramp);
+ }
+ break;
+ case LS_MODIFIER_TANGENT:
+ {
+ LineStyleColorModifier_Tangent *m = (LineStyleColorModifier_Tangent *)modifier;
+ m->color_ramp = newdataadr(fd, m->color_ramp);
+ }
+ break;
+ case LS_MODIFIER_NOISE:
+ {
+ LineStyleColorModifier_Noise *m = (LineStyleColorModifier_Noise *)modifier;
+ m->color_ramp = newdataadr(fd, m->color_ramp);
+ }
+ break;
+ case LS_MODIFIER_CREASE_ANGLE:
+ {
+ LineStyleColorModifier_CreaseAngle *m = (LineStyleColorModifier_CreaseAngle *)modifier;
+ m->color_ramp = newdataadr(fd, m->color_ramp);
+ }
+ break;
+ case LS_MODIFIER_CURVATURE_3D:
+ {
+ LineStyleColorModifier_Curvature_3D *m = (LineStyleColorModifier_Curvature_3D *)modifier;
+ m->color_ramp = newdataadr(fd, m->color_ramp);
+ }
+ break;
}
}
static void direct_link_linestyle_alpha_modifier(FileData *fd, LineStyleModifier *modifier)
{
switch (modifier->type) {
- case LS_MODIFIER_ALONG_STROKE:
- {
- LineStyleAlphaModifier_AlongStroke *m = (LineStyleAlphaModifier_AlongStroke *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_DISTANCE_FROM_CAMERA:
- {
- LineStyleAlphaModifier_DistanceFromCamera *m = (LineStyleAlphaModifier_DistanceFromCamera *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_DISTANCE_FROM_OBJECT:
- {
- LineStyleAlphaModifier_DistanceFromObject *m = (LineStyleAlphaModifier_DistanceFromObject *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_MATERIAL:
- {
- LineStyleAlphaModifier_Material *m = (LineStyleAlphaModifier_Material *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_TANGENT:
- {
- LineStyleAlphaModifier_Tangent *m = (LineStyleAlphaModifier_Tangent *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_NOISE:
- {
- LineStyleAlphaModifier_Noise *m = (LineStyleAlphaModifier_Noise *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_CREASE_ANGLE:
- {
- LineStyleAlphaModifier_CreaseAngle *m = (LineStyleAlphaModifier_CreaseAngle *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_CURVATURE_3D:
- {
- LineStyleAlphaModifier_Curvature_3D *m = (LineStyleAlphaModifier_Curvature_3D *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
+ case LS_MODIFIER_ALONG_STROKE:
+ {
+ LineStyleAlphaModifier_AlongStroke *m = (LineStyleAlphaModifier_AlongStroke *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_DISTANCE_FROM_CAMERA:
+ {
+ LineStyleAlphaModifier_DistanceFromCamera *m = (LineStyleAlphaModifier_DistanceFromCamera *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ {
+ LineStyleAlphaModifier_DistanceFromObject *m = (LineStyleAlphaModifier_DistanceFromObject *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_MATERIAL:
+ {
+ LineStyleAlphaModifier_Material *m = (LineStyleAlphaModifier_Material *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_TANGENT:
+ {
+ LineStyleAlphaModifier_Tangent *m = (LineStyleAlphaModifier_Tangent *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_NOISE:
+ {
+ LineStyleAlphaModifier_Noise *m = (LineStyleAlphaModifier_Noise *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_CREASE_ANGLE:
+ {
+ LineStyleAlphaModifier_CreaseAngle *m = (LineStyleAlphaModifier_CreaseAngle *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_CURVATURE_3D:
+ {
+ LineStyleAlphaModifier_Curvature_3D *m = (LineStyleAlphaModifier_Curvature_3D *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
}
}
static void direct_link_linestyle_thickness_modifier(FileData *fd, LineStyleModifier *modifier)
{
switch (modifier->type) {
- case LS_MODIFIER_ALONG_STROKE:
- {
- LineStyleThicknessModifier_AlongStroke *m = (LineStyleThicknessModifier_AlongStroke *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_DISTANCE_FROM_CAMERA:
- {
- LineStyleThicknessModifier_DistanceFromCamera *m = (LineStyleThicknessModifier_DistanceFromCamera *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_DISTANCE_FROM_OBJECT:
- {
- LineStyleThicknessModifier_DistanceFromObject *m = (LineStyleThicknessModifier_DistanceFromObject *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_MATERIAL:
- {
- LineStyleThicknessModifier_Material *m = (LineStyleThicknessModifier_Material *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_TANGENT:
- {
- LineStyleThicknessModifier_Tangent *m = (LineStyleThicknessModifier_Tangent *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_CREASE_ANGLE:
- {
- LineStyleThicknessModifier_CreaseAngle *m = (LineStyleThicknessModifier_CreaseAngle *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
- case LS_MODIFIER_CURVATURE_3D:
- {
- LineStyleThicknessModifier_Curvature_3D *m = (LineStyleThicknessModifier_Curvature_3D *)modifier;
- m->curve = newdataadr(fd, m->curve);
- direct_link_curvemapping(fd, m->curve);
- }
- break;
+ case LS_MODIFIER_ALONG_STROKE:
+ {
+ LineStyleThicknessModifier_AlongStroke *m = (LineStyleThicknessModifier_AlongStroke *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_DISTANCE_FROM_CAMERA:
+ {
+ LineStyleThicknessModifier_DistanceFromCamera *m = (LineStyleThicknessModifier_DistanceFromCamera *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ {
+ LineStyleThicknessModifier_DistanceFromObject *m = (LineStyleThicknessModifier_DistanceFromObject *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_MATERIAL:
+ {
+ LineStyleThicknessModifier_Material *m = (LineStyleThicknessModifier_Material *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_TANGENT:
+ {
+ LineStyleThicknessModifier_Tangent *m = (LineStyleThicknessModifier_Tangent *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_CREASE_ANGLE:
+ {
+ LineStyleThicknessModifier_CreaseAngle *m = (LineStyleThicknessModifier_CreaseAngle *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
+ case LS_MODIFIER_CURVATURE_3D:
+ {
+ LineStyleThicknessModifier_Curvature_3D *m = (LineStyleThicknessModifier_Curvature_3D *)modifier;
+ m->curve = newdataadr(fd, m->curve);
+ direct_link_curvemapping(fd, m->curve);
+ }
+ break;
}
}
@@ -8991,49 +8991,49 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
while (bhead) {
switch (bhead->code) {
- case DATA:
- case DNA1:
- case TEST: /* used as preview since 2.5x */
- case REND:
- bhead = blo_nextbhead(fd, bhead);
- break;
- case GLOB:
- bhead = read_global(bfd, fd, bhead);
- break;
- case USER:
- if (fd->skip_flags & BLO_READ_SKIP_USERDEF) {
+ case DATA:
+ case DNA1:
+ case TEST: /* used as preview since 2.5x */
+ case REND:
bhead = blo_nextbhead(fd, bhead);
- }
- else {
- bhead = read_userdef(bfd, fd, bhead);
- }
- break;
- case ENDB:
- bhead = NULL;
- break;
+ break;
+ case GLOB:
+ bhead = read_global(bfd, fd, bhead);
+ break;
+ case USER:
+ if (fd->skip_flags & BLO_READ_SKIP_USERDEF) {
+ bhead = blo_nextbhead(fd, bhead);
+ }
+ else {
+ bhead = read_userdef(bfd, fd, bhead);
+ }
+ break;
+ case ENDB:
+ bhead = NULL;
+ break;
- case ID_ID:
- /* Always adds to the most recently loaded ID_LI block, see direct_link_library.
- * This is part of the file format definition. */
- if (fd->skip_flags & BLO_READ_SKIP_DATA) {
- bhead = blo_nextbhead(fd, bhead);
- }
- else {
- bhead = read_libblock(fd, mainlist.last, bhead, LIB_TAG_READ | LIB_TAG_EXTERN, NULL);
- }
- break;
- /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
- case ID_SCRN:
- bhead->code = ID_SCR;
- /* pass on to default */
- ATTR_FALLTHROUGH;
- default:
- if (fd->skip_flags & BLO_READ_SKIP_DATA) {
- bhead = blo_nextbhead(fd, bhead);
- }
- else {
- bhead = read_libblock(fd, bfd->main, bhead, LIB_TAG_LOCAL, NULL);
- }
+ case ID_ID:
+ /* Always adds to the most recently loaded ID_LI block, see direct_link_library.
+ * This is part of the file format definition. */
+ if (fd->skip_flags & BLO_READ_SKIP_DATA) {
+ bhead = blo_nextbhead(fd, bhead);
+ }
+ else {
+ bhead = read_libblock(fd, mainlist.last, bhead, LIB_TAG_READ | LIB_TAG_EXTERN, NULL);
+ }
+ break;
+ /* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
+ case ID_SCRN:
+ bhead->code = ID_SCR;
+ /* pass on to default */
+ ATTR_FALLTHROUGH;
+ default:
+ if (fd->skip_flags & BLO_READ_SKIP_DATA) {
+ bhead = blo_nextbhead(fd, bhead);
+ }
+ else {
+ bhead = read_libblock(fd, bfd->main, bhead, LIB_TAG_LOCAL, NULL);
+ }
}
}
@@ -10138,91 +10138,91 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
expand_idprops(fd, mainvar, id->properties);
switch (GS(id->name)) {
- case ID_OB:
- expand_object(fd, mainvar, (Object *)id);
- break;
- case ID_ME:
- expand_mesh(fd, mainvar, (Mesh *)id);
- break;
- case ID_CU:
- expand_curve(fd, mainvar, (Curve *)id);
- break;
- case ID_MB:
- expand_mball(fd, mainvar, (MetaBall *)id);
- break;
- case ID_SCE:
- expand_scene(fd, mainvar, (Scene *)id);
- break;
- case ID_MA:
- expand_material(fd, mainvar, (Material *)id);
- break;
- case ID_TE:
- expand_texture(fd, mainvar, (Tex *)id);
- break;
- case ID_WO:
- expand_world(fd, mainvar, (World *)id);
- break;
- case ID_LT:
- expand_lattice(fd, mainvar, (Lattice *)id);
- break;
- case ID_LA:
- expand_lamp(fd, mainvar, (Lamp *)id);
- break;
- case ID_KE:
- expand_key(fd, mainvar, (Key *)id);
- break;
- case ID_CA:
- expand_camera(fd, mainvar, (Camera *)id);
- break;
- case ID_SPK:
- expand_speaker(fd, mainvar, (Speaker *)id);
- break;
- case ID_SO:
- expand_sound(fd, mainvar, (bSound *)id);
- break;
- case ID_LP:
- expand_lightprobe(fd, mainvar, (LightProbe *)id);
- break;
- case ID_AR:
- expand_armature(fd, mainvar, (bArmature *)id);
- break;
- case ID_AC:
- expand_action(fd, mainvar, (bAction *)id); // XXX deprecated - old animation system
- break;
- case ID_GR:
- expand_collection(fd, mainvar, (Collection *)id);
- break;
- case ID_NT:
- expand_nodetree(fd, mainvar, (bNodeTree *)id);
- break;
- case ID_BR:
- expand_brush(fd, mainvar, (Brush *)id);
- break;
- case ID_IP:
- expand_ipo(fd, mainvar, (Ipo *)id); // XXX deprecated - old animation system
- break;
- case ID_PA:
- expand_particlesettings(fd, mainvar, (ParticleSettings *)id);
- break;
- case ID_MC:
- expand_movieclip(fd, mainvar, (MovieClip *)id);
- break;
- case ID_MSK:
- expand_mask(fd, mainvar, (Mask *)id);
- break;
- case ID_LS:
- expand_linestyle(fd, mainvar, (FreestyleLineStyle *)id);
- break;
- case ID_GD:
- expand_gpencil(fd, mainvar, (bGPdata *)id);
- break;
- case ID_CF:
- expand_cachefile(fd, mainvar, (CacheFile *)id);
- break;
- case ID_WS:
- expand_workspace(fd, mainvar, (WorkSpace *)id);
- default:
- break;
+ case ID_OB:
+ expand_object(fd, mainvar, (Object *)id);
+ break;
+ case ID_ME:
+ expand_mesh(fd, mainvar, (Mesh *)id);
+ break;
+ case ID_CU:
+ expand_curve(fd, mainvar, (Curve *)id);
+ break;
+ case ID_MB:
+ expand_mball(fd, mainvar, (MetaBall *)id);
+ break;
+ case ID_SCE:
+ expand_scene(fd, mainvar, (Scene *)id);
+ break;
+ case ID_MA:
+ expand_material(fd, mainvar, (Material *)id);
+ break;
+ case ID_TE:
+ expand_texture(fd, mainvar, (Tex *)id);
+ break;
+ case ID_WO:
+ expand_world(fd, mainvar, (World *)id);
+ break;
+ case ID_LT:
+ expand_lattice(fd, mainvar, (Lattice *)id);
+ break;
+ case ID_LA:
+ expand_lamp(fd, mainvar, (Lamp *)id);
+ break;
+ case ID_KE:
+ expand_key(fd, mainvar, (Key *)id);
+ break;
+ case ID_CA:
+ expand_camera(fd, mainvar, (Camera *)id);
+ break;
+ case ID_SPK:
+ expand_speaker(fd, mainvar, (Speaker *)id);
+ break;
+ case ID_SO:
+ expand_sound(fd, mainvar, (bSound *)id);
+ break;
+ case ID_LP:
+ expand_lightprobe(fd, mainvar, (LightProbe *)id);
+ break;
+ case ID_AR:
+ expand_armature(fd, mainvar, (bArmature *)id);
+ break;
+ case ID_AC:
+ expand_action(fd, mainvar, (bAction *)id); // XXX deprecated - old animation system
+ break;
+ case ID_GR:
+ expand_collection(fd, mainvar, (Collection *)id);
+ break;
+ case ID_NT:
+ expand_nodetree(fd, mainvar, (bNodeTree *)id);
+ break;
+ case ID_BR:
+ expand_brush(fd, mainvar, (Brush *)id);
+ break;
+ case ID_IP:
+ expand_ipo(fd, mainvar, (Ipo *)id); // XXX deprecated - old animation system
+ break;
+ case ID_PA:
+ expand_particlesettings(fd, mainvar, (ParticleSettings *)id);
+ break;
+ case ID_MC:
+ expand_movieclip(fd, mainvar, (MovieClip *)id);
+ break;
+ case ID_MSK:
+ expand_mask(fd, mainvar, (Mask *)id);
+ break;
+ case ID_LS:
+ expand_linestyle(fd, mainvar, (FreestyleLineStyle *)id);
+ break;
+ case ID_GD:
+ expand_gpencil(fd, mainvar, (bGPdata *)id);
+ break;
+ case ID_CF:
+ expand_cachefile(fd, mainvar, (CacheFile *)id);
+ break;
+ case ID_WS:
+ expand_workspace(fd, mainvar, (WorkSpace *)id);
+ default:
+ break;
}
do_it = true;
diff --git a/source/blender/compositor/intern/COM_Debug.cpp b/source/blender/compositor/intern/COM_Debug.cpp
index 6179bd26275..45c51bf1c98 100644
--- a/source/blender/compositor/intern/COM_Debug.cpp
+++ b/source/blender/compositor/intern/COM_Debug.cpp
@@ -274,7 +274,8 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma
#if 0
for (ExecutionSystem::Operations::const_iterator it = system->m_operations.begin();
- it != system->m_operations.end(); ++it) {
+ it != system->m_operations.end(); ++it)
+ {
NodeOperation *op = *it;
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// OPERATION: %s\r\n", node->getbNode()->typeinfo->ui_name);
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_render.c b/source/blender/draw/engines/gpencil/gpencil_render.c
index 0b90de88ec1..3aa94c346df 100644
--- a/source/blender/draw/engines/gpencil/gpencil_render.c
+++ b/source/blender/draw/engines/gpencil/gpencil_render.c
@@ -143,12 +143,12 @@ static void GPENCIL_render_cache(
static void GPENCIL_render_update_viewvecs(float invproj[4][4], float winmat[4][4], float(*r_viewvecs)[4])
{
/* view vectors for the corners of the view frustum.
- * Can be used to recreate the world space position easily */
+ * Can be used to recreate the world space position easily */
float view_vecs[4][4] = {
- { -1.0f, -1.0f, -1.0f, 1.0f },
- { 1.0f, -1.0f, -1.0f, 1.0f },
- { -1.0f, 1.0f, -1.0f, 1.0f },
- { -1.0f, -1.0f, 1.0f, 1.0f }
+ {-1.0f, -1.0f, -1.0f, 1.0f},
+ {1.0f, -1.0f, -1.0f, 1.0f},
+ {-1.0f, 1.0f, -1.0f, 1.0f},
+ {-1.0f, -1.0f, 1.0f, 1.0f}
};
/* convert the view vectors to view space */
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 548294df388..3321bec3846 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -683,9 +683,9 @@ static int gp_frame_clean_fill_exec(bContext *C, wmOperator *op)
void GPENCIL_OT_frame_clean_fill(wmOperatorType *ot)
{
static const EnumPropertyItem duplicate_mode[] = {
- { GP_FRAME_CLEAN_FILL_ACTIVE, "ACTIVE", 0, "Active Frame Only", "Clean active frame only" },
- { GP_FRAME_CLEAN_FILL_ALL, "ALL", 0, "All Frames", "Clean all frames in all layers" },
- { 0, NULL, 0, NULL, NULL }
+ {GP_FRAME_CLEAN_FILL_ACTIVE, "ACTIVE", 0, "Active Frame Only", "Clean active frame only"},
+ {GP_FRAME_CLEAN_FILL_ALL, "ALL", 0, "All Frames", "Clean all frames in all layers"},
+ {0, NULL, 0, NULL, NULL}
};
/* identifiers */
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index df786b4e675..3b2404415a7 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3330,10 +3330,10 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
void GPENCIL_OT_stroke_separate(wmOperatorType *ot)
{
static const EnumPropertyItem separate_type[] = {
- {GP_SEPARATE_POINT, "POINT", 0, "Selected Points", "Separate the selected points" },
- {GP_SEPARATE_STROKE, "STROKE", 0, "Selected Strokes", "Separate the selected strokes"},
- {GP_SEPARATE_LAYER, "LAYER", 0, "Active Layer", "Separate the strokes of the current layer" },
- { 0, NULL, 0, NULL, NULL }
+ {GP_SEPARATE_POINT, "POINT", 0, "Selected Points", "Separate the selected points"},
+ {GP_SEPARATE_STROKE, "STROKE", 0, "Selected Strokes", "Separate the selected strokes"},
+ {GP_SEPARATE_LAYER, "LAYER", 0, "Active Layer", "Separate the strokes of the current layer"},
+ {0, NULL, 0, NULL, NULL}
};
/* identifiers */
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index f73cdc30292..9c7c9fde066 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3764,7 +3764,8 @@ static void brush_add_count_iter(
&min_d,
&add_pars[iter].num_dmcache,
add_pars[iter].fuv,
- 0, 0, 0, 0)) {
+ 0, 0, 0, 0))
+ {
if (psys->part->use_modifier_stack && !psmd_eval->mesh_final->runtime.deformed_only) {
add_pars[iter].num = add_pars[iter].num_dmcache;
add_pars[iter].num_dmcache = DMCACHE_ISCHILD;
@@ -4645,7 +4646,8 @@ int PE_minmax(Scene *scene, ViewLayer *view_layer, float min[3], float max[3])
static struct ParticleSystem *psys_eval_get(
Depsgraph *depsgraph,
Object *object,
- ParticleSystem *psys){
+ ParticleSystem *psys)
+{
Object *object_eval = DEG_get_evaluated_object(depsgraph, object);
if (object_eval == object) {
return psys;
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index e57d004e503..a0b97b817fd 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -164,24 +164,24 @@ int BlenderFileLoader::countClippedFaces(float v1[3], float v2[3], float v3[3],
sum += clip[i];
}
switch (numClipped) {
- case 0:
- numTris = 1; // triangle
- break;
- case 1:
- numTris = 2; // tetragon
- break;
- case 2:
- if (sum == 0)
- numTris = 3; // pentagon
- else
+ case 0:
numTris = 1; // triangle
- break;
- case 3:
- if (sum == 3 || sum == -3)
- numTris = 0;
- else
+ break;
+ case 1:
numTris = 2; // tetragon
- break;
+ break;
+ case 2:
+ if (sum == 0)
+ numTris = 3; // pentagon
+ else
+ numTris = 1; // triangle
+ break;
+ case 3:
+ if (sum == 3 || sum == -3)
+ numTris = 0;
+ else
+ numTris = 2; // tetragon
+ break;
}
return numTris;
}
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index a21b3aa7387..07776bfc1b7 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -193,17 +193,17 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer()
}
#endif
switch (ob->type) {
- case OB_MESH:
- BKE_libblock_free(freestyle_bmain, ob);
- BKE_libblock_free(freestyle_bmain, data);
- break;
- case OB_CAMERA:
- BKE_libblock_free(freestyle_bmain, ob);
- BKE_libblock_free(freestyle_bmain, data);
- freestyle_scene->camera = NULL;
- break;
- default:
- cerr << "Warning: unexpected object in the scene: " << name[0] << name[1] << ":" << (name + 2) << endl;
+ case OB_MESH:
+ BKE_libblock_free(freestyle_bmain, ob);
+ BKE_libblock_free(freestyle_bmain, data);
+ break;
+ case OB_CAMERA:
+ BKE_libblock_free(freestyle_bmain, ob);
+ BKE_libblock_free(freestyle_bmain, data);
+ freestyle_scene->camera = NULL;
+ break;
+ default:
+ cerr << "Warning: unexpected object in the scene: " << name[0] << name[1] << ":" << (name + 2) << endl;
}
}
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 858f6771a45..21b4411fe79 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -147,12 +147,12 @@ static void init_view(Render *re)
float thickness = 1.0f;
switch (re->r.line_thickness_mode) {
- case R_LINE_THICKNESS_ABSOLUTE:
- thickness = re->r.unit_line_thickness * (re->r.size / 100.f);
- break;
- case R_LINE_THICKNESS_RELATIVE:
- thickness = height / 480.f;
- break;
+ case R_LINE_THICKNESS_ABSOLUTE:
+ thickness = re->r.unit_line_thickness * (re->r.size / 100.f);
+ break;
+ case R_LINE_THICKNESS_RELATIVE:
+ thickness = height / 480.f;
+ break;
}
g_freestyle.viewport[0] = g_freestyle.viewport[1] = 0;
@@ -303,25 +303,9 @@ static void prepare(Render *re, ViewLayer *view_layer)
int layer_count = 0;
switch (config->mode) {
- case FREESTYLE_CONTROL_SCRIPT_MODE:
- if (G.debug & G_DEBUG_FREESTYLE) {
- cout << "Modules :" << endl;
- }
- for (FreestyleModuleConfig *module_conf = (FreestyleModuleConfig *)config->modules.first;
- module_conf;
- module_conf = module_conf->next)
- {
- if (module_conf->script && module_conf->is_displayed) {
- const char *id_name = module_conf->script->id.name + 2;
- if (G.debug & G_DEBUG_FREESTYLE) {
- cout << " " << layer_count + 1 << ": " << id_name;
- if (module_conf->script->name)
- cout << " (" << module_conf->script->name << ")";
- cout << endl;
- }
- controller->InsertStyleModule(layer_count, id_name, module_conf->script);
- controller->toggleLayer(layer_count, true);
- layer_count++;
+ case FREESTYLE_CONTROL_SCRIPT_MODE:
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Modules :" << endl;
}
}
if (G.debug & G_DEBUG_FREESTYLE) {
@@ -378,40 +362,99 @@ static void prepare(Render *re, ViewLayer *view_layer)
else
conditions[i].value = -1; // condition: NOT X
}
- // logical operator for the selection conditions
- bool logical_and = ((lineset->flags & FREESTYLE_LINESET_FE_AND) != 0);
- // negation operator
- if (lineset->flags & FREESTYLE_LINESET_FE_NOT) {
- // convert an Exclusive condition into an Inclusive equivalent using De Morgan's laws:
- // NOT (X OR Y) --> (NOT X) AND (NOT Y)
- // NOT (X AND Y) --> (NOT X) OR (NOT Y)
- for (int i = 0; i < num_edge_types; i++)
- conditions[i].value *= -1;
- logical_and = !logical_and;
+ controller->InsertStyleModule(layer_count, id_name, module_conf->script);
+ controller->toggleLayer(layer_count, true);
+ layer_count++;
+ }
+ }
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << endl;
+ }
+ controller->setComputeRidgesAndValleysFlag((config->flags & FREESTYLE_RIDGES_AND_VALLEYS_FLAG) ? true : false);
+ controller->setComputeSuggestiveContoursFlag((config->flags & FREESTYLE_SUGGESTIVE_CONTOURS_FLAG) ? true : false);
+ controller->setComputeMaterialBoundariesFlag((config->flags & FREESTYLE_MATERIAL_BOUNDARIES_FLAG) ? true : false);
+ break;
+ case FREESTYLE_CONTROL_EDITOR_MODE:
+ int use_ridges_and_valleys = 0;
+ int use_suggestive_contours = 0;
+ int use_material_boundaries = 0;
+ struct edge_type_condition conditions[] = {
+ {FREESTYLE_FE_SILHOUETTE, 0},
+ {FREESTYLE_FE_BORDER, 0},
+ {FREESTYLE_FE_CREASE, 0},
+ {FREESTYLE_FE_RIDGE_VALLEY, 0},
+ {FREESTYLE_FE_SUGGESTIVE_CONTOUR, 0},
+ {FREESTYLE_FE_MATERIAL_BOUNDARY, 0},
+ {FREESTYLE_FE_CONTOUR, 0},
+ {FREESTYLE_FE_EXTERNAL_CONTOUR, 0},
+ {FREESTYLE_FE_EDGE_MARK, 0}
+ };
+ int num_edge_types = sizeof(conditions) / sizeof(struct edge_type_condition);
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Linesets:" << endl;
+ }
+ for (FreestyleLineSet *lineset = (FreestyleLineSet *)config->linesets.first;
+ lineset;
+ lineset = lineset->next)
+ {
+ if (lineset->flags & FREESTYLE_LINESET_ENABLED) {
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << " " << layer_count+1 << ": " << lineset->name << " - " <<
+ (lineset->linestyle ? (lineset->linestyle->id.name + 2) : "<NULL>") << endl;
}
- if (test_edge_type_conditions(conditions, num_edge_types, logical_and,
- FREESTYLE_FE_RIDGE_VALLEY, true))
- {
+ char *buffer = create_lineset_handler(srl->name, lineset->name);
+ controller->InsertStyleModule(layer_count, lineset->name, buffer);
+ controller->toggleLayer(layer_count, true);
+ MEM_freeN(buffer);
+ if (!(lineset->selection & FREESTYLE_SEL_EDGE_TYPES) || !lineset->edge_types) {
++use_ridges_and_valleys;
- }
- if (test_edge_type_conditions(conditions, num_edge_types, logical_and,
- FREESTYLE_FE_SUGGESTIVE_CONTOUR, true))
- {
++use_suggestive_contours;
- }
- if (test_edge_type_conditions(conditions, num_edge_types, logical_and,
- FREESTYLE_FE_MATERIAL_BOUNDARY, true))
- {
++use_material_boundaries;
}
+ else {
+ // conditions for feature edge selection by edge types
+ for (int i = 0; i < num_edge_types; i++) {
+ if (!(lineset->edge_types & conditions[i].edge_type))
+ conditions[i].value = 0; // no condition specified
+ else if (!(lineset->exclude_edge_types & conditions[i].edge_type))
+ conditions[i].value = 1; // condition: X
+ else
+ conditions[i].value = -1; // condition: NOT X
+ }
+ // logical operator for the selection conditions
+ bool logical_and = ((lineset->flags & FREESTYLE_LINESET_FE_AND) != 0);
+ // negation operator
+ if (lineset->flags & FREESTYLE_LINESET_FE_NOT) {
+ // convert an Exclusive condition into an Inclusive equivalent using De Morgan's laws:
+ // NOT (X OR Y) --> (NOT X) AND (NOT Y)
+ // NOT (X AND Y) --> (NOT X) OR (NOT Y)
+ for (int i = 0; i < num_edge_types; i++)
+ conditions[i].value *= -1;
+ logical_and = !logical_and;
+ }
+ if (test_edge_type_conditions(conditions, num_edge_types, logical_and,
+ FREESTYLE_FE_RIDGE_VALLEY, true))
+ {
+ ++use_ridges_and_valleys;
+ }
+ if (test_edge_type_conditions(conditions, num_edge_types, logical_and,
+ FREESTYLE_FE_SUGGESTIVE_CONTOUR, true))
+ {
+ ++use_suggestive_contours;
+ }
+ if (test_edge_type_conditions(conditions, num_edge_types, logical_and,
+ FREESTYLE_FE_MATERIAL_BOUNDARY, true))
+ {
+ ++use_material_boundaries;
+ }
+ }
+ layer_count++;
}
- layer_count++;
}
- }
- controller->setComputeRidgesAndValleysFlag(use_ridges_and_valleys > 0);
- controller->setComputeSuggestiveContoursFlag(use_suggestive_contours > 0);
- controller->setComputeMaterialBoundariesFlag(use_material_boundaries > 0);
- break;
+ controller->setComputeRidgesAndValleysFlag(use_ridges_and_valleys > 0);
+ controller->setComputeSuggestiveContoursFlag(use_suggestive_contours > 0);
+ controller->setComputeMaterialBoundariesFlag(use_material_boundaries > 0);
+ break;
}
// set parameters
@@ -541,24 +584,24 @@ static int displayed_layer_count(ViewLayer *view_layer)
int count = 0;
switch (view_layer->freestyle_config.mode) {
- case FREESTYLE_CONTROL_SCRIPT_MODE:
- for (FreestyleModuleConfig *module = (FreestyleModuleConfig *)view_layer->freestyle_config.modules.first;
- module;
- module = module->next)
- {
- if (module->script && module->is_displayed)
- count++;
- }
- break;
- case FREESTYLE_CONTROL_EDITOR_MODE:
- for (FreestyleLineSet *lineset = (FreestyleLineSet *)view_layer->freestyle_config.linesets.first;
- lineset;
- lineset = lineset->next)
- {
- if (lineset->flags & FREESTYLE_LINESET_ENABLED)
- count++;
- }
- break;
+ case FREESTYLE_CONTROL_SCRIPT_MODE:
+ for (FreestyleModuleConfig *module = (FreestyleModuleConfig *)view_layer->freestyle_config.modules.first;
+ module;
+ module = module->next)
+ {
+ if (module->script && module->is_displayed)
+ count++;
+ }
+ break;
+ case FREESTYLE_CONTROL_EDITOR_MODE:
+ for (FreestyleLineSet *lineset = (FreestyleLineSet *)view_layer->freestyle_config.linesets.first;
+ lineset;
+ lineset = lineset->next)
+ {
+ if (lineset->flags & FREESTYLE_LINESET_ENABLED)
+ count++;
+ }
+ break;
}
return count;
}
diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
index 1866058a151..3695e85cd15 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
+++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
@@ -157,38 +157,38 @@ static int FrsMaterial_mathutils_get(BaseMathObject *bmo, int subtype)
{
BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_LINE:
- bmo->data[0] = self->m->lineR();
- bmo->data[1] = self->m->lineG();
- bmo->data[2] = self->m->lineB();
- bmo->data[3] = self->m->lineA();
- break;
- case MATHUTILS_SUBTYPE_DIFFUSE:
- bmo->data[0] = self->m->diffuseR();
- bmo->data[1] = self->m->diffuseG();
- bmo->data[2] = self->m->diffuseB();
- bmo->data[3] = self->m->diffuseA();
- break;
- case MATHUTILS_SUBTYPE_SPECULAR:
- bmo->data[0] = self->m->specularR();
- bmo->data[1] = self->m->specularG();
- bmo->data[2] = self->m->specularB();
- bmo->data[3] = self->m->specularA();
- break;
- case MATHUTILS_SUBTYPE_AMBIENT:
- bmo->data[0] = self->m->ambientR();
- bmo->data[1] = self->m->ambientG();
- bmo->data[2] = self->m->ambientB();
- bmo->data[3] = self->m->ambientA();
- break;
- case MATHUTILS_SUBTYPE_EMISSION:
- bmo->data[0] = self->m->emissionR();
- bmo->data[1] = self->m->emissionG();
- bmo->data[2] = self->m->emissionB();
- bmo->data[3] = self->m->emissionA();
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_LINE:
+ bmo->data[0] = self->m->lineR();
+ bmo->data[1] = self->m->lineG();
+ bmo->data[2] = self->m->lineB();
+ bmo->data[3] = self->m->lineA();
+ break;
+ case MATHUTILS_SUBTYPE_DIFFUSE:
+ bmo->data[0] = self->m->diffuseR();
+ bmo->data[1] = self->m->diffuseG();
+ bmo->data[2] = self->m->diffuseB();
+ bmo->data[3] = self->m->diffuseA();
+ break;
+ case MATHUTILS_SUBTYPE_SPECULAR:
+ bmo->data[0] = self->m->specularR();
+ bmo->data[1] = self->m->specularG();
+ bmo->data[2] = self->m->specularB();
+ bmo->data[3] = self->m->specularA();
+ break;
+ case MATHUTILS_SUBTYPE_AMBIENT:
+ bmo->data[0] = self->m->ambientR();
+ bmo->data[1] = self->m->ambientG();
+ bmo->data[2] = self->m->ambientB();
+ bmo->data[3] = self->m->ambientA();
+ break;
+ case MATHUTILS_SUBTYPE_EMISSION:
+ bmo->data[0] = self->m->emissionR();
+ bmo->data[1] = self->m->emissionG();
+ bmo->data[2] = self->m->emissionB();
+ bmo->data[3] = self->m->emissionA();
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -197,23 +197,23 @@ static int FrsMaterial_mathutils_set(BaseMathObject *bmo, int subtype)
{
BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_LINE:
- self->m->setLine(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
- break;
- case MATHUTILS_SUBTYPE_DIFFUSE:
- self->m->setDiffuse(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
- break;
- case MATHUTILS_SUBTYPE_SPECULAR:
- self->m->setSpecular(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
- break;
- case MATHUTILS_SUBTYPE_AMBIENT:
- self->m->setAmbient(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
- break;
- case MATHUTILS_SUBTYPE_EMISSION:
- self->m->setEmission(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_LINE:
+ self->m->setLine(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
+ break;
+ case MATHUTILS_SUBTYPE_DIFFUSE:
+ self->m->setDiffuse(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
+ break;
+ case MATHUTILS_SUBTYPE_SPECULAR:
+ self->m->setSpecular(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
+ break;
+ case MATHUTILS_SUBTYPE_AMBIENT:
+ self->m->setAmbient(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
+ break;
+ case MATHUTILS_SUBTYPE_EMISSION:
+ self->m->setEmission(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]);
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -222,38 +222,38 @@ static int FrsMaterial_mathutils_get_index(BaseMathObject *bmo, int subtype, int
{
BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_LINE:
- {
- const float *color = self->m->line();
- bmo->data[index] = color[index];
- }
- break;
- case MATHUTILS_SUBTYPE_DIFFUSE:
- {
- const float *color = self->m->diffuse();
- bmo->data[index] = color[index];
- }
- break;
- case MATHUTILS_SUBTYPE_SPECULAR:
- {
- const float *color = self->m->specular();
- bmo->data[index] = color[index];
- }
- break;
- case MATHUTILS_SUBTYPE_AMBIENT:
- {
- const float *color = self->m->ambient();
- bmo->data[index] = color[index];
- }
- break;
- case MATHUTILS_SUBTYPE_EMISSION:
- {
- const float *color = self->m->emission();
- bmo->data[index] = color[index];
- }
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_LINE:
+ {
+ const float *color = self->m->line();
+ bmo->data[index] = color[index];
+ }
+ break;
+ case MATHUTILS_SUBTYPE_DIFFUSE:
+ {
+ const float *color = self->m->diffuse();
+ bmo->data[index] = color[index];
+ }
+ break;
+ case MATHUTILS_SUBTYPE_SPECULAR:
+ {
+ const float *color = self->m->specular();
+ bmo->data[index] = color[index];
+ }
+ break;
+ case MATHUTILS_SUBTYPE_AMBIENT:
+ {
+ const float *color = self->m->ambient();
+ bmo->data[index] = color[index];
+ }
+ break;
+ case MATHUTILS_SUBTYPE_EMISSION:
+ {
+ const float *color = self->m->emission();
+ bmo->data[index] = color[index];
+ }
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -263,33 +263,33 @@ static int FrsMaterial_mathutils_set_index(BaseMathObject *bmo, int subtype, int
BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user;
float color[4];
switch (subtype) {
- case MATHUTILS_SUBTYPE_LINE:
- copy_v4_v4(color, self->m->line());
- color[index] = bmo->data[index];
- self->m->setLine(color[0], color[1], color[2], color[3]);
- break;
- case MATHUTILS_SUBTYPE_DIFFUSE:
- copy_v4_v4(color, self->m->diffuse());
- color[index] = bmo->data[index];
- self->m->setDiffuse(color[0], color[1], color[2], color[3]);
- break;
- case MATHUTILS_SUBTYPE_SPECULAR:
- copy_v4_v4(color, self->m->specular());
- color[index] = bmo->data[index];
- self->m->setSpecular(color[0], color[1], color[2], color[3]);
- break;
- case MATHUTILS_SUBTYPE_AMBIENT:
- copy_v4_v4(color, self->m->ambient());
- color[index] = bmo->data[index];
- self->m->setAmbient(color[0], color[1], color[2], color[3]);
- break;
- case MATHUTILS_SUBTYPE_EMISSION:
- copy_v4_v4(color, self->m->emission());
- color[index] = bmo->data[index];
- self->m->setEmission(color[0], color[1], color[2], color[3]);
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_LINE:
+ copy_v4_v4(color, self->m->line());
+ color[index] = bmo->data[index];
+ self->m->setLine(color[0], color[1], color[2], color[3]);
+ break;
+ case MATHUTILS_SUBTYPE_DIFFUSE:
+ copy_v4_v4(color, self->m->diffuse());
+ color[index] = bmo->data[index];
+ self->m->setDiffuse(color[0], color[1], color[2], color[3]);
+ break;
+ case MATHUTILS_SUBTYPE_SPECULAR:
+ copy_v4_v4(color, self->m->specular());
+ color[index] = bmo->data[index];
+ self->m->setSpecular(color[0], color[1], color[2], color[3]);
+ break;
+ case MATHUTILS_SUBTYPE_AMBIENT:
+ copy_v4_v4(color, self->m->ambient());
+ color[index] = bmo->data[index];
+ self->m->setAmbient(color[0], color[1], color[2], color[3]);
+ break;
+ case MATHUTILS_SUBTYPE_EMISSION:
+ copy_v4_v4(color, self->m->emission());
+ color[index] = bmo->data[index];
+ self->m->setEmission(color[0], color[1], color[2], color[3]);
+ break;
+ default:
+ return -1;
}
return 0;
}
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
index 43313ef5213..fb7eb49127c 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
@@ -391,17 +391,17 @@ static int StrokeAttribute_mathutils_get(BaseMathObject *bmo, int subtype)
{
BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_COLOR:
- bmo->data[0] = self->sa->getColorR();
- bmo->data[1] = self->sa->getColorG();
- bmo->data[2] = self->sa->getColorB();
- break;
- case MATHUTILS_SUBTYPE_THICKNESS:
- bmo->data[0] = self->sa->getThicknessR();
- bmo->data[1] = self->sa->getThicknessL();
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_COLOR:
+ bmo->data[0] = self->sa->getColorR();
+ bmo->data[1] = self->sa->getColorG();
+ bmo->data[2] = self->sa->getColorB();
+ break;
+ case MATHUTILS_SUBTYPE_THICKNESS:
+ bmo->data[0] = self->sa->getThicknessR();
+ bmo->data[1] = self->sa->getThicknessL();
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -410,14 +410,14 @@ static int StrokeAttribute_mathutils_set(BaseMathObject *bmo, int subtype)
{
BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_COLOR:
- self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]);
- break;
- case MATHUTILS_SUBTYPE_THICKNESS:
- self->sa->setThickness(bmo->data[0], bmo->data[1]);
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_COLOR:
+ self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]);
+ break;
+ case MATHUTILS_SUBTYPE_THICKNESS:
+ self->sa->setThickness(bmo->data[0], bmo->data[1]);
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -426,25 +426,25 @@ static int StrokeAttribute_mathutils_get_index(BaseMathObject *bmo, int subtype,
{
BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_COLOR:
- switch (index) {
- case 0: bmo->data[0] = self->sa->getColorR(); break;
- case 1: bmo->data[1] = self->sa->getColorG(); break;
- case 2: bmo->data[2] = self->sa->getColorB(); break;
+ case MATHUTILS_SUBTYPE_COLOR:
+ switch (index) {
+ case 0: bmo->data[0] = self->sa->getColorR(); break;
+ case 1: bmo->data[1] = self->sa->getColorG(); break;
+ case 2: bmo->data[2] = self->sa->getColorB(); break;
+ default:
+ return -1;
+ }
+ break;
+ case MATHUTILS_SUBTYPE_THICKNESS:
+ switch (index) {
+ case 0: bmo->data[0] = self->sa->getThicknessR(); break;
+ case 1: bmo->data[1] = self->sa->getThicknessL(); break;
+ default:
+ return -1;
+ }
+ break;
default:
return -1;
- }
- break;
- case MATHUTILS_SUBTYPE_THICKNESS:
- switch (index) {
- case 0: bmo->data[0] = self->sa->getThicknessR(); break;
- case 1: bmo->data[1] = self->sa->getThicknessL(); break;
- default:
- return -1;
- }
- break;
- default:
- return -1;
}
return 0;
}
@@ -453,23 +453,23 @@ static int StrokeAttribute_mathutils_set_index(BaseMathObject *bmo, int subtype,
{
BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_COLOR:
- {
- float r = (index == 0) ? bmo->data[0] : self->sa->getColorR();
- float g = (index == 1) ? bmo->data[1] : self->sa->getColorG();
- float b = (index == 2) ? bmo->data[2] : self->sa->getColorB();
- self->sa->setColor(r, g, b);
- }
- break;
- case MATHUTILS_SUBTYPE_THICKNESS:
- {
- float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR();
- float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL();
- self->sa->setThickness(tr, tl);
- }
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_COLOR:
+ {
+ float r = (index == 0) ? bmo->data[0] : self->sa->getColorR();
+ float g = (index == 1) ? bmo->data[1] : self->sa->getColorG();
+ float b = (index == 2) ? bmo->data[2] : self->sa->getColorB();
+ self->sa->setColor(r, g, b);
+ }
+ break;
+ case MATHUTILS_SUBTYPE_THICKNESS:
+ {
+ float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR();
+ float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL();
+ self->sa->setThickness(tr, tl);
+ }
+ break;
+ default:
+ return -1;
}
return 0;
}
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
index 33300ea70b5..d83a5a5174c 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
@@ -158,18 +158,18 @@ static int SVertex_mathutils_get(BaseMathObject *bmo, int subtype)
{
BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_POINT3D:
- bmo->data[0] = self->sv->getX();
- bmo->data[1] = self->sv->getY();
- bmo->data[2] = self->sv->getZ();
- break;
- case MATHUTILS_SUBTYPE_POINT2D:
- bmo->data[0] = self->sv->getProjectedX();
- bmo->data[1] = self->sv->getProjectedY();
- bmo->data[2] = self->sv->getProjectedZ();
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_POINT3D:
+ bmo->data[0] = self->sv->getX();
+ bmo->data[1] = self->sv->getY();
+ bmo->data[2] = self->sv->getZ();
+ break;
+ case MATHUTILS_SUBTYPE_POINT2D:
+ bmo->data[0] = self->sv->getProjectedX();
+ bmo->data[1] = self->sv->getProjectedY();
+ bmo->data[2] = self->sv->getProjectedZ();
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -178,20 +178,20 @@ static int SVertex_mathutils_set(BaseMathObject *bmo, int subtype)
{
BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_POINT3D:
- {
- Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
- self->sv->setPoint3D(p);
- }
- break;
- case MATHUTILS_SUBTYPE_POINT2D:
- {
- Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
- self->sv->setPoint2D(p);
- }
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_POINT3D:
+ {
+ Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
+ self->sv->setPoint3D(p);
+ }
+ break;
+ case MATHUTILS_SUBTYPE_POINT2D:
+ {
+ Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
+ self->sv->setPoint2D(p);
+ }
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -200,26 +200,26 @@ static int SVertex_mathutils_get_index(BaseMathObject *bmo, int subtype, int ind
{
BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_POINT3D:
- switch (index) {
- case 0: bmo->data[0] = self->sv->getX(); break;
- case 1: bmo->data[1] = self->sv->getY(); break;
- case 2: bmo->data[2] = self->sv->getZ(); break;
+ case MATHUTILS_SUBTYPE_POINT3D:
+ switch (index) {
+ case 0: bmo->data[0] = self->sv->getX(); break;
+ case 1: bmo->data[1] = self->sv->getY(); break;
+ case 2: bmo->data[2] = self->sv->getZ(); break;
+ default:
+ return -1;
+ }
+ break;
+ case MATHUTILS_SUBTYPE_POINT2D:
+ switch (index) {
+ case 0: bmo->data[0] = self->sv->getProjectedX(); break;
+ case 1: bmo->data[1] = self->sv->getProjectedY(); break;
+ case 2: bmo->data[2] = self->sv->getProjectedZ(); break;
+ default:
+ return -1;
+ }
+ break;
default:
return -1;
- }
- break;
- case MATHUTILS_SUBTYPE_POINT2D:
- switch (index) {
- case 0: bmo->data[0] = self->sv->getProjectedX(); break;
- case 1: bmo->data[1] = self->sv->getProjectedY(); break;
- case 2: bmo->data[2] = self->sv->getProjectedZ(); break;
- default:
- return -1;
- }
- break;
- default:
- return -1;
}
return 0;
}
@@ -228,22 +228,22 @@ static int SVertex_mathutils_set_index(BaseMathObject *bmo, int subtype, int ind
{
BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_POINT3D:
- {
- Vec3r p(self->sv->point3D());
- p[index] = bmo->data[index];
- self->sv->setPoint3D(p);
- }
- break;
- case MATHUTILS_SUBTYPE_POINT2D:
- {
- Vec3r p(self->sv->point2D());
- p[index] = bmo->data[index];
- self->sv->setPoint2D(p);
- }
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_POINT3D:
+ {
+ Vec3r p(self->sv->point3D());
+ p[index] = bmo->data[index];
+ self->sv->setPoint3D(p);
+ }
+ break;
+ case MATHUTILS_SUBTYPE_POINT2D:
+ {
+ Vec3r p(self->sv->point2D());
+ p[index] = bmo->data[index];
+ self->sv->setPoint2D(p);
+ }
+ break;
+ default:
+ return -1;
}
return 0;
}
diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
index ba773d4f4cf..09e33db529d 100644
--- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
@@ -186,10 +186,10 @@ static int StrokeVertex_mathutils_get_index(BaseMathObject *bmo, int /*subtype*/
{
BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user;
switch (index) {
- case 0: bmo->data[0] = (float)self->sv->x(); break;
- case 1: bmo->data[1] = (float)self->sv->y(); break;
- default:
- return -1;
+ case 0: bmo->data[0] = (float)self->sv->x(); break;
+ case 1: bmo->data[1] = (float)self->sv->y(); break;
+ default:
+ return -1;
}
return 0;
}
@@ -198,10 +198,10 @@ static int StrokeVertex_mathutils_set_index(BaseMathObject *bmo, int /*subtype*/
{
BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user;
switch (index) {
- case 0: self->sv->setX((real)bmo->data[0]); break;
- case 1: self->sv->setY((real)bmo->data[1]); break;
- default:
- return -1;
+ case 0: self->sv->setX((real)bmo->data[0]); break;
+ case 1: self->sv->setY((real)bmo->data[1]); break;
+ default:
+ return -1;
}
return 0;
}
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
index acdd5989511..319eee2945e 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
@@ -110,24 +110,24 @@ static int FEdgeSharp_mathutils_get(BaseMathObject *bmo, int subtype)
{
BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_NORMAL_A:
- {
- Vec3r p(self->fes->normalA());
- bmo->data[0] = p[0];
- bmo->data[1] = p[1];
- bmo->data[2] = p[2];
- }
- break;
- case MATHUTILS_SUBTYPE_NORMAL_B:
- {
- Vec3r p(self->fes->normalB());
- bmo->data[0] = p[0];
- bmo->data[1] = p[1];
- bmo->data[2] = p[2];
- }
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_NORMAL_A:
+ {
+ Vec3r p(self->fes->normalA());
+ bmo->data[0] = p[0];
+ bmo->data[1] = p[1];
+ bmo->data[2] = p[2];
+ }
+ break;
+ case MATHUTILS_SUBTYPE_NORMAL_B:
+ {
+ Vec3r p(self->fes->normalB());
+ bmo->data[0] = p[0];
+ bmo->data[1] = p[1];
+ bmo->data[2] = p[2];
+ }
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -136,20 +136,20 @@ static int FEdgeSharp_mathutils_set(BaseMathObject *bmo, int subtype)
{
BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_NORMAL_A:
- {
- Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
- self->fes->setNormalA(p);
- }
- break;
- case MATHUTILS_SUBTYPE_NORMAL_B:
- {
- Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
- self->fes->setNormalB(p);
- }
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_NORMAL_A:
+ {
+ Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
+ self->fes->setNormalA(p);
+ }
+ break;
+ case MATHUTILS_SUBTYPE_NORMAL_B:
+ {
+ Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]);
+ self->fes->setNormalB(p);
+ }
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -158,20 +158,20 @@ static int FEdgeSharp_mathutils_get_index(BaseMathObject *bmo, int subtype, int
{
BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_NORMAL_A:
- {
- Vec3r p(self->fes->normalA());
- bmo->data[index] = p[index];
- }
- break;
- case MATHUTILS_SUBTYPE_NORMAL_B:
- {
- Vec3r p(self->fes->normalB());
- bmo->data[index] = p[index];
- }
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_NORMAL_A:
+ {
+ Vec3r p(self->fes->normalA());
+ bmo->data[index] = p[index];
+ }
+ break;
+ case MATHUTILS_SUBTYPE_NORMAL_B:
+ {
+ Vec3r p(self->fes->normalB());
+ bmo->data[index] = p[index];
+ }
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -180,22 +180,22 @@ static int FEdgeSharp_mathutils_set_index(BaseMathObject *bmo, int subtype, int
{
BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user;
switch (subtype) {
- case MATHUTILS_SUBTYPE_NORMAL_A:
- {
- Vec3r p(self->fes->normalA());
- p[index] = bmo->data[index];
- self->fes->setNormalA(p);
- }
- break;
- case MATHUTILS_SUBTYPE_NORMAL_B:
- {
- Vec3r p(self->fes->normalB());
- p[index] = bmo->data[index];
- self->fes->setNormalB(p);
- }
- break;
- default:
- return -1;
+ case MATHUTILS_SUBTYPE_NORMAL_A:
+ {
+ Vec3r p(self->fes->normalA());
+ p[index] = bmo->data[index];
+ self->fes->setNormalA(p);
+ }
+ break;
+ case MATHUTILS_SUBTYPE_NORMAL_B:
+ {
+ Vec3r p(self->fes->normalB());
+ p[index] = bmo->data[index];
+ self->fes->setNormalB(p);
+ }
+ break;
+ default:
+ return -1;
}
return 0;
}
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
index 1eeb6805e7d..d179e8b7f18 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
@@ -573,7 +573,8 @@ void FEdgeXDetector::ProcessSuggestiveContourFace(WXFace *iFace)
real threshold = _meanKr;
if (faceLayer->nPosDotP()!=numVertices) {
if ((fabs(faceLayer->dotP(0)) < threshold) && (fabs(faceLayer->dotP(1)) < threshold) &&
- (fabs(faceLayer->dotP(2)) < threshold)) {
+ (fabs(faceLayer->dotP(2)) < threshold))
+ {
faceLayer->ReplaceDotP(0, 0);
faceLayer->ReplaceDotP(1, 0);
faceLayer->ReplaceDotP(2, 0);
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h
index 06ab3183027..16c9699dcef 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.h
+++ b/source/blender/freestyle/intern/view_map/ViewMap.h
@@ -1660,7 +1660,7 @@ void ViewShape::SplitEdge(FEdge *fe, const vector<TVertex*>& iViewVertices, vect
sv = sv2;
}
else {
- // if the shape is the same we can safely differ the two vertices using their ids:
+ // if the shape is the same we can safely differ the two vertices using their ids:
if (sv->getId() != fe->vertexA()->getId())
sv = sv2;
}
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index 5b7576ccd3d..f5239b970f5 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -1947,7 +1947,8 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
int viewport[4];
SilhouetteGeomEngine::retrieveViewport(viewport);
if ((A.x() < viewport[0]) || (A.x() > viewport[2]) || (A.y() < viewport[1]) || (A.y() > viewport[3]) ||
- (B.x() < viewport[0]) || (B.x() > viewport[2]) || (B.y() < viewport[1]) || (B.y() > viewport[3])) {
+ (B.x() < viewport[0]) || (B.x() > viewport[2]) || (B.y() < viewport[1]) || (B.y() > viewport[3]))
+ {
cerr << "Warning: point is out of the grid for fedge " << fe->getId() << endl;
//return 0;
}
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 87a67cb0e79..680ed346b54 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -961,8 +961,8 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
/* Grease Pencil Drawing - generated dynamically */
static const EnumPropertyItem prop_dynamic_gpencil_type[] = {
- { 1, "DRAW", 0, "Draw", "" },
- { 0, NULL, 0, NULL, NULL }
+ {1, "DRAW", 0, "Draw", ""},
+ {0, NULL, 0, NULL, NULL}
};
srna = RNA_def_struct(brna, "BrushGpencilSettings", NULL);
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index ef447ff30ec..a961208755d 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -283,8 +283,8 @@ static void bevel_fix_normal_shading_continuity(BevelModifierData *bmd, BMesh *b
if (f_b)
has_f_b = BLI_ghash_haskey(faceHash, f_b);
if (has_f_a ^ has_f_b) {
- /* If one of both faces is present in faceHash then we are at a border
- * between new vmesh created and reconstructed face */
+ /* If one of both faces is present in faceHash then we are at a border
+ * between new vmesh created and reconstructed face */
for (int i = 0; i < 2; i++) {
BMVert *v = (i == 0) ? e->v1 : e->v2;
@@ -316,8 +316,8 @@ static void bevel_fix_normal_shading_continuity(BevelModifierData *bmd, BMesh *b
}
}
else if (has_f_a == true && has_f_b == true) {
- /* Else if both faces are present we assign clnor corresponding
- * to vert normal and face normal */
+ /* Else if both faces are present we assign clnor corresponding
+ * to vert normal and face normal */
for (int i = 0; i < 2; i++) {
BMVert *v = (i == 0) ? e->v1 : e->v2;
BM_ITER_ELEM(l, &liter, v, BM_LOOPS_OF_VERT) {
diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c
index 57846bc7443..f60105e029d 100644
--- a/source/blender/render/intern/source/bake_api.c
+++ b/source/blender/render/intern/source/bake_api.c
@@ -590,7 +590,8 @@ bool RE_bake_pixels_populate_from_objects(
/* cast ray */
if (!cast_ray_highpoly(treeData, tri_low, tris_high,
pixel_array_from, pixel_array_to, mat_low,
- highpoly, co, dir, i, tot_highpoly)) {
+ highpoly, co, dir, i, tot_highpoly))
+ {
/* if it fails mask out the original pixel array */
pixel_array_from[i].primitive_id = -1;
}
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index c259a60cda0..60e0a3d3843 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -882,7 +882,8 @@ bool RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *fil
/* Skip non-RGBA and Z passes if not using multi layer. */
if (!multi_layer && !(STREQ(rp->name, RE_PASSNAME_COMBINED) ||
STREQ(rp->name, "") ||
- (STREQ(rp->name, RE_PASSNAME_Z) && write_z))) {
+ (STREQ(rp->name, RE_PASSNAME_Z) && write_z)))
+ {
continue;
}
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 2841d96025e..e24e14058ed 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -1246,127 +1246,127 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
float facm;
switch (blendtype) {
- case MTEX_BLEND:
- fact*= facg;
- facm= 1.0f-fact;
-
- in[0]= (fact*tex[0] + facm*out[0]);
- in[1]= (fact*tex[1] + facm*out[1]);
- in[2]= (fact*tex[2] + facm*out[2]);
- break;
-
- case MTEX_MUL:
- fact*= facg;
- facm= 1.0f-fact;
- in[0]= (facm+fact*tex[0])*out[0];
- in[1]= (facm+fact*tex[1])*out[1];
- in[2]= (facm+fact*tex[2])*out[2];
- break;
-
- case MTEX_SCREEN:
- fact*= facg;
- facm= 1.0f-fact;
- in[0]= 1.0f - (facm+fact*(1.0f-tex[0])) * (1.0f-out[0]);
- in[1]= 1.0f - (facm+fact*(1.0f-tex[1])) * (1.0f-out[1]);
- in[2]= 1.0f - (facm+fact*(1.0f-tex[2])) * (1.0f-out[2]);
- break;
-
- case MTEX_OVERLAY:
- fact*= facg;
- facm= 1.0f-fact;
-
- if (out[0] < 0.5f)
- in[0] = out[0] * (facm + 2.0f*fact*tex[0]);
- else
- in[0] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[0])) * (1.0f - out[0]);
- if (out[1] < 0.5f)
- in[1] = out[1] * (facm + 2.0f*fact*tex[1]);
- else
- in[1] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[1])) * (1.0f - out[1]);
- if (out[2] < 0.5f)
- in[2] = out[2] * (facm + 2.0f*fact*tex[2]);
- else
- in[2] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[2])) * (1.0f - out[2]);
- break;
-
- case MTEX_SUB:
- fact= -fact;
- ATTR_FALLTHROUGH;
- case MTEX_ADD:
- fact*= facg;
- in[0]= (fact*tex[0] + out[0]);
- in[1]= (fact*tex[1] + out[1]);
- in[2]= (fact*tex[2] + out[2]);
- break;
-
- case MTEX_DIV:
- fact*= facg;
- facm= 1.0f-fact;
-
- if (tex[0]!=0.0f)
- in[0]= facm*out[0] + fact*out[0]/tex[0];
- if (tex[1]!=0.0f)
- in[1]= facm*out[1] + fact*out[1]/tex[1];
- if (tex[2]!=0.0f)
- in[2]= facm*out[2] + fact*out[2]/tex[2];
-
- break;
-
- case MTEX_DIFF:
- fact*= facg;
- facm= 1.0f-fact;
- in[0]= facm*out[0] + fact*fabsf(tex[0]-out[0]);
- in[1]= facm*out[1] + fact*fabsf(tex[1]-out[1]);
- in[2]= facm*out[2] + fact*fabsf(tex[2]-out[2]);
- break;
-
- case MTEX_DARK:
- fact*= facg;
- facm= 1.0f-fact;
-
- in[0] = min_ff(out[0], tex[0])*fact + out[0]*facm;
- in[1] = min_ff(out[1], tex[1])*fact + out[1]*facm;
- in[2] = min_ff(out[2], tex[2])*fact + out[2]*facm;
- break;
-
- case MTEX_LIGHT:
- fact*= facg;
-
- in[0] = max_ff(fact * tex[0], out[0]);
- in[1] = max_ff(fact * tex[1], out[1]);
- in[2] = max_ff(fact * tex[2], out[2]);
- break;
-
- case MTEX_BLEND_HUE:
- fact*= facg;
- copy_v3_v3(in, out);
- ramp_blend(MA_RAMP_HUE, in, fact, tex);
- break;
- case MTEX_BLEND_SAT:
- fact*= facg;
- copy_v3_v3(in, out);
- ramp_blend(MA_RAMP_SAT, in, fact, tex);
- break;
- case MTEX_BLEND_VAL:
- fact*= facg;
- copy_v3_v3(in, out);
- ramp_blend(MA_RAMP_VAL, in, fact, tex);
- break;
- case MTEX_BLEND_COLOR:
- fact*= facg;
- copy_v3_v3(in, out);
- ramp_blend(MA_RAMP_COLOR, in, fact, tex);
- break;
- case MTEX_SOFT_LIGHT:
- fact*= facg;
- copy_v3_v3(in, out);
- ramp_blend(MA_RAMP_SOFT, in, fact, tex);
- break;
- case MTEX_LIN_LIGHT:
- fact*= facg;
- copy_v3_v3(in, out);
- ramp_blend(MA_RAMP_LINEAR, in, fact, tex);
- break;
+ case MTEX_BLEND:
+ fact*= facg;
+ facm= 1.0f-fact;
+
+ in[0]= (fact*tex[0] + facm*out[0]);
+ in[1]= (fact*tex[1] + facm*out[1]);
+ in[2]= (fact*tex[2] + facm*out[2]);
+ break;
+
+ case MTEX_MUL:
+ fact*= facg;
+ facm= 1.0f-fact;
+ in[0]= (facm+fact*tex[0])*out[0];
+ in[1]= (facm+fact*tex[1])*out[1];
+ in[2]= (facm+fact*tex[2])*out[2];
+ break;
+
+ case MTEX_SCREEN:
+ fact*= facg;
+ facm= 1.0f-fact;
+ in[0]= 1.0f - (facm+fact*(1.0f-tex[0])) * (1.0f-out[0]);
+ in[1]= 1.0f - (facm+fact*(1.0f-tex[1])) * (1.0f-out[1]);
+ in[2]= 1.0f - (facm+fact*(1.0f-tex[2])) * (1.0f-out[2]);
+ break;
+
+ case MTEX_OVERLAY:
+ fact*= facg;
+ facm= 1.0f-fact;
+
+ if (out[0] < 0.5f)
+ in[0] = out[0] * (facm + 2.0f*fact*tex[0]);
+ else
+ in[0] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[0])) * (1.0f - out[0]);
+ if (out[1] < 0.5f)
+ in[1] = out[1] * (facm + 2.0f*fact*tex[1]);
+ else
+ in[1] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[1])) * (1.0f - out[1]);
+ if (out[2] < 0.5f)
+ in[2] = out[2] * (facm + 2.0f*fact*tex[2]);
+ else
+ in[2] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[2])) * (1.0f - out[2]);
+ break;
+
+ case MTEX_SUB:
+ fact= -fact;
+ ATTR_FALLTHROUGH;
+ case MTEX_ADD:
+ fact*= facg;
+ in[0]= (fact*tex[0] + out[0]);
+ in[1]= (fact*tex[1] + out[1]);
+ in[2]= (fact*tex[2] + out[2]);
+ break;
+
+ case MTEX_DIV:
+ fact*= facg;
+ facm= 1.0f-fact;
+
+ if (tex[0]!=0.0f)
+ in[0]= facm*out[0] + fact*out[0]/tex[0];
+ if (tex[1]!=0.0f)
+ in[1]= facm*out[1] + fact*out[1]/tex[1];
+ if (tex[2]!=0.0f)
+ in[2]= facm*out[2] + fact*out[2]/tex[2];
+
+ break;
+
+ case MTEX_DIFF:
+ fact*= facg;
+ facm= 1.0f-fact;
+ in[0]= facm*out[0] + fact*fabsf(tex[0]-out[0]);
+ in[1]= facm*out[1] + fact*fabsf(tex[1]-out[1]);
+ in[2]= facm*out[2] + fact*fabsf(tex[2]-out[2]);
+ break;
+
+ case MTEX_DARK:
+ fact*= facg;
+ facm= 1.0f-fact;
+
+ in[0] = min_ff(out[0], tex[0])*fact + out[0]*facm;
+ in[1] = min_ff(out[1], tex[1])*fact + out[1]*facm;
+ in[2] = min_ff(out[2], tex[2])*fact + out[2]*facm;
+ break;
+
+ case MTEX_LIGHT:
+ fact*= facg;
+
+ in[0] = max_ff(fact * tex[0], out[0]);
+ in[1] = max_ff(fact * tex[1], out[1]);
+ in[2] = max_ff(fact * tex[2], out[2]);
+ break;
+
+ case MTEX_BLEND_HUE:
+ fact*= facg;
+ copy_v3_v3(in, out);
+ ramp_blend(MA_RAMP_HUE, in, fact, tex);
+ break;
+ case MTEX_BLEND_SAT:
+ fact*= facg;
+ copy_v3_v3(in, out);
+ ramp_blend(MA_RAMP_SAT, in, fact, tex);
+ break;
+ case MTEX_BLEND_VAL:
+ fact*= facg;
+ copy_v3_v3(in, out);
+ ramp_blend(MA_RAMP_VAL, in, fact, tex);
+ break;
+ case MTEX_BLEND_COLOR:
+ fact*= facg;
+ copy_v3_v3(in, out);
+ ramp_blend(MA_RAMP_COLOR, in, fact, tex);
+ break;
+ case MTEX_SOFT_LIGHT:
+ fact*= facg;
+ copy_v3_v3(in, out);
+ ramp_blend(MA_RAMP_SOFT, in, fact, tex);
+ break;
+ case MTEX_LIN_LIGHT:
+ fact*= facg;
+ copy_v3_v3(in, out);
+ ramp_blend(MA_RAMP_LINEAR, in, fact, tex);
+ break;
}
}
@@ -1382,64 +1382,64 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
if (flip) SWAP(float, fact, facm);
switch (blendtype) {
- case MTEX_BLEND:
- in= fact*tex + facm*out;
- break;
-
- case MTEX_MUL:
- facm= 1.0f-facg;
- in= (facm+fact*tex)*out;
- break;
-
- case MTEX_SCREEN:
- facm= 1.0f-facg;
- in= 1.0f-(facm+fact*(1.0f-tex))*(1.0f-out);
- break;
-
- case MTEX_OVERLAY:
- facm= 1.0f-facg;
- if (out < 0.5f)
- in = out * (facm + 2.0f*fact*tex);
- else
- in = 1.0f - (facm + 2.0f*fact*(1.0f - tex)) * (1.0f - out);
- break;
-
- case MTEX_SUB:
- fact= -fact;
- ATTR_FALLTHROUGH;
- case MTEX_ADD:
- in= fact*tex + out;
- break;
-
- case MTEX_DIV:
- if (tex!=0.0f)
- in= facm*out + fact*out/tex;
- break;
-
- case MTEX_DIFF:
- in= facm*out + fact*fabsf(tex-out);
- break;
-
- case MTEX_DARK:
- in = min_ff(out, tex)*fact + out*facm;
- break;
-
- case MTEX_LIGHT:
- col= fact*tex;
- if (col > out) in= col; else in= out;
- break;
-
- case MTEX_SOFT_LIGHT:
- scf=1.0f - (1.0f - tex) * (1.0f - out);
- in= facm*out + fact * ((1.0f - out) * tex * out) + (out * scf);
- break;
-
- case MTEX_LIN_LIGHT:
- if (tex > 0.5f)
- in = out + fact*(2.0f*(tex - 0.5f));
- else
- in = out + fact*(2.0f*tex - 1.0f);
- break;
+ case MTEX_BLEND:
+ in= fact*tex + facm*out;
+ break;
+
+ case MTEX_MUL:
+ facm= 1.0f-facg;
+ in= (facm+fact*tex)*out;
+ break;
+
+ case MTEX_SCREEN:
+ facm= 1.0f-facg;
+ in= 1.0f-(facm+fact*(1.0f-tex))*(1.0f-out);
+ break;
+
+ case MTEX_OVERLAY:
+ facm= 1.0f-facg;
+ if (out < 0.5f)
+ in = out * (facm + 2.0f*fact*tex);
+ else
+ in = 1.0f - (facm + 2.0f*fact*(1.0f - tex)) * (1.0f - out);
+ break;
+
+ case MTEX_SUB:
+ fact= -fact;
+ ATTR_FALLTHROUGH;
+ case MTEX_ADD:
+ in= fact*tex + out;
+ break;
+
+ case MTEX_DIV:
+ if (tex!=0.0f)
+ in= facm*out + fact*out/tex;
+ break;
+
+ case MTEX_DIFF:
+ in= facm*out + fact*fabsf(tex-out);
+ break;
+
+ case MTEX_DARK:
+ in = min_ff(out, tex)*fact + out*facm;
+ break;
+
+ case MTEX_LIGHT:
+ col= fact*tex;
+ if (col > out) in= col; else in= out;
+ break;
+
+ case MTEX_SOFT_LIGHT:
+ scf=1.0f - (1.0f - tex) * (1.0f - out);
+ in= facm*out + fact * ((1.0f - out) * tex * out) + (out * scf);
+ break;
+
+ case MTEX_LIN_LIGHT:
+ if (tex > 0.5f)
+ in = out + fact*(2.0f*(tex - 0.5f));
+ else
+ in = out + fact*(2.0f*tex - 1.0f);
+ break;
}
return in;