Commit e85370a2 authored by Febi Chajadi (fec935)'s avatar Febi Chajadi (fec935)
Browse files

Modified uploader field in upload form.

parent fd004b2f
......@@ -2,14 +2,14 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="%PUBLIC_URL%/appicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Upload 3D assets for later deployment on the AR-enabled Shared Spaces mobile app."
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/appicon.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
......
......@@ -3,17 +3,17 @@
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"src": "appicon.png",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"src": "appicon.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"src": "appicon.png",
"type": "image/png",
"sizes": "512x512"
}
......
......@@ -34,6 +34,8 @@ function App() {
const [xRot, setRotX] = useState(0);
const [yRot, setRotY] = useState(0);
const [zRot, setRotZ] = useState(0);
let texture = "";
let filename = "";
const changeSize = (newsizenum) => {
unityContent.send("scriptManager", "adjustSize", newsizenum);
......@@ -96,9 +98,9 @@ function App() {
}
})*/
Promise.all([promise1, promise2, promise3]).then(res => {
res.forEach(element => {
console.log(element);
});
//res.forEach(element => {
//console.log(element);
//});
toast.success('Upload successful!');
//var origfn = files[0].name;
//var newname = origfn.split('.').slice(0, -1).join('.');
......@@ -109,12 +111,20 @@ function App() {
} else {
unityContent.send("scriptManager", "loadSimple", newname);
}*/
for (var x = 0; x < files.length; x++){
var thisname = files[x].name.split('.').pop();
if (thisname === 'obj'){
filename = files[x].name;
}
}
if(baked){
var newname = "";
for (var i = 0; i < files.length; i++){
var poppedName = files[i].name.split('.').pop();
if(poppedName === "mtl" || poppedName === "obj"){
newname = newname + files[i].name + "\t";
} else if (poppedName === 'png' || poppedName === 'jpg' || poppedName === 'jpeg'){
texture = files[x].name;
}
}
var editedText = newname.slice(0, -1);
......@@ -127,7 +137,7 @@ function App() {
createItem();
})
.catch(err => {
console.log(err);
//console.log(err);
toast.warn('Upload failed.');
});
}
......@@ -141,6 +151,7 @@ function App() {
artistinfo.append('artworks', title);
artistinfo.append('exhibitions', '');
artistinfo.append('galleries', '');
artistinfo.append('uploader', token);
await axios.post(
"https://sharedspaces-dev.usask.ca/uploadconnect/artistcreate.php",
artistinfo
......@@ -157,15 +168,7 @@ function App() {
}
const createItem = async() => {
let texture = "";
if(baked){
for (var x = 0; x < files.length; x++){
var eName = files[x].name.split('.').pop();
if (eName === 'png' || eName === 'jpg' || eName === 'jpeg'){
texture = files[x].name;
}
}
}
//var filename = files.filter(file => file.name.split('.'.pop() === 'obj'));
const iteminfo = new FormData();
iteminfo.append('itemName', title);
iteminfo.append('size', size);
......@@ -182,6 +185,7 @@ function App() {
iteminfo.append('baked', baked);
iteminfo.append('uploader', token);
iteminfo.append('texture', texture);
iteminfo.append('itemfilename', filename);
await axios.post(
"https://sharedspaces-dev.usask.ca/uploadconnect/newinfo.php",
iteminfo
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment