forked from kaverti/website
3/5
This commit is contained in:
parent
6fc227a413
commit
d14b745cfb
|
@ -773,7 +773,7 @@ blockquote {
|
|||
<b-navbar-item @click="switchUser('user3')" v-if="$store.state.availableUsers.user3.username">{{$store.state.availableUsers.user3.username}}</b-navbar-item>
|
||||
<b-navbar-item @click="switchUser('user3')" v-if="$store.state.availableUsers.user3.username">{{$store.state.availableUsers.user3.username}}</b-navbar-item>
|
||||
<b-navbar-item @click="showAccountModalTab(1)">Add another user</b-navbar-item>
|
||||
<b-navbar-item @click="logoutAll">Logout all users</b-navbar-item>
|
||||
<b-navbar-item @click="logoutAll">Logout of all users</b-navbar-item>
|
||||
<b-navbar-item @click="reload()">Not seeing any users?</b-navbar-item>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1095,6 +1095,7 @@ export default {
|
|||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
if(res.data.theme === "dark") {
|
||||
this.darkTheme()
|
||||
}
|
||||
|
@ -1151,6 +1152,7 @@ export default {
|
|||
this.$store.commit('setAdmin', res.data.admin)
|
||||
this.$store.commit('setDevMode', res.data.developerMode)
|
||||
this.$store.commit('setTheme', res.data.theme)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
})
|
||||
})
|
||||
.catch(e => {
|
||||
|
@ -1191,6 +1193,7 @@ export default {
|
|||
this.$store.commit('setEmailVerified', res.data.emailVerified)
|
||||
this.$store.commit('setAdmin', res.data.admin)
|
||||
this.$store.commit('setDevMode', res.data.developerMode)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
})
|
||||
})
|
||||
.catch(e => {
|
||||
|
@ -1219,6 +1222,7 @@ export default {
|
|||
this.$store.commit('setAdmin', res.data.admin)
|
||||
this.$store.commit('setDevMode', res.data.developerMode)
|
||||
this.$store.commit('setTheme', res.data.theme)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
})
|
||||
})
|
||||
.catch(e => {
|
||||
|
@ -1305,12 +1309,11 @@ export default {
|
|||
this.$store.commit('setEmail', res.data.email)
|
||||
this.$store.commit('setEmailVerified', res.data.emailVerified)
|
||||
this.$store.commit('setAdmin', res.data.admin)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
})
|
||||
})
|
||||
.catch(e => {
|
||||
this.settings.account.email.loadingChange = false
|
||||
|
||||
console.log(e)
|
||||
AjaxErrorHandler(this.$store)(e)
|
||||
})
|
||||
.catch(e => {
|
||||
|
@ -1379,6 +1382,7 @@ export default {
|
|||
this.$store.commit('setTheme', res.data.theme)
|
||||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'kaverti/state')
|
||||
.then(res => {
|
||||
this.$store.commit('setSettings', res.data)
|
||||
|
@ -1416,7 +1420,6 @@ export default {
|
|||
})
|
||||
.catch(e => {
|
||||
this.settings.account.deleteAccountLoading = false
|
||||
console.log(e)
|
||||
AjaxErrorHandler(this.$store)(e)
|
||||
})
|
||||
},
|
||||
|
@ -1562,6 +1565,7 @@ export default {
|
|||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'kaverti/state')
|
||||
.then(res => {
|
||||
this.$store.commit('setSettings', res.data)
|
||||
|
@ -1599,6 +1603,7 @@ export default {
|
|||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'kaverti/state')
|
||||
.then(res => {
|
||||
this.$store.commit('setSettings', res.data)
|
||||
|
@ -1675,6 +1680,7 @@ export default {
|
|||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'kaverti/state')
|
||||
.then(res => {
|
||||
this.$store.commit('setSettings', res.data)
|
||||
|
@ -1709,6 +1715,7 @@ export default {
|
|||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
this.closeConn()
|
||||
}).catch(err => {
|
||||
this.showConn()
|
||||
|
@ -1873,6 +1880,7 @@ export default {
|
|||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
|
||||
|
||||
this.closeConn()
|
||||
|
@ -1987,6 +1995,7 @@ export default {
|
|||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
this.closeConn()
|
||||
}).catch(err => {
|
||||
this.showConn()
|
||||
|
@ -2006,7 +2015,6 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted () {
|
||||
console.log(JSON.parse(localStorage.getItem('currentUser')))
|
||||
this.$store.commit('setMultiUser1Sess', JSON.parse(localStorage.getItem('accessToken')))
|
||||
this.$store.commit('setMultiUser2Sess', JSON.parse(localStorage.getItem('accessToken2')))
|
||||
this.$store.commit('setMultiUser3Sess', JSON.parse(localStorage.getItem('accessToken3')))
|
||||
|
@ -2115,6 +2123,7 @@ export default {
|
|||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
if(res.data.theme === "dark") {
|
||||
this.darkTheme()
|
||||
}
|
||||
|
@ -2147,7 +2156,6 @@ export default {
|
|||
this.pollConn()
|
||||
}
|
||||
})
|
||||
console.log(this.$store.state.sessToken + 'IDENTIFY')
|
||||
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'userinfo', {
|
||||
headers: {
|
||||
'Authorization': this.$store.state.sessToken
|
||||
|
@ -2164,6 +2172,7 @@ export default {
|
|||
this.$store.commit('setExecutive', res.data.executive)
|
||||
this.$store.commit('setUserId', res.data.id)
|
||||
this.$store.commit('setBot', res.data.bot)
|
||||
this.$store.commit('setModeler', res.data.modeler)
|
||||
this.closeConn()
|
||||
}).catch(err => {
|
||||
this.showConn()
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<template v-if='userData'>
|
||||
<div class='avatar_icon__header'>
|
||||
<figure class="avatar_icon__icon--small picture_circle">
|
||||
<figure class="picture_circle">
|
||||
<img
|
||||
:src = pictureURL
|
||||
>
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
<style>
|
||||
.avatar-img {
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div
|
||||
class='user_display'
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
slot='footer'
|
||||
class='button is-danger'
|
||||
style='z-index: 100; width: 50%;'
|
||||
@click=' teamBan(selectedTeam)'
|
||||
@click='teamBan(selectedTeam)'
|
||||
ref='ajaxErrorsModalButton'
|
||||
>
|
||||
Delete
|
||||
|
@ -43,20 +43,17 @@
|
|||
Close
|
||||
</button>
|
||||
</modal-window>
|
||||
<section v-if='$store.state.experimentsStore.teams' class="hero is-info">
|
||||
<div class="hero-body" style="padding: 1rem 1rem !important;">
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<p style="text-align: center;">Teams are currently in development, expect missing features.</p>
|
||||
<div class="section">
|
||||
<section v-if='$store.state.experimentsStore.teams' class="hero is-info">
|
||||
<div class="hero-body" style="padding: 1rem 1rem !important;">
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<p style="text-align: center;">Remember, do not approve items that use the default template with 0 modifications, or if the image fails to load correctly.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="section">
|
||||
</section>
|
||||
<div class="">
|
||||
<div class="column" v-if="$store.state.username">
|
||||
<b-button @click="createTeamModal = true" class="is-primary">Create Team</b-button>
|
||||
</div>
|
||||
<scroll-load
|
||||
key='user-row'
|
||||
class='columns is-multiline'
|
||||
|
@ -64,19 +61,18 @@
|
|||
:loading='loading'
|
||||
@loadNext='fetchData'
|
||||
>
|
||||
<div class="column is-4" v-for='user in users' :key='"user-row" + user.username' v-show="user && !user.banned"><div class="card">
|
||||
<div class="column is-6" v-for='user in users' :key='"user-row" + user.username' v-show="user && !user.banned"><div class="card">
|
||||
<div class="card-content">
|
||||
<router-link :to="'/t/' + user.username"><b-button style="float:right;">View</b-button></router-link>
|
||||
<router-link :to="'/m/' + user.id"><b-button style="float:right;">View</b-button></router-link>
|
||||
<div class="media">
|
||||
<div class="media-left">
|
||||
<figure class="image is-64x64">
|
||||
<img class="team-img" v-if="user.picture !== 'default'" width="128px" height="128px" :src="user.picture">
|
||||
<p v-if="user.picture === 'default'">DEFAULT IMG</p>
|
||||
<figure class="image is-128x128">
|
||||
<img :src="'http://localhost/marketplace/avatars/' + user.previewFile + '.png'">
|
||||
</figure>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<p class="title is-4">{{user.name}}</p>
|
||||
<p class="subtitle is-6">@{{user.username}}</p>
|
||||
<p class="subtitle is-6">Created by @{{user.User.username}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -105,7 +101,7 @@ import throttle from 'lodash.throttle';
|
|||
import AjaxErrorHandler from '../../assets/js/errorHandler';
|
||||
|
||||
export default {
|
||||
name: 'AdminTeams',
|
||||
name: 'AdminMarketplace',
|
||||
components: {
|
||||
LoadingMessage,
|
||||
ScrollLoad,
|
||||
|
|
|
@ -115,6 +115,16 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="column is-6 box">
|
||||
<section v-if='$store.state.experimentsStore.marketplace' class="hero is-info">
|
||||
<div class="hero-body" style="padding: 1rem 1rem !important;">
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<p style="text-align: center;">Current limitations include only being able to put on 1 item per category at a time. So applying an item will replace the item applied if one is applied in the same category, and vice versa</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<br>
|
||||
<tab-view
|
||||
:tabs='["Hats", "Faces", "Shirts", "Pants"]'
|
||||
v-model="tab"
|
||||
|
@ -134,6 +144,7 @@
|
|||
<img v-if=" user.Item.approved" width="128px" height="128px" :src="'http://localhost/marketplace/avatars/' + user.Item.previewFile + '.png'">
|
||||
<img v-if="$store.state.theme === 'light' && !user.Item.approved" width="128px" height="128px" src="http://localhost/marketplace/pending-light.png">
|
||||
<img v-if="$store.state.theme === 'dark' && !user.Item.approved" width="128px" height="128px" src="http://localhost/marketplace/pending-dark.png">
|
||||
<img v-if="!$store.state.theme && !user.Item.approved" width="128px" height="128px" src="http://localhost/marketplace/pending-light.png">
|
||||
</div>
|
||||
<br>
|
||||
<div class="media">
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<b-button class="is-info" @click="$router.push('/thread/new')">
|
||||
{{postNewThreadText}}
|
||||
</b-button>
|
||||
<select-button v-model='selectedCategory' :options='categories'></select-button>
|
||||
</div>
|
||||
<br>
|
||||
<div class='threads_main'>
|
||||
|
@ -117,7 +118,7 @@
|
|||
import ThreadDisplay from '../ThreadDisplay'
|
||||
import ThreadDisplayPlaceholder from '../ThreadDisplayPlaceholder'
|
||||
import SelectOptions from '../SelectOptions'
|
||||
|
||||
import SelectButton from "@/components/SelectButton";
|
||||
import AjaxErrorHandler from '../../assets/js/errorHandler'
|
||||
import logger from '../../assets/js/logger'
|
||||
|
||||
|
@ -127,7 +128,8 @@
|
|||
ScrollLoad,
|
||||
ThreadDisplay,
|
||||
ThreadDisplayPlaceholder,
|
||||
SelectOptions
|
||||
SelectOptions,
|
||||
SelectButton
|
||||
},
|
||||
data () {
|
||||
return {offset: 0,
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<div class="hero-body" style="padding: 1rem 1rem !important;">
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<p style="text-align: center;">Teams are currently in development, expect missing features.</p>
|
||||
<p style="text-align: center;">The Marketplace is currently in development, expect missing features.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -66,10 +66,9 @@
|
|||
<div class="media-left">
|
||||
<figure class="image is-128x128">
|
||||
<img v-if="user.picture !== 'default' && user.approved" width="128px" height="128px" :src="'http://localhost/marketplace/avatars/' + user.previewFile + '.png'">
|
||||
<img v-if="user.picture === 'default' && $store.state.theme === 'light' && user.approved" width="128px" height="128px" src="http://localhost/teams/unknown-light.png">
|
||||
<img v-if="user.picture === 'default' && $store.state.theme === 'dark' && user.approved" width="128px" height="128px" src="http://localhost/teams/unknown-dark.png">
|
||||
<img v-if="$store.state.theme === 'light' && !user.approved" width="128px" height="128px" src="http://localhost/teams/pending-light.png">
|
||||
<img v-if="$store.state.theme === 'dark' && !user.approved" width="128px" height="128px" src="http://localhost/teams/pending-dark.png">
|
||||
<img v-if="$store.state.theme === 'light' && !user.approved" width="128px" height="128px" src="http://localhost/marketplace/pending-light.png">
|
||||
<img v-if="$store.state.theme === 'dark' && !user.approved" width="128px" height="128px" src="http://localhost/marketplace/pending-dark.png">
|
||||
<img v-if="!$store.state.theme && !user.approved" width="128px" height="128px" src="http://localhost/marketplace/pending-light.png">
|
||||
</figure>
|
||||
</div>
|
||||
<br>
|
||||
|
|
|
@ -6,11 +6,14 @@
|
|||
<div class="box">
|
||||
<div v-if="stage === 1">
|
||||
<center><h1>Hi, what asset would you like to create?</h1>
|
||||
<b-button @click="createType = 0; stage = 2" v-if="$store.state.admin" class="is-large">
|
||||
Hat
|
||||
</b-button>
|
||||
<p v-if="!$store.state.modeler">Want to upload more than just shirts and pants? Apply to become an asset creator and get access to much more.</p>
|
||||
<b-tooltip label="You may not upload hats at this time, Contact Troplo if you'd like to upload one.">
|
||||
<b-button disabled @click="createType = 0; stage = 2" v-if="$store.state.modeler" class="is-large">
|
||||
Hat
|
||||
</b-button>
|
||||
</b-tooltip>
|
||||
|
||||
<b-button @click="createType = 1; stage = 2" v-if="$store.state.admin" class="is-large">
|
||||
<b-button @click="createType = 1; stage = 2" v-if="$store.state.modeler" class="is-large">
|
||||
Face
|
||||
</b-button>
|
||||
|
||||
|
@ -37,7 +40,10 @@
|
|||
<h1 v-if="createType === 3">
|
||||
Uploading pants
|
||||
</h1>
|
||||
<b-button tag="a" :href="'https://cdn.kaverti.com/templates/' + createType + 'Template.png'">Download template</b-button><br>
|
||||
<b-button v-if="createType === 3" tag="a" :href="'https://cdn.kaverti.com/templates/pantsTemplate.png'">Download template</b-button><br>
|
||||
<b-button v-if="createType === 2" tag="a" :href="'https://cdn.kaverti.com/templates/shirtTemplate.png'">Download template</b-button><br>
|
||||
<p v-if="createType === 0">Please contact Troplo if you do not have the required assets for uploading this item type.</p>
|
||||
<p v-if="createType === 1">Please contact Troplo if you do not have the required assets for uploading this item type.</p>
|
||||
Name:
|
||||
<b-input :value="$store.state.username + '\'s ' + createType"
|
||||
v-model="item.name"
|
||||
|
@ -73,11 +79,21 @@
|
|||
<b-upload v-model="item.file" expanded>
|
||||
<a class="button is-primary is-fullwidth">
|
||||
<b-icon icon="upload"></b-icon>
|
||||
<span>{{ item.file.name || "Upload file"}}</span>
|
||||
<span>{{ item.file.name || "Upload .OBJ"}}</span>
|
||||
</a>
|
||||
</b-upload>
|
||||
</b-field>
|
||||
<b-button @click="submitItem" :loading="loading">Submit</b-button>
|
||||
<b-field class="file">
|
||||
<b-upload v-model="item.fileMtl" expanded>
|
||||
<a class="button is-primary is-fullwidth">
|
||||
<b-icon icon="upload"></b-icon>
|
||||
<span>{{ item.fileMtl.name || "Upload .MTL"}}</span>
|
||||
</a>
|
||||
</b-upload>
|
||||
</b-field>
|
||||
<b-button v-if="createType === 1" @click="submitItem" :loading="loading">Submit</b-button>
|
||||
<b-button v-if="createType === 2" @click="submitItem" :loading="loading">Submit</b-button>
|
||||
<b-button v-if="createType === 3" @click="submitItem" :loading="loading">Submit</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -98,6 +114,7 @@ export default {
|
|||
loading: false,
|
||||
item: {
|
||||
file: '',
|
||||
fileMtl: '',
|
||||
dropFiles: null,
|
||||
name: 'Item',
|
||||
limited: false,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="hero-body" style="padding: 1rem 1rem !important;">
|
||||
<div class="mobile-container">
|
||||
<div class="container">
|
||||
<p style="text-align: center;">Teams are currently in development, expect missing features.</p>
|
||||
<p style="text-align: center;">The Marketplace is currently in development, expect missing features.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -24,10 +24,9 @@
|
|||
<div class="column is-3">
|
||||
<figure class="image is-512 is-centered">
|
||||
<img v-if="user.picture !== 'default' && user.approved" width="128px" height="128px" :src="'http://localhost/marketplace/avatars/' + user.previewFile + '.png'">
|
||||
<img v-if="user.picture === 'default' && $store.state.theme === 'light' && user.approved" width="512px" height="512px" src="http://localhost/teams/unknown-light.png">
|
||||
<img v-if="user.picture === 'default' && $store.state.theme === 'dark' && user.approved" width="512px" height="512px" src="http://localhost/teams/unknown-dark.png">
|
||||
<img v-if="$store.state.theme === 'light' && !user.approved" width="512px" height="512px" src="http://localhost/teams/pending-light.png">
|
||||
<img v-if="$store.state.theme === 'dark' && !user.approved" width="512px" height="512px" src="http://localhost/user/avatars/full/default.png">
|
||||
<img v-if="$store.state.theme === 'light' && !user.approved" width="128px" height="128px" src="http://localhost/marketplace/pending-light.png">
|
||||
<img v-if="$store.state.theme === 'dark' && !user.approved" width="128px" height="128px" src="http://localhost/marketplace/pending-dark.png">
|
||||
<img v-if="!$store.state.theme && !user.approved" width="128px" height="128px" src="http://localhost/marketplace/pending-light.png">
|
||||
</figure>
|
||||
</div>
|
||||
<div class="column is-7">
|
||||
|
@ -41,10 +40,17 @@
|
|||
<br>
|
||||
Asset uploaded at {{user.createdAt | formatDate}}
|
||||
</p>
|
||||
<b-button class="is-danger" @click="remove()" v-if="$store.state.admin">
|
||||
Remove Item
|
||||
</b-button>
|
||||
<b-button @click="reRender()" v-if="$store.state.admin">
|
||||
Re-Render Preview
|
||||
</b-button>
|
||||
</div>
|
||||
<div class="column" style="float: right">
|
||||
<p v-if="!user.saleEnabled" style="float: right;">This item costs <b>{{user.price}} Koins</b></p>
|
||||
<p v-if="user.saleEnabled" style="float: right;">This item costs <b class="onsale">{{user.price}}</b><b> {{user.salePrice}} Koins</b></p><br>
|
||||
<p v-if="user.saleEnabled && !user.salePrice" style="float: right;">This item is on sale and is free</p><br>
|
||||
<b-button @click="buyItem()" v-if="!purchased && !loading && !failStatus" style="float: right;">Buy item</b-button>
|
||||
<b-button disabled v-if="loading && !failStatus" style="float: right;">Loading purchase status</b-button>
|
||||
<b-button disabled v-if="purchased && !loading && !failStatus" style="float: right;">Item Owned</b-button>
|
||||
|
@ -126,6 +132,31 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
remove() {
|
||||
this.axios
|
||||
.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'admin/marketplace/approve', {
|
||||
id: this.user.id,
|
||||
approve: false,
|
||||
delete: true
|
||||
})
|
||||
.then(() => {
|
||||
this.resetFetchData()
|
||||
})
|
||||
.catch(e => {
|
||||
AjaxErrorHandler(this.$store)(e, error => {
|
||||
this.description.error = error.message
|
||||
})
|
||||
})
|
||||
},
|
||||
reRender () {
|
||||
this.axios.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'marketplace/rerender/' + this.user.id)
|
||||
.then(() => {
|
||||
this.resetFetchData()
|
||||
})
|
||||
.catch((e) => {
|
||||
AjaxErrorHandler(this.$store)(e)
|
||||
})
|
||||
},
|
||||
buyItem () {
|
||||
this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'marketplace/purchase/' + this.user.id)
|
||||
.then(() => {
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
<p name='fade' mode='out-in'>
|
||||
<center><loading-message key='loading' v-if='loading'></loading-message></center>
|
||||
<center><div class='overlay_message' v-if='!loading && !users.length'>
|
||||
Something went wrong while loading the Transaction Log, check your internet connection, or check the <a href="https://status.troplo.com">Service Status</a>
|
||||
Something went wrong while loading the invites, check your internet connection, or check the <a href="https://status.troplo.com">Service Status</a>
|
||||
</div></center></p>
|
||||
</main>
|
||||
</template>
|
||||
|
|
|
@ -17,6 +17,22 @@
|
|||
</style>
|
||||
<template>
|
||||
<main>
|
||||
<modal-window v-model='modifyModal' :loading='loading' style='z-index: 99; '>
|
||||
<div slot="header">
|
||||
Modify {{modifyUser.username}} <b-tooltip v-if='modifyUser' class="is-info" label="This page allows you to modify users badges that appear on user profiles, user list, and various other pages. Abusing this feature will leave you demoted.">
|
||||
<b-tag class="is-info" rounded><i class="fas fa-info-circle"></i></b-tag>
|
||||
</b-tooltip>
|
||||
</div>
|
||||
<div slot='main' class="card-content">
|
||||
<br>
|
||||
<div>
|
||||
<p>User Profile Badges:</p>
|
||||
</div>
|
||||
</div>
|
||||
<div slot='footer'>
|
||||
<button class='button is-info' @click='modifyUser(user)'>Save</button>
|
||||
</div>
|
||||
</modal-window>
|
||||
<div class="section">
|
||||
<div class="">
|
||||
<h1>Members:</h1>
|
||||
|
@ -60,6 +76,7 @@
|
|||
<script>
|
||||
import LoadingMessage from '../LoadingMessage';
|
||||
import ScrollLoad from '../ScrollLoad';
|
||||
import ModalWindow from "@/components/ModalWindow";
|
||||
import throttle from 'lodash.throttle';
|
||||
import AjaxErrorHandler from '../../assets/js/errorHandler';
|
||||
import AvatarIcon from '../AvatarIcon';
|
||||
|
@ -69,7 +86,8 @@ export default {
|
|||
components: {
|
||||
LoadingMessage,
|
||||
ScrollLoad,
|
||||
AvatarIcon
|
||||
AvatarIcon,
|
||||
ModalWindow
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
@ -78,6 +96,21 @@ export default {
|
|||
userRoles: [],
|
||||
roles: [],
|
||||
team: [],
|
||||
modifyModal: false,
|
||||
modifyUser: {
|
||||
id: '',
|
||||
username: '',
|
||||
RoleId: '',
|
||||
Role2Id: '',
|
||||
Role3Id: '',
|
||||
Role4Id: '',
|
||||
Role5Id: '',
|
||||
Role6Id: '',
|
||||
Role7Id: '',
|
||||
Role8Id: '',
|
||||
Role9Id: '',
|
||||
Role10Id: ''
|
||||
},
|
||||
|
||||
loading: true,
|
||||
offset: 0,
|
||||
|
@ -109,6 +142,10 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
showModifyModal (user) {
|
||||
this.modifyModal = true
|
||||
this.modifyUser = user
|
||||
},
|
||||
clearTeamErrors() {
|
||||
this.tcreateProd.errors.username = ''
|
||||
this.tcreateProd.errors.name = ''
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div slot='footer'>
|
||||
<button class='button is-info' :loading="role.loading" @click='updateRole(role)'>Add Role</button>
|
||||
<button class='button is-info' :loading="role.loading" @click='updateRole(role)'>Modify Role</button>
|
||||
</div>
|
||||
</modal-window>
|
||||
<modal-window v-model='showRoleModal' :loading='loading' style='z-index: 99; '>
|
||||
|
@ -108,6 +108,8 @@
|
|||
</section>
|
||||
<h1>Roles:</h1>
|
||||
<ul class="list-group mb-2">
|
||||
<b-button @click="fixRoles">Fix role order</b-button>
|
||||
<br><br>
|
||||
<draggable
|
||||
class="list-group"
|
||||
tag="ul"
|
||||
|
@ -188,6 +190,7 @@ export default {
|
|||
createTeamModal: false,
|
||||
drag: false,
|
||||
showRoleModifyModal: false,
|
||||
sorting: -1,
|
||||
tRole: {
|
||||
name: '',
|
||||
id: '',
|
||||
|
@ -237,26 +240,28 @@ export default {
|
|||
this.role.submitTeamItems = role.submitTeamItems
|
||||
this.showRoleModifyModal = true
|
||||
},
|
||||
fixRoles() {
|
||||
this.updateListSortOrder()
|
||||
},
|
||||
saveRoles() {
|
||||
this.updateListSortOrder()
|
||||
Promise.all(
|
||||
this.roles.map(async () => {
|
||||
const response = await this.axios.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `teams/admin/roles/modify/` + this.$route.params.username, {
|
||||
role: role
|
||||
this.roles.map(async (role) => {
|
||||
const response = await this.axios.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `teams/admin/roles/modify/` + this.$route.params.username + '/' + role.id, {
|
||||
name: role.name,
|
||||
|
||||
administrator: role.administrator,
|
||||
inviteUsers: role.inviteUsers,
|
||||
changeTeamMeta: role.changeTeamMeta,
|
||||
forumAdministrator: role.forumAdministrator,
|
||||
moderateForumThreads: role.moderateForumThreads,
|
||||
submitTeamItems: role.submitTeamItems,
|
||||
priority: role.priority
|
||||
})
|
||||
const todo = await response.json()
|
||||
console.log(todo.title)
|
||||
})
|
||||
)
|
||||
this.axios.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `teams/admin/roles/modify/` + this.$route.params.username, {
|
||||
roles: this.roles
|
||||
}).then(() => {
|
||||
this.tRole.loading = false
|
||||
this.closeAccountModal()
|
||||
}).catch(e => {
|
||||
this.tRole.loading = false
|
||||
AjaxErrorHandler(this.$store)(e)
|
||||
})
|
||||
},
|
||||
updateRole(role) {
|
||||
this.role.loading = true
|
||||
|
@ -342,6 +347,7 @@ export default {
|
|||
AjaxErrorHandler(this.$store)(e);
|
||||
this.loading = /*loading =*/ false;
|
||||
});
|
||||
this.roles = this.sortedItems()
|
||||
this.axios
|
||||
.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + `/` + `teams/view/${this.$route.params.username}`)
|
||||
.then(res => this.team = res.data)
|
||||
|
@ -384,10 +390,13 @@ export default {
|
|||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
sortedItems () {
|
||||
return this.roles.slice(0).sort((a, b) => a.priority < b.priority ? this.sorting : -this.sorting )
|
||||
},
|
||||
dragOptions() {
|
||||
return {
|
||||
animation: 200,
|
||||
group: "description",
|
||||
group: "priority",
|
||||
disabled: false,
|
||||
ghostClass: "ghost"
|
||||
};
|
||||
|
|
|
@ -17,6 +17,31 @@
|
|||
</style>
|
||||
<template>
|
||||
<main>
|
||||
<modal-window v-model='modifyModal' :loading='loading' style='z-index: 99; '>
|
||||
<div slot="header">
|
||||
Modify {{rolePrepend.username}} <b-tooltip v-if='modifyModal' class="is-info" label="This page allows you to modify user roles and permissions that a user has on your Team.">
|
||||
<b-tag class="is-info" rounded><i class="fas fa-info-circle"></i></b-tag>
|
||||
</b-tooltip>
|
||||
</div>
|
||||
<div slot='main' class="card-content">
|
||||
<br>
|
||||
<div>
|
||||
<p>User Profile Badges:</p>
|
||||
<b-dropdown v-model="rolePrepend.RoleId"
|
||||
v-for="role in roles"
|
||||
:key="role.id"
|
||||
:value="role.id"
|
||||
:native-value="role.id">
|
||||
<b-dropdown-item :value='role.id'>
|
||||
<span>{{role.name}}</span>
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<div slot='footer'>
|
||||
<button class='button is-info' @click='modifyUser(user)'>Save</button>
|
||||
</div>
|
||||
</modal-window>
|
||||
<div class="section">
|
||||
<div class="">
|
||||
<h1>Members:</h1>
|
||||
|
@ -44,7 +69,7 @@
|
|||
<div class="content limit">
|
||||
{{user.User.description}}
|
||||
</div>
|
||||
<b-button @click="updateRoles(user)">Assign and remove roles</b-button>
|
||||
<b-button @click="showModifyModal(user)">Assign and remove roles</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -61,6 +86,8 @@
|
|||
<script>
|
||||
import LoadingMessage from '../LoadingMessage';
|
||||
import ScrollLoad from '../ScrollLoad';
|
||||
import ModalWindow from "@/components/ModalWindow";
|
||||
import SelectButton from "@/components/SelectButton";
|
||||
import throttle from 'lodash.throttle';
|
||||
import AjaxErrorHandler from '../../assets/js/errorHandler';
|
||||
import AvatarIcon from '../AvatarIcon';
|
||||
|
@ -70,7 +97,10 @@ export default {
|
|||
components: {
|
||||
LoadingMessage,
|
||||
ScrollLoad,
|
||||
AvatarIcon
|
||||
AvatarIcon,
|
||||
ModalWindow,
|
||||
// eslint-disable-next-line vue/no-unused-components
|
||||
SelectButton
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
@ -81,7 +111,7 @@ export default {
|
|||
team: [],
|
||||
rolePrepend: {
|
||||
username: '',
|
||||
Role1Id: '',
|
||||
RoleId: '',
|
||||
Role2Id: '',
|
||||
Role3Id: '',
|
||||
Role4Id: '',
|
||||
|
@ -92,6 +122,7 @@ export default {
|
|||
Role9Id: '',
|
||||
Role10Id: ''
|
||||
},
|
||||
modifyModal: false,
|
||||
|
||||
loading: true,
|
||||
offset: 0,
|
||||
|
@ -123,6 +154,10 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
showModifyModal (user) {
|
||||
this.modifyModal = true
|
||||
this.rolePrepend = user
|
||||
},
|
||||
clearTeamErrors() {
|
||||
this.tcreateProd.errors.username = ''
|
||||
this.tcreateProd.errors.name = ''
|
||||
|
|
|
@ -46,10 +46,12 @@
|
|||
v-if='$store.state.admin'
|
||||
:options='[
|
||||
{ event: "scrub_username", value: "Scrub Username" },
|
||||
{ event: "scrub_desc", value: "Scrub Description" }
|
||||
{ event: "scrub_desc", value: "Scrub Description" },
|
||||
{ event: "refresh_avatar", value: "Refresh Avatar" }
|
||||
]'
|
||||
@scrub_desc='scrubDesc'
|
||||
@scrub_username='scrubUsername'
|
||||
@refresh_avatar="refreshAvatar"
|
||||
>
|
||||
<button class='button button--thin_text'>
|
||||
<font-awesome-icon :icon='["fa", "cog"]' style='margin-right: 0.25rem;' />
|
||||
|
@ -185,6 +187,16 @@
|
|||
})
|
||||
.catch(AjaxErrorHandler(this.$store))
|
||||
},
|
||||
refreshAvatar () {
|
||||
this.axios
|
||||
.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'admin/user/avatar', {
|
||||
user: this.username
|
||||
})
|
||||
.then(() => {
|
||||
this.resetFetchData()
|
||||
})
|
||||
.catch(AjaxErrorHandler(this.$store))
|
||||
},
|
||||
scrubUsername () {
|
||||
this.axios
|
||||
.put(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'admin/user/scrub', {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<main>
|
||||
<div class="section">
|
||||
<div class="">
|
||||
<h1>Friends:</h1>
|
||||
<h1>{{$route.params.username}}'s Friends:</h1>
|
||||
<scroll-load
|
||||
key='user-row'
|
||||
class='columns is-multiline'
|
||||
|
@ -46,7 +46,7 @@
|
|||
<p name='fade' mode='out-in'>
|
||||
<center><loading-message key='loading' v-if='loading'></loading-message></center>
|
||||
<center><div class='overlay_message' v-if='!loading && !users.length'>
|
||||
This user doesn't have any friends yet :(
|
||||
This user doesn't have any friends yet, friend them to make them feel better.
|
||||
</div></center></p>
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<template>
|
||||
<main>
|
||||
<div class="section">
|
||||
<h1>{{$route.params.username}}'s Inventory:</h1>
|
||||
<div class="">
|
||||
<scroll-load
|
||||
key='user-row'
|
||||
|
|
|
@ -45,6 +45,7 @@ export default new Vuex.Store({
|
|||
settingsModal: true,
|
||||
username: '',
|
||||
admin: false,
|
||||
modeler: false,
|
||||
koins: '',
|
||||
email: '',
|
||||
emailVerified: true,
|
||||
|
@ -116,6 +117,9 @@ export default new Vuex.Store({
|
|||
setToken(state, token) {
|
||||
state.token = token
|
||||
},
|
||||
setModeler(state, modeler) {
|
||||
state.modeler = modeler
|
||||
},
|
||||
setSessionToken(state, sessToken) {
|
||||
state.sessToken = sessToken
|
||||
},
|
||||
|
|
|
@ -19,6 +19,10 @@ let Errors = {
|
|||
'This team is banned and cannot be interacted with or viewed.',
|
||||
400
|
||||
],
|
||||
friendSelf: [
|
||||
'You\'re really that lonely that you manually make an API request to pretend that you\'re friends with someone? (You can\'t friend yourself)',
|
||||
400
|
||||
],
|
||||
notInTeam: [
|
||||
'You need to be in this Team to do that action.',
|
||||
400
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
module.exports = {
|
||||
up(queryInterface, Sequelize) {
|
||||
return Promise.all([
|
||||
queryInterface.addColumn(
|
||||
'Users',
|
||||
'modeler',
|
||||
{
|
||||
type: Sequelize.BOOLEAN,
|
||||
defaultValue: false,
|
||||
default: false
|
||||
},
|
||||
)
|
||||
]);
|
||||
},
|
||||
}
|
|
@ -9,15 +9,12 @@ module.exports = (sequelize, DataTypes) => {
|
|||
let Item = sequelize.define('Item', {
|
||||
name: {
|
||||
type: DataTypes.STRING(191),
|
||||
defaultValue: 'Item',
|
||||
allowNull: false,
|
||||
validate: {
|
||||
len: {
|
||||
args: [3, 30],
|
||||
msg: 'Item name must be between 3 and 30 characters'
|
||||
},
|
||||
isString(val) {
|
||||
if (typeof val !== 'string') {
|
||||
throw new sequelize.ValidationError('Item name must be a string')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -88,6 +85,7 @@ module.exports = (sequelize, DataTypes) => {
|
|||
},
|
||||
price: {
|
||||
type: DataTypes.BIGINT,
|
||||
allowNull: false,
|
||||
validate: {
|
||||
isNumeric: {
|
||||
args: true,
|
||||
|
|
|
@ -295,6 +295,11 @@ module.exports = (sequelize, DataTypes) => {
|
|||
type: DataTypes.BIGINT,
|
||||
defaultValue: 0
|
||||
},
|
||||
modeler: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
defaultValue: false,
|
||||
default: false
|
||||
},
|
||||
picture: {
|
||||
type: DataTypes.TEXT('long'),
|
||||
validate: {
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,57 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
hat_import = bpy.ops.import_scene.obj(filepath='C:/Users/matth/Documents/GitHub/website/rendering/global/5873ada4b44681127842826981ff3d97.obj')
|
||||
hat = bpy.context.selected_objects[0]
|
||||
bpy.context.selected_objects[0].data.name = 'hat'
|
||||
bpy.context.selected_objects[0].name = 'hat'
|
||||
hat_material = bpy.data.materials.new('hat')
|
||||
hat_material.diffuse_shader = 'LAMBERT'
|
||||
hat.active_material = hat_material
|
||||
hat_image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/5873ada4b44681127842826981ff3d97.png')
|
||||
hat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')
|
||||
hat_texture.image = hat_image
|
||||
hat_add = bpy.data.objects['hat'].active_material.texture_slots.add()
|
||||
hat_add.texture = hat_texture
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/54e276b19ecc370a386919cc86a0e530.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,57 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
hat_import = bpy.ops.import_scene.obj(filepath='C:/Users/matth/Documents/GitHub/website/rendering/global/2f18ef93999807c8136a26ef4632a8e3.obj')
|
||||
hat = bpy.context.selected_objects[0]
|
||||
bpy.context.selected_objects[0].data.name = 'hat'
|
||||
bpy.context.selected_objects[0].name = 'hat'
|
||||
hat_material = bpy.data.materials.new('hat')
|
||||
hat_material.diffuse_shader = 'LAMBERT'
|
||||
hat.active_material = hat_material
|
||||
hat_image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/2f18ef93999807c8136a26ef4632a8e3.png')
|
||||
hat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')
|
||||
hat_texture.image = hat_image
|
||||
hat_add = bpy.data.objects['hat'].active_material.texture_slots.add()
|
||||
hat_add.texture = hat_texture
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/ad3dbf0e423c6d4451b7145d05b48e45.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -14,22 +14,22 @@ def hex_to_rgb(value):
|
|||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#DDE6E8')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#DDE6E8')
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#A463BF')
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#fc6f90')
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#e8aef2')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#F39C19')
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#3D556E')
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#C0382B')
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/91b08cbaa4f12e959991779385b81125.png')
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
|
@ -42,5 +42,5 @@ for obj in bpy.data.objects:
|
|||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/user/avatars/full/e3e5ea925f74dc27e63243285ecb4590.png'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/user/avatars/full/f298df5724319ff709e18f3c1dd99062.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#4ae275')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/user/avatars/full/581d2821bf3ec77d3f4214ef7a7d8387.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/364d899cf1e6d17b3d99104c96951ed1.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/595177e2b79dfb12dd5ef26bb6f26647.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/fdd4f5c66b7d955aa5831f4be1b5ad57.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/beae8e42e8be13e6d2988b23548f2e38.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/1c4fffaf0ae8cabba7b77ae808d52f7d.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/d32e56187f2baf3fb9bb677a52265bb9.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/a4162f0e4f4d16da250cde836b526dcd.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/15b15617fbf8320728072717eec2c964.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,46 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatar.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/a4162f0e4f4d16da250cde836b526dcd.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
for obj in bpy.data.objects:
|
||||
obj.select = False
|
||||
bpy.ops.object.select_all(action='SELECT')
|
||||
bpy.ops.view3d.camera_to_view_selected()
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/marketplace/avatars/b4c949af9870209858834f0804ad8f8e.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,42 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatarhs.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#e8aef2')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/user/avatars/headshot/f298df5724319ff709e18f3c1dd99062.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
|
@ -0,0 +1,42 @@
|
|||
import bpy
|
||||
def hex_to_rgb(value):
|
||||
gamma = 2.05
|
||||
value = value.lstrip('#')
|
||||
lv = len(value)
|
||||
fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
|
||||
r = pow(fin[0] / 255, gamma)
|
||||
g = pow(fin[1] / 255, gamma)
|
||||
b = pow(fin[2] / 255, gamma)
|
||||
fin.clear()
|
||||
fin.append(r)
|
||||
fin.append(g)
|
||||
fin.append(b)
|
||||
return tuple(fin)
|
||||
bpy.ops.wm.open_mainfile(filepath='C:/Users/matth/Documents/GitHub/website/rendering/avatarhs.blend')
|
||||
bpy.data.objects['Head'].select = True
|
||||
bpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Arm'].select = True
|
||||
bpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Torso'].select = True
|
||||
bpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#4ae275')
|
||||
bpy.data.objects['Right Arm'].select = True
|
||||
bpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Left Leg'].select = True
|
||||
bpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
bpy.data.objects['Right Leg'].select = True
|
||||
bpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')
|
||||
|
||||
face_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/defaultFace.png')
|
||||
bpy.data.textures['Face'].image = face_Image
|
||||
shirt_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['Shirt'].image = shirt_Image
|
||||
bpy.data.textures['ShirtR'].image = shirt_Image
|
||||
bpy.data.textures['ShirtL'].image = shirt_Image
|
||||
pants_Image = bpy.data.images.load(filepath = 'C:/Users/matth/Documents/GitHub/website/rendering/global/0.png')
|
||||
bpy.data.textures['PantsR'].image = pants_Image
|
||||
bpy.data.textures['PantsL'].image = pants_Image
|
||||
scene = bpy.context.scene
|
||||
scene.render.image_settings.file_format = 'PNG'
|
||||
scene.render.filepath = 'C:/xampp21/htdocs/user/avatars/headshot/581d2821bf3ec77d3f4214ef7a7d8387.png'
|
||||
bpy.ops.render.render(write_still = 1)
|
139
routes/admin.js
139
routes/admin.js
|
@ -12,7 +12,14 @@ let {
|
|||
User, AuditLog, Team, Item, Post, ProfilePicture, StaffApplications, AdminToken, PassKey, Thread, Category, Sequelize, Ip, Ban, sequelize
|
||||
} = require('../models')
|
||||
let pagination = require('../lib/pagination.js')
|
||||
|
||||
var fs = require("fs");
|
||||
const rateLimit = require("express-rate-limit");
|
||||
const cryptoRandomString = require("crypto-random-string")
|
||||
const limiter = rateLimit({
|
||||
windowMs: 60 * 1000,
|
||||
max: 3,
|
||||
message: "{\"errors\":[{\"name\":\"rateLimit\",\"message\":\"You may only make 3 requests to this endpoint per minute, if you performed an action such as avatar color changing, those changes were saved, however your avatar was not re-rendered, please re-render your avatar.\",\"status\":429}]}"
|
||||
});
|
||||
router.all('*', auth, async(req, res, next) => {
|
||||
let user = await User.findOne({ where: {
|
||||
username: req.userData.username
|
||||
|
@ -140,7 +147,7 @@ router.get('/privileges', auth, async(req, res, next) => {
|
|||
try {
|
||||
let queryObj = {
|
||||
attributes: {include: ['username', 'admin', 'executive'], exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode', 'cookieOptOut', 'deleteCode', 'jwtOffset', 'description', 'theme', 'contributor', 'passwordResetOptOut', 'picture', 'createdAt', 'updatedAt', 'id']},
|
||||
where: {username: req.userData.username}
|
||||
where: {username: req.userData.username},
|
||||
}
|
||||
let user = await User.findOne(queryObj)
|
||||
res.json(user)
|
||||
|
@ -188,7 +195,7 @@ router.get('/marketplace/pending', auth, async(req, res, next) => {
|
|||
try {
|
||||
await Ban.isIpBanned(req.ip)
|
||||
|
||||
let item = await Item.findAll({where: {approved: false, deleted: false}})
|
||||
let item = await Item.findAll({where: {approved: false, deleted: false}, include: { model: User, attributes: ['username', 'createdAt', 'id', 'color', 'picture', 'locked', 'admin', 'booster', 'executive', 'bot'] }})
|
||||
if(!item) {
|
||||
res.status(200)
|
||||
res.json({success: false})
|
||||
|
@ -212,7 +219,7 @@ router.put('/marketplace/approve', auth, async(req, res, next) => {
|
|||
res.json({success: true})
|
||||
} else if(req.body.delete && !req.body.approve) {
|
||||
AuditLog.create({UserId: req.userData.UserId, action: req.userData.username + ' removed the Marketplace Item MID: ' + req.body.id + ' and succeeded (removed marketplace item).'})
|
||||
await item.update({deleted: true});
|
||||
await item.update({deleted: true, approved: false});
|
||||
res.status(200)
|
||||
res.json({success: true})
|
||||
} else {
|
||||
|
@ -233,4 +240,128 @@ router.get('/logs', auth, async(req, res, next) => {
|
|||
res.json(logs)
|
||||
} catch (e) { next(e) }
|
||||
})
|
||||
|
||||
router.put("/user/avatar", limiter, auth, async(req, res, next) => {
|
||||
let userCheck = await User.findOne({ where: {
|
||||
username: req.userData.username
|
||||
}
|
||||
})
|
||||
if(!userCheck.admin) {
|
||||
throw Errors.requestNotAuthorized
|
||||
}
|
||||
if(!req.userData.admin) {
|
||||
throw Errors.requestNotAuthorized
|
||||
}
|
||||
let user = await User.findOne({ where: {
|
||||
username: req.body.user
|
||||
}
|
||||
})
|
||||
if(!user) {
|
||||
throw Errors.unknown
|
||||
}
|
||||
const { exec } = require('child_process');
|
||||
if(user.pantsId) {
|
||||
var pantsModel = await Item.findOne({
|
||||
where: {
|
||||
id: user.pantsId
|
||||
}
|
||||
})
|
||||
}
|
||||
if(user.hatId) {
|
||||
var hatModel = await Item.findOne({
|
||||
where: {
|
||||
id: user.hatId
|
||||
}
|
||||
})
|
||||
}
|
||||
if(user.faceId) {
|
||||
var faceModel = await Item.findOne({
|
||||
where: {
|
||||
id: user.faceId
|
||||
}
|
||||
})
|
||||
}
|
||||
if(user.shirtId) {
|
||||
var shirtModel = await Item.findOne({
|
||||
where: {
|
||||
id: user.shirtId
|
||||
}
|
||||
})
|
||||
}
|
||||
let rootPathRender = "C:/Users/matth/Documents/GitHub/website/";
|
||||
let img2 = cryptoRandomString({length: 32})
|
||||
let img = img2
|
||||
var blendFilePath = rootPathRender + "rendering/avatar.blend";
|
||||
var blendFilePathHs = rootPathRender + "rendering/avatarhs.blend";
|
||||
var imageSavePath = "C:/xampp21/htdocs/user/avatars/full/" + img + ".png";
|
||||
var imageSavePathHS = "C:/xampp21/htdocs/user/avatars/headshot/" + img + ".png";
|
||||
var pythonFilePath = "rendering/usercontent/"+req.userData.UserId+".py";
|
||||
if(user.faceId) {
|
||||
var faceFilePath = rootPathRender + "rendering/global/" + faceModel.sourceFile + ".png";
|
||||
} else {
|
||||
var faceFilePath = rootPathRender + "rendering/global/defaultFace.png";
|
||||
}
|
||||
if(user.shirtId) {
|
||||
var shirtFilePath = rootPathRender + "rendering/global/" + shirtModel.sourceFile + ".png"; // should be set to 0 by default, 0.png will just be a transparent image
|
||||
} else {
|
||||
var shirtFilePath = rootPathRender + "rendering/global/0.png"; // should be set to 0 by default, 0.png will just be a transparent image
|
||||
}
|
||||
if(user.pantsId) {
|
||||
var pantsFilePath = rootPathRender + "rendering/global/" + pantsModel.sourceFile + ".png"; // should be set to 0 by default, 0.png will just be a transparent image
|
||||
} else {
|
||||
var pantsFilePath = rootPathRender + "rendering/global/0.png"; // should be set to 0 by default, 0.png will just be a transparent image
|
||||
}
|
||||
if(user.hatId) {
|
||||
var hatFilePath = rootPathRender + "rendering/global/" + hatModel.sourceFile + ".obj"
|
||||
var hat = "hat_import = bpy.ops.import_scene.obj(filepath='"+hatFilePath+"')\nhat = bpy.context.selected_objects[0]\nbpy.context.selected_objects[0].data.name = 'hat'\nbpy.context.selected_objects[0].name = 'hat'\nhat_material = bpy.data.materials.new('hat')\nhat_material.diffuse_shader = 'LAMBERT'\nhat.active_material = hat_material\nhat_image = bpy.data.images.load(filepath = '" + rootPathRender + "rendering/global/"+hatModel.sourceFile+".png')\nhat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')\nhat_texture.image = hat_image\nhat_add = bpy.data.objects['hat'].active_material.texture_slots.add()\nhat_add.texture = hat_texture";
|
||||
} else {
|
||||
var hat = ''
|
||||
}
|
||||
|
||||
var imports = "import bpy";
|
||||
var functions = "def hex_to_rgb(value):\n gamma = 2.05\n value = value.lstrip('#')\n lv = len(value)\n fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))\n r = pow(fin[0] / 255, gamma)\n g = pow(fin[1] / 255, gamma)\n b = pow(fin[2] / 255, gamma)\n fin.clear()\n fin.append(r)\n fin.append(g)\n fin.append(b)\n return tuple(fin)";
|
||||
var blenderImport = "bpy.ops.wm.open_mainfile(filepath='"+blendFilePath+"')";
|
||||
var blenderImportHs = "bpy.ops.wm.open_mainfile(filepath='"+blendFilePathHs+"')";
|
||||
var headColor = "bpy.data.objects['Head'].select = True\nbpy.data.materials['Head'].diffuse_color = hex_to_rgb('"+user.headColor+"')\nbpy.data.materials['Face'].diffuse_color = hex_to_rgb('"+user.headColor+"')";
|
||||
var leftArmColor = "bpy.data.objects['Left Arm'].select = True\nbpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('"+user.leftArmColor+"')";
|
||||
var rightArmColor = "bpy.data.objects['Right Arm'].select = True\nbpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('"+user.rightArmColor+"')";
|
||||
var bodyColor = "bpy.data.objects['Torso'].select = True\nbpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('"+user.color+"')";
|
||||
var leftLegColor = "bpy.data.objects['Left Leg'].select = True\nbpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('"+user.leftLegColor+"')";
|
||||
var rightLegColor = "bpy.data.objects['Right Leg'].select = True\nbpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('"+user.rightLegColor+"')";
|
||||
var colors = headColor+"\n"+leftArmColor+"\n"+bodyColor+"\n"+rightArmColor+"\n"+leftLegColor+"\n"+rightLegColor;
|
||||
|
||||
if(user.hatId) {
|
||||
var hat = "hat_import = bpy.ops.import_scene.obj(filepath='"+hatFilePath+"')\nhat = bpy.context.selected_objects[0]\nbpy.context.selected_objects[0].data.name = 'hat'\nbpy.context.selected_objects[0].name = 'hat'\nhat_material = bpy.data.materials.new('hat')\nhat_material.diffuse_shader = 'LAMBERT'\nhat.active_material = hat_material\nhat_image = bpy.data.images.load(filepath = '" + rootPathRender + "rendering/global/"+hatModel.sourceFile+".png')\nhat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')\nhat_texture.image = hat_image\nhat_add = bpy.data.objects['hat'].active_material.texture_slots.add()\nhat_add.texture = hat_texture";
|
||||
} else {
|
||||
var hat = ''
|
||||
}
|
||||
var face = "face_Image = bpy.data.images.load(filepath = '"+faceFilePath+"')\nbpy.data.textures['Face'].image = face_Image";
|
||||
var shirt = "shirt_Image = bpy.data.images.load(filepath = '"+shirtFilePath+"')\nbpy.data.textures['Shirt'].image = shirt_Image\nbpy.data.textures['ShirtR'].image = shirt_Image\nbpy.data.textures['ShirtL'].image = shirt_Image";
|
||||
var pants = "pants_Image = bpy.data.images.load(filepath = '"+pantsFilePath+"')\nbpy.data.textures['PantsR'].image = pants_Image\nbpy.data.textures['PantsL'].image = pants_Image";
|
||||
var render = "for obj in bpy.data.objects:\n obj.select = False\n bpy.ops.object.select_all(action='SELECT')\nbpy.ops.view3d.camera_to_view_selected()\nscene = bpy.context.scene\nscene.render.image_settings.file_format = 'PNG'\nscene.render.filepath = '"+imageSavePath+"'\nbpy.ops.render.render(write_still = 1)";
|
||||
var renderHS = "scene = bpy.context.scene\nscene.render.image_settings.file_format = 'PNG'\nscene.render.filepath = '"+imageSavePathHS+"'\nbpy.ops.render.render(write_still = 1)";
|
||||
var python = imports+"\n"+functions+"\n"+blenderImport+"\n"+colors+"\n"+hat+"\n"+face+"\n"+shirt+"\n"+pants+"\n"+render;
|
||||
var pythonHS = imports+"\n"+functions+"\n"+blenderImportHs+"\n"+colors+"\n"+hat+"\n"+face+"\n"+shirt+"\n"+pants+"\n"+renderHS;
|
||||
fs.writeFile("rendering/usercontent/"+req.userData.UserId+".py", python, function(err,data){
|
||||
if(err) { console.log(err) }
|
||||
})
|
||||
fs.writeFile("rendering/usercontent/hs/"+req.userData.UserId+".py", pythonHS, function(err,data){
|
||||
if(err) { console.log(err) }
|
||||
})
|
||||
|
||||
exec("blender -b -P rendering/usercontent/"+req.userData.UserId+".py", (err, stdout, stderr) => {
|
||||
if(err) { console.log(err) }
|
||||
console.log("stdout: " + stdout);
|
||||
console.log("stderr: " + stderr);
|
||||
});
|
||||
exec("blender -b -P rendering/usercontent/hs/"+req.userData.UserId+".py", (err, stdout, stderr) => {
|
||||
if(err) { console.log(err) }
|
||||
console.log("stdout: " + stdout);
|
||||
console.log("stderr: " + stderr);
|
||||
res.status(200)
|
||||
res.json({success: true})
|
||||
});
|
||||
user.update({picture: img})
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
@ -54,7 +54,9 @@ router.post("/refresh", limiter, auth, async(req, res, next) => {
|
|||
let img2 = cryptoRandomString({length: 32})
|
||||
let img = img2
|
||||
var blendFilePath = rootPathRender + "rendering/avatar.blend";
|
||||
var blendFilePathHs = rootPathRender + "rendering/avatarhs.blend";
|
||||
var imageSavePath = "C:/xampp21/htdocs/user/avatars/full/" + img + ".png";
|
||||
var imageSavePathHS = "C:/xampp21/htdocs/user/avatars/headshot/" + img + ".png";
|
||||
var pythonFilePath = "rendering/usercontent/"+req.userData.UserId+".py";
|
||||
if(user.faceId) {
|
||||
var faceFilePath = rootPathRender + "rendering/global/" + faceModel.sourceFile + ".png";
|
||||
|
@ -72,8 +74,8 @@ router.post("/refresh", limiter, auth, async(req, res, next) => {
|
|||
var pantsFilePath = rootPathRender + "rendering/global/0.png"; // should be set to 0 by default, 0.png will just be a transparent image
|
||||
}
|
||||
if(user.hatId) {
|
||||
var hatFilePath = rootPathRender + "rendering/hats/" + hatModel.sourceFile + ".obj"
|
||||
var hat = "hat_import = bpy.ops.import_scene.obj(filepath='"+hatFilePath+"')\nhat = bpy.context.selected_objects[0]\nbpy.context.selected_objects[0].data.name = 'hat'\nbpy.context.selected_objects[0].name = 'hat'\nhat_material = bpy.data.materials.new('hat')\nhat_material.diffuse_shader = 'LAMBERT'\nhat.active_material = hat_material\nhat_image = bpy.data.images.load(filepath = '" + rootPathRender + "rendering/hats/"+hatModel.sourceFile+".png')\nhat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')\nhat_texture.image = hat_image\nhat_add = bpy.data.objects['hat'].active_material.texture_slots.add()\nhat_add.texture = hat_texture";
|
||||
var hatFilePath = rootPathRender + "rendering/global/" + hatModel.sourceFile + ".obj"
|
||||
var hat = "hat_import = bpy.ops.import_scene.obj(filepath='"+hatFilePath+"')\nhat = bpy.context.selected_objects[0]\nbpy.context.selected_objects[0].data.name = 'hat'\nbpy.context.selected_objects[0].name = 'hat'\nhat_material = bpy.data.materials.new('hat')\nhat_material.diffuse_shader = 'LAMBERT'\nhat.active_material = hat_material\nhat_image = bpy.data.images.load(filepath = '" + rootPathRender + "rendering/global/"+hatModel.sourceFile+".png')\nhat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')\nhat_texture.image = hat_image\nhat_add = bpy.data.objects['hat'].active_material.texture_slots.add()\nhat_add.texture = hat_texture";
|
||||
} else {
|
||||
var hat = ''
|
||||
}
|
||||
|
@ -81,6 +83,7 @@ router.post("/refresh", limiter, auth, async(req, res, next) => {
|
|||
var imports = "import bpy";
|
||||
var functions = "def hex_to_rgb(value):\n gamma = 2.05\n value = value.lstrip('#')\n lv = len(value)\n fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))\n r = pow(fin[0] / 255, gamma)\n g = pow(fin[1] / 255, gamma)\n b = pow(fin[2] / 255, gamma)\n fin.clear()\n fin.append(r)\n fin.append(g)\n fin.append(b)\n return tuple(fin)";
|
||||
var blenderImport = "bpy.ops.wm.open_mainfile(filepath='"+blendFilePath+"')";
|
||||
var blenderImportHs = "bpy.ops.wm.open_mainfile(filepath='"+blendFilePathHs+"')";
|
||||
var headColor = "bpy.data.objects['Head'].select = True\nbpy.data.materials['Head'].diffuse_color = hex_to_rgb('"+user.headColor+"')\nbpy.data.materials['Face'].diffuse_color = hex_to_rgb('"+user.headColor+"')";
|
||||
var leftArmColor = "bpy.data.objects['Left Arm'].select = True\nbpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('"+user.leftArmColor+"')";
|
||||
var rightArmColor = "bpy.data.objects['Right Arm'].select = True\nbpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('"+user.rightArmColor+"')";
|
||||
|
@ -90,7 +93,7 @@ router.post("/refresh", limiter, auth, async(req, res, next) => {
|
|||
var colors = headColor+"\n"+leftArmColor+"\n"+bodyColor+"\n"+rightArmColor+"\n"+leftLegColor+"\n"+rightLegColor;
|
||||
|
||||
if(user.hatId) {
|
||||
var hat = "hat_import = bpy.ops.import_scene.obj(filepath='"+hatFilePath+"')\nhat = bpy.context.selected_objects[0]\nbpy.context.selected_objects[0].data.name = 'hat'\nbpy.context.selected_objects[0].name = 'hat'\nhat_material = bpy.data.materials.new('hat')\nhat_material.diffuse_shader = 'LAMBERT'\nhat.active_material = hat_material\nhat_image = bpy.data.images.load(filepath = '" + rootPathRender + "rendering/hats/"+user.hatID+".png')\nhat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')\nhat_texture.image = hat_image\nhat_add = bpy.data.objects['hat'].active_material.texture_slots.add()\nhat_add.texture = hat_texture";
|
||||
var hat = "hat_import = bpy.ops.import_scene.obj(filepath='"+hatFilePath+"')\nhat = bpy.context.selected_objects[0]\nbpy.context.selected_objects[0].data.name = 'hat'\nbpy.context.selected_objects[0].name = 'hat'\nhat_material = bpy.data.materials.new('hat')\nhat_material.diffuse_shader = 'LAMBERT'\nhat.active_material = hat_material\nhat_image = bpy.data.images.load(filepath = '" + rootPathRender + "rendering/global/"+hatModel.sourceFile+".png')\nhat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')\nhat_texture.image = hat_image\nhat_add = bpy.data.objects['hat'].active_material.texture_slots.add()\nhat_add.texture = hat_texture";
|
||||
} else {
|
||||
var hat = ''
|
||||
}
|
||||
|
@ -98,15 +101,25 @@ router.post("/refresh", limiter, auth, async(req, res, next) => {
|
|||
var shirt = "shirt_Image = bpy.data.images.load(filepath = '"+shirtFilePath+"')\nbpy.data.textures['Shirt'].image = shirt_Image\nbpy.data.textures['ShirtR'].image = shirt_Image\nbpy.data.textures['ShirtL'].image = shirt_Image";
|
||||
var pants = "pants_Image = bpy.data.images.load(filepath = '"+pantsFilePath+"')\nbpy.data.textures['PantsR'].image = pants_Image\nbpy.data.textures['PantsL'].image = pants_Image";
|
||||
var render = "for obj in bpy.data.objects:\n obj.select = False\n bpy.ops.object.select_all(action='SELECT')\nbpy.ops.view3d.camera_to_view_selected()\nscene = bpy.context.scene\nscene.render.image_settings.file_format = 'PNG'\nscene.render.filepath = '"+imageSavePath+"'\nbpy.ops.render.render(write_still = 1)";
|
||||
var renderHS = "scene = bpy.context.scene\nscene.render.image_settings.file_format = 'PNG'\nscene.render.filepath = '"+imageSavePathHS+"'\nbpy.ops.render.render(write_still = 1)";
|
||||
var python = imports+"\n"+functions+"\n"+blenderImport+"\n"+colors+"\n"+hat+"\n"+face+"\n"+shirt+"\n"+pants+"\n"+render;
|
||||
var pythonHS = imports+"\n"+functions+"\n"+blenderImportHs+"\n"+colors+"\n"+hat+"\n"+face+"\n"+shirt+"\n"+pants+"\n"+renderHS;
|
||||
fs.writeFile("rendering/usercontent/"+req.userData.UserId+".py", python, function(err,data){
|
||||
if(err) { console.log(err) }
|
||||
})
|
||||
fs.writeFile("rendering/usercontent/hs/"+req.userData.UserId+".py", pythonHS, function(err,data){
|
||||
if(err) { console.log(err) }
|
||||
})
|
||||
|
||||
exec("blender -b -P rendering/usercontent/"+req.userData.UserId+".py", (err, stdout, stderr) => {
|
||||
if(err) { console.log(err) }
|
||||
console.log("stdout: " + stdout);
|
||||
console.log("stderr: " + stderr);
|
||||
});
|
||||
exec("blender -b -P rendering/usercontent/hs/"+req.userData.UserId+".py", (err, stdout, stderr) => {
|
||||
if(err) { console.log(err) }
|
||||
console.log("stdout: " + stdout);
|
||||
console.log("stderr: " + stderr);
|
||||
res.status(200)
|
||||
res.json({success: true})
|
||||
});
|
||||
|
|
|
@ -36,6 +36,18 @@ var upload = multer({
|
|||
}
|
||||
}
|
||||
});
|
||||
const storageObj = multer.diskStorage({
|
||||
destination: (req, file, cb) => {
|
||||
cb(null, 'C:\\Users\\matth\\Documents\\GitHub\\website\\rendering\\global\\');
|
||||
},
|
||||
filename: (req, file, cb) => {
|
||||
cb(null, img + '.obj')
|
||||
}
|
||||
});
|
||||
|
||||
var uploadObj = multer({
|
||||
storage: storageObj
|
||||
});
|
||||
|
||||
router.get('/', async(req, res) => {
|
||||
try {
|
||||
|
@ -65,7 +77,7 @@ router.get('/:category', async(req, res, next) => {
|
|||
model: Item,
|
||||
order: [['id', 'DESC']],
|
||||
limit,
|
||||
where: {},
|
||||
where: {deleted: false, approved: true},
|
||||
include: [
|
||||
ItemCategory,
|
||||
{ model: User, attributes: ['username', 'createdAt', 'id', 'color', 'picture', 'locked', 'admin', 'booster', 'executive', 'bot'] },
|
||||
|
@ -132,13 +144,18 @@ router.get('/view/:id', async(req, res, next) => {
|
|||
include: { model: User, attributes: ['username', 'createdAt', 'id', 'color', 'picture', 'locked', 'admin', 'booster', 'executive', 'bot'] }
|
||||
}
|
||||
let marketplace = await Item.findOne(queryObj)
|
||||
res.json(marketplace.toJSON())
|
||||
res.json({createdAt: marketplace.createdAt, updatedAt: marketplace.createdAt, id: marketplace.id, name: "Item unavailable", deleted: true, price: 0, User: marketplace.User, description: 'Item is currently unavailable at this time.', approved: false})
|
||||
}
|
||||
if(!marketplace.deleted) {
|
||||
res.json(marketplace.toJSON())
|
||||
if(!marketplace.approved) {
|
||||
let queryObj = {
|
||||
where: {id: req.params.id},
|
||||
attributes: ['name', 'deleted', 'createdAt', 'id', 'updatedAt', 'price'],
|
||||
include: { model: User, attributes: ['username', 'createdAt', 'id', 'color', 'picture', 'locked', 'admin', 'booster', 'executive', 'bot'] }
|
||||
}
|
||||
let marketplace = await Item.findOne(queryObj)
|
||||
res.json({createdAt: marketplace.createdAt, updatedAt: marketplace.createdAt, id: marketplace.id, name: "Item is pending admin approval", deleted: false, price: 0, User: marketplace.User, description: 'Item is currently unavailable at this time.', approved: false})
|
||||
}
|
||||
|
||||
|
||||
res.json(marketplace.toJSON())
|
||||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
|
@ -232,7 +249,94 @@ try {
|
|||
} catch (err) { next(err) }
|
||||
})
|
||||
|
||||
router.post('/upload/:id', auth, limiter, upload.single('image'), async (req, res, next) => {
|
||||
router.put('/rerender/:id', auth, limiter, async (req, res, next) => {
|
||||
try {
|
||||
let user = await User.findOne({
|
||||
where: {id: req.userData.UserId}
|
||||
});
|
||||
if(!req.userData.admin) {
|
||||
throw Errors.requestNotAuthorized
|
||||
}
|
||||
if(!user.admin) {
|
||||
throw Errors.requestNotAuthorized
|
||||
}
|
||||
let marketplace = await Item.findOne({
|
||||
where: {id: req.params.id}
|
||||
});
|
||||
if(marketplace) {
|
||||
if(marketplace.ItemCategoryId === 0) {
|
||||
var type = "hat"
|
||||
} else if(marketplace.ItemCategoryId === 1) {
|
||||
var type = "face"
|
||||
} else if(marketplace.ItemCategoryId === 2) {
|
||||
var type = "shirt"
|
||||
} else if(marketplace.ItemCategoryId === 3) {
|
||||
var type = "pants"
|
||||
}
|
||||
const { exec } = require('child_process');
|
||||
var fs = require("fs");
|
||||
let rootPathRender = "C:/Users/matth/Documents/GitHub/website/";
|
||||
var blendFilePath = rootPathRender + "rendering/avatar.blend";
|
||||
var img4 = marketplace.previewFile
|
||||
var imageSavePath = "C:/xampp21/htdocs/marketplace/avatars/" + img4 + ".png";
|
||||
var pythonFilePath = "rendering/marketplacecontent/"+req.userData.UserId+".py";
|
||||
if(type === "face") {
|
||||
var faceFilePath = rootPathRender + "rendering/global/" + marketplace.sourceFile + ".png";
|
||||
var shirtFilePath = rootPathRender + "rendering/global/0.png";
|
||||
var pantsFilePath = rootPathRender + "rendering/global/0.png";
|
||||
var hat = ''
|
||||
}
|
||||
if(type === "shirt") {
|
||||
var faceFilePath = rootPathRender + "rendering/global/defaultFace.png";
|
||||
var shirtFilePath = rootPathRender + "rendering/global/" + marketplace.sourceFile + ".png"; // should be set to 0 by default, 0.png will just be a transparent image
|
||||
var pantsFilePath = rootPathRender + "rendering/global/0.png";
|
||||
var hat = ''
|
||||
}
|
||||
if(type === "pants") {
|
||||
var faceFilePath = rootPathRender + "rendering/global/defaultFace.png";
|
||||
var shirtFilePath = rootPathRender + "rendering/global/0.png";
|
||||
var hat = ''
|
||||
var pantsFilePath = rootPathRender + "rendering/global/" + marketplace.sourceFile + ".png"; // should be set to 0 by default, 0.png will just be a transparent image
|
||||
}
|
||||
if(type === "hat") {
|
||||
var faceFilePath = rootPathRender + "rendering/global/defaultFace.png";
|
||||
var shirtFilePath = rootPathRender + "rendering/global/0.png";
|
||||
var pantsFilePath = rootPathRender + "rendering/global/0.png";
|
||||
var hatFilePath = rootPathRender + "rendering/global/" + marketplace.sourceFile + ".obj"
|
||||
var hat = "hat_import = bpy.ops.import_scene.obj(filepath='"+hatFilePath+"')\nhat = bpy.context.selected_objects[0]\nbpy.context.selected_objects[0].data.name = 'hat'\nbpy.context.selected_objects[0].name = 'hat'\nhat_material = bpy.data.materials.new('hat')\nhat_material.diffuse_shader = 'LAMBERT'\nhat.active_material = hat_material\nhat_image = bpy.data.images.load(filepath = '" + rootPathRender + "rendering/global/"+marketplace.sourceFile+".png')\nhat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')\nhat_texture.image = hat_image\nhat_add = bpy.data.objects['hat'].active_material.texture_slots.add()\nhat_add.texture = hat_texture";
|
||||
}
|
||||
|
||||
var imports = "import bpy";
|
||||
var functions = "def hex_to_rgb(value):\n gamma = 2.05\n value = value.lstrip('#')\n lv = len(value)\n fin = list(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))\n r = pow(fin[0] / 255, gamma)\n g = pow(fin[1] / 255, gamma)\n b = pow(fin[2] / 255, gamma)\n fin.clear()\n fin.append(r)\n fin.append(g)\n fin.append(b)\n return tuple(fin)";
|
||||
var blenderImport = "bpy.ops.wm.open_mainfile(filepath='"+blendFilePath+"')";
|
||||
var headColor = "bpy.data.objects['Head'].select = True\nbpy.data.materials['Head'].diffuse_color = hex_to_rgb('#ffffff')\nbpy.data.materials['Face'].diffuse_color = hex_to_rgb('#ffffff')";
|
||||
var leftArmColor = "bpy.data.objects['Left Arm'].select = True\nbpy.data.objects['Left Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')";
|
||||
var rightArmColor = "bpy.data.objects['Right Arm'].select = True\nbpy.data.objects['Right Arm'].active_material.diffuse_color = hex_to_rgb('#ffffff')";
|
||||
var bodyColor = "bpy.data.objects['Torso'].select = True\nbpy.data.objects['Torso'].active_material.diffuse_color = hex_to_rgb('#ffffff')";
|
||||
var leftLegColor = "bpy.data.objects['Left Leg'].select = True\nbpy.data.objects['Left Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')";
|
||||
var rightLegColor = "bpy.data.objects['Right Leg'].select = True\nbpy.data.objects['Right Leg'].active_material.diffuse_color = hex_to_rgb('#ffffff')";
|
||||
var colors = headColor+"\n"+leftArmColor+"\n"+bodyColor+"\n"+rightArmColor+"\n"+leftLegColor+"\n"+rightLegColor;
|
||||
|
||||
var face = "face_Image = bpy.data.images.load(filepath = '"+faceFilePath+"')\nbpy.data.textures['Face'].image = face_Image";
|
||||
var shirt = "shirt_Image = bpy.data.images.load(filepath = '"+shirtFilePath+"')\nbpy.data.textures['Shirt'].image = shirt_Image\nbpy.data.textures['ShirtR'].image = shirt_Image\nbpy.data.textures['ShirtL'].image = shirt_Image";
|
||||
var pants = "pants_Image = bpy.data.images.load(filepath = '"+pantsFilePath+"')\nbpy.data.textures['PantsR'].image = pants_Image\nbpy.data.textures['PantsL'].image = pants_Image";
|
||||
var render = "for obj in bpy.data.objects:\n obj.select = False\n bpy.ops.object.select_all(action='SELECT')\nbpy.ops.view3d.camera_to_view_selected()\nscene = bpy.context.scene\nscene.render.image_settings.file_format = 'PNG'\nscene.render.filepath = '"+imageSavePath+"'\nbpy.ops.render.render(write_still = 1)";
|
||||
var python = imports+"\n"+functions+"\n"+blenderImport+"\n"+colors+"\n"+hat+"\n"+face+"\n"+shirt+"\n"+pants+"\n"+render;
|
||||
fs.writeFile("rendering/marketplacecontent/"+marketplace.id+".py", python, function(err,data){
|
||||
if(err) { console.log(err) }
|
||||
})
|
||||
await Inventory.create({UserId: req.userData.UserId, purchasePrice: 0, isReselling: false, isResellingPrice: 0, ItemId: marketplace.id, boughtFrom: marketplace.UserId, resellType: 0, auctionId: 0})
|
||||
exec("blender -b -P rendering/marketplacecontent/"+marketplace.id+".py", (err, stdout, stderr) => {
|
||||
if(err) { console.log(err) }
|
||||
console.log("stdout: " + stdout);
|
||||
console.log("stderr: " + stderr);
|
||||
res.status(200)
|
||||
res.json(marketplace.toJSON())
|
||||
});
|
||||
}
|
||||
} catch (e) { next(e) }
|
||||
})
|
||||
router.post('/upload/:id', auth, upload.single('image'), limiter, async (req, res, next) => {
|
||||
try {
|
||||
|
||||
let findCategory = await ItemCategory.findOne({
|
||||
|
@ -246,10 +350,10 @@ router.post('/upload/:id', auth, limiter, upload.single('image'), async (req, re
|
|||
where: {id: req.userData.UserId}
|
||||
});
|
||||
|
||||
if(findCategory.value === "HATS" && !req.userData.admin && !user.admin ) {
|
||||
if(findCategory.value === "HATS" && !user.modeler ) {
|
||||
throw Errors.marketplaceAdminOnly
|
||||
}
|
||||
if(findCategory.value === "FACES" && !req.userData.admin && !user.admin ) {
|
||||
if(findCategory.value === "FACES" && !user.modeler) {
|
||||
throw Errors.marketplaceAdminOnly
|
||||
}
|
||||
if(req.body.limited && !req.userData.admin && !user.admin) {
|
||||
|
@ -278,7 +382,7 @@ router.post('/upload/:id', auth, limiter, upload.single('image'), async (req, re
|
|||
let rootPathRender = "C:/Users/matth/Documents/GitHub/website/";
|
||||
var blendFilePath = rootPathRender + "rendering/avatar.blend";
|
||||
var imageSavePath = "C:/xampp21/htdocs/marketplace/avatars/" + img4 + ".png";
|
||||
var pythonFilePath = "rendering/usercontent/"+req.userData.UserId+".py";
|
||||
var pythonFilePath = "rendering/marketplacecontent/"+req.userData.UserId+".py";
|
||||
if(type === "face") {
|
||||
var faceFilePath = rootPathRender + "rendering/global/" + marketplace.sourceFile + ".png";
|
||||
var shirtFilePath = rootPathRender + "rendering/global/0.png";
|
||||
|
@ -301,8 +405,8 @@ router.post('/upload/:id', auth, limiter, upload.single('image'), async (req, re
|
|||
var faceFilePath = rootPathRender + "rendering/global/defaultFace.png";
|
||||
var shirtFilePath = rootPathRender + "rendering/global/0.png";
|
||||
var pantsFilePath = rootPathRender + "rendering/global/0.png";
|
||||
var hatFilePath = rootPathRender + "rendering/hats/" + marketplace.sourceFile + ".obj"
|
||||
var hat = "hat_import = bpy.ops.import_scene.obj(filepath='"+hatFilePath+"')\nhat = bpy.context.selected_objects[0]\nbpy.context.selected_objects[0].data.name = 'hat'\nbpy.context.selected_objects[0].name = 'hat'\nhat_material = bpy.data.materials.new('hat')\nhat_material.diffuse_shader = 'LAMBERT'\nhat.active_material = hat_material\nhat_image = bpy.data.images.load(filepath = '" + rootPathRender + "rendering/hats/"+marketplace.sourceFile+".png')\nhat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')\nhat_texture.image = hat_image\nhat_add = bpy.data.objects['hat'].active_material.texture_slots.add()\nhat_add.texture = hat_texture";
|
||||
var hatFilePath = rootPathRender + "rendering/global/" + marketplace.sourceFile + ".obj"
|
||||
var hat = "hat_import = bpy.ops.import_scene.obj(filepath='"+hatFilePath+"')\nhat = bpy.context.selected_objects[0]\nbpy.context.selected_objects[0].data.name = 'hat'\nbpy.context.selected_objects[0].name = 'hat'\nhat_material = bpy.data.materials.new('hat')\nhat_material.diffuse_shader = 'LAMBERT'\nhat.active_material = hat_material\nhat_image = bpy.data.images.load(filepath = '" + rootPathRender + "rendering/global/"+marketplace.sourceFile+".png')\nhat_texture = bpy.data.textures.new('ColorTex', type = 'IMAGE')\nhat_texture.image = hat_image\nhat_add = bpy.data.objects['hat'].active_material.texture_slots.add()\nhat_add.texture = hat_texture";
|
||||
}
|
||||
|
||||
var imports = "import bpy";
|
||||
|
@ -321,11 +425,11 @@ router.post('/upload/:id', auth, limiter, upload.single('image'), async (req, re
|
|||
var pants = "pants_Image = bpy.data.images.load(filepath = '"+pantsFilePath+"')\nbpy.data.textures['PantsR'].image = pants_Image\nbpy.data.textures['PantsL'].image = pants_Image";
|
||||
var render = "for obj in bpy.data.objects:\n obj.select = False\n bpy.ops.object.select_all(action='SELECT')\nbpy.ops.view3d.camera_to_view_selected()\nscene = bpy.context.scene\nscene.render.image_settings.file_format = 'PNG'\nscene.render.filepath = '"+imageSavePath+"'\nbpy.ops.render.render(write_still = 1)";
|
||||
var python = imports+"\n"+functions+"\n"+blenderImport+"\n"+colors+"\n"+hat+"\n"+face+"\n"+shirt+"\n"+pants+"\n"+render;
|
||||
fs.writeFile("rendering/usercontent/"+marketplace.id+".py", python, function(err,data){
|
||||
fs.writeFile("rendering/marketplacecontent/"+marketplace.id+".py", python, function(err,data){
|
||||
if(err) { console.log(err) }
|
||||
})
|
||||
await Inventory.create({UserId: req.userData.UserId, purchasePrice: 0, isReselling: false, isResellingPrice: 0, ItemId: marketplace.id, boughtFrom: marketplace.UserId, resellType: 0, auctionId: 0})
|
||||
exec("blender -b -P rendering/usercontent/"+marketplace.id+".py", (err, stdout, stderr) => {
|
||||
exec("blender -b -P rendering/marketplacecontent/"+marketplace.id+".py", (err, stdout, stderr) => {
|
||||
if(err) { console.log(err) }
|
||||
console.log("stdout: " + stdout);
|
||||
console.log("stderr: " + stderr);
|
||||
|
|
|
@ -21,6 +21,9 @@ router.post('/send', auth, async(req, res, next) => {
|
|||
if(!user2) {
|
||||
throw Errors.accountDoesNotExist
|
||||
}
|
||||
if(user.id === user2.id) {
|
||||
throw Errors.friendSelf
|
||||
}
|
||||
let checkIfSent = await Relationship.findOne({
|
||||
where: {friend1Id: user.id, friend2Id: user2.id}
|
||||
})
|
||||
|
@ -29,12 +32,6 @@ router.post('/send', auth, async(req, res, next) => {
|
|||
}
|
||||
Relationship.create({friend1Id: user.id, friend2Id: user2.id, type: 'pending'})
|
||||
Relationship.create({friend1Id: user2.id, friend2Id: user.id, type: 'pendingCanAccept'})
|
||||
Notification.createNotification({
|
||||
usernameTo: user2,
|
||||
userFrom: user,
|
||||
type: 'friend request',
|
||||
message: user.username + ' sent a friend request'
|
||||
})
|
||||
res.status(200)
|
||||
res.json({success: true})
|
||||
} else {
|
||||
|
|
|
@ -284,7 +284,7 @@ router.get('/view/:username/roles', async(req, res, next) => {
|
|||
res.json([])
|
||||
}
|
||||
let team = await TeamRoles.findAll({
|
||||
order: [['id', 'DESC']],
|
||||
order: [['priority', 'ASC']],
|
||||
where: {
|
||||
TeamId: user.id
|
||||
},
|
||||
|
|
|
@ -151,6 +151,8 @@ router.post('/:username/picture', auth, upload.single('picture'), async (req, re
|
|||
})
|
||||
|
||||
res.json(user.toJSON())
|
||||
} else {
|
||||
throw Errors.requestNotAuthorized
|
||||
}
|
||||
} catch (e) { next(e) }
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue