[Bf-blender-cvs] [ca5fdd857b7] blender2.8: Merge branch 'master' into blender2.8

Campbell Barton noreply at git.blender.org
Thu Feb 15 15:16:18 CET 2018


Commit: ca5fdd857b7864b0336aca655f2c04d00090c0f9
Author: Campbell Barton
Date:   Fri Feb 16 01:17:43 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBca5fdd857b7864b0336aca655f2c04d00090c0f9

Merge branch 'master' into blender2.8

===================================================================



===================================================================

diff --cc source/blender/editors/object/object_bake.c
index 3c0c083dbd7,9837fec2b1e..a13df441c5f
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@@ -863,12 -829,12 +863,12 @@@ static int bake_image_exec(bContext *C
  			RE_test_break_cb(bkr.re, NULL, thread_break);
  			G.is_break = false;   /* BKE_blender_test_break uses this global */
  
 -			RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL);
 +			RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT(view_layer) : NULL);
  
  			/* baking itself is threaded, cannot use test_break in threads  */
- 			BLI_init_threads(&threads, do_bake_render, 1);
+ 			BLI_threadpool_init(&threads, do_bake_render, 1);
  			bkr.ready = 0;
- 			BLI_insert_thread(&threads, &bkr);
+ 			BLI_threadpool_insert(&threads, &bkr);
  
  			while (bkr.ready == 0) {
  				PIL_sleep_ms(50);
diff --cc source/blender/editors/render/render_internal.c
index d4fd62c6dac,58b4c0fe222..0130b93babf
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@@ -343,8 -327,8 +343,8 @@@ static int screen_render_exec(bContext 
  	if (is_animation)
  		RE_BlenderAnim(re, mainp, scene, camera_override, lay_override, scene->r.sfra, scene->r.efra, scene->r.frame_step);
  	else
 -		RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay_override, scene->r.cfra, is_write_still);
 +		RE_BlenderFrame(re, mainp, scene, view_layer, camera_override, lay_override, scene->r.cfra, is_write_still);
- 	BLI_end_threaded_malloc();
+ 	BLI_threaded_malloc_end();
  
  	RE_SetReports(re, NULL);
  
diff --cc source/blender/editors/space_image/image_draw.c
index cea0a3b4828,4d4beb07f00..43d5348da3e
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@@ -835,8 -924,25 +835,8 @@@ void draw_image_main(const bContext *C
  	if (show_paint)
  		draw_image_paint_helpers(C, ar, scene, zoomx, zoomy);
  
 -	/* XXX integrate this code */
 -#if 0
 -	if (ibuf) {
 -		float xoffs = 0.0f, yoffs = 0.0f;
 -		
 -		if (image_preview_active(sa, &xim, &yim)) {
 -			xoffs = scene->r.disprect.xmin;
 -			yoffs = scene->r.disprect.ymin;
 -			glColor3ub(0, 0, 0);
 -			calc_image_view(sima, 'f');
 -			myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
 -			glRectf(0.0f, 0.0f, 1.0f, 1.0f);
 -			glLoadIdentity();
 -		}
 -	}
 -#endif
 -
  	if (show_viewer) {
- 		BLI_unlock_thread(LOCK_DRAW_IMAGE);
+ 		BLI_thread_unlock(LOCK_DRAW_IMAGE);
  	}
  
  	/* render info */
diff --cc source/blender/editors/space_view3d/view3d_draw.c
index 3fdc938aec2,cdbb57c436a..a41b133a189
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@@ -68,1235 -87,1837 +68,1235 @@@
  #include "ED_keyframing.h"
  #include "ED_gpencil.h"
  #include "ED_screen.h"
 -#include "ED_space_api.h"
 -#include "ED_screen_types.h"
  #include "ED_transform.h"
  
 -#include "UI_interface.h"
 -#include "UI_interface_icons.h"
 -#include "UI_resources.h"
 +#include "DEG_depsgraph_query.h"
  
  #include "GPU_draw.h"
 -#include "GPU_framebuffer.h"
 +#include "GPU_matrix.h"
 +#include "GPU_immediate.h"
 +#include "GPU_immediate_util.h"
  #include "GPU_material.h"
 +#include "GPU_viewport.h"
  #include "GPU_compositing.h"
 -#include "GPU_extensions.h"
 -#include "GPU_select.h"
 -
 -#include "view3d_intern.h"  /* own include */
  
 -/* prototypes */
 -static bool view3d_stereo3d_active(wmWindow *win, Scene *scene, View3D *v3d, RegionView3D *rv3d);
 -static void view3d_stereo3d_setup(Scene *scene, View3D *v3d, ARegion *ar, const rcti *rect);
 -static void view3d_stereo3d_setup_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
 -                                            float winmat[4][4], const char *viewname);
 -
 -/* handy utility for drawing shapes in the viewport for arbitrary code.
 - * could add lines and points too */
 -// #define DEBUG_DRAW
 -#ifdef DEBUG_DRAW
 -static void bl_debug_draw(void);
 -/* add these locally when using these functions for testing */
 -extern void bl_debug_draw_quad_clear(void);
 -extern void bl_debug_draw_quad_add(const float v0[3], const float v1[3], const float v2[3], const float v3[3]);
 -extern void bl_debug_draw_edge_add(const float v0[3], const float v1[3]);
 -extern void bl_debug_color_set(const unsigned int col);
 -#endif
 +#include "MEM_guardedalloc.h"
  
 -void circf(float x, float y, float rad)
 -{
 -	GLUquadricObj *qobj = gluNewQuadric(); 
 -	
 -	gluQuadricDrawStyle(qobj, GLU_FILL); 
 -	
 -	glPushMatrix(); 
 -	
 -	glTranslatef(x, y, 0.0);
 -	
 -	gluDisk(qobj, 0.0,  rad, 32, 1);
 -	
 -	glPopMatrix(); 
 -	
 -	gluDeleteQuadric(qobj);
 -}
 +#include "UI_interface.h"
 +#include "UI_resources.h"
  
 -void circ(float x, float y, float rad)
 -{
 -	GLUquadricObj *qobj = gluNewQuadric(); 
 -	
 -	gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); 
 -	
 -	glPushMatrix(); 
 -	
 -	glTranslatef(x, y, 0.0);
 -	
 -	gluDisk(qobj, 0.0,  rad, 32, 1);
 -	
 -	glPopMatrix(); 
 -	
 -	gluDeleteQuadric(qobj);
 -}
 +#include "RE_engine.h"
  
 +#include "WM_api.h"
 +#include "WM_types.h"
  
 -/* ********* custom clipping *********** */
 +#include "RNA_access.h"
  
 -static void view3d_draw_clipping(RegionView3D *rv3d)
 -{
 -	BoundBox *bb = rv3d->clipbb;
 -
 -	if (bb) {
 -		const unsigned int clipping_index[6][4] = {
 -			{0, 1, 2, 3},
 -			{0, 4, 5, 1},
 -			{4, 7, 6, 5},
 -			{7, 3, 2, 6},
 -			{1, 5, 6, 2},
 -			{7, 4, 0, 3}
 -		};
 -
 -		/* fill in zero alpha for rendering & re-projection [#31530] */
 -		unsigned char col[4];
 -		UI_GetThemeColor4ubv(TH_V3D_CLIPPING_BORDER, col);
 -		glColor4ubv(col);
 -
 -		glEnable(GL_BLEND);
 -		glEnableClientState(GL_VERTEX_ARRAY);
 -		glVertexPointer(3, GL_FLOAT, 0, bb->vec);
 -		glDrawElements(GL_QUADS, sizeof(clipping_index) / sizeof(unsigned int), GL_UNSIGNED_INT, clipping_index);
 -		glDisableClientState(GL_VERTEX_ARRAY);
 -		glDisable(GL_BLEND);
 -	}
 -}
 +#include "IMB_imbuf.h"
 +#include "IMB_imbuf_types.h"
  
 -void ED_view3d_clipping_set(RegionView3D *rv3d)
 -{
 -	double plane[4];
 -	const unsigned int tot = (rv3d->viewlock & RV3D_BOXCLIP) ? 4 : 6;
 -	unsigned int a;
 -
 -	for (a = 0; a < tot; a++) {
 -		copy_v4db_v4fl(plane, rv3d->clip[a]);
 -		glClipPlane(GL_CLIP_PLANE0 + a, plane);
 -		glEnable(GL_CLIP_PLANE0 + a);
 -	}
 -}
 +#include "view3d_intern.h"  /* own include */
  
 -/* use these to temp disable/enable clipping when 'rv3d->rflag & RV3D_CLIPPING' is set */
 -void ED_view3d_clipping_disable(void)
 -{
 -	unsigned int a;
 +/* ******************** general functions ***************** */
  
 -	for (a = 0; a < 6; a++) {
 -		glDisable(GL_CLIP_PLANE0 + a);
 -	}
 -}
 -void ED_view3d_clipping_enable(void)
 +static bool use_depth_doit(View3D *v3d, Object *obedit)
  {
 -	unsigned int a;
 +	if (v3d->drawtype > OB_WIRE)
 +		return true;
  
 -	for (a = 0; a < 6; a++) {
 -		glEnable(GL_CLIP_PLANE0 + a);
 +	/* special case (depth for wire color) */
 +	if (v3d->drawtype <= OB_WIRE) {
 +		if (obedit && obedit->type == OB_MESH) {
 +			Mesh *me = obedit->data;
 +			if (me->drawflag & ME_DRAWEIGHT) {
 +				return true;
 +			}
 +		}
  	}
 +	return false;
  }
  
 -static bool view3d_clipping_test(const float co[3], const float clip[6][4])
 +/**
 + * \note keep this synced with #ED_view3d_mats_rv3d_backup/#ED_view3d_mats_rv3d_restore
 + */
 +void ED_view3d_update_viewmat(
 +        const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar,
 +        float viewmat[4][4], float winmat[4][4], const rcti *rect)
  {
 -	if (plane_point_side_v3(clip[0], co) > 0.0f)
 -		if (plane_point_side_v3(clip[1], co) > 0.0f)
 -			if (plane_point_side_v3(clip[2], co) > 0.0f)
 -				if (plane_point_side_v3(clip[3], co) > 0.0f)
 -					return false;
 +	const Depsgraph *depsgraph = eval_ctx->depsgraph;
 +	RegionView3D *rv3d = ar->regiondata;
  
 -	return true;
 -}
 +	/* setup window matrices */
 +	if (winmat)
 +		copy_m4_m4(rv3d->winmat, winmat);
 +	else
 +		view3d_winmatrix_set(depsgraph, ar, v3d, rect);
  
 -/* for 'local' ED_view3d_clipping_local must run first
 - * then all comparisons can be done in localspace */
 -bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const bool is_local)
 -{
 -	return view3d_clipping_test(co, is_local ? rv3d->clip_local : rv3d->clip);
 -}
 +	/* setup view matrix */
 +	if (viewmat) {
 +		copy_m4_m4(rv3d->viewmat, viewmat);
 +	}
 +	else {
 +		float rect_scale[2];
 +		if (rect) {
 +			rect_scale[0] = (float)BLI_rcti_size_x(rect) / (float)ar->winx;
 +			rect_scale[1] = (float)BLI_rcti_size_y(rect) / (float)ar->winy;
 +		}
 +		/* note: calls BKE_object_where_is_calc for camera... */
 +		view3d_viewmatrix_set(eval_ctx, scene, v3d, rv3d, rect ? rect_scale : NULL);
 +	}
 +	/* update utility matrices */
 +	mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
 +	invert_m4_m4(rv3d->persinv, rv3d->persmat);
 +	invert_m4_m4(rv3d->viewinv, rv3d->viewmat);
 +
 +	/* calculate GLSL view dependent values */
  
 -/* ********* end custom clipping *********** */
 +	/* store window coordinates scaling/offset */
 +	if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
 +		rctf cameraborder;
 +		ED_view3d_calc_camera_border(scene, eval_ctx->depsgraph, ar, v3d, rv3d, &cameraborder, false);
 +		rv3d->viewcamtexcofac[0] = (float)ar->winx / BLI_rctf_size_x(&cameraborder);
 +		rv3d->viewcamtexcofac[1] = (float)ar->winy / BLI_rctf_size_y(&cameraborder);
  
 +		rv3d->viewcamtexcofac[2] = -rv3d->viewcamtexcofac[0] * cameraborder.xmin / (float)ar->winx;
 +		rv3d->viewcamtexcofac[3] = -rv3d->viewcamtexcofac[1] * cameraborder.ymin / (float)ar->winy;
 +	}
 +	else {
 +		rv3d->viewcamtexcofac[0] = rv3d->viewcamtexcofac[1] = 1.0f;
 +		rv3d->viewcamtexcofac[2] = rv3d->viewcamtexcofac[3] = 0.0f;
 +	}
  
 -static void drawgrid_draw(ARegion *ar, double wx, double wy, double x, double y, double dx)
 -{	
 -	double verts[2][2];
 +	/* calculate pixelsize factor once, is used for lamps and obcenters */
 +	{
 +		/* note:  '1.0f / len_v3(v1)'  replaced  'len_v3(rv3d->viewmat[0])'
 +		 * because of float point p

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list