mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 23:05:01 -06:00
T466: Only one gcode file can be loaded at a time, and deleting previous gcode file when loading non-gcode file
Merge changes : Only call backgroundItem.hasMesh if/on an imported model (skips if only curaprofiles get loaded)
This commit is contained in:
parent
1f84ad7084
commit
b4a7173a61
4 changed files with 67 additions and 12 deletions
|
@ -269,16 +269,16 @@ UM.MainWindow
|
|||
if(drop.urls.length > 0)
|
||||
{
|
||||
// Import models
|
||||
var imported_model = -1;
|
||||
for(var i in drop.urls)
|
||||
{
|
||||
// There is no endsWith in this version of JS...
|
||||
if ((drop.urls[i].length <= 12) || (drop.urls[i].substring(drop.urls[i].length-12) !== ".curaprofile")) {
|
||||
// Drop an object
|
||||
UM.MeshFileHandler.readLocalFile(drop.urls[i]);
|
||||
if (i == drop.urls.length - 1)
|
||||
Printer.loadFile(drop.urls[i]);
|
||||
if (imported_model == -1)
|
||||
{
|
||||
var meshName = backgroundItem.getMeshName(drop.urls[i].toString());
|
||||
backgroundItem.hasMesh(decodeURIComponent(meshName));
|
||||
imported_model = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -297,6 +297,11 @@ UM.MainWindow
|
|||
}
|
||||
messageDialog.open()
|
||||
}
|
||||
if (imported_model != -1)
|
||||
{
|
||||
var meshName = backgroundItem.getMeshName(drop.urls[imported_model].toString())
|
||||
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -732,14 +737,11 @@ UM.MainWindow
|
|||
|
||||
for(var i in fileUrls)
|
||||
{
|
||||
UM.MeshFileHandler.readLocalFile(fileUrls[i])
|
||||
|
||||
if (i == fileUrls.length - 1)
|
||||
{
|
||||
var meshName = backgroundItem.getMeshName(fileUrls.toString())
|
||||
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
||||
}
|
||||
Printer.loadFile(fileUrls[i])
|
||||
}
|
||||
|
||||
var meshName = backgroundItem.getMeshName(fileUrls[0].toString())
|
||||
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Menu
|
|||
return (index + 1) + ". " + path.slice(path.lastIndexOf("/") + 1);
|
||||
}
|
||||
onTriggered: {
|
||||
UM.MeshFileHandler.readLocalFile(modelData);
|
||||
Printer.loadFile(modelData);
|
||||
var meshName = backgroundItem.getMeshName(modelData.toString())
|
||||
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue