Blender  V3.3
sculpt_transform.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2020 Blender Foundation. All rights reserved. */
3 
8 #include "MEM_guardedalloc.h"
9 
10 #include "BLI_blenlib.h"
11 #include "BLI_math.h"
12 #include "BLI_task.h"
13 
14 #include "DNA_mesh_types.h"
15 #include "DNA_meshdata_types.h"
16 
17 #include "BKE_brush.h"
18 #include "BKE_context.h"
19 #include "BKE_kelvinlet.h"
20 #include "BKE_mesh.h"
21 #include "BKE_mesh_mapping.h"
22 #include "BKE_object.h"
23 #include "BKE_paint.h"
24 #include "BKE_pbvh.h"
25 #include "BKE_scene.h"
26 
27 #include "DEG_depsgraph.h"
28 
29 #include "WM_api.h"
30 #include "WM_message.h"
31 #include "WM_toolsystem.h"
32 #include "WM_types.h"
33 
34 #include "ED_object.h"
35 #include "ED_screen.h"
36 #include "ED_sculpt.h"
37 #include "ED_view3d.h"
38 #include "paint_intern.h"
39 #include "sculpt_intern.h"
40 
41 #include "RNA_access.h"
42 #include "RNA_define.h"
43 
44 #include "bmesh.h"
45 
46 #include <math.h>
47 #include <stdlib.h>
48 
50 {
52  SculptSession *ss = ob->sculpt;
54 
58 
62 
63  SCULPT_undo_push_begin(ob, "Transform");
64  BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false, false);
65 
66  ss->pivot_rot[3] = 1.0f;
67 
70 
73  }
74  else {
76  }
77 }
78 
80  const char symm,
82  float r_transform_mats[8][4][4])
83 {
84 
85  float final_pivot_pos[3], d_t[3], d_r[4], d_s[3];
86  float t_mat[4][4], r_mat[4][4], s_mat[4][4], pivot_mat[4][4], pivot_imat[4][4],
87  transform_mat[4][4];
88 
89  float start_pivot_pos[3], start_pivot_rot[4], start_pivot_scale[3];
90  switch (t_mode) {
92  copy_v3_v3(start_pivot_pos, ss->init_pivot_pos);
93  copy_v4_v4(start_pivot_rot, ss->init_pivot_rot);
94  copy_v3_v3(start_pivot_scale, ss->init_pivot_scale);
95  break;
97  copy_v3_v3(start_pivot_pos, ss->prev_pivot_pos);
98  copy_v4_v4(start_pivot_rot, ss->prev_pivot_rot);
99  copy_v3_v3(start_pivot_scale, ss->prev_pivot_scale);
100  break;
101  }
102 
103  for (int i = 0; i < PAINT_SYMM_AREAS; i++) {
104  ePaintSymmetryAreas v_symm = i;
105 
106  copy_v3_v3(final_pivot_pos, ss->pivot_pos);
107 
108  unit_m4(pivot_mat);
109 
110  unit_m4(t_mat);
111  unit_m4(r_mat);
112  unit_m4(s_mat);
113 
114  /* Translation matrix. */
115  sub_v3_v3v3(d_t, ss->pivot_pos, start_pivot_pos);
116  SCULPT_flip_v3_by_symm_area(d_t, symm, v_symm, ss->init_pivot_pos);
117  translate_m4(t_mat, d_t[0], d_t[1], d_t[2]);
118 
119  /* Rotation matrix. */
120  sub_qt_qtqt(d_r, ss->pivot_rot, start_pivot_rot);
121  normalize_qt(d_r);
122  SCULPT_flip_quat_by_symm_area(d_r, symm, v_symm, ss->init_pivot_pos);
123  quat_to_mat4(r_mat, d_r);
124 
125  /* Scale matrix. */
126  sub_v3_v3v3(d_s, ss->pivot_scale, start_pivot_scale);
127  add_v3_fl(d_s, 1.0f);
128  size_to_mat4(s_mat, d_s);
129 
130  /* Pivot matrix. */
131  SCULPT_flip_v3_by_symm_area(final_pivot_pos, symm, v_symm, start_pivot_pos);
132  translate_m4(pivot_mat, final_pivot_pos[0], final_pivot_pos[1], final_pivot_pos[2]);
133  invert_m4_m4(pivot_imat, pivot_mat);
134 
135  /* Final transform matrix. */
136  mul_m4_m4m4(transform_mat, r_mat, t_mat);
137  mul_m4_m4m4(transform_mat, transform_mat, s_mat);
138  mul_m4_m4m4(r_transform_mats[i], transform_mat, pivot_imat);
139  mul_m4_m4m4(r_transform_mats[i], pivot_mat, r_transform_mats[i]);
140  }
141 }
142 
143 static void sculpt_transform_task_cb(void *__restrict userdata,
144  const int i,
145  const TaskParallelTLS *__restrict UNUSED(tls))
146 {
147 
148  SculptThreadedTaskData *data = userdata;
149  SculptSession *ss = data->ob->sculpt;
150  PBVHNode *node = data->nodes[i];
151 
152  SculptOrigVertData orig_data;
153  SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[i], SCULPT_UNDO_COORDS);
154 
155  PBVHVertexIter vd;
156 
159  SCULPT_orig_vert_data_update(&orig_data, &vd);
160  float *start_co;
161  float transformed_co[3], orig_co[3], disp[3];
162  float fade = vd.mask ? *vd.mask : 0.0f;
163  copy_v3_v3(orig_co, orig_data.co);
164  char symm_area = SCULPT_get_vertex_symm_area(orig_co);
165 
168  start_co = orig_co;
169  break;
171  start_co = vd.co;
172  break;
173  }
174 
175  copy_v3_v3(transformed_co, start_co);
176  mul_m4_v3(data->transform_mats[(int)symm_area], transformed_co);
177  sub_v3_v3v3(disp, transformed_co, start_co);
178  mul_v3_fl(disp, 1.0f - fade);
179  add_v3_v3v3(vd.co, start_co, disp);
180 
181  if (vd.mvert) {
183  }
184  }
186 
188 }
189 
191 {
192  SculptSession *ss = ob->sculpt;
193  const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
194 
196  .sd = sd,
197  .ob = ob,
198  .nodes = ss->filter_cache->nodes,
199  };
200 
202  ss, symm, ss->filter_cache->transform_displacement_mode, data.transform_mats);
203 
204  /* Regular transform applies all symmetry passes at once as it is split by symmetry areas
205  * (each vertex can only be transformed once by the transform matrix of its area). */
206  TaskParallelSettings settings;
209  0, ss->filter_cache->totnode, &data, sculpt_transform_task_cb, &settings);
210 }
211 
212 static void sculpt_elastic_transform_task_cb(void *__restrict userdata,
213  const int i,
214  const TaskParallelTLS *__restrict UNUSED(tls))
215 {
216 
217  SculptThreadedTaskData *data = userdata;
218  SculptSession *ss = data->ob->sculpt;
219  PBVHNode *node = data->nodes[i];
220 
221  float(*proxy)[3] = BKE_pbvh_node_add_proxy(ss->pbvh, data->nodes[i])->co;
222 
223  SculptOrigVertData orig_data;
224  SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[i], SCULPT_UNDO_COORDS);
225 
227  /* TODO(pablodp606): These parameters can be exposed if needed as transform strength and volume
228  * preservation like in the elastic deform brushes. Setting them to the same default as elastic
229  * deform triscale grab because they work well in most cases. */
230  const float force = 1.0f;
231  const float shear_modulus = 1.0f;
232  const float poisson_ratio = 0.4f;
234  &params, data->elastic_transform_radius, force, shear_modulus, poisson_ratio);
235 
237 
238  PBVHVertexIter vd;
240  SCULPT_orig_vert_data_update(&orig_data, &vd);
241  float transformed_co[3], orig_co[3], disp[3];
242  const float fade = vd.mask ? *vd.mask : 0.0f;
243  copy_v3_v3(orig_co, orig_data.co);
244 
245  copy_v3_v3(transformed_co, vd.co);
246  mul_m4_v3(data->elastic_transform_mat, transformed_co);
247  sub_v3_v3v3(disp, transformed_co, vd.co);
248 
249  float final_disp[3];
250  BKE_kelvinlet_grab_triscale(final_disp, &params, vd.co, data->elastic_transform_pivot, disp);
251  mul_v3_fl(final_disp, 20.0f * (1.0f - fade));
252 
253  copy_v3_v3(proxy[vd.i], final_disp);
254 
255  if (vd.mvert) {
257  }
258  }
260 
262 }
263 
264 static void sculpt_transform_radius_elastic(Sculpt *sd, Object *ob, const float transform_radius)
265 {
266  SculptSession *ss = ob->sculpt;
269 
270  const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
271 
273  .sd = sd,
274  .ob = ob,
275  .nodes = ss->filter_cache->nodes,
276  .elastic_transform_radius = transform_radius,
277  };
278 
280  ss, symm, ss->filter_cache->transform_displacement_mode, data.transform_mats);
281 
282  TaskParallelSettings settings;
284 
285  /* Elastic transform needs to apply all transform matrices to all vertices and then combine the
286  * displacement proxies as all vertices are modified by all symmetry passes. */
287  for (ePaintSymmetryFlags symmpass = 0; symmpass <= symm; symmpass++) {
288  if (SCULPT_is_symmetry_iteration_valid(symmpass, symm)) {
289  flip_v3_v3(data.elastic_transform_pivot, ss->pivot_pos, symmpass);
290  flip_v3_v3(data.elastic_transform_pivot_init, ss->init_pivot_pos, symmpass);
291 
292  const int symm_area = SCULPT_get_vertex_symm_area(data.elastic_transform_pivot);
293  copy_m4_m4(data.elastic_transform_mat, data.transform_mats[symm_area]);
296  }
297  }
299 }
300 
302 {
304  SculptSession *ss = ob->sculpt;
306 
308  BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false, false);
309 
310  switch (sd->transform_mode) {
313  break;
314  }
316  Brush *brush = BKE_paint_brush(&sd->paint);
318  float transform_radius;
319 
320  if (BKE_brush_use_locked_size(scene, brush)) {
321  transform_radius = BKE_brush_unprojected_radius_get(scene, brush);
322  }
323  else {
324  ViewContext vc;
325 
327 
328  transform_radius = paint_calc_object_space_radius(
329  &vc, ss->init_pivot_pos, BKE_brush_size_get(scene, brush));
330  }
331 
332  sculpt_transform_radius_elastic(sd, ob, transform_radius);
333  break;
334  }
335  }
336 
340 
341  if (ss->deform_modifiers_active || ss->shapekey_active) {
342  SCULPT_flush_stroke_deform(sd, ob, true);
343  }
344 
346 }
347 
349 {
350  SculptSession *ss = ob->sculpt;
351  if (ss->filter_cache) {
353  }
354  /* Force undo push to happen even inside transform operator, since the sculpt
355  * undo system works separate from regular undo and this is require to properly
356  * finish an undo step also when canceling. */
357  const bool use_nested_undo = true;
358  SCULPT_undo_push_end_ex(ob, use_nested_undo);
360 }
361 
369 
372  "ORIGIN",
373  0,
374  "Origin",
375  "Sets the pivot to the origin of the sculpt"},
377  "UNMASKED",
378  0,
379  "Unmasked",
380  "Sets the pivot position to the average position of the unmasked vertices"},
382  "BORDER",
383  0,
384  "Mask Border",
385  "Sets the pivot position to the center of the border of the mask"},
387  "ACTIVE",
388  0,
389  "Active Vertex",
390  "Sets the pivot position to the active vertex position"},
392  "SURFACE",
393  0,
394  "Surface",
395  "Sets the pivot position to the surface under the cursor"},
396  {0, NULL, 0, NULL, NULL},
397 };
398 
400 {
402  SculptSession *ss = ob->sculpt;
403  ARegion *region = CTX_wm_region(C);
405  const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
406 
407  int mode = RNA_enum_get(op->ptr, "mode");
408 
409  BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true, false);
410 
411  /* Pivot to center. */
412  if (mode == SCULPT_PIVOT_POSITION_ORIGIN) {
413  zero_v3(ss->pivot_pos);
414  }
415  /* Pivot to active vertex. */
416  else if (mode == SCULPT_PIVOT_POSITION_ACTIVE_VERTEX) {
418  }
419  /* Pivot to ray-cast surface. */
420  else if (mode == SCULPT_PIVOT_POSITION_CURSOR_SURFACE) {
421  float stroke_location[3];
422  const float mval[2] = {
423  RNA_float_get(op->ptr, "mouse_x"),
424  RNA_float_get(op->ptr, "mouse_y"),
425  };
426  if (SCULPT_stroke_get_location(C, stroke_location, mval, false)) {
427  copy_v3_v3(ss->pivot_pos, stroke_location);
428  }
429  }
430  else {
431  PBVHNode **nodes;
432  int totnode;
433  BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
434 
435  float avg[3];
436  int total = 0;
437  zero_v3(avg);
438 
439  /* Pivot to unmasked. */
440  if (mode == SCULPT_PIVOT_POSITION_UNMASKED) {
441  for (int n = 0; n < totnode; n++) {
442  PBVHVertexIter vd;
443  BKE_pbvh_vertex_iter_begin (ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
444  const float mask = (vd.mask) ? *vd.mask : 0.0f;
445  if (mask < 1.0f) {
446  if (SCULPT_check_vertex_pivot_symmetry(vd.co, ss->pivot_pos, symm)) {
447  add_v3_v3(avg, vd.co);
448  total++;
449  }
450  }
451  }
453  }
454  }
455  /* Pivot to mask border. */
456  else if (mode == SCULPT_PIVOT_POSITION_MASK_BORDER) {
457  const float threshold = 0.2f;
458 
459  for (int n = 0; n < totnode; n++) {
460  PBVHVertexIter vd;
461  BKE_pbvh_vertex_iter_begin (ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
462  const float mask = (vd.mask) ? *vd.mask : 0.0f;
463  if (mask < (0.5f + threshold) && mask > (0.5f - threshold)) {
464  if (SCULPT_check_vertex_pivot_symmetry(vd.co, ss->pivot_pos, symm)) {
465  add_v3_v3(avg, vd.co);
466  total++;
467  }
468  }
469  }
471  }
472  }
473 
474  if (total > 0) {
475  mul_v3_fl(avg, 1.0f / total);
476  copy_v3_v3(ss->pivot_pos, avg);
477  }
478 
479  MEM_SAFE_FREE(nodes);
480  }
481 
482  /* Update the viewport navigation rotation origin. */
485  ups->average_stroke_counter = 1;
486  ups->last_stroke_valid = true;
487 
488  ED_region_tag_redraw(region);
490 
491  return OPERATOR_FINISHED;
492 }
493 
495 {
496  RNA_float_set(op->ptr, "mouse_x", event->mval[0]);
497  RNA_float_set(op->ptr, "mouse_y", event->mval[1]);
498  return sculpt_set_pivot_position_exec(C, op);
499 }
500 
502 {
503  /* Identifiers. */
504  ot->name = "Set Pivot Position";
505  ot->idname = "SCULPT_OT_set_pivot_position";
506  ot->description = "Sets the sculpt transform pivot position";
507 
508  /* API callbacks. */
512 
515  "mode",
518  "Mode",
519  "");
520 
522  "mouse_x",
523  0.0f,
524  0.0f,
525  FLT_MAX,
526  "Mouse Position X",
527  "Position of the mouse used for \"Surface\" mode",
528  0.0f,
529  10000.0f);
531  "mouse_y",
532  0.0f,
533  0.0f,
534  FLT_MAX,
535  "Mouse Position Y",
536  "Position of the mouse used for \"Surface\" mode",
537  0.0f,
538  10000.0f);
539 }
typedef float(TangentPoint)[2]
int BKE_brush_size_get(const struct Scene *scene, const struct Brush *brush)
float BKE_brush_unprojected_radius_get(const struct Scene *scene, const struct Brush *brush)
bool BKE_brush_use_locked_size(const struct Scene *scene, const struct Brush *brush)
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1528
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Definition: context.c:1505
struct ToolSettings * CTX_data_tool_settings(const bContext *C)
Definition: context.c:1282
void BKE_kelvinlet_grab_triscale(float radius_elem_disp[3], const KelvinletParams *params, const float elem_orig_co[3], const float brush_location[3], const float brush_delta[3])
Definition: kelvinlet.c:87
void BKE_kelvinlet_init_params(KelvinletParams *params, float radius, float force, float shear_modulus, float poisson_ratio)
Definition: kelvinlet.c:13
General operations, lookup, etc. for blender objects.
#define PAINT_SYMM_AREAS
Definition: BKE_paint.h:118
ePaintSymmetryAreas
Definition: BKE_paint.h:112
void BKE_sculpt_update_object_for_edit(struct Depsgraph *depsgraph, struct Object *ob_orig, bool need_pmap, bool need_mask, bool is_paint_tool)
Definition: paint.c:1914
struct Brush * BKE_paint_brush(struct Paint *paint)
Definition: paint.c:607
A BVH for high poly meshes.
void BKE_pbvh_node_mark_update(PBVHNode *node)
Definition: pbvh.c:1869
#define BKE_pbvh_vertex_iter_begin(pbvh, node, vi, mode)
Definition: BKE_pbvh.h:439
#define BKE_pbvh_vertex_iter_end
Definition: BKE_pbvh.h:509
void BKE_pbvh_vert_tag_update_normal(PBVH *pbvh, int index)
Definition: pbvh.c:1967
#define PBVH_ITER_UNIQUE
Definition: BKE_pbvh.h:391
PBVHProxyNode * BKE_pbvh_node_add_proxy(PBVH *pbvh, PBVHNode *node)
Definition: pbvh.c:3016
void BKE_pbvh_parallel_range_settings(struct TaskParallelSettings *settings, bool use_threading, int totnode)
Definition: pbvh.c:3211
void BKE_pbvh_search_gather(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot)
Definition: pbvh.c:838
#define BLI_assert(a)
Definition: BLI_assert.h:46
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:259
void unit_m4(float m[4][4])
Definition: rct.c:1090
void translate_m4(float mat[4][4], float tx, float ty, float tz)
Definition: math_matrix.c:2318
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
void size_to_mat4(float R[4][4], const float size[3])
Definition: math_matrix.c:2111
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:729
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:77
void sub_qt_qtqt(float q[4], const float a[4], const float b[4])
float normalize_qt(float q[4])
void quat_to_mat4(float mat[4][4], const float q[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void add_v3_fl(float r[3], float f)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
Definition: task_range.cc:94
#define UNUSED(x)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
ePaintSymmetryFlags
@ SCULPT_TRANSFORM_MODE_RADIUS_ELASTIC
@ SCULPT_TRANSFORM_MODE_ALL_VERTICES
@ OPERATOR_FINISHED
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc, struct Depsgraph *depsgraph)
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
#define C
Definition: RandGen.cpp:25
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define NC_GEOM
Definition: WM_types.h:343
#define ND_SELECT
Definition: WM_types.h:455
OperationNode * node
Scene scene
const Depsgraph * depsgraph
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
CCL_NAMESPACE_BEGIN ccl_device float fade(float t)
Definition: noise.h:15
float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius)
Definition: paint_utils.c:130
BLI_INLINE void flip_v3_v3(float out[3], const float in[3], const ePaintSymmetryFlags symm)
Definition: paint_intern.h:392
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4957
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
Definition: rna_access.c:4968
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3836
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
void SCULPT_orig_vert_data_update(SculptOrigVertData *orig_data, PBVHVertexIter *iter)
Definition: sculpt.c:1300
void SCULPT_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBVHNode *node, SculptUndoType type)
Definition: sculpt.c:1290
bool SCULPT_stroke_get_location(bContext *C, float out[3], const float mval[2], bool force_original)
Definition: sculpt.c:4964
bool SCULPT_is_symmetry_iteration_valid(char i, char symm)
Definition: sculpt.c:1025
const float * SCULPT_active_vertex_co_get(SculptSession *ss)
Definition: sculpt.c:279
void SCULPT_vertex_random_access_ensure(SculptSession *ss)
Definition: sculpt.c:103
void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType update_flags)
Definition: sculpt.c:5212
void SCULPT_combine_transform_proxies(Sculpt *sd, Object *ob)
Definition: sculpt.c:3646
void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags)
Definition: sculpt.c:5144
void SCULPT_flip_v3_by_symm_area(float v[3], const ePaintSymmetryFlags symm, const ePaintSymmetryAreas symmarea, const float pivot[3])
Definition: sculpt.c:2863
bool SCULPT_mode_poll(bContext *C)
Definition: sculpt.c:3957
char SCULPT_mesh_symmetry_xyz_get(Object *object)
Definition: sculpt.c:317
bool SCULPT_check_vertex_pivot_symmetry(const float vco[3], const float pco[3], const char symm)
Definition: sculpt.c:923
void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used)
Definition: sculpt.c:3719
ePaintSymmetryAreas SCULPT_get_vertex_symm_area(const float co[3])
Definition: sculpt.c:2848
void SCULPT_flip_quat_by_symm_area(float quat[4], const ePaintSymmetryFlags symm, const ePaintSymmetryAreas symmarea, const float pivot[3])
Definition: sculpt.c:2882
void SCULPT_filter_cache_init(bContext *C, Object *ob, Sculpt *sd, const int undo_type)
void SCULPT_filter_cache_free(SculptSession *ss)
void SCULPT_undo_push_begin(struct Object *ob, const char *name)
Definition: sculpt_undo.c:1545
SculptTransformDisplacementMode
@ SCULPT_TRANSFORM_DISPLACEMENT_ORIGINAL
@ SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL
void SCULPT_undo_push_end_ex(struct Object *ob, const bool use_nested_undo)
Definition: sculpt_undo.c:1580
@ SCULPT_UPDATE_COORDS
Definition: sculpt_intern.h:45
SculptUndoNode * SCULPT_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type)
Definition: sculpt_undo.c:1419
@ SCULPT_UNDO_COORDS
static int sculpt_set_pivot_position_invoke(bContext *C, wmOperator *op, const wmEvent *event)
eSculptPivotPositionModes
@ SCULPT_PIVOT_POSITION_MASK_BORDER
@ SCULPT_PIVOT_POSITION_ACTIVE_VERTEX
@ SCULPT_PIVOT_POSITION_CURSOR_SURFACE
@ SCULPT_PIVOT_POSITION_UNMASKED
@ SCULPT_PIVOT_POSITION_ORIGIN
void ED_sculpt_end_transform(struct bContext *C, Object *ob)
void ED_sculpt_update_modal_transform(struct bContext *C, Object *ob)
static void sculpt_transform_task_cb(void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
static void sculpt_elastic_transform_task_cb(void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
void SCULPT_OT_set_pivot_position(wmOperatorType *ot)
static void sculpt_transform_radius_elastic(Sculpt *sd, Object *ob, const float transform_radius)
static int sculpt_set_pivot_position_exec(bContext *C, wmOperator *op)
static EnumPropertyItem prop_sculpt_pivot_position_types[]
static void sculpt_transform_all_vertices(Sculpt *sd, Object *ob)
static void sculpt_transform_matrices_init(SculptSession *ss, const char symm, const SculptTransformDisplacementMode t_mode, float r_transform_mats[8][4][4])
void ED_sculpt_init_transform(struct bContext *C, Object *ob)
SculptTransformDisplacementMode transform_displacement_mode
PBVHNode ** nodes
struct SculptSession * sculpt
void * data
float(* co)[3]
Definition: BKE_pbvh.h:47
struct MVert * mvert
Definition: BKE_pbvh.h:428
float * co
Definition: BKE_pbvh.h:430
float * mask
Definition: BKE_pbvh.h:433
const float * co
Definition: sculpt_intern.h:87
float pivot_scale[3]
Definition: BKE_paint.h:614
float pivot_pos[3]
Definition: BKE_paint.h:612
struct KeyBlock * shapekey_active
Definition: BKE_paint.h:505
float init_pivot_scale[3]
Definition: BKE_paint.h:618
float pivot_rot[4]
Definition: BKE_paint.h:613
float init_pivot_rot[4]
Definition: BKE_paint.h:617
float prev_pivot_scale[3]
Definition: BKE_paint.h:622
float prev_pivot_pos[3]
Definition: BKE_paint.h:620
float init_pivot_pos[3]
Definition: BKE_paint.h:616
float prev_pivot_rot[4]
Definition: BKE_paint.h:621
struct FilterCache * filter_cache
Definition: BKE_paint.h:564
struct PBVH * pbvh
Definition: BKE_paint.h:550
bool deform_modifiers_active
Definition: BKE_paint.h:555
Paint paint
int transform_mode
struct UnifiedPaintSettings unified_paint_settings
int mval[2]
Definition: WM_types.h:684
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct PointerRNA * ptr
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition: wm_files.c:3479