Skip to content

Commit

Permalink
restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
josephkirk committed Oct 3, 2017
1 parent 108dce1 commit d63d6ff
Show file tree
Hide file tree
Showing 56 changed files with 8,556 additions and 0 deletions.
168 changes: 168 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${file}",
"cwd": "${workspaceRoot}",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "PySpark",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"osx": {
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit"
},
"windows": {
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit.cmd"
},
"linux": {
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit"
},
"program": "${file}",
"cwd": "${workspaceRoot}",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Python Module",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"module": "module.name",
"cwd": "${workspaceRoot}",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Integrated Terminal/Console",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${file}",
"cwd": "null",
"console": "integratedTerminal",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
},
{
"name": "External Terminal/Console",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${file}",
"cwd": "null",
"console": "externalTerminal",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
},
{
"name": "Django",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${workspaceRoot}/manage.py",
"cwd": "${workspaceRoot}",
"args": [
"runserver",
"--noreload"
],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput",
"DjangoDebugging"
]
},
{
"name": "Flask",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config.python.pythonPath}",
"program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter",
"cwd": "${workspaceRoot}",
"env": {
"FLASK_APP": "${workspaceRoot}/quickstart/app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Flask (old)",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config.python.pythonPath}",
"program": "${workspaceRoot}/run.py",
"cwd": "${workspaceRoot}",
"args": [],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Watson",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${workspaceRoot}/console.py",
"cwd": "${workspaceRoot}",
"args": [
"dev",
"runserver",
"--noreload=True"
],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
{
"name": "Attach (Remote Debug)",
"type": "python",
"request": "attach",
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
}
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Place your settings in this file to overwrite default and user settings.
{
"python.linting.pylintEnabled": false
}
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Copyright (c) 2017, Kenneth Reitz

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include LICENSE
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
init:
pip install -r requirements.txt

test:
nosetests tests
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Sample Module Repository
========================

This simple project is an example repo for Python projects.

`Learn more <http://www.kennethreitz.org/essays/repository-structure-and-python>`_.

---------------

If you want to learn more about ``setup.py`` files, check out `this repository <https://github.com/kennethreitz/setup.py>`_.

✨🍰✨
Empty file added customclass/__init__.py
Empty file.
Binary file added customclass/__init__.pyc
Binary file not shown.
144 changes: 144 additions & 0 deletions customclass/asset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import os
from os import listdir
from os.path import join, isdir, normpath, isfile, getmtime, abspath, exists
import pymel.core as pm
projectRoot = pm.workspace.path
"""
written by Nguyen Phi Hung 2017
email: [email protected]
All code written by me unless specify
"""
#Rigging Class

#Pipeline Class
class Asset(object):
'''Base Class to find AssetPath'''
def __init__(self, name, type, kind):
self.kind = kind
self.type = type
self.name = name
self.ID = 0
self.path = ""
self.texPath = ""
self.get()
#self.getFiles()

def get(self):
RootPath = normpath(join(projectRoot, 'scenes'))
RootTexPath = normpath(join(projectRoot, 'sourceimages'))
XgenPath = normpath(join(projectRoot, 'xgen', 'collections'))
if self.kind in listdir(RootPath):
self.kindPath = normpath(join(RootPath,self.kind))
self.kindTexPath = normpath(join(RootTexPath,self.kind))
if not isdir(self.kindTexPath):
self.kindTexPath= RootTexPath
if self.type in listdir(self.kindPath):
self.typePath = normpath(join(self.kindPath,self.type))
self.typeTexPath = normpath(join(self.kindTexPath,self.type))
if not isdir(self.typeTexPath):
self.typeTexPath= self.kindTexPath
else:
print "These directories are not exist, please create them:\n\t%s\n\t%s" % (self.kind, self.type)
return
AssetList = []
if XgenPath:
for d in listdir(XgenPath):
if self.name in d:
self.xgenPath = join(XgenPath, d)
for d in listdir(self.typePath):
if self.name in d:
self.path = join(self.typePath, d)
if isdir(join(self.typeTexPath, d)):
self.texPath = join(self.typeTexPath, d)
if d.split('_')[0].isdigit():
self.ID = int(d.split('_')[0])
else:
self.ID = listdir(self.typePath).index(d)
return
else:
if isdir(join(self.typePath,d)):
AssetList.append(d)
print 'Can\'t find Asset %s' % self.name
print 'Current Avalaible Asset:'
for asset in AssetList:
print asset
raise Exception

class Character(Asset):
def __init__(self, name):
self.kind = 'Model'
self.type = 'CH'
Asset.__init__(self, name, self.type, self.kind)
self.get()
def rename(self, newName):
self.name = newName
self.get()
def get(self):
Asset.get(self)
self.texCommon = [d for d in listdir(self.texPath) if 'common' in d.lower()]
if self.texCommon:
self.texCommon = join(self.texPath,self.texCommon[0])
self.version = ([d.split('_')[1] for d in listdir(self.path)
if self.name.lower() in d.lower()])
self.version.sort()
def __getitem__(self,*args):
version = []
if not self.version:
return version
for v in self.version:
version.append(subCharacter(self.name,v))
if not args:
return version
else:
if len(args)<2:
return version[args[0]]
else:
result = []
for arg in args:
result.append(version[arg])
return result
def getChild(self):
return self.__getitem__()

class subCharacter(Character):
def __init__(self, name, version):
Character.__init__(self, name)
self.getversion(version)
def getversion(self, version):
def collectdir(dirDict):
try:
if exists(dirDict['..']):
for d in listdir(dirDict['..']):
if any([di in d.lower() for di in ['hair','clothes', 'pattern', 'zbr', 'uv']]):
fullPath = join(dirDict['..'], d)
if isdir(fullPath):
dirDict[d.lower()] = fullPath
if 'cloth' in d.lower():
if isdir(join(fullPath,'rend')):
dirDict['clothRender'] = join(fullPath,'rend')
if 'hair' in d.lower():
if isdir(join(fullPath,'rend')):
dirDict['hairRender'] = join(fullPath,'rend')
except (IOError,OSError) as why:
print why
if version in self.version:
self.version = version
self.name = '_'.join([self.name, self.version])
RootPath = join(self.path, self.name)
self.path = {}
if exists(RootPath):
self.path['..'] = RootPath
collectdir(self.path)
RootTexPath = join(self.texPath, self.name)
self.texPath = {}
if exists(RootTexPath):
self.texPath['..'] = RootTexPath
collectdir(self.texPath)

class Background(Asset):
"""Background prop Link"""
def __init__(self, name):
self.kind = "Model"
self.type = "BG"
Asset.__init__(self, name, self.type, self.kind)

Binary file added customclass/asset.pyc
Binary file not shown.
Loading

0 comments on commit d63d6ff

Please sign in to comment.