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

Campbell Barton noreply at git.blender.org
Wed Dec 19 00:30:49 CET 2018


Commit: d46d8e831ce0c6a519d60cdcb4c8a5d4f5a88428
Author: Campbell Barton
Date:   Wed Dec 19 10:28:26 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBd46d8e831ce0c6a519d60cdcb4c8a5d4f5a88428

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/editors/object/object_add.c
index a760086abae,1bba15c93c1..c481a62acb7
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@@ -1857,11 -1666,11 +1857,11 @@@ static int convert_exec(bContext *C, wm
  	{
  		for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
  			Base *base = link->ptr.data;
 -			ob = base->object;
 +			Object *ob = base->object;
  
  			/* The way object type conversion works currently (enforcing conversion of *all* objects using converted
- 			 * obdata, even some un-selected/hidden/inother scene ones, sounds totally bad to me.
- 			 * However, changing this is more design than bugfix, not to mention convoluted code below,
+ 			 * object-data, even some un-selected/hidden/another scene ones, sounds totally bad to me.
+ 			 * However, changing this is more design than bug-fix, not to mention convoluted code below,
  			 * so that will be for later.
  			 * But at the very least, do not do that with linked IDs! */
  			if ((ID_IS_LINKED(ob) || (ob->data && ID_IS_LINKED(ob->data))) && !keep_original) {
diff --cc source/blender/editors/screen/screen_draw.c
index 679bd66753b,c4a6cff6ac8..ca3707786dd
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@@ -307,26 -202,23 +307,26 @@@ static void scrarea_draw_shape_dark(Scr
  }
  
  /**
-  * Draw screen area ligher with arrow shape ("eraser" of previous dark shape).
+  * Draw screen area lighter with arrow shape ("eraser" of previous dark shape).
   */
 -static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir))
 +static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir), unsigned int pos)
  {
 -	glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
 +	GPU_blend_set_func(GPU_DST_COLOR, GPU_SRC_ALPHA);
  	/* value 181 was hardly computed: 181~105 */
 -	glColor4ub(255, 255, 255, 50);
 +	immUniformColor4ub(255, 255, 255, 50);
  	/* draw_join_shape(sa, dir); */
 -	glRecti(sa->v1->vec.x, sa->v1->vec.y, sa->v3->vec.x, sa->v3->vec.y);
 +
 +	immRectf(pos, sa->v1->vec.x, sa->v1->vec.y, sa->v3->vec.x, sa->v3->vec.y);
  }
  
 -static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2)
 +static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2, float edge_thickness)
  {
 +	rctf rect;
 +	BLI_rctf_init(&rect, (float)x1, (float)x2, (float)y1, (float)y2);
 +
  	/* right border area */
 -	if (x2 < sizex - 1) {
 -		glVertex2s(x2, y1);
 -		glVertex2s(x2, y2);
 +	if (x2 >= sizex - 1) {
 +		rect.xmax += edge_thickness * 0.5f;
  	}
  
  	/* left border area */
diff --cc source/blender/editors/transform/transform_conversions.c
index 3576406ee0b,a25ed90973b..6d8f487b755
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@@ -2681,220 -2537,191 +2681,220 @@@ static void createTransEditVerts(TransI
  			}
  		}
  
 -		t->total = count;
 +		/**
 +		 * Quick check if we can transform.
 +		 *
 +		 * \note ignore modes here, even in edge/face modes, transform data is created by selected vertices.
 +		 * \note in prop mode we need at least 1 selected.
 +		 */
 +		if (bm->totvertsel == 0) {
 +			goto cleanup;
 +		}
  
 -		/* allocating scratch arrays */
 -		if (prop_mode & T_PROP_CONNECTED) {
 -			dists = MEM_mallocN(em->bm->totvert * sizeof(float), __func__);
 -			if (is_island_center) {
 -				dists_index =  MEM_mallocN(em->bm->totvert * sizeof(int), __func__);
 -			}
 +		if (t->mode == TFM_BWEIGHT) {
 +			BM_mesh_cd_flag_ensure(bm, BKE_mesh_from_object(tc->obedit), ME_CDFLAG_VERT_BWEIGHT);
 +			cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
  		}
 -	}
 -	else {
 -		t->total = bm->totvertsel;
 -	}
  
 -	tob = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Mesh EditMode)");
 -	if (ELEM(t->mode, TFM_SKIN_RESIZE, TFM_SHRINKFATTEN)) {
 -		/* warning, this is overkill, we only need 2 extra floats,
 -		 * but this stores loads of extra stuff, for TFM_SHRINKFATTEN its even more overkill
 -		 * since we may not use the 'alt' transform mode to maintain shell thickness,
 -		 * but with generic transform code its hard to lazy init vars */
 -		tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension),
 -		                          "TransObData ext");
 -	}
 +		if (prop_mode) {
 +			unsigned int count = 0;
 +			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
 +				if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
 +					count++;
 +				}
 +			}
  
 -	copy_m3_m4(mtx, t->obedit->obmat);
 -	/* we use a pseudo-inverse so that when one of the axes is scaled to 0,
 -	 * matrix inversion still works and we can still moving along the other */
 -	pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
 +			tc->data_len = count;
  
 -	if (prop_mode & T_PROP_CONNECTED) {
 -		editmesh_set_connectivity_distance(em->bm, mtx, dists, dists_index);
 -	}
 +			/* allocating scratch arrays */
 +			if (prop_mode & T_PROP_CONNECTED) {
 +				dists = MEM_mallocN(em->bm->totvert * sizeof(float), __func__);
 +				if (is_island_center) {
 +					dists_index =  MEM_mallocN(em->bm->totvert * sizeof(int), __func__);
 +				}
 +			}
 +		}
 +		else {
 +			tc->data_len = bm->totvertsel;
 +		}
  
 -	if (is_island_center) {
 -		/* In this specific case, near-by vertices will need to know the island of the nearest connected vertex. */
 -		const bool calc_single_islands = (
 -		        (prop_mode & T_PROP_CONNECTED) &&
 -		        (t->around == V3D_AROUND_LOCAL_ORIGINS) &&
 -		        (em->selectmode & SCE_SELECT_VERTEX));
 +		tob = tc->data = MEM_callocN(tc->data_len * sizeof(TransData), "TransObData(Mesh EditMode)");
 +		if (ELEM(t->mode, TFM_SKIN_RESIZE, TFM_SHRINKFATTEN)) {
 +			/* warning, this is overkill, we only need 2 extra floats,
 +			 * but this stores loads of extra stuff, for TFM_SHRINKFATTEN its even more overkill
 +			 * since we may not use the 'alt' transform mode to maintain shell thickness,
 +			 * but with generic transform code its hard to lazy init vars */
 +			tx = tc->data_ext = MEM_callocN(tc->data_len * sizeof(TransDataExtension), "TransObData ext");
 +		}
  
 -		island_info = editmesh_islands_info_calc(em, &island_info_tot, &island_vert_map, calc_single_islands);
 -	}
 +		copy_m3_m4(mtx, tc->obedit->obmat);
- 		/* we use a pseudoinverse so that when one of the axes is scaled to 0,
++		/* we use a pseudo-inverse so that when one of the axes is scaled to 0,
 +		 * matrix inversion still works and we can still moving along the other */
 +		pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
  
 -	/* detect CrazySpace [tm] */
 -	if (modifiers_getCageIndex(t->scene, t->obedit, NULL, 1) != -1) {
 -		int totleft = -1;
 -		if (modifiers_isCorrectableDeformed(t->scene, t->obedit)) {
 -			/* check if we can use deform matrices for modifier from the
 -			 * start up to stack, they are more accurate than quats */
 -			totleft = BKE_crazyspace_get_first_deform_matrices_editbmesh(t->scene, t->obedit, em, &defmats, &defcos);
 +		if (prop_mode & T_PROP_CONNECTED) {
 +			editmesh_set_connectivity_distance(em->bm, mtx, dists, dists_index);
  		}
  
 -		/* if we still have more modifiers, also do crazyspace
 -		 * correction with quats, relative to the coordinates after
 -		 * the modifiers that support deform matrices (defcos) */
 +		if (is_island_center) {
 +			/* In this specific case, near-by vertices will need to know the island of the nearest connected vertex. */
 +			const bool calc_single_islands = (
 +			        (prop_mode & T_PROP_CONNECTED) &&
 +			        (t->around == V3D_AROUND_LOCAL_ORIGINS) &&
 +			        (em->selectmode & SCE_SELECT_VERTEX));
 +
 +			island_info = editmesh_islands_info_calc(em, &island_info_tot, &island_vert_map, calc_single_islands);
 +		}
 +
 +		/* detect CrazySpace [tm] */
 +		if (modifiers_getCageIndex(t->scene, tc->obedit, NULL, 1) != -1) {
 +			int totleft = -1;
 +			if (modifiers_isCorrectableDeformed(t->scene, tc->obedit)) {
 +				/* Use evaluated state because we need b-bone cache. */
 +				Scene *scene_eval = (Scene *)DEG_get_evaluated_id(t->depsgraph, &t->scene->id);
 +				Object *obedit_eval = (Object *)DEG_get_evaluated_id(t->depsgraph, &tc->obedit->id);
 +				BMEditMesh *em_eval = BKE_editmesh_from_object(obedit_eval);
 +				/* check if we can use deform matrices for modifier from the
 +				 * start up to stack, they are more accurate than quats */
 +				totleft = BKE_crazyspace_get_first_deform_matrices_editbmesh(
 +				        t->depsgraph, scene_eval, obedit_eval, em_eval,
 +				        &defmats, &defcos);
 +			}
 +
 +			/* if we still have more modifiers, also do crazyspace
 +			 * correction with quats, relative to the coordinates after
 +			 * the modifiers that support deform matrices (defcos) */
  
  #if 0	/* TODO, fix crazyspace+extrude so it can be enabled for general use - campbell */
 -		if ((totleft > 0) || (totleft == -1))
 +			if ((totleft > 0) || (totleft == -1))
  #else
 -		if (totleft > 0)
 +			if (totleft > 0)
  #endif
 -		{
 -			mappedcos = BKE_crazyspace_get_mapped_editverts(t->scene, t->obedit);
 -			quats = MEM_mallocN(em->bm->totvert * sizeof(*quats), "crazy quats");
 -			BKE_crazyspace_set_quats_editmesh(em, defcos, mappedcos, quats, !prop_mode);
 -			if (mappedcos)
 -				MEM_freeN(mappedcos);
 -		}
 +			{
 +				mappedcos = BKE_crazyspace_get_mapped_editverts(t->depsgraph, t->scene, tc->obedit);
 +				quats = MEM_mallocN(em->bm->totvert * sizeof(*quats), "crazy quats");
 +				BKE_crazyspace_set_quats_editmesh(em, defcos, mappedcos, quats, !prop_mode);
 +				if (mappedcos)
 +					MEM_freeN(mappedcos);
 +			}
  
 -		if (defcos) {
 -			MEM_freeN(defcos);
 +			if (defcos) {
 +				MEM_freeN(defcos);
 +			}
  		}
 -	}
  
 -	/* find out which half we do */
 -	if (mirror) {
 -		BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
 -			if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve->co[0] != 0.0f) {
 -				if (eve->co[0] < 0.0f) {
 -					t->mirror = -1;
 -					mirror = -1;
 +		/* find out which half we do */
 +		if (mirror) {
 +			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
 +				if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve->c

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list