45 #define MARK_BOUNDARY 1
133 const float mouse_coord[2],
141 float radius_root =
sqrtf(radius);
162 tmp_uvdata[i].
b[0] =
diff[0] - sculptdata->
uv[i].
uv[0];
163 tmp_uvdata[i].
b[1] =
diff[1] - sculptdata->
uv[i].
uv[1];
182 diff[1] /= aspectRatio;
188 sculptdata->
uv[i].
uv[0] = (1.0f - strength) * sculptdata->
uv[i].
uv[0] +
190 (tmp_uvdata[i].
p[0] -
191 0.5f * (tmp_uvdata[i].
b[0] +
193 sculptdata->
uv[i].
uv[1] = (1.0f - strength) * sculptdata->
uv[i].
uv[1] +
195 (tmp_uvdata[i].
p[1] -
196 0.5f * (tmp_uvdata[i].
b[1] +
219 const float mouse_coord[2],
227 float radius_root =
sqrtf(radius);
246 copy_v2_v2(tmp_uvdata[i].p, tmp_uvdata[i].sum_co);
247 mul_v2_fl(tmp_uvdata[i].p, 1.0f / tmp_uvdata[i].ncounter);
260 diff[1] /= aspectRatio;
266 sculptdata->
uv[i].
uv[0] = (1.0f - strength) * sculptdata->
uv[i].
uv[0] +
267 strength * tmp_uvdata[i].
p[0];
268 sculptdata->
uv[i].
uv[1] = (1.0f - strength) * sculptdata->
uv[i].
uv[1] +
269 strength * tmp_uvdata[i].
p[1];
294 float co[2], radius, radius_root;
304 float alpha, zoomx, zoomy;
307 tool = sculptdata->
tool;
320 radius = radius * radius;
321 radius_root =
sqrtf(radius);
339 diff[1] /= aspectRatio;
346 sculptdata->
uv[i].
uv[0] -= strength *
diff[0] * 0.001f;
347 sculptdata->
uv[i].
uv[1] -= strength *
diff[1] * 0.001f;
390 sculptdata->
uv[uvindex].
uv[0] =
392 sculptdata->
uv[uvindex].
uv[1] =
417 if (
data->elementMap) {
422 if (
data->initial_stroke) {
452 if ((edge1->
uv1 == edge2->
uv1) && (edge1->
uv2 == edge2->
uv2)) {
485 int island_index = 0;
495 if (do_island_optimization) {
503 if (!
data->elementMap) {
512 if (do_island_optimization) {
518 island_index =
element->island;
522 for (i = 0; i <
data->elementMap->totalUVs; i++) {
523 if (
data->elementMap->buf[i].separate &&
524 (!do_island_optimization ||
data->elementMap->buf[i].island == island_index)) {
532 "uv_brush_unique_uv_map");
535 edges =
MEM_mallocN(
sizeof(*edges) *
data->elementMap->totalUVs,
"uv_brush_all_edges");
536 if (!
data->uv || !uniqueUv || !edgeHash || !edges) {
554 if (do_island_optimization && (
element->island != island_index)) {
580 data->elementMap, efa,
l, island_index, do_island_optimization);
582 data->elementMap, efa,
l->
next, island_index, do_island_optimization);
586 if (itmp1 == -1 || itmp2 == -1) {
590 offset1 = uniqueUv[itmp1];
591 offset2 = uniqueUv[itmp2];
596 if (offset1 < offset2) {
622 "uv_brush_edge_connectivity_data");
623 if (!
data->uvedges) {
643 for (i = 0; i <
data->totalUvEdges; i++) {
644 if (!
data->uvedges[i].flag) {
653 float radius, radius_root;
658 float alpha, zoomx, zoomy;
669 radius /= (
width * zoomx);
670 radius = radius * radius;
671 radius_root =
sqrtf(radius);
675 "uv_sculpt_initial_stroke");
676 if (!
data->initial_stroke) {
680 sizeof(*
data->initial_stroke->initialSelection) *
data->totalUniqueUvs,
681 "uv_sculpt_initial_selection");
682 if (!
data->initial_stroke->initialSelection) {
690 for (i = 0; i <
data->totalUniqueUvs; i++) {
697 diff[1] /= aspectRatio;
702 data->initial_stroke->initialSelection[
counter].uv = i;
703 data->initial_stroke->initialSelection[
counter].strength = strength;
709 data->initial_stroke->totalInitialSelected =
counter;
743 switch (event->
type) {
794 "Invert action of brush for duration of stroke"},
799 "Switch brush to relax mode for duration of stroke"},
806 ot->
idname =
"SCULPT_OT_uv_sculpt_stroke";
typedef float(TangentPoint)[2]
float BKE_brush_curve_strength_clamped(const struct Brush *br, float p, float len)
float BKE_brush_alpha_get(const struct Scene *scene, const struct Brush *brush)
int BKE_brush_size_get(const struct Scene *scene, const struct Brush *brush)
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_edit_object(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct SpaceImage * CTX_wm_space_image(const bContext *C)
struct ToolSettings * CTX_data_tool_settings(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
void * CustomData_bmesh_get(const struct CustomData *data, void *block, int type)
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
struct Brush * BKE_paint_brush(struct Paint *paint)
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghashutil_uinthash(unsigned int key)
#define GHASH_ITER(gh_iter_, ghash_)
GHash * BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v2(float r[2])
void DEG_id_tag_update(struct ID *id, int flag)
Object is a sort of wrapper for general info.
#define UV_SCULPT_TOOL_RELAX_HC
#define UV_SCULPT_LOCK_BORDERS
#define UV_SCULPT_ALL_ISLANDS
void ED_space_image_get_zoom(struct SpaceImage *sima, const struct ARegion *region, float *r_zoomx, float *r_zoomy)
void ED_space_image_get_size(struct SpaceImage *sima, int *r_width, int *r_height)
struct UvElementMap * BM_uv_element_map_create(struct BMesh *bm, const struct Scene *scene, bool uv_selected, bool use_winding, bool do_islands)
struct UvElement * BM_uv_element_get(struct UvElementMap *map, struct BMFace *efa, struct BMLoop *l)
void BM_uv_element_map_free(struct UvElementMap *element_map)
bool ED_operator_uvedit_space_image(struct bContext *C)
void ED_region_tag_redraw(struct ARegion *region)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
Read Guarded memory(de)allocation.
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
ATTR_WARN_UNUSED_RESULT const void * element
ATTR_WARN_UNUSED_RESULT const BMLoop * l
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
ccl_gpu_kernel_postfix ccl_global int * counter
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
SocketIndexByIdentifierMap * map
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, const float mouse_coord[2], float alpha, float radius, float aspectRatio)
static bool uv_sculpt_stroke_poll(bContext *C)
static UvSculptData * uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wmEvent *event)
struct UVInitialStroke UVInitialStroke
struct Temp_UvData Temp_UVData
static int uv_sculpt_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event)
void SCULPT_OT_uv_sculpt_stroke(wmOperatorType *ot)
struct UvAdjacencyElement UvAdjacencyElement
static bool uv_edge_compare(const void *a, const void *b)
static int uv_sculpt_stroke_invoke(bContext *C, wmOperator *op, const wmEvent *event)
struct UvSculptData UvSculptData
static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, const float mouse_coord[2], float alpha, float radius, float aspectRatio)
static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *event, Object *obedit)
static uint uv_edge_hash(const void *key)
static int uv_element_offset_from_face_get(UvElementMap *map, BMFace *efa, BMLoop *l, int island_index, const bool doIslands)
static void uv_sculpt_stroke_exit(bContext *C, wmOperator *op)
struct UVInitialStrokeElement UVInitialStrokeElement
struct CurveMapping * curve
struct ToolSettings * toolsettings
UVInitialStrokeElement * initialSelection
UVInitialStroke * initial_stroke
UvElementMap * elementMap
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
bool uv_find_nearest_vert(struct Scene *scene, struct Object *obedit, const float co[2], float penalty_dist, struct UvNearestHit *hit)
#define UV_NEAREST_HIT_INIT_MAX(v2d)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)