Previously, the implementation of this was quite awkward, with
the preference swapping mouse buttons globally, rather than just
selection, as is advertised on the pref. This had the effect of
changing the painting in sculpt/texture paint/weight paint/etc to
the left mouse button. This was totally silly, since when using a
tablet, left mouse select is the sane way to go, but it meant
that every time you wanted to sculpt or paint, you had to switch
the mouse buttons around so you could actually use the tablet as
normal.
This commit fixes that, and makes the preference do just what it
says, use left mouse for selection (i.e. in object/edit mode) and
only that.
Added a new input control that smooths the brush stroke.
This option controlled by the menu item Sculpt>Input Control>Smooth Stroke. When enabled, the brush has a delayed effect on the model; a green line is drawn to indicate the smoothed path of the stroke. After ~200 pixels, the first half of the stroke will be applied to the model; the process then repeats, with a new segment of the stroke being applied to the model after every 200 pixels. On mouse up, any remaining portion of the stroke will be applied.
Other changes:
* Added a flags field to SculptData; currently only used for smooth stroke but other flags can be moved into it
* Moved the damaged_rects/verts into SculptSession
* Simplified brush application by moving init_editdata into do_symmetrical_brush_actions
* Removed Averaging from sculpt Input menu; smooth stroke should take its place
TODO:
* Fix display of the smooth line in Partial Redraw mode
* Make the smoothing and delay factors adjustable
* Optimize the stroke application (currently using the old 'dot' style of applying the brush)
Kind of fixed [#6688] sculpt - if 2.44 blend is openned in 2.43 with flatten brush selected causes crash
* Added better handling for new brushes; if more brushes are added they will no longer cause a crash (but this doesn't help older Blenders compiled without this fix.)
Fixed bug #6631, Sculpt Tool don't works correctly on a mesh with Armature modifier
* Modified the calculation of projected (2D) vertex locations to use deformed vertex locations when appropriate
Fixed bug #6639 ] Sculpt mode clearing brush texture causes a crash (null pointer)
* Added code to clear the brush texture preview (used for propset) when deleting a brush texture
* Added a check in tex_strength() for an empty (NULL) texture slot to prevent the crash
Fix for bug #6556, Sculpt draw/inflate brush strength is dependent on object scale value
Added a scaling factor to brushes that adjusts for objects which have been scaled. Usually this means that the vertex locations are also scaled up or down.
This commit should hopefully fix some of the problems some people were
having with tablet support in sculpt mode, and also the problems I made
visible with my previous commit related to number field dragging.
Now, all the ghost related stuff is tucked away in ghostwinlay.c and a
simple Blender API, similar to the existing get_mbut() for example, is
provided to access the tablet data. As with the other mouse related data in
Blender, the tablet data is cached upon each mouse move or click, in the
Window struct.
You can now just use:
float get_pressure(void);
void get_tilt(float *xtilt, float *ytilt);
short get_activedevice(void);
to get such data from the tablet. Documentation on the returned data
is in ghostwinlay.c in the _Window struct definition.
Brecht and Nicholas, I've updated the painting and sculpt code and it works
just fine here, you may want to give it a check though to make sure I
haven't done anything silly.
* Added new brush, "Flatten". This brush pushes vertices along the normal defined by the average normal of each vertex within the brush area. The vertices are pushed towards the plane defined by vertices towards the edge of the brush. Essentially, this means that the direction of flattening is dependent on the surface beneath the brush.
* In order to make space for the flatten brush, the controls inside the Sculpt palette were widened to 268. (Note that the panel width didn't change, so it still fits properly in the vertical layout.)
* Todo: it would probably make sense to make the "View" slider available under the Brush tab available for the Flatten brush (currently it's only used for the Draw brush.)
Added a SculptSession parameter to sculptmode_propset_end, to avoid propset_end creating a new session (propset_end is called when freeing the session, so this can cause a memory leak.)
Removed special Sculpt Mode undo code. Sculpt Mode undo is no longer so useful, since in order to make it more correct it has gotten slower, so normal BIF_undo_push is used now. Fixes bug with Shape Keys, sculpting on a shape key wasn't doing undo properly.
Fixed bug #6056, Brush Grab in SculptMode don't works for ShapeKeys
* Grab Brush stores active vertices differently from other brushes, need to read from a different List when updating shape keys.
* Replaced get_tex_angle() with tex_angle() and set_tex_angle(). This removes the need to do a bunch of error-prone NULL checking everywhere the texture angle is used.
When in sculptmode, enter editmode, add faces or vertices, exit editmode,
then undos/redos screw up mesh.
Now the stack for sculpt is freed. Later on one could precisely test why
this undo isn't resistant to such changes.
- possible fix for crash mentioned in [ #5781 ] Sculpt Brush Tool not working correctly
- workaround for possible compiler glitch with floating point conversion.
the texture (in texture buttons) crashed painting. Reason was reading
a NULL pointer.
- fix for bufix: commit by Ken Hughes accidentally deleted a bugfix
(yafray render doesn't support bake, and should return)
- tooltip fix
ShapeKeys could get corrupted when using the sliders (or relative values).
Was caused by 25 dec commit to get SculptMesh work with Shapes... very
strange implementation here. For now, disabled this function to enter when
not in sculpt mode, while waiting for Nichololas to make it definite OK.
Fix for bug #5248, sculpt - mirrored tiled texture odd results
Changed the algorithm used for projecting the brush texture onto the model. The old algorithm was never implemented properly, causing increasingly
wonky distortions of the brush as it got farther away from parallel to the screen. The new system uses the screen coords of vertices, the obvious
advantage being that 2D screen coords can be mapped quite easily to 2D texture coords. The main disadvantage of this method is that there are still
distortions in the brush as the surface beneath it becomes less parallel the screen. These distortions, however, are not as bad as the old ones
because they are predictable from the user's perspective. (It's analogous to a movie being projected onto a sphere; if the viewer is in front of the
sphere there is no apparent distortion, but from the side the movie appears stretched and distorted.)
This may still be worth revisiting after the release.