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

Campbell Barton noreply at git.blender.org
Sat Sep 30 02:49:07 CEST 2017


Commit: 18965905d0fdb2dd546d95ce9eaa4653cd1e3b17
Author: Campbell Barton
Date:   Sat Sep 30 11:00:29 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB18965905d0fdb2dd546d95ce9eaa4653cd1e3b17

Merge branch 'master' into blender2.8

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



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

diff --cc intern/cycles/blender/blender_object.cpp
index 635f1d2eb46,63138c060fb..02cb4dbbe8a
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@@ -286,8 -285,31 +303,31 @@@ Object *BlenderSync::sync_object(BL::De
  		return NULL;
  	}
  
+ 	/* Visibility flags for both parent and child. */
+ 	bool use_holdout = (layer_flag & render_layer.holdout_layer) != 0;
+ 	uint visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY;
+ 
+ 	if(b_parent.ptr.data != b_ob.ptr.data) {
+ 		visibility &= object_ray_visibility(b_parent);
+ 	}
+ 
+ 	/* Make holdout objects on excluded layer invisible for non-camera rays. */
+ 	if(use_holdout && (layer_flag & render_layer.exclude_layer)) {
+ 		visibility &= ~(PATH_RAY_ALL_VISIBILITY - PATH_RAY_CAMERA);
+ 	}
+ 
+ 	/* Hide objects not on render layer from camera rays. */
+ 	if(!(layer_flag & render_layer.layer)) {
+ 		visibility &= ~PATH_RAY_CAMERA;
+ 	}
+ 
+ 	/* Don't export completely invisible objects. */
+ 	if(visibility == 0) {
+ 		return NULL;
+ 	}
+ 
  	/* key to lookup object */
 -	ObjectKey key(b_parent, persistent_id, b_ob);
 +	ObjectKey key(b_parent, persistent_id, b_ob_instance);
  	Object *object;
  
  	/* motion vector case */
@@@ -326,10 -348,8 +366,8 @@@
  	if(object_map.sync(&object, b_ob, b_parent, key))
  		object_updated = true;
  	
- 	bool use_holdout = (layer_flag & render_layer.holdout_layer) != 0;
- 	
  	/* mesh sync */
 -	object->mesh = sync_mesh(b_ob, object_updated, hide_tris);
 +	object->mesh = sync_mesh(b_ob, b_ob_instance, object_updated, hide_tris);
  
  	/* special case not tracked by object update flags */
  
diff --cc source/blender/editors/sculpt_paint/paint_vertex.c
index c3fb67816da,4d6222a4301..9775c136586
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@@ -51,24 -51,18 +51,19 @@@
  
  #include "RNA_access.h"
  #include "RNA_define.h"
- #include "RNA_enum_types.h"
  
- #include "BKE_DerivedMesh.h"
- #include "BKE_action.h"
  #include "BKE_brush.h"
  #include "BKE_context.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_deform.h"
  #include "BKE_mesh.h"
  #include "BKE_mesh_mapping.h"
  #include "BKE_object_deform.h"
  #include "BKE_paint.h"
  #include "BKE_report.h"
- #include "BKE_colortools.h"
  #include "BKE_subsurf.h"
  
 +#include "DEG_depsgraph.h"
 +
  #include "WM_api.h"
  #include "WM_types.h"
  
@@@ -4309,388 -2861,3 +2884,4 @@@ void PAINT_OT_vertex_paint(wmOperatorTy
  
  	paint_stroke_operator_properties(ot);
  }
 +
- /* ********************** weight from bones operator ******************* */
- 
- static int weight_from_bones_poll(bContext *C)
- {
- 	Object *ob = CTX_data_active_object(C);
- 
- 	return (ob && (ob->mode & OB_MODE_WEIGHT_PAINT) && modifiers_isDeformedByArmature(ob));
- }
- 
- static int weight_from_bones_exec(bContext *C, wmOperator *op)
- {
- 	Scene *scene = CTX_data_scene(C);
- 	Object *ob = CTX_data_active_object(C);
- 	Object *armob = modifiers_isDeformedByArmature(ob);
- 	Mesh *me = ob->data;
- 	int type = RNA_enum_get(op->ptr, "type");
- 	EvaluationContext eval_ctx;
- 
- 	CTX_data_eval_ctx(C, &eval_ctx);
- 	create_vgroups_from_armature(op->reports, &eval_ctx, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
- 
- 	DEG_id_tag_update(&me->id, 0);
- 	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
- 
- 	return OPERATOR_FINISHED;
- }
- 
- void PAINT_OT_weight_from_bones(wmOperatorType *ot)
- {
- 	static EnumPropertyItem type_items[] = {
- 		{ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights from bones"},
- 		{ARM_GROUPS_ENVELOPE, "ENVELOPES", 0, "From Envelopes", "Weights from envelopes with user defined radius"},
- 		{0, NULL, 0, NULL, NULL}};
- 
- 	/* identifiers */
- 	ot->name = "Weight from Bones";
- 	ot->idname = "PAINT_OT_weight_from_bones";
- 	ot->description = "Set the weights of the groups matching the attached armature's selected bones, "
- 	                  "using the distance between the vertices and the bones";
- 	
- 	/* api callbacks */
- 	ot->exec = weight_from_bones_exec;
- 	ot->invoke = WM_menu_invoke;
- 	ot->poll = weight_from_bones_poll;
- 	
- 	/* flags */
- 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- 
- 	/* properties */
- 	ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Method to use for assigning weights");
- }
- 
- /* *** VGroups Gradient *** */
- typedef struct DMGradient_vertStore {
- 	float sco[2];
- 	float weight_orig;
- 	enum {
- 		VGRAD_STORE_NOP      = 0,
- 		VGRAD_STORE_DW_EXIST = (1 << 0)
- 	} flag;
- } DMGradient_vertStore;
- 
- typedef struct DMGradient_vertStoreBase {
- 	struct WPaintPrev wpp;
- 	DMGradient_vertStore elem[0];
- } DMGradient_vertStoreBase;
- 
- typedef struct DMGradient_userData {
- 	struct ARegion *ar;
- 	Scene *scene;
- 	Mesh *me;
- 	Brush *brush;
- 	const float *sco_start;     /* [2] */
- 	const float *sco_end;       /* [2] */
- 	float        sco_line_div;  /* store (1.0f / len_v2v2(sco_start, sco_end)) */
- 	int def_nr;
- 	bool is_init;
- 	DMGradient_vertStoreBase *vert_cache;
- 	/* only for init */
- 	BLI_bitmap *vert_visit;
- 
- 	/* options */
- 	short use_select;
- 	short type;
- 	float weightpaint;
- } DMGradient_userData;
- 
- static void gradientVert_update(DMGradient_userData *grad_data, int index)
- {
- 	Mesh *me = grad_data->me;
- 	DMGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- 	float alpha;
- 
- 	if (grad_data->type == WPAINT_GRADIENT_TYPE_LINEAR) {
- 		alpha = line_point_factor_v2(vs->sco, grad_data->sco_start, grad_data->sco_end);
- 	}
- 	else {
- 		BLI_assert(grad_data->type == WPAINT_GRADIENT_TYPE_RADIAL);
- 		alpha = len_v2v2(grad_data->sco_start, vs->sco) * grad_data->sco_line_div;
- 	}
- 	/* no need to clamp 'alpha' yet */
- 
- 	/* adjust weight */
- 	alpha = BKE_brush_curve_strength_clamped(grad_data->brush, alpha, 1.0f);
- 
- 	if (alpha != 0.0f) {
- 		MDeformVert *dv = &me->dvert[index];
- 		MDeformWeight *dw = defvert_verify_index(dv, grad_data->def_nr);
- 		// dw->weight = alpha; // testing
- 		int tool = grad_data->brush->vertexpaint_tool;
- 		float testw;
- 
- 		/* init if we just added */
- 		testw = wpaint_blend_tool(tool, vs->weight_orig, grad_data->weightpaint, alpha * grad_data->brush->alpha);
- 		CLAMP(testw, 0.0f, 1.0f);
- 		dw->weight = testw;
- 	}
- 	else {
- 		MDeformVert *dv = &me->dvert[index];
- 		if (vs->flag & VGRAD_STORE_DW_EXIST) {
- 			/* normally we NULL check, but in this case we know it exists */
- 			MDeformWeight *dw = defvert_find_index(dv, grad_data->def_nr);
- 			dw->weight = vs->weight_orig;
- 		}
- 		else {
- 			/* wasn't originally existing, remove */
- 			MDeformWeight *dw = defvert_find_index(dv, grad_data->def_nr);
- 			if (dw) {
- 				defvert_remove_group(dv, dw);
- 			}
- 		}
- 	}
- }
- 
- static void gradientVertUpdate__mapFunc(
-         void *userData, int index, const float UNUSED(co[3]),
-         const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
- {
- 	DMGradient_userData *grad_data = userData;
- 	Mesh *me = grad_data->me;
- 	if ((grad_data->use_select == false) || (me->mvert[index].flag & SELECT)) {
- 		DMGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- 		if (vs->sco[0] != FLT_MAX) {
- 			gradientVert_update(grad_data, index);
- 		}
- 	}
- }
- 
- static void gradientVertInit__mapFunc(
-         void *userData, int index, const float co[3],
-         const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
- {
- 	DMGradient_userData *grad_data = userData;
- 	Mesh *me = grad_data->me;
- 
- 	if ((grad_data->use_select == false) || (me->mvert[index].flag & SELECT)) {
- 		/* run first pass only,
- 		 * the screen coords of the verts need to be cached because
- 		 * updating the mesh may move them about (entering feedback loop) */
- 
- 		if (BLI_BITMAP_TEST(grad_data->vert_visit, index) == 0) {
- 			DMGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- 			if (ED_view3d_project_float_object(grad_data->ar,
- 			                                   co, vs->sco,
- 			                                   V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
- 			{
- 				/* ok */
- 				MDeformVert *dv = &me->dvert[index];
- 				const MDeformWeight *dw;
- 				dw = defvert_find_index(dv, grad_data->def_nr);
- 				if (dw) {
- 					vs->weight_orig = dw->weight;
- 					vs->flag = VGRAD_STORE_DW_EXIST;
- 				}
- 				else {
- 					vs->weight_orig = 0.0f;
- 					vs->flag = VGRAD_STORE_NOP;
- 				}
- 
- 				BLI_BITMAP_ENABLE(grad_data->vert_visit, index);
- 
- 				gradientVert_update(grad_data, index);
- 			}
- 			else {
- 				/* no go */
- 				copy_v2_fl(vs->sco, FLT_MAX);
- 			}
- 		}
- 	}
- }
- 
- static int paint_weight_gradient_modal(bContext *C, wmOperator *op, const wmEvent *event)
- {
- 	int ret = WM_gesture_straightline_modal(C, op, event);
- 	wmGesture *gesture = op->customdata;
- 	DMGradient_vertStoreBase *vert_cache = gesture->userdata;
- 	bool do_gesture_free = false;
- 
- 	if (ret & OPERATOR_RUNNING_MODAL) {
- 		if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {  /* XXX, hardcoded */
- 			/* generally crap! redo! */
- 			do_gesture_free = true;
- 			ret &= ~OPERATOR_RUNNING_MODAL;
- 			ret |= OPERATOR_FINISHED;
- 		}
- 	}
- 
- 	if (ret & OPERATOR_CANCELLED) {
- 		Object *ob = CTX_data_active_object(C);
- 		Mesh *me = ob->data;
- 		if (vert_cache->wpp.wpaint_prev) {
- 			BKE_defvert_array_free_elems(me->dvert, me->totvert);
- 			BKE_defvert_array_copy(me->dvert, vert_cache->wpp.wpaint_prev, me->totvert);
- 			wpaint_prev_destroy(&vert_cache->wpp);
- 		}
- 
- 		DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
- 		WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
- 	}
- 	else if (ret & OPERATOR_FINISHED) {
- 		wpaint_prev_destroy(&vert_cache->wpp);
- 	}
- 
- 	if (do_gesture_free) {
- 		WM_gesture_straightline_cancel(C, op);
- 	}
- 
- 	return ret;
- }
- 
- static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
- {
- 	wmGesture *gesture = op->customdata;
- 	DMGradient_vertStoreBase *vert_cache;
- 	struct ARegion *ar = CTX_wm_region(C);
- 	Scene *scene = CTX_data_scene(C);
- 	Object *ob = CTX_data_active_object(C);
- 	EvaluationContext eval_ctx;
- 	Mesh *me = ob->data;
- 	int x_start = RNA_int_get(op->

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list