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

Antonio Vazquez noreply at git.blender.org
Mon May 15 11:23:13 CEST 2017


Commit: d91d88c810656bf4af0237dfeb28f87fbabe0db1
Author: Antonio Vazquez
Date:   Mon May 15 10:56:00 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBd91d88c810656bf4af0237dfeb28f87fbabe0db1

Merge branch 'blender2.8' into greasepencil-object

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



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

diff --cc source/blender/blenloader/intern/versioning_280.c
index 70ae4348698,ea7a6316466..9105d4db72f
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -257,48 -255,13 +259,57 @@@ void blo_do_versions_280(FileData *fd, 
  				}
  			}
  		}
 +		/* ------- convert grease pencil palettes to blender palettes --------------- */
 +		if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "Palette", "*palette")) {
 +			for (bGPdata *gpd = main->gpencil.first; gpd; gpd = gpd->id.next) {
 +				/* first create all palettes and colors */
 +				Palette *first = NULL;
 +				for (bGPDpalette *oldpalette = gpd->palettes.first; oldpalette; oldpalette = oldpalette->next) {
 +					/* create palette */
 +					Palette *newpalette = BKE_palette_add(main, oldpalette->info);
 +					/* save first to use later */
 +					if (first == NULL) {
 +						first = newpalette;
 +					}
 +					/* enable fake user by default */
 +					id_fake_user_set(&newpalette->id);
 +
 +					for (bGPDpalettecolor *oldcolor = oldpalette->colors.first; oldcolor; oldcolor = oldcolor->next) {
 +						PaletteColor *newcolor = BKE_palette_color_add_name(newpalette, oldcolor->info);
 +						/* set color attributes */
 +						copy_v4_v4(newcolor->rgb, oldcolor->color);
 +						copy_v4_v4(newcolor->fill, oldcolor->fill);
 +						newcolor->flag = oldcolor->flag;
 +					}
 +					/* set first color active by default */
 +					if (!BLI_listbase_is_empty(&newpalette->colors)) {
 +						newpalette->active_color = 0;
 +					}
 +				}
 +				/* second, assign the palette and the color (always to first palette) */
 +				for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 +					for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
 +						for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
 +							Palette *palette = first;
 +							PaletteColor *palcolor = BKE_palette_color_getbyname(first, gps->colorname);
 +
 +							gps->palette = palette;
 +							gps->palcolor = palcolor;
 +						}
 +					}
 +				}
 +			}
 +		}
 +		/* ------- end grease pencil palettes conversion --------------- */
++			}
++		}
+ 
+ 	}
+ 
+ 	if (!DNA_struct_elem_find(fd->filesdna, "GPUDOFSettings", "float", "ratio"))	{
+ 		for (Camera *ca = main->camera.first; ca; ca = ca->id.next) {
+ 			ca->gpu_dof.ratio = 1.0f;
+ 		}
  	}
  
  	if (!DNA_struct_elem_find(fd->filesdna, "SceneLayer", "IDProperty", "*properties")) {
diff --cc source/blender/draw/intern/draw_cache_impl.h
index 75cbd8314ce,2363d097261..7eb9b7a14da
--- a/source/blender/draw/intern/draw_cache_impl.h
+++ b/source/blender/draw/intern/draw_cache_impl.h
@@@ -44,9 -45,9 +45,12 @@@ void DRW_mesh_batch_cache_free(struct M
  void DRW_lattice_batch_cache_dirty(struct Lattice *lt, int mode);
  void DRW_lattice_batch_cache_free(struct Lattice *lt);
  
+ void DRW_particle_batch_cache_dirty(struct ParticleSystem *psys, int mode);
+ void DRW_particle_batch_cache_free(struct ParticleSystem *psys);
+ 
 +void DRW_gpencil_batch_cache_dirty(struct bGPdata *gpd, int mode);
 +void DRW_gpencil_batch_cache_free(struct bGPdata *gpd);
 +
  /* Curve */
  struct Batch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu, struct CurveCache *ob_curve_cache);
  struct Batch *DRW_curve_batch_cache_get_normal_edge(
diff --cc source/blender/draw/intern/draw_manager.c
index 212a57a7982,a6f6b14a1d7..21d84f1751b
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@@ -3103,9 -3105,9 +3108,12 @@@ void DRW_engines_register(void
  		/* BKE: lattice.c */
  		extern void *BKE_lattice_batch_cache_dirty_cb;
  		extern void *BKE_lattice_batch_cache_free_cb;
+ 		/* BKE: particle.c */
+ 		extern void *BKE_particle_batch_cache_dirty_cb;
+ 		extern void *BKE_particle_batch_cache_free_cb;
 +		/* BKE: gpencil.c */
 +		extern void *BKE_gpencil_batch_cache_dirty_cb;
 +		extern void *BKE_gpencil_batch_cache_free_cb;
  
  		BKE_curve_batch_cache_dirty_cb = DRW_curve_batch_cache_dirty;
  		BKE_curve_batch_cache_free_cb = DRW_curve_batch_cache_free;
@@@ -3116,8 -3118,8 +3124,11 @@@
  		BKE_lattice_batch_cache_dirty_cb = DRW_lattice_batch_cache_dirty;
  		BKE_lattice_batch_cache_free_cb = DRW_lattice_batch_cache_free;
  
+ 		BKE_particle_batch_cache_dirty_cb = DRW_particle_batch_cache_dirty;
+ 		BKE_particle_batch_cache_free_cb = DRW_particle_batch_cache_free;
++
 +		BKE_gpencil_batch_cache_dirty_cb = DRW_gpencil_batch_cache_dirty;
 +		BKE_gpencil_batch_cache_free_cb = DRW_gpencil_batch_cache_free;
  	}
  }
  
diff --cc source/blender/editors/interface/interface_utils.c
index f2e79ec0c7f,f383719a747..046ac0a957e
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@@ -214,92 -214,90 +214,175 @@@ int uiDefAutoButsRNA
  
  	return tot;
  }
 +/* *** RNA collection search menu *** */
 +
 +typedef struct CollItemSearch {
 +	struct CollItemSearch *next, *prev;
 +	ID *id;
 +	char *name;
 +	int index;
 +	int iconid;
 +} CollItemSearch;
 +
 +static int sort_search_items_list(const void *a, const void *b)
 +{
 +	const CollItemSearch *cis1 = a;
 +	const CollItemSearch *cis2 = b;
 +
 +	if (BLI_strcasecmp(cis1->name, cis2->name) > 0)
 +		return 1;
 +	else
 +		return 0;
 +}
 +
 +void ui_rna_collection_search_cb(const struct bContext *C, void *arg, const char *str, uiSearchItems *items)
 +{
 +	uiRNACollectionSearch *data = arg;
 +	char *name;
 +	int i = 0, iconid = 0, flag = RNA_property_flag(data->target_prop);
 +	ListBase *items_list = MEM_callocN(sizeof(ListBase), "items_list");
 +	CollItemSearch *cis;
 +	const bool skip_filter = !(data->but_changed && *data->but_changed);
 +
 +	/* build a temporary list of relevant items first */
 +	RNA_PROP_BEGIN (&data->search_ptr, itemptr, data->search_prop)
 +	{
 +		ID *id = NULL;
 +
 +		if (flag & PROP_ID_SELF_CHECK)
 +			if (itemptr.data == data->target_ptr.id.data)
 +				continue;
 +
 +		/* use filter */
 +		if (RNA_property_type(data->target_prop) == PROP_POINTER) {
 +			if (RNA_property_pointer_poll(&data->target_ptr, data->target_prop, &itemptr) == 0)
 +				continue;
 +		}
 +
 +		name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
 +		iconid = 0;
 +		if (itemptr.type && RNA_struct_is_ID(itemptr.type)) {
 +			id = itemptr.data;
 +			iconid = ui_id_icon_get(C, id, false);
 +		}
 +
 +		if (name) {
 +			if (skip_filter || BLI_strcasestr(name, str)) {
 +				cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
 +				cis->id = id;
 +				cis->name = MEM_dupallocN(name);
 +				cis->index = i;
 +				cis->iconid = iconid;
 +				BLI_addtail(items_list, cis);
 +			}
 +			MEM_freeN(name);
 +		}
 +
 +		i++;
 +	}
 +	RNA_PROP_END;
 +
 +	BLI_listbase_sort(items_list, sort_search_items_list);
 +
 +	/* add search items from temporary list */
 +	for (cis = items_list->first; cis; cis = cis->next) {
 +		void *poin = cis->id ? cis->id : SET_INT_IN_POINTER(cis->index);
 +		if (UI_search_item_add(items, cis->name, poin, cis->iconid) == false) {
 +			break;
 +		}
 +	}
 +
 +	for (cis = items_list->first; cis; cis = cis->next) {
 +		MEM_freeN(cis->name);
 +	}
 +	BLI_freelistN(items_list);
 +	MEM_freeN(items_list);
 +}
 +
  
+ /* *** RNA collection search menu *** */
+ 
+ typedef struct CollItemSearch {
+ 	struct CollItemSearch *next, *prev;
+ 	void *data;
+ 	char *name;
+ 	int index;
+ 	int iconid;
+ } CollItemSearch;
+ 
+ static int sort_search_items_list(const void *a, const void *b)
+ {
+ 	const CollItemSearch *cis1 = a;
+ 	const CollItemSearch *cis2 = b;
+ 
+ 	if (BLI_strcasecmp(cis1->name, cis2->name) > 0)
+ 		return 1;
+ 	else
+ 		return 0;
+ }
+ 
+ void ui_rna_collection_search_cb(const struct bContext *C, void *arg, const char *str, uiSearchItems *items)
+ {
+ 	uiRNACollectionSearch *data = arg;
+ 	char *name;
+ 	int i = 0, iconid = 0, flag = RNA_property_flag(data->target_prop);
+ 	ListBase *items_list = MEM_callocN(sizeof(ListBase), "items_list");
+ 	CollItemSearch *cis;
+ 	const bool skip_filter = !(data->but_changed && *data->but_changed);
+ 
+ 	/* build a temporary list of relevant items first */
+ 	RNA_PROP_BEGIN (&data->search_ptr, itemptr, data->search_prop)
+ 	{
+ 
+ 		if (flag & PROP_ID_SELF_CHECK)
+ 			if (itemptr.data == data->target_ptr.id.data)
+ 				continue;
+ 
+ 		/* use filter */
+ 		if (RNA_property_type(data->target_prop) == PROP_POINTER) {
+ 			if (RNA_property_pointer_poll(&data->target_ptr, data->target_prop, &itemptr) == 0)
+ 				continue;
+ 		}
+ 
+ 		name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
+ 		iconid = 0;
+ 		if (itemptr.type && RNA_struct_is_ID(itemptr.type)) {
+ 			iconid = ui_id_icon_get(C, itemptr.data, false);
+ 		}
+ 
+ 		if (name) {
+ 			if (skip_filter || BLI_strcasestr(name, str)) {
+ 				cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
+ 				cis->data = itemptr.data;
+ 				cis->name = MEM_dupallocN(name);
+ 				cis->index = i;
+ 				cis->iconid = iconid;
+ 				BLI_addtail(items_list, cis);
+ 			}
+ 			MEM_freeN(name);
+ 		}
+ 
+ 		i++;
+ 	}
+ 	RNA_PROP_END;
+ 
+ 	BLI_listbase_sort(items_list, sort_search_items_list);
+ 
+ 	/* add search items from temporary list */
+ 	for (cis = items_list->first; cis; cis = cis->next) {
+ 		if (UI_search_item_add(items, cis->name, cis->data, cis->iconid) == false) {
+ 			break;
+ 		}
+ 	}
+ 
+ 	for (cis = items_list->first; cis; cis = cis->next) {
+ 		MEM_freeN(cis->name);
+ 	}
+ 	BLI_freelistN(items_list);
+ 	MEM_freeN(items_list);
+ }
+ 
+ 
  /***************************** ID Utilities *******************************/
  
  int UI_icon_from_id(ID *id)




More information about the Bf-blender-cvs mailing list