mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:18:24 +02:00
Merge pull request #5614 from samcake/punk
Script improvments with render Engine debug.js
This commit is contained in:
commit
6f3b34982e
2 changed files with 72 additions and 72 deletions
|
@ -183,6 +183,24 @@ var CHECK_MARK_COLOR = {
|
||||||
this.onValueChanged(resetValue);
|
this.onValueChanged(resetValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Slider.prototype.setMinValue = function(minValue) {
|
||||||
|
var currentValue = this.getValue();
|
||||||
|
this.minValue = minValue;
|
||||||
|
this.setValue(currentValue);
|
||||||
|
};
|
||||||
|
Slider.prototype.getMinValue = function() {
|
||||||
|
return this.minValue;
|
||||||
|
};
|
||||||
|
Slider.prototype.setMaxValue = function(maxValue) {
|
||||||
|
var currentValue = this.getValue();
|
||||||
|
this.maxValue = maxValue;
|
||||||
|
this.setValue(currentValue);
|
||||||
|
};
|
||||||
|
Slider.prototype.getMaxValue = function() {
|
||||||
|
return this.maxValue;
|
||||||
|
};
|
||||||
|
|
||||||
Slider.prototype.onValueChanged = function(value) {};
|
Slider.prototype.onValueChanged = function(value) {};
|
||||||
|
|
||||||
Slider.prototype.getHeight = function() {
|
Slider.prototype.getHeight = function() {
|
||||||
|
@ -1396,6 +1414,14 @@ var CHECK_MARK_COLOR = {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Panel.prototype.getWidget = function(name) {
|
||||||
|
var item = this.items[name];
|
||||||
|
if (item != null) {
|
||||||
|
return item.widget;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
Panel.prototype.update = function(name) {
|
Panel.prototype.update = function(name) {
|
||||||
var item = this.items[name];
|
var item = this.items[name];
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
|
|
@ -12,59 +12,55 @@ Script.include("cookies.js");
|
||||||
|
|
||||||
var panel = new Panel(10, 100);
|
var panel = new Panel(10, 100);
|
||||||
|
|
||||||
panel.newSlider("Num Feed Opaques", 0, 1000,
|
function CounterWidget(parentPanel, name, feedGetter, drawGetter, capSetter, capGetter) {
|
||||||
function(value) { },
|
this.subPanel = panel.newSubPanel(name);
|
||||||
function() { return Scene.getEngineNumFeedOpaqueItems(); },
|
|
||||||
function(value) { return (value); }
|
this.subPanel.newSlider("Num Feed", 0, 1,
|
||||||
|
function(value) { },
|
||||||
|
feedGetter,
|
||||||
|
function(value) { return (value); });
|
||||||
|
this.subPanel.newSlider("Num Drawn", 0, 1,
|
||||||
|
function(value) { },
|
||||||
|
drawGetter,
|
||||||
|
function(value) { return (value); });
|
||||||
|
this.subPanel.newSlider("Max Drawn", -1, 1,
|
||||||
|
capSetter,
|
||||||
|
capGetter,
|
||||||
|
function(value) { return (value); });
|
||||||
|
|
||||||
|
this.update = function () {
|
||||||
|
var numFeed = this.subPanel.get("Num Feed");
|
||||||
|
this.subPanel.set("Num Feed", numFeed);
|
||||||
|
this.subPanel.set("Num Drawn", this.subPanel.get("Num Drawn"));
|
||||||
|
|
||||||
|
var numMax = Math.max(numFeed, 1);
|
||||||
|
this.subPanel.getWidget("Num Feed").setMaxValue(numMax);
|
||||||
|
this.subPanel.getWidget("Num Drawn").setMaxValue(numMax);
|
||||||
|
this.subPanel.getWidget("Max Drawn").setMaxValue(numMax);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var opaquesCounter = new CounterWidget(panel, "Opaques",
|
||||||
|
function () { return Scene.getEngineNumFeedOpaqueItems(); },
|
||||||
|
function () { return Scene.getEngineNumDrawnOpaqueItems(); },
|
||||||
|
function(value) { Scene.setEngineMaxDrawnOpaqueItems(value); },
|
||||||
|
function () { return Scene.getEngineMaxDrawnOpaqueItems(); }
|
||||||
);
|
);
|
||||||
|
|
||||||
panel.newSlider("Num Drawn Opaques", 0, 1000,
|
var transparentsCounter = new CounterWidget(panel, "Transparents",
|
||||||
function(value) { },
|
function () { return Scene.getEngineNumFeedTransparentItems(); },
|
||||||
function() { return Scene.getEngineNumDrawnOpaqueItems(); },
|
function () { return Scene.getEngineNumDrawnTransparentItems(); },
|
||||||
function(value) { return (value); }
|
function(value) { Scene.setEngineMaxDrawnTransparentItems(value); },
|
||||||
|
function () { return Scene.getEngineMaxDrawnTransparentItems(); }
|
||||||
);
|
);
|
||||||
|
|
||||||
panel.newSlider("Max Drawn Opaques", -1, 1000,
|
var overlaysCounter = new CounterWidget(panel, "Overlays",
|
||||||
function(value) { Scene.setEngineMaxDrawnOpaqueItems(value); },
|
function () { return Scene.getEngineNumFeedOverlay3DItems(); },
|
||||||
function() { return Scene.getEngineMaxDrawnOpaqueItems(); },
|
function () { return Scene.getEngineNumDrawnOverlay3DItems(); },
|
||||||
function(value) { return (value); }
|
function(value) { Scene.setEngineMaxDrawnOverlay3DItems(value); },
|
||||||
|
function () { return Scene.getEngineMaxDrawnOverlay3DItems(); }
|
||||||
);
|
);
|
||||||
|
|
||||||
panel.newSlider("Num Feed Transparents", 0, 100,
|
|
||||||
function(value) { },
|
|
||||||
function() { return Scene.getEngineNumFeedTransparentItems(); },
|
|
||||||
function(value) { return (value); }
|
|
||||||
);
|
|
||||||
|
|
||||||
panel.newSlider("Num Drawn Transparents", 0, 100,
|
|
||||||
function(value) { },
|
|
||||||
function() { return Scene.getEngineNumDrawnTransparentItems(); },
|
|
||||||
function(value) { return (value); }
|
|
||||||
);
|
|
||||||
|
|
||||||
panel.newSlider("Max Drawn Transparents", -1, 100,
|
|
||||||
function(value) { Scene.setEngineMaxDrawnTransparentItems(value); },
|
|
||||||
function() { return Scene.getEngineMaxDrawnTransparentItems(); },
|
|
||||||
function(value) { return (value); }
|
|
||||||
);
|
|
||||||
|
|
||||||
panel.newSlider("Num Feed Overlay3Ds", 0, 100,
|
|
||||||
function(value) { },
|
|
||||||
function() { return Scene.getEngineNumFeedOverlay3DItems(); },
|
|
||||||
function(value) { return (value); }
|
|
||||||
);
|
|
||||||
|
|
||||||
panel.newSlider("Num Drawn Overlay3Ds", 0, 100,
|
|
||||||
function(value) { },
|
|
||||||
function() { return Scene.getEngineNumDrawnOverlay3DItems(); },
|
|
||||||
function(value) { return (value); }
|
|
||||||
);
|
|
||||||
|
|
||||||
panel.newSlider("Max Drawn Overlay3Ds", -1, 100,
|
|
||||||
function(value) { Scene.setEngineMaxDrawnOverlay3DItems(value); },
|
|
||||||
function() { return Scene.getEngineMaxDrawnOverlay3DItems(); },
|
|
||||||
function(value) { return (value); }
|
|
||||||
);
|
|
||||||
|
|
||||||
panel.newCheckbox("Display status",
|
panel.newCheckbox("Display status",
|
||||||
function(value) { Scene.setEngineDisplayItemStatus(value); },
|
function(value) { Scene.setEngineDisplayItemStatus(value); },
|
||||||
|
@ -75,31 +71,9 @@ panel.newCheckbox("Display status",
|
||||||
var tickTackPeriod = 500;
|
var tickTackPeriod = 500;
|
||||||
|
|
||||||
function updateCounters() {
|
function updateCounters() {
|
||||||
var numFeedOpaques = panel.get("Num Feed Opaques");
|
opaquesCounter.update();
|
||||||
var numFeedTransparents = panel.get("Num Feed Transparents");
|
transparentsCounter.update();
|
||||||
var numFeedOverlay3Ds = panel.get("Num Feed Overlay3Ds");
|
overlaysCounter.update();
|
||||||
|
|
||||||
panel.set("Num Feed Opaques", numFeedOpaques);
|
|
||||||
panel.set("Num Drawn Opaques", panel.get("Num Drawn Opaques"));
|
|
||||||
panel.set("Num Feed Transparents", numFeedTransparents);
|
|
||||||
panel.set("Num Drawn Transparents", panel.get("Num Drawn Transparents"));
|
|
||||||
panel.set("Num Feed Overlay3Ds", numFeedOverlay3Ds);
|
|
||||||
panel.set("Num Drawn Overlay3Ds", panel.get("Num Drawn Overlay3Ds"));
|
|
||||||
|
|
||||||
var numMax = Math.max(numFeedOpaques * 1.2, 1);
|
|
||||||
panel.getWidget("Num Feed Opaques").setMaxValue(numMax);
|
|
||||||
panel.getWidget("Num Drawn Opaques").setMaxValue(numMax);
|
|
||||||
panel.getWidget("Max Drawn Opaques").setMaxValue(numMax);
|
|
||||||
|
|
||||||
numMax = Math.max(numFeedTransparents * 1.2, 1);
|
|
||||||
panel.getWidget("Num Feed Transparents").setMaxValue(numMax);
|
|
||||||
panel.getWidget("Num Drawn Transparents").setMaxValue(numMax);
|
|
||||||
panel.getWidget("Max Drawn Transparents").setMaxValue(numMax);
|
|
||||||
|
|
||||||
numMax = Math.max(numFeedOverlay3Ds * 1.2, 1);
|
|
||||||
panel.getWidget("Num Feed Overlay3Ds").setMaxValue(numMax);
|
|
||||||
panel.getWidget("Num Drawn Overlay3Ds").setMaxValue(numMax);
|
|
||||||
panel.getWidget("Max Drawn Overlay3Ds").setMaxValue(numMax);
|
|
||||||
}
|
}
|
||||||
Script.setInterval(updateCounters, tickTackPeriod);
|
Script.setInterval(updateCounters, tickTackPeriod);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue