Commit Graph

265 Commits

Author SHA1 Message Date
c94db5d1c7 Fix T61778: Crash when adding material slot to object
For some reason the mat_nr can be superior to the number of material slots
present on an object. Just cap this number to the max available slot.
2019-03-05 18:58:22 +01:00
f96fffe0db Fix/workaround T62167: Random crash when displaying wireframes.
Some old AMD drivers crash when a vbo with stride 1 is used a few times.
I have not found a real solution to this problem. So the solution was to use a vbo with stride 4 (which in theory is less efficient and takes up more memory space).
2019-03-04 10:27:41 -03:00
9d34a9d7e5 DRW: add back edge highlighting for active face drawing
Removed in aa7b013bd5 for performance reasons, however highlights
can't always be seen against specular shading, see: T55456#510873

Instead of having a highlighted inner-edge, use the active edge color.
2019-02-28 18:03:31 +11:00
60a1ccbe2c DRW: use active color for face dot
Matches active vert/edge modes.
2019-02-28 14:57:03 +11:00
06961515e4 Fix T61965: Crash edit-mesh drawing w/ hidden faces 2019-02-26 16:04:23 +11:00
39afc2775f Cleanup: style 2019-02-20 08:27:01 +11:00
11b8d8a838 DRW: Fix Crash when enabling object wireframe option 2019-02-18 16:02:27 +01:00
0c4334d0bb Cleanup: Remove old wireframe batch cache code 2019-02-18 14:17:57 +01:00
e49d955541 Wireframe: Refactor to use GL_LINES instead of triangles with alpha blend
This gets rid of the progressive fading of the edges as it does not work
with depth perception (sorting problem with alpha blending).
2019-02-18 14:17:57 +01:00
de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
e0e6229176 Cleanup: rename Mesh.edit_btmesh -> edit_mesh
When bmesh was in a branch we had both edit_mesh and edit_btmesh,
now there is no reason to use this odd name.
2019-02-17 18:05:18 +11:00
4d890f3778 Cleanup: unused variable 2019-02-13 11:08:38 +11:00
a1d440de4a Edit Mode: Fix element selection on some old AMD GPUs
Tested on an `AMD Radeon HD 7570M`.
It seems that a VBO containing only `unsigned bytes` or `unsigned shorts` can't be read correctly in a shader.
Strange that if the index buffer repeats the drawing of the vertices (as was done before rBa04dd15193e6) the problem disappears.
The disadvantage of this solution is that the memory size for a selection VBO increases by about 4 times.
But the loss in optimization is negligible.


Thanks to @fclem for pointing out the possible source of the problem and reviewing the fix.
2019-02-12 14:12:57 -02:00
0021273b31 Fix crash drawing loose vertex from recent changes 2019-02-08 07:27:00 +11:00
a04dd15193 Edit Mesh: Only draw vertices once
Only add each vertices to point ibo once. That requires tagging each mvert
in the case of modifier preview.
2019-02-07 20:36:29 +01:00
ea30767997 Edit Mode: Reduce number of edges drawn
This make sure only one line is drawn per edge.

It makes the function mesh_create_edit_loops_points_lines() non-thread safe
but this is fine as of now because nothing is multithreaded at this point.
Also this is the only function use this flag so it might be OK.

The side effect is that we don't need to use depth test in edit mode
overlay so the masking artifact will not appear.
2019-02-07 19:11:01 +01:00
7584ef85bf Edit Mode: Fix edge partially displayed as selected with modifier preview
Force set the flag vertice selected in this case.
2019-02-07 19:06:54 +01:00
eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
a13fb30917 Edit Mode: Fix loose edges edit mode normal display broken 2019-02-05 15:02:15 +01:00
86193d25db Edit Mesh: Refactor Edit cage drawing to use old style drawing
This is work in progress. Look is not final.

This align data VBO data structure used for edti cage drawing to the one
use for normal drawing.

We no longer use barycentric coords to draw the lines an just rasterize
line primitives for edge drawing. This is a bit slower than using the
previous fast method but faster than the "correct" (edge artifact free)
method. This also make the code way simpler.

This also makes it possible to reuse possible and normal vbos used for
shading if the edit cage matches the

This also touches the UV batch code to share as much render data as
possible. The code also prepare for edit cage "modified" drawing cage (with
modifier applied) but is not enabled since selection and operators does not
work with modified cage yet.
2019-02-05 15:02:15 +01:00
65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
68cab3aff6 Cleanup: replace attrib w/ attr
Also rename GPUVertexAttribs to GPUVertAttrLayers,
avoids confusion with GPUVertAttr which isn't closely related.
2019-01-29 08:32:25 +11:00
f20dbc293f Cleanup: blank lines over doxy headers 2019-01-26 21:43:24 +11:00
19b5f5493c Cleanup: draw manager headers 2019-01-26 20:08:52 +11:00
a4fe338dd8 Cleanup: add missing braces to draw manager 2019-01-25 07:12:13 +11:00
bc32240105 Fix T60810: crash editing mesh with subdivision modifier
typo in rBdc7e49298940

Reviewers: fclem

Maniphest Tasks: T60810

Differential Revision: https://developer.blender.org/D4244
2019-01-24 14:36:01 +01:00
dc7e492989 Fix T60545: Buffer overflow in selection batch creation
Use loose_edges and loose_verts buffer instead of detecting them manually.
2019-01-17 19:48:00 +01:00
9d8445d6a9 Cleanup: de-duplicate loose vert/edge checks 2019-01-17 13:20:44 +11:00
76fdd33df2 Fix T60578: Crash selecting after hiding vertices 2019-01-17 13:05:45 +11:00
6f9e3e9d33 Fix T60476 Loose vertices only partially drawn
Was caused by a missing vbo attachement.

Also fix said Vbo refreshing when selecting.
2019-01-14 18:33:07 +01:00
9f51fc656e EditUV: Only clear data VBO when selection changes
This is a small optimisation that make UV selection faster.
2019-01-11 20:09:42 +01:00
3a9909f38e Fix T59990: Crash when entering edit mode with skin modifier enabled
The skin modifier does not keep the UV layers.

This just add a safety check when there is no UV layers.
2019-01-11 18:56:05 +01:00
1c91b6ee29 UVEdit: Port texpaint_loop_wire to batch request
This removes code duplication and put an end to the old "create at request"
batch creation.

Also it uses the same vbo as the uv layer used for shading. Reducing VRAM
usage.

Also fixes the modified uv display in uv edit mode.
2019-01-11 16:00:23 +01:00
621a6d4a5d UVEdit: Add back uv angle stretch aspect correction
This is now done in shader so that the batches are shared across ImageUV
areas.
2019-01-11 16:00:23 +01:00
5f3fdee53a UVEdit: Port batches to batch request
This is in order to allow more spaces to have their batches created at the
same time and sharing the batches.

This is part of the effort fo making the drawing code more optimized. This
commit however should not introduce any difference.

This commit bypass the aspect ratio correction for angle stretch display
but this should be fixed in the next commit.
2019-01-11 16:00:23 +01:00
a46dc9b234 Mesh Batch Cache: Cleanup Unused 2019-01-11 16:00:23 +01:00
55ddb21b7c Mesh Selection: Port to batch cache request
This makes it more future proof and remove baked id offset inside the vbos.
Instead we add the offset as a uniform. This makes it possible to reuse
the vbos instead of discarding them all the time.

Also using batch request may reduce batches creation time.
2019-01-11 16:00:23 +01:00
4c0c4e7f9f Mesh Batch Cache: Fix wrong assert 2019-01-11 16:00:23 +01:00
943852c0dc Mesh Batch Cache: Put context evaluation out of batch cache
This is in order to be able to call DRW_mesh_batch_cache_create_requested
outside of the draw manager
2019-01-11 16:00:23 +01:00
369e1d46f0 Fix T56545: Material referencing missing UV crash 2019-01-09 01:05:43 +11:00
543ddbe6bf Cleanup: warnings (clang) 2018-12-30 15:15:05 +11:00
7a26e930a8 Cleanup: macro hygiene, line length 2018-12-21 10:46:26 +11:00
217727cb35 Mesh Batch Cache: Fix missing flag for looptris indexbuf generation
Fix T59637: Crash report - Overlays -> Face Orientation causes crash
2018-12-20 23:42:21 +01:00
a9706476e3 Mesh Batch Cache: Fix uninitialized loop variable 2018-12-19 22:56:15 +01:00
1a7fe54a85 Fix T59578: enabling "vertex group weights" in edit mode results in crash 2018-12-19 12:32:13 +01:00
5b277d7a18 Mesh Batch Cache: Port loose_edges to batch request 2018-12-18 22:17:53 +01:00
2f00e0a37b Mesh Batch Cache: Cleanup / Reorder function for more consistency 2018-12-18 22:17:53 +01:00
604101d262 Mesh Batch Cache: Port edge_detection to batch request
Also add proper support for mapped meshes (deformed by modifiers in edit
mode). So this fixes the shadows of workbench in edit mode.
2018-12-18 20:51:52 +01:00
99fb654ffd DRW: Cleanup / Renaming of mesh batch cache functions
THis is in order to avoid the jungle of names being different at each
step of the API.

Also removes some unused functions.
2018-12-18 20:51:52 +01:00
df88b6a48d Mesh Batch Cache: Port all_edges batch to batch request 2018-12-18 20:51:52 +01:00