-
Notifications
You must be signed in to change notification settings - Fork 52
/
create.sh
75 lines (61 loc) · 1.57 KB
/
create.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#! /usr/bin/env bash
# create a new pip package for a 3ds Max feature
set -e
script="$(dirname "$(readlink -f "$0")")"
if [ $# -lt 1 ]
then
echo "please provide the name of the sample to create"
exit 1
fi
samplename=$1
sampledescr=${2:-$samplename sample}
if [ -e "$samplename" ]
then
echo "the directory already exists. please rm -f $samplename if you want to reset it"
exit 1
fi
mkdir -p "$samplename/$samplename"
cat >"$samplename/LICENSE" <<EOF
Copyright (c) 2020 Autodesk, all rights reserved.
EOF
cat >"$samplename/README.md" <<EOF
# HowTo: $samplename
$sampledescr
EOF
cat >"$samplename/setup.py" <<EOF
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="$samplename-autodesk",
version="0.0.1",
description="$sampledescr",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://git.autodesk.com/windish/maxpythontutorials",
packages=setuptools.find_packages(),
entry_points={'3dsMax': 'startup=$samplename:startup'},
python_requires='>=3.7'
)
EOF
cat >>$samplename/$samplename/__init__.py <<EOF
"""
$samplename example: $sampledescr
"""
import menuhook
from pymxs import runtime as rt
def $samplename():
'''$sampledescr'''
print("$sampledescr")
def startup():
"""
Hook the function to a menu item.
"""
menuhook.register(
"$samplename",
"howtos",
$samplename,
menu=["&Scripting", "Python3 Development", "How To"],
text="$sampledescr",
tooltip="$sampledescr")
EOF