Commit Graph

787 Commits

Author SHA1 Message Date
025421950b Forgot to clean a line in last commit 2014-03-28 22:42:21 +01:00
00a9e77259 Fix compiling sculpt without OpenMP available 2014-03-28 22:37:05 +01:00
6d973b87a6 Fix T39468
Issue is that sampling functions did not pass a thread index to the
texture sampler so all threads were contesting for the same pool.

Paint cursors and sculpting that used openmp for threading suffered from
this. Now use omp_get_thread_num to pass the thread number.
2014-03-28 22:02:26 +02:00
a99a8a6070 Code cleanup: style and warnings 2014-03-26 07:53:56 +11:00
f0ca40f9c1 Code cleanup: function calls 2014-03-25 10:10:00 +11:00
b701c92588 Code cleanup:
* Separate some common code for sculpt raycasting
* Cleanup to radial operator commit
2014-03-24 23:46:30 +02:00
3b68c6304d OSX/sculpt/omp: missing initialisation of size_t pcount_len, oddly worked fine without on OSX 10.9, fixes < 10.9 2014-03-24 13:33:26 +01:00
551d1a1ed5 Code cleanup: style 2014-03-24 13:14:19 +11:00
c359de2c3a Use eyeliner cursor for sampling. Thanks to Thomas Beck for the
suggestion :)
2014-03-23 00:33:55 +02:00
e732c5809c Detail sampling operator
Located on topology panel.

To use just click on button and click on mesh.
Operator will just use the dimensions of the triangles below to set the
constant detail setting.

Also changed pair of scale/detail size with nice separate float
percentage value.
2014-03-22 23:35:41 +02:00
0ef416722e Flood fill for dyntopo constant detail mode.
Nothing spectacular here, fill tools are easy. Just take the dyntopo
code and repeat until nothing more to do.

The tool can be located in the dyntopo panel when the dyntopo constant
detail is on.

Also added scale factor for constant detail. This may change when detail
sampling gets in, I am not very happy with having two numbers here,
still it will give some more control for now.
2014-03-22 17:47:18 +02:00
12ce5ae5be Forgot to remove test printf 2014-03-21 15:32:07 +01:00
081b0b6599 Sculpt: Fix non openMP threads not set correct and use optimal omp threadcount for OSX
- i empirically found that using HT just gives overhead, even possibly slowing things down
- i propose other OS test this too again
- switching threaded on/off did not restored single threaded case ( credits to Sergey )
2014-03-21 15:27:00 +01:00
2de9da6ee9 Fix T39034 brush always shown even after deactivating the show cursor
option after reentering a paint mode.

Solution by Bastien with modifications, thanks!
Show Brush flag need not be reenabled always, but make sure it is at
least enabled once on paint initialization.
2014-03-10 18:42:35 +02:00
f03df4f024 Fix crash when changing and using between layer and other brushes in
dyntopo

Layer brush would not invalidate the layer_disp arrays in dyntopo mode,
checking only for the existence of the array. This means that if a tool
resized the node due to topology changes, the layer brush code could
index (and write!) out of bounds in the array. Solution is to invalidate
the layer data prior to each stroke in dyntopo.
2014-03-07 16:58:56 +02:00
20f7a34abe Fix hard crash when using persistent base on layer brush on multires and
dyntopo.
2014-03-07 15:58:20 +02:00
03af4cbf91 Code cleanup: style 2014-03-07 13:28:39 +11:00
03afa6f9e7 Experimental dyntopo feature:
Dyntopo detail in object space. This allows to set the detail in
percentage of blender units and sculpt in this detail constantly,
regardless of the distance to the mesh.

This commit just enables the functionality, which is really trivial.
There will be some more commits like detail flood fill and
detail sampling in the future.
2014-03-06 20:15:44 +02:00
2a167dafc2 Forgo one rect union function, partial rect is inferred from nodes that
are tagged for update anyway. The important part of the fix was updating
the previous rectangle in the draw function.
2014-03-06 19:54:44 +02:00
43486bbdb9 Final fix (I hope!) for partial redraw.
The problem here is that the redraw rectangle can be calculated many
times before actual redraw (for instance due to repetitive calls to the
paint step function for space strokes). Those redraw rectangles need to
be accumulated and finally flushed when the draw call is done.

Also, it is this accumulated rectangle that must account for the
previously drawn rectangle to avoid artifacts due to drawing.

Now all looks like it works correctly :)
2014-03-06 19:27:05 +02:00
d916cedb4f Better handling for previous fix: Make sure previous redraw rect stays
after the stroke so that it can be unioned with current rect correctly
during the draw update. For some reason dyntopo clipping misbehaved
before that.
2014-03-06 18:19:02 +02:00
d4ad050632 Fix error in previous commit. Included dubious fix for smooth brush by mistake 2014-03-06 16:39:30 +02:00
175a6b2fce Solve partial redraw issues in sculpting.
* Do union with previous partial redraw before overwriting with self and
store unmodified new rect to avoid rect getting bigger.
* Make rect one pixel wider instead of smaller so edges do not get left
outside. Overall this looks quite better.
2014-03-06 16:32:02 +02:00
f53014d642 Fix simplify brush not supporting autosmooth. There is no reason why
this should be so and it's useful to quickly decimate and smooth at the
same time.
2014-03-04 18:57:45 +02:00
13ea967cce Code cleanup: correct abs use and quiet warnings 2014-03-01 14:26:18 +11:00
08f5e3897c Modifier: rename triangulate scanfill to ear-clip 2014-02-21 15:03:34 +11:00
37026b12ec Code cleanup: use bool for static methods 2014-02-05 22:36:15 +11:00
36fc4e15f6 Fix for vpaint_stroke_test_start returning operator flags, not bool
also use bools for paint callbacks
2014-02-05 22:18:33 +11:00
30b5aef678 Fix T38427: Sculpt mode dimension changes don't Undo 2014-02-04 19:47:17 +06:00
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
018fe81779 Fix T38269: scene full copy in mesh edit or sculpt mode did not copy mesh edits. 2014-01-20 14:16:22 +01:00
62aa004c25 Style Cleanup: whitespace 2014-01-12 22:05:24 +11:00
ba8d65a9a7 Code clean-up change naming of gpu buffers used by pbvh to better
reflect that. Previous name GPU_Buffers was very similar to GPU_Buffer,
renamed to GPU_PBVH_Buffers
2014-01-03 12:48:12 +02:00
c1c26c36f6 Style Cleanup: remove preprocessor indentation (updated wiki style guide too) 2013-12-22 14:12:19 +11:00
f55eba5462 Code Cleanup: style 2013-12-20 21:52:08 +11:00
a102d3397f Sculpting:
* Support for symmetry in lasso masking
* Optimize away symmetry multiplication of gravity vector if no gravity
active
* Move flip_v3_v3 to paint_utils (used in masking as well)
* Use OpenMP for mask flood fill too.
2013-12-19 14:40:19 +02:00
e915ecdfc4 Fix T37387 VIEW3D_OT_view_selected in sculpt mode zooms far from
sculpted object if last sculpt stroke ends outside the mesh.

Code here used the last true location which is invalid in that case,
just reuse the average stroke location instead.
2013-12-19 05:09:42 +02:00
58ae499fc1 Support for symmetry in gravity.
Also fix previous commit original coordinate change for proxy calculation
(broke all non-anchored brushes -facepalm-) and cache the gravity support
result.
2013-12-19 02:25:32 +02:00
2d06ecf687 Fix T37812, anchored sculpting on a flat plane created artifacts.
This must be an ancient bug, almost as old as anchored brushes
themselves. Code did not do sphere node intersection against original
bounding boxes if an anchored brush required it. In practice this was
not easy to see because vertices were displaced inside brush radius most
of the time. However in the provided report file, displacement was far
away from the brush sphere, making the issue apparent.

Also added original check in proxy combination code (might cause issues
with dyntopo but quick test did not show any) and did some style int ->
bool style changes.
2013-12-19 01:48:30 +02:00
94a2801322 Fix T37807 gravity causes crashes when using shif-smoothing.
Turns out we didn't properly free node proxies that gravity did use and
strokes ended up accessing previous data. Also deactivated gravity when
a smooth brush is used. It is kind of distracting to get the mesh
gravitated while smoothing.
2013-12-19 00:50:39 +02:00
9efef3c251 Fix T37177, sculpting can act on opposite side of mesh in orthographic camera.
Summary:
Issue here most probably is that the start point in ray-casting is too
far away from the mesh. As a result the triangle intersection code can
sometimes miss the ray intersection. To solve this, we project the ray
segment to the boundary of the root node.

Reviewers: brecht, sergey, campbellbarton

Reviewed By: brecht

Maniphest Tasks: T37177

Differential Revision: http://developer.blender.org/D115
2013-12-18 18:34:02 +02:00
d9e42cf43e Style Cleanup: minor edits in recent changes 2013-12-18 15:35:31 +11:00
669b590229 minor style and comment fix. 2013-12-12 23:32:07 +02:00
b0a3f32ed3 improvements and simplification to gravity code:
* world to object matrix is calculated for view vector as well, reuse
that.
* if no orientation exists use world negative axis instead of object
negative axis for gravity.

there's also the issue of mirroring, it may be wise to invert the
gravity effect there but it may be better to have artist feedback on
that.
2013-12-12 19:35:33 +02:00
c740f1a792 Sculpt mode Gravity feature from GSOC 2010 by Jason Wilkins.
Reviewers: sergey, brecht, campbellbarton, jwilkins

Differential Revision: http://developer.blender.org/D89
2013-12-12 19:01:11 +02:00
e23f77b935 Code Cleanup: move mesh mapping functions into their own file/header 2013-12-12 16:28:52 +11:00
07d0926796 Style changes to refactor commit. 2013-12-10 04:28:16 +02:00
f0675b14d8 Refactoring/cleanup, borrowed from soc-2013-paint branch.
* Move symmetry options to the paint struct (where all paint systems can
make use of it)

* Rename draw_pressure to stroke_active. This is what is really checked
on those occasions that this is used. Also move turning on/off of this
option to the stroke level and avoid doing it on every stroke system.

* Rename BRUSH_RESTORE_MESH to BRUSH_DRAG_DOT. In image painting this
won't restore any mesh, so better have a name that is directly linked to
what the flag actually does.
2013-12-09 22:40:02 +02:00
6d8f76cfab Minor addition for completeness (unlikely to happen), make sure new
sculpt struct has at least dyntopo subdivision turned on.
2013-12-08 01:57:44 +02:00
1908909273 Sculpt Dynamic Topology: support collapsing edges without subdividing edges as well
This allows you to choose between subdivide edges, collapse and both. Being able to
only collapse edges can be useful to simplify meshes with accidentally introducing
more detail.

Reviewed By: psy-fi, carter2422

Differential Revision: http://developer.blender.org/D15
2013-11-26 00:21:04 +01:00