static void rna_ImaPaint_canvas_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
{
	Object *ob = OBACT;
	bScreen *sc;
	Image *ima = scene->toolsettings->imapaint.canvas;

	for (sc = bmain->screen.first; sc; sc = sc->id.next) {
		ScrArea *sa;
		for (sa = sc->areabase.first; sa; sa = sa->next) {
			SpaceLink *sl;
			for (sl = sa->spacedata.first; sl; sl = sl->next) {
				if (sl->spacetype == SPACE_IMAGE) {
					SpaceImage *sima = (SpaceImage *)sl;

					if (!sima->pin)
						ED_space_image_set(bmain, sima, scene, scene->obedit, ima);
				}
			}
		}
	}

	if (ob && ob->type == OB_MESH) {
		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);
	}
}
Beispiel #2
0
static void rna_ImaPaint_stencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
    Object *ob = OBACT;
    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);
}
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);
}
Beispiel #4
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);
    BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
    WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
}