From 39eb05161690510ecec4c30129a9f8d5532d39c9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 30 Aug 2018 01:31:20 +1000 Subject: Cleanup: indentation --- source/blender/blenkernel/intern/pointcache.c | 179 ++++--- source/blender/blenloader/intern/readfile.c | 584 ++++++++++----------- source/blender/compositor/intern/COM_Debug.cpp | 3 +- .../intern/blender_interface/BlenderFileLoader.cpp | 32 +- .../blender_interface/BlenderStrokeRenderer.cpp | 22 +- .../intern/blender_interface/FRS_freestyle.cpp | 248 ++++----- .../freestyle/intern/python/BPy_FrsMaterial.cpp | 216 ++++---- .../intern/python/BPy_StrokeAttribute.cpp | 106 ++-- .../intern/python/Interface0D/BPy_SVertex.cpp | 120 ++--- .../Interface0D/CurvePoint/BPy_StrokeVertex.cpp | 16 +- .../python/Interface1D/FEdge/BPy_FEdgeSharp.cpp | 124 ++--- .../freestyle/intern/view_map/FEdgeXDetector.cpp | 3 +- source/blender/freestyle/intern/view_map/ViewMap.h | 2 +- .../freestyle/intern/view_map/ViewMapBuilder.cpp | 3 +- source/blender/render/intern/source/bake_api.c | 3 +- .../blender/render/intern/source/convertblender.c | 36 +- .../blender/render/intern/source/render_result.c | 3 +- .../blender/render/intern/source/render_texture.c | 492 ++++++++--------- source/blender/render/intern/source/shadeoutput.c | 27 +- 19 files changed, 1112 insertions(+), 1107 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 104f8482635..7311b17134d 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2977,117 +2977,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 bdfae79a1d0..08a45f367f4 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7851,32 +7851,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++) { @@ -7899,171 +7899,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; } } @@ -8704,49 +8704,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); + } } } @@ -9883,86 +9883,86 @@ 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_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_group(fd, mainvar, (Group *)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; - 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_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_group(fd, mainvar, (Group *)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; + 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/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index f16c4c3574b..7248bde0d10 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -158,24 +158,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 d885ef4735f..9c3ff8999b7 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -176,17 +176,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; } } BLI_freelistN(&freestyle_scene->base); diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 45da59e9215..6e65b021805 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,115 +303,115 @@ static void prepare(Render *re, SceneRenderLayer *srl) 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) { - 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) : "") << endl; - } - 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; - ++use_suggestive_contours; - ++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 + 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; } - // 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) : "") << 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 +541,24 @@ static int displayed_layer_count(SceneRenderLayer *srl) int count = 0; switch (srl->freestyleConfig.mode) { - case FREESTYLE_CONTROL_SCRIPT_MODE: - for (FreestyleModuleConfig *module = (FreestyleModuleConfig *)srl->freestyleConfig.modules.first; - module; - module = module->next) - { - if (module->script && module->is_displayed) - count++; - } - break; - case FREESTYLE_CONTROL_EDITOR_MODE: - for (FreestyleLineSet *lineset = (FreestyleLineSet *)srl->freestyleConfig.linesets.first; - lineset; - lineset = lineset->next) - { - if (lineset->flags & FREESTYLE_LINESET_ENABLED) - count++; - } - break; + case FREESTYLE_CONTROL_SCRIPT_MODE: + for (FreestyleModuleConfig *module = (FreestyleModuleConfig *)srl->freestyleConfig.modules.first; + module; + module = module->next) + { + if (module->script && module->is_displayed) + count++; + } + break; + case FREESTYLE_CONTROL_EDITOR_MODE: + for (FreestyleLineSet *lineset = (FreestyleLineSet *)srl->freestyleConfig.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& 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/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c index 8b25c1fe962..4d5a8458897 100644 --- a/source/blender/render/intern/source/bake_api.c +++ b/source/blender/render/intern/source/bake_api.c @@ -568,7 +568,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/convertblender.c b/source/blender/render/intern/source/convertblender.c index ba4bca35a34..15432af4915 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3757,24 +3757,24 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) } else if (lar->type==LA_AREA) { switch (lar->area_shape) { - case LA_AREA_SQUARE: - lar->ray_totsamp= lar->ray_samp*lar->ray_samp; - lar->ray_sampy= lar->ray_samp; - lar->area_sizey= lar->area_size; - break; - case LA_AREA_RECT: - lar->ray_totsamp= lar->ray_samp*lar->ray_sampy; - break; - case LA_AREA_CUBE: - lar->ray_totsamp= lar->ray_samp*lar->ray_samp*lar->ray_samp; - lar->ray_sampy= lar->ray_samp; - lar->ray_sampz= lar->ray_samp; - lar->area_sizey= lar->area_size; - lar->area_sizez= lar->area_size; - break; - case LA_AREA_BOX: - lar->ray_totsamp= lar->ray_samp*lar->ray_sampy*lar->ray_sampz; - break; + case LA_AREA_SQUARE: + lar->ray_totsamp= lar->ray_samp*lar->ray_samp; + lar->ray_sampy= lar->ray_samp; + lar->area_sizey= lar->area_size; + break; + case LA_AREA_RECT: + lar->ray_totsamp= lar->ray_samp*lar->ray_sampy; + break; + case LA_AREA_CUBE: + lar->ray_totsamp= lar->ray_samp*lar->ray_samp*lar->ray_samp; + lar->ray_sampy= lar->ray_samp; + lar->ray_sampz= lar->ray_samp; + lar->area_sizey= lar->area_size; + lar->area_sizez= lar->area_size; + break; + case LA_AREA_BOX: + lar->ray_totsamp= lar->ray_samp*lar->ray_sampy*lar->ray_sampz; + break; } area_lamp_vectors(lar); diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index a79d0c3098f..4f2b0980762 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -912,7 +912,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 8450098d733..7426e953632 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1453,127 +1453,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; } } @@ -1589,64 +1589,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; @@ -3201,76 +3201,76 @@ void do_sky_tex( /* Grab the mapping settings for this texture */ switch (mtex->texco) { - case TEXCO_ANGMAP: - /* only works with texture being "real" */ - /* use saacos(), fixes bug [#22398], float precision caused lo[2] to be slightly less than -1.0 */ - if (lo[0] || lo[1]) { /* check for zero case [#24807] */ - fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrtf(lo[0]*lo[0] + lo[1]*lo[1])); - tempvec[0]= lo[0]*fact; - tempvec[1]= lo[1]*fact; - tempvec[2]= 0.0; - } - else { - /* this value has no angle, the vector is directly along the view. - * avoid divide by zero and use a dummy value. */ - tempvec[0]= 1.0f; - tempvec[1]= 0.0; - tempvec[2]= 0.0; - } - co= tempvec; - break; - - case TEXCO_H_SPHEREMAP: - case TEXCO_H_TUBEMAP: - if (skyflag & WO_ZENUP) { - if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1, lo[0], lo[2], lo[1]); - else map_to_sphere(tempvec, tempvec+1, lo[0], lo[2], lo[1]); - /* tube/spheremap maps for outside view, not inside */ - tempvec[0]= 1.0f-tempvec[0]; - /* only top half */ - tempvec[1]= 2.0f*tempvec[1]-1.0f; - tempvec[2]= 0.0; - /* and correction for do_2d_mapping */ - tempvec[0]= 2.0f*tempvec[0]-1.0f; - tempvec[1]= 2.0f*tempvec[1]-1.0f; - co= tempvec; - } - else { - /* potentially dangerous... check with multitex! */ - continue; - } - break; - case TEXCO_EQUIRECTMAP: - tempvec[0]= -atan2f(lo[2], lo[0]) / (float)M_PI; - tempvec[1]= atan2f(lo[1], hypot(lo[0], lo[2])) / (float)M_PI_2; - tempvec[2]= 0.0f; - co= tempvec; - break; - case TEXCO_OBJECT: - if (mtex->object) { - copy_v3_v3(tempvec, lo); - mul_m4_v3(mtex->object->imat_ren, tempvec); + case TEXCO_ANGMAP: + /* only works with texture being "real" */ + /* use saacos(), fixes bug [#22398], float precision caused lo[2] to be slightly less than -1.0 */ + if (lo[0] || lo[1]) { /* check for zero case [#24807] */ + fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrtf(lo[0]*lo[0] + lo[1]*lo[1])); + tempvec[0]= lo[0]*fact; + tempvec[1]= lo[1]*fact; + tempvec[2]= 0.0; + } + else { + /* this value has no angle, the vector is directly along the view. + * avoid divide by zero and use a dummy value. */ + tempvec[0]= 1.0f; + tempvec[1]= 0.0; + tempvec[2]= 0.0; + } co= tempvec; - } - break; - - case TEXCO_GLOB: - if (rco) { - copy_v3_v3(tempvec, rco); - mul_m4_v3(R.viewinv, tempvec); + break; + + case TEXCO_H_SPHEREMAP: + case TEXCO_H_TUBEMAP: + if (skyflag & WO_ZENUP) { + if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1, lo[0], lo[2], lo[1]); + else map_to_sphere(tempvec, tempvec+1, lo[0], lo[2], lo[1]); + /* tube/spheremap maps for outside view, not inside */ + tempvec[0]= 1.0f-tempvec[0]; + /* only top half */ + tempvec[1]= 2.0f*tempvec[1]-1.0f; + tempvec[2]= 0.0; + /* and correction for do_2d_mapping */ + tempvec[0]= 2.0f*tempvec[0]-1.0f; + tempvec[1]= 2.0f*tempvec[1]-1.0f; + co= tempvec; + } + else { + /* potentially dangerous... check with multitex! */ + continue; + } + break; + case TEXCO_EQUIRECTMAP: + tempvec[0]= -atan2f(lo[2], lo[0]) / (float)M_PI; + tempvec[1]= atan2f(lo[1], hypot(lo[0], lo[2])) / (float)M_PI_2; + tempvec[2]= 0.0f; co= tempvec; - } - else - co= lo; + break; + case TEXCO_OBJECT: + if (mtex->object) { + copy_v3_v3(tempvec, lo); + mul_m4_v3(mtex->object->imat_ren, tempvec); + co= tempvec; + } + break; -// copy_v3_v3(shi->dxgl, shi->dxco); -// mul_m3_v3(R.imat, shi->dxco); -// copy_v3_v3(shi->dygl, shi->dyco); -// mul_m3_v3(R.imat, shi->dyco); - break; - case TEXCO_VIEW: - co = view; - break; + case TEXCO_GLOB: + if (rco) { + copy_v3_v3(tempvec, rco); + mul_m4_v3(R.viewinv, tempvec); + co= tempvec; + } + else + co= lo; + +// copy_v3_v3(shi->dxgl, shi->dxco); +// mul_m3_v3(R.imat, shi->dxco); +// copy_v3_v3(shi->dygl, shi->dyco); +// mul_m3_v3(R.imat, shi->dyco); + break; + case TEXCO_VIEW: + co = view; + break; } /* placement */ diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 090c249defb..b9c703a0528 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1048,18 +1048,18 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3]) /* input */ switch (ma->rampin_spec) { - case MA_RAMP_IN_ENERGY: - fac= t; - break; - case MA_RAMP_IN_SHADER: - fac= is; - break; - case MA_RAMP_IN_NOR: - fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; - break; - default: - fac= 0.0f; - break; + case MA_RAMP_IN_ENERGY: + fac= t; + break; + case MA_RAMP_IN_SHADER: + fac= is; + break; + case MA_RAMP_IN_NOR: + fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; + break; + default: + fac= 0.0f; + break; } BKE_colorband_evaluate(ma->ramp_spec, fac, col); @@ -1833,7 +1833,8 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) /* AO pass */ if (((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || - (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) { + (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) + { if ((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && (R.r.mode & R_SHADOW)) { /* AO was calculated for scanline already */ if (shi->depth || shi->volume_depth) -- cgit v1.2.3