Fixed review comments

This commit is contained in:
Atlante45 2014-03-12 12:20:43 -07:00
parent 1c4051b288
commit 9402a5852c
7 changed files with 20 additions and 17 deletions

View file

@ -308,7 +308,7 @@ function initImport() {
}
function importVoxels() {
if (Clipboard.importVoxels() == 0) {
if (Clipboard.importVoxels()) {
isImporting = true;
if (importScale <= 0) {
importScale = 1;

View file

@ -4,22 +4,22 @@
<context>
<name>Application</name>
<message>
<location filename="src/Application.cpp" line="1373"/>
<location filename="src/Application.cpp" line="1374"/>
<source>Export Voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="1374"/>
<location filename="src/Application.cpp" line="1375"/>
<source>Sparse Voxel Octree Files (*.svo)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="3562"/>
<location filename="src/Application.cpp" line="3563"/>
<source>Open Script</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="3563"/>
<location filename="src/Application.cpp" line="3564"/>
<source>JavaScript Files (*.js)</source>
<translation type="unfinished"></translation>
</message>

View file

@ -140,6 +140,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
_fps(120.0f),
_justStarted(true),
_voxelImporter(NULL),
_importSucceded(false),
_sharedVoxelSystem(TREE_SCALE, DEFAULT_MAX_VOXELS_PER_SYSTEM, &_clipboard),
_wantToKillLocalVoxels(false),
_audioScope(256, 200, true),
@ -1387,7 +1388,7 @@ void Application::exportVoxels(const VoxelDetail& sourceVoxel) {
}
void Application::importVoxels() {
int result = 1;
_importSucceded = false;
if (!_voxelImporter) {
_voxelImporter = new VoxelImporter(_window);
@ -1396,7 +1397,7 @@ void Application::importVoxels() {
if (!_voxelImporter->exec()) {
qDebug() << "[DEBUG] Import succeeded." << endl;
result = 0;
_importSucceded = true;
} else {
qDebug() << "[DEBUG] Import failed." << endl;
if (_sharedVoxelSystem.getTree() == _voxelImporter->getVoxelTree()) {
@ -1408,7 +1409,7 @@ void Application::importVoxels() {
// restore the main window's active state
_window->activateWindow();
emit importDone(result);
emit importDone();
}
void Application::cutVoxels(const VoxelDetail& sourceVoxel) {

View file

@ -157,6 +157,7 @@ public:
VoxelTree* getVoxelTree() { return _voxels.getTree(); }
ParticleTreeRenderer* getParticles() { return &_particles; }
MetavoxelSystem* getMetavoxels() { return &_metavoxels; }
bool getImportSucceded() { return _importSucceded; }
VoxelSystem* getSharedVoxelSystem() { return &_sharedVoxelSystem; }
VoxelTree* getClipboard() { return &_clipboard; }
Environment* getEnvironment() { return &_environment; }
@ -225,8 +226,8 @@ signals:
/// Fired when we're rendering in-world interface elements; allows external parties to hook in.
void renderingInWorldInterface();
/// Fired when the import window is closed with a return code.
void importDone(int);
/// Fired when the import window is closed
void importDone();
public slots:
void domainChanged(const QString& domainHostname);
@ -368,6 +369,7 @@ private:
VoxelSystem _voxels;
VoxelTree _clipboard; // if I copy/paste
VoxelImporter* _voxelImporter;
bool _importSucceded;
VoxelSystem _sharedVoxelSystem;
ViewFrustum _sharedVoxelSystemViewFrustum;

View file

@ -77,11 +77,11 @@ void ClipboardScriptingInterface::exportVoxel(float x, float y, float z, float s
bool ClipboardScriptingInterface::importVoxels() {
qDebug() << "[DEBUG] Importing ... ";
QEventLoop loop;
connect(Application::getInstance(), SIGNAL(importDone(int)), &loop, SLOT(quit()));
connect(Application::getInstance(), SIGNAL(importDone()), &loop, SLOT(quit()));
emit readyToImport();
int returnCode = loop.exec();
loop.exec();
return returnCode;
return Application::getInstance()->getImportSucceded();
}
void ClipboardScriptingInterface::nudgeVoxel(const VoxelDetail& sourceVoxel, const glm::vec3& nudgeVec) {

View file

@ -61,8 +61,11 @@ void LocalVoxelsOverlay::render() {
void LocalVoxelsOverlay::setProperties(const QScriptValue &properties) {
Volume3DOverlay::setProperties(properties);
if (properties.property("scale").isValid()) {
setSize(properties.property("scale").toVariant().toFloat());
}
QScriptValue treeName = properties.property("name");
// if "end" property was not there, check to see if they included aliases: endPoint, or p2
if (treeName.isValid()) {
if ((_treeName = treeName.toString()) == DOMAIN_TREE_NAME) {
qDebug() << "addOverlay(): Can't create overlay from domain tree";

View file

@ -31,9 +31,6 @@ void Volume3DOverlay::setProperties(const QScriptValue& properties) {
if (properties.property("size").isValid()) {
setSize(properties.property("size").toVariant().toFloat());
}
if (properties.property("scale").isValid()) {
setSize(properties.property("scale").toVariant().toFloat());
}
if (properties.property("isSolid").isValid()) {
setIsSolid(properties.property("isSolid").toVariant().toBool());