File tree Expand file tree Collapse file tree 3 files changed +20
-33
lines changed Expand file tree Collapse file tree 3 files changed +20
-33
lines changed Original file line number Diff line number Diff line change @@ -1440,11 +1440,30 @@ virtual protected TrTransform GetDesiredTransform(TrTransform xf_GS)
1440
1440
return outXf_GS ;
1441
1441
}
1442
1442
1443
- protected virtual TrTransform ApplyAxisLocks ( TrTransform xf_GS )
1443
+ private TrTransform ApplyAxisLocks ( TrTransform xf_GS )
1444
1444
{
1445
+ if ( this is StencilWidget || this is MediaWidget || this is SelectionWidget )
1446
+ {
1447
+ xf_GS = CalculateAxisLocks ( xf_GS ) ;
1448
+ }
1445
1449
return xf_GS ;
1446
1450
}
1447
1451
1452
+ private TrTransform CalculateAxisLocks ( TrTransform xf_GS )
1453
+ {
1454
+ var outXf_CS = App . ActiveCanvas . Pose . inverse * xf_GS ;
1455
+ // Restore transforms for locked axes
1456
+ if ( SelectionManager . m_Instance . m_LockTranslationX ) outXf_CS . translation . x = transform . localPosition . x ;
1457
+ if ( SelectionManager . m_Instance . m_LockTranslationY ) outXf_CS . translation . y = transform . localPosition . y ;
1458
+ if ( SelectionManager . m_Instance . m_LockTranslationZ ) outXf_CS . translation . z = transform . localPosition . z ;
1459
+ var euler = outXf_CS . rotation . eulerAngles ;
1460
+ if ( SelectionManager . m_Instance . m_LockRotationX ) euler . x = transform . localRotation . eulerAngles . x ;
1461
+ if ( SelectionManager . m_Instance . m_LockRotationY ) euler . y = transform . localRotation . eulerAngles . y ;
1462
+ if ( SelectionManager . m_Instance . m_LockRotationZ ) euler . z = transform . localRotation . eulerAngles . z ;
1463
+ outXf_CS . rotation . eulerAngles = euler ;
1464
+ return App . ActiveCanvas . Pose * outXf_CS ;
1465
+ }
1466
+
1448
1467
protected virtual bool AllowSnapping ( )
1449
1468
{
1450
1469
return m_AllowSnapping && SnapEnabled ;
Original file line number Diff line number Diff line change @@ -122,22 +122,6 @@ override public void Activate(bool bActive)
122
122
}
123
123
}
124
124
}
125
-
126
- protected override TrTransform ApplyAxisLocks ( TrTransform xf_GS )
127
- {
128
- var outXf_CS = App . ActiveCanvas . Pose . inverse * xf_GS ;
129
- // Restore transforms for locked axes
130
- if ( SelectionManager . m_Instance . m_LockTranslationX ) outXf_CS . translation . x = transform . localPosition . x ;
131
- if ( SelectionManager . m_Instance . m_LockTranslationY ) outXf_CS . translation . y = transform . localPosition . y ;
132
- if ( SelectionManager . m_Instance . m_LockTranslationZ ) outXf_CS . translation . z = transform . localPosition . z ;
133
- var euler = outXf_CS . rotation . eulerAngles ;
134
- if ( SelectionManager . m_Instance . m_LockRotationX ) euler . x = transform . localRotation . eulerAngles . x ;
135
- if ( SelectionManager . m_Instance . m_LockRotationY ) euler . y = transform . localRotation . eulerAngles . y ;
136
- if ( SelectionManager . m_Instance . m_LockRotationZ ) euler . z = transform . localRotation . eulerAngles . z ;
137
- outXf_CS . rotation . eulerAngles = euler ;
138
- xf_GS = App . ActiveCanvas . Pose * outXf_CS ;
139
- return xf_GS ;
140
- }
141
125
}
142
126
143
127
} // namespace TiltBrush
Original file line number Diff line number Diff line change @@ -310,22 +310,6 @@ override protected void OnUserBeginInteracting()
310
310
}
311
311
}
312
312
313
- protected override TrTransform ApplyAxisLocks ( TrTransform xf_GS )
314
- {
315
- var outXf_CS = m_SelectionCanvas . Pose . inverse * xf_GS ;
316
- // Restore transforms for locked axes
317
- if ( SelectionManager . m_Instance . m_LockTranslationX ) outXf_CS . translation . x = transform . localPosition . x ;
318
- if ( SelectionManager . m_Instance . m_LockTranslationY ) outXf_CS . translation . y = transform . localPosition . y ;
319
- if ( SelectionManager . m_Instance . m_LockTranslationZ ) outXf_CS . translation . z = transform . localPosition . z ;
320
- var euler = outXf_CS . rotation . eulerAngles ;
321
- if ( SelectionManager . m_Instance . m_LockRotationX ) euler . x = transform . localRotation . eulerAngles . x ;
322
- if ( SelectionManager . m_Instance . m_LockRotationY ) euler . y = transform . localRotation . eulerAngles . y ;
323
- if ( SelectionManager . m_Instance . m_LockRotationZ ) euler . z = transform . localRotation . eulerAngles . z ;
324
- outXf_CS . rotation . eulerAngles = euler ;
325
- xf_GS = m_SelectionCanvas . Pose * outXf_CS ;
326
- return xf_GS ;
327
- }
328
-
329
313
protected override IEnumerable < StencilWidget > GetStencilsToIgnore ( )
330
314
{
331
315
return SelectionManager . m_Instance . SelectedWidgets . OfType < StencilWidget > ( ) ;
You can’t perform that action at this time.
0 commit comments