Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/render/render_update.c
| Show First 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | |||||
| static void material_changed(Main *bmain, Material *ma) | static void material_changed(Main *bmain, Material *ma) | ||||
| { | { | ||||
| Material *parent; | Material *parent; | ||||
| Object *ob; | Object *ob; | ||||
| Scene *scene; | Scene *scene; | ||||
| int texture_draw = false; | int texture_draw = false; | ||||
| /* icons */ | /* icons */ | ||||
| BKE_icon_changed(BKE_icon_getid(&ma->id)); | BKE_icon_changed(BKE_icon_id_ensure(&ma->id)); | ||||
| /* glsl */ | /* glsl */ | ||||
| if (ma->gpumaterial.first) | if (ma->gpumaterial.first) | ||||
| GPU_material_free(&ma->gpumaterial); | GPU_material_free(&ma->gpumaterial); | ||||
| /* find node materials using this */ | /* find node materials using this */ | ||||
| for (parent = bmain->mat.first; parent; parent = parent->id.next) { | for (parent = bmain->mat.first; parent; parent = parent->id.next) { | ||||
| if (parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma)) { | if (parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma)) { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| else { | else { | ||||
| continue; | continue; | ||||
| } | } | ||||
| BKE_icon_changed(BKE_icon_getid(&parent->id)); | BKE_icon_changed(BKE_icon_id_ensure(&parent->id)); | ||||
| if (parent->gpumaterial.first) | if (parent->gpumaterial.first) | ||||
| GPU_material_free(&parent->gpumaterial); | GPU_material_free(&parent->gpumaterial); | ||||
| } | } | ||||
| /* find if we have a scene with textured display */ | /* find if we have a scene with textured display */ | ||||
| for (scene = bmain->scene.first; scene; scene = scene->id.next) { | for (scene = bmain->scene.first; scene; scene = scene->id.next) { | ||||
| if (scene->customdata_mask & CD_MASK_MTFACE) { | if (scene->customdata_mask & CD_MASK_MTFACE) { | ||||
| Show All 23 Lines | |||||
| } | } | ||||
| static void lamp_changed(Main *bmain, Lamp *la) | static void lamp_changed(Main *bmain, Lamp *la) | ||||
| { | { | ||||
| Object *ob; | Object *ob; | ||||
| Material *ma; | Material *ma; | ||||
| /* icons */ | /* icons */ | ||||
| BKE_icon_changed(BKE_icon_getid(&la->id)); | BKE_icon_changed(BKE_icon_id_ensure(&la->id)); | ||||
| /* glsl */ | /* glsl */ | ||||
| for (ob = bmain->object.first; ob; ob = ob->id.next) | for (ob = bmain->object.first; ob; ob = ob->id.next) | ||||
| if (ob->data == la && ob->gpulamp.first) | if (ob->data == la && ob->gpulamp.first) | ||||
| GPU_lamp_free(ob); | GPU_lamp_free(ob); | ||||
| for (ma = bmain->mat.first; ma; ma = ma->id.next) | for (ma = bmain->mat.first; ma; ma = ma->id.next) | ||||
| if (ma->gpumaterial.first) | if (ma->gpumaterial.first) | ||||
| Show All 19 Lines | static void texture_changed(Main *bmain, Tex *tex) | ||||
| Lamp *la; | Lamp *la; | ||||
| World *wo; | World *wo; | ||||
| Scene *scene; | Scene *scene; | ||||
| Object *ob; | Object *ob; | ||||
| bNode *node; | bNode *node; | ||||
| bool texture_draw = false; | bool texture_draw = false; | ||||
| /* icons */ | /* icons */ | ||||
| BKE_icon_changed(BKE_icon_getid(&tex->id)); | BKE_icon_changed(BKE_icon_id_ensure(&tex->id)); | ||||
| /* paint overlays */ | /* paint overlays */ | ||||
| for (scene = bmain->scene.first; scene; scene = scene->id.next) | for (scene = bmain->scene.first; scene; scene = scene->id.next) | ||||
| BKE_paint_invalidate_overlay_tex(scene, tex); | BKE_paint_invalidate_overlay_tex(scene, tex); | ||||
| /* find materials */ | /* find materials */ | ||||
| for (ma = bmain->mat.first; ma; ma = ma->id.next) { | for (ma = bmain->mat.first; ma; ma = ma->id.next) { | ||||
| if (!material_uses_texture(ma, tex)) | if (!material_uses_texture(ma, tex)) | ||||
| continue; | continue; | ||||
| BKE_icon_changed(BKE_icon_getid(&ma->id)); | BKE_icon_changed(BKE_icon_id_ensure(&ma->id)); | ||||
| if (ma->gpumaterial.first) | if (ma->gpumaterial.first) | ||||
| GPU_material_free(&ma->gpumaterial); | GPU_material_free(&ma->gpumaterial); | ||||
| } | } | ||||
| /* find lamps */ | /* find lamps */ | ||||
| for (la = bmain->lamp.first; la; la = la->id.next) { | for (la = bmain->lamp.first; la; la = la->id.next) { | ||||
| if (mtex_use_tex(la->mtex, MAX_MTEX, tex)) { | if (mtex_use_tex(la->mtex, MAX_MTEX, tex)) { | ||||
| Show All 14 Lines | for (wo = bmain->world.first; wo; wo = wo->id.next) { | ||||
| } | } | ||||
| else if (wo->nodetree && nodes_use_tex(wo->nodetree, tex)) { | else if (wo->nodetree && nodes_use_tex(wo->nodetree, tex)) { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| else { | else { | ||||
| continue; | continue; | ||||
| } | } | ||||
| BKE_icon_changed(BKE_icon_getid(&wo->id)); | BKE_icon_changed(BKE_icon_id_ensure(&wo->id)); | ||||
| if (wo->gpumaterial.first) | if (wo->gpumaterial.first) | ||||
| GPU_material_free(&wo->gpumaterial); | GPU_material_free(&wo->gpumaterial); | ||||
| } | } | ||||
| /* find compositing nodes */ | /* find compositing nodes */ | ||||
| for (scene = bmain->scene.first; scene; scene = scene->id.next) { | for (scene = bmain->scene.first; scene; scene = scene->id.next) { | ||||
| if (scene->use_nodes && scene->nodetree) { | if (scene->use_nodes && scene->nodetree) { | ||||
| Show All 31 Lines | static void texture_changed(Main *bmain, Tex *tex) | ||||
| } | } | ||||
| } | } | ||||
| static void world_changed(Main *bmain, World *wo) | static void world_changed(Main *bmain, World *wo) | ||||
| { | { | ||||
| Material *ma; | Material *ma; | ||||
| /* icons */ | /* icons */ | ||||
| BKE_icon_changed(BKE_icon_getid(&wo->id)); | BKE_icon_changed(BKE_icon_id_ensure(&wo->id)); | ||||
| /* glsl */ | /* glsl */ | ||||
| for (ma = bmain->mat.first; ma; ma = ma->id.next) | for (ma = bmain->mat.first; ma; ma = ma->id.next) | ||||
| if (ma->gpumaterial.first) | if (ma->gpumaterial.first) | ||||
| GPU_material_free(&ma->gpumaterial); | GPU_material_free(&ma->gpumaterial); | ||||
| if (defmaterial.gpumaterial.first) | if (defmaterial.gpumaterial.first) | ||||
| GPU_material_free(&defmaterial.gpumaterial); | GPU_material_free(&defmaterial.gpumaterial); | ||||
| if (wo->gpumaterial.first) | if (wo->gpumaterial.first) | ||||
| GPU_material_free(&wo->gpumaterial); | GPU_material_free(&wo->gpumaterial); | ||||
| } | } | ||||
| static void image_changed(Main *bmain, Image *ima) | static void image_changed(Main *bmain, Image *ima) | ||||
| { | { | ||||
| Tex *tex; | Tex *tex; | ||||
| /* icons */ | /* icons */ | ||||
| BKE_icon_changed(BKE_icon_getid(&ima->id)); | BKE_icon_changed(BKE_icon_id_ensure(&ima->id)); | ||||
| /* textures */ | /* textures */ | ||||
| for (tex = bmain->tex.first; tex; tex = tex->id.next) | for (tex = bmain->tex.first; tex; tex = tex->id.next) | ||||
| if (tex->ima == ima) | if (tex->ima == ima) | ||||
| texture_changed(bmain, tex); | texture_changed(bmain, tex); | ||||
| } | } | ||||
| static void scene_changed(Main *bmain, Scene *scene) | static void scene_changed(Main *bmain, Scene *scene) | ||||
| ▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines | |||||