From 2a2bf3c1ab1f9f844a66d1f5f69232d64e16d678 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 19 Mar 2015 14:33:05 +1100 Subject: Freestyle: pass Main struct to new/copy --- source/blender/editors/render/render_shading.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/render/render_shading.c') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index ff90f48d705..75b8b8cebde 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -731,10 +731,11 @@ void SCENE_OT_freestyle_module_move(wmOperatorType *ot) static int freestyle_lineset_add_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - BKE_freestyle_lineset_add(&srl->freestyleConfig, NULL); + BKE_freestyle_lineset_add(bmain, &srl->freestyleConfig, NULL); DAG_id_tag_update(&scene->id, 0); WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -893,6 +894,7 @@ void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot) static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig); @@ -903,10 +905,10 @@ static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op) } if (lineset->linestyle) { lineset->linestyle->id.us--; - lineset->linestyle = BKE_linestyle_copy(lineset->linestyle); + lineset->linestyle = BKE_linestyle_copy(bmain, lineset->linestyle); } else { - lineset->linestyle = BKE_linestyle_new("LineStyle", NULL); + lineset->linestyle = BKE_linestyle_new(bmain, "LineStyle"); } DAG_id_tag_update(&lineset->linestyle->id, 0); WM_event_add_notifier(C, NC_LINESTYLE, lineset->linestyle); -- cgit v1.2.3 From 8a183aa26bc34fe441ba1ad3e5f2c307ed54f6b7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 29 Mar 2015 03:16:55 +1100 Subject: Cleanup: use BKE_texture_ prefix --- source/blender/editors/render/render_shading.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/render/render_shading.c') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 75b8b8cebde..cf712a653e6 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -450,7 +450,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) tex = BKE_texture_copy(tex); } else { - tex = add_texture(bmain, DATA_("Texture")); + tex = BKE_texture_add(bmain, DATA_("Texture")); } /* hook into UI */ @@ -1492,7 +1492,7 @@ static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; - BKE_free_envmapdata(tex->env); + BKE_texture_envmap_free_data(tex->env); WM_event_add_notifier(C, NC_TEXTURE | NA_EDITED, tex); @@ -1535,7 +1535,7 @@ static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op)) for (tex = bmain->tex.first; tex; tex = tex->id.next) if (tex->env) - BKE_free_envmapdata(tex->env); + BKE_texture_envmap_free_data(tex->env); WM_event_add_notifier(C, NC_TEXTURE | NA_EDITED, tex); -- cgit v1.2.3 From d5f1b9c2223333e03f2e4994171ad9df8c1c4f21 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 6 Apr 2015 10:40:12 -0300 Subject: Multi-View and Stereo 3D Official Documentation: http://www.blender.org/manual/render/workflows/multiview.html Implemented Features ==================== Builtin Stereo Camera * Convergence Mode * Interocular Distance * Convergence Distance * Pivot Mode Viewport * Cameras * Plane * Volume Compositor * View Switch Node * Image Node Multi-View OpenEXR support Sequencer * Image/Movie Strips 'Use Multiview' UV/Image Editor * Option to see Multi-View images in Stereo-3D or its individual images * Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images I/O * Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images Scene Render Views * Ability to have an arbitrary number of views in the scene Missing Bits ============ First rule of Multi-View bug report: If something is not working as it should *when Views is off* this is a severe bug, do mention this in the report. Second rule is, if something works *when Views is off* but doesn't (or crashes) when *Views is on*, this is a important bug. Do mention this in the report. Everything else is likely small todos, and may wait until we are sure none of the above is happening. Apart from that there are those known issues: * Compositor Image Node poorly working for Multi-View OpenEXR (this was working prefectly before the 'Use Multi-View' functionality) * Selecting camera from Multi-View when looking from camera is problematic * Animation Playback (ctrl+F11) doesn't support stereo formats * Wrong filepath when trying to play back animated scene * Viewport Rendering doesn't support Multi-View * Overscan Rendering * Fullscreen display modes need to warn the user * Object copy should be aware of views suffix Acknowledgments =============== * Francesco Siddi for the help with the original feature specs and design * Brecht Van Lommel for the original review of the code and design early on * Blender Foundation for the Development Fund to support the project wrap up Final patch reviewers: * Antony Riakiotakis (psy-fi) * Campbell Barton (ideasman42) * Julian Eisel (Severin) * Sergey Sharybin (nazgul) * Thomas Dinged (dingto) Code contributors of the original branch in github: * Alexey Akishin * Gabriel Caraballo --- source/blender/editors/render/render_shading.c | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'source/blender/editors/render/render_shading.c') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index cf712a653e6..3de21536148 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -605,6 +605,70 @@ void SCENE_OT_render_layer_remove(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; } +/********************** render view operators *********************/ + +static int render_view_remove_poll(bContext *C) +{ + Scene *scene = CTX_data_scene(C); + + /* don't allow user to remove "left" and "right" views */ + return scene->r.actview > 1; +} + +static int render_view_add_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene = CTX_data_scene(C); + + BKE_scene_add_render_view(scene, NULL); + scene->r.actview = BLI_listbase_count(&scene->r.views) - 1; + + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + + return OPERATOR_FINISHED; +} + +void SCENE_OT_render_view_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Add Render View"; + ot->idname = "SCENE_OT_render_view_add"; + ot->description = "Add a render view"; + + /* api callbacks */ + ot->exec = render_view_add_exec; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +static int render_view_remove_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene = CTX_data_scene(C); + SceneRenderView *rv = BLI_findlink(&scene->r.views, scene->r.actview); + + if (!BKE_scene_remove_render_view(scene, rv)) + return OPERATOR_CANCELLED; + + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + + return OPERATOR_FINISHED; +} + +void SCENE_OT_render_view_remove(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Remove Render View"; + ot->idname = "SCENE_OT_render_view_remove"; + ot->description = "Remove the selected render view"; + + /* api callbacks */ + ot->exec = render_view_remove_exec; + ot->poll = render_view_remove_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + #ifdef WITH_FREESTYLE static bool freestyle_linestyle_check_report(FreestyleLineSet *lineset, ReportList *reports) -- cgit v1.2.3 From 4288ab16e5c83bd0763d8ee580731d9ea7eacde1 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Tue, 28 Apr 2015 07:24:56 +1000 Subject: Add material slot reorder buttons --- source/blender/editors/render/render_shading.c | 70 +++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/render/render_shading.c') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 3de21536148..88f522a2615 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -41,8 +41,9 @@ #include "DNA_space_types.h" #include "DNA_world_types.h" -#include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_math_vector.h" #include "BLF_translation.h" @@ -381,6 +382,73 @@ void OBJECT_OT_material_slot_copy(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; } +static int material_slot_move_exec(bContext *C, wmOperator *op) +{ + Object *ob = ED_object_context(C); + + unsigned int *slot_remap; + int index_pair[2]; + + int dir = RNA_enum_get(op->ptr, "direction"); + + if (!ob || ob->totcol < 2) { + return OPERATOR_CANCELLED; + } + + /* up */ + if (dir == 1 && ob->actcol > 1) { + index_pair[0] = ob->actcol - 2; + index_pair[1] = ob->actcol - 1; + ob->actcol--; + } + /* down */ + else if (dir == -1 && ob->actcol < ob->totcol) { + index_pair[0] = ob->actcol - 1; + index_pair[1] = ob->actcol - 0; + ob->actcol++; + } + else { + return OPERATOR_CANCELLED; + } + + slot_remap = MEM_mallocN(sizeof(unsigned int) * ob->totcol, __func__); + + range_vn_u(slot_remap, ob->totcol, 0); + + slot_remap[index_pair[0]] = index_pair[1]; + slot_remap[index_pair[1]] = index_pair[0]; + + BKE_material_remap_object(ob, slot_remap); + + MEM_freeN(slot_remap); + + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW | ND_DATA, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_material_slot_move(wmOperatorType *ot) +{ + static EnumPropertyItem material_slot_move[] = { + {1, "UP", 0, "Up", ""}, + {-1, "DOWN", 0, "Down", ""}, + {0, NULL, 0, NULL, NULL} + }; + + /* identifiers */ + ot->name = "Move Material"; + ot->idname = "OBJECT_OT_material_slot_move"; + ot->description = "Move the active material up/down in the list"; + + /* api callbacks */ + ot->exec = material_slot_move_exec; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_enum(ot->srna, "direction", material_slot_move, 0, "Direction", "Direction to move, UP or DOWN"); +} + /********************** new material operator *********************/ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) -- cgit v1.2.3 From 5c6ec169ccb257a0f1d7f0aafa83f3d5ff866ba1 Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Tue, 28 Apr 2015 10:52:19 +0200 Subject: Added missing update tag to recalculate data after permutating materials --- source/blender/editors/render/render_shading.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/editors/render/render_shading.c') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 88f522a2615..617364c7e74 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -422,6 +422,7 @@ static int material_slot_move_exec(bContext *C, wmOperator *op) MEM_freeN(slot_remap); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW | ND_DATA, ob); return OPERATOR_FINISHED; -- cgit v1.2.3 From be228d33f165b10327b06ae77bb21ab1a437a16a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 29 Apr 2015 00:19:34 +1000 Subject: Curves: don't use 'charidx' for regular curves Code attempted to sync them with materials, but its not needed (and wasn't reliable). --- source/blender/editors/render/render_shading.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/render/render_shading.c') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 617364c7e74..3b8b874a462 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -203,7 +203,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op)) if (nurbs) { for (nu = nurbs->first; nu; nu = nu->next) if (isNurbsel(nu)) - nu->mat_nr = nu->charidx = ob->actcol - 1; + nu->mat_nr = ob->actcol - 1; } } else if (ob->type == OB_FONT) { -- cgit v1.2.3