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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/CMakeLists.txt4
-rw-r--r--source/blender/blenfont/SConscript6
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c2
-rw-r--r--source/blender/blenkernel/BKE_depsgraph.h4
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h7
-rw-r--r--source/blender/blenkernel/CMakeLists.txt3
-rw-r--r--source/blender/blenkernel/SConscript8
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c3
-rw-r--r--source/blender/blenkernel/intern/blender.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c3
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c3
-rw-r--r--source/blender/blenkernel/intern/pbvh.c11
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c151
-rw-r--r--source/blender/blenkernel/intern/smoke.c4
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c3
-rw-r--r--source/blender/blenlib/BLI_buffer.h6
-rw-r--r--source/blender/blenlib/BLI_math_base.h26
-rw-r--r--source/blender/blenlib/BLI_math_geom.h19
-rw-r--r--source/blender/blenlib/BLI_rand.h8
-rw-r--r--source/blender/blenlib/intern/math_geom.c28
-rw-r--r--source/blender/blenlib/intern/rand.c26
-rw-r--r--source/blender/bmesh/intern/bmesh_log.c4
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c3
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c15
-rw-r--r--source/blender/bmesh/tools/bmesh_bisect_plane.c7
-rw-r--r--source/blender/bmesh/tools/bmesh_bisect_plane.h7
-rw-r--r--source/blender/editors/animation/CMakeLists.txt4
-rw-r--r--source/blender/editors/animation/SConscript6
-rw-r--r--source/blender/editors/animation/keyframes_edit.c2
-rw-r--r--source/blender/editors/armature/CMakeLists.txt5
-rw-r--r--source/blender/editors/armature/SConscript7
-rw-r--r--source/blender/editors/armature/armature_skinning.c8
-rw-r--r--source/blender/editors/gpencil/CMakeLists.txt4
-rw-r--r--source/blender/editors/gpencil/SConscript5
-rw-r--r--source/blender/editors/include/BIF_gl.h2
-rw-r--r--source/blender/editors/include/BIF_glutil.h10
-rw-r--r--source/blender/editors/include/ED_armature.h6
-rw-r--r--source/blender/editors/include/ED_object.h11
-rw-r--r--source/blender/editors/include/ED_util.h2
-rw-r--r--source/blender/editors/interface/CMakeLists.txt3
-rw-r--r--source/blender/editors/interface/SConscript5
-rw-r--r--source/blender/editors/interface/interface_handlers.c61
-rw-r--r--source/blender/editors/interface/interface_regions.c5
-rw-r--r--source/blender/editors/mask/CMakeLists.txt4
-rw-r--r--source/blender/editors/mask/SConscript6
-rw-r--r--source/blender/editors/mask/mask_ops.c2
-rw-r--r--source/blender/editors/mesh/CMakeLists.txt3
-rw-r--r--source/blender/editors/mesh/SConscript5
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c29
-rw-r--r--source/blender/editors/object/CMakeLists.txt5
-rw-r--r--source/blender/editors/object/object_relations.c599
-rw-r--r--source/blender/editors/physics/CMakeLists.txt4
-rw-r--r--source/blender/editors/physics/SConscript6
-rw-r--r--source/blender/editors/physics/particle_edit.c81
-rw-r--r--source/blender/editors/physics/physics_intern.h1
-rw-r--r--source/blender/editors/physics/physics_ops.c1
-rw-r--r--source/blender/editors/render/CMakeLists.txt3
-rw-r--r--source/blender/editors/render/SConscript5
-rw-r--r--source/blender/editors/render/render_opengl.c3
-rw-r--r--source/blender/editors/render/render_preview.c9
-rw-r--r--source/blender/editors/screen/CMakeLists.txt3
-rw-r--r--source/blender/editors/screen/SConscript5
-rw-r--r--source/blender/editors/screen/glutil.c46
-rw-r--r--source/blender/editors/screen/screen_edit.c2
-rw-r--r--source/blender/editors/sculpt_paint/CMakeLists.txt3
-rw-r--r--source/blender/editors/sculpt_paint/SConscript5
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c12
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c16
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c10
-rw-r--r--source/blender/editors/space_action/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_action/SConscript8
-rw-r--r--source/blender/editors/space_buttons/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_buttons/SConscript7
-rw-r--r--source/blender/editors/space_clip/CMakeLists.txt5
-rw-r--r--source/blender/editors/space_clip/SConscript7
-rw-r--r--source/blender/editors/space_clip/clip_editor.c67
-rw-r--r--source/blender/editors/space_clip/clip_ops.c133
-rw-r--r--source/blender/editors/space_console/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_console/SConscript7
-rw-r--r--source/blender/editors/space_file/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_file/SConscript6
-rw-r--r--source/blender/editors/space_file/fsmenu.c7
-rw-r--r--source/blender/editors/space_graph/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_graph/SConscript6
-rw-r--r--source/blender/editors/space_image/CMakeLists.txt7
-rw-r--r--source/blender/editors/space_image/SConscript6
-rw-r--r--source/blender/editors/space_image/image_buttons.c36
-rw-r--r--source/blender/editors/space_image/image_draw.c7
-rw-r--r--source/blender/editors/space_image/image_intern.h2
-rw-r--r--source/blender/editors/space_image/image_ops.c85
-rw-r--r--source/blender/editors/space_image/space_image.c10
-rw-r--r--source/blender/editors/space_info/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_info/SConscript6
-rw-r--r--source/blender/editors/space_logic/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_logic/SConscript6
-rw-r--r--source/blender/editors/space_nla/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_nla/SConscript6
-rw-r--r--source/blender/editors/space_node/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_node/SConscript6
-rw-r--r--source/blender/editors/space_outliner/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_outliner/SConscript7
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c38
-rw-r--r--source/blender/editors/space_script/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_script/SConscript6
-rw-r--r--source/blender/editors/space_sequencer/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_sequencer/SConscript6
-rw-r--r--source/blender/editors/space_text/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_text/SConscript8
-rw-r--r--source/blender/editors/space_time/CMakeLists.txt4
-rw-r--r--source/blender/editors/space_time/SConscript6
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt3
-rw-r--r--source/blender/editors/space_view3d/SConscript6
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c4
-rw-r--r--source/blender/editors/transform/CMakeLists.txt3
-rw-r--r--source/blender/editors/transform/SConscript7
-rw-r--r--source/blender/editors/transform/transform_conversions.c4
-rw-r--r--source/blender/editors/transform/transform_snap.c6
-rw-r--r--source/blender/editors/util/CMakeLists.txt4
-rw-r--r--source/blender/editors/util/SConscript7
-rw-r--r--source/blender/editors/util/ed_util.c20
-rw-r--r--source/blender/editors/uvedit/CMakeLists.txt4
-rw-r--r--source/blender/editors/uvedit/SConscript5
-rw-r--r--source/blender/freestyle/CMakeLists.txt12
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeShader.cpp36
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp12
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp38
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp122
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h54
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp143
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h53
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp130
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h53
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp128
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h54
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp114
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h53
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp110
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp73
-rw-r--r--source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp402
-rw-r--r--source/blender/freestyle/intern/stroke/BasicStrokeShaders.h302
-rw-r--r--source/blender/gpu/CMakeLists.txt7
-rw-r--r--source/blender/gpu/GPU_extensions.h2
-rw-r--r--source/blender/gpu/GPU_glew.h37
-rw-r--r--source/blender/gpu/GPU_init_exit.h (renamed from source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h)35
-rw-r--r--source/blender/gpu/GPU_material.h2
-rw-r--r--source/blender/gpu/SConscript6
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c2
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c6
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h10
-rw-r--r--source/blender/gpu/intern/gpu_draw.c37
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c21
-rw-r--r--source/blender/gpu/intern/gpu_extensions_private.h32
-rw-r--r--source/blender/gpu/intern/gpu_init_exit.c68
-rw-r--r--source/blender/gpu/intern/gpu_material.c18
-rw-r--r--source/blender/gpu/intern/gpu_select.c5
-rw-r--r--source/blender/gpu/intern/gpu_simple_shader.c2
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl5
-rw-r--r--source/blender/makesdna/DNA_image_types.h5
-rw-r--r--source/blender/makesrna/SConscript5
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt5
-rw-r--r--source/blender/makesrna/intern/SConscript6
-rw-r--r--source/blender/makesrna/intern/rna_image.c88
-rw-r--r--source/blender/makesrna/intern/rna_render.c4
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c2
-rw-r--r--source/blender/modifiers/CMakeLists.txt1
-rw-r--r--source/blender/modifiers/SConscript1
-rw-r--r--source/blender/nodes/CMakeLists.txt3
-rw-r--r--source/blender/nodes/SConscript6
-rw-r--r--source/blender/python/SConscript7
-rw-r--r--source/blender/python/generic/CMakeLists.txt4
-rw-r--r--source/blender/python/generic/bgl.c2
-rw-r--r--source/blender/python/intern/CMakeLists.txt1
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c5
-rw-r--r--source/blender/render/extern/include/RE_engine.h1
-rw-r--r--source/blender/render/extern/include/RE_render_ext.h2
-rw-r--r--source/blender/render/intern/source/imagetexture.c10
-rw-r--r--source/blender/render/intern/source/render_texture.c37
-rw-r--r--source/blender/windowmanager/CMakeLists.txt6
-rw-r--r--source/blender/windowmanager/SConscript8
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c20
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c3
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c1
-rw-r--r--source/blender/windowmanager/intern/wm_window.c22
-rw-r--r--source/blender/windowmanager/wm_window.h4
-rw-r--r--source/blenderplayer/CMakeLists.txt3
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c2
-rw-r--r--source/creator/CMakeLists.txt16
-rw-r--r--source/creator/creator.c18
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp5
-rw-r--r--source/gameengine/BlenderRoutines/CMakeLists.txt3
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp6
-rw-r--r--source/gameengine/BlenderRoutines/KX_BlenderCanvas.h3
-rw-r--r--source/gameengine/BlenderRoutines/SConscript7
-rw-r--r--source/gameengine/GamePlayer/common/CMakeLists.txt3
-rw-r--r--source/gameengine/GamePlayer/common/GPC_Canvas.h2
-rw-r--r--source/gameengine/GamePlayer/common/SConscript7
-rw-r--r--source/gameengine/GamePlayer/ghost/CMakeLists.txt3
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp7
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp6
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Canvas.h2
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp23
-rw-r--r--source/gameengine/GamePlayer/ghost/SConscript7
-rw-r--r--source/gameengine/Ketsji/BL_Shader.cpp2
-rw-r--r--source/gameengine/Ketsji/BL_Texture.cpp2
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt3
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Dome.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Dome.h2
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp7
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp6
-rw-r--r--source/gameengine/Ketsji/SConscript5
-rw-r--r--source/gameengine/Physics/Bullet/CMakeLists.txt3
-rw-r--r--source/gameengine/Physics/Bullet/SConscript5
-rw-r--r--source/gameengine/Rasterizer/CMakeLists.txt3
-rw-r--r--source/gameengine/Rasterizer/RAS_2DFilterManager.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_ICanvas.h3
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt3
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp3
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript5
-rw-r--r--source/gameengine/Rasterizer/SConscript6
-rw-r--r--source/gameengine/VideoTexture/CMakeLists.txt3
-rw-r--r--source/gameengine/VideoTexture/ImageBase.cpp2
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp2
-rw-r--r--source/gameengine/VideoTexture/ImageViewport.cpp2
-rw-r--r--source/gameengine/VideoTexture/SConscript6
-rw-r--r--source/gameengine/VideoTexture/Texture.cpp2
236 files changed, 1863 insertions, 2822 deletions
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
index 2debe516dd7..346d5bc64b8 100644
--- a/source/blender/blenfont/CMakeLists.txt
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -26,11 +26,13 @@ set(INC
../blenkernel
../blenlib
../editors/include
+ ../gpu
../makesdna
../makesrna
../python
../imbuf
../../../intern/guardedalloc
+ ../../../intern/glew-mx
../../../intern/locale
)
@@ -58,7 +60,7 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript
index 1c573fa4a59..b6cf052a980 100644
--- a/source/blender/blenfont/SConscript
+++ b/source/blender/blenfont/SConscript
@@ -35,10 +35,12 @@ incs = [
'intern',
'#/intern/guardedalloc',
'#/intern/locale',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../blenkernel',
'../blenlib',
'../editors/include',
+ '../gpu',
'../imbuf',
'../makesdna',
'../makesrna',
@@ -47,7 +49,7 @@ incs = [
incs.extend(Split(env['BF_FREETYPE_INC']))
-defs = ['GLEW_STATIC']
+defs = env['BF_GL_DEFINITIONS']
if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross':
defs.append('_WIN32')
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index a2462f3e302..7978d28a4ef 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -379,7 +379,7 @@ static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x
static void blf_glyph_calc_rect(rctf *rect, GlyphBLF *g, float x, float y)
{
- rect->xmin = (float)floor(x + g->pos_x);
+ rect->xmin = floorf(x + g->pos_x);
rect->xmax = rect->xmin + (float)g->width;
rect->ymin = y + g->pos_y;
rect->ymax = y + g->pos_y - (float)g->height;
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index 2ac5e5eb4be..27cf19d7d06 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -61,8 +61,8 @@ typedef struct EvaluationContext {
typedef enum eEvaluationMode {
DAG_EVAL_VIEWPORT = 0, /* evaluate for OpenGL viewport */
- DAG_EVAL_PREVIEW = 1, /* evaluate for render with preview settings */
- DAG_EVAL_RENDER = 2, /* evaluate for render purposes */
+ DAG_EVAL_PREVIEW = 1, /* evaluate for render with preview settings */
+ DAG_EVAL_RENDER = 2, /* evaluate for render purposes */
} eEvaluationMode;
/* DagNode->eval_flags */
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 3d12483dac0..81e7ce1cdbe 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -89,9 +89,10 @@ void BKE_pbvh_search_gather(PBVH *bvh,
* it's up to the callback to find the primitive within the leaves that is
* hit first */
-void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
- const float ray_start[3], const float ray_normal[3],
- int original);
+void BKE_pbvh_raycast(
+ PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
+ const float ray_start[3], const float ray_normal[3],
+ bool original);
bool BKE_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco,
const float ray_start[3], const float ray_normal[3],
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index fd201fed9e7..f4a3a0c10dd 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -38,6 +38,7 @@ set(INC
../nodes
../render/extern/include
../../../intern/guardedalloc
+ ../../../intern/glew-mx
../../../intern/iksolver/extern
../../../intern/memutil
../../../intern/mikktspace
@@ -272,7 +273,7 @@ set(SRC
intern/pbvh_intern.h
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
if(WITH_AUDASPACE)
list(APPEND INC
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 25f8422afed..9243c85167b 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -45,7 +45,8 @@ incs = [
'#/intern/raskter',
'#/intern/rigidbody',
'#/extern/bullet2/src',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/audaspace/intern',
'#/intern/elbeem/extern',
'#/intern/iksolver/extern',
@@ -65,14 +66,11 @@ incs = [
'../nodes',
'../render/extern/include',
'../windowmanager',
- env['BF_OPENGL_INC'],
env['BF_ZLIB_INC'],
]
incs = ' '.join(incs)
-defs = [
- 'GLEW_STATIC',
- ]
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_SMOKE']:
defs.append('WITH_SMOKE')
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 3aa4e0abbba..81c03d8081b 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -72,11 +72,10 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm);
#include "BLI_sys_types.h" /* for intptr_t support */
-#include "GL/glew.h"
-
#include "GPU_buffers.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "GPU_glew.h"
#include "GPU_material.h"
/* very slow! enable for testing only! */
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index fff8265a158..adfe43cb2a3 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -80,6 +80,7 @@
#include "BKE_sound.h"
#include "RE_pipeline.h"
+#include "RE_render_ext.h"
#include "BLF_api.h"
@@ -119,6 +120,7 @@ void free_blender(void)
DAG_exit();
BKE_brush_system_exit();
+ RE_exit_texture_rng();
BLI_callback_global_finalize();
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index cad062ac63d..bfc70c91181 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -34,8 +34,6 @@
* \ingroup bke
*/
-#include "GL/glew.h"
-
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
@@ -62,6 +60,7 @@
#include "GPU_buffers.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "GPU_glew.h"
#include "GPU_material.h"
#include <string.h>
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 40a4bc22ce9..ce7804d9878 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -41,8 +41,6 @@
* is likely to be a little slow.
*/
-#include "GL/glew.h"
-
#include "BLI_math.h"
#include "BLI_jitter.h"
#include "BLI_bitmap.h"
@@ -58,6 +56,7 @@
#include "MEM_guardedalloc.h"
#include "GPU_extensions.h"
+#include "GPU_glew.h"
extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index ccedb6f6b71..ff6fae08460 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1433,7 +1433,7 @@ void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *pro
typedef struct {
IsectRayAABBData ray;
- int original;
+ bool original;
} RaycastData;
static bool ray_aabb_intersect(PBVHNode *node, void *data_v)
@@ -1449,9 +1449,10 @@ static bool ray_aabb_intersect(PBVHNode *node, void *data_v)
return isect_ray_aabb(&rcd->ray, bb_min, bb_max, &node->tmin);
}
-void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
- const float ray_start[3], const float ray_normal[3],
- int original)
+void BKE_pbvh_raycast(
+ PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
+ const float ray_start[3], const float ray_normal[3],
+ bool original)
{
RaycastData rcd;
@@ -1644,7 +1645,7 @@ void BKE_pbvh_raycast_project_ray_root (PBVH *bvh, bool original, float ray_star
}
-//#include <GL/glew.h>
+//#include "GPU_glew.h"
typedef struct {
DMSetMaterial setMaterial;
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 28c01e0bdee..e0cf9eeeae1 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -280,22 +280,49 @@ static bool pbvh_bmesh_node_limit_ensure(PBVH *bvh, int node_index)
/**********************************************************************/
-static PBVHNode *pbvh_bmesh_node_lookup(PBVH *bvh, void *key, const int cd_node_offset)
+static int pbvh_bmesh_node_offset_from_elem(PBVH *bvh, BMElem *ele)
{
- int node_index = BM_ELEM_CD_GET_INT((BMElem *)key, cd_node_offset);
+ switch (ele->head.htype) {
+ case BM_VERT:
+ return bvh->cd_vert_node_offset;
+ default:
+ BLI_assert(ele->head.htype == BM_FACE);
+ return bvh->cd_face_node_offset;
+ }
- BLI_assert(node_index != DYNTOPO_NODE_NONE);
+}
+
+static int pbvh_bmesh_node_lookup_index(PBVH *bvh, void *key)
+{
+ const int cd_node_offset = pbvh_bmesh_node_offset_from_elem(bvh, key);
+ const int node_index = BM_ELEM_CD_GET_INT((BMElem *)key, cd_node_offset);
+ BLI_assert(node_index != DYNTOPO_NODE_NONE);
BLI_assert(node_index < bvh->totnode);
+ (void)bvh;
+
+ return node_index;
+}
- return &bvh->nodes[node_index];
+static PBVHNode *pbvh_bmesh_node_lookup(PBVH *bvh, void *key)
+{
+ return &bvh->nodes[pbvh_bmesh_node_lookup_index(bvh, key)];
}
-static BMVert *pbvh_bmesh_vert_create(PBVH *bvh, int node_index,
- const float co[3],
- const BMVert *example,
- const int cd_vert_mask_offset,
- const int cd_vert_node_offset)
+/* typecheck */
+#define pbvh_bmesh_node_lookup_index(bvh, key) ( \
+ CHECK_TYPE_ANY(key, BMFace *, BMVert *), \
+ pbvh_bmesh_node_lookup_index(bvh, key))
+#define pbvh_bmesh_node_lookup(bvh, key) ( \
+ CHECK_TYPE_ANY(key, BMFace *, BMVert *), \
+ pbvh_bmesh_node_lookup(bvh, key))
+
+
+static BMVert *pbvh_bmesh_vert_create(
+ PBVH *bvh, int node_index,
+ const float co[3],
+ const BMVert *example,
+ const int cd_vert_mask_offset)
{
BMVert *v = BM_vert_create(bvh->bm, co, example, BM_CREATE_NOP);
PBVHNode *node = &bvh->nodes[node_index];
@@ -303,7 +330,7 @@ static BMVert *pbvh_bmesh_vert_create(PBVH *bvh, int node_index,
BLI_assert((bvh->totnode == 1 || node_index) && node_index <= bvh->totnode);
BLI_gset_insert(node->bm_unique_verts, v);
- BM_ELEM_CD_SET_INT(v, cd_vert_node_offset, node_index);
+ BM_ELEM_CD_SET_INT(v, bvh->cd_vert_node_offset, node_index);
node->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateBB;
@@ -313,9 +340,10 @@ static BMVert *pbvh_bmesh_vert_create(PBVH *bvh, int node_index,
return v;
}
-static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index,
- BMVert *v_tri[3], BMEdge *e_tri[3],
- const BMFace *f_example, const int cd_face_node_offset)
+static BMFace *pbvh_bmesh_face_create(
+ PBVH *bvh, int node_index,
+ BMVert *v_tri[3], BMEdge *e_tri[3],
+ const BMFace *f_example)
{
BMFace *f;
PBVHNode *node = &bvh->nodes[node_index];
@@ -327,7 +355,7 @@ static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index,
f->head.hflag = f_example->head.hflag;
BLI_gset_insert(node->bm_faces, f);
- BM_ELEM_CD_SET_INT(f, cd_face_node_offset, node_index);
+ BM_ELEM_CD_SET_INT(f, bvh->cd_face_node_offset, node_index);
/* mark node for update */
node->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateNormals;
@@ -340,7 +368,7 @@ static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index,
}
/* Return the number of faces in 'node' that use vertex 'v' */
-static int pbvh_bmesh_node_vert_use_count(PBVH *bvh, PBVHNode *node, BMVert *v, const int cd_face_node_offset)
+static int pbvh_bmesh_node_vert_use_count(PBVH *bvh, PBVHNode *node, BMVert *v)
{
BMIter bm_iter;
BMFace *f;
@@ -349,7 +377,7 @@ static int pbvh_bmesh_node_vert_use_count(PBVH *bvh, PBVHNode *node, BMVert *v,
BM_ITER_ELEM (f, &bm_iter, v, BM_FACES_OF_VERT) {
PBVHNode *f_node;
- f_node = pbvh_bmesh_node_lookup(bvh, f, cd_face_node_offset);
+ f_node = pbvh_bmesh_node_lookup(bvh, f);
if (f_node == node)
count++;
@@ -359,20 +387,18 @@ static int pbvh_bmesh_node_vert_use_count(PBVH *bvh, PBVHNode *node, BMVert *v,
}
/* Return a node that uses vertex 'v' other than its current owner */
-static PBVHNode *pbvh_bmesh_vert_other_node_find(PBVH *bvh, BMVert *v,
- const int cd_vert_node_offset,
- const int cd_face_node_offset)
+static PBVHNode *pbvh_bmesh_vert_other_node_find(PBVH *bvh, BMVert *v)
{
BMIter bm_iter;
BMFace *f;
PBVHNode *current_node;
- current_node = pbvh_bmesh_node_lookup(bvh, v, cd_vert_node_offset);
+ current_node = pbvh_bmesh_node_lookup(bvh, v);
BM_ITER_ELEM (f, &bm_iter, v, BM_FACES_OF_VERT) {
PBVHNode *f_node;
- f_node = pbvh_bmesh_node_lookup(bvh, f, cd_face_node_offset);
+ f_node = pbvh_bmesh_node_lookup(bvh, f);
if (f_node != current_node)
return f_node;
@@ -381,12 +407,13 @@ static PBVHNode *pbvh_bmesh_vert_other_node_find(PBVH *bvh, BMVert *v,
return NULL;
}
-static void pbvh_bmesh_vert_ownership_transfer(PBVH *bvh, PBVHNode *new_owner,
- BMVert *v, const int cd_vert_node_offset)
+static void pbvh_bmesh_vert_ownership_transfer(
+ PBVH *bvh, PBVHNode *new_owner,
+ BMVert *v)
{
PBVHNode *current_owner;
- current_owner = pbvh_bmesh_node_lookup(bvh, v, cd_vert_node_offset);
+ current_owner = pbvh_bmesh_node_lookup(bvh, v);
/* mark node for update */
current_owner->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateBB;
@@ -397,7 +424,7 @@ static void pbvh_bmesh_vert_ownership_transfer(PBVH *bvh, PBVHNode *new_owner,
BLI_gset_remove(current_owner->bm_unique_verts, v, NULL);
/* Set new ownership */
- BM_ELEM_CD_SET_INT(v, cd_vert_node_offset, new_owner - bvh->nodes);
+ BM_ELEM_CD_SET_INT(v, bvh->cd_vert_node_offset, new_owner - bvh->nodes);
BLI_gset_insert(new_owner->bm_unique_verts, v);
BLI_gset_remove(new_owner->bm_other_verts, v, NULL);
BLI_assert(!BLI_gset_haskey(new_owner->bm_other_verts, v));
@@ -406,20 +433,31 @@ static void pbvh_bmesh_vert_ownership_transfer(PBVH *bvh, PBVHNode *new_owner,
new_owner->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateBB;
}
-static void pbvh_bmesh_vert_remove(PBVH *bvh, BMVert *v, const int cd_vert_node_offset, const int cd_face_node_offset)
+static void pbvh_bmesh_vert_remove(PBVH *bvh, BMVert *v)
{
PBVHNode *v_node;
BMIter bm_iter;
BMFace *f;
- v_node = pbvh_bmesh_node_lookup(bvh, v, cd_vert_node_offset);
+ /* never match for first time */
+ int f_node_index_prev = DYNTOPO_NODE_NONE;
+
+ v_node = pbvh_bmesh_node_lookup(bvh, v);
BLI_gset_remove(v_node->bm_unique_verts, v, NULL);
- BM_ELEM_CD_SET_INT(v, cd_vert_node_offset, DYNTOPO_NODE_NONE);
+ BM_ELEM_CD_SET_INT(v, bvh->cd_vert_node_offset, DYNTOPO_NODE_NONE);
/* Have to check each neighboring face's node */
BM_ITER_ELEM (f, &bm_iter, v, BM_FACES_OF_VERT) {
- PBVHNode *f_node = pbvh_bmesh_node_lookup(bvh, f, cd_face_node_offset);
+ const int f_node_index = pbvh_bmesh_node_lookup_index(bvh, f);
+ PBVHNode *f_node;
+
+ /* faces often share the same node,
+ * quick check to avoid redundant #BLI_gset_remove calls */
+ if (f_node_index_prev == f_node_index)
+ continue;
+ f_node_index_prev = f_node_index;
+ f_node = &bvh->nodes[f_node_index];
f_node->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateBB;
/* Remove current ownership */
@@ -430,7 +468,7 @@ static void pbvh_bmesh_vert_remove(PBVH *bvh, BMVert *v, const int cd_vert_node_
}
}
-static void pbvh_bmesh_face_remove(PBVH *bvh, BMFace *f, const int cd_vert_node_offset, const int cd_face_node_offset)
+static void pbvh_bmesh_face_remove(PBVH *bvh, BMFace *f)
{
PBVHNode *f_node;
BMVert *v;
@@ -438,23 +476,23 @@ static void pbvh_bmesh_face_remove(PBVH *bvh, BMFace *f, const int cd_vert_node_
BMLoop *l_iter;
BMLoop *l_first;
- f_node = pbvh_bmesh_node_lookup(bvh, f, cd_face_node_offset);
+ f_node = pbvh_bmesh_node_lookup(bvh, f);
/* Check if any of this face's vertices need to be removed
* from the node */
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
v = l_iter->v;
- if (pbvh_bmesh_node_vert_use_count(bvh, f_node, v, cd_face_node_offset) == 1) {
+ if (pbvh_bmesh_node_vert_use_count(bvh, f_node, v) == 1) {
if (BLI_gset_haskey(f_node->bm_unique_verts, v)) {
/* Find a different node that uses 'v' */
PBVHNode *new_node;
- new_node = pbvh_bmesh_vert_other_node_find(bvh, v, cd_vert_node_offset, cd_face_node_offset);
+ new_node = pbvh_bmesh_vert_other_node_find(bvh, v);
BLI_assert(new_node || BM_vert_face_count(v) == 1);
if (new_node) {
- pbvh_bmesh_vert_ownership_transfer(bvh, new_node, v, cd_vert_node_offset);
+ pbvh_bmesh_vert_ownership_transfer(bvh, new_node, v);
}
}
else {
@@ -466,7 +504,7 @@ static void pbvh_bmesh_face_remove(PBVH *bvh, BMFace *f, const int cd_vert_node_
/* Remove face from node and top level */
BLI_gset_remove(f_node->bm_faces, f, NULL);
- BM_ELEM_CD_SET_INT(f, cd_face_node_offset, DYNTOPO_NODE_NONE);
+ BM_ELEM_CD_SET_INT(f, bvh->cd_face_node_offset, DYNTOPO_NODE_NONE);
/* Log removed face */
BM_log_face_removed(bvh->bm_log, f);
@@ -817,7 +855,7 @@ static void pbvh_bmesh_delete_vert_face(PBVH *bvh, BMVert *v, BMFace *f_del, GSe
for (j = 0; j < 3; j++) {
if (v_tri[j] != v && BM_vert_face_count(v_tri[j]) == 1) {
BLI_gset_insert(deleted_verts, v_tri[j]);
- pbvh_bmesh_vert_remove(bvh, v_tri[j], eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_vert_remove(bvh, v_tri[j]);
}
else {
v_tri[j] = NULL;
@@ -825,7 +863,7 @@ static void pbvh_bmesh_delete_vert_face(PBVH *bvh, BMVert *v, BMFace *f_del, GSe
}
/* Remove the face */
- pbvh_bmesh_face_remove(bvh, f_del, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_face_remove(bvh, f_del);
BM_face_kill(bvh->bm, f_del);
/* Check if any of the face's edges are now unused by any
@@ -848,7 +886,7 @@ static void pbvh_bmesh_delete_vert_face(PBVH *bvh, BMVert *v, BMFace *f_del, GSe
/**
* Same as #pbvh_bmesh_delete_vert_face but keeps verts
*/
-static void pbvh_bmesh_delete_edge_face(PBVH *bvh, BMFace *f_del, EdgeQueueContext *eq_ctx)
+static void pbvh_bmesh_delete_edge_face(PBVH *bvh, BMFace *f_del)
{
BMLoop *l_iter;
BMEdge *e_tri[3];
@@ -862,7 +900,7 @@ static void pbvh_bmesh_delete_edge_face(PBVH *bvh, BMFace *f_del, EdgeQueueConte
e_tri[2] = l_iter->e;
/* Remove the face */
- pbvh_bmesh_face_remove(bvh, f_del, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_face_remove(bvh, f_del);
BM_face_kill(bvh->bm, f_del);
/* Check if any of the face's edges are now unused by any
@@ -1005,7 +1043,7 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, PBVH *bvh,
mid_v3_v3v3(mid, e->v1->co, e->v2->co);
node_index = BM_ELEM_CD_GET_INT(e->v1, eq_ctx->cd_vert_node_offset);
- v_new = pbvh_bmesh_vert_create(bvh, node_index, mid, e->v1, eq_ctx->cd_vert_mask_offset, eq_ctx->cd_vert_node_offset);
+ v_new = pbvh_bmesh_vert_create(bvh, node_index, mid, e->v1, eq_ctx->cd_vert_mask_offset);
/* update paint mask */
if (eq_ctx->cd_vert_mask_offset != -1) {
@@ -1039,14 +1077,14 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, PBVH *bvh,
v2 = l_adj->next->v;
if (ni != node_index && i == 0)
- pbvh_bmesh_vert_ownership_transfer(bvh, &bvh->nodes[ni], v_new, eq_ctx->cd_vert_node_offset);
+ pbvh_bmesh_vert_ownership_transfer(bvh, &bvh->nodes[ni], v_new);
/* Create two new faces */
v_tri[0] = v1;
v_tri[1] = v_new;
v_tri[2] = v_opp;
bm_edges_from_tri(bvh->bm, v_tri, e_tri);
- f_new = pbvh_bmesh_face_create(bvh, ni, v_tri, e_tri, f_adj, eq_ctx->cd_face_node_offset);
+ f_new = pbvh_bmesh_face_create(bvh, ni, v_tri, e_tri, f_adj);
long_edge_queue_face_add(eq_ctx, f_new);
v_tri[0] = v_new;
@@ -1055,11 +1093,11 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, PBVH *bvh,
e_tri[0] = BM_edge_create(bvh->bm, v_tri[0], v_tri[1], NULL, BM_CREATE_NO_DOUBLE);
e_tri[2] = e_tri[1]; /* switched */
e_tri[1] = BM_edge_create(bvh->bm, v_tri[1], v_tri[2], NULL, BM_CREATE_NO_DOUBLE);
- f_new = pbvh_bmesh_face_create(bvh, ni, v_tri, e_tri, f_adj, eq_ctx->cd_face_node_offset);
+ f_new = pbvh_bmesh_face_create(bvh, ni, v_tri, e_tri, f_adj);
long_edge_queue_face_add(eq_ctx, f_new);
/* Delete original */
- pbvh_bmesh_face_remove(bvh, f_adj, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_face_remove(bvh, f_adj);
BM_face_kill(bvh->bm, f_adj);
/* Ensure new vertex is in the node */
@@ -1146,13 +1184,13 @@ static void pbvh_bmesh_collapse_edge(
}
/* Remove the merge vertex from the PBVH */
- pbvh_bmesh_vert_remove(bvh, v_del, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_vert_remove(bvh, v_del);
/* Remove all faces adjacent to the edge */
while ((l_adj = e->l)) {
BMFace *f_adj = l_adj->f;
- pbvh_bmesh_face_remove(bvh, f_adj, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_face_remove(bvh, f_adj);
BM_face_kill(bvh->bm, f_adj);
}
@@ -1165,7 +1203,8 @@ static void pbvh_bmesh_collapse_edge(
/* Note: this could be done with BM_vert_splice(), but that
* requires handling other issues like duplicate edges, so doesn't
* really buy anything. */
- deleted_faces->count = 0;
+ BLI_buffer_empty(deleted_faces);
+
BM_ITER_ELEM (f, &bm_iter, v_del, BM_FACES_OF_VERT) {
BMVert *v_tri[3];
BMFace *existing_face;
@@ -1191,10 +1230,10 @@ static void pbvh_bmesh_collapse_edge(
}
else {
BMEdge *e_tri[3];
- n = pbvh_bmesh_node_lookup(bvh, f, eq_ctx->cd_face_node_offset);
+ n = pbvh_bmesh_node_lookup(bvh, f);
ni = n - bvh->nodes;
bm_edges_from_tri(bvh->bm, v_tri, e_tri);
- pbvh_bmesh_face_create(bvh, ni, v_tri, e_tri, f, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_face_create(bvh, ni, v_tri, e_tri, f);
/* Ensure that v_conn is in the new face's node */
if (!BLI_gset_haskey(n->bm_unique_verts, v_conn) &&
@@ -1355,7 +1394,7 @@ static bool pbvh_bmesh_collapse_small_tetrahedrons(
/* Remove all faces adjacent to the edge, we _KNOW_ there are 2! */
while ((l_adj = e->l)) {
BMFace *f_adj = l_adj->f;
- pbvh_bmesh_face_remove(bvh, f_adj, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_face_remove(bvh, f_adj);
BM_face_kill(bvh->bm, f_adj);
}
@@ -1686,7 +1725,7 @@ static void pbvh_bridge_loops(
if (e_tri[1]->l) {
BMLoop *l_rim = e_tri[1]->l;
BMFace *f_rim = l_rim->f;
- PBVHNode *n = pbvh_bmesh_node_lookup(bvh, f_rim, bvh->cd_face_node_offset);
+ PBVHNode *n = pbvh_bmesh_node_lookup(bvh, f_rim);
const int ni = n - bvh->nodes;
/* winding should be correct in most cases (when verts face away from eachother at least)...
@@ -1696,7 +1735,7 @@ static void pbvh_bridge_loops(
SWAP(BMEdge *, e_tri[0], e_tri[2]);
}
- f_new = pbvh_bmesh_face_create(bvh, ni, v_tri, e_tri, f_rim, bvh->cd_face_node_offset);
+ f_new = pbvh_bmesh_face_create(bvh, ni, v_tri, e_tri, f_rim);
(void)f_new;
for (i = 0; i < 3; i++) {
@@ -1782,14 +1821,14 @@ static void pbvh_bmesh_collapse_close_verts(EdgeQueueContext *eq_ctx,
pbvh_bmesh_delete_edge_face_tagged_radial(bvh, l->next, eq_ctx);
#endif
BLI_assert(BM_ELEM_CD_GET_INT(l->f, eq_ctx->cd_face_node_offset) != DYNTOPO_NODE_NONE);
- pbvh_bmesh_delete_edge_face(bvh, l->f, eq_ctx);
+ pbvh_bmesh_delete_edge_face(bvh, l->f);
}
while ((l = BM_vert_find_first_loop(v2))) {
#ifdef USE_BRIDGE_MERGE_HOLES
pbvh_bmesh_delete_edge_face_tagged_radial(bvh, l->next, eq_ctx);
#endif
BLI_assert(BM_ELEM_CD_GET_INT(l->f, eq_ctx->cd_face_node_offset) != DYNTOPO_NODE_NONE);
- pbvh_bmesh_delete_edge_face(bvh, l->f, eq_ctx);
+ pbvh_bmesh_delete_edge_face(bvh, l->f);
}
/* Note, maybe this should be done after deletion of the vertices? */
@@ -1807,9 +1846,9 @@ static void pbvh_bmesh_collapse_close_verts(EdgeQueueContext *eq_ctx,
}
if (BM_ELEM_CD_GET_INT(v1, eq_ctx->cd_vert_node_offset) != DYNTOPO_NODE_NONE)
- pbvh_bmesh_vert_remove(bvh, v1, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_vert_remove(bvh, v1);
if (BM_ELEM_CD_GET_INT(v2, eq_ctx->cd_vert_node_offset) != DYNTOPO_NODE_NONE)
- pbvh_bmesh_vert_remove(bvh, v2, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset);
+ pbvh_bmesh_vert_remove(bvh, v2);
BM_log_vert_removed(bvh->bm_log, v1, eq_ctx->cd_vert_mask_offset);
BM_vert_kill(bvh->bm, v1);
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 89245d2300d..90ac712e55a 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -33,8 +33,6 @@
/* Part of the code copied from elbeem fluid library, copyright by Nils Thuerey */
-#include <GL/glew.h>
-
#include "MEM_guardedalloc.h"
#include <float.h>
@@ -84,6 +82,8 @@
#include "RE_shader_ext.h"
+#include "GPU_glew.h"
+
/* UNUSED so far, may be enabled later */
/* #define USE_SMOKE_COLLISION_DM */
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 2e96eecebcf..0bd9517dcfd 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -72,10 +72,9 @@
# include "BLI_array.h"
#endif
-#include "GL/glew.h"
-
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "GPU_glew.h"
#include "GPU_material.h"
#include "CCGSubSurf.h"
diff --git a/source/blender/blenlib/BLI_buffer.h b/source/blender/blenlib/BLI_buffer.h
index 9c4b4b00b24..700abcad9bd 100644
--- a/source/blender/blenlib/BLI_buffer.h
+++ b/source/blender/blenlib/BLI_buffer.h
@@ -88,13 +88,15 @@ enum {
#define BLI_buffer_resize_data(buffer_, type_, new_count_) ( \
(BLI_buffer_resize(buffer_, new_count_), new_count_ ? BLI_buffer_array(buffer_, type_) : NULL))
-
-
#define BLI_buffer_append(buffer_, type_, val_) ( \
BLI_buffer_resize(buffer_, (buffer_)->count + 1), \
(BLI_buffer_at(buffer_, type_, (buffer_)->count - 1) = val_) \
)
+#define BLI_buffer_empty(buffer_) { \
+ (buffer_)->count = 0; \
+} (void)0
+
/* Never decreases the amount of memory allocated */
void BLI_buffer_resize(BLI_Buffer *buffer, int new_count);
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 494bc4083ba..07de074e717 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -146,32 +146,6 @@ static const int NAN_INT = 0x7FC00000;
# endif
#endif
-/* Causes warning:
- * incompatible types when assigning to type 'Foo' from type 'Bar'
- * ... the compiler optimizes away the temp var */
-#ifndef CHECK_TYPE
-#ifdef __GNUC__
-#define CHECK_TYPE(var, type) { \
- typeof(var) *__tmp; \
- __tmp = (type *)NULL; \
- (void)__tmp; \
-} (void)0
-#else
-#define CHECK_TYPE(var, type)
-#endif
-#endif
-
-#ifndef SWAP
-# define SWAP(type, a, b) { \
- type sw_ap; \
- CHECK_TYPE(a, type); \
- CHECK_TYPE(b, type); \
- sw_ap = (a); \
- (a) = (b); \
- (b) = sw_ap; \
-} (void)0
-#endif
-
#if BLI_MATH_DO_INLINE
#include "intern/math_base_inline.c"
#endif
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 81ca2908619..ba32b29becc 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -275,17 +275,22 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f
/********************************** Normals **********************************/
-void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
- float n4[3], const float f_no[3], const float co1[3], const float co2[3],
- const float co3[3], const float co4[3]);
+void accumulate_vertex_normals(
+ float n1[3], float n2[3], float n3[3], float n4[3],
+ const float f_no[3],
+ const float co1[3], const float co2[3], const float co3[3], const float co4[3]);
-void accumulate_vertex_normals_poly(float **vertnos, const float polyno[3],
- const float **vertcos, float vdiffs[][3], const int nverts);
+void accumulate_vertex_normals_poly(
+ float **vertnos, const float polyno[3],
+ const float **vertcos, float vdiffs[][3], const int nverts);
/********************************* Tangents **********************************/
-void tangent_from_uv(float uv1[2], float uv2[2], float uv3[2],
- float co1[3], float co2[3], float co3[3], float n[3], float tang[3]);
+void tangent_from_uv(
+ const float uv1[2], const float uv2[2], const float uv3[2],
+ const float co1[3], const float co2[3], const float co3[3],
+ const float n[3],
+ float r_tang[3]);
/******************************** Vector Clouds ******************************/
diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h
index c86b3aea503..879af446469 100644
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@ -40,6 +40,9 @@
struct RNG;
typedef struct RNG RNG;
+struct RNG_THREAD_ARRAY;
+typedef struct RNG_THREAD_ARRAY RNG_THREAD_ARRAY;
+
struct RNG *BLI_rng_new(unsigned int seed);
struct RNG *BLI_rng_new_srandom(unsigned int seed);
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1);
@@ -89,4 +92,9 @@ int BLI_thread_rand(int thread) ATTR_WARN_UNUSED_RESULT;
/** Allows up to BLENDER_MAX_THREADS threads to address */
float BLI_thread_frand(int thread) ATTR_WARN_UNUSED_RESULT;
+/** array versions for thread safe random generation */
+RNG_THREAD_ARRAY *BLI_rng_threaded_new(void);
+void BLI_rng_threaded_free(struct RNG_THREAD_ARRAY *rngarr) ATTR_NONNULL(1);
+int BLI_rng_thread_rand(RNG_THREAD_ARRAY *rngarr, int thread) ATTR_WARN_UNUSED_RESULT;
+
#endif /* __BLI_RAND_H__ */
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 496e5362cc4..da0855ad022 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -3231,9 +3231,10 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f
/********************************* Normals **********************************/
-void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
- float n4[3], const float f_no[3], const float co1[3], const float co2[3],
- const float co3[3], const float co4[3])
+void accumulate_vertex_normals(
+ float n1[3], float n2[3], float n3[3], float n4[3],
+ const float f_no[3],
+ const float co1[3], const float co2[3], const float co3[3], const float co4[3])
{
float vdiffs[4][3];
const int nverts = (n4 != NULL && co4 != NULL) ? 4 : 3;
@@ -3305,7 +3306,11 @@ void accumulate_vertex_normals_poly(float **vertnos, const float polyno[3],
/********************************* Tangents **********************************/
-void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], float co2[3], float co3[3], float n[3], float tang[3])
+void tangent_from_uv(
+ const float uv1[2], const float uv2[2], const float uv3[3],
+ const float co1[3], const float co2[3], const float co3[3],
+ const float n[3],
+ float r_tang[3])
{
const float s1 = uv2[0] - uv1[0];
const float s2 = uv3[0] - uv1[0];
@@ -3313,7 +3318,8 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo
const float t2 = uv3[1] - uv1[1];
float det = (s1 * t2 - s2 * t1);
- if (det != 0.0f) { /* otherwise 'tang' becomes nan */
+ /* otherwise 'r_tang' becomes nan */
+ if (det != 0.0f) {
float tangv[3], ct[3], e1[3], e2[3];
det = 1.0f / det;
@@ -3321,21 +3327,21 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo
/* normals in render are inversed... */
sub_v3_v3v3(e1, co1, co2);
sub_v3_v3v3(e2, co1, co3);
- tang[0] = (t2 * e1[0] - t1 * e2[0]) * det;
- tang[1] = (t2 * e1[1] - t1 * e2[1]) * det;
- tang[2] = (t2 * e1[2] - t1 * e2[2]) * det;
+ r_tang[0] = (t2 * e1[0] - t1 * e2[0]) * det;
+ r_tang[1] = (t2 * e1[1] - t1 * e2[1]) * det;
+ r_tang[2] = (t2 * e1[2] - t1 * e2[2]) * det;
tangv[0] = (s1 * e2[0] - s2 * e1[0]) * det;
tangv[1] = (s1 * e2[1] - s2 * e1[1]) * det;
tangv[2] = (s1 * e2[2] - s2 * e1[2]) * det;
- cross_v3_v3v3(ct, tang, tangv);
+ cross_v3_v3v3(ct, r_tang, tangv);
/* check flip */
if (dot_v3v3(ct, n) < 0.0f) {
- negate_v3(tang);
+ negate_v3(r_tang);
}
}
else {
- tang[0] = tang[1] = tang[2] = 0.0f;
+ zero_v3(r_tang);
}
}
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c
index 3dff0b31091..59ccf381f29 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -245,3 +245,29 @@ float BLI_thread_frand(int thread)
return BLI_rng_get_float(&rng_tab[thread]);
}
+struct RNG_THREAD_ARRAY {
+ RNG rng_tab[BLENDER_MAX_THREADS];
+};
+
+RNG_THREAD_ARRAY *BLI_rng_threaded_new(void)
+{
+ unsigned int i;
+ RNG_THREAD_ARRAY *rngarr = MEM_mallocN(sizeof(RNG_THREAD_ARRAY), "random_array");
+
+ for (i = 0; i < BLENDER_MAX_THREADS; i++) {
+ BLI_rng_srandom(&rngarr->rng_tab[i], (unsigned int)clock());
+ }
+
+ return rngarr;
+}
+
+void BLI_rng_threaded_free(struct RNG_THREAD_ARRAY *rngarr)
+{
+ MEM_freeN(rngarr);
+}
+
+int BLI_rng_thread_rand(RNG_THREAD_ARRAY *rngarr, int thread)
+{
+ return BLI_rng_get_int(&rngarr->rng_tab[thread]);
+}
+
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index 0bb1a892ffe..709a174731f 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -423,9 +423,7 @@ static void bm_log_id_ghash_retake(RangeTreeUInt *unused_ids, GHash *id_ghash)
void *key = BLI_ghashIterator_getKey(&gh_iter);
unsigned int id = GET_UINT_FROM_POINTER(key);
- if (range_tree_uint_has(unused_ids, id)) {
- range_tree_uint_take(unused_ids, id);
- }
+ range_tree_uint_retake(unused_ids, id);
}
}
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index e2be90e7baf..aba805cccd7 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1676,7 +1676,8 @@ static BMOpDefine bmo_bevel_def = {
{"offset_type", BMO_OP_SLOT_INT}, /* how to measure offset (enum) */
{"segments", BMO_OP_SLOT_INT}, /* number of segments in bevel */
{"profile", BMO_OP_SLOT_FLT}, /* profile shape, 0->1 (.5=>round) */
- {"vertex_only", BMO_OP_SLOT_BOOL}, /* only bevel vertices, not edges */
+ {"vertex_only", BMO_OP_SLOT_BOOL}, /* only bevel vertices, not edges */
+ {"clamp_overlap", BMO_OP_SLOT_BOOL}, /* do not allow beveled edges/vertices to overlap each other */
{"material", BMO_OP_SLOT_INT}, /* material for bevel faces, -1 means get from adjacent faces */
{{'\0'}},
},
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index 213a0830e63..864c4dada6d 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -35,12 +35,13 @@
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
{
- const float offset = BMO_slot_float_get(op->slots_in, "offset");
- const int offset_type = BMO_slot_int_get(op->slots_in, "offset_type");
- const int seg = BMO_slot_int_get(op->slots_in, "segments");
- const bool vonly = BMO_slot_bool_get(op->slots_in, "vertex_only");
- const float profile = BMO_slot_float_get(op->slots_in, "profile");
- const int material = BMO_slot_int_get(op->slots_in, "material");
+ const float offset = BMO_slot_float_get(op->slots_in, "offset");
+ const int offset_type = BMO_slot_int_get(op->slots_in, "offset_type");
+ const int seg = BMO_slot_int_get(op->slots_in, "segments");
+ const bool vonly = BMO_slot_bool_get(op->slots_in, "vertex_only");
+ const float profile = BMO_slot_float_get(op->slots_in, "profile");
+ const bool clamp_overlap = BMO_slot_bool_get(op->slots_in, "clamp_overlap");
+ const int material = BMO_slot_int_get(op->slots_in, "material");
if (offset > 0) {
BMOIter siter;
@@ -61,7 +62,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
}
}
- BM_mesh_bevel(bm, offset, offset_type, seg, profile, vonly, false, false, NULL, -1, material);
+ BM_mesh_bevel(bm, offset, offset_type, seg, profile, vonly, false, clamp_overlap, NULL, -1, material);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG);
}
diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c
index ed9e8783037..463304f27f7 100644
--- a/source/blender/bmesh/tools/bmesh_bisect_plane.c
+++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c
@@ -294,9 +294,10 @@ finally:
* \param use_tag Only bisect tagged edges and faces.
* \param oflag_center Operator flag, enabled for geometry on the axis (existing and created)
*/
-void BM_mesh_bisect_plane(BMesh *bm, float plane[4],
- const bool use_snap_center, const bool use_tag,
- const short oflag_center, const float eps)
+void BM_mesh_bisect_plane(
+ BMesh *bm, const float plane[4],
+ const bool use_snap_center, const bool use_tag,
+ const short oflag_center, const float eps)
{
unsigned int einput_len;
unsigned int i;
diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.h b/source/blender/bmesh/tools/bmesh_bisect_plane.h
index 15f902642c8..7f3a97c4c79 100644
--- a/source/blender/bmesh/tools/bmesh_bisect_plane.h
+++ b/source/blender/bmesh/tools/bmesh_bisect_plane.h
@@ -27,8 +27,9 @@
* \ingroup bmesh
*/
-void BM_mesh_bisect_plane(BMesh *bm, float plane[4],
- const bool use_snap_center, const bool use_tag,
- const short oflag_center, const float eps);
+void BM_mesh_bisect_plane(
+ BMesh *bm, const float plane[4],
+ const bool use_snap_center, const bool use_tag,
+ const short oflag_center, const float eps);
#endif /* __BMESH_BISECT_PLANE_H__ */
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index d6030a967d5..b9f50a6cdf1 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -23,10 +23,12 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -57,4 +59,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/animation/SConscript b/source/blender/editors/animation/SConscript
index 91d480978c4..ed4b794cbce 100644
--- a/source/blender/editors/animation/SConscript
+++ b/source/blender/editors/animation/SConscript
@@ -31,17 +31,19 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../makesdna',
'../../makesrna',
'../../windowmanager',
]
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 83593faff22..7f612de14b7 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -643,7 +643,7 @@ static short snap_bezier_nearestsec(KeyframeEditData *ked, BezTriple *bezt)
const float secf = (float)FPS;
if (bezt->f2 & SELECT)
- bezt->vec[1][0] = ((float)floor(bezt->vec[1][0] / secf + 0.5f) * secf);
+ bezt->vec[1][0] = (floorf(bezt->vec[1][0] / secf + 0.5f) * secf);
return 0;
}
diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt
index 9aa17f1e503..fc211f0e60b 100644
--- a/source/blender/editors/armature/CMakeLists.txt
+++ b/source/blender/editors/armature/CMakeLists.txt
@@ -23,11 +23,12 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
- ../../gpu
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -74,4 +75,6 @@ if(WITH_OPENNL)
)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript
index c68045c9398..97bc1a138b3 100644
--- a/source/blender/editors/armature/SConscript
+++ b/source/blender/editors/armature/SConscript
@@ -31,20 +31,21 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/opennl/extern',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../makesdna',
'../../makesrna',
- '../../gpu',
'../../windowmanager',
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index fbc18e977ce..5ff15b84284 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -238,7 +238,8 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i
}
}
-static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, bool mirror)
+static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par,
+ int heat, const bool mirror)
{
/* This functions implements the automatic computation of vertex group
* weights, either through envelopes or using a heat equilibrium.
@@ -418,7 +419,8 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
MEM_freeN(verts);
}
-void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, int mode, bool mirror)
+void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par,
+ const int mode, const bool mirror)
{
/* Lets try to create some vertex groups
* based on the bones of the parent armature.
@@ -439,7 +441,7 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob,
ED_vgroup_data_clamp_range(ob->data, defbase_tot);
}
}
- else if (mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) {
+ else if (ELEM(mode, ARM_GROUPS_ENVELOPE, ARM_GROUPS_AUTO)) {
/* Traverse the bone list, trying to create vertex groups
* that are populated with the vertices for which the
* bone is closest.
diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index 904ad4892ed..5dc9679777f 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -24,10 +24,12 @@ set(INC
../../blenkernel
../../blenlib
../../imbuf
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -50,4 +52,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/gpencil/SConscript b/source/blender/editors/gpencil/SConscript
index 8b891fcb8cf..ab42bad52dc 100644
--- a/source/blender/editors/gpencil/SConscript
+++ b/source/blender/editors/gpencil/SConscript
@@ -31,7 +31,8 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/elbeem/extern',
'../include',
'../../blenfont',
@@ -46,7 +47,7 @@ incs = [
'../../windowmanager',
]
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index 9fa603966b6..cd26bb22ada 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -33,7 +33,7 @@
#ifndef __BIF_GL_H__
#define __BIF_GL_H__
-#include "GL/glew.h"
+#include "GPU_glew.h"
#ifdef __APPLE__
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index b401f06f484..4272fd49f7f 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -41,10 +41,12 @@ struct ColorManagedDisplaySettings;
void fdrawbezier(float vec[4][3]);
void fdrawline(float x1, float y1, float x2, float y2);
void fdrawbox(float x1, float y1, float x2, float y2);
-void sdrawline(short x1, short y1, short x2, short y2);
-void sdrawtri(short x1, short y1, short x2, short y2);
-void sdrawtrifill(short x1, short y1, short x2, short y2);
-void sdrawbox(short x1, short y1, short x2, short y2);
+void sdrawline(int x1, int y1, int x2, int y2);
+#if 0
+void sdrawtri(int x1, int y1, int x2, int y2);
+void sdrawtrifill(int x1, int y1, int x2, int y2);
+#endif
+void sdrawbox(int x1, int y1, int x2, int y2);
void sdrawXORline(int x0, int y0, int x1, int y1);
void sdrawXORline4(int nr, int x0, int y0, int x1, int y1);
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 24c80cbf005..b08cc12dc3e 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -157,9 +157,11 @@ void ED_armature_transform(struct bArmature *arm, float mat[4][4]);
#define ARM_GROUPS_ENVELOPE 2
#define ARM_GROUPS_AUTO 3
-void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, int mode, bool mirror);
+void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob,
+ struct Object *par, const int mode, const bool mirror);
-void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */
+/* if bone is already in list, pass it as param to ignore it */
+void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone);
void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const char *newnamep);
void undo_push_armature(struct bContext *C, const char *name);
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 2328f7d5135..39586039e8f 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -101,9 +101,10 @@ extern struct EnumPropertyItem prop_clear_parent_types[];
extern struct EnumPropertyItem prop_make_parent_types[];
#endif
-int ED_object_parent_set(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob,
- struct Object *par, int partype, bool xmirror, bool keep_transform, const int vert_par[3]);
-void ED_object_parent_clear(struct Object *ob, int type);
+bool ED_object_parent_set(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob,
+ struct Object *par, int partype, const bool xmirror, const bool keep_transform,
+ const int vert_par[3]);
+void ED_object_parent_clear(struct Object *ob, const int type);
struct Base *ED_object_scene_link(struct Scene *scene, struct Object *ob);
void ED_keymap_proportional_cycle(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
@@ -122,7 +123,7 @@ void ED_base_object_free_and_unlink(struct Main *bmain, struct Scene *scene, str
/* single object duplicate, if (dupflag == 0), fully linked, else it uses the flags given */
struct Base *ED_object_add_duplicate(struct Main *bmain, struct Scene *scene, struct Base *base, int dupflag);
-void ED_object_parent(struct Object *ob, struct Object *parent, int type, const char *substr);
+void ED_object_parent(struct Object *ob, struct Object *parent, const int type, const char *substr);
bool ED_object_mode_compat_set(struct bContext *C, struct Object *ob, int mode, struct ReportList *reports);
void ED_object_toggle_modes(struct bContext *C, int mode);
@@ -154,7 +155,7 @@ struct Object *ED_object_add_type(
struct bContext *C, int type, const float loc[3], const float rot[3],
bool enter_editmode, unsigned int layer) ATTR_RETURNS_NONNULL;
-void ED_object_single_users(struct Main *bmain, struct Scene *scene, bool full, bool copy_groups);
+void ED_object_single_users(struct Main *bmain, struct Scene *scene, const bool full, const bool copy_groups);
void ED_object_single_user(struct Main *bmain, struct Scene *scene, struct Object *ob);
/* object motion paths */
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 6d9f1c4eda0..e26e03473e0 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -46,7 +46,7 @@ struct Mesh;
void ED_editors_init(struct bContext *C);
void ED_editors_exit(struct bContext *C);
-void ED_editors_flush_edits(const struct bContext *C, bool for_render);
+bool ED_editors_flush_edits(const struct bContext *C, bool for_render);
/* ************** Undo ************************ */
diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt
index e13517adbb3..b921d17104c 100644
--- a/source/blender/editors/interface/CMakeLists.txt
+++ b/source/blender/editors/interface/CMakeLists.txt
@@ -30,6 +30,7 @@ set(INC
../../python
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -70,4 +71,6 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_interface "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript
index 1936e17a7bb..303ab7ff286 100644
--- a/source/blender/editors/interface/SConscript
+++ b/source/blender/editors/interface/SConscript
@@ -31,7 +31,8 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
@@ -45,7 +46,7 @@ incs = [
'../../windowmanager',
]
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 9138ac92ab9..5bd85f855ba 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -6560,7 +6560,7 @@ static bool ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
ui_window_to_block_fl(ar, block, &mx, &my);
- if (but->dt == UI_EMBOSSR) {
+ if (but->pie_dir != UI_RADIAL_NONE) {
if (!ui_but_isect_pie_seg(block, but)) {
return false;
}
@@ -8521,14 +8521,6 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo
}
if (menu->menuretval) {
- /* pie menus should not close but wait for release instead */
- if ((block->flag & UI_BLOCK_RADIAL) &&
- !(block->pie_data.flags & UI_PIE_CLICK_STYLE))
- {
- menu->menuretval = 0;
- block->pie_data.flags |= UI_PIE_FINISHED;
- }
-
return WM_UI_HANDLER_CONTINUE;
}
else {
@@ -8538,10 +8530,10 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo
static bool ui_but_pie_menu_supported_apply(uiBut *but)
{
- return (but->type != NUMSLI);
+ return (!ELEM(but->type, NUMSLI, NUM));
}
-static int ui_but_pie_menu_apply(bContext *C, uiPopupBlockHandle *menu, uiBut *but, bool force_close, bool click_style)
+static int ui_but_pie_menu_apply(bContext *C, uiPopupBlockHandle *menu, uiBut *but, bool force_close)
{
int retval = WM_UI_HANDLER_BREAK;
@@ -8566,24 +8558,11 @@ static int ui_but_pie_menu_apply(bContext *C, uiPopupBlockHandle *menu, uiBut *b
ui_apply_button(C, but->block, but, but->active, false);
button_activate_exit((bContext *)C, but, but->active, false, true);
- if (!(click_style || force_close)) {
- but->block->pie_data.flags |= UI_PIE_FINISHED;
- menu->menuretval = 0;
- }
- else {
- menu->menuretval = UI_RETURN_OK;
- }
+ menu->menuretval = UI_RETURN_OK;
}
}
else {
- uiBlock *block = menu->region->uiblocks.first;
-
- if (!(click_style || force_close)) {
- block->pie_data.flags |= UI_PIE_FINISHED;
- }
- else {
- menu->menuretval = UI_RETURN_CANCEL;
- }
+ menu->menuretval = UI_RETURN_CANCEL;
ED_region_tag_redraw(menu->region);
}
@@ -8606,7 +8585,7 @@ static uiBut *ui_block_pie_dir_activate(uiBlock *block, const wmEvent *event, Ra
return NULL;
}
-static int ui_but_pie_button_activate(bContext *C, uiBut *but, uiPopupBlockHandle *menu, bool is_click_style)
+static int ui_but_pie_button_activate(bContext *C, uiBut *but, uiPopupBlockHandle *menu)
{
uiBut *active_but;
@@ -8619,7 +8598,7 @@ static int ui_but_pie_button_activate(bContext *C, uiBut *but, uiPopupBlockHandl
button_activate_exit(C, active_but, active_but->active, false, false);
button_activate_init(C, menu->region, but, BUTTON_ACTIVATE_OVER);
- return ui_but_pie_menu_apply(C, menu, but, false, is_click_style);
+ return ui_but_pie_menu_apply(C, menu, but, false);
}
static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
@@ -8687,7 +8666,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
mul_v2_fl(vec, pie_radius);
add_v2_v2(vec, center);
- mul_v2_fl(vec, fac);
+ mul_v2_fl(vec, fac);
add_v2_v2(vec, block->pie_data.pie_center_spawned);
BLI_rctf_recenter(&but->rect, vec[0], vec[1]);
@@ -8718,7 +8697,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
return WM_UI_HANDLER_BREAK;
}
- if (event->type == block->pie_data.event) {
+ if (event->type == block->pie_data.event && !is_click_style) {
if (event->val != KM_RELEASE) {
ui_handle_menu_button(C, event, menu);
@@ -8734,10 +8713,10 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
if (!(block->pie_data.flags & UI_PIE_DRAG_STYLE)) {
block->pie_data.flags |= UI_PIE_CLICK_STYLE;
}
- else if (!is_click_style) {
+ else {
uiBut *but = ui_but_find_activated(menu->region);
- retval = ui_but_pie_menu_apply(C, menu, but, true, is_click_style);
+ retval = ui_but_pie_menu_apply(C, menu, but, true);
}
}
}
@@ -8747,7 +8726,9 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
switch (event->type) {
case MOUSEMOVE:
- if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ) {
+ if (!is_click_style &&
+ (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ))
+ {
block->pie_data.flags |= UI_PIE_DRAG_STYLE;
}
ui_handle_menu_button(C, event, menu);
@@ -8757,9 +8738,13 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
break;
case LEFTMOUSE:
- if (event->val == KM_PRESS) {
- uiBut *but = ui_but_find_activated(menu->region);
- retval = ui_but_pie_menu_apply(C, menu, but, false, is_click_style);
+ if (is_click_style) {
+ if (block->pie_data.flags & UI_PIE_INVALID_DIR) {
+ menu->menuretval = UI_RETURN_CANCEL;
+ }
+ else {
+ retval = ui_handle_menu_button(C, event, menu);
+ }
}
break;
@@ -8808,7 +8793,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
{
for (but = block->buttons.first; but; but = but->next) {
if (but->menu_key == event->type) {
- ui_but_pie_button_activate(C, but, menu, is_click_style);
+ ui_but_pie_button_activate(C, but, menu);
}
}
}
@@ -8829,7 +8814,7 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
CASE_NUM_TO_DIR(9, UI_RADIAL_NE);
{
but = ui_block_pie_dir_activate(block, event, num_dir);
- retval = ui_but_pie_button_activate(C, but, menu, is_click_style);
+ retval = ui_but_pie_button_activate(C, but, menu);
break;
}
#undef CASE_NUM_TO_DIR
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 9b450b8fdf4..5739ebebe64 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2720,6 +2720,11 @@ uiPieMenu *uiPieMenuBegin(struct bContext *C, const char *title, int icon, const
pie->block_radial->flag |= UI_BLOCK_RADIAL;
pie->block_radial->pie_data.event = event->type;
+ /* if pie is spawned by a left click, it is always assumed to be click style */
+ if (event->type == LEFTMOUSE) {
+ pie->block_radial->flag |= UI_PIE_CLICK_STYLE;
+ }
+
pie->layout = uiBlockLayout(pie->block_radial, UI_LAYOUT_VERTICAL, UI_LAYOUT_PIEMENU, 0, 0, 200, 0, 0, style);
pie->mx = event->x;
pie->my = event->y;
diff --git a/source/blender/editors/mask/CMakeLists.txt b/source/blender/editors/mask/CMakeLists.txt
index b1cf6db3144..033d034cf4e 100644
--- a/source/blender/editors/mask/CMakeLists.txt
+++ b/source/blender/editors/mask/CMakeLists.txt
@@ -25,10 +25,12 @@ set(INC
../include
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -48,4 +50,6 @@ set(SRC
mask_intern.h
)
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_mask "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/mask/SConscript b/source/blender/editors/mask/SConscript
index 9dd521e3a7c..bcbaaa34960 100644
--- a/source/blender/editors/mask/SConscript
+++ b/source/blender/editors/mask/SConscript
@@ -29,14 +29,16 @@ Import ('env')
sources = env.Glob('*.c')
-defs = []
+defs = env['BF_GL_DEFINITIONS']
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../makesdna',
'../../makesrna',
'../../windowmanager',
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index c3959f90318..b27baaf22be 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -580,7 +580,7 @@ static bool spline_under_mouse_get(const bContext *C,
}
}
}
- /* TODO(sergey): Chech whether tesellated spline point is closer
+ /* TODO(sergey): Chech whether tessellated spline point is closer
* to the mouse than the spline center.
*/
if (closest_dist_squared < 32.0f * 32.0f && closest_spline != NULL) {
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index 0cb2dd1eb68..db20d42f39d 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -32,6 +32,7 @@ set(INC
../../render/extern/include
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -86,4 +87,6 @@ if(WITH_BULLET)
add_definitions(-DWITH_BULLET)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript
index 6fa48c12eca..122a7501e58 100644
--- a/source/blender/editors/mesh/SConscript
+++ b/source/blender/editors/mesh/SConscript
@@ -29,11 +29,12 @@ Import ('env')
sources = env.Glob('*.c')
-defs = []
+defs = env['BF_GL_DEFINITIONS']
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../uvedit',
'../../blenfont',
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 48d5113a279..0e48cbcd589 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -75,7 +75,8 @@ typedef struct {
static void edbm_bevel_update_header(bContext *C, wmOperator *op)
{
- const char *str = IFACE_("Confirm: (Enter/LMB), Cancel: (Esc/RMB), Mode: %s (M), Offset: %s, Segments: %d");
+ const char *str = IFACE_("Confirm: (Enter/LMB), Cancel: (Esc/RMB), Mode: %s (M), Clamp Overlap: %s (C), "
+ "Offset: %s, Segments: %d");
char msg[HEADER_LENGTH];
ScrArea *sa = CTX_wm_area(C);
@@ -96,7 +97,9 @@ static void edbm_bevel_update_header(bContext *C, wmOperator *op)
RNA_property_enum_name_gettexted(C, op->ptr, prop, RNA_property_enum_get(op->ptr, prop), &type_str);
- BLI_snprintf(msg, HEADER_LENGTH, str, type_str, offset_str, RNA_int_get(op->ptr, "segments"));
+ BLI_snprintf(msg, HEADER_LENGTH, str, type_str,
+ WM_bool_as_string(RNA_boolean_get(op->ptr, "clamp_overlap")),
+ offset_str, RNA_int_get(op->ptr, "segments"));
ED_area_headerprint(sa, msg);
}
@@ -150,6 +153,7 @@ static bool edbm_bevel_calc(wmOperator *op)
const int segments = RNA_int_get(op->ptr, "segments");
const float profile = RNA_float_get(op->ptr, "profile");
const bool vertex_only = RNA_boolean_get(op->ptr, "vertex_only");
+ const bool clamp_overlap = RNA_boolean_get(op->ptr, "clamp_overlap");
int material = RNA_int_get(op->ptr, "material");
/* revert to original mesh */
@@ -161,8 +165,9 @@ static bool edbm_bevel_calc(wmOperator *op)
material = CLAMPIS(material, -1, em->ob->totcol - 1);
EDBM_op_init(em, &bmop, op,
- "bevel geom=%hev offset=%f segments=%i vertex_only=%b offset_type=%i profile=%f material=%i",
- BM_ELEM_SELECT, offset, segments, vertex_only, offset_type, profile, material);
+ "bevel geom=%hev offset=%f segments=%i vertex_only=%b offset_type=%i profile=%f clamp_overlap=%b "
+ "material=%i",
+ BM_ELEM_SELECT, offset, segments, vertex_only, offset_type, profile, clamp_overlap, material);
BMO_op_exec(em->bm, &bmop);
@@ -408,6 +413,18 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
edbm_bevel_update_header(C, op);
handled = true;
break;
+ case CKEY:
+ if (event->val == KM_RELEASE)
+ break;
+
+ {
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "clamp_overlap");
+ RNA_property_enum_set(op->ptr, prop, !RNA_property_boolean_get(op->ptr, prop));
+ }
+ edbm_bevel_calc(op);
+ edbm_bevel_update_header(C, op);
+ handled = true;
+ break;
}
/* Modal numinput inactive, try to handle numeric inputs last... */
@@ -467,6 +484,8 @@ void MESH_OT_bevel(wmOperatorType *ot)
RNA_def_property_float_array_funcs_runtime(prop, NULL, NULL, mesh_ot_bevel_offset_range_func);
RNA_def_int(ot->srna, "segments", 1, 1, 50, "Segments", "Segments for curved edge", 1, 8);
RNA_def_float(ot->srna, "profile", 0.5f, 0.15f, 1.0f, "Profile", "Controls profile shape (0.5 = round)", 0.15f, 1.0f);
- RNA_def_boolean(ot->srna, "vertex_only", false, "Vertex only", "Bevel only vertices");
+ RNA_def_boolean(ot->srna, "vertex_only", false, "Vertex Only", "Bevel only vertices");
+ RNA_def_boolean(ot->srna, "clamp_overlap", false, "Clamp Overlap",
+ "Do not allow beveled edges/vertices to overlap each other");
RNA_def_int(ot->srna, "material", -1, -1, INT_MAX, "Material", "Material for bevel faces (-1 means use adjacent faces)", -1, 100);
}
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 1bb35b65918..9b380ff8d48 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -33,10 +33,11 @@ set(INC
../../render/extern/include
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
-
+ ${GLEW_INCLUDE_PATH}
)
set(SRC
@@ -62,6 +63,8 @@ set(SRC
object_intern.h
)
+add_definitions(${GL_DEFINITIONS})
+
if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index abc0516cf2b..c8a009e4129 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -128,9 +128,9 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
BPoint *bp;
Object *par;
int a, v1 = 0, v2 = 0, v3 = 0, v4 = 0, nr = 1;
-
+
/* we need 1 to 3 selected vertices */
-
+
if (obedit->type == OB_MESH) {
Mesh *me = obedit->data;
BMEditMesh *em;
@@ -160,7 +160,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
else if (ELEM(obedit->type, OB_SURF, OB_CURVE)) {
ListBase *editnurb = object_editcurve_get(obedit);
-
+
cu = obedit->data;
nu = editnurb->first;
@@ -200,7 +200,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
else if (obedit->type == OB_LATTICE) {
Lattice *lt = obedit->data;
-
+
a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
bp = lt->editlatt->latt->def;
while (a--) {
@@ -215,28 +215,24 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
bp++;
}
}
-
+
if (v4 || !((v1 && v2 == 0 && v3 == 0) || (v1 && v2 && v3))) {
BKE_report(op->reports, RPT_ERROR, "Select either 1 or 3 vertices to parent to");
return OPERATOR_CANCELLED;
}
-
+
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
if (ob != obedit) {
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
par = obedit->parent;
-
- while (par) {
- if (par == ob) break;
- par = par->parent;
- }
- if (par) {
+
+ if (BKE_object_parent_loop_check(par, ob)) {
BKE_report(op->reports, RPT_ERROR, "Loop in parents");
}
else {
Object workob;
-
+
ob->parent = BASACT->object;
if (v3) {
ob->partype = PARVERT3;
@@ -260,7 +256,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
}
CTX_DATA_END;
-
+
DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT, NULL);
@@ -274,12 +270,12 @@ void OBJECT_OT_vertex_parent_set(wmOperatorType *ot)
ot->name = "Make Vertex Parent";
ot->description = "Parent selected objects to the selected vertices";
ot->idname = "OBJECT_OT_vertex_parent_set";
-
+
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->poll = vertex_parent_set_poll;
ot->exec = vertex_parent_set_exec;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -291,26 +287,26 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
-
+
/* sanity checks */
if (!scene || scene->id.lib || !ob)
return OPERATOR_CANCELLED;
-
+
/* Get object to work on - use a menu if we need to... */
if (ob->dup_group && ob->dup_group->id.lib) {
/* gives menu with list of objects in group */
- //proxy_group_objects_menu(C, op, ob, ob->dup_group);
+ /* proxy_group_objects_menu(C, op, ob, ob->dup_group); */
WM_enum_search_invoke(C, op, event);
return OPERATOR_CANCELLED;
-
}
else if (ob->id.lib) {
uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("OK?"), ICON_QUESTION);
uiLayout *layout = uiPupMenuLayout(pup);
-
+
/* create operator menu item with relevant properties filled in */
- uiItemFullO_ptr(layout, op->type, op->type->name, ICON_NONE, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
-
+ uiItemFullO_ptr(layout, op->type, op->type->name, ICON_NONE, NULL,
+ WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
+
/* present the menu and be done... */
uiPupMenuEnd(C, pup);
}
@@ -318,7 +314,7 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* error.. cannot continue */
BKE_report(op->reports, RPT_ERROR, "Can only make proxy for a referenced object or group");
}
-
+
/* this invoke just calls another instance of this operator... */
return OPERATOR_CANCELLED;
}
@@ -338,32 +334,32 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
ob = gob;
gob = NULL;
}
-
+
if (ob) {
Object *newob;
Base *newbase, *oldbase = BASACT;
char name[MAX_ID_NAME + 4];
-
+
/* Add new object for the proxy */
newob = BKE_object_add(bmain, scene, OB_EMPTY);
BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2);
rename_id(&newob->id, name);
-
+
/* set layers OK */
newbase = BASACT; /* BKE_object_add sets active... */
newbase->lay = oldbase->lay;
newob->lay = newbase->lay;
-
+
/* remove base, leave user count of object, it gets linked in BKE_object_make_proxy */
if (gob == NULL) {
BKE_scene_base_unlink(scene, oldbase);
MEM_freeN(oldbase);
}
-
+
BKE_object_make_proxy(newob, ob, gob);
-
+
/* depsgraph flushes are needed for the new data */
DAG_relations_tag_update(bmain);
DAG_id_tag_update(&newob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
@@ -373,12 +369,13 @@ static int make_proxy_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No object to make proxy for");
return OPERATOR_CANCELLED;
}
-
+
return OPERATOR_FINISHED;
}
/* Generic itemf's for operators that take library args */
-static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
+static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), bool *r_free)
{
EnumPropertyItem item_tmp = {0}, *item = NULL;
int totitem = 0;
@@ -410,17 +407,19 @@ void OBJECT_OT_proxy_make(wmOperatorType *ot)
ot->name = "Make Proxy";
ot->idname = "OBJECT_OT_proxy_make";
ot->description = "Add empty object to become local replacement data of a library-linked object";
-
+
/* callbacks */
ot->invoke = make_proxy_invoke;
ot->exec = make_proxy_exec;
ot->poll = ED_operator_object_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
- prop = RNA_def_enum(ot->srna, "object", DummyRNA_DEFAULT_items, 0, "Proxy Object", "Name of lib-linked/grouped object to make a proxy for"); /* XXX, relies on hard coded ID at the moment */
+ /* XXX, relies on hard coded ID at the moment */
+ prop = RNA_def_enum(ot->srna, "object", DummyRNA_DEFAULT_items, 0, "Proxy Object",
+ "Name of lib-linked/grouped object to make a proxy for");
RNA_def_enum_funcs(prop, proxy_group_object_itemf);
RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
ot->prop = prop;
@@ -435,9 +434,12 @@ typedef enum eObClearParentTypes {
} eObClearParentTypes;
EnumPropertyItem prop_clear_parent_types[] = {
- {CLEAR_PARENT_ALL, "CLEAR", 0, "Clear Parent", ""},
- {CLEAR_PARENT_KEEP_TRANSFORM, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation", ""},
- {CLEAR_PARENT_INVERSE, "CLEAR_INVERSE", 0, "Clear Parent Inverse", ""},
+ {CLEAR_PARENT_ALL, "CLEAR", 0, "Clear Parent",
+ "Completely clear the parenting relationship, including involved modifiers is any"},
+ {CLEAR_PARENT_KEEP_TRANSFORM, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation",
+ "As 'Clear Parent', but keep the current visual transformations of the object"},
+ {CLEAR_PARENT_INVERSE, "CLEAR_INVERSE", 0, "Clear Parent Inverse",
+ "Reset the transform corrections applied to the parenting relationship, does not remove parenting itself"},
{0, NULL, 0, NULL, NULL}
};
@@ -446,13 +448,13 @@ static void object_remove_parent_deform_modifiers(Object *ob, const Object *par)
{
if (ELEM(par->type, OB_ARMATURE, OB_LATTICE, OB_CURVE)) {
ModifierData *md, *mdn;
-
+
/* assume that we only need to remove the first instance of matching deform modifier here */
for (md = ob->modifiers.first; md; md = mdn) {
bool free = false;
-
+
mdn = md->next;
-
+
/* need to match types (modifier + parent) and references */
if ((md->type == eModifierType_Armature) && (par->type == OB_ARMATURE)) {
ArmatureModifierData *amd = (ArmatureModifierData *)md;
@@ -472,7 +474,7 @@ static void object_remove_parent_deform_modifiers(Object *ob, const Object *par)
free = true;
}
}
-
+
/* free modifier if match */
if (free) {
BLI_remlink(&ob->modifiers, md);
@@ -482,17 +484,17 @@ static void object_remove_parent_deform_modifiers(Object *ob, const Object *par)
}
}
-void ED_object_parent_clear(Object *ob, int type)
+void ED_object_parent_clear(Object *ob, const int type)
{
if (ob->parent == NULL)
return;
-
+
switch (type) {
case CLEAR_PARENT_ALL:
{
/* for deformers, remove corresponding modifiers to prevent a large number of modifiers building up */
object_remove_parent_deform_modifiers(ob, ob->parent);
-
+
/* clear parenting relationship completely */
ob->parent = NULL;
break;
@@ -506,12 +508,15 @@ void ED_object_parent_clear(Object *ob, int type)
}
case CLEAR_PARENT_INVERSE:
{
- /* object stays parented, but the parent inverse (i.e. offset from parent to retain binding state) is cleared */
- unit_m4(ob->parentinv);
+ /* object stays parented, but the parent inverse (i.e. offset from parent to retain binding state)
+ * is cleared. In other words: nothing to do here! */
break;
}
}
-
+
+ /* Always clear parentinv matrix for sake of consistency, see T41950. */
+ unit_m4(ob->parentinv);
+
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
@@ -519,7 +524,7 @@ void ED_object_parent_clear(Object *ob, int type)
static int parent_clear_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- int type = RNA_enum_get(op->ptr, "type");
+ const int type = RNA_enum_get(op->ptr, "type");
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
@@ -539,23 +544,26 @@ void OBJECT_OT_parent_clear(wmOperatorType *ot)
ot->name = "Clear Parent";
ot->description = "Clear the object's parenting";
ot->idname = "OBJECT_OT_parent_clear";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = parent_clear_exec;
-
+
ot->poll = ED_operator_object_active_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_parent_types, CLEAR_PARENT_ALL, "Type", "");
}
/* ******************** Make Parent Operator *********************** */
-void ED_object_parent(Object *ob, Object *par, int type, const char *substr)
+void ED_object_parent(Object *ob, Object *par, const int type, const char *substr)
{
+ /* Always clear parentinv matrix for sake of consistency, see T41950. */
+ unit_m4(ob->parentinv);
+
if (!par || BKE_object_parent_loop_check(par, ob)) {
ob->parent = NULL;
ob->partype = PAROBJECT;
@@ -589,21 +597,21 @@ EnumPropertyItem prop_make_parent_types[] = {
{0, NULL, 0, NULL, NULL}
};
-int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object *ob, Object *par,
- int partype, bool xmirror, bool keep_transform, const int vert_par[3])
+bool ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object *ob, Object *par,
+ int partype, const bool xmirror, const bool keep_transform, const int vert_par[3])
{
bPoseChannel *pchan = NULL;
- int pararm = ELEM(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
-
+ const bool pararm = ELEM(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
+
DAG_id_tag_update(&par->id, OB_RECALC_OB);
-
+
/* preconditions */
if (partype == PAR_FOLLOW || partype == PAR_PATH_CONST) {
if (par->type != OB_CURVE)
return 0;
else {
Curve *cu = par->data;
-
+
if ((cu->flag & CU_PATH) == 0) {
cu->flag |= CU_PATH | CU_FOLLOW;
BKE_displist_make_curveTypes(scene, par, 0); /* force creation of path data */
@@ -617,12 +625,12 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* get or create F-Curve */
bAction *act = verify_adt_action(&cu->id, 1);
FCurve *fcu = verify_fcurve(act, NULL, NULL, "eval_time", 0, 1);
-
+
/* setup dummy 'generator' modifier here to get 1-1 correspondence still working */
if (!fcu->bezt && !fcu->fpt && !fcu->modifiers.first)
add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR);
}
-
+
/* fall back on regular parenting now (for follow only) */
if (partype == PAR_FOLLOW)
partype = PAR_OBJECT;
@@ -630,17 +638,17 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
}
else if (ELEM(partype, PAR_BONE, PAR_BONE_RELATIVE)) {
pchan = BKE_pose_channel_active(par);
-
+
if (pchan == NULL) {
BKE_report(reports, RPT_ERROR, "No active bone");
- return 0;
+ return false;
}
}
-
+
if (ob != par) {
if (BKE_object_parent_loop_check(par, ob)) {
BKE_report(reports, RPT_ERROR, "Loop in parents");
- return 0;
+ return false;
}
else {
Object workob;
@@ -655,14 +663,16 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* set the parent (except for follow-path constraint option) */
if (partype != PAR_PATH_CONST) {
ob->parent = par;
+ /* Always clear parentinv matrix for sake of consistency, see T41950. */
+ unit_m4(ob->parentinv);
}
-
+
/* handle types */
if (pchan)
BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr));
else
ob->parsubstr[0] = 0;
-
+
if (partype == PAR_PATH_CONST) {
/* don't do anything here, since this is not technically "parenting" */
}
@@ -670,17 +680,18 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* partype is now set to PAROBJECT so that invisible 'virtual' modifiers don't need to be created
* NOTE: the old (2.4x) method was to set ob->partype = PARSKEL, creating the virtual modifiers
*/
- ob->partype = PAROBJECT; /* note, dna define, not operator property */
- //ob->partype = PARSKEL; /* note, dna define, not operator property */
-
- /* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses
+ ob->partype = PAROBJECT; /* note, dna define, not operator property */
+ /* ob->partype = PARSKEL; */ /* note, dna define, not operator property */
+
+ /* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses
* - We need to ensure that the modifier we're adding doesn't already exist, so we check this by
* assuming that the parent is selected too...
*/
- // XXX currently this should only happen for meshes, curves, surfaces, and lattices - this stuff isn't available for metas yet
+ /* XXX currently this should only happen for meshes, curves, surfaces,
+ * and lattices - this stuff isn't available for metas yet */
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
ModifierData *md;
-
+
switch (partype) {
case PAR_CURVE: /* curve deform */
if (modifiers_isDeformedByCurve(ob) != par) {
@@ -730,21 +741,21 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
else {
ob->partype = PAROBJECT; /* note, dna define, not operator property */
}
-
+
/* constraint */
if (partype == PAR_PATH_CONST) {
bConstraint *con;
bFollowPathConstraint *data;
float cmat[4][4], vec[3];
-
+
con = BKE_constraint_add_for_object(ob, "AutoPath", CONSTRAINT_TYPE_FOLLOWPATH);
-
+
data = con->data;
data->tar = par;
-
+
BKE_constraint_target_matrix_get(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
-
+
copy_v3_v3(ob->loc, vec);
}
else if (pararm && (ob->type == OB_MESH) && (par->type == OB_ARMATURE)) {
@@ -760,7 +771,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* get corrected inverse */
ob->partype = PAROBJECT;
BKE_object_workob_calc_parent(scene, ob, &workob);
-
+
invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
@@ -768,12 +779,12 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
BKE_object_workob_calc_parent(scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
-
+
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
}
}
- return 1;
+ return true;
}
@@ -808,8 +819,8 @@ static int parent_set_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *par = ED_object_active_context(C);
int partype = RNA_enum_get(op->ptr, "type");
- bool xmirror = RNA_boolean_get(op->ptr, "xmirror");
- bool keep_transform = RNA_boolean_get(op->ptr, "keep_transform");
+ const bool xmirror = RNA_boolean_get(op->ptr, "xmirror");
+ const bool keep_transform = RNA_boolean_get(op->ptr, "keep_transform");
bool ok = true;
/* vertex parent (kdtree) */
@@ -828,27 +839,25 @@ static int parent_set_exec(bContext *C, wmOperator *op)
if (tree_tot < (is_tri ? 3 : 1)) {
BKE_report(op->reports, RPT_ERROR, "Not enough vertices for vertex-parent");
ok = false;
- goto cleanup;
}
}
+ if (ok) {
+ /* Non vertex-parent */
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
+ {
+ if (is_vert_par) {
+ parent_set_vert_find(tree, ob, vert_par, is_tri);
+ }
- /* Non vertex-parent */
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
- {
- if (is_vert_par) {
- parent_set_vert_find(tree, ob, vert_par, is_tri);
- }
-
- if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, xmirror, keep_transform, vert_par_p)) {
- ok = false;
- break;
+ if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, xmirror, keep_transform, vert_par_p)) {
+ ok = false;
+ break;
+ }
}
+ CTX_DATA_END;
}
- CTX_DATA_END;
-
-cleanup:
if (is_vert_par) {
BLI_kdtree_free(tree);
}
@@ -902,7 +911,7 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
else if (ob->type == OB_LATTICE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_LATTICE);
}
-
+
/* vertex parenting */
if (OB_TYPE_SUPPORT_PARVERT(ob->type)) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_VERTEX);
@@ -910,14 +919,14 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
}
uiPupMenuEnd(C, pup);
-
+
return OPERATOR_CANCELLED;
}
static bool parent_set_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
{
const char *prop_id = RNA_property_identifier(prop);
- int type = RNA_enum_get(ptr, "type");
+ const int type = RNA_enum_get(ptr, "type");
/* Only show XMirror for PAR_ARMATURE_ENVELOPE and PAR_ARMATURE_AUTO! */
if (STREQ(prop_id, "xmirror")) {
@@ -948,22 +957,21 @@ void OBJECT_OT_parent_set(wmOperatorType *ot)
ot->name = "Make Parent";
ot->description = "Set the object's parenting";
ot->idname = "OBJECT_OT_parent_set";
-
+
/* api callbacks */
ot->invoke = parent_set_invoke;
ot->exec = parent_set_exec;
ot->poll = ED_operator_object_active;
ot->ui = parent_set_ui;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", "");
RNA_def_boolean(ot->srna, "xmirror", false, "X Mirror",
"Apply weights symmetrically along X axis, for Envelope/Automatic vertex groups creation");
RNA_def_boolean(ot->srna, "keep_transform", false, "Keep Transform",
"Apply transformation before parenting");
-
}
/* ************ Make Parent Without Inverse Operator ******************* */
@@ -972,9 +980,9 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *par = ED_object_active_context(C);
-
+
DAG_id_tag_update(&par->id, OB_RECALC_OB);
-
+
/* context iterator */
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
@@ -986,10 +994,10 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
/* clear inverse matrix and also the object location */
unit_m4(ob->parentinv);
memset(ob->loc, 0, 3 * sizeof(float));
-
+
/* set recalc flags */
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
-
+
/* set parenting type for object - object only... */
ob->parent = par;
ob->partype = PAROBJECT; /* note, dna define, not operator property */
@@ -997,10 +1005,10 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
}
}
CTX_DATA_END;
-
+
DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1010,12 +1018,12 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
ot->name = "Make Parent without Inverse";
ot->description = "Set the object's parenting without setting the inverse parent correction";
ot->idname = "OBJECT_OT_parent_no_inverse_set";
-
+
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = parent_noinv_set_exec;
ot->poll = ED_operator_object_active_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1040,23 +1048,22 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
WM_event_add_notifier(C, NC_SCENE, scene);
-
+
return OPERATOR_FINISHED;
}
void OBJECT_OT_slow_parent_clear(wmOperatorType *ot)
{
-
/* identifiers */
ot->name = "Clear Slow Parent";
ot->description = "Clear the object's slow parent";
ot->idname = "OBJECT_OT_slow_parent_clear";
-
+
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = object_slow_parent_clear_exec;
ot->poll = ED_operator_view3d_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1073,37 +1080,40 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
ob->partype |= PARSLOW;
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
-
}
CTX_DATA_END;
WM_event_add_notifier(C, NC_SCENE, scene);
-
+
return OPERATOR_FINISHED;
}
void OBJECT_OT_slow_parent_set(wmOperatorType *ot)
{
-
/* identifiers */
ot->name = "Set Slow Parent";
ot->description = "Set the object's slow parent";
ot->idname = "OBJECT_OT_slow_parent_set";
-
+
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = object_slow_parent_set_exec;
ot->poll = ED_operator_view3d_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Clear Track Operator ******************* */
+enum {
+ CLEAR_TRACK = 1,
+ CLEAR_TRACK_KEEP_TRANSFORM = 2,
+};
+
static EnumPropertyItem prop_clear_track_types[] = {
- {0, "CLEAR", 0, "Clear Track", ""},
- {1, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation (Clear Track)", ""},
+ {CLEAR_TRACK, "CLEAR", 0, "Clear Track", ""},
+ {CLEAR_TRACK_KEEP_TRANSFORM, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation (Clear Track)", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1111,7 +1121,7 @@ static EnumPropertyItem prop_clear_track_types[] = {
static int object_track_clear_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- int type = RNA_enum_get(op->ptr, "type");
+ const int type = RNA_enum_get(op->ptr, "type");
if (CTX_data_edit_object(C)) {
BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in edit mode");
@@ -1120,19 +1130,19 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
bConstraint *con, *pcon;
-
+
/* remove track-object for old track */
ob->track = NULL;
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
-
+
/* also remove all tracking constraints */
for (con = ob->constraints.last; con; con = pcon) {
pcon = con->prev;
if (ELEM(con->type, CONSTRAINT_TYPE_TRACKTO, CONSTRAINT_TYPE_LOCKTRACK, CONSTRAINT_TYPE_DAMPTRACK))
BKE_constraint_remove(&ob->constraints, con);
}
-
- if (type == 1)
+
+ if (type == CLEAR_TRACK_KEEP_TRANSFORM)
BKE_object_apply_mat4(ob, ob->obmat, true, true);
}
CTX_DATA_END;
@@ -1149,25 +1159,31 @@ void OBJECT_OT_track_clear(wmOperatorType *ot)
ot->name = "Clear Track";
ot->description = "Clear tracking constraint or flag from object";
ot->idname = "OBJECT_OT_track_clear";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = object_track_clear_exec;
-
+
ot->poll = ED_operator_objectmode;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_track_types, 0, "Type", "");
}
/************************** Make Track Operator *****************************/
+enum {
+ CREATE_TRACK_DAMPTRACK = 1,
+ CREATE_TRACK_TRACKTO = 2,
+ CREATE_TRACK_LOCKTRACK = 3,
+};
+
static EnumPropertyItem prop_make_track_types[] = {
- {1, "DAMPTRACK", 0, "Damped Track Constraint", ""},
- {2, "TRACKTO", 0, "Track To Constraint", ""},
- {3, "LOCKTRACK", 0, "Lock Track Constraint", ""},
+ {CREATE_TRACK_DAMPTRACK, "DAMPTRACK", 0, "Damped Track Constraint", ""},
+ {CREATE_TRACK_TRACKTO, "TRACKTO", 0, "Track To Constraint", ""},
+ {CREATE_TRACK_LOCKTRACK, "LOCKTRACK", 0, "Lock Track Constraint", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1175,78 +1191,86 @@ static int track_set_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *obact = ED_object_active_context(C);
-
- int type = RNA_enum_get(op->ptr, "type");
-
- if (type == 1) {
- bConstraint *con;
- bDampTrackConstraint *data;
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
+ const int type = RNA_enum_get(op->ptr, "type");
+
+ switch (type) {
+ case CREATE_TRACK_DAMPTRACK:
{
- if (ob != obact) {
- con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK);
+ bConstraint *con;
+ bDampTrackConstraint *data;
- data = con->data;
- data->tar = obact;
- DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
-
- /* Lamp, Camera and Speaker track differently by default */
- if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
- data->trackflag = TRACK_nZ;
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
+ {
+ if (ob != obact) {
+ con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK);
+
+ data = con->data;
+ data->tar = obact;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+
+ /* Lamp, Camera and Speaker track differently by default */
+ if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
+ data->trackflag = TRACK_nZ;
+ }
}
}
+ CTX_DATA_END;
+ break;
}
- CTX_DATA_END;
- }
- else if (type == 2) {
- bConstraint *con;
- bTrackToConstraint *data;
-
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
+ case CREATE_TRACK_TRACKTO:
{
- if (ob != obact) {
- con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
+ bConstraint *con;
+ bTrackToConstraint *data;
- data = con->data;
- data->tar = obact;
- DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
-
- /* Lamp, Camera and Speaker track differently by default */
- if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
- data->reserved1 = TRACK_nZ;
- data->reserved2 = UP_Y;
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
+ {
+ if (ob != obact) {
+ con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
+
+ data = con->data;
+ data->tar = obact;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+
+ /* Lamp, Camera and Speaker track differently by default */
+ if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
+ data->reserved1 = TRACK_nZ;
+ data->reserved2 = UP_Y;
+ }
}
}
+ CTX_DATA_END;
+ break;
}
- CTX_DATA_END;
- }
- else if (type == 3) {
- bConstraint *con;
- bLockTrackConstraint *data;
-
- CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
+ case CREATE_TRACK_LOCKTRACK:
{
- if (ob != obact) {
- con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_LOCKTRACK);
+ bConstraint *con;
+ bLockTrackConstraint *data;
- data = con->data;
- data->tar = obact;
- DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
-
- /* Lamp, Camera and Speaker track differently by default */
- if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
- data->trackflag = TRACK_nZ;
- data->lockflag = LOCK_Y;
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
+ {
+ if (ob != obact) {
+ con = BKE_constraint_add_for_object(ob, "AutoTrack", CONSTRAINT_TYPE_LOCKTRACK);
+
+ data = con->data;
+ data->tar = obact;
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+
+ /* Lamp, Camera and Speaker track differently by default */
+ if (ELEM(ob->type, OB_LAMP, OB_CAMERA, OB_SPEAKER)) {
+ data->trackflag = TRACK_nZ;
+ data->lockflag = LOCK_Y;
+ }
}
}
+ CTX_DATA_END;
+ break;
}
- CTX_DATA_END;
}
-
+
DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -1254,18 +1278,18 @@ void OBJECT_OT_track_set(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Make Track";
- ot->description = "Make the object track another object, either by constraint or old way or locked track";
+ ot->description = "Make the object track another object, using various methods/constraints";
ot->idname = "OBJECT_OT_track_set";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = track_set_exec;
-
+
ot->poll = ED_operator_objectmode;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", prop_make_track_types, 0, "Type", "");
}
@@ -1287,7 +1311,7 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
for (a = 0; a < 20; a++)
values[a] = (lay & (1 << a));
-
+
RNA_boolean_set_array(op->ptr, "layers", values);
}
else {
@@ -1320,12 +1344,12 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
unsigned int lay, local;
/* bool is_lamp = false; */ /* UNUSED */
-
+
lay = move_to_layer_init(C, op);
lay &= 0xFFFFFF;
if (lay == 0) return OPERATOR_CANCELLED;
-
+
if (v3d && v3d->localvd) {
/* now we can move out of localview. */
/* note: layers are set in bases, library objects work for this */
@@ -1353,9 +1377,9 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
}
-
+
/* warning, active object may be hidden now */
-
+
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
@@ -1370,15 +1394,15 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot)
ot->name = "Move to Layer";
ot->description = "Move the object to different layers";
ot->idname = "OBJECT_OT_move_to_layer";
-
+
/* api callbacks */
ot->invoke = move_to_layer_invoke;
ot->exec = move_to_layer_exec;
ot->poll = ED_operator_objectmode;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
}
@@ -1390,13 +1414,12 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
{
Scene *sce = (Scene *) BLI_findlink(&bmain->scene, G.curscreen->scenenr - 1);
Base *base, *nbase;
-
- if (sce == 0) return;
+
+ if (sce == NULL) return;
if (sce->id.lib) return;
-
+
for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASE(v3d, base)) {
-
nbase = MEM_mallocN(sizeof(Base), "newbase");
*nbase = *base;
BLI_addhead(&(sce->base), nbase);
@@ -1453,48 +1476,45 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
}
enum {
- MAKE_LINKS_OBDATA = 1,
- MAKE_LINKS_MATERIALS,
- MAKE_LINKS_ANIMDATA,
- MAKE_LINKS_GROUP,
- MAKE_LINKS_DUPLIGROUP,
- MAKE_LINKS_MODIFIERS,
- MAKE_LINKS_FONTS
+ MAKE_LINKS_OBDATA = 1,
+ MAKE_LINKS_MATERIALS = 2,
+ MAKE_LINKS_ANIMDATA = 3,
+ MAKE_LINKS_GROUP = 4,
+ MAKE_LINKS_DUPLIGROUP = 5,
+ MAKE_LINKS_MODIFIERS = 6,
+ MAKE_LINKS_FONTS = 7,
};
-/* Return 1 if make link data is allow, zero otherwise */
-static int allow_make_links_data(const int type, Object *ob_src, Object *ob_dst)
+/* Return true if make link data is allowed, false otherwise */
+static bool allow_make_links_data(const int type, Object *ob_src, Object *ob_dst)
{
switch (type) {
case MAKE_LINKS_OBDATA:
- if (ob_src->type == ob_dst->type && ob_src->type != OB_EMPTY)
- return 1;
+ if (ob_src->type == ob_dst->type && ob_src->type != OB_EMPTY) {
+ return true;
+ }
break;
case MAKE_LINKS_MATERIALS:
- if (OB_TYPE_SUPPORT_MATERIAL(ob_src->type) &&
- OB_TYPE_SUPPORT_MATERIAL(ob_dst->type))
- {
- return 1;
+ if (OB_TYPE_SUPPORT_MATERIAL(ob_src->type) && OB_TYPE_SUPPORT_MATERIAL(ob_dst->type)) {
+ return true;
}
break;
case MAKE_LINKS_ANIMDATA:
case MAKE_LINKS_GROUP:
case MAKE_LINKS_DUPLIGROUP:
- return 1;
+ return true;
case MAKE_LINKS_MODIFIERS:
- if (ob_src->type != OB_EMPTY && ob_dst->type != OB_EMPTY)
- return 1;
+ if (!ELEM(OB_EMPTY, ob_src->type, ob_dst->type)) {
+ return true;
+ }
break;
case MAKE_LINKS_FONTS:
- if ((ob_src->data != ob_dst->data) &&
- (ob_src->type == OB_FONT) &&
- (ob_dst->type == OB_FONT))
- {
- return 1;
+ if ((ob_src->data != ob_dst->data) && (ob_src->type == OB_FONT) && (ob_dst->type == OB_FONT)) {
+ return true;
}
break;
}
- return 0;
+ return false;
}
static int make_links_data_exec(bContext *C, wmOperator *op)
@@ -1697,13 +1717,13 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
/**************************** Make Single User ********************************/
-static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, int flag, bool copy_groups)
+static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const int flag, const bool copy_groups)
{
Base *base;
Object *ob, *obn;
Group *group, *groupn;
GroupObject *go;
-
+
clear_sca_new_poins(); /* sensor/contr/act */
/* newid may still have some trash from Outliner tree building,
@@ -1714,7 +1734,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, int flag
/* duplicate (must set newid) */
for (base = FIRSTBASE; base; base = base->next) {
ob = base->object;
-
+
if ((base->flag & flag) == flag) {
if (ob->id.lib == NULL && ob->id.us > 1) {
/* base gets copy of object */
@@ -1761,10 +1781,10 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, int flag
/* group pointers in scene */
BKE_scene_groups_relink(scene);
-
+
ID_NEW(scene->camera);
if (v3d) ID_NEW(v3d->camera);
-
+
/* object and group pointers */
for (base = FIRSTBASE; base; base = base->next) {
BKE_object_relink(base->object);
@@ -1778,7 +1798,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, int flag
void ED_object_single_user(Main *bmain, Scene *scene, Object *ob)
{
Base *base;
- bool copy_groups = false;
+ const bool copy_groups = false;
for (base = FIRSTBASE; base; base = base->next) {
if (base->object == ob) base->flag |= OB_DONE;
@@ -1788,11 +1808,11 @@ void ED_object_single_user(Main *bmain, Scene *scene, Object *ob)
single_object_users(bmain, scene, NULL, OB_DONE, copy_groups);
}
-static void new_id_matar(Material **matar, int totcol)
+static void new_id_matar(Material **matar, const int totcol)
{
ID *id;
int a;
-
+
for (a = 0; a < totcol; a++) {
id = (ID *)matar[a];
if (id && id->lib == NULL) {
@@ -1810,12 +1830,12 @@ static void new_id_matar(Material **matar, int totcol)
}
}
-static void single_obdata_users(Main *bmain, Scene *scene, int flag)
+static void single_obdata_users(Main *bmain, Scene *scene, const int flag)
{
Object *ob;
Lamp *la;
Curve *cu;
- //Camera *cam;
+ /* Camera *cam; */
Base *base;
Mesh *me;
Lattice *lat;
@@ -1826,7 +1846,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
ob = base->object;
if (ob->id.lib == NULL && (base->flag & flag) == flag) {
id = ob->data;
-
+
if (id && id->us > 1 && id->lib == NULL) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -1887,12 +1907,10 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
id->us--;
id->newid = ob->data;
-
}
-
}
}
-
+
me = bmain->mesh.first;
while (me) {
ID_NEW(me->texcomesh);
@@ -1900,11 +1918,11 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
}
}
-static void single_object_action_users(Scene *scene, int flag)
+static void single_object_action_users(Scene *scene, const int flag)
{
Object *ob;
Base *base;
-
+
for (base = FIRSTBASE; base; base = base->next) {
ob = base->object;
if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) {
@@ -1914,27 +1932,26 @@ static void single_object_action_users(Scene *scene, int flag)
}
}
-static void single_mat_users(Scene *scene, int flag, int do_textures)
+static void single_mat_users(Scene *scene, const int flag, const bool do_textures)
{
Object *ob;
Base *base;
Material *ma, *man;
Tex *tex;
int a, b;
-
+
for (base = FIRSTBASE; base; base = base->next) {
ob = base->object;
if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) {
-
for (a = 1; a <= ob->totcol; a++) {
ma = give_current_material(ob, a);
if (ma) {
/* do not test for LIB_NEW: this functions guaranteed delivers single_users! */
-
+
if (ma->id.us > 1) {
man = BKE_material_copy(ma);
BKE_copy_animdata_id_action(&man->id);
-
+
man->id.us = 0;
assign_material(ob, man, a, BKE_MAT_ASSIGN_USERPREF);
@@ -1960,10 +1977,10 @@ static void single_mat_users(Scene *scene, int flag, int do_textures)
static void do_single_tex_user(Tex **from)
{
Tex *tex, *texn;
-
+
tex = *from;
if (tex == NULL) return;
-
+
if (tex->id.newid) {
*from = (Tex *)tex->id.newid;
id_us_plus(tex->id.newid);
@@ -1985,7 +2002,7 @@ static void single_tex_users_expand(Main *bmain)
Lamp *la;
World *wo;
int b;
-
+
for (ma = bmain->mat.first; ma; ma = ma->id.next) {
if (ma->id.flag & LIB_NEW) {
for (b = 0; b < MAX_MTEX; b++) {
@@ -2026,7 +2043,7 @@ static void single_mat_users_expand(Main *bmain)
MetaBall *mb;
Material *ma;
int a;
-
+
for (ob = bmain->object.first; ob; ob = ob->id.next)
if (ob->id.flag & LIB_NEW)
new_id_matar(ob->mat, ob->totcol);
@@ -2052,7 +2069,7 @@ static void single_mat_users_expand(Main *bmain)
}
/* used for copying scenes */
-void ED_object_single_users(Main *bmain, Scene *scene, bool full, bool copy_groups)
+void ED_object_single_users(Main *bmain, Scene *scene, const bool full, const bool copy_groups)
{
single_object_users(bmain, scene, NULL, 0, copy_groups);
@@ -2073,13 +2090,13 @@ static void make_local_makelocalmaterial(Material *ma)
{
AnimData *adt;
int b;
-
+
id_make_local(&ma->id, false);
-
+
for (b = 0; b < MAX_MTEX; b++)
if (ma->mtex[b] && ma->mtex[b]->tex)
id_make_local(&ma->mtex[b]->tex->id, false);
-
+
adt = BKE_animdata_from_id(&ma->id);
if (adt) BKE_animdata_make_local(adt);
@@ -2087,13 +2104,13 @@ static void make_local_makelocalmaterial(Material *ma)
}
enum {
- MAKE_LOCAL_SELECT_OB,
- MAKE_LOCAL_SELECT_OBDATA,
- MAKE_LOCAL_SELECT_OBDATA_MATERIAL,
- MAKE_LOCAL_ALL
+ MAKE_LOCAL_SELECT_OB = 1,
+ MAKE_LOCAL_SELECT_OBDATA = 2,
+ MAKE_LOCAL_SELECT_OBDATA_MATERIAL = 3,
+ MAKE_LOCAL_ALL = 4,
};
-static bool tag_localizable_looper(void *UNUSED(user_data), ID **id_pointer, int UNUSED(cd_flag))
+static bool tag_localizable_looper(void *UNUSED(user_data), ID **id_pointer, const int UNUSED(cd_flag))
{
if (*id_pointer) {
(*id_pointer)->flag &= ~LIB_DOIT;
@@ -2101,7 +2118,7 @@ static bool tag_localizable_looper(void *UNUSED(user_data), ID **id_pointer, int
return true;
}
-static void tag_localizable_objects(bContext *C, int mode)
+static void tag_localizable_objects(bContext *C, const int mode)
{
Main *bmain = CTX_data_main(C);
Object *object;
@@ -2182,8 +2199,9 @@ static int make_local_exec(bContext *C, wmOperator *op)
Material *ma, ***matarar;
Lamp *la;
ID *id;
- int a, b, mode = RNA_enum_get(op->ptr, "type");
-
+ const int mode = RNA_enum_get(op->ptr, "type");
+ int a, b;
+
if (mode == MAKE_LOCAL_ALL) {
/* de-select so the user can differentiate newly instanced from existing objects */
BKE_scene_base_deselect_all(scene);
@@ -2200,7 +2218,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
tag_localizable_objects(C, mode);
BKE_main_id_clear_newpoins(bmain);
-
+
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
if ((ob->id.flag & LIB_DOIT) == 0) {
@@ -2211,7 +2229,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
id_make_local(&ob->id, false);
}
CTX_DATA_END;
-
+
/* maybe object pointers */
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
@@ -2228,12 +2246,12 @@ static int make_local_exec(bContext *C, wmOperator *op)
}
id = ob->data;
-
+
if (id && (ELEM(mode, MAKE_LOCAL_SELECT_OBDATA, MAKE_LOCAL_SELECT_OBDATA_MATERIAL))) {
id_make_local(id, false);
adt = BKE_animdata_from_id(id);
if (adt) BKE_animdata_make_local(adt);
-
+
/* tag indirect data direct */
matarar = give_matarar(ob);
if (matarar) {
@@ -2273,7 +2291,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
if (ma)
make_local_makelocalmaterial(ma);
}
-
+
matarar = (Material ***)give_matarar(ob);
if (matarar) {
for (a = 0; a < ob->totcol; a++) {
@@ -2306,26 +2324,33 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
ot->name = "Make Local";
ot->description = "Make library linked datablocks local to this file";
ot->idname = "OBJECT_OT_make_local";
-
+
/* api callbacks */
ot->invoke = WM_menu_invoke;
ot->exec = make_local_exec;
ot->poll = ED_operator_objectmode;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
}
+enum {
+ /* Be careful with those values, they are used as bitflags in some cases, in others as bool...
+ * See single_object_users, single_obdata_users, single_object_action_users, etc.< */
+ MAKE_SINGLE_USER_ALL = 0,
+ MAKE_SINGLE_USER_SELECTED = SELECT,
+};
+
static int make_single_user_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C); /* ok if this is NULL */
- int flag = RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */
- bool copy_groups = false;
+ const int flag = RNA_enum_get(op->ptr, "type");
+ const bool copy_groups = false;
bool update_deps = false;
BKE_main_id_clear_newpoins(bmain);
@@ -2372,8 +2397,8 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
void OBJECT_OT_make_single_user(wmOperatorType *ot)
{
static EnumPropertyItem type_items[] = {
- {SELECT, "SELECTED_OBJECTS", 0, "Selected Objects", ""},
- {0, "ALL", 0, "All", ""},
+ {MAKE_SINGLE_USER_SELECTED, "SELECTED_OBJECTS", 0, "Selected Objects", ""},
+ {MAKE_SINGLE_USER_ALL, "ALL", 0, "All", ""},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
@@ -2395,7 +2420,8 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "object", 0, "Object", "Make single user objects");
RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data");
RNA_def_boolean(ot->srna, "material", 0, "Materials", "Make materials local to each datablock");
- RNA_def_boolean(ot->srna, "texture", 0, "Textures", "Make textures local to each material");
+ RNA_def_boolean(ot->srna, "texture", 0, "Textures",
+ "Make textures local to each material (needs 'Materials' to be set too)");
RNA_def_boolean(ot->srna, "animation", 0, "Object Animation", "Make animation data local to each object");
}
@@ -2404,12 +2430,12 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, const wmEvent
Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
Material *ma;
char name[MAX_ID_NAME - 2];
-
+
RNA_string_get(op->ptr, "name", name);
ma = (Material *)BKE_libblock_find_name(ID_MA, name);
if (base == NULL || ma == NULL)
return OPERATOR_CANCELLED;
-
+
assign_material(base->object, ma, 1, BKE_MAT_ASSIGN_USERPREF);
DAG_id_tag_update(&base->object->id, OB_RECALC_OB);
@@ -2425,19 +2451,18 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, const wmEvent
/* assigns to object under cursor, only first material slot */
void OBJECT_OT_drop_named_material(wmOperatorType *ot)
{
-
/* identifiers */
ot->name = "Drop Named Material on Object";
ot->description = "";
ot->idname = "OBJECT_OT_drop_named_material";
-
+
/* api callbacks */
ot->invoke = drop_named_material_invoke;
ot->poll = ED_operator_objectmode;
-
+
/* flags */
ot->flag = OPTYPE_UNDO | OPTYPE_INTERNAL;
-
+
/* properties */
RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME - 2, "Name", "Material name to assign");
}
diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt
index 892d71befb4..40d555226f3 100644
--- a/source/blender/editors/physics/CMakeLists.txt
+++ b/source/blender/editors/physics/CMakeLists.txt
@@ -23,11 +23,13 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/elbeem/extern
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -64,4 +66,6 @@ if(WITH_BULLET)
add_definitions(-DWITH_BULLET)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript
index 9436280de43..983d1c4b4ba 100644
--- a/source/blender/editors/physics/SConscript
+++ b/source/blender/editors/physics/SConscript
@@ -31,20 +31,22 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/rigidbody',
- '#/extern/glew/include',
'#/intern/elbeem/extern',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../makesdna',
'../../makesrna',
'../../windowmanager',
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 76344b77dd3..9a3433b0ccf 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1588,6 +1588,87 @@ void PARTICLE_OT_select_tips(wmOperatorType *ot)
WM_operator_properties_select_action(ot, SEL_SELECT);
}
+/*********************** select random operator ************************/
+
+enum { RAN_HAIR, RAN_POINTS };
+
+static EnumPropertyItem select_random_type_items[] = {
+ {RAN_HAIR, "HAIR", 0, "Hair", ""},
+ {RAN_POINTS, "POINTS", 0, "Points", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+static int select_random_exec(bContext *C, wmOperator *op)
+{
+ PEData data;
+ int type;
+ Scene *scene;
+ Object *ob;
+
+ /* used by LOOP_VISIBLE_POINTS, LOOP_VISIBLE_KEYS and LOOP_KEYS */
+ PTCacheEdit *edit;
+ PTCacheEditPoint *point;
+ PTCacheEditKey *key;
+ int p;
+ int k;
+
+ const float randf = RNA_float_get (op->ptr, "percent") / 100.0f;
+
+ type = RNA_enum_get(op->ptr, "type");
+
+ PE_set_data(C, &data);
+ data.select_action = SEL_SELECT;
+ scene = CTX_data_scene(C);
+ ob = CTX_data_active_object(C);
+ edit = PE_get_current(scene, ob);
+
+ switch (type) {
+ case RAN_HAIR:
+ LOOP_VISIBLE_POINTS {
+ int flag = (BLI_frand() < randf) ? SEL_SELECT : SEL_DESELECT;
+ LOOP_KEYS {
+ select_action_apply (point, key, flag);
+ }
+ }
+ break;
+ case RAN_POINTS:
+ LOOP_VISIBLE_POINTS {
+ LOOP_VISIBLE_KEYS {
+ int flag = (BLI_frand() < randf) ? SEL_SELECT : SEL_DESELECT;
+ select_action_apply (point, key, flag);
+ }
+ }
+ break;
+ }
+
+ PE_update_selection(data.scene, data.ob, 1);
+ WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void PARTICLE_OT_select_random(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Select Random";
+ ot->idname = "PARTICLE_OT_select_random";
+ ot->description = "Select a randomly distributed set of hair or points";
+
+ /* api callbacks */
+ ot->exec = select_random_exec;
+ ot->poll = PE_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_float_percentage (ot->srna, "percent", 50.0f, 0.0f, 100.0f, "Percent",
+ "Percentage (mean) of elements in randomly selected set",
+ 0.0f, 100.0f);
+ ot->prop = RNA_def_enum (ot->srna, "type", select_random_type_items, RAN_HAIR,
+ "Type", "Select either hair or points");
+}
+
/************************ select linked operator ************************/
static int select_linked_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h
index 77ce5a334e6..b8955c8c397 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -39,6 +39,7 @@ struct wmOperatorType;
void PARTICLE_OT_select_all(struct wmOperatorType *ot);
void PARTICLE_OT_select_roots(struct wmOperatorType *ot);
void PARTICLE_OT_select_tips(struct wmOperatorType *ot);
+void PARTICLE_OT_select_random(struct wmOperatorType *ot);
void PARTICLE_OT_select_linked(struct wmOperatorType *ot);
void PARTICLE_OT_select_less(struct wmOperatorType *ot);
void PARTICLE_OT_select_more(struct wmOperatorType *ot);
diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c
index 48cc51ffb55..ff89909b124 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -51,6 +51,7 @@ static void operatortypes_particle(void)
WM_operatortype_append(PARTICLE_OT_select_all);
WM_operatortype_append(PARTICLE_OT_select_roots);
WM_operatortype_append(PARTICLE_OT_select_tips);
+ WM_operatortype_append(PARTICLE_OT_select_random);
WM_operatortype_append(PARTICLE_OT_select_linked);
WM_operatortype_append(PARTICLE_OT_select_less);
WM_operatortype_append(PARTICLE_OT_select_more);
diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt
index 24015bd4ea3..42dafc076ed 100644
--- a/source/blender/editors/render/CMakeLists.txt
+++ b/source/blender/editors/render/CMakeLists.txt
@@ -32,6 +32,7 @@ set(INC
../../render/extern/include
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -64,6 +65,8 @@ if(WITH_HEADLESS)
add_definitions(-DWITH_HEADLESS)
endif()
+add_definitions(${GL_DEFINITIONS})
+
if(WITH_FREESTYLE)
list(APPEND INC
../../freestyle
diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript
index 41576f9b485..cbb7988695b 100644
--- a/source/blender/editors/render/SConscript
+++ b/source/blender/editors/render/SConscript
@@ -31,7 +31,8 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/elbeem/extern',
'../include',
'../../blenfont',
@@ -48,7 +49,7 @@ incs = [
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index ecf5e962c80..559c86bf48c 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -31,8 +31,6 @@
#include <string.h>
#include <stddef.h>
-#include <GL/glew.h>
-
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
@@ -69,6 +67,7 @@
#include "RNA_define.h"
#include "GPU_extensions.h"
+#include "GPU_glew.h"
#include "wm_window.h"
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 70c9e3c4306..450a3b19889 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -88,6 +88,7 @@
#include "PIL_time.h"
#include "RE_pipeline.h"
+#include "RE_engine.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -213,6 +214,12 @@ void ED_preview_init_dbase(void)
#endif
}
+static bool check_engine_supports_textures(Scene *scene)
+{
+ RenderEngineType *type = RE_engines_find(scene->r.engine);
+ return type->flag & RE_USE_TEXTURE_PREVIEW;
+}
+
void ED_preview_free_dbase(void)
{
if (G_pr_main)
@@ -299,7 +306,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.cfra = scene->r.cfra;
- if (id_type == ID_TE) {
+ if (id_type == ID_TE && !check_engine_supports_textures(scene)) {
/* Force blender internal for texture icons and nodes render,
* seems commonly used render engines does not support
* such kind of rendering.
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index 4ff1767f582..413d40b9f9c 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -30,6 +30,7 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -51,4 +52,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/screen/SConscript b/source/blender/editors/screen/SConscript
index 28a6cbb02e6..f5442c7ea63 100644
--- a/source/blender/editors/screen/SConscript
+++ b/source/blender/editors/screen/SConscript
@@ -31,7 +31,8 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
@@ -45,7 +46,7 @@ incs = [
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 0edde66ffff..c095dfe7792 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -224,15 +224,15 @@ void fdrawcheckerboard(float x1, float y1, float x2, float y2)
glDisable(GL_POLYGON_STIPPLE);
}
-void sdrawline(short x1, short y1, short x2, short y2)
+void sdrawline(int x1, int y1, int x2, int y2)
{
- short v[2];
+ int v[2];
glBegin(GL_LINE_STRIP);
v[0] = x1; v[1] = y1;
- glVertex2sv(v);
+ glVertex2iv(v);
v[0] = x2; v[1] = y2;
- glVertex2sv(v);
+ glVertex2iv(v);
glEnd();
}
@@ -246,25 +246,25 @@ void sdrawline(short x1, short y1, short x2, short y2)
* x1,y1-- x2,y1
*/
-static void sdrawtripoints(short x1, short y1, short x2, short y2)
+static void sdrawtripoints(int x1, int y1, int x2, int y2)
{
- short v[2];
+ int v[2];
v[0] = x1; v[1] = y1;
- glVertex2sv(v);
+ glVertex2iv(v);
v[0] = x1; v[1] = y2;
- glVertex2sv(v);
+ glVertex2iv(v);
v[0] = x2; v[1] = y1;
- glVertex2sv(v);
+ glVertex2iv(v);
}
-void sdrawtri(short x1, short y1, short x2, short y2)
+void sdrawtri(int x1, int y1, int x2, int y2)
{
glBegin(GL_LINE_STRIP);
sdrawtripoints(x1, y1, x2, y2);
glEnd();
}
-void sdrawtrifill(short x1, short y1, short x2, short y2)
+void sdrawtrifill(int x1, int y1, int x2, int y2)
{
glBegin(GL_TRIANGLES);
sdrawtripoints(x1, y1, x2, y2);
@@ -272,22 +272,22 @@ void sdrawtrifill(short x1, short y1, short x2, short y2)
}
#endif
-void sdrawbox(short x1, short y1, short x2, short y2)
+void sdrawbox(int x1, int y1, int x2, int y2)
{
- short v[2];
+ int v[2];
glBegin(GL_LINE_STRIP);
v[0] = x1; v[1] = y1;
- glVertex2sv(v);
+ glVertex2iv(v);
v[0] = x1; v[1] = y2;
- glVertex2sv(v);
+ glVertex2iv(v);
v[0] = x2; v[1] = y2;
- glVertex2sv(v);
+ glVertex2iv(v);
v[0] = x2; v[1] = y1;
- glVertex2sv(v);
+ glVertex2iv(v);
v[0] = x1; v[1] = y1;
- glVertex2sv(v);
+ glVertex2iv(v);
glEnd();
}
@@ -339,7 +339,7 @@ void sdrawXORline(int x0, int y0, int x1, int y1)
void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
{
- static short old[4][2][2];
+ static int old[4][2][2];
static char flags[4] = {0, 0, 0, 0};
/* with builtin memory, max 4 lines */
@@ -350,8 +350,8 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
if (nr == -1) { /* flush */
for (nr = 0; nr < 4; nr++) {
if (flags[nr]) {
- glVertex2sv(old[nr][0]);
- glVertex2sv(old[nr][1]);
+ glVertex2iv(old[nr][0]);
+ glVertex2iv(old[nr][1]);
flags[nr] = 0;
}
}
@@ -359,8 +359,8 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
else {
if (nr >= 0 && nr < 4) {
if (flags[nr]) {
- glVertex2sv(old[nr][0]);
- glVertex2sv(old[nr][1]);
+ glVertex2iv(old[nr][0]);
+ glVertex2iv(old[nr][1]);
}
old[nr][0][0] = x0;
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 5beab9fcc14..12236e3779d 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1009,7 +1009,7 @@ static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir))
glDisable(GL_BLEND);
}
-static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2, short a)
+static void drawscredge_area_draw(int sizex, int sizey, int x1, int y1, int x2, int y2, int a)
{
/* right border area */
if (x2 < sizex - 1)
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 18db57c9f21..0fa5f2d9837 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -32,6 +32,7 @@ set(INC
../../render/extern/include
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -64,4 +65,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_sculpt_paint "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/sculpt_paint/SConscript b/source/blender/editors/sculpt_paint/SConscript
index b0118fbbf53..233f562fcc7 100644
--- a/source/blender/editors/sculpt_paint/SConscript
+++ b/source/blender/editors/sculpt_paint/SConscript
@@ -29,11 +29,12 @@ Import ('env')
sources = env.Glob('*.c')
-defs = []
+defs = env['BF_GL_DEFINITIONS']
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../uvedit',
'../../blenfont',
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 7b9ede38b39..e27ef705fad 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -521,14 +521,15 @@ static int project_brush_radius(ViewContext *vc,
}
}
-static int sculpt_get_brush_geometry(bContext *C, ViewContext *vc,
- int x, int y, int *pixel_radius,
- float location[3])
+static bool sculpt_get_brush_geometry(
+ bContext *C, ViewContext *vc,
+ int x, int y, int *pixel_radius,
+ float location[3])
{
Scene *scene = CTX_data_scene(C);
Paint *paint = BKE_paint_get_active_from_context(C);
float mouse[2];
- int hit;
+ bool hit;
mouse[0] = x;
mouse[1] = y;
@@ -1011,7 +1012,8 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
* special mode of drawing will go away */
if ((mode == PAINT_SCULPT) && vc.obact->sculpt) {
float location[3];
- int pixel_radius, hit;
+ int pixel_radius;
+ bool hit;
/* test if brush is over the mesh */
hit = sculpt_get_brush_geometry(C, &vc, x, y, &pixel_radius, location);
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 8faa4cfaf33..25f22996050 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -277,7 +277,7 @@ int ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *r
typedef struct LassoMaskData {
struct ViewContext *vc;
float projviewobjmat[4][4];
- bool *px;
+ BLI_bitmap *px;
int width;
rcti rect; /* bounding box for scanfilling */
int symmpass;
@@ -307,19 +307,19 @@ static bool is_effected_lasso(LassoMaskData *data, float co[3])
scr_co_s[0] -= data->rect.xmin;
scr_co_s[1] -= data->rect.ymin;
- return data->px[scr_co_s[1] * data->width + scr_co_s[0]];
+ return BLI_BITMAP_TEST_BOOL(data->px, scr_co_s[1] * data->width + scr_co_s[0]);
}
static void mask_lasso_px_cb(int x, int y, void *user_data)
{
struct LassoMaskData *data = user_data;
- data->px[(y * data->width) + x] = true;
+ BLI_BITMAP_ENABLE(data->px, (y * data->width) + x);
}
static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
{
int mcords_tot;
- int (*mcords)[2] = (int (*)[2])WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
+ const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
if (mcords) {
float clip_planes[4][4], clip_planes_final[4][4];
@@ -349,13 +349,13 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
ob = vc.obact;
ED_view3d_ob_project_mat_get(vc.rv3d, ob, data.projviewobjmat);
- BLI_lasso_boundbox(&data.rect, (const int (*)[2])mcords, mcords_tot);
+ BLI_lasso_boundbox(&data.rect, mcords, mcords_tot);
data.width = data.rect.xmax - data.rect.xmin;
- data.px = MEM_callocN(sizeof(*data.px) * data.width * (data.rect.ymax - data.rect.ymin), "lasso_mask_pixel_buffer");
+ data.px = BLI_BITMAP_NEW(data.width * (data.rect.ymax - data.rect.ymin), __func__);
fill_poly_v2i_n(
data.rect.xmin, data.rect.ymin, data.rect.xmax, data.rect.ymax,
- (const int (*)[2])mcords, mcords_tot,
+ mcords, mcords_tot,
mask_lasso_px_cb, &data);
ED_view3d_clipping_calc(&bb, clip_planes, &mats, &data.rect);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 101d176b00f..9c4701d0a01 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -68,6 +68,12 @@
#include <float.h>
#include <math.h>
+// #define DEBUG_TIME
+
+#ifdef DEBUG_TIME
+# include "PIL_time_utildefines.h"
+#endif
+
typedef struct PaintSample {
float mouse[2];
float pressure;
@@ -910,6 +916,7 @@ static void paint_stroke_line_end(bContext *C, wmOperator *op, PaintStroke *stro
static bool paint_stroke_curve_end(bContext *C, wmOperator *op, PaintStroke *stroke)
{
Brush *br = stroke->brush;
+
if (br->flag & BRUSH_CURVE) {
const Scene *scene = CTX_data_scene(C);
const float spacing = paint_space_stroke_spacing(scene, stroke, 1.0f, 1.0f);
@@ -921,6 +928,10 @@ static bool paint_stroke_curve_end(bContext *C, wmOperator *op, PaintStroke *str
if (!pc)
return true;
+#ifdef DEBUG_TIME
+ TIMEIT_START(stroke);
+#endif
+
pcp = pc->points;
stroke->ups->overlap_factor = paint_stroke_integrate_overlap(br, 1.0);
@@ -956,6 +967,11 @@ static bool paint_stroke_curve_end(bContext *C, wmOperator *op, PaintStroke *str
}
stroke_done(C, op);
+
+#ifdef DEBUG_TIME
+ TIMEIT_END(stroke);
+#endif
+
return true;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c1f52c58793..abdc184aa1a 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -268,8 +268,8 @@ typedef struct {
/* Original coordinate, normal, and mask */
const float *co;
- float mask;
const short *no;
+ float mask;
} SculptOrigVertData;
@@ -4066,14 +4066,14 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob)
typedef struct {
SculptSession *ss;
const float *ray_start, *ray_normal;
- int hit;
+ bool hit;
float dist;
- int original;
+ bool original;
} SculptRaycastData;
typedef struct {
const float *ray_start, *ray_normal;
- int hit;
+ bool hit;
float dist;
float detail;
} SculptDetailRaycastData;
@@ -4205,7 +4205,7 @@ static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession
sculpt_update_tex(scene, sd, ss);
}
-static int sculpt_brush_stroke_init(bContext *C, wmOperator *op)
+static bool sculpt_brush_stroke_init(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt
index e0dc2709cf3..96a1e74c882 100644
--- a/source/blender/editors/space_action/CMakeLists.txt
+++ b/source/blender/editors/space_action/CMakeLists.txt
@@ -22,10 +22,12 @@ set(INC
../include
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -42,4 +44,6 @@ set(SRC
action_intern.h
)
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_action "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_action/SConscript b/source/blender/editors/space_action/SConscript
index 2776bd2989a..2e2081b3c6e 100644
--- a/source/blender/editors/space_action/SConscript
+++ b/source/blender/editors/space_action/SConscript
@@ -29,16 +29,20 @@ Import ('env')
sources = env.Glob('*.c')
+defs = env['BF_GL_DEFINITIONS']
+
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../makesdna',
'../../makesrna',
'../../windowmanager',
]
incs = ' '.join(incs)
-env.BlenderLib ( 'bf_editors_space_action', sources, Split(incs), [], libtype=['core'], priority=[40] )
+env.BlenderLib ( 'bf_editors_space_action', sources, Split(incs), defs, libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index 9e045a39a0c..01a099e3701 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -23,10 +23,12 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -46,6 +48,8 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
diff --git a/source/blender/editors/space_buttons/SConscript b/source/blender/editors/space_buttons/SConscript
index 61f9b6f496e..07fe17e302b 100644
--- a/source/blender/editors/space_buttons/SConscript
+++ b/source/blender/editors/space_buttons/SConscript
@@ -31,12 +31,14 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
'../../bmesh',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
@@ -44,7 +46,8 @@ incs = [
'../../windowmanager',
]
incs = ' '.join(incs)
-defs = []
+
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt
index 7689aa28169..4659e612b41 100644
--- a/source/blender/editors/space_clip/CMakeLists.txt
+++ b/source/blender/editors/space_clip/CMakeLists.txt
@@ -27,11 +27,12 @@ set(INC
../../blenfont
../../blenlib
../../imbuf
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
- ../../gpu
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -56,6 +57,8 @@ set(SRC
clip_intern.h
)
+add_definitions(${GL_DEFINITIONS})
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
diff --git a/source/blender/editors/space_clip/SConscript b/source/blender/editors/space_clip/SConscript
index d4483eda6e3..8fec4ebf0fa 100644
--- a/source/blender/editors/space_clip/SConscript
+++ b/source/blender/editors/space_clip/SConscript
@@ -28,10 +28,13 @@
Import ('env')
sources = env.Glob('*.c')
-defs = []
+
+defs = env['BF_GL_DEFINITIONS']
+
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index b7860643e1a..f25f035db32 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -48,7 +48,7 @@
#include "BLI_fileops.h"
#include "BLI_math.h"
#include "BLI_rect.h"
-#include "BLI_threads.h"
+#include "BLI_task.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -620,11 +620,6 @@ typedef struct PrefetchQueue {
float *progress;
} PrefetchQueue;
-typedef struct PrefetchThread {
- MovieClip *clip;
- PrefetchQueue *queue;
-} PrefetchThread;
-
/* check whether pre-fetching is allowed */
static bool check_prefetch_break(void)
{
@@ -757,15 +752,15 @@ static unsigned char *prefetch_thread_next_frame(PrefetchQueue *queue, MovieClip
return mem;
}
-static void *do_prefetch_thread(void *data_v)
+static void prefetch_task_func(TaskPool *pool, void *task_data, int UNUSED(threadid))
{
- PrefetchThread *data = (PrefetchThread *) data_v;
- MovieClip *clip = data->clip;
+ PrefetchQueue *queue = (PrefetchQueue *)BLI_task_pool_userdata(pool);
+ MovieClip *clip = (MovieClip *)task_data;
unsigned char *mem;
size_t size;
int current_frame;
- while ((mem = prefetch_thread_next_frame(data->queue, data->clip, &size, &current_frame))) {
+ while ((mem = prefetch_thread_next_frame(queue, clip, &size, &current_frame))) {
ImBuf *ibuf;
MovieClipUser user = {0};
int flag = IB_rect | IB_alphamode_detect;
@@ -773,17 +768,17 @@ static void *do_prefetch_thread(void *data_v)
char *colorspace_name = NULL;
user.framenr = current_frame;
- user.render_size = data->queue->render_size;
- user.render_flag = data->queue->render_flag;
+ user.render_size = queue->render_size;
+ user.render_flag = queue->render_flag;
/* Proxies are stored in the display space. */
- if (data->queue->render_flag & MCLIP_USE_PROXY) {
+ if (queue->render_flag & MCLIP_USE_PROXY) {
colorspace_name = clip->colorspace_settings.name;
}
ibuf = IMB_ibImageFromMemory(mem, size, flag, colorspace_name, "prefetch frame");
- result = BKE_movieclip_put_frame_if_possible(data->clip, &user, ibuf);
+ result = BKE_movieclip_put_frame_if_possible(clip, &user, ibuf);
IMB_freeImBuf(ibuf);
@@ -791,27 +786,20 @@ static void *do_prefetch_thread(void *data_v)
if (!result) {
/* no more space in the cache, stop reading frames */
- *data->queue->stop = 1;
+ *queue->stop = 1;
break;
}
}
-
- return NULL;
}
static void start_prefetch_threads(MovieClip *clip, int start_frame, int current_frame, int end_frame,
short render_size, short render_flag, short *stop, short *do_update,
float *progress)
{
- ListBase threads;
PrefetchQueue queue;
- PrefetchThread *handles;
- int tot_thread = BLI_system_thread_count();
- int i;
-
- /* reserve one thread for the interface */
- if (tot_thread > 1)
- tot_thread--;
+ TaskScheduler *task_scheduler = BLI_task_scheduler_get();
+ TaskPool *task_pool;
+ int i, tot_thread = BLI_task_scheduler_num_threads(task_scheduler);
/* initialize queue */
BLI_spin_init(&queue.spin);
@@ -828,29 +816,18 @@ static void start_prefetch_threads(MovieClip *clip, int start_frame, int current
queue.do_update = do_update;
queue.progress = progress;
- /* fill in thread handles */
- handles = MEM_callocN(sizeof(PrefetchThread) * tot_thread, "prefetch threaded handles");
-
- if (tot_thread > 1)
- BLI_init_threads(&threads, do_prefetch_thread, tot_thread);
-
+ task_pool = BLI_task_pool_create(task_scheduler, &queue);
for (i = 0; i < tot_thread; i++) {
- PrefetchThread *handle = &handles[i];
-
- handle->clip = clip;
- handle->queue = &queue;
-
- if (tot_thread > 1)
- BLI_insert_thread(&threads, handle);
+ BLI_task_pool_push(task_pool,
+ prefetch_task_func,
+ clip,
+ false,
+ TASK_PRIORITY_LOW);
}
+ BLI_task_pool_work_and_wait(task_pool);
+ BLI_task_pool_free(task_pool);
- /* run the threads */
- if (tot_thread > 1)
- BLI_end_threads(&threads);
- else
- do_prefetch_thread(handles);
-
- MEM_freeN(handles);
+ BLI_spin_end(&queue.spin);
}
static bool prefetch_movie_frame(MovieClip *clip, int frame, short render_size,
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 87efaa615ee..9f7bcae800a 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -49,7 +49,7 @@
#include "BLI_path_util.h"
#include "BLI_math.h"
#include "BLI_rect.h"
-#include "BLI_threads.h"
+#include "BLI_task.h"
#include "BLI_string.h"
#include "BLF_translation.h"
@@ -79,6 +79,8 @@
#include "UI_view2d.h"
+#include "PIL_time.h"
+
#include "clip_intern.h" // own include
/******************** view navigation utilities *********************/
@@ -486,18 +488,25 @@ typedef struct ViewZoomData {
float zoom;
int event_type;
float location[2];
+ wmTimer *timer;
+ double timer_lastdraw;
} ViewZoomData;
static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceClip *sc = CTX_wm_space_clip(C);
ARegion *ar = CTX_wm_region(C);
-
ViewZoomData *vpd;
op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
WM_cursor_modal_set(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);
+ if (U.viewzoom == USER_ZOOM_CONT) {
+ /* needs a timer to continue redrawing */
+ vpd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+ vpd->timer_lastdraw = PIL_check_seconds_timer();
+ }
+
vpd->x = event->x;
vpd->y = event->y;
vpd->zoom = sc->zoom;
@@ -518,6 +527,10 @@ static void view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
ED_region_tag_redraw(CTX_wm_region(C));
}
+ if (vpd->timer) {
+ WM_event_remove_timer(CTX_wm_manager(C), vpd->timer->win, vpd->timer);
+ }
+
WM_cursor_modal_restore(CTX_wm_window(C));
MEM_freeN(op->customdata);
}
@@ -555,22 +568,61 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
}
+static void view_zoom_apply(bContext *C,
+ ViewZoomData *vpd,
+ wmOperator *op,
+ const wmEvent *event)
+{
+ float factor;
+
+ if (U.viewzoom == USER_ZOOM_CONT) {
+ SpaceClip *sclip = CTX_wm_space_clip(C);
+ double time = PIL_check_seconds_timer();
+ float time_step = (float)(time - vpd->timer_lastdraw);
+ float fac;
+ float zfac;
+
+ if (U.uiflag & USER_ZOOM_HORIZ) {
+ fac = (float)(event->x - vpd->x);
+ }
+ else {
+ fac = (float)(event->y - vpd->y);
+ }
+
+ if (U.uiflag & USER_ZOOM_INVERT) {
+ fac = -fac;
+ }
+
+ zfac = 1.0f + ((fac / 20.0f) * time_step);
+ vpd->timer_lastdraw = time;
+ factor = (sclip->zoom * zfac) / vpd->zoom;
+ }
+ else {
+ float delta = event->x - vpd->x + event->y - vpd->y;
+
+ if (U.uiflag & USER_ZOOM_INVERT) {
+ delta *= -1;
+ }
+
+ factor = 1.0f + delta / 300.0f;
+ }
+
+ RNA_float_set(op->ptr, "factor", factor);
+ sclip_zoom_set(C, vpd->zoom * factor, vpd->location);
+ ED_region_tag_redraw(CTX_wm_region(C));
+}
+
static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
ViewZoomData *vpd = op->customdata;
- float delta, factor;
-
switch (event->type) {
+ case TIMER:
+ if (event->customdata == vpd->timer) {
+ view_zoom_apply(C, vpd, op, event);
+ }
+ break;
case MOUSEMOVE:
- delta = event->x - vpd->x + event->y - vpd->y;
-
- if (U.uiflag & USER_ZOOM_INVERT)
- delta *= -1;
-
- factor = 1.0f + delta / 300.0f;
- RNA_float_set(op->ptr, "factor", factor);
- sclip_zoom_set(C, vpd->zoom * factor, vpd->location);
- ED_region_tag_redraw(CTX_wm_region(C));
+ view_zoom_apply(C, vpd, op, event);
break;
default:
if (event->type == vpd->event_type && event->val == KM_RELEASE) {
@@ -1071,10 +1123,7 @@ typedef struct ProxyQueue {
typedef struct ProxyThread {
MovieClip *clip;
- ProxyQueue *queue;
-
struct MovieDistortion *distortion;
-
int *build_sizes, build_count;
int *build_undistort_sizes, build_undistort_count;
} ProxyThread;
@@ -1130,14 +1179,15 @@ static unsigned char *proxy_thread_next_frame(ProxyQueue *queue, MovieClip *clip
return mem;
}
-static void *do_proxy_thread(void *data_v)
+static void proxy_task_func(TaskPool *pool, void *task_data, int UNUSED(threadid))
{
- ProxyThread *data = (ProxyThread *) data_v;
+ ProxyThread *data = (ProxyThread *)task_data;
+ ProxyQueue *queue = (ProxyQueue *)BLI_task_pool_userdata(pool);
unsigned char *mem;
size_t size;
int cfra;
- while ((mem = proxy_thread_next_frame(data->queue, data->clip, &size, &cfra))) {
+ while ((mem = proxy_thread_next_frame(queue, data->clip, &size, &cfra))) {
ImBuf *ibuf;
ibuf = IMB_ibImageFromMemory(mem, size, IB_rect | IB_multilayer | IB_alphamode_detect,
@@ -1153,8 +1203,6 @@ static void *do_proxy_thread(void *data_v)
MEM_freeN(mem);
}
-
- return NULL;
}
static void do_sequence_proxy(void *pjv, int *build_sizes, int build_count,
@@ -1164,12 +1212,18 @@ static void do_sequence_proxy(void *pjv, int *build_sizes, int build_count,
ProxyJob *pj = pjv;
MovieClip *clip = pj->clip;
Scene *scene = pj->scene;
+ TaskScheduler *task_scheduler = BLI_task_scheduler_get();
+ TaskPool *task_pool;
int sfra = SFRA, efra = EFRA;
ProxyThread *handles;
- ListBase threads;
- int i, tot_thread = BLI_system_thread_count();
+ int i, tot_thread = BLI_task_scheduler_num_threads(task_scheduler);
+ int width, height;
ProxyQueue queue;
+ if (build_undistort_count) {
+ BKE_movieclip_get_size(clip, NULL, &width, &height);
+ }
+
BLI_spin_init(&queue.spin);
queue.cfra = sfra;
@@ -1179,16 +1233,13 @@ static void do_sequence_proxy(void *pjv, int *build_sizes, int build_count,
queue.do_update = do_update;
queue.progress = progress;
- handles = MEM_callocN(sizeof(ProxyThread) * tot_thread, "proxy threaded handles");
-
- if (tot_thread > 1)
- BLI_init_threads(&threads, do_proxy_thread, tot_thread);
-
+ task_pool = BLI_task_pool_create(task_scheduler, &queue);
+ handles = MEM_callocN(sizeof(ProxyThread) * tot_thread,
+ "proxy threaded handles");
for (i = 0; i < tot_thread; i++) {
ProxyThread *handle = &handles[i];
handle->clip = clip;
- handle->queue = &queue;
handle->build_count = build_count;
handle->build_sizes = build_sizes;
@@ -1197,29 +1248,29 @@ static void do_sequence_proxy(void *pjv, int *build_sizes, int build_count,
handle->build_undistort_sizes = build_undistort_sizes;
if (build_undistort_count) {
- int width, height;
- BKE_movieclip_get_size(clip, NULL, &width, &height);
- handle->distortion = BKE_tracking_distortion_new(&clip->tracking, width, height);
+ handle->distortion = BKE_tracking_distortion_new(&clip->tracking,
+ width, height);
}
- if (tot_thread > 1)
- BLI_insert_thread(&threads, handle);
+ BLI_task_pool_push(task_pool,
+ proxy_task_func,
+ handle,
+ false,
+ TASK_PRIORITY_LOW);
}
- if (tot_thread > 1)
- BLI_end_threads(&threads);
- else
- do_proxy_thread(handles);
-
- MEM_freeN(handles);
+ BLI_task_pool_work_and_wait(task_pool);
+ BLI_task_pool_free(task_pool);
if (build_undistort_count) {
for (i = 0; i < tot_thread; i++) {
ProxyThread *handle = &handles[i];
-
BKE_tracking_distortion_free(handle->distortion);
}
}
+
+ BLI_spin_end(&queue.spin);
+ MEM_freeN(handles);
}
static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt
index 241a48c1e2d..ecfb1f0e0df 100644
--- a/source/blender/editors/space_console/CMakeLists.txt
+++ b/source/blender/editors/space_console/CMakeLists.txt
@@ -23,10 +23,12 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -45,4 +47,6 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_console "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_console/SConscript b/source/blender/editors/space_console/SConscript
index 0395a33cd97..87d12fe34bd 100644
--- a/source/blender/editors/space_console/SConscript
+++ b/source/blender/editors/space_console/SConscript
@@ -28,16 +28,19 @@
Import ('env')
sources = env.Glob('*.c')
-defs = []
+
+defs = env['BF_GL_DEFINITIONS']
incs = [
'../include',
- '#/extern/glew/include',
'#/intern/guardedalloc',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../../makesdna',
'../../makesrna',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../windowmanager',
'../../blenfont',
]
diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt
index 3b2db3ee7bc..fc007a659b4 100644
--- a/source/blender/editors/space_file/CMakeLists.txt
+++ b/source/blender/editors/space_file/CMakeLists.txt
@@ -25,11 +25,13 @@ set(INC
../../blenlib
../../blenloader
../../imbuf
+ ../../gpu
../../makesdna
../../makesrna
../../render/extern/include
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -86,6 +88,8 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript
index d42394454eb..85c3e073922 100644
--- a/source/blender/editors/space_file/SConscript
+++ b/source/blender/editors/space_file/SConscript
@@ -30,12 +30,14 @@ Import ('env')
sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
'../../blenloader',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
@@ -44,7 +46,7 @@ incs = [
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_OPENJPEG']:
defs.append('WITH_OPENJPEG')
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 1915f45fc87..00d9680f0aa 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -443,7 +443,12 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
if (pathString == NULL || !CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingASCII))
continue;
- fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, NULL);
+
+ /* Exclude "all my files" as it makes no sense in blender fileselector */
+ /* Exclude "airdrop" if wlan not active as it would show "" ) */
+ if (!strstr((char *)line, "myDocuments.cannedSearch") && (strcmp((char *)line, ""))) {
+ fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, NULL);
+ }
CFRelease(pathString);
CFRelease(cfURL);
diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt
index d3fb87204fb..0a29810ff3d 100644
--- a/source/blender/editors/space_graph/CMakeLists.txt
+++ b/source/blender/editors/space_graph/CMakeLists.txt
@@ -23,10 +23,12 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -56,4 +58,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_graph/SConscript b/source/blender/editors/space_graph/SConscript
index 8ddeb0ccfe8..35e09749743 100644
--- a/source/blender/editors/space_graph/SConscript
+++ b/source/blender/editors/space_graph/SConscript
@@ -31,19 +31,21 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/audaspace/intern',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
'../../windowmanager',
]
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt
index 62ac3c2d985..30bfc2fbdfd 100644
--- a/source/blender/editors/space_image/CMakeLists.txt
+++ b/source/blender/editors/space_image/CMakeLists.txt
@@ -23,14 +23,15 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
- ../../imbuf
../../bmesh
+ ../../imbuf
+ ../../gpu
../../makesdna
../../makesrna
../../render/extern/include
../../windowmanager
../../../../intern/guardedalloc
- ../../gpu
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -71,4 +72,6 @@ if(WITH_IMAGE_CINEON)
add_definitions(-DWITH_CINEON)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript
index d878a726b55..e983db431b4 100644
--- a/source/blender/editors/space_image/SConscript
+++ b/source/blender/editors/space_image/SConscript
@@ -31,12 +31,14 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
'../../bmesh',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
@@ -46,7 +48,7 @@ incs = [
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index ed6e6ba1e1b..ffdb8ecfce6 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -284,10 +284,10 @@ static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PRE
/* ********************* callbacks for standard image buttons *************** */
-static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *render_slot_p)
+static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *image_p)
{
uiBlock *block = uiLayoutGetBlock(layout);
- short *render_slot = render_slot_p;
+ Image *image = image_p;
int slot;
uiDefBut(block, LABEL, 0, IFACE_("Slot"),
@@ -296,10 +296,15 @@ static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *
slot = IMA_MAX_RENDER_SLOT;
while (slot--) {
- char str[32];
- BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot + 1);
+ char str[64];
+ if (image->render_slots[slot].name[0] != '\0') {
+ BLI_strncpy(str, image->render_slots[slot].name, sizeof(str));
+ }
+ else {
+ BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot + 1);
+ }
uiDefButS(block, BUTM, B_NOP, str, 0, 0,
- UI_UNIT_X * 5, UI_UNIT_X, render_slot, (float) slot, 0.0, 0, -1, "");
+ UI_UNIT_X * 5, UI_UNIT_X, &image->render_slot, (float) slot, 0.0, 0, -1, "");
}
}
@@ -492,7 +497,7 @@ static void image_user_change(bContext *C, void *iuser_v, void *unused)
}
#endif
-static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, int w, short *render_slot)
+static void uiblock_layer_pass_buttons(uiLayout *layout, Image *image, RenderResult *rr, ImageUser *iuser, int w, short *render_slot)
{
static void *rnd_pt[3]; /* XXX, workaround */
uiBlock *block = uiLayoutGetBlock(layout);
@@ -516,8 +521,13 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image
/* menu buts */
if (render_slot) {
char str[64];
- BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), *render_slot + 1);
- but = uiDefMenuBut(block, ui_imageuser_slot_menu, render_slot, str, 0, 0, wmenu1, UI_UNIT_Y, TIP_("Select Slot"));
+ if (image->render_slots[*render_slot].name[0] != '\0') {
+ BLI_strncpy(str, image->render_slots[*render_slot].name, sizeof(str));
+ }
+ else {
+ BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), *render_slot + 1);
+ }
+ but = uiDefMenuBut(block, ui_imageuser_slot_menu, image, str, 0, 0, wmenu1, UI_UNIT_Y, TIP_("Select Slot"));
uiButSetFunc(but, image_multi_cb, rr, iuser);
uiButSetMenuFromPulldown(but);
}
@@ -547,7 +557,7 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image
}
}
-static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, short *render_slot)
+static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, Image *image, RenderResult *rr, ImageUser *iuser, short *render_slot)
{
uiBlock *block = uiLayoutGetBlock(layout);
uiLayout *row;
@@ -569,7 +579,7 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr,
but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Layer"));
uiButSetFunc(but, image_multi_inclay_cb, rr, iuser);
- uiblock_layer_pass_buttons(row, rr, iuser, 230 * dpi_fac, render_slot);
+ uiblock_layer_pass_buttons(row, image, rr, iuser, 230 * dpi_fac, render_slot);
/* decrease, increase arrows */
but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Pass"));
@@ -691,7 +701,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
/* use BKE_image_acquire_renderresult so we get the correct slot in the menu */
rr = BKE_image_acquire_renderresult(scene, ima);
- uiblock_layer_pass_arrow_buttons(layout, rr, iuser, &ima->render_slot);
+ uiblock_layer_pass_arrow_buttons(layout, ima, rr, iuser, &ima->render_slot);
BKE_image_release_renderresult(scene, ima);
}
}
@@ -724,7 +734,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
/* multilayer? */
if (ima->type == IMA_TYPE_MULTILAYER && ima->rr) {
- uiblock_layer_pass_arrow_buttons(layout, ima->rr, iuser, NULL);
+ uiblock_layer_pass_arrow_buttons(layout, ima, ima->rr, iuser, NULL);
}
else if (ima->source != IMA_SRC_GENERATED) {
if (compact == 0) {
@@ -937,7 +947,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser
/* use BKE_image_acquire_renderresult so we get the correct slot in the menu */
rr = BKE_image_acquire_renderresult(scene, ima);
- uiblock_layer_pass_buttons(layout, rr, iuser, 160 * dpi_fac, (ima->type == IMA_TYPE_R_RESULT) ? &ima->render_slot : NULL);
+ uiblock_layer_pass_buttons(layout, ima, rr, iuser, 160 * dpi_fac, (ima->type == IMA_TYPE_R_RESULT) ? &ima->render_slot : NULL);
BKE_image_release_renderresult(scene, ima);
}
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 79c21bab01c..f41e237beb4 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -83,6 +83,7 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar, float zoomx,
{
RenderResult *rr;
Render *re = RE_GetRender(scene->id.name);
+ RenderData *rd = RE_engine_get_render_data(re);
rr = BKE_image_acquire_renderresult(scene, ima);
@@ -110,9 +111,9 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar, float zoomx,
glTranslatef(x, y, 0.0f);
glScalef(zoomx, zoomy, 1.0f);
- if (scene->r.mode & R_BORDER) {
- glTranslatef((int)(-scene->r.border.xmin * scene->r.xsch * scene->r.size / 100.0f),
- (int)(-scene->r.border.ymin * scene->r.ysch * scene->r.size / 100.0f),
+ if (rd->mode & R_BORDER) {
+ glTranslatef((int)(-rd->border.xmin * rd->xsch * rd->size / 100.0f),
+ (int)(-rd->border.ymin * rd->ysch * rd->size / 100.0f),
0.0f);
}
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index 74a0a18b0c8..aecc43f4fdf 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -92,6 +92,8 @@ void IMAGE_OT_curves_point_set(struct wmOperatorType *ot);
void IMAGE_OT_change_frame(struct wmOperatorType *ot);
void IMAGE_OT_read_renderlayers(struct wmOperatorType *ot);
+void IMAGE_OT_render_border(struct wmOperatorType *ot);
+void IMAGE_OT_clear_render_border(struct wmOperatorType *ot);
/* image_panels.c */
struct ImageUser *ntree_get_active_iuser(struct bNodeTree *ntree);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 58b56e99119..df556f94f28 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -3101,3 +3101,88 @@ void IMAGE_OT_read_renderlayers(wmOperatorType *ot)
/* flags */
ot->flag = 0;
}
+
+/* ********************* Render border operator ****************** */
+
+static int render_border_exec(bContext *C, wmOperator *op)
+{
+ ARegion *ar = CTX_wm_region(C);
+ Scene *scene = CTX_data_scene(C);
+ rctf border;
+
+ /* get rectangle from operator */
+ WM_operator_properties_border_to_rctf(op, &border);
+ UI_view2d_region_to_view_rctf(&ar->v2d, &border, &border);
+
+ /* actually set border */
+ CLAMP(border.xmin, 0.0f, 1.0f);
+ CLAMP(border.ymin, 0.0f, 1.0f);
+ CLAMP(border.xmax, 0.0f, 1.0f);
+ CLAMP(border.ymax, 0.0f, 1.0f);
+ scene->r.border = border;
+
+ /* drawing a border surrounding the entire camera view switches off border rendering
+ * or the border covers no pixels */
+ if ((border.xmin <= 0.0f && border.xmax >= 1.0f &&
+ border.ymin <= 0.0f && border.ymax >= 1.0f) ||
+ (border.xmin == border.xmax || border.ymin == border.ymax))
+ {
+ scene->r.mode &= ~R_BORDER;
+ }
+ else {
+ scene->r.mode |= R_BORDER;
+ }
+
+ WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ return OPERATOR_FINISHED;
+
+}
+
+void IMAGE_OT_render_border(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Render Border";
+ ot->description = "Set the boundaries of the border render and enable border render";
+ ot->idname = "IMAGE_OT_render_border";
+
+ /* api callbacks */
+ ot->invoke = WM_border_select_invoke;
+ ot->exec = render_border_exec;
+ ot->modal = WM_border_select_modal;
+ ot->cancel = WM_border_select_cancel;
+ ot->poll = image_cycle_render_slot_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* rna */
+ WM_operator_properties_border(ot);
+}
+
+/* ********************* Clear render border operator ****************** */
+
+static int clear_render_border_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ scene->r.mode &= ~R_BORDER;
+ WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ BLI_rctf_init(&scene->r.border, 0.0f, 1.0f, 0.0f, 1.0f);
+ return OPERATOR_FINISHED;
+
+}
+
+void IMAGE_OT_clear_render_border(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Render Border";
+ ot->description = "Clear the boundaries of the border render and disable border render";
+ ot->idname = "IMAGE_OT_clear_render_border";
+
+ /* api callbacks */
+ ot->exec = clear_render_border_exec;
+ ot->poll = image_cycle_render_slot_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index ab616bf592f..9cfd2e645f9 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -257,6 +257,8 @@ static void image_operatortypes(void)
WM_operatortype_append(IMAGE_OT_change_frame);
WM_operatortype_append(IMAGE_OT_read_renderlayers);
+ WM_operatortype_append(IMAGE_OT_render_border);
+ WM_operatortype_append(IMAGE_OT_clear_render_border);
}
static void image_keymap(struct wmKeyConfig *keyconf)
@@ -325,9 +327,9 @@ static void image_keymap(struct wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "toggle", true);
/* fast switch to render slots */
- for (i = 0; i < MAX2(IMA_MAX_RENDER_SLOT, 9); i++) {
+ for (i = 0; i < MIN2(IMA_MAX_RENDER_SLOT, 9); i++) {
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_int", ONEKEY + i, KM_PRESS, 0, 0);
- RNA_string_set(kmi->ptr, "data_path", "space_data.image.render_slot");
+ RNA_string_set(kmi->ptr, "data_path", "space_data.image.render_slots.active_index");
RNA_int_set(kmi->ptr, "value", i);
}
@@ -343,6 +345,10 @@ static void image_keymap(struct wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
RNA_string_set(kmi->ptr, "value", "CURSOR");
+
+ /* render border */
+ WM_keymap_add_item(keymap, "IMAGE_OT_render_border", BKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "IMAGE_OT_clear_render_border", BKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
}
/* dropboxes */
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index 94b40a9f40a..46ea251de03 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -26,10 +26,12 @@ set(INC
../../blenloader
../../imbuf
../../bmesh
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -52,4 +54,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_info "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_info/SConscript b/source/blender/editors/space_info/SConscript
index 2a1419984c6..378940805da 100644
--- a/source/blender/editors/space_info/SConscript
+++ b/source/blender/editors/space_info/SConscript
@@ -31,13 +31,15 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
'../../blenloader',
'../../bmesh',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
@@ -45,7 +47,7 @@ incs = [
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt
index af2e8476511..19525c87923 100644
--- a/source/blender/editors/space_logic/CMakeLists.txt
+++ b/source/blender/editors/space_logic/CMakeLists.txt
@@ -24,10 +24,12 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -47,6 +49,8 @@ if(WITH_GAMEENGINE)
add_definitions(-DWITH_GAMEENGINE)
endif()
+add_definitions(${GL_DEFINITIONS})
+
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
diff --git a/source/blender/editors/space_logic/SConscript b/source/blender/editors/space_logic/SConscript
index ae8e929a684..067073fab22 100644
--- a/source/blender/editors/space_logic/SConscript
+++ b/source/blender/editors/space_logic/SConscript
@@ -31,12 +31,14 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../interface',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
@@ -44,7 +46,7 @@ incs = [
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_GAMEENGINE']:
defs.append('WITH_GAMEENGINE')
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index a74fc3191b7..ab0dfa30121 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -23,10 +23,12 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -49,4 +51,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_nla/SConscript b/source/blender/editors/space_nla/SConscript
index a00337e0b58..9e743d918b9 100644
--- a/source/blender/editors/space_nla/SConscript
+++ b/source/blender/editors/space_nla/SConscript
@@ -31,18 +31,20 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../makesdna',
'../../makesrna',
'../../windowmanager',
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index 6b0460ce5cd..34887f8388d 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -32,6 +32,7 @@ set(INC
../../windowmanager
../../compositor
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -64,4 +65,6 @@ if(WITH_COMPOSITOR)
add_definitions(-DWITH_COMPOSITOR)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_node/SConscript b/source/blender/editors/space_node/SConscript
index 94756b96035..435a78f1b7e 100644
--- a/source/blender/editors/space_node/SConscript
+++ b/source/blender/editors/space_node/SConscript
@@ -31,7 +31,8 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
@@ -47,7 +48,8 @@ incs = [
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
+
cf = []
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
#cf.append('/WX')
diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index 4db47b75502..b716f0671bd 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -24,10 +24,12 @@ set(INC
../../blenlib
../../blenfont
../../imbuf
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -50,4 +52,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_outliner/SConscript b/source/blender/editors/space_outliner/SConscript
index db8041f0235..cc02c9555a9 100644
--- a/source/blender/editors/space_outliner/SConscript
+++ b/source/blender/editors/space_outliner/SConscript
@@ -28,15 +28,18 @@
Import ('env')
sources = env.Glob('*.c')
-defs = []
+
+defs = env['BF_GL_DEFINITIONS']
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 7eb90953df4..e033f781f62 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -29,6 +29,7 @@
* \ingroup spoutliner
*/
+#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_group_types.h"
#include "DNA_lamp_types.h"
@@ -46,6 +47,7 @@
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_depsgraph.h"
+#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
@@ -55,6 +57,7 @@
#include "BKE_object.h"
#include "ED_armature.h"
+#include "ED_keyframing.h"
#include "ED_object.h"
#include "ED_screen.h"
@@ -168,7 +171,7 @@ static void restrictbutton_recursive_bone(bContext *C, bArmature *arm, Bone *bon
}
static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob_parent, char flag,
- bool state, bool deselect)
+ bool state, bool deselect, const char *rnapropname)
{
Main *bmain = CTX_data_main(C);
Object *ob;
@@ -183,6 +186,33 @@ static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob
else {
ob->restrictflag &= ~flag;
}
+
+ if (rnapropname) {
+ PointerRNA ptr;
+ PropertyRNA *prop;
+ ID *id;
+ bAction *action;
+ FCurve *fcu;
+ bool driven;
+
+ RNA_id_pointer_create(&ob->id, &ptr);
+ prop = RNA_struct_find_property(&ptr, rnapropname);
+ fcu = rna_get_fcurve_context_ui(C, &ptr, prop, 0, &action, &driven);
+
+ if (fcu && !driven) {
+ id = ptr.id.data;
+ if (autokeyframe_cfra_can_key(scene, id)) {
+ ReportList *reports = CTX_wm_reports(C);
+ short flag = ANIM_get_keyframing_flags(scene, 1);
+
+ fcu->flag &= ~FCURVE_SELECTED;
+ insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
+ fcu->rna_path, fcu->array_index, CFRA, flag);
+ /* Assuming this is not necessary here, since 'ancestor' object button will do it anyway. */
+ /* WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); */
+ }
+ }
+ }
}
}
}
@@ -203,7 +233,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
if (CTX_wm_window(C)->eventstate->ctrl) {
restrictbutton_recursive_child(C, scene, ob, OB_RESTRICT_VIEW,
- (ob->restrictflag & OB_RESTRICT_VIEW) != 0, true);
+ (ob->restrictflag & OB_RESTRICT_VIEW) != 0, true, "hide");
}
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -226,7 +256,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
if (CTX_wm_window(C)->eventstate->ctrl) {
restrictbutton_recursive_child(C, scene, ob, OB_RESTRICT_SELECT,
- (ob->restrictflag & OB_RESTRICT_SELECT) != 0, true);
+ (ob->restrictflag & OB_RESTRICT_SELECT) != 0, true, NULL);
}
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -239,7 +269,7 @@ static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2)
if (CTX_wm_window(C)->eventstate->ctrl) {
restrictbutton_recursive_child(C, (Scene *)poin, ob, OB_RESTRICT_RENDER,
- (ob->restrictflag & OB_RESTRICT_RENDER) != 0, false);
+ (ob->restrictflag & OB_RESTRICT_RENDER) != 0, false, "hide_render");
}
WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, poin);
diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt
index 26c4183f7df..2eb31576c57 100644
--- a/source/blender/editors/space_script/CMakeLists.txt
+++ b/source/blender/editors/space_script/CMakeLists.txt
@@ -22,10 +22,12 @@ set(INC
../include
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -47,4 +49,6 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_script "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_script/SConscript b/source/blender/editors/space_script/SConscript
index acb0bf9f20b..e749780a4aa 100644
--- a/source/blender/editors/space_script/SConscript
+++ b/source/blender/editors/space_script/SConscript
@@ -31,10 +31,12 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
@@ -42,7 +44,7 @@ incs = [
'../../windowmanager',
]
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_PYTHON']:
defs.append('WITH_PYTHON')
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index db5729a5762..4cf9c0c95c2 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -24,10 +24,12 @@ set(INC
../../blenkernel
../../blenlib
../../imbuf
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -60,4 +62,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_sequencer/SConscript b/source/blender/editors/space_sequencer/SConscript
index 5aae30244a7..954f8abff69 100644
--- a/source/blender/editors/space_sequencer/SConscript
+++ b/source/blender/editors/space_sequencer/SConscript
@@ -31,19 +31,21 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/audaspace/intern',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
'../../windowmanager',
]
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs.append(env['BF_PTHREADS_INC'])
diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt
index bfeeb93372a..5367efbf84b 100644
--- a/source/blender/editors/space_text/CMakeLists.txt
+++ b/source/blender/editors/space_text/CMakeLists.txt
@@ -23,10 +23,12 @@ set(INC
../../blenfont
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -48,6 +50,8 @@ set(SRC
text_intern.h
)
+add_definitions(${GL_DEFINITIONS})
+
if(WITH_PYTHON)
list(APPEND INC
../../python
diff --git a/source/blender/editors/space_text/SConscript b/source/blender/editors/space_text/SConscript
index 3f617f95c58..8ee9bd745dd 100644
--- a/source/blender/editors/space_text/SConscript
+++ b/source/blender/editors/space_text/SConscript
@@ -28,14 +28,18 @@
Import ('env')
sources = env.Glob('*.c')
-defs = []
+
+defs = env['BF_GL_DEFINITIONS']
+
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../imbuf',
'../../makesdna',
'../../makesrna',
diff --git a/source/blender/editors/space_time/CMakeLists.txt b/source/blender/editors/space_time/CMakeLists.txt
index b42ae3ab725..90af405eaa8 100644
--- a/source/blender/editors/space_time/CMakeLists.txt
+++ b/source/blender/editors/space_time/CMakeLists.txt
@@ -22,10 +22,12 @@ set(INC
../include
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -39,4 +41,6 @@ set(SRC
time_intern.h
)
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_space_time "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_time/SConscript b/source/blender/editors/space_time/SConscript
index bf1b918f4f1..5a9e9a4cb42 100644
--- a/source/blender/editors/space_time/SConscript
+++ b/source/blender/editors/space_time/SConscript
@@ -31,15 +31,17 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenkernel',
'../../blenlib',
+ '../../gpu',
'../../makesdna',
'../../makesrna',
'../../windowmanager',
]
-defs = []
+defs = env['BF_GL_DEFINITIONS']
env.BlenderLib('bf_editors_space_time', sources, incs, defs, libtype=['core'], priority=[65])
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index 97c328dbac2..320267a4a7c 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -31,6 +31,7 @@ set(INC
../../render/extern/include
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
../../../../intern/smoke/extern
)
@@ -76,7 +77,7 @@ if(WITH_GAMEENGINE)
add_definitions(-DWITH_GAMEENGINE)
endif()
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
diff --git a/source/blender/editors/space_view3d/SConscript b/source/blender/editors/space_view3d/SConscript
index e6658ab3c49..a21da940906 100644
--- a/source/blender/editors/space_view3d/SConscript
+++ b/source/blender/editors/space_view3d/SConscript
@@ -28,11 +28,13 @@
Import ('env')
sources = env.Glob('*.c')
-defs = [ 'GLEW_STATIC' ]
+
+defs = env['BF_GL_DEFINITIONS']
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/smoke/extern',
'#/source/gameengine/BlenderRoutines',
'../include',
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 0e3621aa91f..b3accb431ee 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -434,9 +434,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
BGpic *bgpic;
/* clear or remove stuff from old */
-
-// XXX BIF_view3d_previewrender_free(v3do);
-
+
if (v3dn->localvd) {
v3dn->localvd = NULL;
v3dn->properties_storage = NULL;
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index 3ad5d94efd6..0c360474b78 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -30,6 +30,7 @@ set(INC
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -54,4 +55,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/transform/SConscript b/source/blender/editors/transform/SConscript
index 4f47062e3a3..e249856b747 100644
--- a/source/blender/editors/transform/SConscript
+++ b/source/blender/editors/transform/SConscript
@@ -31,20 +31,21 @@ sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
'../../bmesh',
+ '../../gpu',
'../../ikplugin',
'../../makesdna',
'../../makesrna',
- '../../gpu',
'../../windowmanager',
]
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 47adbb6d16d..86e6e611cf3 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2773,8 +2773,8 @@ void flushTransUVs(TransInfo *t)
td->loc2d[1] = td->loc[1] * invy;
if ((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
- td->loc2d[0] = (float)floor(width * td->loc2d[0] + 0.5f) / width;
- td->loc2d[1] = (float)floor(height * td->loc2d[1] + 0.5f) / height;
+ td->loc2d[0] = floorf(width * td->loc2d[0] + 0.5f) / width;
+ td->loc2d[1] = floorf(height * td->loc2d[1] + 0.5f) / height;
}
}
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index af563f71376..8a3e8f19db4 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -2396,7 +2396,7 @@ bool snapNodesContext(bContext *C, const int mval[2], float *r_dist_px, float r_
/*================================================================*/
-static void applyGridIncrement(TransInfo *t, float *val, int max_index, float fac[3], GearsType action);
+static void applyGridIncrement(TransInfo *t, float *val, int max_index, const float fac[3], GearsType action);
void snapGridIncrementAction(TransInfo *t, float *val, GearsType action)
@@ -2429,7 +2429,7 @@ void snapGridIncrement(TransInfo *t, float *val)
}
-static void applyGridIncrement(TransInfo *t, float *val, int max_index, float fac[3], GearsType action)
+static void applyGridIncrement(TransInfo *t, float *val, int max_index, const float fac[3], GearsType action)
{
int i;
float asp[3] = {1.0f, 1.0f, 1.0f}; // TODO: Remove hard coded limit here (3)
@@ -2457,6 +2457,6 @@ static void applyGridIncrement(TransInfo *t, float *val, int max_index, float fa
}
for (i = 0; i <= max_index; i++) {
- val[i] = fac[action] * asp[i] * (float)floor(val[i] / (fac[action] * asp[i]) + 0.5f);
+ val[i] = fac[action] * asp[i] * floorf(val[i] / (fac[action] * asp[i]) + 0.5f);
}
}
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 4400870f1b8..f4189a18da4 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -24,10 +24,12 @@ set(INC
../../blenkernel
../../blenlib
../../bmesh
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -91,7 +93,7 @@ set(SRC
../include/UI_view2d.h
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
diff --git a/source/blender/editors/util/SConscript b/source/blender/editors/util/SConscript
index 0876fe48c91..d695a848f4e 100644
--- a/source/blender/editors/util/SConscript
+++ b/source/blender/editors/util/SConscript
@@ -28,16 +28,19 @@
Import ('env')
sources = env.Glob('*.c')
-defs = [ 'GLEW_STATIC' ]
+
+defs = env['BF_GL_DEFINITIONS']
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../include',
'../../blenfont',
'../../blenkernel',
'../../blenlib',
'../../bmesh',
+ '../../gpu',
'../../makesdna',
'../../makesrna',
'../../windowmanager',
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 56b12fcdcda..ec0471da8d3 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -153,19 +153,20 @@ void ED_editors_exit(bContext *C)
/* flush any temp data from object editing to DNA before writing files,
* rendering, copying, etc. */
-void ED_editors_flush_edits(const bContext *C, bool for_render)
+bool ED_editors_flush_edits(const bContext *C, bool for_render)
{
+ bool has_edited = false;
Object *ob;
- Object *obedit = CTX_data_edit_object(C);
Main *bmain = CTX_data_main(C);
- /* get editmode results */
- if (obedit)
- ED_object_editmode_load(obedit);
+ /* loop through all data to find edit mode or object mode, because during
+ * exiting we might not have a context for edit object and multiple sculpt
+ * objects can exist at the same time */
for (ob = bmain->object.first; ob; ob = ob->id.next) {
- if (ob && (ob->mode & OB_MODE_SCULPT)) {
+ if (ob->mode & OB_MODE_SCULPT) {
/* flush multires changes (for sculpt) */
multires_force_update(ob);
+ has_edited = true;
if (for_render) {
/* flush changes from dynamic topology sculpt */
@@ -177,7 +178,14 @@ void ED_editors_flush_edits(const bContext *C, bool for_render)
BKE_sculptsession_bm_to_me(ob, false);
}
}
+ else if (ob->mode & OB_MODE_EDIT) {
+ /* get editmode results */
+ has_edited = true;
+ ED_object_editmode_load(ob);
+ }
}
+
+ return has_edited;
}
/* ***** XXX: functions are using old blender names, cleanup later ***** */
diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt
index 45edbde7482..74ba1672485 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -24,10 +24,12 @@ set(INC
../../blenlib
../../blenfont
../../bmesh
+ ../../gpu
../../makesdna
../../makesrna
../../windowmanager
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -57,4 +59,6 @@ if(WITH_OPENNL)
)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/uvedit/SConscript b/source/blender/editors/uvedit/SConscript
index 413503191cd..7153d25188b 100644
--- a/source/blender/editors/uvedit/SConscript
+++ b/source/blender/editors/uvedit/SConscript
@@ -27,13 +27,14 @@
Import ('env')
-defs = []
+defs = env['BF_GL_DEFINITIONS']
sources = env.Glob('*.c')
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/opennl/extern',
'../include',
'../../blenfont',
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt
index bfd1c17df7d..cb187eca6ac 100644
--- a/source/blender/freestyle/CMakeLists.txt
+++ b/source/blender/freestyle/CMakeLists.txt
@@ -189,8 +189,6 @@ set(SRC
intern/python/StrokeShader/BPy_CalligraphicShader.h
intern/python/StrokeShader/BPy_ColorNoiseShader.cpp
intern/python/StrokeShader/BPy_ColorNoiseShader.h
- intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp
- intern/python/StrokeShader/BPy_ColorVariationPatternShader.h
intern/python/StrokeShader/BPy_ConstantColorShader.cpp
intern/python/StrokeShader/BPy_ConstantColorShader.h
intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp
@@ -211,22 +209,12 @@ set(SRC
intern/python/StrokeShader/BPy_SmoothingShader.h
intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp
intern/python/StrokeShader/BPy_SpatialNoiseShader.h
- intern/python/StrokeShader/BPy_StrokeTextureShader.cpp
- intern/python/StrokeShader/BPy_StrokeTextureShader.h
intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp
intern/python/StrokeShader/BPy_StrokeTextureStepShader.h
- intern/python/StrokeShader/BPy_TextureAssignerShader.cpp
- intern/python/StrokeShader/BPy_TextureAssignerShader.h
intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp
intern/python/StrokeShader/BPy_ThicknessNoiseShader.h
- intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp
- intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h
intern/python/StrokeShader/BPy_TipRemoverShader.cpp
intern/python/StrokeShader/BPy_TipRemoverShader.h
- intern/python/StrokeShader/BPy_fstreamShader.cpp
- intern/python/StrokeShader/BPy_fstreamShader.h
- intern/python/StrokeShader/BPy_streamShader.cpp
- intern/python/StrokeShader/BPy_streamShader.h
intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h
intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
index a6c7a40e780..6b4a1872b61 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
@@ -32,11 +32,9 @@
#include "StrokeShader/BPy_BlenderTextureShader.h"
#include "StrokeShader/BPy_CalligraphicShader.h"
#include "StrokeShader/BPy_ColorNoiseShader.h"
-#include "StrokeShader/BPy_ColorVariationPatternShader.h"
#include "StrokeShader/BPy_ConstantColorShader.h"
#include "StrokeShader/BPy_ConstantThicknessShader.h"
#include "StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h"
-#include "StrokeShader/BPy_fstreamShader.h"
#include "StrokeShader/BPy_GuidingLinesShader.h"
#include "StrokeShader/BPy_IncreasingColorShader.h"
#include "StrokeShader/BPy_IncreasingThicknessShader.h"
@@ -44,12 +42,8 @@
#include "StrokeShader/BPy_SamplingShader.h"
#include "StrokeShader/BPy_SmoothingShader.h"
#include "StrokeShader/BPy_SpatialNoiseShader.h"
-#include "StrokeShader/BPy_streamShader.h"
-#include "StrokeShader/BPy_StrokeTextureShader.h"
#include "StrokeShader/BPy_StrokeTextureStepShader.h"
-#include "StrokeShader/BPy_TextureAssignerShader.h"
#include "StrokeShader/BPy_ThicknessNoiseShader.h"
-#include "StrokeShader/BPy_ThicknessVariationPatternShader.h"
#include "StrokeShader/BPy_TipRemoverShader.h"
#ifdef __cplusplus
@@ -94,11 +88,6 @@ int StrokeShader_Init(PyObject *module)
Py_INCREF(&ColorNoiseShader_Type);
PyModule_AddObject(module, "ColorNoiseShader", (PyObject *)&ColorNoiseShader_Type);
- if (PyType_Ready(&ColorVariationPatternShader_Type) < 0)
- return -1;
- Py_INCREF(&ColorVariationPatternShader_Type);
- PyModule_AddObject(module, "ColorVariationPatternShader", (PyObject *)&ColorVariationPatternShader_Type);
-
if (PyType_Ready(&ConstantColorShader_Type) < 0)
return -1;
Py_INCREF(&ConstantColorShader_Type);
@@ -115,11 +104,6 @@ int StrokeShader_Init(PyObject *module)
PyModule_AddObject(module, "ConstrainedIncreasingThicknessShader",
(PyObject *)&ConstrainedIncreasingThicknessShader_Type);
- if (PyType_Ready(&fstreamShader_Type) < 0)
- return -1;
- Py_INCREF(&fstreamShader_Type);
- PyModule_AddObject(module, "fstreamShader", (PyObject *)&fstreamShader_Type);
-
if (PyType_Ready(&GuidingLinesShader_Type) < 0)
return -1;
Py_INCREF(&GuidingLinesShader_Type);
@@ -155,36 +139,16 @@ int StrokeShader_Init(PyObject *module)
Py_INCREF(&SpatialNoiseShader_Type);
PyModule_AddObject(module, "SpatialNoiseShader", (PyObject *)&SpatialNoiseShader_Type);
- if (PyType_Ready(&streamShader_Type) < 0)
- return -1;
- Py_INCREF(&streamShader_Type);
- PyModule_AddObject(module, "streamShader", (PyObject *)&streamShader_Type);
-
- if (PyType_Ready(&StrokeTextureShader_Type) < 0)
- return -1;
- Py_INCREF(&StrokeTextureShader_Type);
- PyModule_AddObject(module, "StrokeTextureShader", (PyObject *)&StrokeTextureShader_Type);
-
if (PyType_Ready(&StrokeTextureStepShader_Type) < 0)
return -1;
Py_INCREF(&StrokeTextureStepShader_Type);
PyModule_AddObject(module, "StrokeTextureStepShader", (PyObject *)&StrokeTextureStepShader_Type);
- if (PyType_Ready(&TextureAssignerShader_Type) < 0)
- return -1;
- Py_INCREF(&TextureAssignerShader_Type);
- PyModule_AddObject(module, "TextureAssignerShader", (PyObject *)&TextureAssignerShader_Type);
-
if (PyType_Ready(&ThicknessNoiseShader_Type) < 0)
return -1;
Py_INCREF(&ThicknessNoiseShader_Type);
PyModule_AddObject(module, "ThicknessNoiseShader", (PyObject *)&ThicknessNoiseShader_Type);
- if (PyType_Ready(&ThicknessVariationPatternShader_Type) < 0)
- return -1;
- Py_INCREF(&ThicknessVariationPatternShader_Type);
- PyModule_AddObject(module, "ThicknessVariationPatternShader", (PyObject *)&ThicknessVariationPatternShader_Type);
-
if (PyType_Ready(&TipRemoverShader_Type) < 0)
return -1;
Py_INCREF(&TipRemoverShader_Type);
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
index c972db1e680..7419f0ed127 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
@@ -120,14 +120,20 @@ static PyObject *Interface0DIterator_iternext(BPy_Interface0DIterator *self)
self->if0D_it->decrement();
}
else {
- if (self->if0D_it->atLast() || self->if0D_it->isEnd()) {
+ if (self->if0D_it->isEnd()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
- if (self->at_start)
+ else if (self->at_start) {
self->at_start = false;
- else
+ }
+ else if (self->if0D_it->atLast()) {
+ PyErr_SetNone(PyExc_StopIteration);
+ return NULL;
+ }
+ else {
self->if0D_it->increment();
+ }
}
Interface0D *if0D = self->if0D_it->operator->();
return Any_BPy_Interface0D_from_Interface0D(*if0D);
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
index 18d1b37eb3b..e35076ec7fe 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
@@ -115,19 +115,25 @@ static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self)
self->sv_it->decrement();
}
else {
- /* if sv_it.isEnd() is true, the iterator can't be incremented. if sv_it.isLast() is true,
- * the iterator is currently pointing to the final valid argument. Incrementing it further would
- * give a python object that can't be dereferenced. */
- if (self->sv_it->atLast() || self->sv_it->isEnd()) {
+ /* If sv_it.isEnd() is true, the iterator can't be incremented. */
+ if (self->sv_it->isEnd()) {
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
- /* if at the start of the iterator, only return the object
- * and don't increment, to keep for-loops in sync */
- if (self->at_start)
+ /* If at the start of the iterator, only return the object
+ * and don't increment, to keep for-loops in sync */
+ else if (self->at_start) {
self->at_start = false;
- else
+ }
+ /* If sv_it.atLast() is true, the iterator is currently pointing to the final valid element.
+ * Incrementing it further would lead to a state that the iterator can't be dereferenced. */
+ else if (self->sv_it->atLast()) {
+ PyErr_SetNone(PyExc_StopIteration);
+ return NULL;
+ }
+ else {
self->sv_it->increment();
+ }
}
StrokeVertex *sv = self->sv_it->operator->();
return BPy_StrokeVertex_from_StrokeVertex(*sv);
@@ -149,9 +155,9 @@ static PyObject *StrokeVertexIterator_incremented(BPy_StrokeVertexIterator *self
PyErr_SetString(PyExc_RuntimeError, "cannot increment any more");
return NULL;
}
- StrokeInternal::StrokeVertexIterator *copy = new StrokeInternal::StrokeVertexIterator(*self->sv_it);
- copy->increment();
- return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*copy, self->reversed);
+ StrokeInternal::StrokeVertexIterator copy(*self->sv_it);
+ copy.increment();
+ return BPy_StrokeVertexIterator_from_StrokeVertexIterator(copy, self->reversed);
}
PyDoc_STRVAR(StrokeVertexIterator_decremented_doc,
@@ -168,10 +174,9 @@ static PyObject *StrokeVertexIterator_decremented(BPy_StrokeVertexIterator *self
PyErr_SetString(PyExc_RuntimeError, "cannot decrement any more");
return NULL;
}
-
- StrokeInternal::StrokeVertexIterator *copy = new StrokeInternal::StrokeVertexIterator(*self->sv_it);
- copy->decrement();
- return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*copy, self->reversed);
+ StrokeInternal::StrokeVertexIterator copy(*self->sv_it);
+ copy.decrement();
+ return BPy_StrokeVertexIterator_from_StrokeVertexIterator(copy, self->reversed);
}
PyDoc_STRVAR(StrokeVertexIterator_reversed_doc,
@@ -185,8 +190,7 @@ PyDoc_STRVAR(StrokeVertexIterator_reversed_doc,
static PyObject *StrokeVertexIterator_reversed(BPy_StrokeVertexIterator *self)
{
- StrokeInternal::StrokeVertexIterator *copy = new StrokeInternal::StrokeVertexIterator(*self->sv_it);
- return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*copy, !self->reversed);
+ return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*self->sv_it, !self->reversed);
}
static PyMethodDef BPy_StrokeVertexIterator_methods[] = {
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp
deleted file mode 100644
index 173e00b0ed8..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp
- * \ingroup freestyle
- */
-
-#include "BPy_ColorVariationPatternShader.h"
-
-#include "../../stroke/BasicStrokeShaders.h"
-#include "../BPy_Convert.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-//------------------------INSTANCE METHODS ----------------------------------
-
-static char ColorVariationPatternShader___doc__[] =
-"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ColorVariationPatternShader`\n"
-"\n"
-"[Color shader]\n"
-"\n"
-".. method:: __init__(pattern_name, stretch=True)\n"
-"\n"
-" Builds a ColorVariationPatternShader object.\n"
-"\n"
-" :arg pattern_name: The file name of the texture file to use as\n"
-" pattern.\n"
-" :type pattern_name: str\n"
-" :arg stretch: Tells whether the texture must be strecthed or\n"
-" repeted to fit the stroke.\n"
-" :type stretch: bool\n"
-"\n"
-".. method:: shade(stroke)\n"
-"\n"
-" Applies a pattern to vary the original color. The new color is the\n"
-" result of the multiplication of the pattern and the original color.\n"
-"\n"
-" :arg stroke: A Stroke object.\n"
-" :type stroke: :class:`freestyle.types.Stroke`\n";
-
-static int ColorVariationPatternShader___init__(BPy_ColorVariationPatternShader *self, PyObject *args, PyObject *kwds)
-{
- static const char *kwlist[] = {"pattern_name", "stretch", NULL};
- const char *s;
- PyObject *obj = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!", (char **)kwlist, &s, &PyBool_Type, &obj))
- return -1;
- bool b = (!obj) ? true : bool_from_PyBool(obj);
- self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s, b);
- return 0;
-}
-
-/*-----------------------BPy_ColorVariationPatternShader type definition ------------------------------*/
-
-PyTypeObject ColorVariationPatternShader_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "ColorVariationPatternShader", /* tp_name */
- sizeof(BPy_ColorVariationPatternShader), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- ColorVariationPatternShader___doc__, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- &StrokeShader_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)ColorVariationPatternShader___init__, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h
deleted file mode 100644
index af5cf17caff..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h
- * \ingroup freestyle
- */
-
-#ifndef __FREESTYLE_PYTHON_COLORVARIATIONPATTERNSHADER_H__
-#define __FREESTYLE_PYTHON_COLORVARIATIONPATTERNSHADER_H__
-
-#include "../BPy_StrokeShader.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-extern PyTypeObject ColorVariationPatternShader_Type;
-
-#define BPy_ColorVariationPatternShader_Check(v) \
- (PyObject_IsInstance((PyObject *)v, (PyObject *)&ColorVariationPatternShader_Type))
-
-/*---------------------------Python BPy_ColorVariationPatternShader structure definition----------*/
-typedef struct {
- BPy_StrokeShader py_ss;
-} BPy_ColorVariationPatternShader;
-
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* __FREESTYLE_PYTHON_COLORVARIATIONPATTERNSHADER_H__ */
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp
deleted file mode 100644
index db2807addc4..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp
- * \ingroup freestyle
- */
-
-#include "BPy_StrokeTextureShader.h"
-
-#include "../../stroke/BasicStrokeShaders.h"
-#include "../BPy_Convert.h"
-#include "../BPy_MediumType.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-//------------------------INSTANCE METHODS ----------------------------------
-
-static char StrokeTextureShader___doc__[] =
-"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`StrokeTextureShader`\n"
-"\n"
-"[Texture shader]\n"
-"\n"
-".. method:: __init__(texture_file, medium_type=Stroke.OPAQUE_MEDIUM, tips=False)\n"
-"\n"
-" Builds a StrokeTextureShader object.\n"
-"\n"
-" :arg texture_file: \n"
-" :type texture_file: str\n"
-" :arg medium_type: The medium type and therefore, the blending mode\n"
-" that must be used for the rendering of this stroke.\n"
-" :type medium_type: :class:`freestyle.types.MediumType`\n"
-" :arg tips: Tells whether the texture includes tips or not. If it\n"
-" is the case, the texture image must respect the following format.\n"
-" :type tips: bool\n"
-"\n"
-" The format of a texture image including tips::\n"
-"\n"
-" ___________\n"
-" | |\n"
-" | A |\n"
-" |___________|\n"
-" | | |\n"
-" | B | C |\n"
-" |_____|_____|\n"
-"\n"
-" * A : The stroke's corpus texture.\n"
-" * B : The stroke's left extremity texture.\n"
-" * C : The stroke's right extremity texture.\n"
-"\n"
-".. method:: shade(stroke)\n"
-"\n"
-" Assigns a texture and a blending mode to the stroke in order to\n"
-" simulate its marks system.\n"
-"\n"
-" :arg stroke: A Stroke object.\n"
-" :type stroke: :class:`freestyle.types.Stroke`\n";
-
-static int StrokeTextureShader___init__(BPy_StrokeTextureShader *self, PyObject *args, PyObject *kwds)
-{
- static const char *kwlist[] = {"texture_file", "medium_type", "tips", NULL};
- const char *s1;
- PyObject *obj2 = 0, *obj3 = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!O!", (char **)kwlist,
- &s1, &MediumType_Type, &obj2, &PyBool_Type, &obj3))
- {
- return -1;
- }
- Stroke::MediumType mt = (!obj2) ? Stroke::OPAQUE_MEDIUM : MediumType_from_BPy_MediumType(obj2);
- bool b = (!obj3) ? false : bool_from_PyBool(obj3);
- self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1, mt, b);
- return 0;
-}
-
-/*-----------------------BPy_StrokeTextureShader type definition ------------------------------*/
-
-PyTypeObject StrokeTextureShader_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "StrokeTextureShader", /* tp_name */
- sizeof(BPy_StrokeTextureShader), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- StrokeTextureShader___doc__, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- &StrokeShader_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)StrokeTextureShader___init__, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h
deleted file mode 100644
index d025e8b7c2d..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h
- * \ingroup freestyle
- */
-
-#ifndef __FREESTYLE_PYTHON_STROKETEXTURESHADER_H__
-#define __FREESTYLE_PYTHON_STROKETEXTURESHADER_H__
-
-#include "../BPy_StrokeShader.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-extern PyTypeObject StrokeTextureShader_Type;
-
-#define BPy_StrokeTextureShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeTextureShader_Type))
-
-/*---------------------------Python BPy_StrokeTextureShader structure definition----------*/
-typedef struct {
- BPy_StrokeShader py_ss;
-} BPy_StrokeTextureShader;
-
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* __FREESTYLE_PYTHON_STROKETEXTURESHADER_H__ */
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp
deleted file mode 100644
index 78a07cb6c38..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp
- * \ingroup freestyle
- */
-
-#include "BPy_TextureAssignerShader.h"
-
-#include "../../stroke/BasicStrokeShaders.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-//------------------------INSTANCE METHODS ----------------------------------
-
-static char TextureAssignerShader___doc__[] =
-"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`TextureAssignerShader`\n"
-"\n"
-"[Texture shader]\n"
-"\n"
-".. method:: __init__(preset)\n"
-"\n"
-" Builds a TextureAssignerShader object.\n"
-"\n"
-" :arg preset: The preset number to use.\n"
-" :type preset: int\n"
-"\n"
-".. method:: shade(stroke)\n"
-"\n"
-" Assigns a texture to the stroke in order to simulate its marks\n"
-" system. This shader takes as input an integer value telling which\n"
-" texture and blending mode to use among a set of predefined\n"
-" textures. Here are the different presets:\n"
-"\n"
-" * 0: `/brushes/charcoalAlpha.bmp`, `Stroke.HUMID_MEDIUM`\n"
-" * 1: `/brushes/washbrushAlpha.bmp`, `Stroke.HUMID_MEDIUM`\n"
-" * 2: `/brushes/oil.bmp`, `Stroke.HUMID_MEDIUM`\n"
-" * 3: `/brushes/oilnoblend.bmp`, `Stroke.HUMID_MEDIUM`\n"
-" * 4: `/brushes/charcoalAlpha.bmp`, `Stroke.DRY_MEDIUM`\n"
-" * 5: `/brushes/washbrushAlpha.bmp`, `Stroke.DRY_MEDIUM`\n"
-" * 6: `/brushes/opaqueDryBrushAlpha.bmp`, `Stroke.OPAQUE_MEDIUM`\n"
-" * 7: `/brushes/opaqueBrushAlpha.bmp`, `Stroke.OPAQUE_MEDIUM`\n"
-"\n"
-" Any other value will lead to the following preset:\n"
-"\n"
-" * Default: `/brushes/smoothAlpha.bmp`, `Stroke.OPAQUE_MEDIUM`\n"
-"\n"
-" :arg stroke: A Stroke object.\n"
-" :type stroke: :class:`freestyle.types.Stroke`\n";
-
-static int TextureAssignerShader___init__(BPy_TextureAssignerShader *self, PyObject *args, PyObject *kwds)
-{
- static const char *kwlist[] = {"preset", NULL};
- int i;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i))
- return -1;
- self->py_ss.ss = new StrokeShaders::TextureAssignerShader(i);
- return 0;
-}
-
-/*-----------------------BPy_TextureAssignerShader type definition ------------------------------*/
-
-PyTypeObject TextureAssignerShader_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "TextureAssignerShader", /* tp_name */
- sizeof(BPy_TextureAssignerShader), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- TextureAssignerShader___doc__, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- &StrokeShader_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)TextureAssignerShader___init__, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h
deleted file mode 100644
index 046f785dc57..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h
- * \ingroup freestyle
- */
-
-#ifndef __FREESTYLE_PYTHON_TEXTUREASSIGNERSHADER_H__
-#define __FREESTYLE_PYTHON_TEXTUREASSIGNERSHADER_H__
-
-#include "../BPy_StrokeShader.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-extern PyTypeObject TextureAssignerShader_Type;
-
-#define BPy_TextureAssignerShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&TextureAssignerShader_Type))
-
-/*---------------------------Python BPy_TextureAssignerShader structure definition----------*/
-typedef struct {
- BPy_StrokeShader py_ss;
-} BPy_TextureAssignerShader;
-
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* __FREESTYLE_PYTHON_TEXTUREASSIGNERSHADER_H__ */
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp
deleted file mode 100644
index 3196065cd34..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp
- * \ingroup freestyle
- */
-
-#include "BPy_ThicknessVariationPatternShader.h"
-
-#include "../../stroke/BasicStrokeShaders.h"
-#include "../BPy_Convert.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-//------------------------INSTANCE METHODS ----------------------------------
-
-static char ThicknessVariationPatternShader___doc__[] =
-"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ThicknessVariationPatternShader`\n"
-"\n"
-"[Thickness shader]\n"
-"\n"
-".. method:: __init__(pattern_name, thickness_min=1.0, thickness_max=5.0, stretch=True)\n"
-"\n"
-" Builds a ThicknessVariationPatternShader object.\n"
-"\n"
-" :arg pattern_name: The texture file name.\n"
-" :type pattern_name: str\n"
-" :arg thickness_min: The minimum thickness we don't want to exceed.\n"
-" :type thickness_min: float\n"
-" :arg thickness_max: The maximum thickness we don't want to exceed.\n"
-" :type thickness_max: float\n"
-" :arg stretch: Tells whether the pattern texture must be stretched\n"
-" or repeated to fit the stroke.\n"
-" :type stretch: bool\n"
-"\n"
-".. method:: shade(stroke)\n"
-"\n"
-" Applies a pattern (texture) to vary thickness. The new thicknesses\n"
-" are the result of the multiplication of the pattern and the\n"
-" original thickness.\n"
-"\n"
-" :arg stroke: A Stroke object.\n"
-" :type stroke: :class:`freestyle.types.Stroke`\n";
-
-static int ThicknessVariationPatternShader___init__(BPy_ThicknessVariationPatternShader *self,
- PyObject *args, PyObject *kwds)
-{
- static const char *kwlist[] = {"pattern_name", "thickness_min", "thickness_max", "stretch", NULL};
- const char *s1;
- float f2 = 1.0, f3 = 5.0;
- PyObject *obj4 = 0;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ffO!", (char **)kwlist, &s1, &f2, &f3, &PyBool_Type, &obj4))
- return -1;
- bool b = (!obj4) ? true : bool_from_PyBool(obj4);
- self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b);
- return 0;
-}
-
-/*-----------------------BPy_ThicknessVariationPatternShader type definition ------------------------------*/
-
-PyTypeObject ThicknessVariationPatternShader_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "ThicknessVariationPatternShader", /* tp_name */
- sizeof(BPy_ThicknessVariationPatternShader), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- ThicknessVariationPatternShader___doc__, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- &StrokeShader_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)ThicknessVariationPatternShader___init__, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h
deleted file mode 100644
index 604e875f815..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h
- * \ingroup freestyle
- */
-
-#ifndef __FREESTYLE_PYTHON_THICKNESSVARIATIONPATTERNSHADER_H__
-#define __FREESTYLE_PYTHON_THICKNESSVARIATIONPATTERNSHADER_H__
-
-#include "../BPy_StrokeShader.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-extern PyTypeObject ThicknessVariationPatternShader_Type;
-
-#define BPy_ThicknessVariationPatternShader_Check(v) \
- (PyObject_IsInstance((PyObject *)v, (PyObject *)&ThicknessVariationPatternShader_Type))
-
-/*---------------------------Python BPy_ThicknessVariationPatternShader structure definition----------*/
-typedef struct {
- BPy_StrokeShader py_ss;
-} BPy_ThicknessVariationPatternShader;
-
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* __FREESTYLE_PYTHON_THICKNESSVARIATIONPATTERNSHADER_H__ */
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp
deleted file mode 100644
index b838cae9817..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp
- * \ingroup freestyle
- */
-
-#include "BPy_fstreamShader.h"
-
-#include "../../stroke/AdvancedStrokeShaders.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-//------------------------INSTANCE METHODS ----------------------------------
-
-static char fstreamShader___doc__[] =
-"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`fstreamShader`\n"
-"\n"
-"[Output shader]\n"
-"\n"
-".. method:: __init__(filename)\n"
-"\n"
-" Builds a fstreamShader object.\n"
-"\n"
-" :arg filename: The output file name.\n"
-" :type filename: str\n"
-"\n"
-".. method:: shade(stroke)\n"
-"\n"
-" Streams the Stroke in a file.\n"
-"\n"
-" :arg stroke: A Stroke object.\n"
-" :type stroke: :class:`freestyle.types.Stroke`\n";
-
-static int fstreamShader___init__(BPy_fstreamShader *self, PyObject *args, PyObject *kwds)
-{
- static const char *kwlist[] = {"filename", NULL};
- const char *s;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &s))
- return -1;
- self->py_ss.ss = new StrokeShaders::fstreamShader(s);
- return 0;
-}
-
-/*-----------------------BPy_fstreamShader type definition ------------------------------*/
-
-PyTypeObject fstreamShader_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "fstreamShader", /* tp_name */
- sizeof(BPy_fstreamShader), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- fstreamShader___doc__, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- &StrokeShader_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)fstreamShader___init__, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h
deleted file mode 100644
index 9f2371a3756..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h
- * \ingroup freestyle
- */
-
-#ifndef __FREESTYLE_PYTHON_FSTREAMSHADER_H__
-#define __FREESTYLE_PYTHON_FSTREAMSHADER_H__
-
-#include "../BPy_StrokeShader.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-extern PyTypeObject fstreamShader_Type;
-
-#define BPy_fstreamShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&fstreamShader_Type))
-
-/*---------------------------Python BPy_fstreamShader structure definition----------*/
-typedef struct {
- BPy_StrokeShader py_ss;
-} BPy_fstreamShader;
-
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* __FREESTYLE_PYTHON_FSTREAMSHADER_H__ */
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp
deleted file mode 100644
index 97a6ca0d39e..00000000000
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp
- * \ingroup freestyle
- */
-
-#include "BPy_streamShader.h"
-
-#include "../../stroke/BasicStrokeShaders.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-//------------------------INSTANCE METHODS ----------------------------------
-
-static char streamShader___doc__[] =
-"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`streamShader`\n"
-"\n"
-"[Output shader]\n"
-"\n"
-".. method:: __init__()\n"
-"\n"
-" Builds a streamShader object.\n"
-"\n"
-".. method:: shade(stroke)\n"
-"\n"
-" Streams the Stroke into stdout.\n"
-"\n"
-" :arg stroke: A Stroke object.\n"
-" :type stroke: :class:`freestyle.types.Stroke`\n";
-
-static int streamShader___init__(BPy_streamShader *self, PyObject *args, PyObject *kwds)
-{
- static const char *kwlist[] = {NULL};
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
- return -1;
- self->py_ss.ss = new StrokeShaders::streamShader();
- return 0;
-}
-
-/*-----------------------BPy_streamShader type definition ------------------------------*/
-
-PyTypeObject streamShader_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "streamShader", /* tp_name */
- sizeof(BPy_streamShader), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- streamShader___doc__, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- &StrokeShader_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)streamShader___init__, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
index 274e36a4c9b..e37631e5bd6 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
@@ -81,20 +81,6 @@ int CalligraphicShader::shade(Stroke &ioStroke) const
return 0;
}
-#if 0
-void TipRemoverShader::shade(Stroke &ioStroke) const
-{
- StrokeInternal::StrokeVertexIterator v, vend;
- for (v = ioStroke.strokeVerticesBegin(), vend = ioStroke.strokeVerticesEnd(); v != vend; ++v) {
- if (((*v)->curvilinearAbscissa() < _tipLength) ||
- (((*v)->strokeLength() - (*v)->curvilinearAbscissa()) < _tipLength)) {
- (*v)->attribute().setThickness(0.0, 0.0);
- (*v)->attribute().setColor(1, 1, 1);
- }
- }
-}
-#endif
-
/////////////////////////////////////////
//
// SPATIAL NOISE SHADER
@@ -347,63 +333,4 @@ void Smoother::copyVertices()
_stroke->UpdateLength();
}
-#if 0 // FIXME
-
-/////////////////////////////////////////
-//
-// OMISSION SHADER
-//
-/////////////////////////////////////////
-
-OmissionShader::OmissionShader(real sizeWindow, real thrVari, real thrFlat, real lFlat)
-{
- _sizeWindow = sizeWindow;
- _thresholdVariation = thrVari;
- _thresholdFlat = thrFlat;
- _lengthFlat = lFlat;
-}
-
-int OmissionShader::shade(Stroke &ioStroke) const
-{
- Omitter omi(ioStroke);
- omi.omit(_sizeWindow, _thresholdVariation, _thresholdFlat, _lengthFlat);
-
- return 0;
-}
-
-
-// OMITTER
-///////////////////////////
-
-Omitter::Omitter(Stroke &ioStroke) : Smoother(ioStroke)
-{
- StrokeInternal::StrokeVertexIterator v, vend;
- int i = 0;
- for (v = ioStroke.strokeVerticesBegin(), vend = ioStroke.strokeVerticesEnd(); v != vend; ++v, ++i) {
- _u[i] = (v)->curvilinearAbscissa();
- }
-}
-
-void Omitter::omit(real sizeWindow, real thrVari, real thrFlat, real lFlat)
-{
- _sizeWindow=sizeWindow;
- _thresholdVariation=thrVari;
- _thresholdFlat=thrFlat;
- _lengthFlat=lFlat;
-
- for (int i = 1; i < _nbVertices-1; ++i) {
- if (_u[i] < _lengthFlat)
- continue;
- // is the previous segment flat?
- int j = i - 1;
- while ((j >= 0) && (_u[i] - _u[j] < _lengthFlat)) {
- if ((_normal[j] * _normal[i]) < _thresholdFlat)
- ; // FIXME
- --j;
- }
- }
-}
-
-#endif
-
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
index 69ca45d3ec7..11b7df7ecec 100644
--- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
@@ -43,9 +43,6 @@
#include "BKE_global.h"
-//soc #include <qimage.h>
-//soc #include <QString>
-
extern "C" {
# include "IMB_imbuf.h"
# include "IMB_imbuf_types.h"
@@ -53,32 +50,6 @@ extern "C" {
namespace Freestyle {
-// Internal function
-
-#if 0 // soc
-void convert(const QImage& iImage, float **oArray, unsigned &oSize)
-{
- oSize = iImage.width();
- *oArray = new float[oSize];
- for (unsigned int i = 0; i < oSize; ++i) {
- QRgb rgb = iImage.pixel(i,0);
- (*oArray)[i] = ((float)qBlue(rgb)) / 255.0f;
- }
-}
-#endif
-
-static void convert(ImBuf *imBuf, float **oArray, unsigned &oSize)
-{
- oSize = imBuf->x;
- *oArray = new float[oSize];
-
- char *pix;
- for (unsigned int i = 0; i < oSize; ++i) {
- pix = (char *) imBuf->rect + i * 4;
- (*oArray)[i] = ((float) pix[2]) / 255.0f;
- }
-}
-
namespace StrokeShaders {
//
@@ -191,76 +162,6 @@ int LengthDependingThicknessShader::shade(Stroke& stroke) const
return 0;
}
-
-ThicknessVariationPatternShader::ThicknessVariationPatternShader(const string pattern_name, float iMinThickness,
- float iMaxThickness, bool stretch)
-: StrokeShader()
-{
- _stretch = stretch;
- _minThickness = iMinThickness;
- _maxThickness = iMaxThickness;
- ImBuf *image = NULL;
- vector<string> pathnames;
- StringUtils::getPathName(TextureManager::Options::getPatternsPath(), pattern_name, pathnames);
- for (vector<string>::const_iterator j = pathnames.begin(); j != pathnames.end(); ++j) {
- ifstream ifs(j->c_str());
- if (ifs.is_open()) {
- /* OCIO_TODO: support different input color space */
- image = IMB_loadiffname(j->c_str(), 0, NULL);
- break;
- }
- }
- if (image == NULL)
- cerr << "Error: cannot find pattern \"" << pattern_name << "\" - check the path in the Options" << endl;
- else
- convert(image, &_aThickness, _size);
- IMB_freeImBuf(image);
-}
-
-
-int ThicknessVariationPatternShader::shade(Stroke& stroke) const
-{
- StrokeInternal::StrokeVertexIterator v, vend;
- float *array = NULL;
- /* int size; */ /* UNUSED */
- array = _aThickness;
- /* size = _size; */ /* UNUSED */
- int vert_size = stroke.strokeVerticesSize();
- int sig = 0;
- unsigned index;
- const float *originalThickness;
- for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
- originalThickness = v->attribute().getThickness();
- if (_stretch) {
- float tmp = v->u() * (_size - 1);
- index = (unsigned)floor(tmp);
- if ((tmp - index) > (index + 1 - tmp))
- ++index;
- }
- else {
- index = (unsigned)floor(v->curvilinearAbscissa());
- }
- index %= _size;
- float thicknessR = array[index] * originalThickness[0];
- float thicknessL = array[index] * originalThickness[1];
- if (thicknessR + thicknessL < _minThickness) {
- thicknessL = _minThickness / 2.0f;
- thicknessR = _minThickness / 2.0f;
- }
- if (thicknessR + thicknessL > _maxThickness) {
- thicknessL = _maxThickness / 2.0f;
- thicknessR = _maxThickness / 2.0f;
- }
- if ((sig == 0) || (sig == vert_size - 1))
- v->attribute().setThickness(1, 1);
- else
- v->attribute().setThickness(thicknessR, thicknessL);
- ++sig;
- }
- return 0;
-}
-
-
static const unsigned NB_VALUE_NOISE = 512;
ThicknessNoiseShader::ThicknessNoiseShader() : StrokeShader()
@@ -328,51 +229,6 @@ int IncreasingColorShader::shade(Stroke& stroke) const
return 0;
}
-ColorVariationPatternShader::ColorVariationPatternShader(const string pattern_name, bool stretch) : StrokeShader()
-{
- _stretch = stretch;
- ImBuf *image = NULL;
- vector<string> pathnames;
- StringUtils::getPathName(TextureManager::Options::getPatternsPath(), pattern_name, pathnames);
- for (vector<string>::const_iterator j = pathnames.begin(); j != pathnames.end(); ++j) {
- ifstream ifs(j->c_str());
- if (ifs.is_open()) {
- /* OCIO_TODO: support different input color space */
- image = IMB_loadiffname(j->c_str(), 0, NULL); //soc
- break;
- }
- }
- if (image == NULL)
- cerr << "Error: cannot find pattern \"" << pattern_name << "\" - check the path in the Options" << endl;
- else
- convert(image, &_aVariation, _size);
- IMB_freeImBuf(image);
-}
-
-int ColorVariationPatternShader::shade(Stroke& stroke) const
-{
- StrokeInternal::StrokeVertexIterator v, vend;
- unsigned index;
- for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
- const float *originalColor = v->attribute().getColor();
- if (_stretch) {
- float tmp = v->u() * (_size - 1);
- index = (unsigned)floor(tmp);
- if ((tmp - index) > (index + 1 - tmp))
- ++index;
- }
- else {
- index = (unsigned)floor(v->curvilinearAbscissa());
- }
- index %= _size;
- float r = _aVariation[index] * originalColor[0];
- float g = _aVariation[index] * originalColor[1];
- float b = _aVariation[index] * originalColor[2];
- v->attribute().setColor(r, g, b);
- }
- return 0;
-}
-
int MaterialColorShader::shade(Stroke& stroke) const
{
Interface0DIterator v, vend;
@@ -389,29 +245,6 @@ int MaterialColorShader::shade(Stroke& stroke) const
return 0;
}
-
-int CalligraphicColorShader::shade(Stroke& stroke) const
-{
- Interface0DIterator v;
- Functions0D::VertexOrientation2DF0D fun;
- StrokeVertex *sv;
- for (v = stroke.verticesBegin(); !v.isEnd(); ++v) {
- if (fun(v) < 0)
- return -1;
- Vec2f vertexOri(fun.result);
- Vec2d ori2d(-vertexOri[1], vertexOri[0]);
- ori2d.normalizeSafe();
- real scal = ori2d * _orientation;
- sv = dynamic_cast<StrokeVertex*>(&(*v));
- if ((scal < 0))
- sv->attribute().setColor(0, 0, 0);
- else
- sv->attribute().setColor(1, 1, 1);
- }
- return 0;
-}
-
-
ColorNoiseShader::ColorNoiseShader() : StrokeShader()
{
_amplitude = 1.0f;
@@ -439,11 +272,9 @@ int ColorNoiseShader::shade(Stroke& stroke) const
float b = bruit * _amplitude + originalColor[2];
v->attribute().setColor(r, g, b);
}
-
return 0;
}
-
//
// Texture Shaders
//
@@ -466,19 +297,6 @@ int StrokeTextureStepShader::shade(Stroke& stroke) const
return 0;
}
-// Legacy shaders from freestyle standalone texture system
-int TextureAssignerShader::shade(Stroke& stroke) const
-{
- cout << "TextureAssignerShader is not supported in blender, please use the BlenderTextureShader" << endl;
- return 0;
-}
-
-int StrokeTextureShader::shade(Stroke& stroke) const
-{
- cout << "StrokeTextureShader is not supported in blender, please use the BlenderTextureShader" << endl;
- return 0;
-}
-
//
// Geometry Shaders
//
@@ -541,119 +359,6 @@ int ExternalContourStretcherShader::shade(Stroke& stroke) const
return 0;
}
-int BSplineShader::shade(Stroke& stroke) const
-{
- if (stroke.strokeVerticesSize() < 4)
- return 0;
-
- // Find the new vertices
- vector<Vec2d> newVertices;
- double t = 0.0;
- float _sampling = 5.0f;
-
- StrokeInternal::StrokeVertexIterator p0, p1, p2, p3, end;
- p0 = stroke.strokeVerticesBegin();
- p1 = p0;
- p2 = p1;
- p3 = p2;
- end = stroke.strokeVerticesEnd();
- double a[4], b[4];
- int n = 0;
- while (p1 != end) {
-#if 0
- if (p1 == end)
- p1 = p0;
-#endif
- if (p2 == end)
- p2 = p1;
- if (p3 == end)
- p3 = p2;
- // compute new matrix
- a[0] = (-(p0)->x() + 3 * (p1)->x() - 3 * (p2)->x() + (p3)->x()) / 6.0;
- a[1] = (3 * (p0)->x() - 6 * (p1)->x() + 3 * (p2)->x()) / 6.0;
- a[2] = (-3 * (p0)->x() + 3 * (p2)->x()) / 6.0;
- a[3] = ((p0)->x() + 4 * (p1)->x() + (p2)->x()) / 6.0;
-
- b[0] = (-(p0)->y() + 3 * (p1)->y() - 3 * (p2)->y() + (p3)->y()) / 6.0;
- b[1] = (3 * (p0)->y() - 6 * (p1)->y() + 3 * (p2)->y()) / 6.0;
- b[2] = (-3 * (p0)->y() + 3 * (p2)->y()) / 6.0;
- b[3] = ((p0)->y() + 4 * (p1)->y() + (p2)->y()) / 6.0;
-
- // draw the spline depending on resolution:
- Vec2d p1p2((p2)->x() - (p1)->x(), (p2)->y() - (p1)->y());
- double norm = p1p2.norm();
- //t = _sampling / norm;
- t = 0;
- while (t < 1) {
- newVertices.push_back(Vec2d((a[3] + t * (a[2] + t * (a[1] + t * a[0]))),
- (b[3] + t * (b[2] + t * (b[1] + t * b[0])))));
- t = t + _sampling / norm;
- }
- if (n > 2) {
- ++p0;
- ++p1;
- ++p2;
- ++p3;
- }
- else {
- if (n == 0)
- ++p3;
- if (n == 1) {
- ++p2;
- ++p3;
- }
- if (n == 2) {
- ++p1;
- ++p2;
- ++p3;
- }
- ++n;
- }
- }
- //last point:
- newVertices.push_back(Vec2d((p0)->x(), (p0)->y()));
-
- int originalSize = newVertices.size();
- _sampling = stroke.ComputeSampling(originalSize);
-
- // Resample and set x,y coordinates
- stroke.Resample(_sampling);
- int newsize = stroke.strokeVerticesSize();
-
- int nExtraVertex = 0;
- if (newsize < originalSize) {
- cerr << "Warning: unsufficient resampling" << endl;
- }
- else {
- nExtraVertex = newsize - originalSize;
- }
-
- // assigns the new coordinates:
- vector<Vec2d>::iterator p = newVertices.begin(), pend = newVertices.end();
- vector<Vec2d>::iterator last = p;
- n = 0;
- StrokeInternal::StrokeVertexIterator it, itend;
- for (it = stroke.strokeVerticesBegin(), itend = stroke.strokeVerticesEnd();
- (it != itend) && (p != pend);
- ++it, ++p, ++n)
- {
- it->setX(p->x());
- it->setY(p->y());
- last = p;
- }
-
- // nExtraVertex should stay unassigned
- for (int i = 0; i < nExtraVertex; ++i, ++it, ++n) {
- it->setX(last->x());
- it->setY(last->y());
- if (it.isEnd()) {
- // XXX Shouldn't we break in this case???
- cerr << "Warning: Problem encountered while creating B-spline" << endl;
- }
- }
- stroke.UpdateLength();
- return 0;
-}
//!! Bezier curve stroke shader
int BezierCurveShader::shade(Stroke& stroke) const
@@ -673,15 +378,6 @@ int BezierCurveShader::shade(Stroke& stroke) const
previous = v;
}
-#if 0
- Vec2d tmp;
- bool equal = false;
- if (data.front() == data.back()) {
- tmp = data.back();
- data.pop_back();
- equal = true;
- }
-#endif
// here we build the bezier curve
BezierCurve bcurve(data, _error);
@@ -702,25 +398,6 @@ int BezierCurveShader::shade(Stroke& stroke) const
}
}
-#if 0
- if (equal) {
- if (data.back() == data.front()) {
- vector<Vec2d>::iterator d = data.begin(), dend;
- if (G.debug & G_DEBUG_FREESTYLE) {
- cout << "ending point = starting point" << endl;
- cout << "---------------DATA----------" << endl;
- for (dend = data.end(); d != dend; ++d) {
- cout << d->x() << "-" << d->y() << endl;
- }
- cout << "--------------BEZIER RESULT----------" << endl;
- for (d = CurveVertices.begin(), dend = CurveVertices.end(); d != dend; ++d) {
- cout << d->x() << "-" << d->y() << endl;
- }
- }
- }
- }
-#endif
-
// Resample the Stroke depending on the number of vertices of the bezier curve:
int originalSize = CurveVertices.size();
#if 0
@@ -734,11 +411,6 @@ int BezierCurveShader::shade(Stroke& stroke) const
cerr << "Warning: unsufficient resampling" << endl;
}
else {
-#if 0
- if (G.debug & G_DEBUG_FREESTYLE) {
- cout << "Oversampling" << endl;
- }
-#endif
nExtraVertex = newsize - originalSize;
if (nExtraVertex != 0) {
if (G.debug & G_DEBUG_FREESTYLE) {
@@ -752,22 +424,12 @@ int BezierCurveShader::shade(Stroke& stroke) const
vector<Vec2d>::iterator last = p;
int n;
StrokeInternal::StrokeVertexIterator it, itend;
-#if 0
- for (; p != pend; ++n, ++p);
-#endif
for (n = 0, it = stroke.strokeVerticesBegin(), itend = stroke.strokeVerticesEnd(), pend = CurveVertices.end();
(it != itend) && (p != pend);
++it, ++p, ++n)
{
it->setX(p->x());
it->setY(p->y());
-#if 0
- double x = p->x();
- double y = p->y();
- if (G.debug & G_DEBUG_FREESTYLE) {
- cout << "x = " << x << "-" << "y = " << y << endl;
- }
-#endif
last = p;
}
stroke.UpdateLength();
@@ -816,46 +478,6 @@ int BezierCurveShader::shade(Stroke& stroke) const
return 0;
}
-int InflateShader::shade(Stroke& stroke) const
-{
- // we're computing the curvature variance of the stroke. (Combo 5)
- // If it's too high, forget about it
- Functions1D::Curvature2DAngleF1D fun;
- if (fun(stroke) < 0)
- return -1;
- if (fun.result > _curvatureThreshold)
- return 0;
-
- Functions0D::VertexOrientation2DF0D ori_fun;
- Functions0D::Curvature2DAngleF0D curv_fun;
- Functions1D::Normal2DF1D norm_fun;
- Interface0DIterator it;
- StrokeVertex *sv;
- for (it = stroke.verticesBegin(); !it.isEnd(); ++it) {
- if (ori_fun(it) < 0)
- return -1;
- Vec2f ntmp(ori_fun.result);
- Vec2f n(ntmp.y(), -ntmp.x());
- if (norm_fun(stroke) < 0)
- return -1;
- Vec2f strokeN(norm_fun.result);
- if (n * strokeN < 0) {
- n[0] = -n[0];
- n[1] = -n[1];
- }
- sv = dynamic_cast<StrokeVertex*>(&(*it));
- float u = sv->u();
- float t = 4.0f * (0.25f - (u - 0.5) * (u - 0.5));
- if (curv_fun(it) < 0)
- return -1;
- float curvature_coeff = (M_PI - curv_fun.result) / M_PI;
- Vec2d newPoint(sv->x() + curvature_coeff * t * _amount * n.x(),
- sv->y() + curvature_coeff * t * _amount * n.y());
- sv->setPoint(newPoint[0], newPoint[1]);
- }
- stroke.UpdateLength();
- return 0;
-}
class CurvePiece
{
@@ -1040,40 +662,16 @@ int TipRemoverShader::shade(Stroke& stroke) const
// assign old attributes to new stroke vertices:
vector<StrokeAttribute>::iterator a = oldAttributes.begin(), aend = oldAttributes.end();
-#if 0
- if (G.debug & G_DEBUG_FREESTYLE) {
- cout << "-----------------------------------------------" << endl;
- }
-#endif
for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd();
(v != vend) && (a != aend);
++v, ++a)
{
v->setAttribute(*a);
-#if 0
- if (G.debug & G_DEBUG_FREESTYLE) {
- cout << "thickness = " << (*a).getThickness()[0] << "-" << (*a).getThickness()[1] << endl;
- }
-#endif
}
// we're done!
return 0;
}
-int streamShader::shade(Stroke& stroke) const
-{
- if (G.debug & G_DEBUG_FREESTYLE) {
- cout << stroke << endl;
- }
- return 0;
-}
-
-int fstreamShader::shade(Stroke& stroke) const
-{
- _stream << stroke << endl;
- return 0;
-}
-
} // end of namespace StrokeShaders
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
index 6ac22c5b2d1..e3842f45eb0 100644
--- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
+++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
@@ -218,51 +218,6 @@ public:
virtual int shade(Stroke& stroke) const;
};
-/*! [ Thickness Shader ].
-* Applys a pattern (texture) to vary thickness.
-* The new thicknesses are the result of the multiplication
-* of the pattern and the original thickness
-*/
-class ThicknessVariationPatternShader : public StrokeShader
-{
-public:
- /*! Builds the shader.
- * \param pattern_name
- * The texture file name.
- * \param iMinThickness
- * The minimum thickness we don't want to exceed.
- * \param iMaxThickness
- * The maximum thickness we don't want to exceed.
- * \param stretch
- * Tells whether the pattern texture must be stretched or repeted to fit the stroke.
- */
- ThicknessVariationPatternShader(const string pattern_name, float iMinThickness = 1.0f, float iMaxThickness = 5.0f,
- bool stretch = true);
-
- /*! Destructor.*/
- virtual ~ThicknessVariationPatternShader()
- {
- if (0 != _aThickness) {
- delete[] _aThickness;
- _aThickness = 0;
- }
- }
-
- virtual string getName() const
- {
- return "ThicknessVariationPatternShader";
- }
-
- /*! The shading method. */
- virtual int shade(Stroke& stroke) const;
-
-private:
- float *_aThickness; // array of thickness values, in % of the max (i.e comprised between 0 and 1)
- unsigned _size;
- float _minThickness;
- float _maxThickness;
- bool _stretch;
-};
/*! [ Thickness Shader ].
* Adds some noise to the stroke thickness.
@@ -389,44 +344,6 @@ public:
virtual int shade(Stroke& stroke) const;
};
-/*! [ Color Shader ].
- * Applys a pattern to vary original color.
- * The new color is the result of the multiplication of the pattern and the original color
- */
-class ColorVariationPatternShader : public StrokeShader
-{
-public:
- /*! Builds the shader from the pattern texture file name.
- * \param pattern_name
- * The file name of the texture file to use as pattern
- * \param stretch
- * Tells whether the texture must be strecthed or repeted to fit the stroke.
- */
- ColorVariationPatternShader(const string pattern_name, bool stretch = true);
-
- /*! Destructor */
- virtual ~ColorVariationPatternShader()
- {
- if (0 != _aVariation) {
- delete[] _aVariation;
- _aVariation = 0;
- }
- }
-
- virtual string getName() const
- {
- return "ColorVariationPatternShader";
- }
-
- /*! The shading method. */
- virtual int shade(Stroke& stroke) const;
-
-private:
- float *_aVariation; // array of coef values, in % of the max (i.e comprised between 0 and 1)
- unsigned _size;
- bool _stretch;
-};
-
/* [ Color Shader ].
* Assigns a color to the stroke depending on the material of the shape to which ot belongs to. (Disney shader)
*/
@@ -449,28 +366,6 @@ public:
virtual int shade(Stroke& stroke) const;
};
-class CalligraphicColorShader : public StrokeShader
-{
-private:
- /* UNUSED */
- // int _textureId;
- Vec2d _orientation;
-
-public:
- CalligraphicColorShader(const Vec2d &iOrientation) : StrokeShader()
- {
- _orientation = iOrientation;
- _orientation.normalize();
- }
-
- virtual string getName() const
- {
- return "CalligraphicColorShader";
- }
-
- virtual int shade(Stroke& stroke) const;
-};
-
/*! [ Color Shader ].
* Shader to add noise to the stroke colors.
*/
@@ -501,105 +396,6 @@ public:
};
//
-// Texture Shaders
-//
-///////////////////////////////////////////////////////////////////////////////
-/*! [ Texture Shader ].
-* Assigns a texture to the stroke in order to simulate
-* its marks system. This shader takes as input an integer value
-* telling which texture and blending mode to use among a set of
-* predefined textures.
-* Here are the different presets:
-* 0) -> /brushes/charcoalAlpha.bmp, HUMID_MEDIUM
-* 1) -> /brushes/washbrushAlpha.bmp, HUMID_MEDIUM
-* 2) -> /brushes/oil.bmp, HUMID_MEDIUM
-* 3) -> /brushes/oilnoblend.bmp, HUMID_MEDIUM
-* 4) -> /brushes/charcoalAlpha.bmp, DRY_MEDIUM
-* 5) -> /brushes/washbrushAlpha.bmp, DRY_MEDIUM
-* 6) -> /brushes/opaqueDryBrushAlpha.bmp, OPAQUE_MEDIUM
-* 7) -> /brushes/opaqueBrushAlpha.bmp, Stroke::OPAQUE_MEDIUM
-* Any other value will lead to the following preset:
-* default) -> /brushes/smoothAlpha.bmp, OPAQUE_MEDIUM.
-*/
-class TextureAssignerShader : public StrokeShader // FIXME
-{
-private:
- int _textureId;
-
-public:
- /*! Builds the shader.
- * \param id
- * The number of the preset to use.
- */
- TextureAssignerShader(int id) : StrokeShader()
- {
- _textureId = id;
- }
-
- virtual string getName() const
- {
- return "TextureAssignerShader";
- }
-
- /*! The shading method */
- virtual int shade(Stroke& stroke) const;
-};
-
-/*! [ Texture Shader ].
-* Assigns a texture and a blending mode to the stroke
-* in order to simulate its marks system.
-*/
-class StrokeTextureShader : public StrokeShader
-{
-private:
- string _texturePath;
- Stroke::MediumType _mediumType;
- bool _tips; // 0 or 1
-
-public:
- /*! Builds the shader from the texture file name and the blending mode to use.
- * \param textureFile
- * The the texture file name.
- * \attention The textures must be placed in the $FREESTYLE_DIR/data/textures/brushes directory.
- * \param mediumType
- * The medium type and therefore, the blending mode that must be used for the rendering of this stroke.
- * \param iTips
- * Tells whether the texture includes tips or not.
- * If it is the case, the texture image must respect the following format:
- * \verbatim
- * __________
- * | |
- * | A |
- * |__________|
- * | | |
- * | B | C |
- * |_____|____|
- *
- * \endverbatim
- * - A : The stroke's corpus texture
- * - B : The stroke's left extremity texture
- * - C : The stroke's right extremity texture
- */
- StrokeTextureShader(const string textureFile, Stroke::MediumType mediumType = Stroke::OPAQUE_MEDIUM,
- bool iTips = false)
- : StrokeShader()
- {
- _texturePath = textureFile;
- _mediumType = mediumType;
- _tips = iTips;
- }
-
- virtual string getName() const
- {
- return "StrokeTextureShader";
- }
-
- /*! The shading method */
- virtual int shade(Stroke& stroke) const;
-};
-
-
-//
// Geometry Shaders
//
///////////////////////////////////////////////////////////////////////////////
@@ -678,20 +474,6 @@ public:
virtual int shade(Stroke& stroke) const;
};
-// B-Spline stroke shader
-class BSplineShader: public StrokeShader
-{
-public:
- BSplineShader() : StrokeShader() {}
-
- virtual string getName() const
- {
- return "BSplineShader";
- }
-
- virtual int shade(Stroke& stroke) const;
-};
-
// Bezier curve stroke shader
/*! [ Geometry Shader ].
@@ -724,37 +506,6 @@ public:
virtual int shade(Stroke& stroke) const;
};
-/* Shader to inflate the curves. It keeps the extreme points positions and moves the other ones along the 2D normal.
- * The displacement value is proportional to the 2d curvature at the considered point (the higher the curvature,
- * the smaller the displacement) and to a value specified by the user.
- */
-class InflateShader : public StrokeShader
-{
-private:
- float _amount;
- float _curvatureThreshold;
-
-public:
- /*! Builds an inflate shader
- * \param iAmount
- * A multiplicative coefficient that acts on the amount and direction of displacement
- * \param iThreshold
- * The curves having a 2d curvature > iThreshold at one of their points is not inflated
- */
- InflateShader(float iAmount, float iThreshold) : StrokeShader()
- {
- _amount = iAmount;
- _curvatureThreshold = iThreshold;
- }
-
- virtual string getName() const
- {
- return "InflateShader";
- }
-
- /*! The shading method */
- virtual int shade(Stroke& stroke) const;
-};
/*! [ Geometry Shader ].
* Shader to modify the Stroke geometry so that it looks more "polygonal".
@@ -846,59 +597,6 @@ protected:
real _tipLength;
};
-/*! [ output Shader ].
- * streams the Stroke
- */
-class streamShader : public StrokeShader
-{
-public:
- /*! Destructor. */
- virtual ~streamShader() {}
-
- /*! Returns the string "streamShader".*/
- virtual string getName() const
- {
- return "streamShader";
- }
-
- /*! The shading method. */
- virtual int shade(Stroke& stroke) const;
-};
-
-/*! [ output Shader ].
- * streams the Stroke in a file
- */
-class fstreamShader : public StrokeShader
-{
-protected:
- mutable ofstream _stream;
-
-public:
- /*! Builds the shader from the output file name */
- fstreamShader(const char *iFileName) : StrokeShader()
- {
- _stream.open(iFileName);
- if (!_stream.is_open()) {
- cerr << "couldn't open file " << iFileName << endl;
- }
- }
-
- /*! Destructor. */
- virtual ~fstreamShader()
- {
- _stream.close();
- }
-
- /*! Returns the string "fstreamShader".*/
- virtual string getName() const
- {
- return "fstreamShader";
- }
-
- /*! The shading method. */
- virtual int shade(Stroke& stroke) const;
-};
-
/*! [ Texture Shader ].
* Shader to assign texture to the Stroke material.
*/
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 13e46bc7de8..63eea9486ed 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -36,6 +36,7 @@ set(INC
../nodes
../nodes/intern
+ ../../../intern/glew-mx
../../../intern/guardedalloc
../../../intern/smoke/extern
)
@@ -49,6 +50,7 @@ set(SRC
intern/gpu_codegen.c
intern/gpu_draw.c
intern/gpu_extensions.c
+ intern/gpu_init_exit.c
intern/gpu_material.c
intern/gpu_simple_shader.c
intern/gpu_select.c
@@ -56,10 +58,13 @@ set(SRC
GPU_buffers.h
GPU_draw.h
GPU_extensions.h
+ GPU_glew.h
+ GPU_init_exit.h
GPU_material.h
GPU_simple_shader.h
GPU_select.h
intern/gpu_codegen.h
+ intern/gpu_extensions_private.h
)
data_to_c_simple(shaders/gpu_shader_material.glsl SRC)
@@ -79,7 +84,7 @@ if(WITH_MOD_SMOKE)
add_definitions(-DWITH_SMOKE)
endif()
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
if(WITH_IMAGE_DDS)
add_definitions(-DWITH_DDS)
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index 04c4119df6e..3daf8585539 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -55,8 +55,6 @@ typedef struct GPUShader GPUShader;
/* GPU extensions support */
void GPU_extensions_disable(void);
-void GPU_extensions_init(void); /* call this before running any of the functions below */
-void GPU_extensions_exit(void);
int GPU_print_error(const char *str);
int GPU_glsl_support(void);
diff --git a/source/blender/gpu/GPU_glew.h b/source/blender/gpu/GPU_glew.h
new file mode 100644
index 00000000000..94217863fd6
--- /dev/null
+++ b/source/blender/gpu/GPU_glew.h
@@ -0,0 +1,37 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Jason Wilkins.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file source/blender/gpu/GPU_glew.h
+ * \ingroup gpu
+ */
+
+#ifndef __GPU_GLEW_H__
+#define __GPU_GLEW_H__
+
+#include "glew-mx.h"
+
+#endif /* __GPU_GLEW_H__ */
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h b/source/blender/gpu/GPU_init_exit.h
index 047ff4b58b5..e89c970b7d9 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h
+++ b/source/blender/gpu/GPU_init_exit.h
@@ -15,39 +15,32 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Jason Wilkins.
+ *
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h
- * \ingroup freestyle
+/** \file blender/gpu/GPU_init_exit.h
+ * \ingroup gpu
*/
-#ifndef __FREESTYLE_PYTHON_STREAMSHADER_H__
-#define __FREESTYLE_PYTHON_STREAMSHADER_H__
-
-#include "../BPy_StrokeShader.h"
+#ifndef __GPU_INIT_EXIT_H__
+#define __GPU_INIT_EXIT_H__
#ifdef __cplusplus
extern "C" {
#endif
-///////////////////////////////////////////////////////////////////////////////////////////
-
-extern PyTypeObject streamShader_Type;
-
-#define BPy_streamShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&streamShader_Type))
-
-/*---------------------------Python BPy_streamShader structure definition----------*/
-typedef struct {
- BPy_StrokeShader py_ss;
-} BPy_streamShader;
-
-
-///////////////////////////////////////////////////////////////////////////////////////////
+void GPU_init(void);
+void GPU_exit(void);
#ifdef __cplusplus
}
#endif
-
-#endif /* __FREESTYLE_PYTHON_STREAMSHADER_H__ */
+#endif /* __GPU_INIT_EXIT_H__ */
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index 8d44ad87916..a111401343e 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -34,6 +34,8 @@
#include "DNA_listBase.h"
+#include "BLI_sys_types.h" /* for bool */
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/source/blender/gpu/SConscript b/source/blender/gpu/SConscript
index e9320f08eff..f11ecafc986 100644
--- a/source/blender/gpu/SConscript
+++ b/source/blender/gpu/SConscript
@@ -30,13 +30,14 @@ Import ('env')
sources = env.Glob('intern/*.c')
sources += env.Glob('shaders/*.c')
-defs = [ 'GLEW_STATIC' ]
+defs = env['BF_GL_DEFINITIONS']
incs = [
'.',
+ '#/intern/glew-mx',
'#/intern/guardedalloc',
+ env['BF_GLEW_INC'],
'#/intern/smoke/extern',
- '#/extern/glew/include',
'../blenkernel',
'../blenlib',
'../bmesh',
@@ -46,7 +47,6 @@ incs = [
'../makesrna',
'../nodes',
'../nodes/intern',
- env['BF_OPENGL_INC'],
]
if env['WITH_BF_GAMEENGINE']:
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 5d2c9cd3a90..b5a576b509c 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -36,7 +36,7 @@
#include <stddef.h>
#include <string.h>
-#include "GL/glew.h"
+#include "GPU_glew.h"
#include "MEM_guardedalloc.h"
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 6b46db89a93..322d37055db 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -31,7 +31,7 @@
* Convert material node-trees to GLSL.
*/
-#include "GL/glew.h"
+#include "GPU_glew.h"
#include "MEM_guardedalloc.h"
@@ -242,12 +242,12 @@ GPUFunction *GPU_lookup_function(const char *name)
return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name);
}
-void GPU_codegen_init(void)
+void gpu_codegen_init(void)
{
GPU_code_generate_glsl_lib();
}
-void GPU_codegen_exit(void)
+void gpu_codegen_exit(void)
{
extern Material defmaterial; // render module abuse...
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index b6db923e5c2..69213925931 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -35,7 +35,7 @@
#include "DNA_listBase.h"
#include "GPU_material.h"
-#include "GL/glew.h"
+#include "GPU_glew.h"
struct ListBase;
struct GPUShader;
@@ -106,7 +106,7 @@ struct GPUNodeLink {
int type;
int users;
- GPUTexture *dynamictex;
+ struct GPUTexture *dynamictex;
GPUBuiltin builtin;
GPUOpenGLBuiltin oglbuiltin;
@@ -146,7 +146,7 @@ typedef struct GPUInput {
float *dynamicvec; /* vector data in case it is dynamic */
int dynamictype; /* origin of the dynamic uniform (GPUDynamicType) */
void *dynamicdata; /* data source of the dynamic uniform */
- GPUTexture *tex; /* input texture, only set at runtime */
+ struct GPUTexture *tex; /* input texture, only set at runtime */
int shaderloc; /* id from opengl */
char shadername[32]; /* name in shader */
@@ -185,8 +185,8 @@ void GPU_pass_unbind(GPUPass *pass);
void GPU_pass_free(GPUPass *pass);
-void GPU_codegen_init(void);
-void GPU_codegen_exit(void);
+void gpu_codegen_init(void);
+void gpu_codegen_exit(void);
/* Material calls */
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 7295f0259c5..622e7b5ce9e 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -38,7 +38,7 @@
#include <string.h>
-#include "GL/glew.h"
+#include "GPU_glew.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
@@ -1878,6 +1878,37 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][
return count;
}
+static void gpu_multisample(bool enable)
+{
+ if (GLEW_VERSION_1_3 || GLEW_ARB_multisample) {
+#ifdef __linux__
+ /* changing multisample from the default (enabled) causes problems on some
+ * systems (NVIDIA/Linux) when the pixel format doesn't have a multisample buffer */
+ bool toggle_ok = true;
+
+ if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_UNIX, GPU_DRIVER_ANY)) {
+ int samples = 0;
+ glGetIntegerv(GL_SAMPLES, &samples);
+
+ if (samples == 0)
+ toggle_ok = false;
+ }
+
+ if (toggle_ok) {
+ if (enable)
+ glEnable(GL_MULTISAMPLE);
+ else
+ glDisable(GL_MULTISAMPLE);
+ }
+#else
+ if (enable)
+ glEnable(GL_MULTISAMPLE);
+ else
+ glDisable(GL_MULTISAMPLE);
+#endif
+ }
+}
+
/* Default OpenGL State */
void GPU_state_init(void)
@@ -1950,9 +1981,7 @@ void GPU_state_init(void)
glCullFace(GL_BACK);
glDisable(GL_CULL_FACE);
- /* calling this makes drawing very slow when AA is not set up in ghost
- * on Linux/NVIDIA. */
- // glDisable(GL_MULTISAMPLE);
+ gpu_multisample(false);
}
#ifdef DEBUG
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 7fabb2feb51..04f8e68431a 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -33,7 +33,7 @@
*/
-#include "GL/glew.h"
+#include "GPU_glew.h"
#include "DNA_image_types.h"
@@ -48,7 +48,9 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_simple_shader.h"
-#include "gpu_codegen.h"
+
+#include "intern/gpu_codegen.h"
+#include "intern/gpu_extensions_private.h"
#include <stdlib.h>
#include <stdio.h>
@@ -110,8 +112,6 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
/* GPU Extensions */
-static int gpu_extensions_init = 0;
-
void GPU_extensions_disable(void)
{
GG.extdisabled = 1;
@@ -122,18 +122,11 @@ int GPU_max_texture_size(void)
return GG.maxtexsize;
}
-void GPU_extensions_init(void)
+void gpu_extensions_init(void)
{
GLint r, g, b;
const char *vendor, *renderer;
- /* can't avoid calling this multiple times, see wm_window_add_ghostwindow */
- if (gpu_extensions_init) return;
- gpu_extensions_init= 1;
-
- glewInit();
- GPU_codegen_init();
-
/* glewIsSupported("GL_VERSION_2_0") */
if (GLEW_ARB_multitexture)
@@ -233,10 +226,8 @@ void GPU_extensions_init(void)
GPU_simple_shaders_init();
}
-void GPU_extensions_exit(void)
+void gpu_extensions_exit(void)
{
- gpu_extensions_init = 0;
- GPU_codegen_exit();
GPU_simple_shaders_exit();
GPU_invalid_tex_free();
}
diff --git a/source/blender/gpu/intern/gpu_extensions_private.h b/source/blender/gpu/intern/gpu_extensions_private.h
new file mode 100644
index 00000000000..a4124b8fa3d
--- /dev/null
+++ b/source/blender/gpu/intern/gpu_extensions_private.h
@@ -0,0 +1,32 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file gpu_extensions_private.h
+ * \ingroup gpu
+ */
+
+#ifndef __GPU_EXTENSIONS_PRIVATE_H__
+#define __GPU_EXTENSIONS_PRIVATE_H__
+
+/* call this before running any of the functions below */
+void gpu_extensions_init(void);
+void gpu_extensions_exit(void);
+
+#endif /* __GPU_EXTENSIONS_PRIVATE_H__ */
diff --git a/source/blender/gpu/intern/gpu_init_exit.c b/source/blender/gpu/intern/gpu_init_exit.c
new file mode 100644
index 00000000000..912774cd345
--- /dev/null
+++ b/source/blender/gpu/intern/gpu_init_exit.c
@@ -0,0 +1,68 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Jason Wilkins
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file source/blender/gpu/intern/gpu_init_exit.c
+ * \ingroup gpu
+ */
+
+#include "BLI_sys_types.h"
+#include "GPU_init_exit.h" /* interface */
+#include "GPU_extensions.h" /* library */
+
+#include "intern/gpu_codegen.h"
+#include "intern/gpu_extensions_private.h"
+
+/**
+ * although the order of initialization and shutdown should not matter
+ * (except for the extensions), I chose alphabetical and reverse alphabetical order
+ */
+
+static bool initialized = false;
+
+void GPU_init(void)
+{
+ /* can't avoid calling this multiple times, see wm_window_add_ghostwindow */
+ if (initialized)
+ return;
+
+ initialized = true;
+
+ gpu_extensions_init(); /* must come first */
+
+ gpu_codegen_init();
+}
+
+
+
+void GPU_exit(void)
+{
+ gpu_codegen_exit();
+
+ gpu_extensions_exit(); /* must come last */
+
+ initialized = false;
+}
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 81dcd9cf450..f91fd7a8c1e 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -35,8 +35,6 @@
#include <math.h>
#include <string.h>
-#include "GL/glew.h"
-
#include "MEM_guardedalloc.h"
#include "DNA_lamp_types.h"
@@ -739,8 +737,9 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
i = is;
GPU_link(mat, "shade_visifac", i, visifac, shi->refl, &i);
- GPU_link(mat, "set_value", GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &lcol);
+ GPU_link(mat, "set_rgb", GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &lcol);
shade_light_textures(mat, lamp, &lcol);
+ GPU_link(mat, "shade_mul_value_v3", GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob), lcol, &lcol);
#if 0
if (ma->mode & MA_TANGENT_VN)
@@ -1716,9 +1715,9 @@ void GPU_lamp_update_colors(GPULamp *lamp, float r, float g, float b, float ener
lamp->energy = energy;
if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
- lamp->col[0]= r* lamp->energy;
- lamp->col[1]= g* lamp->energy;
- lamp->col[2]= b* lamp->energy;
+ lamp->col[0]= r;
+ lamp->col[1]= g;
+ lamp->col[2]= b;
}
void GPU_lamp_update_distance(GPULamp *lamp, float distance, float att1, float att2)
@@ -1750,9 +1749,9 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
lamp->energy = la->energy;
if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
- lamp->col[0]= la->r*lamp->energy;
- lamp->col[1]= la->g*lamp->energy;
- lamp->col[2]= la->b*lamp->energy;
+ lamp->col[0]= la->r;
+ lamp->col[1]= la->g;
+ lamp->col[2]= la->b;
GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), ob->obmat);
@@ -2015,6 +2014,7 @@ GPUNodeLink *GPU_lamp_get_data(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **co
*col = GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob);
visifac = lamp_get_visibility(mat, lamp, lv, dist);
+ /* looks like it's not used? psy-fi */
shade_light_textures(mat, lamp, col);
if (GPU_lamp_has_shadow_buffer(lamp)) {
diff --git a/source/blender/gpu/intern/gpu_select.c b/source/blender/gpu/intern/gpu_select.c
index 1d448231dda..afd6af9efae 100644
--- a/source/blender/gpu/intern/gpu_select.c
+++ b/source/blender/gpu/intern/gpu_select.c
@@ -31,15 +31,14 @@
*/
#include "GPU_select.h"
#include "GPU_extensions.h"
-
+#include "GPU_glew.h"
+
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h"
-#include <GL/glew.h>
-
/* Ad hoc number of queries to allocate to skip doing many glGenQueries */
#define ALLOC_QUERIES 200
diff --git a/source/blender/gpu/intern/gpu_simple_shader.c b/source/blender/gpu/intern/gpu_simple_shader.c
index 0cb712d220f..c0d7ebd4abb 100644
--- a/source/blender/gpu/intern/gpu_simple_shader.c
+++ b/source/blender/gpu/intern/gpu_simple_shader.c
@@ -42,7 +42,7 @@
* - Optimize for case where no texture matrix is used.
*/
-#include "GL/glew.h"
+#include "GPU_glew.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 3ba36c11311..23716c8105d 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -1960,6 +1960,11 @@ void shade_mul_value(float fac, vec4 col, out vec4 outcol)
outcol = col*fac;
}
+void shade_mul_value_v3(float fac, vec3 col, out vec3 outcol)
+{
+ outcol = col*fac;
+}
+
void shade_obcolor(vec4 col, vec4 obcol, out vec4 outcol)
{
outcol = vec4(col.rgb*obcol.rgb, col.a);
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index b66772f0bb9..fcb894c9ebf 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -64,6 +64,10 @@ typedef struct ImageUser {
} ImageUser;
+typedef struct RenderSlot {
+ char name[64]; /* 64 = MAX_NAME */
+} RenderSlot;
+
/* iuser->flag */
#define IMA_ANIM_ALWAYS 1
#define IMA_ANIM_REFRESHED 2
@@ -119,6 +123,7 @@ typedef struct Image {
char alpha_mode;
char pad[7];
+ RenderSlot render_slots[8]; /* 8 = IMA_MAX_RENDER_SLOT */
} Image;
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index 17bbfb1cc84..4e7a564e9d4 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -38,7 +38,8 @@ incs = [
'#/intern/guardedalloc',
'#/intern/atomic',
'#/intern/memutil',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/audaspace/intern',
'#/intern/cycles/blender',
'#/intern/smoke/extern',
@@ -57,7 +58,7 @@ incs = [
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_SMOKE']:
defs.append('WITH_SMOKE')
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index c5f62439b9e..5d736f9c011 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -293,13 +293,14 @@ blender_include_dirs(
../../../../intern/audaspace/intern
../../../../intern/cycles/blender
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
../../../../intern/atomic
../../../../intern/memutil
../../../../intern/smoke/extern
)
blender_include_dirs_sys(
- ${GLEW_INCLUDE_PATH}
+ "${GLEW_INCLUDE_PATH}"
)
add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC})
@@ -328,4 +329,6 @@ set(SRC
rna_mesh_utils.h
)
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index 9fda79feb74..d1eab5ca9db 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -53,11 +53,12 @@ makesrna_tool = env.Clone()
rna = env.Clone()
makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ')
-defs = []
+defs = env['BF_GL_DEFINITIONS']
incs = [
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/audaspace/intern',
'#/intern/cycles/blender',
'#/intern/smoke/extern',
@@ -66,6 +67,7 @@ incs = [
'../../blenlib',
'../../bmesh',
'../../editors/include',
+ '../../gpu',
'../../ikplugin',
'../../imbuf',
'../../makesdna',
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 90c9cd108cd..141de511a09 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -399,6 +399,43 @@ static int rna_Image_is_float_get(PointerRNA *ptr)
return is_float;
}
+static void rna_Image_render_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Image *image = (Image *)ptr->id.data;
+ rna_iterator_array_begin(iter, (void *)image->render_slots, sizeof(RenderSlot), IMA_MAX_RENDER_SLOT, 0, NULL);
+}
+
+static PointerRNA rna_render_slots_active_get(PointerRNA *ptr)
+{
+ Image *image = (Image *)ptr->id.data;
+ RenderSlot *render_slot = &image->render_slots[image->render_slot];
+
+ return rna_pointer_inherit_refine(ptr, &RNA_RenderSlot, render_slot);
+}
+
+static void rna_render_slots_active_set(PointerRNA *ptr, PointerRNA value)
+{
+ Image *image = (Image *)ptr->id.data;
+ if (value.id.data == image) {
+ RenderSlot *render_slot = (RenderSlot *)value.data;
+ int index = render_slot - image->render_slots;
+ image->render_slot = CLAMPIS(index, 0, IMA_MAX_RENDER_SLOT - 1);
+ }
+}
+
+static int rna_render_slots_active_index_get(PointerRNA *ptr)
+{
+ Image *image = (Image *)ptr->id.data;
+ return image->render_slot;
+}
+
+static void rna_render_slots_active_index_set(PointerRNA *ptr, int value)
+{
+ Image *image = (Image *)ptr->id.data;
+ image->render_slot = value;
+ CLAMP(image->render_slot, 0, IMA_MAX_RENDER_SLOT - 1);
+}
+
#else
static void rna_def_imageuser(BlenderRNA *brna)
@@ -467,6 +504,45 @@ static void rna_def_imageuser(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pass", "Pass in multilayer image");
}
+static void rna_def_render_slot(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+ srna = RNA_def_struct(brna, "RenderSlot", NULL);
+ RNA_def_struct_ui_text(srna, "Render Slot", "Parameters defining the render slot");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Name", "Render slot name");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+}
+
+static void rna_def_render_slots(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "RenderSlots", NULL);
+ RNA_def_struct_sdna(srna, "RenderSlot");
+ RNA_def_struct_ui_text(srna, "Render Slots", "Collection of the render slots");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RenderSlot");
+ RNA_def_property_pointer_funcs(prop, "rna_render_slots_active_get", "rna_render_slots_active_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active", "Active render slot of the image");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_funcs(prop, "rna_render_slots_active_index_get",
+ "rna_render_slots_active_index_set",
+ NULL);
+ RNA_def_property_range(prop, 0, IMA_MAX_RENDER_SLOT);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Active Index", "Index of an active render slot of the image");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+}
+
static void rna_def_image(BlenderRNA *brna)
{
StructRNA *srna;
@@ -668,10 +744,12 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode");
RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
- prop = RNA_def_property(srna, "render_slot", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_range(prop, 0, IMA_MAX_RENDER_SLOT - 1);
- RNA_def_property_ui_text(prop, "Render Slot", "The current render slot displayed, only for viewer type images");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+ prop = RNA_def_property(srna, "render_slots", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RenderSlot");
+ RNA_def_property_ui_text(prop, "Render Slots", "Render slots of the image");
+ RNA_def_property_collection_funcs(prop, "rna_Image_render_slots_begin", "rna_iterator_array_next",
+ "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_srna(prop, "RenderSlots");
/*
* Image.has_data and Image.depth are temporary,
@@ -737,6 +815,8 @@ static void rna_def_image(BlenderRNA *brna)
void RNA_def_image(BlenderRNA *brna)
{
+ rna_def_render_slot(brna);
+ rna_def_render_slots(brna);
rna_def_image(brna);
rna_def_imageuser(brna);
}
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index b1f997a5f80..0ee654d4ecc 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -587,6 +587,10 @@ static void rna_def_render_engine(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ prop = RNA_def_property(srna, "bl_use_texture_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_TEXTURE_PREVIEW);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
prop = RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 7fdc9ba1e79..b4968333d3f 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -4388,7 +4388,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_auto_save_temporary_files", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSAVE);
RNA_def_property_ui_text(prop, "Auto Save Temporary Files",
- "Automatic saving of temporary files in temp directory, uses process ID");
+ "Automatic saving of temporary files in temp directory, uses process ID (Sculpt or edit mode data won't be saved!')");
RNA_def_property_update(prop, 0, "rna_userdef_autosave_update");
prop = RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE);
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 71c84fd1e8a..06e9f8f5b67 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -40,7 +40,6 @@ set(INC
set(INC_SYS
${ZLIB_INCLUDE_DIRS}
- ${GLEW_INCLUDE_PATH}
)
set(SRC
diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript
index c112f525398..c15a562abc0 100644
--- a/source/blender/modifiers/SConscript
+++ b/source/blender/modifiers/SConscript
@@ -34,7 +34,6 @@ incs = [
'./intern',
'#/intern/guardedalloc',
'#/intern/elbeem/extern',
- '#/extern/glew/include',
'#/intern/opennl/extern',
'../render/extern/include',
'../bmesh',
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 2293415aef0..9eb6c1674a3 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -38,6 +38,7 @@ set(INC
../makesrna
../render/extern/include
../../../intern/guardedalloc
+ ../../../intern/glew-mx
)
set(INC_SYS
@@ -279,6 +280,8 @@ if(WITH_COMPOSITOR)
add_definitions(-DWITH_COMPOSITOR)
endif()
+add_definitions(${GL_DEFINITIONS})
+
if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript
index becf6e79d44..aed846355c3 100644
--- a/source/blender/nodes/SConscript
+++ b/source/blender/nodes/SConscript
@@ -39,7 +39,8 @@ incs = [
'./shader',
'./texture',
'#/intern/guardedalloc',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../blenfont',
'../blenkernel',
'../blenlib',
@@ -48,12 +49,11 @@ incs = [
'../makesdna',
'../makesrna',
'../render/extern/include',
- env['BF_OPENGL_INC'],
env['BF_ZLIB_INC'],
]
incs = ' '.join(incs)
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
index a5b52a3dd63..9988e0981aa 100644
--- a/source/blender/python/SConscript
+++ b/source/blender/python/SConscript
@@ -33,7 +33,8 @@ incs = [
'.',
'#/intern/guardedalloc',
'#/intern/memutil',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#/intern/audaspace/intern',
'#/intern/cycles/blender',
'../blenfont',
@@ -62,7 +63,7 @@ sources = env.Glob('bmesh/*.c')
env.BlenderLib( libname = 'bf_python_bmesh', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165])
# generic
-defs = ['GLEW_STATIC']
+defs = env['BF_GL_DEFINITIONS']
if is_debug:
defs.append('_DEBUG')
@@ -79,7 +80,7 @@ env.BlenderLib( libname = 'bf_python_mathutils', sources = Split(sources), inclu
# bpy
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if is_debug:
defs.append('_DEBUG')
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index aec2faa89e6..155247a4249 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -22,8 +22,10 @@ set(INC
.
../../blenkernel
../../blenlib
+ ../../gpu
../../makesdna
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
)
set(INC_SYS
@@ -46,6 +48,6 @@ set(SRC
py_capi_utils.h
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_python_ext "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index b8dcf9d8491..c599ce26f6c 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -33,7 +33,7 @@
#include <Python.h>
#include "bgl.h" /*This must come first */
-#include <GL/glew.h>
+#include "GPU_glew.h"
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index 70b4df7d6fe..a75db23d20b 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -260,5 +260,6 @@ if(WITH_PLAYER)
add_definitions(-DWITH_PLAYER)
endif()
+add_definitions(${GL_DEFINITIONS})
blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index b4add0fc615..0f0ffe9fec5 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -149,6 +149,11 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject *
/* calculate t, ray intersects triangle */
t = dot_v3v3(e2, qvec) * inv_det;
+ /* ray hit behind */
+ if (t < 0.0f) {
+ Py_RETURN_NONE;
+ }
+
mul_v3_fl(dir, t);
add_v3_v3v3(pvec, orig, dir);
diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h
index 24f8cbee401..4b0473f7483 100644
--- a/source/blender/render/extern/include/RE_engine.h
+++ b/source/blender/render/extern/include/RE_engine.h
@@ -60,6 +60,7 @@ struct BakePixel;
#define RE_USE_SHADING_NODES 16
#define RE_USE_EXCLUDE_LAYERS 32
#define RE_USE_SAVE_BUFFERS 64
+#define RE_USE_TEXTURE_PREVIEW 128
/* RenderEngine.flag */
#define RE_ENGINE_ANIMATION 1
diff --git a/source/blender/render/extern/include/RE_render_ext.h b/source/blender/render/extern/include/RE_render_ext.h
index eb861d440d8..6d083ec785d 100644
--- a/source/blender/render/extern/include/RE_render_ext.h
+++ b/source/blender/render/extern/include/RE_render_ext.h
@@ -61,5 +61,7 @@ void RE_free_sample_material(struct Material *mat);
void RE_sample_material_color(struct Material *mat, float color[3], float *alpha, const float volume_co[3], const float surface_co[3],
int face_index, short hit_quad, struct DerivedMesh *orcoDm, struct Object *ob);
+void RE_init_texture_rng(void);
+void RE_exit_texture_rng(void);
#endif /* __RE_RENDER_EXT_H__ */
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 12701099e18..2787ce99b13 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -791,14 +791,6 @@ static void area_sample(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata
texr->ta = texr->talpha ? texr->ta*xsd : (clip ? cw*xsd : 1.f);
}
-/* test if a float value is 'nan'
- * there is a C99 function for this: isnan(), but blender seems to use C90 (according to gcc warns),
- * and may not be supported by other compilers either */
-/* TODO(sergey): Consider using isnan(), it's used in the other areas. */
-#ifndef ISNAN
-# define ISNAN(x) ((x) != (x))
-#endif
-
typedef struct ReadEWAData {
ImBuf *ibuf;
afdata_t *AFD;
@@ -1212,7 +1204,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
if (tex->texfilter == TXF_FELINE) AFD.iProbes = 1;
}
else {
- const int lev = ISNAN(levf) ? 0 : (int)levf;
+ const int lev = isnan(levf) ? 0 : (int)levf;
curibuf = mipmaps[lev];
previbuf = mipmaps[lev + 1];
levf -= floorf(levf);
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index ae01779e814..d9d1acf4efe 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -85,8 +85,19 @@
extern struct Render R;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+static RNG_THREAD_ARRAY *random_tex_array;
+void RE_init_texture_rng(void)
+{
+ random_tex_array = BLI_rng_threaded_new();
+}
+
+void RE_exit_texture_rng(void)
+{
+ BLI_rng_threaded_free(random_tex_array);
+}
+
static void init_render_texture(Render *re, Tex *tex)
{
@@ -709,19 +720,22 @@ static float voronoiTex(Tex *tex, const float texvec[3], TexResult *texres)
/* ------------------------------------------------------------------------- */
-static int texnoise(Tex *tex, TexResult *texres)
+static int texnoise(Tex *tex, TexResult *texres, int thread)
{
float div=3.0;
- int val, ran, loop;
+ int val, ran, loop, shift = 30;
- ran= BLI_rand();
- val= (ran & 3);
+ ran= BLI_rng_thread_rand(random_tex_array, thread);
loop= tex->noisedepth;
+
+ /* start from top bits since they have more variance */
+ val= ((ran >> shift) & 3);
+
while (loop--) {
- ran= (ran>>2);
- val*= (ran & 3);
- div*= 3.0f;
+ shift -= 2;
+ val += ((ran >> shift) & 3);
+ div += 3.0f;
}
texres->tin= ((float)val)/div;
@@ -1127,7 +1141,7 @@ static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int o
retval = stucci(tex, texvec, texres);
break;
case TEX_NOISE:
- retval = texnoise(tex, texres);
+ retval = texnoise(tex, texres, thread);
break;
case TEX_IMAGE:
if (osatex) retval = imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres, pool);
@@ -3396,8 +3410,11 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
col[0]= texres.tr*la->energy;
col[1]= texres.tg*la->energy;
col[2]= texres.tb*la->energy;
-
- texture_rgb_blend(col_r, col, col_r, texres.tin, mtex->colfac, mtex->blendtype);
+
+ if (effect & LA_SHAD_TEX)
+ texture_rgb_blend(col_r, col, col_r, texres.tin, mtex->shadowfac, mtex->blendtype);
+ else
+ texture_rgb_blend(col_r, col, col_r, texres.tin, mtex->colfac, mtex->blendtype);
}
}
}
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 5f993297840..088bddc8a76 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -40,12 +40,12 @@ set(INC
../../gameengine/BlenderRoutines
../../../intern/ghost
../../../intern/guardedalloc
+ ../../../intern/glew-mx
../../../intern/memutil
)
set(INC_SYS
${ZLIB_INCLUDE_DIRS}
- ${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_PATH}
)
@@ -78,7 +78,7 @@ set(SRC
wm_window.h
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
@@ -107,6 +107,8 @@ endif()
if(WITH_HEADLESS)
add_definitions(-DWITH_HEADLESS)
+elseif(WITH_X11)
+ add_definitions(-DWITH_X11)
endif()
if(WITH_PYTHON)
diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript
index 00d363e1539..b93192d5067 100644
--- a/source/blender/windowmanager/SConscript
+++ b/source/blender/windowmanager/SConscript
@@ -36,7 +36,8 @@ incs = [
'#/intern/guardedalloc',
'#/intern/memutil',
'#/source/gameengine/BlenderRoutines',
- '#/extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'../blenfont',
'../blenkernel',
'../blenlib',
@@ -54,7 +55,7 @@ incs = [
]
incs = ' '.join(incs)
-defs = [ 'GLEW_STATIC' ]
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_PYTHON']:
defs.append('WITH_PYTHON')
@@ -78,4 +79,7 @@ if env['WITH_BF_COMPOSITOR']:
if env['WITH_BF_PYTHON_SECURITY']:
defs.append("WITH_PYTHON_SECURITY")
+if env['OURPLATFORM'] in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'aix4', 'aix5'):
+ defs.append("WITH_X11")
+
env.BlenderLib ( 'bf_windowmanager', sources, Split(incs), defines=defs, libtype=['core'], priority=[5] )
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 2f20e8c234f..7440570f4a0 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -32,7 +32,6 @@
#include <stdlib.h>
#include <string.h>
-#include <GL/glew.h>
#include "DNA_listBase.h"
#include "DNA_screen_types.h"
@@ -57,6 +56,7 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "GPU_glew.h"
#include "RE_engine.h"
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index b1f693502f6..139e0101859 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -54,6 +54,8 @@
#include "BLI_threads.h"
#include "BLI_utildefines.h"
+#include "BLO_writefile.h"
+
#include "BKE_blender.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -110,6 +112,7 @@
#include "GPU_buffers.h"
#include "GPU_extensions.h"
#include "GPU_draw.h"
+#include "GPU_init_exit.h"
#include "BKE_depsgraph.h"
#include "BKE_sound.h"
@@ -195,7 +198,8 @@ void WM_init(bContext *C, int argc, const char **argv)
wm_init_reports(C); /* reports cant be initialized before the wm */
if (!G.background) {
- GPU_extensions_init();
+ GPU_init();
+
GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP));
GPU_set_anisotropic(U.anisotropic_filter);
GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
@@ -407,11 +411,18 @@ void WM_exit_ext(bContext *C, const bool do_python)
if ((U.uiflag2 & USER_KEEP_SESSION) || BKE_undo_valid(NULL)) {
/* save the undo state as quit.blend */
char filename[FILE_MAX];
-
+ bool has_edited;
+ int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN | G_FILE_HISTORY);
+
BLI_make_file_string("/", filename, BLI_temp_dir_base(), BLENDER_QUIT_FILE);
- if (BKE_undo_save_file(filename))
+ has_edited = ED_editors_flush_edits(C, false);
+
+ if ((has_edited && BLO_write_file(CTX_data_main(C), filename, fileflags, NULL, NULL)) ||
+ BKE_undo_save_file(filename))
+ {
printf("Saved session recovery to '%s'\n", filename);
+ }
}
}
@@ -502,7 +513,8 @@ void WM_exit_ext(bContext *C, const bool do_python)
if (!G.background) {
GPU_global_buffer_pool_free();
GPU_free_unused_buffers();
- GPU_extensions_exit();
+
+ GPU_exit();
}
BKE_reset_undo();
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 1abe000a86c..ff90de4b3c6 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -590,9 +590,8 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
/* add item */
if (kmdi->add_item) {
/* Do not re-add an already existing keymap item! See T42088. */
+ /* We seek only for exact copy here! See T42137. */
kmi_add = wm_keymap_find_item_equals(km, kmdi->add_item);
- if (!kmi_add)
- kmi_add = wm_keymap_find_item_equals_result(km, kmdi->add_item);
/* only if nothing to remove or item to remove found */
if (!kmi_add && (!kmdi->remove_item || kmi_remove)) {
kmi_add = wm_keymap_item_copy(kmdi->add_item);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index b9a79a85455..016446e0a63 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -4740,6 +4740,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_assign(keymap, "VIEW3D_OT_render_border");
WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_border");
WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom_border"); /* XXX TODO: zoom border should perhaps map rightmouse to zoom out instead of in+cancel */
+ WM_modalkeymap_assign(keymap, "IMAGE_OT_render_border");
}
/* zoom to border modal operators */
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index ec806fb7c61..46a20d3bf88 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -55,7 +55,6 @@
#include "BKE_global.h"
#include "BKE_main.h"
-#include "BIF_gl.h"
#include "RNA_access.h"
@@ -74,6 +73,8 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "GPU_init_exit.h"
+#include "GPU_glew.h"
#include "UI_interface.h"
@@ -319,8 +320,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
/* nothing to do for 'temp' windows,
* because WM_window_open_temp always sets window title */
}
- else {
-
+ else if (win->ghostwin) {
/* this is set to 1 if you don't have startup.blend open */
if (G.save_over && G.main->name[0]) {
char str[sizeof(G.main->name) + 24];
@@ -353,7 +353,7 @@ float wm_window_pixelsize(wmWindow *win)
}
/* belongs to below */
-static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
+static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wmWindow *win)
{
GHOST_WindowHandle ghostwin;
static int multisamples = -1;
@@ -377,8 +377,11 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
if (ghostwin) {
GHOST_RectangleHandle bounds;
+ /* the new window has already been made drawable upon creation */
+ wm->windrawable = win;
+
/* needed so we can detect the graphics card below */
- GPU_extensions_init();
+ GPU_init();
win->ghostwin = ghostwin;
GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
@@ -444,8 +447,7 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
wm_init_state.start_x = 0;
wm_init_state.start_y = 0;
-
-#if !defined(__APPLE__) && !defined(WIN32) /* X11 */
+#ifdef WITH_X11 /* X11 */
/* X11, start maximized but use default sane size */
wm_init_state.size_x = min_ii(wm_init_state.size_x, WM_WIN_INIT_SIZE_X);
wm_init_state.size_y = min_ii(wm_init_state.size_y, WM_WIN_INIT_SIZE_Y);
@@ -474,7 +476,7 @@ void wm_window_add_ghostwindows(wmWindowManager *wm)
wm_init_state.override_flag &= ~WIN_OVERRIDE_WINSTATE;
}
- wm_window_add_ghostwindow("Blender", win);
+ wm_window_add_ghostwindow(wm, "Blender", win);
}
/* happens after fileread */
if (win->eventstate == NULL)
@@ -1426,9 +1428,9 @@ void wm_window_set_swap_interval (wmWindow *win, int interval)
GHOST_SetSwapInterval(win->ghostwin, interval);
}
-int wm_window_get_swap_interval (wmWindow *win)
+bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut)
{
- return GHOST_GetSwapInterval(win->ghostwin);
+ return GHOST_GetSwapInterval(win->ghostwin, intervalOut);
}
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index bf96e020a48..9c9c79d2f54 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -58,8 +58,8 @@ void wm_window_lower (wmWindow *win);
void wm_window_set_size (wmWindow *win, int width, int height);
void wm_window_get_position (wmWindow *win, int *posx_r, int *posy_r);
void wm_window_swap_buffers (wmWindow *win);
-void wm_window_set_swap_interval (wmWindow *win, int interval);
-int wm_window_get_swap_interval (wmWindow *win);
+void wm_window_set_swap_interval(wmWindow *win, int interval);
+bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut);
float wm_window_pixelsize(wmWindow *win);
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index 188fb01d23d..c48578c791b 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -151,6 +151,7 @@ endif()
bf_intern_raskter
bf_intern_opencolorio
bf_intern_opennl
+ bf_intern_glew_mx
extern_rangetree
extern_wcwidth
extern_libmv
@@ -162,7 +163,7 @@ endif()
endif()
if(NOT WITH_SYSTEM_GLEW)
- list(APPEND BLENDER_SORTED_LIBS extern_glew)
+ list(APPEND BLENDER_SORTED_LIBS ${BLENDER_GLEW_LIBRARIES})
endif()
if(WITH_LZMA)
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 649ea1f59c7..0846e37178d 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -221,6 +221,8 @@ void *g_system;
float *RE_RenderLayerGetPass(struct RenderLayer *rl, int passtype) RET_NULL
float RE_filter_value(int type, float x) RET_ZERO
struct RenderLayer *RE_GetRenderLayer(struct RenderResult *rr, const char *name) RET_NULL
+void RE_init_texture_rng() RET_NONE
+void RE_exit_texture_rng() RET_NONE
/* zbuf.c stub */
void antialias_tagbuf(int xsize, int ysize, char *rectmove) RET_NONE
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 35cbff33342..73400da4845 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -27,6 +27,7 @@ setup_libdirs()
blender_include_dirs(
../../intern/guardedalloc
+ ../../intern/glew-mx
../blender/blenlib
../blender/blenkernel
../blender/blenloader
@@ -39,6 +40,9 @@ blender_include_dirs(
../blender/windowmanager
)
+add_definitions(${GL_DEFINITIONS})
+blender_include_dirs("${GLEW_INCLUDE_PATH}")
+
if(WIN32)
blender_include_dirs(../../intern/utfconv)
endif()
@@ -676,6 +680,18 @@ elseif(WIN32)
unset(_PYTHON_VERSION_NO_DOTS)
endif()
+ # EGL Runtime Components
+ if(WITH_GL_EGL)
+ if(WIN32)
+ install(FILES "${OPENGLES_DLL}" DESTINATION ${TARGETDIR})
+ install(FILES "${OPENGLES_EGL_DLL}" DESTINATION ${TARGETDIR})
+
+ if(WITH_GL_ANGLE)
+ install(FILES "${D3DCOMPILER_DLL}" DESTINATION ${TARGETDIR})
+ endif()
+ endif()
+ endif()
+
if(MSVC)
install(
FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 458afb2d131..d779095c1ee 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -107,6 +107,7 @@
#include "RE_engine.h"
#include "RE_pipeline.h"
+#include "RE_render_ext.h"
#include "ED_datafiles.h"
#include "ED_util.h"
@@ -1609,21 +1610,6 @@ int main(
#endif
setCallbacks();
-#if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE)
- /* patch to ignore argument finder gives us (pid?) */
- if (argc == 2 && strncmp(argv[1], "-psn_", 5) == 0) {
- extern int GHOST_HACK_getFirstFile(char buf[]);
- static char firstfilebuf[512];
-
- argc = 1;
-
- if (GHOST_HACK_getFirstFile(firstfilebuf)) {
- argc = 2;
- argv[1] = firstfilebuf;
- }
- }
-
-#endif
#ifdef __FreeBSD__
fpsetmask(0);
@@ -1642,6 +1628,8 @@ int main(
DAG_init();
BKE_brush_system_init();
+ RE_init_texture_rng();
+
BLI_callback_global_init();
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index c652532895f..2a7e631637e 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -40,7 +40,7 @@
# pragma warning (disable:4786)
#endif
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "KX_BlenderCanvas.h"
#include "KX_BlenderKeyboardDevice.h"
@@ -299,7 +299,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE);
// Setup vsync
- int previous_vsync = canvas->GetSwapInterval();
+ int previous_vsync = 0;
+ canvas->GetSwapInterval(previous_vsync);
if (startscene->gm.vsync == VSYNC_ADAPTIVE)
canvas->SetSwapInterval(-1);
else
diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt
index 73dbe005518..1a2809cc8ab 100644
--- a/source/gameengine/BlenderRoutines/CMakeLists.txt
+++ b/source/gameengine/BlenderRoutines/CMakeLists.txt
@@ -24,6 +24,7 @@ set(INC
../../blender/makesrna
../../blender/windowmanager
../../../intern/container
+ ../../../intern/glew-mx
../../../intern/guardedalloc
../../../intern/string
)
@@ -52,7 +53,7 @@ set(SRC
KX_BlenderSystem.h
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
if(WITH_AUDASPACE)
list(APPEND INC
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
index b3e0b4c3ea6..31f3b1b2047 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
@@ -29,7 +29,7 @@
* \ingroup blroutines
*/
-#include <GL/glew.h>
+#include "glew-mx.h"
#include "MEM_guardedalloc.h"
@@ -91,9 +91,9 @@ void KX_BlenderCanvas::SetSwapInterval(int interval)
wm_window_set_swap_interval(m_win, interval);
}
-int KX_BlenderCanvas::GetSwapInterval()
+bool KX_BlenderCanvas::GetSwapInterval(int &intervalOut)
{
- return wm_window_get_swap_interval(m_win);
+ return wm_window_get_swap_interval(m_win, &intervalOut);
}
void KX_BlenderCanvas::ResizeWindow(int width, int height)
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
index 9ad80cb1737..917e0136cb1 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
@@ -82,8 +82,9 @@ public:
int interval
);
- int
+ bool
GetSwapInterval(
+ int &intervalOut
);
void
diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript
index 62d657189c5..def0bc32697 100644
--- a/source/gameengine/BlenderRoutines/SConscript
+++ b/source/gameengine/BlenderRoutines/SConscript
@@ -29,9 +29,7 @@ Import ('env')
sources = env.Glob('*.cpp')
-defs = [
- 'GLEW_STATIC',
- ]
+defs = env['BF_GL_DEFINITIONS']
incs = [
'.',
@@ -39,7 +37,8 @@ incs = [
'#intern/guardedalloc',
'#intern/string',
'#source/blender',
- '#extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#intern/audaspace/intern',
'#intern/ghost/include',
'#intern/moto/include',
diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt
index fd73b4efb53..e6c980de566 100644
--- a/source/gameengine/GamePlayer/common/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/common/CMakeLists.txt
@@ -47,6 +47,7 @@ set(INC
../../../blender/makesdna
../../../../intern/container
../../../../intern/ghost
+ ../../../../intern/glew-mx
../../../../intern/guardedalloc
../../../../intern/string
)
@@ -69,6 +70,6 @@ set(SRC
GPC_MouseDevice.h
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
blender_add_lib_nolist(ge_player_common "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h
index bd50066a212..338f9647b3e 100644
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.h
+++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h
@@ -40,7 +40,7 @@
# include <windows.h>
#endif /* WIN32 */
-#include "GL/glew.h"
+#include "glew-mx.h"
#include <map>
diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript
index e30c2eb5859..b8fb9cbd2e2 100644
--- a/source/gameengine/GamePlayer/common/SConscript
+++ b/source/gameengine/GamePlayer/common/SConscript
@@ -64,12 +64,11 @@ incs = [
'#source/blender/misc',
'#source/blender/blenloader',
'#source/blender/gpu',
- '#extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
]
-defs = [
- 'GLEW_STATIC',
- ]
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_PYTHON']:
incs.extend(Split(env['BF_PYTHON_INC']))
diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt
index df752799c2c..8ab090eac02 100644
--- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt
+++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt
@@ -48,6 +48,7 @@ set(INC
../../../blender/makesrna
../../../../intern/container
../../../../intern/ghost
+ ../../../../intern/glew-mx
../../../../intern/guardedalloc
../../../../intern/string
../../../../intern/memutil
@@ -73,7 +74,7 @@ set(SRC
GPG_System.h
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
if(WITH_CODEC_FFMPEG)
add_definitions(-DWITH_FFMPEG)
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index b85d4b40ca8..d7a63c28da3 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -36,8 +36,9 @@
# include <windows.h>
#endif
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "GPU_extensions.h"
+#include "GPU_init_exit.h"
#include "GPG_Application.h"
#include "BL_BlenderDataConversion.h"
@@ -545,7 +546,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
{
if (!m_engineInitialized)
{
- GPU_extensions_init();
+ GPU_init();
bgl::InitExtensions(true);
// get and set the preferences
@@ -867,7 +868,7 @@ void GPG_Application::exitEngine()
m_canvas = 0;
}
- GPU_extensions_exit();
+ GPU_exit();
#ifdef WITH_PYTHON
// Call this after we're sure nothing needs Python anymore (e.g., destructors)
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
index 35c7c62a67d..556f85804ea 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
@@ -113,12 +113,12 @@ void GPG_Canvas::SetSwapInterval(int interval)
m_window->setSwapInterval(interval);
}
-int GPG_Canvas::GetSwapInterval()
+bool GPG_Canvas::GetSwapInterval(int& intervalOut)
{
if (m_window)
- return m_window->getSwapInterval();
+ return (bool)m_window->getSwapInterval(intervalOut);
- return 0;
+ return false;
}
void GPG_Canvas::ResizeWindow(int width, int height)
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
index 6e1f86cac0e..337c2cedf55 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
@@ -56,7 +56,7 @@ public:
virtual void SetMouseState(RAS_MouseState mousestate);
virtual void SwapBuffers();
virtual void SetSwapInterval(int interval);
- virtual int GetSwapInterval();
+ virtual bool GetSwapInterval(int& intervalOut);
virtual int GetMouseX(int x) { return x; }
virtual int GetMouseY(int y) { return y; }
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index b6456b105c8..3bb5f17841d 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -79,8 +79,6 @@ extern "C"
#include "IMB_imbuf.h"
#include "IMB_moviecache.h"
- int GHOST_HACK_getFirstFile(char buf[]);
-
// For BLF
#include "BLF_api.h"
#include "BLF_translation.h"
@@ -294,12 +292,6 @@ static void get_filename(int argc, char **argv, char *filename)
if (BLI_exists(argv[argc-1])) {
BLI_strncpy(filename, argv[argc-1], FILE_MAX);
}
- if (::strncmp(argv[argc-1], "-psn_", 5)==0) {
- static char firstfilebuf[512];
- if (GHOST_HACK_getFirstFile(firstfilebuf)) {
- BLI_strncpy(filename, firstfilebuf, FILE_MAX);
- }
- }
}
srclen -= ::strlen("MacOS/blenderplayer");
@@ -811,14 +803,6 @@ int main(int argc, char** argv)
if (scr_saver_mode != SCREEN_SAVER_MODE_CONFIGURATION)
#endif
{
-
- if (SYS_GetCommandLineInt(syshandle, "nomipmap", 0)) {
- GPU_set_mipmap(0);
- }
-
- GPU_set_anisotropic(U.anisotropic_filter);
- GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
-
// Create the system
if (GHOST_ISystem::createSystem() == GHOST_kSuccess) {
GHOST_ISystem* system = GHOST_ISystem::getSystem();
@@ -1041,6 +1025,13 @@ int main(int argc, char** argv)
else
app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight,
stereoWindow, stereomode, aasamples);
+
+ if (SYS_GetCommandLineInt(syshandle, "nomipmap", 0)) {
+ GPU_set_mipmap(0);
+ }
+
+ GPU_set_anisotropic(U.anisotropic_filter);
+ GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
}
}
}
diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript
index 3e8ab3d0dd7..d4c31889a5e 100644
--- a/source/gameengine/GamePlayer/ghost/SConscript
+++ b/source/gameengine/GamePlayer/ghost/SConscript
@@ -68,15 +68,14 @@ incs = [
'#source/blender/misc',
'#source/blender/blenloader',
'#source/blender/gpu',
- '#extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
]
incs.append(env['BF_PTHREADS_INC'])
incs.append(env['BF_BOOST_INC'])
-defs = [
- 'GLEW_STATIC',
- ]
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_PYTHON']:
incs += Split(env['BF_PYTHON_INC'])
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index 872ac19351d..a59c3686a18 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -22,7 +22,7 @@
* \ingroup ketsji
*/
-#include "GL/glew.h"
+#include "glew-mx.h"
#include <iostream>
#include "BL_Shader.h"
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp
index 1578c745b9f..1a78efb3c18 100644
--- a/source/gameengine/Ketsji/BL_Texture.cpp
+++ b/source/gameengine/Ketsji/BL_Texture.cpp
@@ -22,7 +22,7 @@
* \ingroup ketsji
*/
-#include "GL/glew.h"
+#include "glew-mx.h"
#include <iostream>
#include <map>
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index 03d1524b310..44532e5d737 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -49,6 +49,7 @@ set(INC
../../blender/python/generic
../../blender/python/mathutils
../../../intern/container
+ ../../../intern/glew-mx
../../../intern/guardedalloc
../../../intern/string
)
@@ -229,7 +230,7 @@ set(SRC
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
if(WITH_IMAGE_DDS)
add_definitions(-DWITH_DDS)
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 9ebdfea6156..9f0b582045f 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -22,7 +22,7 @@
* \ingroup ketsji
*/
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "KX_BlenderMaterial.h"
#include "BL_Material.h"
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 4ab768e4240..e0761154ed2 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -31,7 +31,7 @@
*/
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "KX_Camera.h"
#include "KX_Scene.h"
#include "KX_PythonInit.h"
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp
index c7f7f586865..a77269c116d 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -41,7 +41,7 @@
#include "RAS_CameraData.h"
#include "BLI_math.h"
-#include "GL/glew.h"
+#include "glew-mx.h"
// constructor
KX_Dome::KX_Dome (
diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h
index a7e798a3944..420565e62f6 100644
--- a/source/gameengine/Ketsji/KX_Dome.h
+++ b/source/gameengine/Ketsji/KX_Dome.h
@@ -38,7 +38,7 @@
#include "RAS_IRasterizer.h"
#include "KX_KetsjiEngine.h"
-#include "GL/glew.h"
+#include "glew-mx.h"
#include <vector>
#include "MEM_guardedalloc.h"
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index c681e0842c4..dc246406a88 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1587,9 +1587,10 @@ CListValue* KX_GameObject::GetChildrenRecursive()
KX_Scene* KX_GameObject::GetScene()
{
SG_Node* node = this->GetSGNode();
- KX_Scene* scene = static_cast<KX_Scene*>(node->GetSGClientInfo());
-
- return scene;
+ if (node == NULL)
+ // this happens for object in non active layers, rely on static scene then
+ return KX_GetActiveScene();
+ return static_cast<KX_Scene*>(node->GetSGClientInfo());
}
/* ---------------------------------------------------------------------
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index da8a0c0844e..fefc64b4bad 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -30,7 +30,7 @@
* \ingroup ketsji
*/
-#include "GL/glew.h"
+#include "glew-mx.h"
#ifdef _MSC_VER
# pragma warning (disable:4786)
@@ -1396,7 +1396,9 @@ static PyObject *gPySetVsync(PyObject *, PyObject *args)
static PyObject *gPyGetVsync(PyObject *)
{
- return PyLong_FromLong(gp_Canvas->GetSwapInterval());
+ int interval = 0;
+ gp_Canvas->GetSwapInterval(interval);
+ return PyLong_FromLong(interval);
}
static PyObject *gPyShowFramerate(PyObject *, PyObject *args)
diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript
index db5474cf2d7..8074a4064ff 100644
--- a/source/gameengine/Ketsji/SConscript
+++ b/source/gameengine/Ketsji/SConscript
@@ -30,7 +30,7 @@ import sys
Import ('env')
sources = env.Glob('*.cpp')
-defs = [ 'GLEW_STATIC' ]
+defs = env['BF_GL_DEFINITIONS']
incs = [
'.',
@@ -38,7 +38,8 @@ incs = [
'#intern/guardedalloc',
'#intern/string',
'#source/blender',
- '#extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#intern/audaspace/FX',
'#intern/audaspace/intern',
'#intern/moto/include',
diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt
index fbaa7bb59ba..e52dc1ba052 100644
--- a/source/gameengine/Physics/Bullet/CMakeLists.txt
+++ b/source/gameengine/Physics/Bullet/CMakeLists.txt
@@ -40,6 +40,7 @@ set(INC
../../../blender/makesdna
../../../../intern/container
../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
../../../../intern/string
)
@@ -66,4 +67,6 @@ if(WITH_BULLET)
add_definitions(-DWITH_BULLET)
endif()
+add_definitions(${GL_DEFINITIONS})
+
blender_add_lib(ge_phys_bullet "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript
index 2a8249b9558..30287553a10 100644
--- a/source/gameengine/Physics/Bullet/SConscript
+++ b/source/gameengine/Physics/Bullet/SConscript
@@ -34,7 +34,8 @@ incs = [
'#intern/container',
'#intern/guardedalloc',
'#intern/string',
- '#extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#intern/moto/include',
'#source/blender/blenkernel',
'#source/blender/blenlib',
@@ -51,7 +52,7 @@ incs = ' '.join(incs)
incs += ' ' + env['BF_BULLET_INC']
-defs = []
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_PYTHON']:
incs += ' ' + env['BF_PYTHON_INC']
diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt
index e254bf9b1c5..5bc3f22e327 100644
--- a/source/gameengine/Rasterizer/CMakeLists.txt
+++ b/source/gameengine/Rasterizer/CMakeLists.txt
@@ -32,6 +32,7 @@ set(INC
../../blender/blenlib
../../blender/blenkernel
../../../intern/container
+ ../../../intern/glew-mx
../../../intern/guardedalloc
../../../intern/string
)
@@ -81,6 +82,6 @@ set(SRC
RAS_OpenGLFilters/RAS_Sobel2DFilter.h
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
blender_add_lib(ge_rasterizer "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
index abbe65738d4..908c5979249 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
@@ -43,7 +43,7 @@
#include "RAS_2DFilterManager.h"
#include <iostream>
-#include "GL/glew.h"
+#include "glew-mx.h"
#include <stdio.h>
diff --git a/source/gameengine/Rasterizer/RAS_ICanvas.h b/source/gameengine/Rasterizer/RAS_ICanvas.h
index 9e8a6e8ccf6..d90cbea286e 100644
--- a/source/gameengine/Rasterizer/RAS_ICanvas.h
+++ b/source/gameengine/Rasterizer/RAS_ICanvas.h
@@ -113,8 +113,9 @@ public:
)=0;
virtual
- int
+ bool
GetSwapInterval(
+ int& intervalOut
)=0;
virtual
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
index f0410ba891d..888a7114f50 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
@@ -39,6 +39,7 @@ set(INC
../../../blender/gpu
../../../blender/makesdna
../../../../intern/container
+ ../../../../intern/glew-mx
../../../../intern/string
)
@@ -66,6 +67,6 @@ set(SRC
RAS_StorageVBO.h
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
blender_add_lib(ge_oglrasterizer "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
index 32cc4ba9fea..bc22d68e218 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
@@ -32,7 +32,7 @@
#include <iostream>
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "RAS_GLExtensionManager.h"
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
index e1dbd6f0a7f..b3da5e1f812 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
@@ -30,7 +30,7 @@
#include <windows.h>
#endif // WIN32
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "RAS_MaterialBucket.h"
#include "RAS_TexVert.h"
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
index e1b7a2151c5..4ac1c9c4ebb 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
@@ -25,9 +25,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include "glew-mx.h"
+
#include <stdio.h>
-#include "GL/glew.h"
#include "RAS_OpenGLLight.h"
#include "RAS_OpenGLRasterizer.h"
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index 0960fdaab4f..415ea87fb1b 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -35,7 +35,7 @@
#include "RAS_OpenGLRasterizer.h"
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "RAS_ICanvas.h"
#include "RAS_Rect.h"
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
index c8975c245cb..e0613350b77 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
@@ -29,7 +29,7 @@
#include "RAS_MaterialBucket.h"
#include "RAS_IPolygonMaterial.h"
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_material.h"
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
index 006c07b0491..c2980a6c15f 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
@@ -27,7 +27,7 @@
#include "RAS_StorageVA.h"
-#include "GL/glew.h"
+#include "glew-mx.h"
RAS_StorageVA::RAS_StorageVA(int *texco_num, RAS_IRasterizer::TexCoGen *texco, int *attrib_num, RAS_IRasterizer::TexCoGen *attrib, int *attrib_layer) :
m_drawingmode(RAS_IRasterizer::KX_TEXTURED),
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
index 6aa90fbd6ef..58f3d4c05da 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
@@ -28,7 +28,7 @@
#include "RAS_StorageVBO.h"
#include "RAS_MeshObject.h"
-#include "GL/glew.h"
+#include "glew-mx.h"
VBO::VBO(RAS_DisplayArray *data, unsigned int indices)
{
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
index 2fe0c32f399..f156722247c 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
@@ -29,7 +29,7 @@
#define __KX_VERTEXBUFFEROBJECTSTORAGE
#include <map>
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "RAS_IStorage.h"
#include "RAS_IRasterizer.h"
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
index 0a7417656c6..93905f733dc 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
@@ -3,14 +3,15 @@ Import ('env')
sources = env.Glob('*.cpp')
-defs = [ 'GLEW_STATIC' ]
+defs = env['BF_GL_DEFINITIONS']
incs = [
'.',
'#intern/container',
'#intern/guardedalloc',
'#intern/string',
- '#extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#intern/moto/include',
'#source/blender/blenkernel',
'#source/blender/blenfont',
diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript
index 5c68ce63a3b..c0d725ad957 100644
--- a/source/gameengine/Rasterizer/SConscript
+++ b/source/gameengine/Rasterizer/SConscript
@@ -36,15 +36,17 @@ incs = [
'#intern/moto/include',
'#intern/container',
'#source/gameengine/BlenderRoutines',
- '#extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#source/gameengine/Expressions',
'#source/gameengine/SceneGraph',
'#source/blender/blenlib',
'#source/blender/blenkernel',
+ '#source/blender/gpu',
'#source/blender/makesdna',
]
-defs = ['GLEW_STATIC']
+defs = env['BF_GL_DEFINITIONS']
if env['WITH_BF_PYTHON']:
incs.extend(Split(env['BF_PYTHON_INC']))
diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt
index 3ca3917cf6d..4be9a9abe5c 100644
--- a/source/gameengine/VideoTexture/CMakeLists.txt
+++ b/source/gameengine/VideoTexture/CMakeLists.txt
@@ -42,6 +42,7 @@ set(INC
../../blender/python/generic
../../../intern/container
../../../intern/ffmpeg
+ ../../../intern/glew-mx
../../../intern/guardedalloc
../../../intern/string
)
@@ -51,7 +52,7 @@ set(INC_SYS
${GLEW_INCLUDE_PATH}
)
-add_definitions(-DGLEW_STATIC)
+add_definitions(${GL_DEFINITIONS})
set(SRC
Exception.cpp
diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp
index 4109981a98c..0d46160a11e 100644
--- a/source/gameengine/VideoTexture/ImageBase.cpp
+++ b/source/gameengine/VideoTexture/ImageBase.cpp
@@ -32,7 +32,7 @@
extern "C" {
#include "bgl.h"
}
-#include "GL/glew.h"
+#include "glew-mx.h"
#include <vector>
#include <string.h>
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index 8c6dcf45d6f..617e7fd1d8e 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -36,7 +36,7 @@
#include <math.h>
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "KX_PythonInit.h"
#include "DNA_scene_types.h"
diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp
index 789b6006f99..421f0df814b 100644
--- a/source/gameengine/VideoTexture/ImageViewport.cpp
+++ b/source/gameengine/VideoTexture/ImageViewport.cpp
@@ -33,7 +33,7 @@
#include "PyObjectPlus.h"
#include <structmember.h>
-#include "GL/glew.h"
+#include "glew-mx.h"
#include "KX_PythonInit.h"
#include "RAS_ICanvas.h"
diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript
index f7bf6bd93c1..b1b02db3ebc 100644
--- a/source/gameengine/VideoTexture/SConscript
+++ b/source/gameengine/VideoTexture/SConscript
@@ -37,7 +37,8 @@ incs = [
'#intern/ffmpeg',
'#intern/guardedalloc',
'#intern/string',
- '#extern/glew/include',
+ env['BF_GLEW_INC'],
+ '#/intern/glew-mx',
'#intern/moto/include',
'#source/blender/blenkernel',
'#source/blender/blenlib',
@@ -57,7 +58,8 @@ incs = [
]
incs = ' '.join(incs)
-defs = ['GLEW_STATIC']
+defs = env['BF_GL_DEFINITIONS']
+
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw', 'win64-mingw'):
if env['BF_DEBUG']:
defs.append('_DEBUG')
diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp
index 35a73193a24..74f36207774 100644
--- a/source/gameengine/VideoTexture/Texture.cpp
+++ b/source/gameengine/VideoTexture/Texture.cpp
@@ -54,7 +54,7 @@
#include "Exception.h"
#include <memory.h>
-#include "GL/glew.h"
+#include "glew-mx.h"
// macro for exception handling and logging