Commit Graph

809 Commits

Author SHA1 Message Date
Jeroen Bakker
dfe088c5d9 Workbench: SeeThrough draw option
Option to see through all meshes (transparency)

Works for OB_SOLID and OB_TEXTURED. Does not work for
V3D_SHADING_SHADOW.

TODO: Fresnel effect
2018-05-22 14:55:50 +02:00
Clément Foucault
c7df618263 3D Cursor: Clip if behind near plane. 2018-05-22 14:33:07 +02:00
Joshua Leung
47b9d7494e Experimental Armature Drawing Tweak for Relationship Lines
Only show hierarchy relationship lines when bone or its parent is selected.
This cuts down the clutter visible in general when relationship lines are
enabled (currently they can't be disabled), which should make it more useful
to keep them on (e.g. constraint lines/hints can still be drawn this way).
2018-05-22 13:39:01 +02:00
Campbell Barton
99f994e7ed Fix crash drawing edit-lattice
Edit-mode was never using batch cache.
2018-05-22 08:10:36 +02:00
Campbell Barton
ac476375b1 Cleanup: style, whitespace 2018-05-22 07:39:16 +02:00
Campbell Barton
67cf4cb5ec Cleanup: replace MEM_SAFE_FREE -> MEM_freeN
No need to check for NULL in this case.
2018-05-22 07:28:14 +02:00
Bastien Montagne
13d2df32c7 Fix broken draw code from last Thursday commit.
Seriously... Not all edges have faces!!!!!!!!

Quick fix to make it possible to load/use customshaped bones again, not
100% sure it is correct, but... At least it does not crash anymore!
2018-05-21 18:00:50 +02:00
Campbell Barton
575437ac90 3D View: fix scale of 3D cursor crosshair
Interface scale was applied twice.
2018-05-21 14:51:10 +02:00
Clément Foucault
4bbb1d4e5e DRW: Rename some DRW_STATE_* for more consistency. 2018-05-20 19:17:11 +02:00
Clément Foucault
7a28dea1e1 Workbench: Shadow: Add Depth Fail method
Also add new debug visualisation.

Depth fail method is not used for the moment but has nice benefits. It will
be used efficiently in the future.
2018-05-20 19:14:22 +02:00
Clément Foucault
687f09a8ad Workbench: Optimize Shadows.
This makes the shadows ~10 times faster in the general case.

This only create extrusion geometry on the outline edges. Also we increment
or decrement the stencil buffer by 2 for each manifold edge and only by 1
for non manifold. This make the algorithm robust yet less heavy than creating
one prism for each triangles.
2018-05-20 19:14:22 +02:00
Campbell Barton
12eb29fe35 Cleanup: whitespace, duplicate includes 2018-05-20 08:52:56 +02:00
Clément Foucault
35a298db52 Armature: Fix non working Wireframe option on bones. 2018-05-17 11:11:53 +02:00
Jeroen Bakker
ba4d215139 T55090: Proxy bones were not selectable
- Implemented custom selection in pose mode overriding the rest. This
selection mode is only done for bone selection right now
2018-05-17 08:54:40 +02:00
Dalai Felinto
e51bf11b15 Remove ViewLayer settings - cleanup 1/2 2018-05-16 23:13:28 +02:00
Campbell Barton
9abb4b555a Cleanup: unused vars 2018-05-16 19:04:29 +02:00
Clément Foucault
5ed702dc9c Armature: Fix T55068: Wireframe bones with custom shapes not working in object mode 2018-05-16 18:46:35 +02:00
Clément Foucault
1b4916054e Armature: Cleanup: Remove unused function and use less silly wire drawing. 2018-05-16 18:46:35 +02:00
Clément Foucault
bcfe075f89 Armature: Fix T55070: Bones relationship lines are offsetted
Was missing object matrix multiplication.
2018-05-16 16:58:32 +02:00
Clément Foucault
a25856f2a8 GPUShader/DRW: Add Transform Feedback support.
This is a usefull feature that can be used to do a lot of precomputation on
the GPU instead of the CPU.

Implementation is simple and only covers the most usefull case.

How to use:
- Create shader with transform feedback.
- Create a pass with DRW_STATE_TRANS_FEEDBACK.
- Create a target Gwn_VertBuf (make sure it's big enough).
- Create a shading group with DRW_shgroup_transform_feedback_create().
- Add your draw calls to the shading group.
- Render your pass normaly.

Current limitation:
- Only one output buffer.
- Cannot pause/resume tfb rendering to interleave with normal drawcalls.
- Cannot get the number of verts drawn.
2018-05-16 16:58:32 +02:00
Sybren A. Stüvel
def1c3eb4b Particle System: ported most DerivedMesh → Mesh
There are a few places where DerivedMesh is still used, most notably
when calling the (not yet ported) cloth simulation. There is also still
the use of Object.derivedDeform and Object.derivedFinal. Those places are
marked with a TODO.

Some functions in the editors module were copied to accept Mesh. Those
already had 'mesh' in the name; the copies are suffixed with '__real_mesh'
for easy renaming later when the DM-based functionality is removed.
2018-05-16 16:31:38 +02:00
Sybren A. Stüvel
eacf63c96f Particle System: Pass correct particle index when drawing
Passing the wrong index caused the particles to stop being shown when the
first particle dies.
2018-05-16 16:09:52 +02:00
Sergey Sharybin
a104c41759 Particle edit: Support children particles display with copy on write 2018-05-15 17:20:02 +02:00
Sergey Sharybin
e57ba1daf5 Particle edit: Allow children to be visible in edit mode
Follows tool settings, tested without copy-on-write.

Enabling copy-on-write still needs verification and likely some fixing.
2018-05-15 17:20:02 +02:00
Sergey Sharybin
f4fd1f1f4b Particle edit: Move cache update to particle batch cache implementation
The idea is to allow "regular" strands to update edit cache and hence
get the final update strands.
2018-05-15 17:20:02 +02:00
Sergey Sharybin
e83cee73eb Draw manager: Pass object to hair batch cache
Currently unused, but is required for an upcoming work.
2018-05-15 17:20:02 +02:00
Sergey Sharybin
979c48fd66 Particle edit: Decouple caches for regular and edit strands
Makes it possible to have children strands to be visible during combing.
Actual implementation still needs work though.
2018-05-15 17:20:02 +02:00
Sergey Sharybin
361bc2bc50 Particle edit: Make visibility check to be per-particle system
This way we can see other particle systems while combing another one.
2018-05-15 17:20:02 +02:00
Sybren A. Stüvel
b6e3430417 Modifiers on Lattices now work
Tested with Hook and Armature modifiers. Requires CoW to be enabled.
2018-05-15 17:16:23 +02:00
Jeroen Bakker
ce27d11595 Workbench: Enable Textures in Edit Mesh Mode
Constructed UV out of BMesh data layers.
2018-05-15 08:58:25 +02:00
Bastien Montagne
70a60061e5 Fix crash opening 01_015_A.lighting.blend - DL_INDEX3 displist have a single normal, not one per vertex! 2018-05-14 17:41:11 +02:00
Joshua Leung
2b09062def COW Fix: The "layers used" display for armatures did not update after bones were moved between layers
Previously, the "layers_used" value was getting updated by the drawing code.
However, when using copy on write, the drawing code gets evaluated copies of
the armature data instead of the original data, so any updates here fail to
get flushed to the original data, hence the lack of updates in the UI.

Fixed by moving the calculation to RNA when setting bone layers, as it should
have been done originally. (The one downside to this is if we set individual
layer memberships one by one - this could be slower as the recalc would have to
happen each time this changes).
2018-05-14 15:42:57 +02:00
Clément Foucault
ef49a587d4 DRW: Add DRW_UNIFORM_FLOAT_COPY and DRW_UNIFORM_BOOL_COPY.
And also use a union instead of forcing the cast to void*.
2018-05-11 19:00:32 +02:00
Clément Foucault
10b9c86c80 DRW: Add DRW_view_layer_engine_data_ensure_ex. 2018-05-11 19:00:32 +02:00
Sergey Sharybin
2f0aca4596 Particle mode: Fix memory leak with simple interpolated children 2018-05-11 15:40:46 +02:00
Sergey Sharybin
aefd181b0b Fix crash going to edit mode of particles with copy on write
We can not rely on edit->psys, it is not set for particle edit,
and there is some logic deeper inside which does different things
dependent on that.

We need to replace those checks with some some HAIR vs. PARTICLES
flag and always set psys pointer.
2018-05-11 14:55:58 +02:00
Sergey Sharybin
f74c604646 Remove unused functions which will break with copy-on-write 2018-05-11 12:49:25 +02:00
Sergey Sharybin
d50821f145 Particle edit: Initial support of edit with copy-on-write
The idea is that edit mode structure is owned by original object,
and used for drawing. This is a bit confusing, especially since
path cache is also in that structure and needs evaluated object
to calculate cache.

In the future we should split edit data from visualization data,
but that's bigger refactor.
2018-05-11 12:49:25 +02:00
Sergey Sharybin
96584818b7 Draw manager: Use explicit edit structure passed in 2018-05-11 12:49:25 +02:00
Sergey Sharybin
1c6414dd1b Draw manager: Get number of cached segments from edit
This way we know it's in sync with edit mode.
2018-05-11 12:49:25 +02:00
Sergey Sharybin
327789eaf8 Draw manager: Add utility function to check whether particle systems are to be drawn 2018-05-11 12:49:25 +02:00
Jeroen Bakker
6d155dc462 T54983: Bone selection overlay
Bone selection overlay is only available in pose mode.
and when active overrules the selection buffer.

This is currently `tricked` by switching the draw engines, but this is
an exception. Not sure how to solve this in a better way.

After this is solved we can look at how to localize the dim effect to only the objects connected to the active armatures. Currently it dims the whole screen (including background).

@campbellbarton I added you as reviewer as it you have done a lot in the DRW_draw_select_loop

Reviewers: campbellbarton, fclem

Reviewed By: fclem

Subscribers: campbellbarton

Tags: #bf_blender_2.8, #code_quest

Maniphest Tasks: T54983

Differential Revision: https://developer.blender.org/D3241
2018-05-11 08:17:05 +02:00
Campbell Barton
33f3298e28 Cleanup: use 'uint' in draw manager 2018-05-11 07:48:52 +02:00
Campbell Barton
83a83a3d4b Cleanup: whitespace, duplicate includes 2018-05-11 07:43:20 +02:00
Sergey Sharybin
6f891e2b87 Draw manager: Implement point selection modes for particle edit mode 2018-05-09 15:00:29 +02:00
Sergey Sharybin
5cea8bf435 Draw manager: Initial implementation of key points visualization
Does all points all the time, ignoring the setting in viewport header.
This is to be addressed by the next commit.
2018-05-09 14:59:48 +02:00
Sergey Sharybin
033c2c7131 Draw manager: Start using more explicit API for particle edit mode 2018-05-09 14:59:48 +02:00
Sergey Sharybin
afdc5c148b Draw manager: Use utility function to get particle edit mode
Makes it more local where we have to do all the tricky checks.
2018-05-09 10:34:45 +02:00
Sergey Sharybin
43c6ba9eed Draw manager: Add support for cached particle edit paths
Before it was only supporting hair strand paths editing.
2018-05-09 10:34:45 +02:00
Sergey Sharybin
25eb6d01f5 Draw manager: Correct edit mode check for particles 2018-05-09 10:34:45 +02:00