[Bf-blender-cvs] [1e0a74f] custom-manipulators: Merge branch 'blender2.8' into custom-manipulators
Julian Eisel
noreply at git.blender.org
Fri Oct 7 16:15:40 CEST 2016
Commit: 1e0a74fc25038eca486005a3685a974cd39d644c
Author: Julian Eisel
Date: Fri Oct 7 15:44:43 2016 +0200
Branches: custom-manipulators
https://developer.blender.org/rB1e0a74fc25038eca486005a3685a974cd39d644c
Merge branch 'blender2.8' into custom-manipulators
Conflicts:
source/blender/editors/space_view3d/view3d_draw.c
===================================================================
===================================================================
diff --cc source/blender/editors/space_view3d/view3d_draw.c
index 12aa24a,584b6dc..c8ed5ff
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@@ -28,80 -28,34 +28,35 @@@
* \ingroup spview3d
*/
- #include <string.h>
- #include <stdio.h>
#include <math.h>
- #include "DNA_armature_types.h"
- #include "DNA_camera_types.h"
- #include "DNA_customdata_types.h"
- #include "DNA_object_types.h"
- #include "DNA_group_types.h"
- #include "DNA_mesh_types.h"
- #include "DNA_key_types.h"
- #include "DNA_lamp_types.h"
- #include "DNA_scene_types.h"
- #include "DNA_world_types.h"
- #include "DNA_brush_types.h"
-
- #include "MEM_guardedalloc.h"
-
- #include "BLI_blenlib.h"
- #include "BLI_math.h"
- #include "BLI_jitter.h"
- #include "BLI_utildefines.h"
- #include "BLI_endian_switch.h"
- #include "BLI_threads.h"
+ #include "BIF_gl.h"
- #include "BKE_anim.h"
#include "BKE_camera.h"
#include "BKE_context.h"
- #include "BKE_customdata.h"
- #include "BKE_DerivedMesh.h"
- #include "BKE_image.h"
- #include "BKE_key.h"
- #include "BKE_main.h"
- #include "BKE_object.h"
- #include "BKE_global.h"
- #include "BKE_paint.h"
#include "BKE_scene.h"
- #include "BKE_screen.h"
#include "BKE_unit.h"
- #include "BKE_movieclip.h"
- #include "RE_engine.h"
-
- #include "IMB_imbuf_types.h"
- #include "IMB_imbuf.h"
- #include "IMB_colormanagement.h"
-
- #include "BIF_gl.h"
- #include "BIF_glutil.h"
-
- #include "WM_api.h"
- #include "WM_types.h"
+ #include "BLI_math.h"
+ #include "BLI_rect.h"
+ #include "BLI_threads.h"
- #include "BLF_api.h"
- #include "BLT_translation.h"
+ #include "DNA_camera_types.h"
+ #include "DNA_mesh_types.h"
+ #include "DNA_object_types.h"
+ #include "DNA_view3d_types.h"
+ #include "DNA_windowmanager_types.h"
- #include "ED_armature.h"
- #include "ED_keyframing.h"
- #include "ED_gpencil.h"
#include "ED_screen.h"
- #include "ED_space_api.h"
- #include "ED_screen_types.h"
- #include "ED_transform.h"
- #include "UI_interface.h"
- #include "UI_interface_icons.h"
+ #include "GPU_immediate.h"
+
#include "UI_resources.h"
- #include "GPU_draw.h"
- #include "GPU_framebuffer.h"
- #include "GPU_material.h"
- #include "GPU_compositing.h"
- #include "GPU_extensions.h"
- #include "GPU_immediate.h"
+ #include "RE_engine.h"
+
+ #include "WM_api.h"
++#include "WM_types.h"
#include "view3d_intern.h" /* own include */
@@@ -4045,327 -929,195 +930,197 @@@ static void view3d_draw_setup_view(cons
view3d_stereo3d_setup(scene, v3d, ar);
else
view3d_main_region_setup_view(scene, v3d, ar, NULL, NULL);
+ }
- rv3d->rflag &= ~RV3D_IS_GAME_ENGINE;
- #ifdef WITH_GAMEENGINE
- if (STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME)) {
- rv3d->rflag |= RV3D_IS_GAME_ENGINE;
-
- /* Make sure LoDs are up to date */
- update_lods(scene, rv3d->viewinv[3]);
- }
- #endif
-
- /* framebuffer fx needed, we need to draw offscreen first */
- if (v3d->fx_settings.fx_flag && v3d->drawtype >= OB_SOLID) {
- GPUFXSettings fx_settings;
- BKE_screen_gpu_fx_validate(&v3d->fx_settings);
- fx_settings = v3d->fx_settings;
- if (!rv3d->compositor)
- rv3d->compositor = GPU_fx_compositor_create();
-
- if (rv3d->persp == RV3D_CAMOB && v3d->camera)
- BKE_camera_to_gpu_dof(v3d->camera, &fx_settings);
- else {
- fx_settings.dof = NULL;
- }
-
- do_compositing = GPU_fx_compositor_initialize_passes(rv3d->compositor, &ar->winrct, &ar->drawrct, &fx_settings);
- }
-
- /* clear the background */
- view3d_main_region_clear(scene, v3d, ar);
-
- /* enables anti-aliasing for 3D view drawing */
- if (win->multisamples != USER_MULTISAMPLE_NONE) {
- glEnable(GL_MULTISAMPLE);
- }
-
- /* main drawing call */
- view3d_draw_objects(C, scene, v3d, ar, grid_unit, true, false, do_compositing ? rv3d->compositor : NULL);
+ static void draw_all_objects(const bContext *C, ARegion *ar, const bool only_depth, const bool use_depth)
+ {
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ Base *base;
- /* draw depth culled manipulators - manipulators need to be updated *after* view matrix was set up */
- /* TODO depth culling manipulators is not yet supported, just drawing _3D here, should
- * later become _IN_SCENE (and draw _3D separate) */
- WM_manipulatormap_draw(ar->manipulator_map, C, WM_MANIPULATORMAP_DRAWSTEP_3D);
+ if (only_depth)
+ glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
- /* post process */
- if (do_compositing) {
- GPU_fx_do_composite_pass(rv3d->compositor, rv3d->winmat, rv3d->is_persp, scene, NULL);
+ if (only_depth || use_depth) {
+ glEnable(GL_DEPTH_TEST);
+ v3d->zbuf = true;
}
- /* Disable back anti-aliasing */
- if (win->multisamples != USER_MULTISAMPLE_NONE) {
- glDisable(GL_MULTISAMPLE);
- }
+ for (base = scene->base.first; base; base = base->next) {
+ if (v3d->lay & base->lay) {
+ /* dupli drawing */
+ if (base->object->transflag & OB_DUPLI)
+ draw_dupli_objects(scene, ar, v3d, base);
- if (v3d->lay_used != lay_used) { /* happens when loading old files or loading with UI load */
- /* find header and force tag redraw */
- ScrArea *sa = CTX_wm_area(C);
- ARegion *ar_header = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
- ED_region_tag_redraw(ar_header); /* can be NULL */
+ draw_object(scene, ar, v3d, base, 0);
+ }
}
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
- BDR_drawSketch(C);
- }
+ if (only_depth)
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- #ifdef WITH_INPUT_NDOF
- if ((U.ndof_flag & NDOF_SHOW_GUIDE) && ((rv3d->viewlock & RV3D_LOCKED) == 0) && (rv3d->persp != RV3D_CAMOB))
- /* TODO: draw something else (but not this) during fly mode */
- draw_rotation_guide(rv3d);
- #endif
+ glDisable(GL_DEPTH_TEST);
}
- static bool is_cursor_visible(Scene *scene)
+ /**
+ * Draw only the scene depth buffer
+ */
+ static void draw_depth_buffer(const bContext *C, ARegion *ar)
{
- Object *ob = OBACT;
-
- /* don't draw cursor in paint modes, but with a few exceptions */
- if (ob && ob->mode & OB_MODE_ALL_PAINT) {
- /* exception: object is in weight paint and has deforming armature in pose mode */
- if (ob->mode & OB_MODE_WEIGHT_PAINT) {
- if (BKE_object_pose_armature_get(ob) != NULL) {
- return true;
- }
- }
- /* exception: object in texture paint mode, clone brush, use_clone_layer disabled */
- else if (ob->mode & OB_MODE_TEXTURE_PAINT) {
- const Paint *p = BKE_paint_get_active(scene);
-
- if (p && p->brush && p->brush->imagepaint_tool == PAINT_TOOL_CLONE) {
- if ((scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE) == 0) {
- return true;
- }
- }
- }
-
- /* no exception met? then don't draw cursor! */
- return false;
- }
-
- return true;
+ draw_all_objects(C, ar, true, true);
}
- static void view3d_main_region_draw_info(const bContext *C, Scene *scene,
- ARegion *ar, View3D *v3d,
- const char *grid_unit, bool render_border)
+ /**
+ * Required if the shaders need it or external engines
+ * (e.g., Cycles requires depth buffer handled separately).
+ */
+ static void view3d_draw_prerender_buffers(const bContext *C, ARegion *ar, DrawData *draw_data)
{
- wmWindowManager *wm = CTX_wm_manager(C);
- RegionView3D *rv3d = ar->regiondata;
- rcti rect;
-
- /* local coordinate visible rect inside region, to accomodate overlapping ui */
- ED_region_visible_rect(ar, &rect);
-
- if (rv3d->persp == RV3D_CAMOB) {
- drawviewborder(scene, ar, v3d);
+ /* TODO viewport */
+ if (draw_data->is_render && (!draw_data->clip_border)) {
+ draw_depth_buffer(C, ar);
}
- else if (v3d->flag2 & V3D_RENDER_BORDER) {
- glLineWidth(1.0f);
- setlinestyle(3);
- cpack(0x4040FF);
+ }
- sdrawbox(v3d->render_border.xmin * ar->winx, v3d->render_border.ymin * ar->winy,
- v3d->render_border.xmax * ar->winx, v3d->render_border.ymax * ar->winy);
+ /**
+ * Draw all the plates that will fill the RGBD buffer
+ */
+ static void view3d_draw_solid_plates(const bContext *C, ARegion *ar, DrawData *draw_data)
+ {
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
- setlinestyle(0);
+ /* realtime plates */
+ if ((!draw_data->is_render) || draw_data->clip_border) {
+ view3d_draw_background(C);
+ view3d_draw_render_solid_surfaces(C, ar, true);
+ view3d_draw_render_transparent_surfaces(C);
+ view3d_draw_post_draw(C);
}
- if (v3d->flag2 & V3D_SHOW_GPENCIL) {
- /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
- ED_gpencil_draw_view3d(wm, scene, v3d, ar, false);
+ /* offline plates*/
+ if (draw_data->is_render) {
+ view3d_draw_render_draw(C, scene, ar, v3d, draw_data->clip_border, &draw_data->border_rect);
}
+ }
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
- Object *ob;
-
- /* 3d cursor */
- if (is_cursor_visible(scene)) {
- drawcursor(scene, ar, v3d);
- }
+ /**
+ * Wires, outline, ...
+ */
+ static void view3d_draw_geometry_overlay(const bContext *C)
+ {
+ view3d_draw_wire_plates(C);
+ view3d_draw_outline_plates(C);
+ }
- if (U.uiflag & USER_SHOW_ROTVIEWICON)
- draw_view_axis(rv3d, &rect);
- else
- draw_view_icon(rv3d, &rect);
+ /**
+ * Empties, lamps, parent lines, grid, ...
+ */
+ static void view3d_draw_other_elements(const bContext *C, ARegion *ar)
+ {
+ /* TODO viewport */
+ view3d_draw_grid(C, ar);
+ }
- ob = OBACT;
- if (U.uiflag & USER_DRAWVIEWINFO)
- draw_selected_name(scene, ob, &rect);
- }
+ /**
+ * Paint brushes, armatures, ...
+ */
+ static void view3d_draw_tool_ui(const bContext *C)
+ {
+ /* TODO viewport */
+ }
- if (rv3d->render_engine) {
- view3d_main_region_draw_engine_info(v3d, rv3d, ar, render_border);
- return;
- }
+ /**
+ * Blueprint images
+ */
+ static void view3d_draw_reference_images(const bContext *C)
+ {
+ /* TODO viewport */
+ }
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
- if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
- ED_scene_draw_fps(scene, &rect);
- }
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list