This is apparently caused by the following condition in the Snapper.snap method:
Code: Select all
if self.snapInfo and "Component" in self.snapInfo: return self.snapToObject(lastpoint, active, constrain, eline, point, oldActive)
The condition is satisfied whenever there is an object under the cursor; consequently, the method returns before the grid snap code is run.
My first thought was to move the related grid snap code above all the other snap code. The problem is that snapToGrid doesn't clearly indicate when it fails to return a grid point: It just returns the point it received, instead of a grid point.
The solution seemed simple, just return None to indicate failure. However, that results in a crash. My temporary work-around is having it return Vector(0,0,1), which is an invalid 2D point.
Is there some connection with C++ code that requires the snapToGrid method to only return Vector objects?