Blender V2.61 - r43446
Classes | Typedefs | Functions

uvedit_ops.c File Reference

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_node.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "ED_image.h"
#include "ED_mesh.h"
#include "ED_node.h"
#include "ED_uvedit.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_view2d.h"
#include "uvedit_intern.h"

Go to the source code of this file.

Classes

struct  NearestHit
struct  UVVertAverage

Typedefs

typedef struct NearestHit NearestHit
typedef struct UVVertAverage UVVertAverage

Functions

int ED_uvedit_test (Object *obedit)
static int is_image_texture_node (bNode *node)
int ED_object_get_active_image (Object *ob, int mat_nr, Image **ima, ImageUser **iuser, bNode **node_r)
void ED_object_assign_active_image (Main *bmain, Object *ob, int mat_nr, Image *ima)
void ED_uvedit_assign_image (Main *bmain, Scene *scene, Object *obedit, Image *ima, Image *previma)
static int uvedit_set_tile (Object *obedit, Image *ima, int curtile)
static void uvedit_pixel_to_float (SpaceImage *sima, float *dist, float pixeldist)
int uvedit_face_visible_nolocal (Scene *scene, EditFace *efa)
int uvedit_face_visible (Scene *scene, Image *ima, EditFace *efa, MTFace *tf)
int uvedit_face_selected (Scene *scene, EditFace *efa, MTFace *tf)
void uvedit_face_select (Scene *scene, EditFace *efa, MTFace *tf)
void uvedit_face_deselect (Scene *scene, EditFace *efa, MTFace *tf)
int uvedit_edge_selected (Scene *scene, EditFace *efa, MTFace *tf, int i)
void uvedit_edge_select (Scene *scene, EditFace *efa, MTFace *tf, int i)
void uvedit_edge_deselect (Scene *scene, EditFace *efa, MTFace *tf, int i)
int uvedit_uv_selected (Scene *scene, EditFace *efa, MTFace *tf, int i)
void uvedit_uv_select (Scene *scene, EditFace *efa, MTFace *tf, int i)
void uvedit_uv_deselect (Scene *scene, EditFace *efa, MTFace *tf, int i)
static void uvedit_live_unwrap_update (SpaceImage *sima, Scene *scene, Object *obedit)
void uv_center (float uv[][2], float cent[2], int quad)
float uv_area (float uv[][2], int quad)
void uv_copy_aspect (float uv_orig[][2], float uv[][2], float aspx, float aspy)
int ED_uvedit_minmax (Scene *scene, Image *ima, Object *obedit, float *min, float *max)
static int ED_uvedit_median (Scene *scene, Image *ima, Object *obedit, float co[3])
static int uvedit_center (Scene *scene, Image *ima, Object *obedit, float *cent, char mode)
static void find_nearest_uv_edge (Scene *scene, Image *ima, EditMesh *em, float co[2], NearestHit *hit)
static void find_nearest_uv_face (Scene *scene, Image *ima, EditMesh *em, float co[2], NearestHit *hit)
static int nearest_uv_between (MTFace *tf, int nverts, int id, float co[2], float uv[2])
static void find_nearest_uv_vert (Scene *scene, Image *ima, EditMesh *em, float co[2], float penalty[2], NearestHit *hit)
int ED_uvedit_nearest_uv (Scene *scene, Object *obedit, Image *ima, float co[2], float uv[2])
static void uv_vertex_loop_flag (UvMapVert *first)
static UvMapVertuv_vertex_map_get (UvVertMap *vmap, EditFace *efa, int a)
static int uv_edge_tag_faces (UvMapVert *first1, UvMapVert *first2, int *totface)
static int select_edgeloop (Scene *scene, Image *ima, EditMesh *em, NearestHit *hit, float limit[2], int extend)
static void select_linked (Scene *scene, Image *ima, EditMesh *em, float limit[2], NearestHit *hit, int extend)
static void weld_align_uv (bContext *C, int tool)
static int align_exec (bContext *C, wmOperator *op)
static void UV_OT_align (wmOperatorType *ot)
static int weld_exec (bContext *C, wmOperator *UNUSED(op))
static void UV_OT_weld (wmOperatorType *ot)
static int stitch_exec (bContext *C, wmOperator *op)
static void UV_OT_stitch (wmOperatorType *ot)
static void select_all_perform (bContext *C, int action)
static int select_all_exec (bContext *C, wmOperator *op)
static void UV_OT_select_all (wmOperatorType *ot)
static int sticky_select (float *limit, int hitv[4], int v, float *hituv[4], float *uv, int sticky)
static int mouse_select (bContext *C, float co[2], int extend, int loop)
static int select_exec (bContext *C, wmOperator *op)
static int select_invoke (bContext *C, wmOperator *op, wmEvent *event)
static void UV_OT_select (wmOperatorType *ot)
static int select_loop_exec (bContext *C, wmOperator *op)
static int select_loop_invoke (bContext *C, wmOperator *op, wmEvent *event)
static void UV_OT_select_loop (wmOperatorType *ot)
static int select_linked_internal (bContext *C, wmOperator *op, wmEvent *event, int pick)
static int select_linked_exec (bContext *C, wmOperator *op)
static void UV_OT_select_linked (wmOperatorType *ot)
static int select_linked_pick_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int select_linked_pick_exec (bContext *C, wmOperator *op)
static void UV_OT_select_linked_pick (wmOperatorType *ot)
static int unlink_selection_exec (bContext *C, wmOperator *op)
static void UV_OT_unlink_selected (wmOperatorType *ot)
static void uv_faces_do_sticky (bContext *C, SpaceImage *sima, Scene *scene, Object *obedit, short select)
static int border_select_exec (bContext *C, wmOperator *op)
static void UV_OT_select_border (wmOperatorType *ot)
static void select_uv_inside_ellipse (Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index)
static int circle_select_exec (bContext *C, wmOperator *op)
static void UV_OT_circle_select (wmOperatorType *ot)
static void snap_uv_to_pixel (float *uvco, float w, float h)
static void snap_cursor_to_pixels (SpaceImage *sima)
static int snap_cursor_to_selection (Scene *scene, Image *ima, Object *obedit, SpaceImage *sima)
static int snap_cursor_exec (bContext *C, wmOperator *op)
static void UV_OT_snap_cursor (wmOperatorType *ot)
static int snap_uvs_to_cursor (Scene *scene, Image *ima, Object *obedit, SpaceImage *sima)
static int snap_uvs_to_adjacent_unselected (Scene *scene, Image *ima, Object *obedit)
static int snap_uvs_to_pixels (SpaceImage *sima, Scene *scene, Object *obedit)
static int snap_selection_exec (bContext *C, wmOperator *op)
static void UV_OT_snap_selected (wmOperatorType *ot)
static int pin_exec (bContext *C, wmOperator *op)
static void UV_OT_pin (wmOperatorType *ot)
static int select_pinned_exec (bContext *C, wmOperator *UNUSED(op))
static void UV_OT_select_pinned (wmOperatorType *ot)
static int hide_exec (bContext *C, wmOperator *op)
static void UV_OT_hide (wmOperatorType *ot)
static int reveal_exec (bContext *C, wmOperator *UNUSED(op))
static void UV_OT_reveal (wmOperatorType *ot)
static int set_2d_cursor_exec (bContext *C, wmOperator *op)
static int set_2d_cursor_invoke (bContext *C, wmOperator *op, wmEvent *event)
static void UV_OT_cursor_set (wmOperatorType *ot)
static int set_tile_exec (bContext *C, wmOperator *op)
static int set_tile_invoke (bContext *C, wmOperator *op, wmEvent *event)
static void UV_OT_tile_set (wmOperatorType *ot)
void ED_operatortypes_uvedit (void)
void ED_keymap_uvedit (wmKeyConfig *keyconf)

Detailed Description

Definition in file uvedit_ops.c.


Typedef Documentation

typedef struct NearestHit NearestHit
typedef struct UVVertAverage UVVertAverage

Function Documentation

static int align_exec ( bContext C,
wmOperator op 
) [static]

Definition at line 1245 of file uvedit_ops.c.

References OPERATOR_FINISHED, wmOperator::ptr, RNA_enum_get(), and weld_align_uv().

Referenced by UV_OT_align().

static int border_select_exec ( bContext C,
wmOperator op 
) [static]
static int circle_select_exec ( bContext C,
wmOperator op 
) [static]
void ED_keymap_uvedit ( wmKeyConfig keyconf)
void ED_object_assign_active_image ( Main bmain,
Object ob,
int  mat_nr,
Image ima 
)
int ED_object_get_active_image ( Object ob,
int  mat_nr,
Image **  ima,
ImageUser **  iuser,
bNode **  node_r 
)
void ED_operatortypes_uvedit ( void  )
void ED_uvedit_assign_image ( Main bmain,
Scene scene,
Object obedit,
Image ima,
Image previma 
)
static int ED_uvedit_median ( Scene scene,
Image ima,
Object obedit,
float  co[3] 
) [static]
int ED_uvedit_minmax ( Scene scene,
Image ima,
Object obedit,
float *  min,
float *  max 
)
int ED_uvedit_nearest_uv ( Scene scene,
Object obedit,
Image ima,
float  co[2],
float  uv[2] 
)
int ED_uvedit_test ( Object obedit)
static void find_nearest_uv_edge ( Scene scene,
Image ima,
EditMesh em,
float  co[2],
NearestHit hit 
) [static]
static void find_nearest_uv_face ( Scene scene,
Image ima,
EditMesh em,
float  co[2],
NearestHit hit 
) [static]
static void find_nearest_uv_vert ( Scene scene,
Image ima,
EditMesh em,
float  co[2],
float  penalty[2],
NearestHit hit 
) [static]
static int hide_exec ( bContext C,
wmOperator op 
) [static]
static int is_image_texture_node ( bNode node) [static]
static int mouse_select ( bContext C,
float  co[2],
int  extend,
int  loop 
) [static]
static int nearest_uv_between ( MTFace tf,
int  nverts,
int  id,
float  co[2],
float  uv[2] 
) [static]

Definition at line 609 of file uvedit_ops.c.

References sub_v2_v2v2(), and MTFace::uv.

Referenced by find_nearest_uv_vert().

static int pin_exec ( bContext C,
wmOperator op 
) [static]
static int reveal_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int select_all_exec ( bContext C,
wmOperator op 
) [static]
static void select_all_perform ( bContext C,
int  action 
) [static]
static int select_edgeloop ( Scene scene,
Image ima,
EditMesh em,
NearestHit hit,
float  limit[2],
int  extend 
) [static]
static int select_exec ( bContext C,
wmOperator op 
) [static]

Definition at line 1891 of file uvedit_ops.c.

References co, mouse_select(), wmOperator::ptr, RNA_boolean_get(), and RNA_float_get_array().

Referenced by select_invoke(), and UV_OT_select().

static int select_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static void select_linked ( Scene scene,
Image ima,
EditMesh em,
float  limit[2],
NearestHit hit,
int  extend 
) [static]
static int select_linked_exec ( bContext C,
wmOperator op 
) [static]

Definition at line 2031 of file uvedit_ops.c.

References NULL, and select_linked_internal().

Referenced by UV_OT_select_linked().

static int select_linked_internal ( bContext C,
wmOperator op,
wmEvent event,
int  pick 
) [static]
static int select_linked_pick_exec ( bContext C,
wmOperator op 
) [static]

Definition at line 2058 of file uvedit_ops.c.

References NULL, and select_linked_internal().

Referenced by UV_OT_select_linked_pick().

static int select_linked_pick_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]

Definition at line 2053 of file uvedit_ops.c.

References select_linked_internal().

Referenced by UV_OT_select_linked_pick().

static int select_loop_exec ( bContext C,
wmOperator op 
) [static]
static int select_loop_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int select_pinned_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static void select_uv_inside_ellipse ( Scene scene,
int  select,
EditFace efa,
MTFace tface,
int  index,
float *  offset,
float *  ell,
int  select_index 
) [static]

Definition at line 2430 of file uvedit_ops.c.

References MTFace::uv, uvedit_uv_deselect(), and uvedit_uv_select().

Referenced by circle_select_exec().

static int set_2d_cursor_exec ( bContext C,
wmOperator op 
) [static]
static int set_2d_cursor_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int set_tile_exec ( bContext C,
wmOperator op 
) [static]
static int set_tile_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int snap_cursor_exec ( bContext C,
wmOperator op 
) [static]
static void snap_cursor_to_pixels ( SpaceImage sima) [static]

Definition at line 2527 of file uvedit_ops.c.

References SpaceImage::cursor, ED_space_image_size(), and snap_uv_to_pixel().

Referenced by snap_cursor_exec().

static int snap_cursor_to_selection ( Scene scene,
Image ima,
Object obedit,
SpaceImage sima 
) [static]

Definition at line 2535 of file uvedit_ops.c.

References SpaceImage::around, SpaceImage::cursor, and uvedit_center().

Referenced by snap_cursor_exec().

static int snap_selection_exec ( bContext C,
wmOperator op 
) [static]
static void snap_uv_to_pixel ( float *  uvco,
float  w,
float  h 
) [static]

Definition at line 2521 of file uvedit_ops.c.

References simple_enum_gen::w.

Referenced by snap_cursor_to_pixels(), and snap_uvs_to_pixels().

static int snap_uvs_to_adjacent_unselected ( Scene scene,
Image ima,
Object obedit 
) [static]
static int snap_uvs_to_cursor ( Scene scene,
Image ima,
Object obedit,
SpaceImage sima 
) [static]
static int snap_uvs_to_pixels ( SpaceImage sima,
Scene scene,
Object obedit 
) [static]
static int sticky_select ( float *  limit,
int  hitv[4],
int  v,
float *  hituv[4],
float *  uv,
int  sticky 
) [static]

Definition at line 1594 of file uvedit_ops.c.

References fabsf, i, SI_STICKY_DISABLE, SI_STICKY_LOC, and SI_STICKY_VERTEX.

Referenced by mouse_select().

static int stitch_exec ( bContext C,
wmOperator op 
) [static]
static int unlink_selection_exec ( bContext C,
wmOperator op 
) [static]
float uv_area ( float  uv[][2],
int  quad 
)

Definition at line 426 of file uvedit_ops.c.

References area_tri_v2().

Referenced by draw_uvs_stretch().

void uv_center ( float  uv[][2],
float  cent[2],
int  quad 
)

Definition at line 414 of file uvedit_ops.c.

Referenced by border_select_exec(), and draw_uvs().

void uv_copy_aspect ( float  uv_orig[][2],
float  uv[][2],
float  aspx,
float  aspy 
)

Definition at line 434 of file uvedit_ops.c.

Referenced by draw_uvs_stretch().

static int uv_edge_tag_faces ( UvMapVert first1,
UvMapVert first2,
int *  totface 
) [static]
static void uv_faces_do_sticky ( bContext C,
SpaceImage sima,
Scene scene,
Object obedit,
short  select 
) [static]
static void UV_OT_align ( wmOperatorType ot) [static]
static void UV_OT_circle_select ( wmOperatorType ot) [static]
static void UV_OT_cursor_set ( wmOperatorType ot) [static]
static void UV_OT_hide ( wmOperatorType ot) [static]
static void UV_OT_pin ( wmOperatorType ot) [static]
static void UV_OT_reveal ( wmOperatorType ot) [static]
static void UV_OT_select ( wmOperatorType ot) [static]
static void UV_OT_select_all ( wmOperatorType ot) [static]
static void UV_OT_select_border ( wmOperatorType ot) [static]
static void UV_OT_select_linked ( wmOperatorType ot) [static]
static void UV_OT_select_linked_pick ( wmOperatorType ot) [static]
static void UV_OT_select_loop ( wmOperatorType ot) [static]
static void UV_OT_select_pinned ( wmOperatorType ot) [static]
static void UV_OT_snap_cursor ( wmOperatorType ot) [static]
static void UV_OT_snap_selected ( wmOperatorType ot) [static]
static void UV_OT_stitch ( wmOperatorType ot) [static]
static void UV_OT_tile_set ( wmOperatorType ot) [static]
static void UV_OT_unlink_selected ( wmOperatorType ot) [static]
static void UV_OT_weld ( wmOperatorType ot) [static]
static void uv_vertex_loop_flag ( UvMapVert first) [static]

Definition at line 721 of file uvedit_ops.c.

References UvMapVert::flag, UvMapVert::next, and UvMapVert::separate.

Referenced by select_edgeloop().

static UvMapVert* uv_vertex_map_get ( UvVertMap vmap,
EditFace efa,
int  a 
) [static]
static int uvedit_center ( Scene scene,
Image ima,
Object obedit,
float *  cent,
char  mode 
) [static]
void uvedit_edge_deselect ( Scene scene,
EditFace efa,
MTFace tf,
int  i 
)
void uvedit_edge_select ( Scene scene,
EditFace efa,
MTFace tf,
int  i 
)
int uvedit_edge_selected ( Scene scene,
EditFace efa,
MTFace tf,
int  i 
)
void uvedit_face_deselect ( Scene scene,
EditFace efa,
MTFace tf 
)
void uvedit_face_select ( Scene scene,
EditFace efa,
MTFace tf 
)
int uvedit_face_selected ( Scene scene,
EditFace efa,
MTFace tf 
)
int uvedit_face_visible ( Scene scene,
Image ima,
EditFace efa,
MTFace tf 
)
int uvedit_face_visible_nolocal ( Scene scene,
EditFace efa 
)
static void uvedit_live_unwrap_update ( SpaceImage sima,
Scene scene,
Object obedit 
) [static]
static void uvedit_pixel_to_float ( SpaceImage sima,
float *  dist,
float  pixeldist 
) [static]

Definition at line 236 of file uvedit_ops.c.

References ED_space_image_size().

Referenced by mouse_select(), select_linked_internal(), and uv_faces_do_sticky().

static int uvedit_set_tile ( Object obedit,
Image ima,
int  curtile 
) [static]
void uvedit_uv_deselect ( Scene scene,
EditFace efa,
MTFace tf,
int  i 
)
void uvedit_uv_select ( Scene scene,
EditFace efa,
MTFace tf,
int  i 
)
int uvedit_uv_selected ( Scene scene,
EditFace efa,
MTFace tf,
int  i 
)
static void weld_align_uv ( bContext C,
int  tool 
) [static]
static int weld_exec ( bContext C,
wmOperator UNUSEDop 
) [static]

Definition at line 1279 of file uvedit_ops.c.

References OPERATOR_FINISHED, and weld_align_uv().

Referenced by UV_OT_weld().