Skip to content

Commit

Permalink
Refactoring (#3)
Browse files Browse the repository at this point in the history
* Add mkdocs-glightbox to dependencies

* Update sensor and output registration in
pyproject.toml

* Update asset browser name

* Remove unused imports in environment.py

* Update output path default value in CLI

* Fix asset library addition to catalog

* Remove Python formatting settings
  • Loading branch information
aelmiger committed Dec 1, 2023
1 parent 001bda8 commit 31892f3
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 37 deletions.
6 changes: 0 additions & 6 deletions .vscode/settings.json

This file was deleted.

1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ To build the documentation, you need to install [Material for MKDocs](https://sq

```bash
pip install mkdocs-material
pip install mkdocs-glightbox
```

## Serve
Expand Down
5 changes: 3 additions & 2 deletions docs/docs/developement/add_functionality/create_sensor.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,14 @@ class LaserDistanceOutput(OutputInterface):

1. The `RevertAfter` context manager is used to revert all changes made to the scene after the context manager is exited.

### Plugin Registration
### Sensor and Ouput Registration

To register your sensor and output plugins with Syclops, add entries in your pyproject.toml file under the [project.entry-points."syclops.plugins"] section. For example:

```toml title="pyproject.toml"
[project.entry-points."syclops.plugins"]
[project.entry-points."syclops.sensors"]
syclops_laser_sensor = "path.to.laser_distance_sensor:LaserDistanceSensor"
[project.entry-points."syclops.outputs"]
syclops_laser_output = "path.to.laser_distance_output:LaserDistanceOutput"
```

Expand Down
4 changes: 2 additions & 2 deletions syclops/asset_manager/asset_browser/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Syclopes Asset Browser"
content="Syclops Asset Browser"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
Expand All @@ -28,7 +28,7 @@
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<title>Syclopes Asset Browser</title>
<title>Syclops Asset Browser</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
2 changes: 1 addition & 1 deletion syclops/asset_manager/asset_browser/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "Asset Browser",
"name": "Syclopes Asset Browser",
"name": "Syclops Asset Browser",
"icons": [
{
"src": "favicon.ico",
Expand Down
19 changes: 10 additions & 9 deletions syclops/asset_manager/asset_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,16 @@ def _merge_manifests(self, manifest_files: list, root_path: Path) -> dict:
merged_manifest["root_path"] = str(root_path.absolute())
return merged_manifest


def _add_assets_to_catalog(self, manifest: dict):
asset_library_name = manifest["name"]
if asset_library_name in self.asset_catalog:
raise Exception(
"Asset library {} already exists in catalog.".format(asset_library_name)
print(
"Warning: Asset library '{}' already exists in catalog. Skipping addition.".format(
asset_library_name
)
)
return
self.asset_catalog[asset_library_name] = manifest

def check_catalog(self):
Expand Down Expand Up @@ -182,29 +186,26 @@ def write_catalog(self, catalog_path: str):
self.yaml.dump(self.asset_catalog, f)

def create_thumbnails(self, blender_path: Path):
thumbnail_generator_path = (
Path(__file__).parent / "thumbnail_generator.py"
)
thumbnail_generator_path = Path(__file__).parent / "thumbnail_generator.py"

for manifest_path in self.manifest_files:
print(f"Generate thumbnails for {manifest_path}")
subprocess.run(
[
blender_path,
Path(__file__).resolve().parent / "studio.blend",
blender_path,
Path(__file__).resolve().parent / "studio.blend",
"-P",
thumbnail_generator_path,
"-b",
"--",
"--asset",
manifest_path,
"--site-packages-path",
get_site_packages_path()
get_site_packages_path(),
]
)



if __name__ == "__main__":
# Create a new asset crawler
asset_crawler = AssetCrawler(ASSET_LIBRARY_PATHS)
Expand Down
2 changes: 0 additions & 2 deletions syclops/blender/plugins/environment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import logging
import os
from pathlib import Path

import bpy
import numpy as np
Expand Down
16 changes: 1 addition & 15 deletions syclops/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
parser.add_argument(
"-o",
"--output-path",
help="Output path of generated files",
help="Output path of generated files. Defaults to <install_folder>/output",
default="./output",
)
parser.add_argument(
Expand Down Expand Up @@ -91,20 +91,6 @@
help="Live view of textures in the job config",
)

parser.add_argument(
"-i",
"--install",
help="Install code from src to install folder. If no folders are specified, everything will be copied.",
nargs="*",
)

parser.add_argument(
"-p",
"--pull_repos",
help="Pull all or a list of git repos",
nargs="*",
)

parser.add_argument(
"-if",
"--install_folder",
Expand Down

0 comments on commit 31892f3

Please sign in to comment.