Skip to content

Commit 620472f

Browse files
committed
Removed WatchForThemeChange variable and checks so that widgets always check for theme updates by default. The performance hit seems minimal and the functionality is valuable enough to promote it to the default behavior.
1 parent 0945a16 commit 620472f

File tree

9 files changed

+8
-33
lines changed

9 files changed

+8
-33
lines changed

Assets/HoloToolkit-Examples/InteractiveElements/Scripts/Controls/ButtonThemeWidget.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ public class ButtonThemeWidget : InteractiveThemeWidget
3131
[Tooltip("scale animation component: optional")]
3232
public ScaleToValue ScaleSize;
3333

34-
[Tooltip("Upate the widget's theme and refresh if the theme tag changes")]
35-
public bool WatchForThemeChange = false;
36-
3734
// themes
3835
private ColorInteractiveTheme mColorTheme;
3936
private Vector3InteractiveTheme mPositionTheme;
@@ -150,7 +147,7 @@ public override void SetState(Interactive.ButtonStateEnum state)
150147

151148
private void Update()
152149
{
153-
if(WatchForThemeChange && (!mCheckScaleThemeTag.Equals(ScaleThemeTag) || !mCheckPositionThemeTag.Equals(PositionThemeTag) || !mCheckColorThemeTag.Equals(ColorThemeTag)))
150+
if(!mCheckScaleThemeTag.Equals(ScaleThemeTag) || !mCheckPositionThemeTag.Equals(PositionThemeTag) || !mCheckColorThemeTag.Equals(ColorThemeTag))
154151
{
155152
SetTheme();
156153
RefreshIfNeeded();

Assets/HoloToolkit-Examples/InteractiveElements/Scripts/Controls/ButtonThemeWidgetLabel.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ public class ButtonThemeWidgetLabel : InteractiveThemeWidget
2525
[Tooltip("position animation component: optional")]
2626
public MoveToPosition MovePosition;
2727

28-
[Tooltip("Upate the widget's theme and refresh if the theme tag changes")]
29-
public bool WatchForThemeChange = false;
30-
3128
// themes
3229
private ColorInteractiveTheme mColorTheme;
3330
private Vector3InteractiveTheme mPositionTheme;
@@ -123,7 +120,7 @@ public override void SetState(Interactive.ButtonStateEnum state)
123120

124121
private void Update()
125122
{
126-
if (WatchForThemeChange && (!mCheckPositionThemeTag.Equals(PositionThemeTag) || !mCheckColorThemeTag.Equals(ColorThemeTag)))
123+
if (!mCheckPositionThemeTag.Equals(PositionThemeTag) || !mCheckColorThemeTag.Equals(ColorThemeTag))
127124
{
128125
SetTheme();
129126
RefreshIfNeeded();

Assets/HoloToolkit-Examples/InteractiveElements/Scripts/Controls/ButtonThemeWidgetOutline.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public class ButtonThemeWidgetOutline : InteractiveThemeWidget
2929
[Tooltip("A color tween component : required, but could be on a different object")]
3030
public ColorTransition ColorBlender;
3131

32-
[Tooltip("Upate the widget's theme and refresh if the theme tag changes")]
33-
public bool WatchForThemeChange = false;
34-
3532
private ColorInteractiveTheme mInnerColorTheme;
3633
private ColorInteractiveTheme mOuterColorTheme;
3734

@@ -100,7 +97,7 @@ public override void SetState(Interactive.ButtonStateEnum state)
10097

10198
private void Update()
10299
{
103-
if (WatchForThemeChange && (!mCheckOuterColorThemeTag.Equals(OuterColorThemeTag) || !mCheckInnerColorThemeTag.Equals(InnerColorThemeTag)))
100+
if (!mCheckOuterColorThemeTag.Equals(OuterColorThemeTag) || !mCheckInnerColorThemeTag.Equals(InnerColorThemeTag))
104101
{
105102
SetTheme();
106103
RefreshIfNeeded();

Assets/HoloToolkit-Examples/InteractiveElements/Scripts/Controls/SliderGestureControl.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ public override void ManipulationUpdate(Vector3 startGesturePosition, Vector3 cu
151151

152152
// get the current delta
153153
float delta = (CurrentDistance > 0) ? CurrentPercentage : -CurrentPercentage;
154-
print(delta);
155154

156155
// combine the delta with the current slider position so the slider does not start over every time
157156
mDeltaValue = Mathf.Clamp01(delta + mCachedValue);

Assets/HoloToolkit-Examples/InteractiveElements/Scripts/Widgets/MaterialColorThemeWidget.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ public class MaterialColorThemeWidget : InteractiveThemeWidget
2020
[Tooltip("A component for color transitions: optional")]
2121
public ColorTransition ColorBlender;
2222

23-
[Tooltip("Upate the widget's theme and refresh if the theme tag changes")]
24-
public bool WatchForThemeChange = false;
25-
2623
private ColorInteractiveTheme mColorTheme;
2724
private Material mMaterial;
2825

@@ -88,7 +85,7 @@ public override void SetState(Interactive.ButtonStateEnum state)
8885

8986
private void Update()
9087
{
91-
if (WatchForThemeChange && (!mCheckThemeTag.Equals(ThemeTag)))
88+
if (!mCheckThemeTag.Equals(ThemeTag))
9289
{
9390
SetTheme();
9491
RefreshIfNeeded();

Assets/HoloToolkit-Examples/InteractiveElements/Scripts/Widgets/PositionThemeWidget.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ public class PositionThemeWidget : InteractiveThemeWidget
1919
[Tooltip("Move to Position, a component for animating position")]
2020
public MoveToPosition MovePositionTweener;
2121

22-
[Tooltip("Upate the widget's theme and refresh if the theme tag changes")]
23-
public bool WatchForThemeChange = false;
24-
2522
private Vector3InteractiveTheme mPositionTheme;
2623

2724
private string mCheckThemeTag = "";
@@ -80,7 +77,7 @@ public override void SetState(Interactive.ButtonStateEnum state)
8077

8178
private void Update()
8279
{
83-
if (WatchForThemeChange && (!mCheckThemeTag.Equals(ThemeTag)))
80+
if (!mCheckThemeTag.Equals(ThemeTag))
8481
{
8582
SetTheme();
8683
RefreshIfNeeded();

Assets/HoloToolkit-Examples/InteractiveElements/Scripts/Widgets/ScaleThemeWidget.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ public class ScaleThemeWidget : InteractiveThemeWidget
1919
[Tooltip("Scale to Value component for animating scale")]
2020
public ScaleToValue ScaleTweener;
2121

22-
[Tooltip("Upate the widget's theme and refresh if the theme tag changes")]
23-
public bool WatchForThemeChange = false;
24-
2522
private Vector3InteractiveTheme mScaleTheme;
2623
private Material mMaterial;
2724

@@ -81,7 +78,7 @@ public override void SetState(Interactive.ButtonStateEnum state)
8178

8279
private void Update()
8380
{
84-
if (WatchForThemeChange && (!mCheckThemeTag.Equals(ThemeTag)))
81+
if (!mCheckThemeTag.Equals(ThemeTag))
8582
{
8683
SetTheme();
8784
RefreshIfNeeded();

Assets/HoloToolkit-Examples/InteractiveElements/Scripts/Widgets/TextMeshColorThemeWidget.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ public class TextMeshColorThemeWidget : InteractiveThemeWidget
2020
[Tooltip("A component for color transitions: optional")]
2121
public ColorTransition ColorBlender;
2222

23-
[Tooltip("Upate the widget's theme and refresh if the theme tag changes")]
24-
public bool WatchForThemeChange = false;
25-
2623
private ColorInteractiveTheme mTextColorTheme;
2724
private TextMesh mTextMesh;
2825

@@ -82,7 +79,7 @@ public override void SetState(Interactive.ButtonStateEnum state)
8279

8380
private void Update()
8481
{
85-
if (WatchForThemeChange && (!mCheckThemeTag.Equals(ThemeTag)))
82+
if (!mCheckThemeTag.Equals(ThemeTag))
8683
{
8784
SetTheme();
8885
RefreshIfNeeded();

Assets/HoloToolkit-Examples/InteractiveElements/Scripts/Widgets/TextureThemeWidget.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ public class TextureThemeWidget : InteractiveThemeWidget
1919
[Tooltip("The target object with the material to swap textures on : optional, leave blank for self")]
2020
public GameObject Target;
2121

22-
[Tooltip("Upate the widget's theme and refresh if the theme tag changes")]
23-
public bool WatchForThemeChange = false;
24-
2522
// The theme with the texture states
2623
private TextureInteractiveTheme mTextureTheme;
2724

@@ -100,7 +97,7 @@ private void SetTexture(Interactive.ButtonStateEnum state)
10097

10198
private void Update()
10299
{
103-
if(WatchForThemeChange && (!mCheckThemeTag.Equals(ThemeTag)))
100+
if(!mCheckThemeTag.Equals(ThemeTag))
104101
{
105102
SetTheme();
106103
RefreshIfNeeded();

0 commit comments

Comments
 (0)