2008-12-30 13:16:14 +00:00
|
|
|
/**
|
|
|
|
* $Id:
|
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Internal for editmesh_xxxx.c functions */
|
|
|
|
|
2009-01-01 13:15:35 +00:00
|
|
|
#ifndef MESH_INTERN_H
|
|
|
|
#define MESH_INTERN_H
|
2008-12-30 13:16:14 +00:00
|
|
|
|
2009-02-02 03:25:23 +00:00
|
|
|
#include "BLI_editVert.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
|
2008-12-30 16:03:29 +00:00
|
|
|
struct bContext;
|
2009-01-01 13:15:35 +00:00
|
|
|
struct wmOperatorType;
|
2009-01-09 18:32:33 +00:00
|
|
|
struct ViewContext;
|
2008-12-30 13:16:14 +00:00
|
|
|
|
|
|
|
#define UVCOPY(t, s) memcpy(t, s, 2 * sizeof(float));
|
|
|
|
|
|
|
|
/* ******************** editface.c */
|
|
|
|
|
|
|
|
int edgetag_context_check(Scene *scene, EditEdge *eed);
|
|
|
|
void edgetag_context_set(Scene *scene, EditEdge *eed, int val);
|
|
|
|
int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge *target);
|
|
|
|
|
|
|
|
/* ******************* editmesh.c */
|
|
|
|
|
|
|
|
extern void free_editvert(EditMesh *em, EditVert *eve);
|
|
|
|
extern void free_editedge(EditMesh *em, EditEdge *eed);
|
|
|
|
extern void free_editface(EditMesh *em, EditFace *efa);
|
|
|
|
void free_editMesh(EditMesh *em);
|
|
|
|
|
Replaced unified extrude edges/faces code (the stuff specificaly for
edges/faces,extrudeflag_edgess, not the entire extrude system) with
a bmesh version. This stress-tested the operator api, and I had to
code some new stuff,including:
* An api to iterate over Mapping slots and array slots. It's modeled
after the normal iterator api.
* The ability to copy mapping slots.
* More mapping functions.
* In addition to being able to flag elements in a buffer,
you can now unflag them (much clearer then passing in ~flag
I think).
The extrude edge/faces code has multiple layers. At the top
level is a funtion in editmesh_lib.c, which takes care of selection,
handles mirror modifiers, etc. It calls the extrude operator, which
in turns calls split, which calls dupe/del. Note that split needed
a slot to exclude things from being deleting (e.g. when extruding
a single isolated face).
The basic idea (reflected in original design of split/dupe/del by Briggs)
is to use the split function to do the heavy work of extrude. split spits
out new geometry and mappings from boundary edges, for extrude (it should
also spit out other mappings, but that's for later).
Briggs: you may want to look over this, hopefully I didn't do anything
too evil.
I probably should spend some time going over the 2.5 mesh operators and
cleaning them up, splitting ones that need splitting, etc, and in general
getting them to work properly.
2009-02-12 16:59:51 +00:00
|
|
|
/*frees dst mesh, then copies the contents of
|
|
|
|
*src (the struct) to dst. */
|
|
|
|
void set_editMesh(EditMesh *dst, EditMesh *src);
|
|
|
|
|
2008-12-30 13:16:14 +00:00
|
|
|
extern void free_vertlist(EditMesh *em, ListBase *edve);
|
|
|
|
extern void free_edgelist(EditMesh *em, ListBase *lb);
|
|
|
|
extern void free_facelist(EditMesh *em, ListBase *lb);
|
|
|
|
|
|
|
|
extern void remedge(EditMesh *em, EditEdge *eed);
|
|
|
|
|
|
|
|
extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example);
|
|
|
|
extern struct EditEdge *addedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditEdge *example);
|
|
|
|
extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges);
|
|
|
|
extern struct EditEdge *findedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2);
|
|
|
|
|
|
|
|
EditVert *editedge_getOtherVert(EditEdge *eed, EditVert *eve);
|
|
|
|
EditVert *editedge_getSharedVert(EditEdge *eed, EditEdge *eed2);
|
|
|
|
int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve);
|
|
|
|
int editface_containsVert(struct EditFace *efa, struct EditVert *eve);
|
|
|
|
int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
|
|
|
|
|
2009-01-09 18:32:33 +00:00
|
|
|
void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc);
|
2008-12-30 16:03:29 +00:00
|
|
|
|
2009-01-30 15:01:14 +00:00
|
|
|
void MESH_OT_separate(struct wmOperatorType *ot);
|
|
|
|
|
2008-12-30 13:16:14 +00:00
|
|
|
/* ******************* editmesh_add.c */
|
2.5
Editmesh: add primitive basics back. Had to clean up a load of
crap there... but it's sorta in control, so I think Shul can
pick it up again.
Test: ctrl+0 adds plane, or ctrl+9 adds grid.
Notes for Shul:
- i've added a transform function, which gets correctly passed
on to the add_prim function, should work for all object
transforms. Only the code inside add_prim might be needed
to check (it uses 4x4 mat now, not a 3x3)
- The old code with buttons has been ifdeffed out, check for
user input and make it rna properties, which get read
in the exec(), and handed over to the add_prim. Set them
default now to the values from old buttons.
- Operator naming is preferred lower case, I gave this
a new name.
- check a bit on formatting code, but don't use the old code
as example! Look also at ED_keymap_mesh() for example.
2009-01-14 19:26:11 +00:00
|
|
|
void MESH_OT_add_primitive_plane(struct wmOperatorType *ot);
|
2009-01-15 03:05:19 +00:00
|
|
|
void MESH_OT_add_primitive_cube(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_add_primitive_circle(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_add_primitive_cylinder(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_add_primitive_tube(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_add_primitive_cone(struct wmOperatorType *ot);
|
2.5
Editmesh: add primitive basics back. Had to clean up a load of
crap there... but it's sorta in control, so I think Shul can
pick it up again.
Test: ctrl+0 adds plane, or ctrl+9 adds grid.
Notes for Shul:
- i've added a transform function, which gets correctly passed
on to the add_prim function, should work for all object
transforms. Only the code inside add_prim might be needed
to check (it uses 4x4 mat now, not a 3x3)
- The old code with buttons has been ifdeffed out, check for
user input and make it rna properties, which get read
in the exec(), and handed over to the add_prim. Set them
default now to the values from old buttons.
- Operator naming is preferred lower case, I gave this
a new name.
- check a bit on formatting code, but don't use the old code
as example! Look also at ED_keymap_mesh() for example.
2009-01-14 19:26:11 +00:00
|
|
|
void MESH_OT_add_primitive_grid(struct wmOperatorType *ot);
|
2009-01-15 03:05:19 +00:00
|
|
|
void MESH_OT_add_primitive_monkey(struct wmOperatorType *ot);
|
2009-01-15 18:28:40 +00:00
|
|
|
void MESH_OT_add_primitive_uv_sphere(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_add_primitive_ico_sphere(struct wmOperatorType *ot);
|
2.5
- Edit mesh: Add ctrl+click add vertex or extrude.
I've made it not move the 3d cursor in that case.
Also found out tweak events conflicted with existing
keymap definitions; on tweak failure (= no mousemove)
it now passes on the mouse event as 'mouse down' for
the remaining keymaps to check.
These then actually respond to mouse-up instead of down...
The location in the keymaps where tweaks get generated
remains important. Examples:
1 - 'select' mouse-handler, operator return pass-through
2 - tweak handler checks, and makes tweak event
3 - grabber responds to tweak event
1 - ctrl+mouse tweak handler checks, makes tweak event,
or passes event on
2 - if tweak event, it runs lasso
3 - else when passed on, ctrl+click extrude happens
In the first case, select works on mouse-down, immediate.
In the second case, extrude happens on mouse-release, even
though the keymap defined mouse-press.
This will make designing nice balanced keymaps still not
simple; especially because you can't tell operators to
pass on the key... although we can add the convention that
select-mouse operators always pass on to enable tweaks.
Still a good reason to wait with custom keymaps
when this is fully settled!
2009-01-30 18:18:41 +00:00
|
|
|
void MESH_OT_dupli_extrude_cursor(struct wmOperatorType *ot);
|
2009-01-30 19:14:50 +00:00
|
|
|
void MESH_OT_add_edge_face(struct wmOperatorType *ot);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
2009-01-31 03:23:41 +00:00
|
|
|
void MESH_OT_make_fgon(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_clear_fgon(struct wmOperatorType *ot);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
|
|
|
/* ******************* editmesh_lib.c */
|
2009-01-15 15:01:39 +00:00
|
|
|
void EM_stats_update(EditMesh *em);
|
|
|
|
|
2008-12-30 13:16:14 +00:00
|
|
|
extern void EM_fgon_flags(EditMesh *em);
|
|
|
|
extern void EM_hide_reset(EditMesh *em);
|
|
|
|
|
|
|
|
extern int faceselectedOR(EditFace *efa, int flag);
|
|
|
|
extern int faceselectedAND(EditFace *efa, int flag);
|
|
|
|
|
|
|
|
void EM_remove_selection(EditMesh *em, void *data, int type);
|
|
|
|
void EM_clear_flag_all(EditMesh *em, int flag);
|
|
|
|
void EM_set_flag_all(EditMesh *em, int flag);
|
|
|
|
|
|
|
|
void EM_data_interp_from_verts(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *eve, float fac);
|
|
|
|
void EM_data_interp_from_faces(EditMesh *em, EditFace *efa1, EditFace *efa2, EditFace *efan, int i1, int i2, int i3, int i4);
|
|
|
|
|
|
|
|
int EM_nvertices_selected(EditMesh *em);
|
2009-01-15 15:01:39 +00:00
|
|
|
int EM_nedges_selected(EditMesh *em);
|
2008-12-30 13:16:14 +00:00
|
|
|
int EM_nfaces_selected(EditMesh *em);
|
2009-01-15 15:01:39 +00:00
|
|
|
|
2008-12-30 13:16:14 +00:00
|
|
|
float EM_face_perimeter(EditFace *efa);
|
|
|
|
|
|
|
|
void EM_store_selection(EditMesh *em, void *data, int type);
|
|
|
|
|
|
|
|
extern EditFace *exist_face(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4);
|
|
|
|
extern void flipface(EditMesh *em, EditFace *efa); // flips for normal direction
|
|
|
|
extern int compareface(EditFace *vl1, EditFace *vl2);
|
|
|
|
|
|
|
|
/* flag for selection bits, *nor will be filled with normal for extrusion constraint */
|
|
|
|
/* return value defines if such normal was set */
|
|
|
|
extern short extrudeflag_face_indiv(EditMesh *em, short flag, float *nor);
|
|
|
|
extern short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor);
|
|
|
|
extern short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor);
|
2009-01-02 19:10:35 +00:00
|
|
|
extern short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor);
|
|
|
|
extern short extrudeflag(Object *obedit, EditMesh *em, short flag, float *nor);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
|
|
|
extern void adduplicateflag(EditMesh *em, int flag);
|
|
|
|
extern void delfaceflag(EditMesh *em, int flag);
|
|
|
|
|
|
|
|
extern void rotateflag(EditMesh *em, short flag, float *cent, float rotmat[][3]);
|
|
|
|
extern void translateflag(EditMesh *em, short flag, float *vec);
|
|
|
|
|
|
|
|
extern int convex(float *v1, float *v2, float *v3, float *v4);
|
|
|
|
|
|
|
|
extern struct EditFace *EM_face_from_faces(EditMesh *em, struct EditFace *efa1,
|
|
|
|
struct EditFace *efa2, int i1, int i2, int i3, int i4);
|
|
|
|
|
|
|
|
|
|
|
|
/* ******************* editmesh_loop.c */
|
|
|
|
|
|
|
|
#define LOOP_SELECT 1
|
|
|
|
#define LOOP_CUT 2
|
|
|
|
|
2009-02-07 15:44:16 +00:00
|
|
|
void MESH_OT_knife_cut(struct wmOperatorType *ot);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
|
|
|
/* ******************* editmesh_mods.c */
|
2009-01-30 18:53:54 +00:00
|
|
|
void MESH_OT_loop_select(struct wmOperatorType *ot);
|
2009-01-01 13:15:35 +00:00
|
|
|
void MESH_OT_de_select_all(struct wmOperatorType *ot);
|
2009-01-19 02:35:26 +00:00
|
|
|
void MESH_OT_bmesh_test(struct wmOperatorType *ot);
|
2009-01-13 02:09:58 +00:00
|
|
|
void MESH_OT_select_more(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_select_less(struct wmOperatorType *ot);
|
2009-02-01 12:40:27 +00:00
|
|
|
void MESH_OT_select_invert(struct wmOperatorType *ot);
|
2009-01-13 02:09:58 +00:00
|
|
|
void MESH_OT_select_non_manifold(struct wmOperatorType *ot);
|
2009-02-01 12:40:27 +00:00
|
|
|
void MESH_OT_select_linked(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_select_linked_pick(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_hide(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_reveal(struct wmOperatorType *ot);
|
2009-01-31 15:21:26 +00:00
|
|
|
void MESH_OT_consistant_normals(struct wmOperatorType *ot);
|
2009-01-13 02:09:58 +00:00
|
|
|
void MESH_OT_select_linked_flat_faces(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_select_sharp_edges(struct wmOperatorType *ot);
|
2009-01-31 13:30:56 +00:00
|
|
|
void MESH_OT_shortest_path_select(struct wmOperatorType *ot);
|
2009-01-31 15:21:26 +00:00
|
|
|
void MESH_OT_similar_vertex_select(struct wmOperatorType *ot);
|
2009-01-31 16:54:37 +00:00
|
|
|
void MESH_OT_similar_edge_select(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_similar_face_select(struct wmOperatorType *ot);
|
2009-02-01 12:40:27 +00:00
|
|
|
void MESH_OT_select_random(struct wmOperatorType *ot);
|
2009-02-01 00:18:45 +00:00
|
|
|
void MESH_OT_vertices_to_sphere(struct wmOperatorType *ot);
|
2009-02-01 12:40:27 +00:00
|
|
|
void MESH_OT_selection_type(struct wmOperatorType *ot);
|
2009-02-02 19:59:22 +00:00
|
|
|
void MESH_OT_select_multi_loop(struct wmOperatorType *ot);
|
2009-02-04 02:58:21 +00:00
|
|
|
void MESH_OT_mark_seam(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_mark_sharp(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_smooth_vertex(struct wmOperatorType *ot);
|
2009-02-05 01:32:37 +00:00
|
|
|
void MESH_OT_flip_editnormals(struct wmOperatorType *ot);
|
2009-01-13 02:09:58 +00:00
|
|
|
|
2009-01-09 18:32:33 +00:00
|
|
|
extern EditEdge *findnearestedge(struct ViewContext *vc, int *dist);
|
2008-12-30 13:16:14 +00:00
|
|
|
extern void EM_automerge(int update);
|
|
|
|
void editmesh_select_by_material(EditMesh *em, int index);
|
|
|
|
void righthandfaces(EditMesh *em, int select); /* makes faces righthand turning */
|
|
|
|
void EM_select_more(EditMesh *em);
|
2009-01-30 15:01:14 +00:00
|
|
|
void selectconnected_mesh_all(EditMesh *em);
|
2009-02-19 19:03:53 +00:00
|
|
|
void faceloop_select(EditMesh *em, EditEdge *startedge, int select);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* findnearestvert
|
|
|
|
*
|
|
|
|
* dist (in/out): minimal distance to the nearest and at the end, actual distance
|
|
|
|
* sel: selection bias
|
|
|
|
* if SELECT, selected vertice are given a 5 pixel bias to make them farter than unselect verts
|
|
|
|
* if 0, unselected vertice are given the bias
|
|
|
|
* strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased
|
|
|
|
*/
|
2009-01-09 18:32:33 +00:00
|
|
|
extern EditVert *findnearestvert(struct ViewContext *vc, int *dist, short sel, short strict);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ******************* editmesh_tools.c */
|
|
|
|
|
|
|
|
#define SUBDIV_SELECT_ORIG 0
|
|
|
|
#define SUBDIV_SELECT_INNER 1
|
|
|
|
#define SUBDIV_SELECT_INNER_SEL 2
|
|
|
|
#define SUBDIV_SELECT_LOOPCUT 3
|
|
|
|
|
|
|
|
void join_triangles(EditMesh *em);
|
|
|
|
int removedoublesflag(EditMesh *em, short flag, short automerge, float limit); /* return amount */
|
2009-01-02 19:10:35 +00:00
|
|
|
void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beauty, int numcuts, int seltype);
|
2009-02-28 12:49:18 +00:00
|
|
|
int EdgeSlide(EditMesh *em, struct wmOperator *op, short immediate, float imperc);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
2009-01-19 18:36:54 +00:00
|
|
|
void MESH_OT_subdivs(struct wmOperatorType *ot);
|
2009-01-16 04:48:33 +00:00
|
|
|
void MESH_OT_subdivide(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_subdivide_multi(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_subdivide_multi_fractal(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_subdivide_smooth(struct wmOperatorType *ot);
|
2009-01-23 03:07:07 +00:00
|
|
|
void MESH_OT_removedoublesflag(struct wmOperatorType *ot);
|
2009-02-01 12:40:27 +00:00
|
|
|
void MESH_OT_extrude(struct wmOperatorType *ot);
|
2009-02-16 20:04:01 +00:00
|
|
|
void MESH_OT_spin(struct wmOperatorType *ot);
|
2009-02-18 03:01:45 +00:00
|
|
|
void MESH_OT_screw(struct wmOperatorType *ot);
|
2009-01-24 22:21:12 +00:00
|
|
|
|
2009-02-01 12:40:27 +00:00
|
|
|
void MESH_OT_fill(struct wmOperatorType *ot);
|
2009-01-24 22:21:12 +00:00
|
|
|
void MESH_OT_beauty_fill(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_convert_quads_to_tris(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_convert_tris_to_quads(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_edge_flip(struct wmOperatorType *ot);
|
2009-02-01 04:22:18 +00:00
|
|
|
void MESH_OT_faces_shade_smooth(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_faces_shade_solid(struct wmOperatorType *ot);
|
2009-02-07 23:20:36 +00:00
|
|
|
void MESH_OT_split_mesh(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_extrude_repeat(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_edge_rotate_selected(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_loop_to_region(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_region_to_loop(struct wmOperatorType *ot);
|
|
|
|
|
|
|
|
void MESH_OT_rotate_uvs(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_mirror_uvs(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_rotate_colors(struct wmOperatorType *ot);
|
|
|
|
void MESH_OT_mirror_colors(struct wmOperatorType *ot);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
2009-02-01 12:40:27 +00:00
|
|
|
void MESH_OT_delete(struct wmOperatorType *ot);
|
2009-02-19 19:03:53 +00:00
|
|
|
void MESH_OT_rip(struct wmOperatorType *ot);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
2009-01-01 13:15:35 +00:00
|
|
|
#endif // MESH_INTERN_H
|
2008-12-30 13:16:14 +00:00
|
|
|
|