Page MenuHome

Fix T81050: Take Clipping Region into account for Frame All
AbandonedPublic

Authored by Juicy HUANG (juicyenc) on Oct 7 2020, 11:11 AM.

Details

Reviewers
None
Group Reviewers
User Interface
Maniphest Tasks
T81050: Take Clipping Region into account for Frame All
Summary

This patch fix T81050 by clamping the frame area with clipped area. According to my testing in local machine. My fixing can focus the frame area to the clipped area when clipped.

Diff Detail

Repository
rB Blender

Event Timeline

Philipp Oeser (lichtwerk) added inline comments.
source/blender/editors/space_view3d/view3d_edit.c
2969

maybe use RV3D_CLIPPING_ENABLED? (clipping does not happen in all shading modes)

Update with more code around.

Update diff. Change condition to RV3D_CLIPPING.

Jeroen Bakker (jbakker) added inline comments.
source/blender/editors/space_view3d/view3d_edit.c
2972

obmat is used for object matrices. As here it isn't we should rename it to unit_mat to be clear that it hasn't to do with any object.

2973

obmat is uninitialized and can refer to random values. the bb_min and bb_max are then multiplied by some random values.
I would expect that obmat contained the unit matrix (see unit_m4 function). Could be that your compiler fills it in with zero's but that might indicate it shouldn't working for all cases.

Have you tested it with objects that aren't on the origin?

Sybren A. Stüvel (sybren) added inline comments.
source/blender/editors/space_view3d/view3d_edit.c
2969

This entire block could be moved into a separate function. That way it can be given a descriptive name as well.

Rename obmat to unit_mat and initialized it with a unit matric.

Juicy HUANG (juicyenc) marked 3 inline comments as done.Oct 7 2020, 12:55 PM

Move code blocks to a new function.

Juicy HUANG (juicyenc) marked an inline comment as done.Oct 15 2020, 8:13 AM

Improve code quality.

Campbell Barton (campbellbarton) requested changes to this revision.EditedOct 26 2020, 10:27 AM

This method of clamping the clipping isn't sufficient, failing whenever the clipping isn't axis aligned. e.g. see attached file:

Even if an approximation is used, should work examples like the one given.

In principle - intersecting the two bounding boxes, then get the minimum & maximum of the resulting intersection will work.

Since we only need the min/max it's simplest to compute an array of planes (from the min-max bounding-box and the 3d view's clipping). Then calculate points inside all of the planes, logic from: M_Geometry_points_in_planes can be used for this.

This revision now requires changes to proceed.Oct 26 2020, 10:27 AM

@Juicy HUANG (juicyenc) why did you abandon this patch? Do you have ideas for a completely new patch? Or do you need more help to finish this one?

I abandoned my patch because I have no idea how to do it at present. Everyone is welcome to help with this task.