Commit Graph

582 Commits

Author SHA1 Message Date
e6605d5f37 Fix depth offset in paint mode wireframe.
The original offset was wrong because it applied a constant to
homogenous coordinates (the actual depth is z/w), which broke
totally if near clip distance was reduced.

A correct depth offset has to take slope into account like
glPolygonOffset in order to avoid dotted lines caused by
interpolation precision variations. When drawing wire lines
however only the slope of the line itself is accessible, so
also generally increase the offset when the object is close.
2018-11-29 17:51:43 +03:00
32ab0647a5 DRW: Implement Hair Weight drawing
Fixes T57931 Particle weight edit mode is not supported.

There is a bug that prevent refresh of the toolsettings on which is based
the weight / non-weight display selection (see T58086).
2018-11-27 13:49:22 +01:00
Dalai Felinto
8e65e38649 Font textbox overflow: Different methods
Sometimes the text doesn't fit. What to do in this case?

* Overflow: The default behaviour still is to overflow the text.
* Truncated: If any text box is defined we can also not draw the text
  that goes outside the text boxes.
* Scale to Fit: For single-text box texts we can scale down the text until
  it fits.

To support textboxes we are bisecting the scale until we find a good
match. Right now the hardcoded iteration limit is 20, and the threshold 0.0001f.

An alternative in the future would be to tackle this by integrating existing
layout engines such as HarfBuzz.

Note: Scale to fit won't work for multiple text-boxes if any of them has
either width or height as zero.

Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3874

Feature development sponsored by Viddyoze.
2018-11-26 21:47:33 -02:00
0b0322099c Fix T57930 : Wrong hair shading in particle edit mode
Implement strand selection visualisation but without any shading.

I think this is not the overlay job to draw the strands shaded.

We can already view the children strands shaded for now but we might add
an option to draw the shaded strand instead of (or in addition to) the
guide strand.
2018-11-26 21:25:33 +01:00
aac2eba1aa DRW: Cleanup: Fix missing uniform warning in curve edit mode 2018-11-26 21:25:33 +01:00
14ea3130ee DRW: Hair: Fix hairs not working properly with duplis
Fix T55355 Instanced hair not working well for EEVEE and workbench
2018-11-26 21:25:33 +01:00
7d32d87a86 Viewport: implement hiding faces in paint modes.
In 2.79 hiding works in paint modes with selection enabled,
so it is a missing feature. This implements it in texture
paint overlays and in workbench base shading.

Reviewers: fclem

Differential Revision: https://developer.blender.org/D3989
2018-11-26 20:26:29 +03:00
2b97a250f6 Cleanup: remove useless redundant NULL check. 2018-11-25 18:49:57 +01:00
0d0c79e879 DRW: Make non Mesh object wire show in edit mode 2018-11-23 18:03:18 +01:00
d56c0a0a6a Cleanup: rename bone-select to xray
This shows bones in font and uses the xray toggle binding.
Also 'bone select' isn't very meaningful on it's own.
2018-11-23 13:48:21 +11:00
1ffb2bf917 Pose: make pose-bone xray usable in wpaint mode
Update UI, draw-manager and operator to support with pose-bone-xray
when in weight paint mode.
2018-11-23 13:19:22 +11:00
7c74f5006a Cleanup: newlines in error prints 2018-11-23 07:29:21 +11:00
f30271e3d4 Image Empties: Potential Fix for T57696
So far this makes a new pass for image empties that does not write to the depth buffer.

Todo:
- Sort empties using `DRW_pass_sort_shgroup_z`.
- Calculate correct bounding boxes.
- fix bounding box memory leak.

Reviewers: fclem

Differential Revision: https://developer.blender.org/D3922
2018-11-22 18:31:03 +01:00
e16ef56a0d Fix T57980: Assert failure in draw manager when opening file 2018-11-22 16:55:29 +01:00
566a4a96cb Fix T57891: Radius of strip hair doesn't scale with object scale
Note that this only works fine with uniformly scaled objects.
Otherwise, the hair thickness will vary in a weird way depending on viewing
angles.
2018-11-20 13:09:27 +01:00
5f21030a81 Image Empties: Option to not display the backside of image empties
Reviewers: brecht

Differential Revision: https://developer.blender.org/D3964
2018-11-19 19:33:09 +01:00
740adf2a4b Cleanup: style 2018-11-19 13:37:18 +11:00
b4640ea020 DRW: Fix object wire appearing when object is drawn as bounds 2018-11-17 14:56:17 +01:00
23c3124b56 Edit Mesh: Improve mesh cage drawing / fix errors and cleanup
* Fixes vertices with bad coloring. Now vertices draw with depth write so
they occlude the underlying face geom overlay, avoiding double drawing the
vertex.

* Decrease the z_offset of edges so they don't poke too much through
geometry. Also delete this offset in ortho view.

* Add zoffset to active and selected vertices so they always draw on top
if they overlap a non selected vertex.

* Fix alpha of edge_fix in vertex selection mode
2018-11-16 00:13:06 +01:00
d546269de8 Cleanup: Double semicolon at the end of line 2018-11-15 16:32:18 +01:00
c3d03b4434 Lamps: Remove HEMI light type
This type is not supported by either Eevee or Cycles. If other types of
lamps are needed by external engines, we should support adding custom types.
2018-11-14 11:50:37 +01:00
Dalai Felinto
221d078641 Multi-Objects Metaball: Selection refactor - fix pick and box selection
This is inspired/based on the code we use for armature bone selection.
Both pick selection, and box selection should be working now.
2018-11-09 16:40:43 -02:00
36e6a41f6f Object Mode: Grid: Make antialiasing more grounded
Went a bit anal on this but at least we will have a decent AA reference
for lines in the future.
2018-11-09 15:35:31 +01:00
2ae88c4d78 UI: Make the grid alpha themable
Now that the 3d grid is infinite, antialiased, not occluded, and overlaid
on top of rendered view, being able to decrease its opacity to reduce
visual strain is a must.
2018-11-05 16:31:12 +01:00
050e91340d Edit Mesh: Fix wire opacity when not rotating the view in Xray mode 2018-11-05 16:31:11 +01:00
46d88c5850 Edit Mesh Mode: Improve edge drawing
Make edge decoration a bit thinner and try to reduce missing edge segment
due to triangle barycentrics.

This invert the "edge fix" strip offset direction, meanning there is now
the possibility that these triangles poke through nearby geometry depending
on the viewport near/far clips distances.
2018-11-02 15:45:13 +01:00
a3802f66e2 Image Empties: More visibility settings
Support for showing images in background/foreground and only in perspective/orthographic view.

Internally the depth of the image is modified in the fragment shader by setting `gl_FragDepth` explicitly.

The UI still needs some work to improve usability, see D3863 for details.
Currently there is one duplicated function, not sure how to best deduplicate it yet. (`is_image_empty_visible`)

Reviewer: fclem, brecht, campbellbarton

Differential Revision: https://developer.blender.org/D3863
2018-10-31 13:42:33 +01:00
603774c1eb Fix T56865: Selection of bones not working properly if the option In Front (old X-ray) is enabled
Differential Revision: https://developer.blender.org/D3828
2018-10-30 15:31:32 -03:00
ffcf193653 UI: Make Wireframe size respect DPI settings 2018-10-30 19:07:49 +01:00
87f4c83018 Object Mode: Grid: Allow more subdivision in orthographic views
2.7x was displaying 2 additional subdivision for theses views. Bumping to 3
just to say we improved it!
Hypothetically it can be increased as much as we want but float precision
can quickly become an issue.
2018-10-30 16:44:23 +01:00
26223f8d9a Object Mode: Grid: Reduce line thickness a tiny bit and apply UI scaling 2018-10-30 16:44:23 +01:00
Dalai Felinto
a2dc4d2532 Fix T57368: Multi-Object-Mode: Edit Lattice draws only active
As it turned out the issue wasn't that we were drawing only the active,
but that the "object mode" lattice drawing was drawing on top of the
drawing for all the edit mode lattice objects.

We are doing the same original behaviour for curves and even meshes. To be
investigated if it is ok for those other cases.
2018-10-26 13:11:07 -03:00
28d5ebbc15 Wireframe: Fix wireframe object drawtype with "in front" draw option
First problem is that enabling the "in front" option made the wire object
test against an not updated stencil buffer.

Second problem is that the "in front" option was useless on wire objects.
To fix this we bypass the depth test and live with some sorting problem.
2018-10-23 18:04:45 +02:00
b31fc40fcd DRW: Fix missing uniform warning in debug mode
Fix T57318
2018-10-22 15:56:12 +02:00
a20c590966 DRW: Fix crash on startup for old Nvidia drivers
This should fix T57296 once and for all.
2018-10-22 15:56:12 +02:00
769b979abb Cleanup: trailing space 2018-10-21 16:23:15 +11:00
905921d2b5 Fix function using same local variable name as output variable
This may fix issues with certain compiler.
2018-10-19 18:13:22 +02:00
642b77e874 Edit Mesh: Decrease the depth bias on vertices 2018-10-18 20:42:32 +02:00
a2922f9840 Optimization: Edit Mesh Overlay
In tests with edit_cage: performance jumped from 9.37ms to 9.17ms.
2018-10-17 15:46:58 -03:00
f666be6edf EditMesh: Fix uninitialized value causing red outline on edges 2018-10-17 18:49:27 +02:00
fd61b49d50 ObjectMode: Fix Outlines being drawn for BBox meshes 2018-10-17 18:09:37 +02:00
91e5e02aff ObjectMode: Fix instances with BoundBox drawtype not displaying 2018-10-17 18:09:37 +02:00
41ad845531 Optimization: Edit Mesh Overlay: Avoid computing fixvec unnecessarily.
This brings a big difference to meshes with edit cage adjusted for modifiers.
In my tests, the suzanne with subdivision modifier level 3 went from 4.80ms to 3.05ms.
2018-10-16 20:42:50 -03:00
1f1da26840 Edit Mesh Overlay Geometry Shader: Ignore correction geometry for loops that are not part of an edge.
By the tests I could only observe a considerable difference in the peformanse when the vertex size is 30.
Vertice 3 showed no difference in a suzzane with subdivision modifier level 3 + show-on-cage.

Point Size 30: 7.29ms vs 2.55ms

Reviewers: fclem

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D3805
2018-10-16 23:04:57 +02:00
2ab6272233 DRW: Fix assert with BoundBox object display mode 2018-10-16 22:53:32 +02:00
478899dee7 Edit Mesh: Fix missing loop normal display 2018-10-15 16:04:50 +02:00
22814ca555 Fix related to T55961: Glitch in selecting loose edges on some AMD drives. 2018-10-15 09:54:24 -03:00
c2afa3ef46 Edit Mesh: Add comments explaining weirdness in the code. 2018-10-15 09:50:31 -03:00
0c39453071 Cleanup: Edit Mesh shader: Remove unecessary varying 2018-10-15 10:43:49 +02:00
9a38a91f41 Fix T55961: Anomalous edges cage on some AMD buggy drivers.
Reviwed on irc by @fclem.
2018-10-14 14:07:45 -03:00