[Bf-blender-cvs] [7e66f8b140b] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Wed Jun 21 22:12:07 CEST 2017
Commit: 7e66f8b140bd91fcc073a6b049c4081dea9f7a28
Author: Antonio Vazquez
Date: Wed Jun 21 17:17:43 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB7e66f8b140bd91fcc073a6b049c4081dea9f7a28
Merge branch 'blender2.8' into greasepencil-object
===================================================================
===================================================================
diff --cc source/blender/blenloader/intern/versioning_280.c
index e0d52720b74,9379c605fe8..acc3991b19d
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@@ -48,16 -49,14 +50,18 @@@
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
+ #include "BKE_node.h"
#include "BKE_scene.h"
#include "BKE_workspace.h"
+#include "BKE_gpencil.h"
+#include "BKE_paint.h"
+#include "BKE_object.h"
#include "BLI_listbase.h"
+#include "BLI_math.h"
#include "BLI_mempool.h"
#include "BLI_string.h"
+ #include "BLI_utildefines.h"
#include "BLO_readfile.h"
#include "readfile.h"
diff --cc source/blender/draw/intern/draw_cache.c
index 5f3795c2ce4,4dfb9f960c2..24099eae08e
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@@ -39,54 -39,53 +39,54 @@@
#include "draw_cache_impl.h"
static struct DRWShapeCache {
- Batch *drw_single_vertice;
- Batch *drw_fullscreen_quad;
- Batch *drw_screenspace_circle;
- Batch *drw_plain_axes;
- Batch *drw_single_arrow;
- Batch *drw_cube;
- Batch *drw_circle;
- Batch *drw_square;
- Batch *drw_line;
- Batch *drw_line_endpoints;
- Batch *drw_empty_sphere;
- Batch *drw_empty_cone;
- Batch *drw_arrows;
- Batch *drw_axis_names;
- Batch *drw_image_plane;
- Batch *drw_image_plane_wire;
- Batch *drw_field_wind;
- Batch *drw_field_force;
- Batch *drw_field_vortex;
- Batch *drw_field_tube_limit;
- Batch *drw_field_cone_limit;
- Batch *drw_lamp;
- Batch *drw_lamp_sunrays;
- Batch *drw_lamp_area;
- Batch *drw_lamp_hemi;
- Batch *drw_lamp_spot;
- Batch *drw_lamp_spot_square;
- Batch *drw_speaker;
- Batch *drw_lightprobe;
- Batch *drw_bone_octahedral;
- Batch *drw_bone_octahedral_wire;
- Batch *drw_bone_box;
- Batch *drw_bone_box_wire;
- Batch *drw_bone_wire_wire;
- Batch *drw_bone_envelope;
- Batch *drw_bone_envelope_distance;
- Batch *drw_bone_envelope_wire;
- Batch *drw_bone_envelope_head_wire;
- Batch *drw_bone_point;
- Batch *drw_bone_point_wire;
- Batch *drw_bone_arrows;
- Batch *drw_camera;
- Batch *drw_camera_tria;
- Batch *drw_camera_focus;
- Batch *drw_particle_cross;
- Batch *drw_particle_circle;
- Batch *drw_particle_axis;
- Batch *drw_gpencil_axes;
+ Gwn_Batch *drw_single_vertice;
+ Gwn_Batch *drw_fullscreen_quad;
+ Gwn_Batch *drw_screenspace_circle;
+ Gwn_Batch *drw_plain_axes;
+ Gwn_Batch *drw_single_arrow;
+ Gwn_Batch *drw_cube;
+ Gwn_Batch *drw_circle;
+ Gwn_Batch *drw_square;
+ Gwn_Batch *drw_line;
+ Gwn_Batch *drw_line_endpoints;
+ Gwn_Batch *drw_empty_sphere;
+ Gwn_Batch *drw_empty_cone;
+ Gwn_Batch *drw_arrows;
+ Gwn_Batch *drw_axis_names;
+ Gwn_Batch *drw_image_plane;
+ Gwn_Batch *drw_image_plane_wire;
+ Gwn_Batch *drw_field_wind;
+ Gwn_Batch *drw_field_force;
+ Gwn_Batch *drw_field_vortex;
+ Gwn_Batch *drw_field_tube_limit;
+ Gwn_Batch *drw_field_cone_limit;
+ Gwn_Batch *drw_lamp;
+ Gwn_Batch *drw_lamp_sunrays;
+ Gwn_Batch *drw_lamp_area;
+ Gwn_Batch *drw_lamp_hemi;
+ Gwn_Batch *drw_lamp_spot;
+ Gwn_Batch *drw_lamp_spot_square;
+ Gwn_Batch *drw_speaker;
+ Gwn_Batch *drw_lightprobe;
+ Gwn_Batch *drw_bone_octahedral;
+ Gwn_Batch *drw_bone_octahedral_wire;
+ Gwn_Batch *drw_bone_box;
+ Gwn_Batch *drw_bone_box_wire;
+ Gwn_Batch *drw_bone_wire_wire;
+ Gwn_Batch *drw_bone_envelope;
+ Gwn_Batch *drw_bone_envelope_distance;
+ Gwn_Batch *drw_bone_envelope_wire;
+ Gwn_Batch *drw_bone_envelope_head_wire;
+ Gwn_Batch *drw_bone_point;
+ Gwn_Batch *drw_bone_point_wire;
+ Gwn_Batch *drw_bone_arrows;
+ Gwn_Batch *drw_camera;
+ Gwn_Batch *drw_camera_tria;
+ Gwn_Batch *drw_camera_focus;
+ Gwn_Batch *drw_particle_cross;
+ Gwn_Batch *drw_particle_circle;
+ Gwn_Batch *drw_particle_axis;
++ Gwn_Batch *drw_gpencil_axes;
} SHC = {NULL};
void DRW_shape_cache_free(void)
@@@ -483,67 -481,14 +483,67 @@@ Gwn_Batch *DRW_cache_screenspace_circle
#undef CIRCLE_RESOL
}
-/** \} */
+/* Grease Pencil object */
- Batch *DRW_cache_gpencil_axes_get(void)
++Gwn_Batch *DRW_cache_gpencil_axes_get(void)
+{
+ if (!SHC.drw_gpencil_axes) {
+ int axis;
+ float v1[3] = { 0.0f, 0.0f, 0.0f };
+ float v2[3] = { 0.0f, 0.0f, 0.0f };
+
+ /* cube data */
+ const GLfloat verts[8][3] = {
+ { -0.25f, -0.25f, -0.25f },
+ { -0.25f, -0.25f, 0.25f },
+ { -0.25f, 0.25f, -0.25f },
+ { -0.25f, 0.25f, 0.25f },
+ { 0.25f, -0.25f, -0.25f },
+ { 0.25f, -0.25f, 0.25f },
+ { 0.25f, 0.25f, -0.25f },
+ { 0.25f, 0.25f, 0.25f }
+ };
+
+ const GLubyte indices[24] = { 0, 1, 1, 3, 3, 2, 2, 0, 0, 4, 4, 5, 5, 7, 7, 6, 6, 4, 1, 5, 3, 7, 2, 6 };
+
+ /* Position Only 3D format */
+ static VertexFormat format = { 0 };
+ static unsigned pos_id;
+ if (format.attrib_ct == 0) {
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ }
+
+ VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ VertexBuffer_allocate_data(vbo, 30);
+
+ /* draw axis */
+ for (axis = 0; axis < 3; axis++) {
+ v1[axis] = 1.0f;
+ v2[axis] = -1.0f;
+
+ VertexBuffer_set_attrib(vbo, pos_id, axis * 2, v1);
+ VertexBuffer_set_attrib(vbo, pos_id, axis * 2 + 1, v2);
+
+ /* reset v1 & v2 to zero for next axis */
+ v1[axis] = v2[axis] = 0.0f;
+ }
+
+ /* draw cube */
+ for (int i = 0; i < 24; ++i) {
+ VertexBuffer_set_attrib(vbo, pos_id, i + 6, verts[indices[i]]);
+ }
+
+ SHC.drw_gpencil_axes = Batch_create(PRIM_LINES, vbo, NULL);
+ }
+ return SHC.drw_gpencil_axes;
+}
+
/* -------------------------------------------------------------------- */
/** \name Common Object API
- * \{ */
+* \{ */
- Batch *DRW_cache_object_wire_outline_get(Object *ob)
+ Gwn_Batch *DRW_cache_object_wire_outline_get(Object *ob)
{
switch (ob->type) {
case OB_MESH:
diff --cc source/blender/draw/intern/draw_cache.h
index 9594a864f82,a4fac3fe71f..bfa62fbe74f
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@@ -32,123 -32,120 +32,123 @@@ struct Object
void DRW_shape_cache_free(void);
/* Common Shapes */
- struct Batch *DRW_cache_fullscreen_quad_get(void);
- struct Batch *DRW_cache_sphere_get(void);
- struct Batch *DRW_cache_single_vert_get(void);
- struct Batch *DRW_cache_single_line_get(void);
- struct Batch *DRW_cache_single_line_endpoints_get(void);
- struct Batch *DRW_cache_screenspace_circle_get(void);
+ struct Gwn_Batch *DRW_cache_fullscreen_quad_get(void);
+ struct Gwn_Batch *DRW_cache_sphere_get(void);
+ struct Gwn_Batch *DRW_cache_single_vert_get(void);
+ struct Gwn_Batch *DRW_cache_single_line_get(void);
+ struct Gwn_Batch *DRW_cache_single_line_endpoints_get(void);
+ struct Gwn_Batch *DRW_cache_screenspace_circle_get(void);
/* Common Object */
- struct Batch *DRW_cache_object_wire_outline_get(struct Object *ob);
- struct Batch *DRW_cache_object_surface_get(struct Object *ob);
- struct Batch **DRW_cache_object_surface_material_get(struct Object *ob);
+ struct Gwn_Batch *DRW_cache_object_wire_outline_get(struct Object *ob);
+ struct Gwn_Batch *DRW_cache_object_surface_get(struct Object *ob);
+ struct Gwn_Batch **DRW_cache_object_surface_material_get(struct Object *ob);
/* Empties */
- struct Batch *DRW_cache_plain_axes_get(void);
- struct Batch *DRW_cache_single_arrow_get(void);
- struct Batch *DRW_cache_cube_get(void);
- struct Batch *DRW_cache_circle_get(void);
- struct Batch *DRW_cache_square_get(void);
- struct Batch *DRW_cache_empty_sphere_get(void);
- struct Batch *DRW_cache_empty_cone_get(void);
- struct Batch *DRW_cache_arrows_get(void);
- struct Batch *DRW_cache_axis_names_get(void);
- struct Batch *DRW_cache_image_plane_get(void);
- struct Batch *DRW_cache_image_plane_wire_get(void);
+ struct Gwn_Batch *DRW_cache_plain_axes_get(void);
+ struct Gwn_Batch *DRW_cache_single_arrow_get(void);
+ struct Gwn_Batch *DRW_cache_cube_get(void);
+ struct Gwn_Batch *DRW_cache_circle_get(void);
+ struct Gwn_Batch *DRW_cache_square_get(void);
+ struct Gwn_Batch *DRW_cache_empty_sphere_get(void);
+ struct Gwn_Batch *DRW_cache_empty_cone_get(void);
+ struct Gwn_Batch *DRW_cache_arrows_get(void);
+ struct Gwn_Batch *DRW_cache_axis_names_get(void);
+ struct Gwn_Batch *DRW_cache_image_plane_get(void);
+ struct Gwn_Batch *DRW_cache_image_plane_wire_get(void);
/* Force Field */
- struct Batch *DRW_cache_field_wind_get(void);
- struct Batch *DRW_cache_field_force_get(void);
- struct Batch *DRW_cache_field_vortex_get(void);
- struct Batch *DRW_cache_field_tube_limit_get(void);
- struct Batch *DRW_cache_field_cone_limit_get(void);
+ struct Gwn_Batch *DRW_cache_field_wind_get(void);
+ struct Gwn_Batch *DRW_cache_field_force_get(void);
+ struct Gwn_Batch *DRW_cache_field_vortex_get(void);
+ struct Gwn_Batch *DRW_cache_field_tube_limit_get(void);
+ struct Gwn_Batch *DRW_cache_field_cone_limit_get(void);
+/* Grease Pencil */
+struct Batch *DRW_cache_gpencil_axes_get(void);
+
/* Lamps */
- struct Batch *DRW_cache_lamp_get(void);
- struct Batch *DRW_cache_lamp_sunrays_get(void);
- struct Batch *DRW_cache_lamp_area_get(void);
- struct Batch *DRW_cache_lamp_hemi_get(void);
- struct Batch *DRW_cache_lamp_spot_get(void);
- struct Batch *DRW_cache_lamp_spot_square_get(void);
+ struct Gwn_Batch *DRW_cache_lamp_get(void);
+ struct Gwn_Batch *DRW_cache_lamp_sunrays_get(void);
+ struct Gwn_Batch *DRW_cache_lamp_area_get(void);
+ struct Gwn_Batch *DRW_cache_lamp_hemi_get(void);
+ struct Gwn_Batch *DRW_cache_lamp_spot_get(void);
+ struct Gwn_Batch *DRW_cache_lamp_spot_square_get(void);
/* Camera */
- struct Batch *DRW_cache_camera_get(void);
- struct Batch *DRW_cache_camera_tria_get(void);
+ struct Gwn_Batch *DRW_cache_camera_get(void);
+ struct Gwn_Batch *DRW_cache_camera_tria_get(void);
/* Speaker */
- struct Batch *DRW_cache_speaker_get(void);
+ struct Gwn_Batch *DRW_cache_speaker_get(void);
/* Probe */
- struct Batch *DRW_cache_lightprobe_get(void);
+ struct Gwn_Batch *DRW_cache_lightprobe_get(void);
/* Bones */
- struct Batch *DRW_cache_bone_octahedral_get(void);
- struct Batch *DRW_cache_bone_octahedral_wire_outline_get(void);
- struct Batch *DRW_cache_bone_box_get(void);
- struct Batc
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list