Page MenuHome

Custom Manipulators Core System
AbandonedPublic

Authored by Julian Eisel (Severin) on Sep 15 2016, 1:16 AM.

Details

Reviewers
Bastien Montagne (mont29)
Brecht Van Lommel (brecht)
Mike Erwin (merwin)
Maniphest Tasks
T47343: Custom Manipulators: Parent Task
Commits
rBS553b4faac8b4: Merge branch 'master' into blender2.8
rBSffc46668c413: OpenGL: modernize gp_draw_strokes_edit
rBSea89b4a918bf: Viewport: bring grid over to the new viewport
rBS198e3a35c884: OpenGL: another built-in shader for 2D points
rBS6b88f3118fe0: Viewport: Starting to port over the principles of the draw flux into…
rBS86e439e3119c: OpenGL: convert gp_draw_stroke_point to new immediate mode
rBSe86bd787454f: Gawain: more ways to set uniform color
rBS360cb8700716: OpenGL: modernize more volumetric gpencil drawing
rBSedcce96d971f: OpenGL: more built-in GPU_SHADERs for points
rBS5e8c4ae75b20: Barebones for viewport code apart from 2.7x drawing code
rBSc46250061852: Gawain: more ways to set uniform color
rBS1731e94d0c38: draw gpencil erase cursor with new imm mode
rBSe874f3cdc59d: draw gpencil sculpt cursor with new imm mode
rBS3a4c1db14be6: fix Linux build
rBS79b8242fd101: Gawain: fix bug in immUniformColor4ubv
rBSae44e24fed4d: Merge remote-tracking branch 'origin/master' into blender2.8
rBSba30b852f317: OpenGL: draw volumetric gpencil with point sprites
rBS55aadccbde3a: Merge branch 'master' into blender2.8
rBSc50ccc847613: Merge branch 'master' into blender2.8
rBS72473a61b0a4: Fix compile errors with Alembic.
rBS875d63ccb565: OpenGL: one more point shader
rBSb8e3d81f31ee: OpenGL: fix point sprites
rBS5753a1462ffb: OpenGL: new built-in shaders for drawing points
rBS82648a8f919c: OpenGL: make platform requirements explicit
rBSd1b21d1278b3: OpenGL: add support for programmable point size
rBS47bba7e15f4b: OpenGL: draw nurbs control verts with new imm mode
rBS42ed1f0e3cbd: Merge branch 'master' into blender2.8
rBS35bd833e0249: Cleanup: Style
rBSbbf32980b09f: OpenGL: draw speaker with new immediate mode
rBS4c7ff8fb1e3c: Fix animation transition in region overlay not working since 4a1feaa5
rBS9bac74c27b32: Complement fixup for 4a1feaa5558ed603 (texture shaders)
rBS83d5a919e26a: modernize basic shader a tiny bit
rBS0ca211885182: safety checks in GPU shader library
rBSad32b774cbfe: fix basic shader syntax when drawing lines
rBS8cff9c20fff9: Merge branch 'master' into blender2.8
rBS88aa42a6f7b2: Fix most toolbar panels not visible
rBSfc485302cc35: immediate mode: using texture shader for stereo drawing
rBS9bea012b8ca0: specialize mat3 multiply routines
rBSa731c75442f6: port math function from Viewport FX
rBS628ef78e8a9d: overhaul gpuMatrix API
rBS5c6baf1ee975: specialize mat4 multiply routines
rBS36bbdf142c52: OpenGL: fix new shader for Mac
rBS7fc2e333bb26: small merge fix
rBSaddc66699925: constify BLI_math_matrix inputs
rBS1d469f3780dc: OpenGL: remove double precision matrix functions
rBS4a1feaa5558e: immediate mode: Triple Buffer and two new shaders for TEXTURE_2D and…
rBS1dfb89d22930: Merge branch 'master' into blender2.8
rBS0e7c3dfe75cb: OpenGL: matrix code from viewport-fx
rBS9047717b3f51: Gawain: support triangle strips & fans in immediate mode
rBS825150605e36: GPU_basic_shader uses GLSL by default
rBS0f759da370ad: Gawain: batch drawing works
rBS284398e51770: immediate mode refactor: walk navigation cross
rBS04bc828fb6cd: gawain update: immAttribute for 2i
rBS6ebf5c18c396: immediate mode refactor: fly navigation square
rBS34bd89a9f69d: OpenGL: draw_view_axis with new immediate mode
rBSd3365c5c725e: OpenGL: fix GPU_SHADER_TEXT on non-Mac
rBS42ad5952ff03: Quiet warning with -Wformat-signedness
rBSe21853abb9fe: OpenGL: streamline font rendering
rBS1b1275f0db85: add GPU_SHADER_TEXT for font rendering
rBSc3034afa586e: OpenGL: simplify basic_shader_bind
rBS834cb93f4059: Blender 2.8: Fix some strict aspects on Linux
rBSd96b8e168f3c: Merge branch 'master' into blender2.8
rBS5eddb8051382: Extend Gawain to use Blender's built-in shaders
rBS76c99f361f58: Gawain improvements
rBS39f7a8117692: Gawain: batch rendering API
rBS0d54d32dd608: Gawain: simplify attrib binding API
rBS2fb5a959e964: Gawain: delete bind_attrib_locations
rBS110d68ca1d31: Gawain: flesh out VertexBuffer
rBSdf7be04ca6d4: fix Mac build with Xcode 8
rBS54b00657cada: Gawain: fix Windows compile error
rBS1b5b899228bd: OpenGL: add built-in GPU_SHADER_3D_DEPTH_ONLY
rBSddb1d5648dbd: Gawain: geometry batches (unfinished)
rBSb6bd29935987: Gawain: reorganize source code
rBS18d49a8283f2: Gawain: add immBeginAtMost
rBS3c29aad787f6: Merge branch 'master' into blender2.8
rBS031c5bad8769: Gawain: fix GL_POINTS in immediate mode
rBS42bbfe7f0a1f: OpenGL: draw grid floor & axes with new immediate mode
rBS498583844fb7: OpenGL: use new uniform color functions
rBS9d3813e602b8: Gawain: convenience functions for uniform color
rBS060bf1bd288d: OpenGL: draw empties without GLU
rBSda36b447c7d5: OpenGL: de-GLU the transform manipulator
rBS069569f82011: Merge branch 'master' into blender2.8
rBS1fc1fd837209: OpenGL: draw area resize handle with new immediate mode
rBSeb717ee9794a: Gawain: more immediate mode functions
rBSbe2bc7e0f66b: OpenGL: draw color picker wheel with new immediate mode
rBS1e6b3ef1a1e2: cleanup: unused OpenGL utility code
rBS7e02d335c0ce: OpenGL: don't poll for errors, rely on KHR_debug
rBSd8f036efd6a5: OpenGL: draw NDOF guide with new immediate mode
rBS6b34eed21735: Gawain: add v functions to immediate mode
rBSb8f27b25145b: OpenGL: shaders for simple 3D drawing
rBSb92d76000d93: fix #includes for GPU debug
rBS23d7ae184397: OpenGL: backtrace on errors (--debug-gpu)
rBS8619e091072c: OpenGL: tweak legacy 2D shader
rBS91f04b82a506: early out for ortho grid drawing
rBSf1ad3483af37: get latest OpenGL version on Windows + AMD
rBS90c4ad7387e6: Mac fixes for new ortho grid drawing
rBSdb5ad6a79e77: draw ortho grid with new immediate mode
rBSdfbc51f764a8: cleanup: ortho grid drawing
rBS4565f3d0c823: use new immediate mode for UI_draw_box_shadow
rBSe36af2c2579f: Gawain: increase size of immediate mode buffer
rBS4aadf7331e10: Gawain: tweak immediate mode API
rBS7664d947b38e: Gawain: allow partial vertex specification
rBSe7a32365cf9b: Gawain: map vertex format to shader inputs
rBSf537d9628665: Merge branch 'blender2.8' of git.blender.org:blender into blender2.8
rBSadbbcefe5722: Gawain: fewer glEnable/DisableVertexAttribArray calls
rBS8fd4a8ab5db1: Merge branch 'master' into blender2.8
rBSe4e1b0c7d353: OpenGL: invalidate buffers the modern way
rBSf3d65ad23c7b: OpenGL: debug context on Windows
rBSb7f3fb0ef9d9: Gawain: fix Windows build error
rBS5320a0ad9b30: Gawain: fix compiler warnings
rBSa77e77599dc2: OpenGL: enhance debug output
rBS989315379938: OpenGL: fix FBO error messages
rBS39259fc8ab2d: draw 3D cursor with new immediate mode
rBSc73e4e99a544: OpenGL: simple 2D shader with flat color
rBS4214b3c44a8d: OpenGL: simplify 3D cursor drawing
rBS6c65e5a00c40: GPU: bind builtin shader for immediate mode
rBS8e99eec0260f: Gawain: immediate mode set uniforms for active program
rBS11ffbfb36a94: Gawain: bind a shader for immediate mode
rBS6fea42d67724: Gawain: initialize & destroy immediate mode
rBSf27516839faa: fix simple 2D built-in shaders
rBS0ea843054937: Gawain: legacy Mac VBO workarounds
rBSe7f9614f079f: Gawain: legacy OpenGL compatibility
rBS3eae585791fb: Merge branch 'master' into blender2.8
rBSa55c5dbcc4b2: Gawain: flesh out immediate mode
rBS6b21d22c6084: Gawain: fix VAO and VBO binds
rBS984392128830: Merge branch 'master' into blender2.8
rBS4571fdde0ecf: OpenGL: transition to ARB FBOs, remove runtime checks
rBS58697444bbb9: OpenGL: remove runtime check for EXT_gpu_shader4
rBS32757d488f50: OpenGL: require EXT_gpu_shader4 & ARB_framebuffer_object on Mac
rBS797f1896fa02: OpenGL: immediate mode work-alike
rBS396dd824285d: OpenGL: add simple shaders for 2D drawing
rBSb3cb7e265230: OpenGL: on Mac use legacy 2.1 or core 3.2
rBS42d816a3d9d6: Blender 2.8 requires Mac OS 10.7 or later
rBS3d9cc4d3f174: support automatic GPU switching on Mac
rBS0d1f0116febf: OpenGL: Blender 2.8 on X11 requires GL 3.0
rBSeccf5a6f8186: OpenGL: Blender 2.8 on Windows requires GL 3.2
rBS251349c3c226: Merge branch 'master' into blender2.8
rBS9186b9ae4806: Merge branch 'master' into blender2.8
rBSb1532493c27b: Merge branch 'master' into blender2.8
rBScfbd605567f4: Merge branch 'master' into blender2.8
rBS71a57a37b2ee: Merge branch 'master' into blender2.8
rBSf45fbf4b8375: Merge branch 'master' into blender2.8
rBS5ae6a3b6b6a1: Merge branch 'master' into blender2.8
rBS0f927d6ecab2: Fix stupid merge error.
rBSb90b02a480e0: Merge branch 'master' into blender2.8
rBScbce7fef1604: Merge branch 'master' into blender2.8
rBSc2dc77983dc4: Merge branch 'master' into blender2.8
rBS3b0a5dd15884: Merge branch 'master' into blender2.8
rBS97ee7f8609be: Merge branch 'master' into blender2.8
rBS48c58bd9138a: Merge branch 'master' into blender2.8
rBS2cfff95ba315: Merge branch 'master' into blender2.8
rBSeedcc4a6a08b: Merge branch 'master' into blender2.8
rBS5864269b2c60: Merge branch 'master' into blender2.8
rBS46e1d85e61aa: Reduce conflicts be keeping same indent-level as master
rBSc96d4ec6446e: Merge branch 'master' into blender2.8
rBSa15180669891: Merge branch 'master' into blender2.8
rBS10d57f991b06: Merge branch 'master' into blender2.8
rBS5750549f6a6e: Cleanup: warnings
rBS4b99958ca126: Remove particle expander
rBS24d29f2e5007: Merge branch 'master' into blender2.8
rBS11af9e9a5bd1: Merge branch 'master' into blender2.8
rBSed6f86a5106e: Merge branch 'master' into blender2.8
rBSfaec43091479: Merge branch 'master' into blender2.8
rBSb4a721af6948: Merge branch 'temp_remove_pointcache' into blender2.8
rBS735727e2b84b: Removed DNA for point caches.
rBS181d095f5061: Removed PointCache RNA struct definition and uses.
rBSceb452bc9d1d: Removed point cache operators.
rBSac30a04b2721: Removed point cache blenkernel code.
rBSc3863650cca2: Removed UI for point cache users.
rBS1f723603c882: Merge branch 'master' into temp_remove_particles
rBS5aa19be91263: Merge branch 'temp_remove_particles' into blender2.8
rBS3632c4997f50: Merge branch 'master' into temp_remove_particles
rBS773efb506a9a: Removed particle sync code from Cycles.
rBSba279efbdb00: Removed the ND_PARTICLE notifier and outliner particle elements.
rBS9465d3decf8a: Removed the particle context of property buttons space.
rBScd0ec340c447: Removed remaining uses of the particle edit mode flag.
rBSecb695ccc8db: Removed tool settings for particle edit mode.
rBS7c57822afacd: Fixed some minor errors in game engine and player.
rBS15c8d095e5f5: Removed the Main.particle list, used for ParticleSettings ID blocks.
rBSc92b6f1de696: Removed the translation context for particle settings.
rBSd30b942f07f6: Removed the ID_PA code used for ParticleSettings.
rBSdf2e543d4431: Removed some unused declarations for boids code.
rBSfbed29a246ed: Merge branch 'master' into temp_remove_particles
rBSd474ed9b8848: Partially revert 82ec9c87a7d8ee28b65555c7fcbd8cdb156249e9, to add back point…
rBS987bb50a7413: Removed remaining use of pointers to particle types as well as boids headers.
rBS664f5b8c06a0: Removed particle DNA.
rBSd8d49befa084: Removed particle system and particle instance modifiers.
rBScf6cb3dcaf17: Removed most particle system code from RNA.
rBSd47173c8caf6: Removed blenkernel particle code.
rBSbcd12bf64d89: Removed most partical-related code from UI scripts.
rBScc468c1974e3: Removed remnants of particle draw code.
rBS29a792a75b66: Removed all direct uses of BKE_particle.h and DNA_particle_types.h from…
rBS82ec9c87a7d8: Removed particle operators API and point cache operators.
rBS5a783144e28d: Removed particle operators from editors/physics/.
Summary

This patch adds the core code needed to manage custom manipulators as part of the window manager. WIP code documentation can be found here: https://wiki.blender.org/index.php?title=User:Julianeisel/Custom_Manipulators

NOTE: The changes here should not be visible for users at all. It's really just a back-end patch. Neither does this patch include any RNA or Python integration.

I'm aware that the general manipulator architecture of this patch still has some rough edges, but I think it's definitely ready for an initial inclusion in master (assuming it's rather bug-free ;) ). I also don't think we should spend too much effort on review, making sure there are no major showstoppers should be kinda enough. More work can still be done, this is just the first milestone for moving the custom manipulators project towards master.
My plan is to get this patch into master (or 2.8 branch) and then finish some initial manipulators (e.g. new transform manipulator) so we can merge them too.

This work isn't completely my own, all the initial work was done by @Antony Riakiotakis (psy-fi) and - although it has changed a log since them - it's still the same in essence. Either way, he definitely deserves a big credit! Some changes in this patch were also done by @Campbell Barton (campbellbarton).

Diff Detail

Event Timeline

Julian Eisel (Severin) retitled this revision from Custom Manipulators core to Custom Manipulators Core System.Sep 15 2016, 1:18 AM

Some notes:

  • Content of DNA_manipulator_types.h could be moved either to DNA_windowmanager_types.h or to WM_manipulator_types.h. At least until RNA integration gets merged.
  • Could directly include manipulator header files instead of including them into wm headers. Thought it would be nicer to have a single header for API/types of wm, rather than different headers for different parts of the wm.
  • Could remove most files from manipulator_library/ from this patch and add them when merging actual manipulators later (already excluded facemap manipulators). Util files could stay though.

So from what I can tell there are a lot of similarities to the UI code:

  • A manipulator group is like a UI block, and manipulators like buttons in the block.
  • Manipulators can be connected to RNA properties or operators, like buttons.
  • The manipulator map is like ListBase uiblocks, but also storing some state that for the UI code is attached to the active button.
  • Modal operators can create a temporary manipulator like they can create a temporary UI popup.

Of course the UI code has a bunch of design issues, and different design decisions were made for this manipulator system. The UI code should eventually do some things more similar to this design, like better abstracting button types or using keymaps.

About the code layout, I'm not really sure what's ideal. Perhaps it should be in editors/, or perhaps interface/ and screen/ actually belong in windowmanager/. I guess it's arbitrary either way and this is ok, it's already using wm prefixes everywhere so that would be a pain to change.

I think keeping DNA_manipulator_types.h and manipulator_library/ as part of this patch is ok, I don't a reason to add it later if it's not breaking anything.

Great!

One more vote for blender2.8 branch since this introduces a new UI approach.

Also we should use core GL or the new abstractions for drawing. Legacy GL calls will have to be replaced, so might as well have it done at the beginning. Immediate mode, client VAs, and GLU. I'm glad to help with this.

Indeed, didn't notice some of these parallels to the UI code. Only noticed some similarities when I worked on a widget drawing code refactor some time ago. Hopefully that means not all of the design decisions made for manipulators are pure rubbish ;)

About the code layout, I'm not really sure what's ideal. Perhaps it should be in editors/, or perhaps interface/ and screen/ actually belong in windowmanager/. I guess it's arbitrary either way and this is ok, it's already using wm prefixes everywhere so that would be a pain to change.

Initially manipulators (back then called widgets) were part of interface/, but AFAIK got moved to wm to be more similar to drop-boxes (this was all done by @Antony Riakiotakis (psy-fi)). I guess what qualifies manipulators as part of the wm is their rather tight integration with event handlers (also with operators and keymaps). This might change once the way the UI communicates with handlers gets improved, but for now I rather have this nicely integrated with the wm. Would have to do more experiments with widget/UI handling to see how to properly improve it.

I think keeping DNA_manipulator_types.h and manipulator_library/ as part of this patch is ok, I don't a reason to add it later if it's not breaking anything.

Main reason why I'm not sure on including files from manipulator_library/ is that there's still quite some WIP code in them (unfinished manipulator designs, a buggy intersection check, immediate mode drawing, etc). Might be better wait till they are more refined before merging them into master.

Also we should use core GL or the new abstractions for drawing. Legacy GL calls will have to be replaced, so might as well have it done at the beginning. Immediate mode, client VAs, and GLU. I'm glad to help with this.

Absolutely, this is on the TODO. It's one of the reasons why I'm considering to wait with merging the manipulator_library/ files (which contain all the drawing).

I didn't review in detail but it seems generally fine.

It's still unclear to me why you would need multiple manipulator maps in a region. Why aren't manipulator groups 2D or 3D and one manipulator map contains both types? The manipulator active/highlighted/selected state to me seems like something you'd want to share between all manipulator maps in a region, you wouldn't want to highlight both a 2D and 3D manipulator at the same time?

It's also not clear to me why there is a concept of manipulator selection. What would be an example where you select multiple manipulators? If at all possible I'd like to avoid more selection states that the user needs to keep track of, and would think that it's the data you work on that you select, not the manipulators. But maybe there's a good reason to have it.

source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
45

Use #include "GPU_glew.h" for consistency.

source/blender/windowmanager/wm_event_types.h
343

Should not have same value as EVT_BUT_CANCEL.

Julian Eisel (Severin) updated this revision to Diff 7546.
  • Remove unused manipulator-map update flag
  • Move manipulator-group creation into own function
  • Move structs to lower level, avoid storing manipulator-group pointers, naming, etc
  • Fix manipulator update event define using already used value
  • Use GPU_glew.h to include glew
  • Remove manipulator library for initial core merge
  • Regions now use a single manipulator-map again
  • Refactor manipulator-group flags
  • Refactor lookups for hovered manipulator
  • Refactor manipulator draw routine
  • Split wmManipulator flag into behavior flags and state flags
  • Move some manipulator flags to manipulator-group-type level
  • Remove DNA_manipulator_types.h for now

(Removed merge and general fix commits)

It's still unclear to me why you would need multiple manipulator maps in a region. Why aren't manipulator groups 2D or 3D and one manipulator map contains both types? The manipulator active/highlighted/selected state to me seems like something you'd want to share between all manipulator maps in a region, you wouldn't want to highlight both a 2D and 3D manipulator at the same time?

The multiple manipulator-maps per region was something I wasn't really sure either. I checked on removing them and turned out it was possible so I did it. Main issue was that 3D manipulator maps used OpenGL picking, where 2D maps used simple intersection tests. Now manipulator-groups store if they're 2D or 3D and we only do OpenGL picking if no intersected 2D manipulator is found (I guess that's what you'd want usually, if not, we can do additional screen-space distance comparison).

It's also not clear to me why there is a concept of manipulator selection. What would be an example where you select multiple manipulators? If at all possible I'd like to avoid more selection states that the user needs to keep track of, and would think that it's the data you work on that you select, not the manipulators. But maybe there's a good reason to have it.

Manipulator selection is mainly needed for facemap manipulators right now, see https://www.youtube.com/watch?v=WXstmjktMgc.

In general I'm pretty happy with the patch now. Would say it's ready for further review or merge.

I think this is in an ok state to merge into 2.8.

Manipulator selection is mainly needed for facemap manipulators right now, see https://www.youtube.com/watch?v=WXstmjktMgc.

Is this manipulator selection separate from object selection in the 3D view? Or does it sync with e.g. bone selection somehow? If it's the latter, it's not clear to me why manipulators need to have their own selection state.

If it's the former, it seems like that could be quite confusing. As a user I would expect pressing A to select/deselect everything, regardless if it's a manipulator/face/bone/object. Same for other selection tools, transform tools, keyframing, ... . At least in this video I can't tell if selecting a manipulator would give me access to the same tools as selecting a face/bone/object.

Is this manipulator selection separate from object selection in the 3D view? Or does it sync with e.g. bone selection somehow? If it's the latter, it's not clear to me why manipulators need to have their own selection state.
If it's the former, it seems like that could be quite confusing. As a user I would expect pressing A to select/deselect everything, regardless if it's a manipulator/face/bone/object. Same for other selection tools, transform tools, keyframing, ... . At least in this video I can't tell if selecting a manipulator would give me access to the same tools as selecting a face/bone/object.

For the face-map manipulators it does nothing but selecting all bones that have this face-map attached (through wmManipulator.select callback), so it's kinda a simple selection redirect. Selecting the bone doesn't select its face-map manipulator though, so manipulators still need to store their selection state separately. Pressing A in pose-mode also deselects all face-map manipulators by calling WM_manipulatormap_select_all.

How all this works together might still change of course, depending on how the design evolves. I would still prefer to leave the selection code in for now, so we can see what further things might be possible with it (e.g. Maya allows selecting a transform manipulator handle, pressing MMB anywhere in the viewport activates this handle then). If it ends up being unnecessary, we can still remove it.

Right, we can keep it for now and look at the individual use cases when they are implemented.

  • Cleanup: Comments
  • Remove any remaining OpenGL calls
  • Remove unneeded UserPref options
  • Merge branch 'master' into temp_manipulators_core

Patch is now based on blender2.8 branch

Julian Eisel (Severin) removed rB Blender as the repository for this revision.Oct 7 2016, 1:53 AM
Julian Eisel (Severin) updated this revision to Diff 7560.

Seems Arcanist has trouble following the rebase, so uploading raw patch.

Will merge branch into blender2.8 tomorrow if there are no objections :)

I'm in favor of landing this in blender2.8. Don't understand it all but am ready for wiggly widgets! We will all need to figure out issues of which buffer to draw into, how hit-testing works, depth buffer... Widgets and viewport need to work well together from the beginning.

Committed rB6e358a1d069. Thanks a lot for reviewing!