Fix brush weird behaviour when starting with clean settings (brush would

be black and filled instead of appliying the correct texture with color)
This commit is contained in:
Artur Gomes 2017-07-27 19:07:33 +01:00
parent ae078f4689
commit c477b50272
2 changed files with 11 additions and 11 deletions

View file

@ -865,7 +865,7 @@
savedSettings = new Object(); savedSettings = new Object();
savedSettings.currentColor = Settings.getValue("currentColor", {red: 250, green: 0, blue: 0, origin: "custom"}), savedSettings.currentColor = Settings.getValue("currentColor", {red: 250, green: 0, blue: 0, origin: "custom"}),
savedSettings.currentStrokeWidth = Settings.getValue("currentStrokeWidth", 0.25); savedSettings.currentStrokeWidth = Settings.getValue("currentStrokeWidth", 0.25);
savedSettings.currentTexture = Settings.getValue("currentTexture", null); savedSettings.currentTexture = Settings.getValue("currentTexture", {brushID: 0});
savedSettings.currentDrawingHand = Settings.getValue("currentDrawingHand", MyAvatar.getDominantHand() == "left"); savedSettings.currentDrawingHand = Settings.getValue("currentDrawingHand", MyAvatar.getDominantHand() == "left");
savedSettings.currentDynamicBrushes = Settings.getValue("currentDynamicBrushes", []); savedSettings.currentDynamicBrushes = Settings.getValue("currentDynamicBrushes", []);
savedSettings.customColors = Settings.getValue("customColors", []); savedSettings.customColors = Settings.getValue("customColors", []);

View file

@ -96,13 +96,13 @@
} }
</style> </style>
<div id="strokeWidthWidget" class="property range"> <div id="strokeWidthWidget" class="property range">
<label style="display: block">Stroke Width</label> <label style="display: block">Stroke Width</label>
<div class="sliderWrapper"> <div class="sliderWrapper">
<input type="range" id="lineWidthRange" value=0.25 min=0 max=1 step=0.01 onchange="changeLineWidthRange(this)"/> <input type="range" id="lineWidthRange" value=0.25 min=0 max=1 step=0.01 onchange="changeLineWidthRange(this)"/>
<input type="number" id="lineWidthText" value=0.25 min=0 max=1 step=0.01 onchange="changeLineWidthNumber(this)"/> <input type="number" id="lineWidthText" value=0.25 min=0 max=1 step=0.01 onchange="changeLineWidthNumber(this)"/>
</div>
</div> </div>
</div>
<div style="margin-top: 75px"> <div style="margin-top: 75px">
<div class="behavior-group property checkbox"> <div class="behavior-group property checkbox">
<input onchange="setDynamicBrush(this)" animationType="DynamicHueBrush" type="checkbox" id="dynamicBrush"></input> <input onchange="setDynamicBrush(this)" animationType="DynamicHueBrush" type="checkbox" id="dynamicBrush"></input>
@ -650,8 +650,8 @@
<script type="text/javascript"> <script type="text/javascript">
var currentBrush = 5; var currentBrush = 0;
var EventBridge = parent.EventBridge; var EventBridge = parent.EventBridge;
function changeLineWidthRange(e) { function changeLineWidthRange(e) {
document.getElementById("lineWidthText").value = e.value; document.getElementById("lineWidthText").value = e.value;
@ -737,10 +737,9 @@
}; };
parent.postMessage(JSON.stringify(switchDynamicBrushEvent), "*"); parent.postMessage(JSON.stringify(switchDynamicBrushEvent), "*");
} }
restoreSavedBrushes(JSON.parse(decodeURIComponent(window.parent.location.search).substring(1))); restoreSavedBrushes(JSON.parse(decodeURIComponent(window.parent.location.search).substring(1)));
function restoreSavedBrushes(brushData) { function restoreSavedBrushes(brushData) {
//var brush = JSON.parse(event.data);
if ("currentTexture" in brushData) { if ("currentTexture" in brushData) {
changePaintBrush(brushData.currentTexture.brushID); changePaintBrush(brushData.currentTexture.brushID);
} }
@ -763,4 +762,5 @@
setUpKeyboardControl(); setUpKeyboardControl();
}); });
</script> </script>