Page MenuHome

Curve Edit Mode: support for curve handle-type theme colors
ClosedPublic

Authored by Germano Cavalcante (mano-wii) on Jan 6 2018, 7:54 AM.

Details

Summary

Attempt to solve the T51258

Code style needs to be heavily analyzed.

It is not complete. There are still some TODOs commented in the code.

I can continue as soon as it is reviewed.

Diff Detail

Repository
rB Blender

Event Timeline

source/blender/draw/modes/edit_curve_mode.c
135–146

Wondering if it wouldn't be better to use GlobalsUboStorage to store these colors?

Then we just need a shader that selects the color to use within the struct.

Am not so experienced here, just seems a bit weak if we have to define static theme storage all over the place.

  • Stored colors in GlobalsUboStorage;

IMHO, the advantages of storing colors in GlobalsUboStorage is that it follows the convention of other engines and keeps the code more organized.

One drawback is that the DRW_globals_update(void) function is called inside DRW_draw_render_loop_ex, so UBOs are rewritten all the time, which seems to be not very efficient.

One suggestion would be to use DRW_globals_update(void) as a callback that is only called when some property within the Themes is changed.

Germano Cavalcante (mano-wii) marked an inline comment as done.Jan 6 2018, 6:05 PM

Minimizing updates to GlobalsUboStorage can be handled separately.

Only the active spline should show with an active outline, otherwise this patch LGTM.


Note: this method of drawing an outline around the handle ignores blenders line-width option.
However IIRC line width in the draw manager isn't fully supported as is, so could leave this as a TODO.

source/blender/draw/modes/shaders/edit_curve_overlay_handle_geom.glsl
12

Needs to be flat out vec4 finalColor; for me, otherwise I get a error

error: interpolation modifier mismatch for varying parameter (named finalColor) between shader stage
Campbell Barton (campbellbarton) requested changes to this revision.Jan 8 2018, 5:33 AM
This revision now requires changes to proceed.Jan 8 2018, 5:33 AM
  • Added flag to distinguish the active nurb;
  • Added colors TH_NURB_ULINE and TH_NURB_SEL_ULINE;
  • GLSL switch is not supported on intel (thanks to @Clément Foucault (fclem) for pointing out the error);
Germano Cavalcante (mano-wii) marked an inline comment as done.Jan 8 2018, 5:01 PM
  • Take viewportSize into account to get the offset to the outline;
This revision is now accepted and ready to land.Jan 9 2018, 3:26 AM