Spaces:
Runtime error
Runtime error
Commit
·
ea3fcd6
1
Parent(s):
0282daa
feat: print help if no argument
Browse filesFormer-commit-id: df4e58c0d6234f0c00d71aadec4791d57b680bc3
- create-3d-icon.py +33 -32
create-3d-icon.py
CHANGED
|
@@ -4,40 +4,41 @@ import math
|
|
| 4 |
import bpy
|
| 5 |
import argparse
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def main():
|
| 9 |
if len(sys.argv) > 1:
|
| 10 |
-
parser = argparse.ArgumentParser()
|
| 11 |
-
parser.add_argument("filepath", help="path to svg file")
|
| 12 |
-
parser.add_argument("--rx", help="rotate x axis",
|
| 13 |
-
type=float, default=0)
|
| 14 |
-
parser.add_argument("--ry", help="rotate y axis",
|
| 15 |
-
type=float, default=0)
|
| 16 |
-
parser.add_argument("--rz", help="rotate z axis",
|
| 17 |
-
type=float, default=0)
|
| 18 |
-
parser.add_argument(
|
| 19 |
-
"--thickness", help="thickness of the icon", type=float, default=1)
|
| 20 |
-
parser.add_argument(
|
| 21 |
-
"--distance", help="distance of the camera", type=float, default=1)
|
| 22 |
-
parser.add_argument(
|
| 23 |
-
"--light-x", help="x position of the light", type=float, default=0)
|
| 24 |
-
parser.add_argument(
|
| 25 |
-
"--light-y", help="y position of the light", type=float, default=0)
|
| 26 |
-
parser.add_argument(
|
| 27 |
-
"--light-z", help="z position of the light", type=float, default=0)
|
| 28 |
-
parser.add_argument(
|
| 29 |
-
"--light-strength", help="strength of the light", type=float, default=1)
|
| 30 |
-
parser.add_argument("--r", help="red color",
|
| 31 |
-
type=float, default=-1)
|
| 32 |
-
parser.add_argument("--g", help="green color",
|
| 33 |
-
type=float, default=-1)
|
| 34 |
-
parser.add_argument("--b", help="blue color",
|
| 35 |
-
type=float, default=-1)
|
| 36 |
-
parser.add_argument(
|
| 37 |
-
"--size", help="size of the image", type=int, default=2048)
|
| 38 |
-
parser.add_argument(
|
| 39 |
-
"--bevel", help="bevel depth of the icon", type=float, default=1
|
| 40 |
-
)
|
| 41 |
args = parser.parse_args()
|
| 42 |
|
| 43 |
filepath = args.filepath
|
|
@@ -74,7 +75,7 @@ def main():
|
|
| 74 |
size
|
| 75 |
)
|
| 76 |
else:
|
| 77 |
-
|
| 78 |
|
| 79 |
|
| 80 |
def capture(
|
|
|
|
| 4 |
import bpy
|
| 5 |
import argparse
|
| 6 |
|
| 7 |
+
parser = argparse.ArgumentParser()
|
| 8 |
+
parser.add_argument("filepath", help="path to svg file")
|
| 9 |
+
parser.add_argument("--rx", help="rotate x axis",
|
| 10 |
+
type=float, default=0)
|
| 11 |
+
parser.add_argument("--ry", help="rotate y axis",
|
| 12 |
+
type=float, default=0)
|
| 13 |
+
parser.add_argument("--rz", help="rotate z axis",
|
| 14 |
+
type=float, default=0)
|
| 15 |
+
parser.add_argument(
|
| 16 |
+
"--thickness", help="thickness of the icon", type=float, default=1)
|
| 17 |
+
parser.add_argument(
|
| 18 |
+
"--distance", help="distance of the camera", type=float, default=1)
|
| 19 |
+
parser.add_argument(
|
| 20 |
+
"--light-x", help="x position of the light", type=float, default=0)
|
| 21 |
+
parser.add_argument(
|
| 22 |
+
"--light-y", help="y position of the light", type=float, default=0)
|
| 23 |
+
parser.add_argument(
|
| 24 |
+
"--light-z", help="z position of the light", type=float, default=0)
|
| 25 |
+
parser.add_argument(
|
| 26 |
+
"--light-strength", help="strength of the light", type=float, default=1)
|
| 27 |
+
parser.add_argument("--r", help="red color",
|
| 28 |
+
type=float, default=-1)
|
| 29 |
+
parser.add_argument("--g", help="green color",
|
| 30 |
+
type=float, default=-1)
|
| 31 |
+
parser.add_argument("--b", help="blue color",
|
| 32 |
+
type=float, default=-1)
|
| 33 |
+
parser.add_argument(
|
| 34 |
+
"--size", help="size of the image", type=int, default=2048)
|
| 35 |
+
parser.add_argument(
|
| 36 |
+
"--bevel", help="bevel depth of the icon", type=float, default=1
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
|
| 40 |
def main():
|
| 41 |
if len(sys.argv) > 1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
args = parser.parse_args()
|
| 43 |
|
| 44 |
filepath = args.filepath
|
|
|
|
| 75 |
size
|
| 76 |
)
|
| 77 |
else:
|
| 78 |
+
parser.print_help()
|
| 79 |
|
| 80 |
|
| 81 |
def capture(
|