Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-12-05 01:49:55 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-12-05 01:49:55 +0300
commit3c6709a63c267dc3cb3898efd9d6466c2300876c (patch)
tree522d9cd6f83c09f9a9ba92b858b307cc0b073867 /source/blender/bmesh/intern
parent24be453938c49cd45d910a8ad0ee144fddd843ee (diff)
Fix T37879: Default UV generation for mesh primitives.
Adds default-generated UVs to mesh primitives (cone, cylinder, icosphere, uvsphere, cube, circle, grid) when they are added to the scene, since some of them can be pretty awkward to unwrap manually. Original patch: Liam Mitchell (CommanderCorianderSalamander). Main review work: Campbell Barton (campbellbarton). Finalization, fixes and cleanup: Bastien Montagne (mont29). Reviewers: mont29, #mesh_modeling, campbellbarton Reviewed By: mont29, campbellbarton Subscribers: lkruel, campbellbarton, michaelknubben, kevindietrich Maniphest Tasks: T37879 Differential Revision: https://developer.blender.org/D481
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c6
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h8
2 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index d92bdc6ea69..72a8dac534a 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1567,6 +1567,7 @@ static BMOpDefine bmo_create_grid_def = {
{"y_segments", BMO_OP_SLOT_INT}, /* number of y segments */
{"size", BMO_OP_SLOT_FLT}, /* size of the grid */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
+ {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
{{'\0'}},
},
/* slots_out */
@@ -1590,6 +1591,7 @@ static BMOpDefine bmo_create_uvsphere_def = {
{"v_segments", BMO_OP_SLOT_INT}, /* number of v segment */
{"diameter", BMO_OP_SLOT_FLT}, /* diameter */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
+ {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
{{'\0'}},
},
/* slots_out */
@@ -1612,6 +1614,7 @@ static BMOpDefine bmo_create_icosphere_def = {
{{"subdivisions", BMO_OP_SLOT_INT}, /* how many times to recursively subdivide the sphere */
{"diameter", BMO_OP_SLOT_FLT}, /* diameter */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
+ {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
{{'\0'}},
},
/* slots_out */
@@ -1658,6 +1661,7 @@ static BMOpDefine bmo_create_cone_def = {
{"diameter2", BMO_OP_SLOT_FLT}, /* diameter of the opposite */
{"depth", BMO_OP_SLOT_FLT}, /* distance between ends */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
+ {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
{{'\0'}},
},
/* slots_out */
@@ -1680,6 +1684,7 @@ static BMOpDefine bmo_create_circle_def = {
{"segments", BMO_OP_SLOT_INT},
{"diameter", BMO_OP_SLOT_FLT}, /* diameter of one end */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
+ {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
{{'\0'}},
},
/* slots_out */
@@ -1701,6 +1706,7 @@ static BMOpDefine bmo_create_cube_def = {
/* slots_in */
{{"size", BMO_OP_SLOT_FLT}, /* size of the cube */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
+ {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
{{'\0'}},
},
/* slots_out */
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index d9961e589da..0a4fb1d56a4 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -141,6 +141,14 @@ void BM_mesh_esubdivide(
const short use_only_quads,
const int seed);
+void BM_mesh_calc_uvs_grid(BMesh *bm, const unsigned int x_segments, const unsigned int y_segments, const short oflag);
+void BM_mesh_calc_uvs_sphere(BMesh *bm, const short oflag);
+void BM_mesh_calc_uvs_circle(BMesh *bm, float mat[4][4], const float radius, const short oflag);
+void BM_mesh_calc_uvs_cone(
+ BMesh *bm, float mat[4][4],
+ const float radius_top, const float radius_bottom, const int segments, const bool cap_ends, const short oflag);
+void BM_mesh_calc_uvs_cube(BMesh *bm, const short oflag);
+
#include "intern/bmesh_operator_api_inline.h"
#endif /* __BMESH_OPERATORS_H__ */