[Bf-blender-cvs] [261d64922b2] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object

Joshua Leung noreply at git.blender.org
Tue Apr 17 17:04:44 CEST 2018


Commit: 261d64922b206840c9e4f8cd6eb059f3bd9aed5a
Author: Joshua Leung
Date:   Tue Apr 17 16:05:37 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB261d64922b206840c9e4f8cd6eb059f3bd9aed5a

Merge branch 'blender2.8' into greasepencil-object

Note:
There were some additional changes needed due to the EvaluationContext -> Depsgraph
cleanups + MultiObject edit that happened in 2.8 since the last merge of 2.8 into
this branch.


# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/blenkernel/BKE_modifier.h
#	source/blender/editors/gpencil/gpencil_paint.c
#	source/blender/editors/include/ED_object.h
#	source/blender/editors/object/object_modifier.c
#	source/blender/editors/screen/screen_context.c
#	source/blender/editors/space_view3d/view3d_draw_legacy.c
#	source/blender/editors/transform/transform.c
#	source/blender/editors/transform/transform_conversions.c
#	source/blender/editors/transform/transform_generics.c
#	source/blender/editors/undo/ed_undo.c
#	source/tools

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



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

diff --cc release/scripts/addons
index 371960484a3,8f2fd7e23f0..f8a43cda938
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@@ -1,1 -1,1 +1,1 @@@
- Subproject commit 371960484a38fc64e0a2635170a41a0d8ab2f6bd
 -Subproject commit 8f2fd7e23f0b5ce023440182f51c40e88d663325
++Subproject commit f8a43cda938c0e037c084f15d410d18dabc31b60
diff --cc source/blender/blenkernel/BKE_context.h
index 22a33d4216e,5057168b9f6..a1cd0088fa0
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@@ -317,16 -322,8 +320,14 @@@ int CTX_data_visible_gpencil_layers(con
  int CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list);
  int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list);
  
 +struct Palette *CTX_data_active_palette(const bContext *C);
 +struct PaletteColor *CTX_data_active_palettecolor(const bContext *C);
 +int CTX_data_active_palettecolors(const bContext *C, ListBase *list);
 +int CTX_data_available_palettes(const bContext *C, ListBase *list);
 +int CTX_data_available_palettecolors(const bContext *C, ListBase *list);
 +
  struct Depsgraph *CTX_data_depsgraph(const bContext *C);
  
- void CTX_data_eval_ctx(const bContext *C, struct EvaluationContext *eval_ctx);
- 
  #ifdef __cplusplus
  }
  #endif
diff --cc source/blender/blenkernel/BKE_modifier.h
index dc4a82b0b11,c81c0f7c4c0..dc164e491db
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@@ -33,9 -33,8 +33,9 @@@
  #include "BKE_customdata.h"
  
  struct ID;
+ struct Depsgraph;
  struct DerivedMesh;
- struct EvaluationContext;
- struct bContext;
++struct bContext; /* NOTE: bakeModifierGP() - called from UI - needs to create new datablocks, hence the need for this */
  struct Object;
  struct Scene;
  struct ViewLayer;
@@@ -233,46 -223,6 +233,46 @@@ typedef struct ModifierTypeInfo 
  	                                       struct DerivedMesh *derivedData, ModifierApplyFlag flag);
  
  
 +	/******************* GP modifier functions *********************/
 +
 +	/* Callback for GP "stroke" modifiers that operate on the
 +	 * shape and parameters of the provided strokes (e.g. Thickness, Noise, etc.)
 +	 *
 +	 * The gpl parameter contains the GP layer that the strokes come from.
 +	 * While access is provided to this data, you should not directly access
 +	 * the gpl->frames data from the modifier. Instead, use the gpf parameter
 +	 * instead.
 +	 *
 +	 * The gps parameter contains the GP stroke to operate on. This is usually a copy
 +	 * of the original (unmodified and saved to files) stroke data.
 +	 */
- 	void (*deformStroke)(struct ModifierData *md, const struct EvaluationContext *eval_ctx,
++	void (*deformStroke)(struct ModifierData *md, struct Depsgraph *depsgraph,
 +	                     struct Object *ob, struct bGPDlayer *gpl, struct bGPDstroke *gps);
 +
 +	/* Callback for GP "geometry" modifiers that create extra geometry
 +	 * in the frame (e.g. Array)
 +	 *
 +	 * The gpf parameter contains the GP frame/strokes to operate on. This is
 +	 * usually a copy of the original (unmodified and saved to files) stroke data.
 +	 * Modifiers should only add any generated strokes to this frame (and not one accessed
 +	 * via the gpl parameter).
 +	 *
 +	 * The modifier_index parameter indicates where the modifier is
 +	 * in the modifier stack in relation to other modifiers.
 +	 */
- 	void (*generateStrokes)(struct ModifierData *md, const struct EvaluationContext *eval_ctx,
++	void (*generateStrokes)(struct ModifierData *md, struct Depsgraph *depsgraph,
 +	                        struct Object *ob, struct bGPDlayer *gpl, struct bGPDframe *gpf,
 +	                        int modifier_index);
 +
 +	/* Bake-down GP modifier's effects into the GP datablock.
 +	 *
 +	 * This gets called when the user clicks the "Apply" button in the UI.
 +	 * As such, this callback needs to go through all layers/frames in the
 +	 * datablock, mutating the geometry and/or creating new datablocks/objects
 +	 */
- 	void (*bakeModifierGP)(const struct bContext *C, const struct EvaluationContext *eval_ctx,
++	void (*bakeModifierGP)(const struct bContext *C, struct Depsgraph *depsgraph,
 +                           struct ModifierData *md, struct Object *ob);
 +
  	/********************* Optional functions *********************/
  
  	/* Initialize new instance data for this modifier type, this function
diff --cc source/blender/blenkernel/BKE_object.h
index 4d816c00af8,b51c4e17394..1e06f5ad5e1
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@@ -36,10 -36,9 +36,10 @@@ extern "C" 
  #include "BLI_compiler_attrs.h"
  
  struct Base;
- struct EvaluationContext;
+ struct Depsgraph;
  struct Scene;
  struct ViewLayer;
 +struct ID;
  struct Object;
  struct BoundBox;
  struct View3D;
diff --cc source/blender/blenkernel/intern/lattice.c
index cdcac8d4c4f,b9e6e0e8fa9..9d1e6c6c502
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@@ -1222,10 -1227,9 +1222,10 @@@ void BKE_lattice_translate(Lattice *lt
  
  /* **** Depsgraph evaluation **** */
  
- void BKE_lattice_eval_geometry(const struct EvaluationContext *UNUSED(eval_ctx),
+ void BKE_lattice_eval_geometry(struct Depsgraph *UNUSED(depsgraph),
                                 Lattice *UNUSED(latt))
  {
 +
  }
  
  /* Draw Engine */
diff --cc source/blender/blenkernel/intern/object_update.c
index 041bc5bf842,81f15d265a2..e1d917af5cf
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@@ -61,13 -61,14 +61,15 @@@
  #include "BKE_mball.h"
  #include "BKE_mesh.h"
  #include "BKE_image.h"
 +#include "BKE_gpencil.h"
  
  #include "MEM_guardedalloc.h"
+ 
  #include "DEG_depsgraph.h"
+ #include "DEG_depsgraph_query.h"
  
  
- void BKE_object_eval_local_transform(const EvaluationContext *UNUSED(eval_ctx),
+ void BKE_object_eval_local_transform(Depsgraph *UNUSED(depsgraph),
                                       Object *ob)
  {
  	DEG_debug_print_eval(__func__, ob->id.name, ob);
diff --cc source/blender/editors/gpencil/gpencil_data.c
index 9b478c556c4,9d183222c2d..b328dd7b2fb
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@@ -1990,200 -2022,65 +1990,201 @@@ static void joined_gpencil_fix_animdata
  					}
  				}
  			}
 +			DRIVER_TARGETS_LOOPER_END
  		}
  	}
 -	/* notifiers */
 -	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
 -
 -	return OPERATOR_FINISHED;
  }
  
 -void GPENCIL_OT_palettecolor_select(wmOperatorType *ot)
 +/* join objects called from OBJECT_OT_join */
 +int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
  {
 -	/* identifiers */
 -	ot->name = "Select Color";
 -	ot->idname = "GPENCIL_OT_palettecolor_select";
 -	ot->description = "Select all Grease Pencil strokes using current color";
 +	Main *bmain = CTX_data_main(C);
 +	Scene *scene = CTX_data_scene(C);
++	Depsgraph *depsgraph = CTX_data_depsgraph(C);
 +	Object  *obact = CTX_data_active_object(C);
 +	bGPdata *gpd_dst = NULL;
 +	bool ok = false;
  
 -	/* callbacks */
 -	ot->exec = gp_palettecolor_select_exec;
 -	ot->poll = gp_palettecolor_reveal_poll; /* XXX: could use dedicated poll later */
 +	/* Ensure we're in right mode and that the active object is correct */
 +	if (!obact || obact->type != OB_GPENCIL)
 +		return OPERATOR_CANCELLED;
  
 -	/* flags */
 -	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 -}
 +	bGPdata *gpd = (bGPdata *)obact->data;
 +	if ((!gpd) || GPENCIL_ANY_MODE(gpd)) {
 +		return OPERATOR_CANCELLED;
 +	}
  
 -/* ***************** Copy Palette color ************************ */
 +	/* Ensure all rotations are applied before */
 +	// XXX: Why don't we apply them here instead of warning?
 +	CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
 +	{
 +		if (base->object->type == OB_GPENCIL) {
 +			if ((base->object->rot[0] != 0) || 
 +				(base->object->rot[1] != 0) || 
 +				(base->object->rot[2] != 0)) 
 +			{
 +				BKE_report(op->reports, RPT_ERROR, "Apply all rotations before join objects");
 +				return OPERATOR_CANCELLED;
 +			}
 +		}
 +	}
 +	CTX_DATA_END;
  
 -static int gp_palettecolor_copy_exec(bContext *C, wmOperator *UNUSED(op))
 -{
 -	bGPdata *gpd = ED_gpencil_data_get_active(C);
 -	bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
 -	bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette);
 -	bGPDpalettecolor *newcolor;
 +	CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
 +	{
 +		if (base->object == obact) {
 +			ok = true;
 +			break;
 +		}
 +	}
 +	CTX_DATA_END;
  
 -	/* sanity checks */
 -	if (ELEM(NULL, gpd, palette, palcolor))
 +	/* that way the active object is always selected */
 +	if (ok == false) {
 +		BKE_report(op->reports, RPT_WARNING, "Active object is not a selected grease pencil");
  		return OPERATOR_CANCELLED;
 +	}
 +
 +	gpd_dst = obact->data;
 +
 +	/* loop and join all data */
 +	CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
 +	{
 +		if ((base->object->type == OB_GPENCIL) && (base->object != obact)) {
 +			/* we assume that each datablock is not already used in active object */
 +			if (obact->data != base->object->data) {
 +				bGPdata *gpd_src = base->object->data;
 +
 +				/* Apply all GP modifiers before */
 +				for (ModifierData *md = base->object->modifiers.first; md; md = md->next) {
 +					const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 +					if (mti->bakeModifierGP) {
- 						mti->bakeModifierGP(C, bmain->eval_ctx, md, base->object);
++						mti->bakeModifierGP(C, depsgraph, md, base->object);
 +					}
 +				}
  
 -	/* create a new color and duplicate data */
 -	newcolor = BKE_gpencil_palettecolor_addnew(palette, palcolor->info, true);
 -	copy_v4_v4(newcolor->color, palcolor->color);
 -	copy_v4_v4(newcolor->fill, palcolor->fill);
 -	newcolor->flag = palcolor->flag;
 +				/* copy vertex groups to the base one's */
 +				int old_idx = 0;
 +				for (bDeformGroup *dg = base->object->defbase.first; dg; dg = dg->next) {
 +					bDeformGroup *vgroup = MEM_dupallocN(dg);
 +					int idx = BLI_listbase_count(&obact->defbase);
 +					defgroup_unique_name(vgroup, obact);
 +					BLI_addta

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list