mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-16 17:00:13 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into animenu
This commit is contained in:
commit
8717977437
12 changed files with 106 additions and 49 deletions
|
@ -40,6 +40,16 @@ var modelURLs = [
|
|||
|
||||
var toolBar;
|
||||
|
||||
function isLocked(properties) {
|
||||
// special case to lock the ground plane model in hq.
|
||||
if (location.hostname == "hq.highfidelity.io" &&
|
||||
properties.modelURL == "https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/Terrain_Reduce_forAlpha.fbx") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function controller(wichSide) {
|
||||
this.side = wichSide;
|
||||
this.palm = 2 * wichSide;
|
||||
|
@ -117,7 +127,7 @@ function controller(wichSide) {
|
|||
|
||||
|
||||
this.grab = function (modelID, properties) {
|
||||
if (this.isLocked(properties)) {
|
||||
if (isLocked(properties)) {
|
||||
print("Model locked " + modelID.id);
|
||||
} else {
|
||||
print("Grabbing " + modelID.id);
|
||||
|
@ -150,18 +160,9 @@ function controller(wichSide) {
|
|||
}
|
||||
}
|
||||
|
||||
this.isLocked = function (properties) {
|
||||
// special case to lock the ground plane model in hq.
|
||||
if (location.hostname == "hq.highfidelity.io" &&
|
||||
properties.modelURL == "https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/Terrain_Reduce_forAlpha.fbx") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.checkModel = function (properties) {
|
||||
// special case to lock the ground plane model in hq.
|
||||
if (this.isLocked(properties)) {
|
||||
if (isLocked(properties)) {
|
||||
return { valid: false };
|
||||
}
|
||||
|
||||
|
@ -293,6 +294,7 @@ function controller(wichSide) {
|
|||
if (this.pressing) {
|
||||
Vec3.print("Looking at: ", this.palmPosition);
|
||||
var foundModels = Models.findModels(this.palmPosition, LASER_LENGTH_FACTOR);
|
||||
|
||||
for (var i = 0; i < foundModels.length; i++) {
|
||||
|
||||
if (!foundModels[i].isKnownID) {
|
||||
|
@ -305,7 +307,9 @@ function controller(wichSide) {
|
|||
}
|
||||
|
||||
var properties = Models.getModelProperties(foundModels[i]);
|
||||
if (this.isLocked(properties)) {
|
||||
print("foundModels["+i+"].modelURL=" + properties.modelURL);
|
||||
|
||||
if (isLocked(properties)) {
|
||||
print("Model locked " + properties.id);
|
||||
} else {
|
||||
print("Checking properties: " + properties.id + " " + properties.isKnownID);
|
||||
|
@ -486,7 +490,7 @@ function mousePressEvent(event) {
|
|||
}
|
||||
|
||||
var properties = Models.getModelProperties(foundModels[i]);
|
||||
if (this.isLocked(properties)) {
|
||||
if (isLocked(properties)) {
|
||||
print("Model locked " + properties.id);
|
||||
} else {
|
||||
print("Checking properties: " + properties.id + " " + properties.isKnownID);
|
||||
|
@ -632,10 +636,23 @@ function mouseMoveEvent(event) {
|
|||
Models.editModel(selectedModelID, selectedModelProperties);
|
||||
}
|
||||
|
||||
function setupModelMenus() {
|
||||
// add our menuitems
|
||||
Menu.addMenuItem({ menuName: "Edit", menuItemName: "Models", isSeparator: true, beforeItem: "Physics" });
|
||||
Menu.addMenuItem({ menuName: "Edit", menuItemName: "Delete Model", shortcutKeyEvent: { text: "backspace" }, afterItem: "Models" });
|
||||
}
|
||||
|
||||
function cleanupModelMenus() {
|
||||
// delete our menuitems
|
||||
Menu.removeSeparator("Edit", "Models");
|
||||
Menu.removeMenuItem("Edit", "Delete Model");
|
||||
}
|
||||
|
||||
function scriptEnding() {
|
||||
leftController.cleanup();
|
||||
rightController.cleanup();
|
||||
toolBar.cleanup();
|
||||
cleanupModelMenus();
|
||||
}
|
||||
Script.scriptEnding.connect(scriptEnding);
|
||||
|
||||
|
@ -644,5 +661,22 @@ Script.update.connect(checkController);
|
|||
Controller.mousePressEvent.connect(mousePressEvent);
|
||||
Controller.mouseMoveEvent.connect(mouseMoveEvent);
|
||||
|
||||
setupModelMenus();
|
||||
Menu.menuItemEvent.connect(function(menuItem){
|
||||
print("menuItemEvent() in JS... menuItem=" + menuItem);
|
||||
if (menuItem == "Delete Model") {
|
||||
if (leftController.grabbing) {
|
||||
print(" Delete Model.... controller.modelID="+ leftController.modelID);
|
||||
Models.deleteModel(leftController.modelID);
|
||||
leftController.grabbing = false;
|
||||
} else if (rightController.grabbing) {
|
||||
print(" Delete Model.... controller.modelID="+ rightController.modelID);
|
||||
Models.deleteModel(rightController.modelID);
|
||||
rightController.grabbing = false;
|
||||
} else {
|
||||
print(" Delete Model.... not holding...");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ static const QString JOINT_FIELD = "joint";
|
|||
static const QString FREE_JOINT_FIELD = "freeJoint";
|
||||
|
||||
static const QString S3_URL = "http://public.highfidelity.io";
|
||||
static const QString DATA_SERVER_URL = "https://data-web.highfidelity.io";
|
||||
static const QString MODEL_URL = "/api/v1/models";
|
||||
|
||||
static const QString SETTING_NAME = "LastModelUploadLocation";
|
||||
|
|
|
@ -41,14 +41,8 @@ Visage::Visage() :
|
|||
_headOrigin(DEFAULT_HEAD_ORIGIN) {
|
||||
|
||||
#ifdef HAVE_VISAGE
|
||||
#ifdef WIN32
|
||||
QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage";
|
||||
#else
|
||||
QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage/license.vlc";
|
||||
#endif
|
||||
initializeLicenseManager(licensePath.data());
|
||||
_tracker = new VisageTracker2(Application::resourcesPath().toLatin1() + "visage/tracker.cfg");
|
||||
_data = new FaceData();
|
||||
_tracker = NULL;
|
||||
_data = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -179,6 +173,19 @@ void Visage::setEnabled(bool enabled) {
|
|||
return;
|
||||
}
|
||||
if ((_enabled = enabled)) {
|
||||
if(_tracker == NULL && _data == NULL){
|
||||
|
||||
#ifdef WIN32
|
||||
QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage";
|
||||
#else
|
||||
QByteArray licensePath = Application::resourcesPath().toLatin1() + "visage/license.vlc";
|
||||
#endif
|
||||
|
||||
initializeLicenseManager(licensePath.data());
|
||||
_tracker = new VisageTracker2(Application::resourcesPath().toLatin1() + "visage/tracker.cfg");
|
||||
_data = new FaceData();
|
||||
}
|
||||
|
||||
_tracker->trackFromCam();
|
||||
} else {
|
||||
_tracker->stop();
|
||||
|
|
|
@ -127,5 +127,9 @@ void ParticleTreeRenderer::renderElement(OctreeElement* element, RenderArgs* arg
|
|||
}
|
||||
|
||||
void ParticleTreeRenderer::processEraseMessage(const QByteArray& dataByteArray, const SharedNodePointer& sourceNode) {
|
||||
static_cast<ParticleTree*>(_tree)->processEraseMessage(dataByteArray, sourceNode);
|
||||
if (_tree){
|
||||
_tree->lockForWrite();
|
||||
static_cast<ParticleTree*>(_tree)->processEraseMessage(dataByteArray, sourceNode);
|
||||
_tree->unlock();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -691,7 +691,6 @@ void Model::computeBoundingShape(const FBXGeometry& geometry) {
|
|||
shapeIsSet.fill(false, numJoints);
|
||||
int numShapesSet = 0;
|
||||
int lastNumShapesSet = -1;
|
||||
glm::vec3 rootOffset(0.0f);
|
||||
while (numShapesSet < numJoints && numShapesSet != lastNumShapesSet) {
|
||||
lastNumShapesSet = numShapesSet;
|
||||
for (int i = 0; i < numJoints; i++) {
|
||||
|
@ -701,9 +700,11 @@ void Model::computeBoundingShape(const FBXGeometry& geometry) {
|
|||
if (parentIndex == -1) {
|
||||
glm::mat4 baseTransform = glm::scale(_scale) * glm::translate(_offset);
|
||||
glm::quat combinedRotation = joint.preRotation * joint.rotation * joint.postRotation;
|
||||
transforms[i] = baseTransform * geometry.offset * glm::translate(joint.translation)
|
||||
glm::mat4 rootTransform = baseTransform * geometry.offset * glm::translate(joint.translation)
|
||||
* joint.preTransform * glm::mat4_cast(combinedRotation) * joint.postTransform;
|
||||
rootOffset = extractTranslation(transforms[i]);
|
||||
// remove the tranlsation part before we save the root transform
|
||||
transforms[i] = glm::translate(- extractTranslation(rootTransform)) * rootTransform;
|
||||
|
||||
finalRotations[i] = combinedRotation;
|
||||
++numShapesSet;
|
||||
shapeIsSet[i] = true;
|
||||
|
@ -724,7 +725,7 @@ void Model::computeBoundingShape(const FBXGeometry& geometry) {
|
|||
for (int i = 0; i < _jointShapes.size(); i++) {
|
||||
const FBXJoint& joint = geometry.joints[i];
|
||||
glm::vec3 jointToShapeOffset = uniformScale * (finalRotations[i] * joint.shapePosition);
|
||||
glm::vec3 localPosition = extractTranslation(transforms[i]) + jointToShapeOffset- rootOffset;
|
||||
glm::vec3 localPosition = extractTranslation(transforms[i]) + jointToShapeOffset;
|
||||
Shape* shape = _jointShapes[i];
|
||||
shape->setPosition(localPosition);
|
||||
shape->setRotation(finalRotations[i] * joint.shapeRotation);
|
||||
|
@ -1087,12 +1088,10 @@ void Model::updateJointState(int index) {
|
|||
|
||||
if (joint.parentIndex == -1) {
|
||||
glm::mat4 baseTransform = glm::mat4_cast(_rotation) * glm::scale(_scale) * glm::translate(_offset);
|
||||
|
||||
glm::quat combinedRotation = joint.preRotation * state.rotation * joint.postRotation;
|
||||
state.transform = baseTransform * geometry.offset * glm::translate(state.translation) * joint.preTransform *
|
||||
glm::mat4_cast(combinedRotation) * joint.postTransform;
|
||||
state.combinedRotation = _rotation * combinedRotation;
|
||||
|
||||
} else {
|
||||
const JointState& parentState = _jointStates.at(joint.parentIndex);
|
||||
if (index == geometry.leanJointIndex) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "LoginDialog.h"
|
||||
|
||||
const QString FORGOT_PASSWORD_URL = "https://data-web.highfidelity.io/password/new";
|
||||
const QString FORGOT_PASSWORD_URL = "https://data.highfidelity.io/password/new";
|
||||
|
||||
LoginDialog::LoginDialog(QWidget* parent) :
|
||||
FramelessDialog(parent, 0, FramelessDialog::POSITION_TOP),
|
||||
|
|
|
@ -57,6 +57,11 @@ void ScriptEditorWidget::onScriptModified() {
|
|||
}
|
||||
}
|
||||
|
||||
void ScriptEditorWidget::onScriptEnding() {
|
||||
// signals will automatically be disonnected when the _scriptEngine is deleted later
|
||||
_scriptEngine = NULL;
|
||||
}
|
||||
|
||||
bool ScriptEditorWidget::isModified() {
|
||||
return _scriptEditorWidgetUI->scriptEdit->document()->isModified();
|
||||
}
|
||||
|
@ -69,11 +74,13 @@ bool ScriptEditorWidget::setRunning(bool run) {
|
|||
if (run && !save()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clean-up old connections.
|
||||
if (_scriptEngine != NULL) {
|
||||
disconnect(_scriptEngine, &ScriptEngine::runningStateChanged, this, &ScriptEditorWidget::runningStateChanged);
|
||||
disconnect(_scriptEngine, &ScriptEngine::errorMessage, this, &ScriptEditorWidget::onScriptError);
|
||||
disconnect(_scriptEngine, &ScriptEngine::printedMessage, this, &ScriptEditorWidget::onScriptPrint);
|
||||
disconnect(_scriptEngine, &ScriptEngine::scriptEnding, this, &ScriptEditorWidget::onScriptEnding);
|
||||
}
|
||||
|
||||
if (run) {
|
||||
|
@ -83,6 +90,7 @@ bool ScriptEditorWidget::setRunning(bool run) {
|
|||
// Make new connections.
|
||||
connect(_scriptEngine, &ScriptEngine::errorMessage, this, &ScriptEditorWidget::onScriptError);
|
||||
connect(_scriptEngine, &ScriptEngine::printedMessage, this, &ScriptEditorWidget::onScriptPrint);
|
||||
connect(_scriptEngine, &ScriptEngine::scriptEnding, this, &ScriptEditorWidget::onScriptEnding);
|
||||
} else {
|
||||
Application::getInstance()->stopScript(_currentScript);
|
||||
_scriptEngine = NULL;
|
||||
|
@ -125,6 +133,7 @@ void ScriptEditorWidget::loadFile(const QString& scriptPath) {
|
|||
disconnect(_scriptEngine, &ScriptEngine::runningStateChanged, this, &ScriptEditorWidget::runningStateChanged);
|
||||
disconnect(_scriptEngine, &ScriptEngine::errorMessage, this, &ScriptEditorWidget::onScriptError);
|
||||
disconnect(_scriptEngine, &ScriptEngine::printedMessage, this, &ScriptEditorWidget::onScriptPrint);
|
||||
disconnect(_scriptEngine, &ScriptEngine::scriptEnding, this, &ScriptEditorWidget::onScriptEnding);
|
||||
}
|
||||
} else {
|
||||
QNetworkAccessManager* networkManager = new QNetworkAccessManager(this);
|
||||
|
@ -144,6 +153,7 @@ void ScriptEditorWidget::loadFile(const QString& scriptPath) {
|
|||
connect(_scriptEngine, &ScriptEngine::runningStateChanged, this, &ScriptEditorWidget::runningStateChanged);
|
||||
connect(_scriptEngine, &ScriptEngine::errorMessage, this, &ScriptEditorWidget::onScriptError);
|
||||
connect(_scriptEngine, &ScriptEngine::printedMessage, this, &ScriptEditorWidget::onScriptPrint);
|
||||
connect(_scriptEngine, &ScriptEngine::scriptEnding, this, &ScriptEditorWidget::onScriptEnding);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ private slots:
|
|||
void onScriptError(const QString& message);
|
||||
void onScriptPrint(const QString& message);
|
||||
void onScriptModified();
|
||||
void onScriptEnding();
|
||||
|
||||
private:
|
||||
Ui::ScriptEditorWidget* _scriptEditorWidgetUI;
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
<string><style type="text/css">
|
||||
a { text-decoration: none; color: #267077;}
|
||||
</style>
|
||||
Invalid username or password. <a href="https://data-web.highfidelity.io/password/new">Recover?</a></string>
|
||||
Invalid username or password. <a href="https://data.highfidelity.io/password/new">Recover?</a></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
|
@ -458,7 +458,7 @@ border-radius: 4px; padding-top: 1px;</string>
|
|||
<string><style type="text/css">
|
||||
a { text-decoration: none; color: #267077;}
|
||||
</style>
|
||||
<a href="https://data-web.highfidelity.io/password/new">Recover password?</a></string>
|
||||
<a href="https://data.highfidelity.io/password/new">Recover password?</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -33,7 +33,7 @@ const char SOLO_NODE_TYPES[2] = {
|
|||
NodeType::AudioMixer
|
||||
};
|
||||
|
||||
const QUrl DEFAULT_NODE_AUTH_URL = QUrl("https://data-web.highfidelity.io");
|
||||
const QUrl DEFAULT_NODE_AUTH_URL = QUrl("https://data.highfidelity.io");
|
||||
|
||||
LimitedNodeList* LimitedNodeList::_sharedInstance = NULL;
|
||||
|
||||
|
|
|
@ -20,8 +20,9 @@ ParticleTreeElement::ParticleTreeElement(unsigned char* octalCode) : OctreeEleme
|
|||
|
||||
ParticleTreeElement::~ParticleTreeElement() {
|
||||
_voxelMemoryUsage -= sizeof(ParticleTreeElement);
|
||||
delete _particles;
|
||||
QList<Particle>* tmpParticles = _particles;
|
||||
_particles = NULL;
|
||||
delete tmpParticles;
|
||||
}
|
||||
|
||||
// This will be called primarily on addChildAt(), which means we're adding a child of our
|
||||
|
@ -277,12 +278,14 @@ const Particle* ParticleTreeElement::getParticleWithID(uint32_t id) const {
|
|||
|
||||
bool ParticleTreeElement::removeParticleWithID(uint32_t id) {
|
||||
bool foundParticle = false;
|
||||
uint16_t numberOfParticles = _particles->size();
|
||||
for (uint16_t i = 0; i < numberOfParticles; i++) {
|
||||
if ((*_particles)[i].getID() == id) {
|
||||
foundParticle = true;
|
||||
_particles->removeAt(i);
|
||||
break;
|
||||
if (_particles) {
|
||||
uint16_t numberOfParticles = _particles->size();
|
||||
for (uint16_t i = 0; i < numberOfParticles; i++) {
|
||||
if ((*_particles)[i].getID() == id) {
|
||||
foundParticle = true;
|
||||
_particles->removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return foundParticle;
|
||||
|
|
|
@ -276,7 +276,7 @@ unsigned char* pointToOctalCode(float x, float y, float z, float s) {
|
|||
unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r, unsigned char g, unsigned char b ) {
|
||||
|
||||
// special case for size 1, the root node
|
||||
if (s >= 1.0) {
|
||||
if (s >= 1.0f) {
|
||||
unsigned char* voxelOut = new unsigned char;
|
||||
*voxelOut = 0;
|
||||
return voxelOut;
|
||||
|
@ -289,7 +289,7 @@ unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r,
|
|||
// voxel of size S.
|
||||
unsigned int voxelSizeInOctets = 1;
|
||||
while (sTest > s) {
|
||||
sTest /= 2.0;
|
||||
sTest /= 2.0f;
|
||||
voxelSizeInOctets++;
|
||||
}
|
||||
|
||||
|
@ -314,11 +314,11 @@ unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r,
|
|||
if (x >= xTest) {
|
||||
//<write 1 bit>
|
||||
byte = (byte << 1) | true;
|
||||
xTest += sTest/2.0;
|
||||
xTest += sTest/2.0f;
|
||||
} else {
|
||||
//<write 0 bit;>
|
||||
byte = (byte << 1) | false;
|
||||
xTest -= sTest/2.0;
|
||||
xTest -= sTest/2.0f;
|
||||
}
|
||||
bitInByteNDX++;
|
||||
// If we've reached the last bit of the byte, then we want to copy this byte
|
||||
|
@ -333,11 +333,11 @@ unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r,
|
|||
if (y >= yTest) {
|
||||
//<write 1 bit>
|
||||
byte = (byte << 1) | true;
|
||||
yTest += sTest/2.0;
|
||||
yTest += sTest/2.0f;
|
||||
} else {
|
||||
//<write 0 bit;>
|
||||
byte = (byte << 1) | false;
|
||||
yTest -= sTest/2.0;
|
||||
yTest -= sTest/2.0f;
|
||||
}
|
||||
bitInByteNDX++;
|
||||
// If we've reached the last bit of the byte, then we want to copy this byte
|
||||
|
@ -352,11 +352,11 @@ unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r,
|
|||
if (z >= zTest) {
|
||||
//<write 1 bit>
|
||||
byte = (byte << 1) | true;
|
||||
zTest += sTest/2.0;
|
||||
zTest += sTest/2.0f;
|
||||
} else {
|
||||
//<write 0 bit;>
|
||||
byte = (byte << 1) | false;
|
||||
zTest -= sTest/2.0;
|
||||
zTest -= sTest/2.0f;
|
||||
}
|
||||
bitInByteNDX++;
|
||||
// If we've reached the last bit of the byte, then we want to copy this byte
|
||||
|
@ -369,7 +369,7 @@ unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r,
|
|||
}
|
||||
|
||||
octetsDone++;
|
||||
sTest /= 2.0;
|
||||
sTest /= 2.0f;
|
||||
}
|
||||
|
||||
// If we've got here, and we didn't fill the last byte, we need to zero pad this
|
||||
|
|
Loading…
Reference in a new issue