diff options
author | Ton Roosendaal <ton@blender.org> | 2018-04-19 18:34:44 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-19 18:35:25 +0300 |
commit | 51b796ff1528c52cc8b4079fab1003671652a4d9 (patch) | |
tree | 0dfc2d2dabe5e77959264f5b6667897569290a41 /source/blender/editors/render/render_shading.c | |
parent | 785e8a636a293941a4295e669cb5aeecfafae039 (diff) |
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
Diffstat (limited to 'source/blender/editors/render/render_shading.c')
-rw-r--r-- | source/blender/editors/render/render_shading.c | 238 |
1 files changed, 4 insertions, 234 deletions
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 270ba2a7947..c5787a1d46c 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -460,7 +460,6 @@ void OBJECT_OT_material_slot_move(wmOperatorType *ot) static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene = CTX_data_scene(C); Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data; Main *bmain = CTX_data_main(C); PointerRNA ptr, idptr; @@ -472,11 +471,8 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) } else { ma = BKE_material_add(bmain, DATA_("Material")); - - if (BKE_scene_use_new_shading_nodes(scene)) { - ED_node_shader_default(C, &ma->id); - ma->use_nodes = true; - } + ED_node_shader_default(C, &ma->id); + ma->use_nodes = true; } /* hook into UI */ @@ -536,14 +532,6 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) * pointer use also increases user, so this compensates it */ id_us_min(&tex->id); - if (ptr.id.data && GS(((ID *)ptr.id.data)->name) == ID_MA && - RNA_property_pointer_get(&ptr, prop).id.data == NULL) - { - /* In case we are assigning new texture to a material, and active slot was empty, reset 'use' flag. */ - Material *ma = (Material *)ptr.id.data; - ma->septex &= ~(1 << ma->texact); - } - RNA_id_pointer_create(&tex->id, &idptr); RNA_property_pointer_set(&ptr, prop, idptr); RNA_property_update(C, &ptr, prop); @@ -572,7 +560,6 @@ void TEXTURE_OT_new(wmOperatorType *ot) static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene = CTX_data_scene(C); World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data; Main *bmain = CTX_data_main(C); PointerRNA ptr, idptr; @@ -584,11 +571,8 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) } else { wo = BKE_world_add(bmain, DATA_("World")); - - if (BKE_scene_use_new_shading_nodes(scene)) { - ED_node_shader_default(C, &wo->id); - wo->use_nodes = true; - } + ED_node_shader_default(C, &wo->id); + wo->use_nodes = true; } /* hook into UI */ @@ -1457,15 +1441,6 @@ static int texture_slot_move_exec(bContext *C, wmOperator *op) BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act - 1, -1, 0); BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act, act - 1, 0); BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, -1, act, 0); - - if (GS(id->name) == ID_MA) { - Material *ma = (Material *)id; - int mtexuse = ma->septex & (1 << act); - ma->septex &= ~(1 << act); - ma->septex |= (ma->septex & (1 << (act - 1))) << 1; - ma->septex &= ~(1 << (act - 1)); - ma->septex |= mtexuse >> 1; - } set_active_mtex(id, act - 1); } @@ -1479,15 +1454,6 @@ static int texture_slot_move_exec(bContext *C, wmOperator *op) BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act + 1, -1, 0); BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act, act + 1, 0); BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, -1, act, 0); - - if (GS(id->name) == ID_MA) { - Material *ma = (Material *)id; - int mtexuse = ma->septex & (1 << act); - ma->septex &= ~(1 << act); - ma->septex |= (ma->septex & (1 << (act + 1))) >> 1; - ma->septex &= ~(1 << (act + 1)); - ma->septex |= mtexuse << 1; - } set_active_mtex(id, act + 1); } @@ -1524,180 +1490,6 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot) -/********************** environment map operators *********************/ - -static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *path, const char imtype) -{ - PropertyRNA *prop; - float layout[12]; - - if ((prop = RNA_struct_find_property(op->ptr, "layout"))) { - RNA_property_float_get_array(op->ptr, prop, layout); - } - else { - memcpy(layout, default_envmap_layout, sizeof(layout)); - } - - if (RE_WriteEnvmapResult(op->reports, scene, env, path, imtype, layout)) { - return OPERATOR_FINISHED; - } - else { - return OPERATOR_CANCELLED; - } - -} - -static int envmap_save_exec(bContext *C, wmOperator *op) -{ - Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; - Scene *scene = CTX_data_scene(C); - //int imtype = RNA_enum_get(op->ptr, "file_type"); - char imtype = scene->r.im_format.imtype; - char path[FILE_MAX]; - - RNA_string_get(op->ptr, "filepath", path); - - if (scene->r.scemode & R_EXTENSION) { - BKE_image_path_ensure_ext_from_imformat(path, &scene->r.im_format); - } - - WM_cursor_wait(1); - - save_envmap(op, scene, tex->env, path, imtype); - - WM_cursor_wait(0); - - WM_event_add_notifier(C, NC_TEXTURE, tex); - - return OPERATOR_FINISHED; -} - -static int envmap_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) -{ - //Scene *scene= CTX_data_scene(C); - - if (RNA_struct_property_is_set(op->ptr, "filepath")) - return envmap_save_exec(C, op); - - //RNA_enum_set(op->ptr, "file_type", scene->r.im_format.imtype); - RNA_string_set(op->ptr, "filepath", G.main->name); - WM_event_add_fileselect(C, op); - - return OPERATOR_RUNNING_MODAL; -} - -static int envmap_save_poll(bContext *C) -{ - Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; - - if (!tex) - return 0; - if (!tex->env || !tex->env->ok) - return 0; - if (tex->env->cube[1] == NULL) - return 0; - - return 1; -} - -void TEXTURE_OT_envmap_save(wmOperatorType *ot) -{ - PropertyRNA *prop; - /* identifiers */ - ot->name = "Save Environment Map"; - ot->idname = "TEXTURE_OT_envmap_save"; - ot->description = "Save the current generated Environment map to an image file"; - - /* api callbacks */ - ot->exec = envmap_save_exec; - ot->invoke = envmap_save_invoke; - ot->poll = envmap_save_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_INTERNAL; /* no undo since this doesnt modify the env-map */ - - /* properties */ - prop = RNA_def_float_array(ot->srna, "layout", 12, default_envmap_layout, 0.0f, 0.0f, - "File layout", - "Flat array describing the X,Y position of each cube face in the output image, " - "where 1 is the size of a face - order is [+Z -Z +Y -X -Y +X] " - "(use -1 to skip a face)", 0.0f, 0.0f); - RNA_def_property_flag(prop, PROP_HIDDEN); - - WM_operator_properties_filesel( - ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_SAVE, - WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA); -} - -static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; - - BKE_texture_envmap_free_data(tex->env); - - WM_event_add_notifier(C, NC_TEXTURE | NA_EDITED, tex); - - return OPERATOR_FINISHED; -} - -static int envmap_clear_poll(bContext *C) -{ - Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; - - if (!tex) - return 0; - if (!tex->env || !tex->env->ok) - return 0; - if (tex->env->cube[1] == NULL) - return 0; - - return 1; -} - -void TEXTURE_OT_envmap_clear(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Clear Environment Map"; - ot->idname = "TEXTURE_OT_envmap_clear"; - ot->description = "Discard the environment map and free it from memory"; - - /* api callbacks */ - ot->exec = envmap_clear_exec; - ot->poll = envmap_clear_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; -} - -static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Main *bmain = CTX_data_main(C); - Tex *tex; - - for (tex = bmain->tex.first; tex; tex = tex->id.next) - if (tex->env) - BKE_texture_envmap_free_data(tex->env); - - WM_event_add_notifier(C, NC_TEXTURE | NA_EDITED, tex); - - return OPERATOR_FINISHED; -} - -void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Clear All Environment Maps"; - ot->idname = "TEXTURE_OT_envmap_clear_all"; - ot->description = "Discard all environment maps in the .blend file and free them from memory"; - - /* api callbacks */ - ot->exec = envmap_clear_all_exec; - ot->poll = envmap_clear_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - /********************** material operators *********************/ /* material copy/paste */ @@ -1769,17 +1561,6 @@ static void copy_mtex_copybuf(ID *id) MTex **mtex = NULL; switch (GS(id->name)) { - case ID_MA: - mtex = &(((Material *)id)->mtex[(int)((Material *)id)->texact]); - break; - case ID_LA: - mtex = &(((Lamp *)id)->mtex[(int)((Lamp *)id)->texact]); - // la->mtex[(int)la->texact] // TODO - break; - case ID_WO: - mtex = &(((World *)id)->mtex[(int)((World *)id)->texact]); - // mtex= wrld->mtex[(int)wrld->texact]; // TODO - break; case ID_PA: mtex = &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]); break; @@ -1807,17 +1588,6 @@ static void paste_mtex_copybuf(ID *id) return; switch (GS(id->name)) { - case ID_MA: - mtex = &(((Material *)id)->mtex[(int)((Material *)id)->texact]); - break; - case ID_LA: - mtex = &(((Lamp *)id)->mtex[(int)((Lamp *)id)->texact]); - // la->mtex[(int)la->texact] // TODO - break; - case ID_WO: - mtex = &(((World *)id)->mtex[(int)((World *)id)->texact]); - // mtex= wrld->mtex[(int)wrld->texact]; // TODO - break; case ID_PA: mtex = &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]); break; |