mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 15:34:05 +02:00
remove code related to tablet being a model rather than an overlay. start on landscape mode
This commit is contained in:
parent
985924a476
commit
371df35013
6 changed files with 54 additions and 104 deletions
|
@ -548,7 +548,6 @@ const float DEFAULT_HMD_TABLET_SCALE_PERCENT = 100.0f;
|
|||
const float DEFAULT_DESKTOP_TABLET_SCALE_PERCENT = 75.0f;
|
||||
const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = true;
|
||||
const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false;
|
||||
const bool DEFAULT_TABLET_VISIBLE_TO_OTHERS = false;
|
||||
const bool DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS = true;
|
||||
|
||||
Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bool runServer, QString runServerPathOption) :
|
||||
|
@ -571,7 +570,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
_desktopTabletScale("desktopTabletScale", DEFAULT_DESKTOP_TABLET_SCALE_PERCENT),
|
||||
_desktopTabletBecomesToolbarSetting("desktopTabletBecomesToolbar", DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR),
|
||||
_hmdTabletBecomesToolbarSetting("hmdTabletBecomesToolbar", DEFAULT_HMD_TABLET_BECOMES_TOOLBAR),
|
||||
_tabletVisibleToOthersSetting("tabletVisibleToOthers", DEFAULT_TABLET_VISIBLE_TO_OTHERS),
|
||||
_preferAvatarFingerOverStylusSetting("preferAvatarFingerOverStylus", DEFAULT_PREFER_AVATAR_FINGER_OVER_STYLUS),
|
||||
_constrainToolbarPosition("toolbar/constrainToolbarToCenterX", true),
|
||||
_scaleMirror(1.0f),
|
||||
|
@ -2359,11 +2357,6 @@ void Application::setHmdTabletBecomesToolbarSetting(bool value) {
|
|||
updateSystemTabletMode();
|
||||
}
|
||||
|
||||
void Application::setTabletVisibleToOthersSetting(bool value) {
|
||||
_tabletVisibleToOthersSetting.set(value);
|
||||
updateSystemTabletMode();
|
||||
}
|
||||
|
||||
void Application::setPreferAvatarFingerOverStylus(bool value) {
|
||||
_preferAvatarFingerOverStylusSetting.set(value);
|
||||
}
|
||||
|
@ -3788,7 +3781,6 @@ void Application::loadSettings() {
|
|||
}
|
||||
|
||||
getMyAvatar()->loadData();
|
||||
setTabletVisibleToOthersSetting(false);
|
||||
_settingsLoaded = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -220,8 +220,6 @@ public:
|
|||
void setDesktopTabletBecomesToolbarSetting(bool value);
|
||||
bool getHmdTabletBecomesToolbarSetting() { return _hmdTabletBecomesToolbarSetting.get(); }
|
||||
void setHmdTabletBecomesToolbarSetting(bool value);
|
||||
bool getTabletVisibleToOthersSetting() { return _tabletVisibleToOthersSetting.get(); }
|
||||
void setTabletVisibleToOthersSetting(bool value);
|
||||
bool getPreferAvatarFingerOverStylus() { return _preferAvatarFingerOverStylusSetting.get(); }
|
||||
void setPreferAvatarFingerOverStylus(bool value);
|
||||
|
||||
|
@ -569,7 +567,6 @@ private:
|
|||
Setting::Handle<float> _desktopTabletScale;
|
||||
Setting::Handle<bool> _desktopTabletBecomesToolbarSetting;
|
||||
Setting::Handle<bool> _hmdTabletBecomesToolbarSetting;
|
||||
Setting::Handle<bool> _tabletVisibleToOthersSetting;
|
||||
Setting::Handle<bool> _preferAvatarFingerOverStylusSetting;
|
||||
Setting::Handle<bool> _constrainToolbarPosition;
|
||||
|
||||
|
|
|
@ -102,13 +102,6 @@ void setupPreferences() {
|
|||
auto setter = [](bool value) { qApp->setHmdTabletBecomesToolbarSetting(value); };
|
||||
preferences->addPreference(new CheckPreference(UI_CATEGORY, "HMD Tablet Becomes Toolbar", getter, setter));
|
||||
}
|
||||
// TODO
|
||||
// Note: If this code is added back, you must remove the line "setTabletVisibleToOthersSetting(false)" from Application::loadSettings()
|
||||
/*{
|
||||
auto getter = []()->bool { return qApp->getTabletVisibleToOthersSetting(); };
|
||||
auto setter = [](bool value) { qApp->setTabletVisibleToOthersSetting(value); };
|
||||
preferences->addPreference(new CheckPreference(UI_CATEGORY, "Tablet Is Visible To Others", getter, setter));
|
||||
}*/
|
||||
{
|
||||
auto getter = []()->bool { return qApp->getPreferAvatarFingerOverStylus(); };
|
||||
auto setter = [](bool value) { qApp->setPreferAvatarFingerOverStylus(value); };
|
||||
|
|
|
@ -662,7 +662,10 @@ const QString OBJECT_NAME_KEY = "objectName";
|
|||
const QString STABLE_ORDER_KEY = "stableOrder";
|
||||
static int s_stableOrder = 1;
|
||||
|
||||
TabletButtonProxy::TabletButtonProxy(const QVariantMap& properties) : _uuid(QUuid::createUuid()), _stableOrder(++s_stableOrder), _properties(properties) {
|
||||
TabletButtonProxy::TabletButtonProxy(const QVariantMap& properties) :
|
||||
_uuid(QUuid::createUuid()),
|
||||
_stableOrder(++s_stableOrder),
|
||||
_properties(properties) {
|
||||
// this is used to uniquely identify this button.
|
||||
_properties[UUID_KEY] = _uuid;
|
||||
_properties[OBJECT_NAME_KEY] = _uuid.toString();
|
||||
|
|
|
@ -35,7 +35,7 @@ var TABLET_NATURAL_DIMENSIONS = {x: 33.797, y: 50.129, z: 2.269};
|
|||
|
||||
var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-close.png";
|
||||
// var HOME_BUTTON_TEXTURE = Script.resourcesPath() + "meshes/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-close.png";
|
||||
var TABLET_MODEL_PATH = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx";
|
||||
// var TABLET_MODEL_PATH = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx";
|
||||
var LOCAL_TABLET_MODEL_PATH = Script.resourcesPath() + "meshes/tablet-with-home-button.fbx";
|
||||
|
||||
// returns object with two fields:
|
||||
|
@ -105,6 +105,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
|||
var tabletScaleFactor = this.width / TABLET_NATURAL_DIMENSIONS.x;
|
||||
this.height = TABLET_NATURAL_DIMENSIONS.y * tabletScaleFactor;
|
||||
this.depth = TABLET_NATURAL_DIMENSIONS.z * tabletScaleFactor;
|
||||
this.landscape = false;
|
||||
|
||||
if (dpi) {
|
||||
this.dpi = dpi;
|
||||
|
@ -112,13 +113,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
|||
this.dpi = DEFAULT_DPI * (DEFAULT_WIDTH / this.width);
|
||||
}
|
||||
|
||||
var modelURL;
|
||||
if (Settings.getValue("tabletVisibleToOthers")) {
|
||||
modelURL = TABLET_MODEL_PATH;
|
||||
} else {
|
||||
modelURL = LOCAL_TABLET_MODEL_PATH;
|
||||
}
|
||||
|
||||
var modelURL = LOCAL_TABLET_MODEL_PATH;
|
||||
var tabletProperties = {
|
||||
name: "WebTablet Tablet",
|
||||
type: "Model",
|
||||
|
@ -132,6 +127,14 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
|||
parentID: AVATAR_SELF_ID
|
||||
};
|
||||
|
||||
this.getDimensions = function() {
|
||||
if (this.landscape) {
|
||||
return { x: this.width * 2, y: this.height, z: this.depth };
|
||||
} else {
|
||||
return { x: this.width, y: this.height, z: this.depth };
|
||||
}
|
||||
};
|
||||
|
||||
// compute position, rotation & parentJointIndex of the tablet
|
||||
this.calculateTabletAttachmentProperties(hand, true, tabletProperties);
|
||||
if (location) {
|
||||
|
@ -141,13 +144,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
|||
|
||||
this.cleanUpOldTablets();
|
||||
|
||||
if (Settings.getValue("tabletVisibleToOthers")) {
|
||||
this.tabletEntityID = Entities.addEntity(tabletProperties, clientOnly);
|
||||
this.tabletIsOverlay = false;
|
||||
} else {
|
||||
this.tabletEntityID = Overlays.addOverlay("model", tabletProperties);
|
||||
this.tabletIsOverlay = true;
|
||||
}
|
||||
this.tabletEntityID = Overlays.addOverlay("model", tabletProperties);
|
||||
|
||||
if (this.webOverlayID) {
|
||||
Overlays.deleteOverlay(this.webOverlayID);
|
||||
|
@ -188,13 +185,14 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
|||
if (_this.homeButtonID == senderID) {
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var onHomeScreen = tablet.onHomeScreen();
|
||||
var isMessageOpen;
|
||||
if (onHomeScreen) {
|
||||
var isMessageOpen = tablet.isMessageDialogOpen();
|
||||
isMessageOpen = tablet.isMessageDialogOpen();
|
||||
if (isMessageOpen === false) {
|
||||
HMD.closeTablet();
|
||||
}
|
||||
} else {
|
||||
var isMessageOpen = tablet.isMessageDialogOpen();
|
||||
isMessageOpen = tablet.isMessageDialogOpen();
|
||||
if (isMessageOpen === false) {
|
||||
tablet.gotoHomeScreen();
|
||||
_this.setHomeButtonTexture();
|
||||
|
@ -203,6 +201,14 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
|||
}
|
||||
};
|
||||
|
||||
this.setLandscape = function(newLandscapeValue) {
|
||||
if (this.landscape == newLandscapeValue) {
|
||||
return;
|
||||
}
|
||||
this.landscape = newLandscapeValue;
|
||||
Overlays.editOverlay(this.tabletEntityID, this.getDimensions());
|
||||
};
|
||||
|
||||
this.state = "idle";
|
||||
|
||||
this.getRoot = function() {
|
||||
|
@ -210,16 +216,12 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location) {
|
|||
};
|
||||
|
||||
this.getLocation = function() {
|
||||
if (this.tabletIsOverlay) {
|
||||
var location = Overlays.getProperty(this.tabletEntityID, "localPosition");
|
||||
var orientation = Overlays.getProperty(this.tabletEntityID, "localOrientation");
|
||||
return {
|
||||
localPosition: location,
|
||||
localRotation: orientation
|
||||
};
|
||||
} else {
|
||||
return Entities.getEntityProperties(_this.tabletEntityID, ["localPosition", "localRotation"]);
|
||||
}
|
||||
var location = Overlays.getProperty(this.tabletEntityID, "localPosition");
|
||||
var orientation = Overlays.getProperty(this.tabletEntityID, "localOrientation");
|
||||
return {
|
||||
localPosition: location,
|
||||
localRotation: orientation
|
||||
};
|
||||
};
|
||||
this.clicked = false;
|
||||
|
||||
|
@ -285,11 +287,7 @@ WebTablet.prototype.setWidth = function (width) {
|
|||
this.dpi = DEFAULT_DPI * (DEFAULT_WIDTH / this.width);
|
||||
|
||||
// update tablet model dimensions
|
||||
if (this.tabletIsOverlay) {
|
||||
Overlays.editOverlay(this.tabletEntityID, {dimensions: {x: this.width, y: this.height, z: this.depth}});
|
||||
} else {
|
||||
Entities.editEntity(this.tabletEntityID, {dimensions: {x: this.width, y: this.height, z: this.depth}});
|
||||
}
|
||||
Overlays.editOverlay(this.tabletEntityID, { dimensions: this.getDimensions() });
|
||||
|
||||
// update webOverlay
|
||||
var WEB_ENTITY_Z_OFFSET = (this.depth / 2);
|
||||
|
@ -309,11 +307,7 @@ WebTablet.prototype.setWidth = function (width) {
|
|||
|
||||
WebTablet.prototype.destroy = function () {
|
||||
Overlays.deleteOverlay(this.webOverlayID);
|
||||
if (this.tabletIsOverlay) {
|
||||
Overlays.deleteOverlay(this.tabletEntityID);
|
||||
} else {
|
||||
Entities.deleteEntity(this.tabletEntityID);
|
||||
}
|
||||
Overlays.deleteOverlay(this.tabletEntityID);
|
||||
Overlays.deleteOverlay(this.homeButtonID);
|
||||
HMD.displayModeChanged.disconnect(this.myOnHmdChanged);
|
||||
|
||||
|
@ -488,11 +482,7 @@ WebTablet.prototype.getPosition = function () {
|
|||
WebTablet.prototype.mousePressEvent = function (event) {
|
||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||
var entityPickResults;
|
||||
if (this.tabletIsOverlay) {
|
||||
entityPickResults = Overlays.findRayIntersection(pickRay, true, [this.tabletEntityID]);
|
||||
} else {
|
||||
entityPickResults = Entities.findRayIntersection(pickRay, true, [this.tabletEntityID]);
|
||||
}
|
||||
entityPickResults = Overlays.findRayIntersection(pickRay, true, [this.tabletEntityID]);
|
||||
if (entityPickResults.intersects && (entityPickResults.entityID === this.tabletEntityID ||
|
||||
entityPickResults.overlayID === this.tabletEntityID)) {
|
||||
var overlayPickResults = Overlays.findRayIntersection(pickRay, true, [this.webOverlayID, this.homeButtonID], []);
|
||||
|
@ -514,11 +504,7 @@ WebTablet.prototype.mousePressEvent = function (event) {
|
|||
this.dragging = true;
|
||||
var invCameraXform = new Xform(Camera.orientation, Camera.position).inv();
|
||||
this.initialLocalIntersectionPoint = invCameraXform.xformPoint(entityPickResults.intersection);
|
||||
if (this.tabletIsOverlay) {
|
||||
this.initialLocalPosition = Overlays.getProperty(this.tabletEntityID, "localPosition");
|
||||
} else {
|
||||
this.initialLocalPosition = Entities.getEntityProperties(this.tabletEntityID, ["localPosition"]).localPosition;
|
||||
}
|
||||
this.initialLocalPosition = Overlays.getProperty(this.tabletEntityID, "localPosition");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -564,15 +550,9 @@ WebTablet.prototype.mouseMoveEvent = function (event) {
|
|||
var localIntersectionPoint = Vec3.sum(localPickRay.origin, Vec3.multiply(localPickRay.direction, result.distance));
|
||||
var localOffset = Vec3.subtract(localIntersectionPoint, this.initialLocalIntersectionPoint);
|
||||
var localPosition = Vec3.sum(this.initialLocalPosition, localOffset);
|
||||
if (this.tabletIsOverlay) {
|
||||
Overlays.editOverlay(this.tabletEntityID, {
|
||||
localPosition: localPosition
|
||||
});
|
||||
} else {
|
||||
Entities.editEntity(this.tabletEntityID, {
|
||||
localPosition: localPosition
|
||||
});
|
||||
}
|
||||
Overlays.editOverlay(this.tabletEntityID, {
|
||||
localPosition: localPosition
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
if (!UIWebTablet) {
|
||||
return false;
|
||||
}
|
||||
if (UIWebTablet.tabletIsOverlay && Overlays.getProperty(HMD.tabletID, "type") != "model") {
|
||||
if (Overlays.getProperty(HMD.tabletID, "type") != "model") {
|
||||
if (debugTablet) {
|
||||
print("TABLET is invalid due to frame: " + JSON.stringify(Overlays.getProperty(HMD.tabletID, "type")));
|
||||
}
|
||||
|
@ -96,7 +96,7 @@
|
|||
tabletShown = true;
|
||||
|
||||
if (!tabletRezzed || !tabletIsValid()) {
|
||||
closeTabletUI()
|
||||
closeTabletUI();
|
||||
rezTablet();
|
||||
}
|
||||
|
||||
|
@ -107,9 +107,7 @@
|
|||
var tabletProperties = {};
|
||||
UIWebTablet.calculateTabletAttachmentProperties(activeHand, true, tabletProperties);
|
||||
tabletProperties.visible = true;
|
||||
if (UIWebTablet.tabletIsOverlay) {
|
||||
Overlays.editOverlay(HMD.tabletID, tabletProperties);
|
||||
}
|
||||
Overlays.editOverlay(HMD.tabletID, tabletProperties);
|
||||
Overlays.editOverlay(HMD.homeButtonID, { visible: true });
|
||||
Overlays.editOverlay(HMD.tabletScreenID, { visible: true });
|
||||
Overlays.editOverlay(HMD.tabletScreenID, { maxFPS: 90 });
|
||||
|
@ -122,22 +120,14 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (UIWebTablet.tabletIsOverlay) {
|
||||
if (debugTablet) {
|
||||
print("TABLET hide");
|
||||
}
|
||||
if (Settings.getValue("tabletVisibleToOthers")) {
|
||||
closeTabletUI();
|
||||
} else {
|
||||
// Overlays.editOverlay(HMD.tabletID, { localPosition: { x: -1000, y: 0, z:0 } });
|
||||
Overlays.editOverlay(HMD.tabletID, { visible: false });
|
||||
Overlays.editOverlay(HMD.homeButtonID, { visible: false });
|
||||
Overlays.editOverlay(HMD.tabletScreenID, { visible: false });
|
||||
Overlays.editOverlay(HMD.tabletScreenID, { maxFPS: 1 });
|
||||
}
|
||||
} else {
|
||||
closeTabletUI();
|
||||
if (debugTablet) {
|
||||
print("TABLET hide");
|
||||
}
|
||||
|
||||
Overlays.editOverlay(HMD.tabletID, { visible: false });
|
||||
Overlays.editOverlay(HMD.homeButtonID, { visible: false });
|
||||
Overlays.editOverlay(HMD.tabletScreenID, { visible: false });
|
||||
Overlays.editOverlay(HMD.tabletScreenID, { maxFPS: 1 });
|
||||
}
|
||||
|
||||
function closeTabletUI() {
|
||||
|
@ -169,7 +159,6 @@
|
|||
|
||||
// close the WebTablet if it we go into toolbar mode.
|
||||
var toolbarMode = Tablet.getTablet("com.highfidelity.interface.tablet.system").toolbarMode;
|
||||
var visibleToOthers = Settings.getValue("tabletVisibleToOthers");
|
||||
|
||||
if (tabletShown && toolbarMode) {
|
||||
closeTabletUI();
|
||||
|
@ -205,20 +194,16 @@
|
|||
// check for change in tablet scale.
|
||||
|
||||
if (HMD.showTablet && !tabletShown && !toolbarMode) {
|
||||
UserActivityLogger.openedTablet(visibleToOthers);
|
||||
UserActivityLogger.openedTablet(false);
|
||||
showTabletUI();
|
||||
} else if (!HMD.showTablet && tabletShown) {
|
||||
UserActivityLogger.closedTablet();
|
||||
if (visibleToOthers) {
|
||||
closeTabletUI();
|
||||
} else {
|
||||
hideTabletUI();
|
||||
}
|
||||
hideTabletUI();
|
||||
}
|
||||
|
||||
// if the tablet is an overlay, attempt to pre-create it and then hide it so that when it's
|
||||
// summoned, it will appear quickly.
|
||||
if (!toolbarMode && !visibleToOthers) {
|
||||
if (!toolbarMode) {
|
||||
if (now - preMakeTime > MSECS_PER_SEC) {
|
||||
preMakeTime = now;
|
||||
if (!tabletIsValid()) {
|
||||
|
@ -273,7 +258,7 @@
|
|||
Script.scriptEnding.connect(function () {
|
||||
var tabletID = HMD.tabletID;
|
||||
Entities.deleteEntity(tabletID);
|
||||
Overlays.deleteOverlay(tabletID)
|
||||
Overlays.deleteOverlay(tabletID);
|
||||
HMD.tabletID = null;
|
||||
HMD.homeButtonID = null;
|
||||
HMD.tabletScreenID = null;
|
||||
|
|
Loading…
Reference in a new issue