Page MenuHome

Armature: Bone Draw Type: Wire
Closed, ResolvedPublic

Description

Note: this also draws bendy-bone segments.

Details

Type
To Do

Event Timeline

Ok, so getting basics working here is trivial thanks to neighbor code ;) , but am hitting a problem which is each bbone segment needs its own matrix and… we have nowhere to store those (since batch drawing only copies pointers of data, not data itself, we need them to remain valid at least for the whole draw call).

So far I can think of three solutions:

  1. Ditch instantiation of basic primitive (a mere line in this case) for each segment, and generate a complete bone with all its segments at once (but then we cannot reuse those, we have to generate a new VertexBuffer for every bendy bone).
  2. Store BBone matrices in bones (as we already store there the disp_mat).
  3. Store BBone matrices in global g_data.

I would go for solution 3, but thought I’d ask first in case you have a better idea, @Campbell Barton (campbellbarton), @Dalai Felinto (dfelinto), @Clément Foucault (fclem) ?

Correction, after quick testing, don't think we can use local static g_data here, works for drawing, but breaks selection (which I’d guess reuses same cached data but is drawn in complete separate call?)…

So new set of proposed solutions:

  1. Ditch instantiation of basic primitive (a mere line in this case) for each segment, and generate a complete bone with all its segments at once (but then we cannot reuse those, we have to generate a new VertexBuffer for every bendy bone - and this would be true for BBone drawing itself too).
  2. Store BBone matrices in bones (as we already store there the disp_mat).
  3. Store BBone matrices in OBJECT_PrivateData… somehow?

Really dislike option 1, and I’d say option 2 is not acceptable (since it would be using data to store cache, we want to go away from doing that), so will dig around option 3 for now.

Bastien Montagne (mont29) closed this task as Resolved.May 3 2017, 8:40 AM

Done in rBd116932f3a6c.

(For the record, we decided to go with storage of the bbone segment matrices in allocated memory in bPoseChannel for now…).