static void scene_changed(Main *bmain, Scene *scene)
{
	Object *ob;
	Material *ma;
	World *wo;

	/* glsl */
	for (ob = bmain->object.first; ob; ob = ob->id.next) {
		if (ob->gpulamp.first)
			GPU_lamp_free(ob);
		
		if (ob->mode & OB_MODE_TEXTURE_PAINT) {
			BKE_texpaint_slots_refresh_object(scene, ob);
			BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
			GPU_drawobject_free(ob->derivedFinal);
		}
	}

	for (ma = bmain->mat.first; ma; ma = ma->id.next)
		if (ma->gpumaterial.first)
			GPU_material_free(&ma->gpumaterial);

	for (wo = bmain->world.first; wo; wo = wo->id.next)
		if (wo->gpumaterial.first)
			GPU_material_free(&wo->gpumaterial);
	
	if (defmaterial.gpumaterial.first)
		GPU_material_free(&defmaterial.gpumaterial);
}
Exemple #2
0
static void rna_ImaPaint_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
	Object *ob = OBACT;
	
	/* of course we need to invalidate here */
	BKE_texpaint_slots_refresh_object(scene, ob);

	/* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */
	GPU_drawobject_free(ob->derivedFinal);	
	WM_main_add_notifier(NC_GEOM | ND_DATA, &ob->id);
}
static void rna_ImaPaint_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
	Object *ob = OBACT;

	if (ob && ob->type == OB_MESH) {
		/* of course we need to invalidate here */
		BKE_texpaint_slots_refresh_object(scene, ob);

		/* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */
		GPU_drawobject_free(ob->derivedFinal);
		BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
		WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
	}
}