Blender V4.3
sculpt_uv.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BLI_math_base_safe.h"
#include "BLI_math_geom.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "DNA_brush_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_brush.hh"
#include "BKE_colortools.hh"
#include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_editmesh.hh"
#include "BKE_image.hh"
#include "BKE_mesh_mapping.hh"
#include "BKE_paint.hh"
#include "DEG_depsgraph.hh"
#include "ED_image.hh"
#include "ED_mesh.hh"
#include "ED_screen.hh"
#include "ED_uvedit.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_enum_types.hh"
#include "paint_intern.hh"
#include "uvedit_intern.hh"
#include "UI_view2d.hh"

Go to the source code of this file.

Classes

struct  UvAdjacencyElement
 
struct  UvEdge
 
struct  UVInitialStrokeElement
 
struct  UVInitialStroke
 
struct  UvSculptData
 
struct  Temp_UVData
 

Macros

#define MARK_BOUNDARY   1
 

Typedefs

typedef enum eBrushUVSculptTool eBrushUVSculptTool
 

Enumerations

enum  eBrushUVSculptTool { UV_SCULPT_BRUSH_TYPE_GRAB = 0 , UV_SCULPT_BRUSH_TYPE_RELAX = 1 , UV_SCULPT_BRUSH_TYPE_PINCH = 2 }
 
enum  { UV_SCULPT_BRUSH_TYPE_RELAX_LAPLACIAN = 0 , UV_SCULPT_BRUSH_TYPE_RELAX_HC = 1 , UV_SCULPT_BRUSH_TYPE_RELAX_COTAN = 2 }
 

Functions

static void apply_sculpt_data_constraints (UvSculptData *sculptdata, float uv[2])
 
static float calc_strength (const UvSculptData *sculptdata, float p, const float len)
 
static void HC_relaxation_iteration_uv (UvSculptData *sculptdata, const int cd_loop_uv_offset, const float mouse_coord[2], const float alpha, const float radius_sq, const float aspectRatio)
 
static void laplacian_relaxation_iteration_uv (UvSculptData *sculptdata, const int cd_loop_uv_offset, const float mouse_coord[2], const float alpha, const float radius_sq, const float aspectRatio)
 
static void add_weighted_edge (float(*delta_buf)[3], const UvElement *storage, const UvElement *ele_next, const UvElement *ele_prev, const float luv_next[2], const float luv_prev[2], const float weight)
 
static float tri_weight_v3 (int method, const float *v1, const float *v2, const float *v3)
 
static void relaxation_iteration_uv (UvSculptData *sculptdata, const int cd_loop_uv_offset, const float mouse_coord[2], const float alpha, const float radius_sq, const float aspect_ratio, const int method)
 
static void uv_sculpt_stroke_apply (bContext *C, wmOperator *op, const wmEvent *event, Object *obedit)
 
static void uv_sculpt_stroke_exit (bContext *C, wmOperator *op)
 
static int uv_element_offset_from_face_get (UvElementMap *map, BMLoop *l, int island_index, const bool do_islands)
 
static uint uv_edge_hash (const void *key)
 
static bool uv_edge_compare (const void *a, const void *b)
 
static void set_element_flag (UvElement *element, const int flag)
 
static UvSculptDatauv_sculpt_stroke_init (bContext *C, wmOperator *op, const wmEvent *event)
 
static int uv_sculpt_stroke_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int uv_sculpt_stroke_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static void register_common_props (wmOperatorType *ot)
 
void SCULPT_OT_uv_sculpt_grab (wmOperatorType *ot)
 
void SCULPT_OT_uv_sculpt_relax (wmOperatorType *ot)
 
void SCULPT_OT_uv_sculpt_pinch (wmOperatorType *ot)
 

Detailed Description

UV Sculpt tools.

Definition in file sculpt_uv.cc.

Macro Definition Documentation

◆ MARK_BOUNDARY

#define MARK_BOUNDARY   1

Definition at line 65 of file sculpt_uv.cc.

Referenced by add_weighted_edge(), and uv_sculpt_stroke_init().

Typedef Documentation

◆ eBrushUVSculptTool

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
UV_SCULPT_BRUSH_TYPE_RELAX_LAPLACIAN 
UV_SCULPT_BRUSH_TYPE_RELAX_HC 
UV_SCULPT_BRUSH_TYPE_RELAX_COTAN 

Definition at line 56 of file sculpt_uv.cc.

◆ eBrushUVSculptTool

Enumerator
UV_SCULPT_BRUSH_TYPE_GRAB 
UV_SCULPT_BRUSH_TYPE_RELAX 
UV_SCULPT_BRUSH_TYPE_PINCH 

Definition at line 50 of file sculpt_uv.cc.

Function Documentation

◆ add_weighted_edge()

static void add_weighted_edge ( float(*) delta_buf[3],
const UvElement * storage,
const UvElement * ele_next,
const UvElement * ele_prev,
const float luv_next[2],
const float luv_prev[2],
const float weight )
static

Definition at line 337 of file sculpt_uv.cc.

References fabsf, UvElement::flag, MARK_BOUNDARY, and sub_v2_v2v2().

Referenced by relaxation_iteration_uv().

◆ apply_sculpt_data_constraints()

static void apply_sculpt_data_constraints ( UvSculptData * sculptdata,
float uv[2] )
static

◆ calc_strength()

◆ HC_relaxation_iteration_uv()

◆ laplacian_relaxation_iteration_uv()

◆ register_common_props()

static void register_common_props ( wmOperatorType * ot)
static

◆ relaxation_iteration_uv()

◆ SCULPT_OT_uv_sculpt_grab()

◆ SCULPT_OT_uv_sculpt_pinch()

◆ SCULPT_OT_uv_sculpt_relax()

◆ set_element_flag()

static void set_element_flag ( UvElement * element,
const int flag )
static

Definition at line 639 of file sculpt_uv.cc.

References flag, and UvEdge::flag.

Referenced by uv_sculpt_stroke_init().

◆ tri_weight_v3()

static float tri_weight_v3 ( int method,
const float * v1,
const float * v2,
const float * v3 )
static

◆ uv_edge_compare()

static bool uv_edge_compare ( const void * a,
const void * b )
static

Definition at line 628 of file sculpt_uv.cc.

References b, UvEdge::uv1, and UvEdge::uv2.

Referenced by uv_sculpt_stroke_init().

◆ uv_edge_hash()

static uint uv_edge_hash ( const void * key)
static

Definition at line 622 of file sculpt_uv.cc.

References BLI_ghashutil_uinthash().

Referenced by uv_sculpt_stroke_init().

◆ uv_element_offset_from_face_get()

static int uv_element_offset_from_face_get ( UvElementMap * map,
BMLoop * l,
int island_index,
const bool do_islands )
static

Definition at line 610 of file sculpt_uv.cc.

References BM_uv_element_get(), and l.

Referenced by uv_sculpt_stroke_init().

◆ uv_sculpt_stroke_apply()

◆ uv_sculpt_stroke_exit()

◆ uv_sculpt_stroke_init()

static UvSculptData * uv_sculpt_stroke_init ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

Definition at line 650 of file sculpt_uv.cc.

References BKE_curvemapping_init(), BKE_editmesh_from_object(), BKE_image_find_nearest_tile_with_offset(), BLI_assert, BLI_ghash_free(), BLI_ghash_insert(), BLI_ghash_len(), BLI_ghash_lookup(), BLI_ghash_new(), BLI_ghashIterator_getKey(), bm, BMEditMesh::bm, BM_ELEM_CD_GET_BOOL, BM_ELEM_CD_GET_FLOAT2_P, BM_FACES_OF_MESH, BM_ITER_ELEM, BM_ITER_MESH, BM_LOOPS_OF_FACE, BM_uv_element_get(), BM_uv_element_map_create(), BM_uv_map_get_offsets(), calc_strength(), copy_v2_v2(), CTX_data_edit_object(), CTX_data_scene(), CTX_wm_region(), CTX_wm_space_image(), CTX_wm_window(), wmOperator::customdata, data, diff(), dot_v2v2(), ED_space_image_get_size(), ED_space_image_get_zoom(), ED_uvedit_live_unwrap_begin(), element, SpaceImage::flag, float, GHASH_ITER, wmOperatorType::idname, SpaceImage::image, UvEdge::is_interior, l, MARK_BOUNDARY, MEM_mallocN, MEM_SAFE_FREE, wmEvent::mval, BMLoop::next, BMUVOffsets::pin, wmOperator::ptr, RNA_boolean_get(), set_element_flag(), SI_CLIP_UV, SI_LIVE_UNWRAP, sqrtf, UvSculpt::strength_curve, STREQ, sub_v2_v2v2(), BMesh::totvert, wmOperator::type, UI_view2d_region_to_view(), BMUVOffsets::uv, uv_edge_compare(), uv_edge_hash(), uv_element_offset_from_face_get(), uv_find_nearest_vert(), uv_nearest_hit_init_max(), UV_SCULPT_ALL_ISLANDS, UV_SCULPT_BRUSH_TYPE_GRAB, UV_SCULPT_BRUSH_TYPE_PINCH, UV_SCULPT_BRUSH_TYPE_RELAX, UV_SCULPT_LOCK_BORDERS, ToolSettings::uv_sculpt_settings, uv_sculpt_stroke_exit(), and ToolSettings::uvsculpt.

Referenced by uv_sculpt_stroke_invoke().

◆ uv_sculpt_stroke_invoke()

◆ uv_sculpt_stroke_modal()