Skip to content

Commit

Permalink
Merge branch 'dev' into barclah/ball-socket
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterBarclay committed Nov 8, 2024
2 parents 762c0b7 + e149858 commit 54b9323
Show file tree
Hide file tree
Showing 254 changed files with 10,402 additions and 5,133 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
* text=auto

# Workaround for a bug in GitHub's language detection,
# previously half of our code was being counted as JavaScript.. for some reason...
# and we certainly can't have that. - Brandon
*.js linguist-detectable=false
2 changes: 1 addition & 1 deletion .github/workflows/FissionUnitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
with:
path: |
~/.cache/ms-playwright/
key: ${{ runner.os }}-assets-playwright-${{ env.PLAYWRIGHT_VERSION }}
key: ${{ runner.os }}-assets-playwright-${{ env.PLAYWRIGHT_VERSION }}-v2

- name: Install Dependencies
run: |
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/FusionTyping.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Fusion - mypy Typing Validation

on:
workflow_dispatch: {}
push:
branches: [ prod, dev ]
pull_request:
branches: [ prod, dev ]

jobs:
mypy:
name: Run mypy
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./exporter/SynthesisFusionAddin
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install -r requirements-mypy.txt
- run: mypy
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.vs/
.vscode/
/build/
build/
dist/
*.log
.DS_Store
*.pkg
*.exe
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "mirabuf"]
path = mirabuf
url = https://github.com/HiceS/mirabuf.git
[submodule "jolt"]
path = jolt
url = https://github.com/HunterBarclay/JoltPhysics.js.git
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ If you're a developer who wants to contribute to Synthesis, you're in the right

- [Fission (Core Web App)](/fission/README.md)
- [Fusion Exporter (Fusion exporter to Mirabuf file format)](/exporter/SynthesisFusionAddin/README.md)
- [Installers](/installer/)
- [Fusion Exporter Installer](/installer/)

Follow the above links to the respective READMEs on how to build and run each component.

### Compatibility Notes

As Fusion is not supported on linux, the linux installer does not come with the Fusion Addin for exporting robots and fields.
As Fusion is not officially supported on Linux, we do not provide an installer for the Fusion Exporter on Linux.

## Contributing

Expand All @@ -60,6 +60,10 @@ All code is under a configured formatting utility. See each component for more d

Mirabuf is a file format we use to store physical data from Fusion to load into the Synthesis simulator (Fission). This is a separate project that is a submodule of Synthesis. [See Mirabuf](https://github.com/HiceS/mirabuf/)

### Jolt Physics

Jolt is the core physics engine for our web biased simulator. [See JoltPhysics.js](https://github.com/HunterBarclay/JoltPhysics.js) for more information.

### Tutorials

Our source code for the tutorials featured on our [Tutorials Page](https://synthesis.autodesk.com/tutorials.html).
Expand Down
17 changes: 8 additions & 9 deletions exporter/SynthesisFusionAddin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ We use `VSCode` Primarily, download it to interact with our code or use your own

### How to Build + Run

1. See root [`README`](/README.md) on how to run `init` script
2. Open `Autodesk Fusion`
3. Select `UTILITIES` from the top bar
4. Click `ADD-INS` Button
5. Click `Add-Ins` tab at the top of Scripts and Add-Ins dialog
6. Press + Button under **My Add-Ins**
7. Navigate to the containing folder for this Addin and click open at bottom - _clone-directory_/synthesis/exporters/SynthesisFusionAddin
8. Synthesis should be an option - select it and click run at the bottom of the dialog
9. There should now be a button that says Synthesis in your utilities menu
1. Open `Autodesk Fusion`
2. Select `UTILITIES` from the top bar
3. Click `ADD-INS` Button
4. Click `Add-Ins` tab at the top of Scripts and Add-Ins dialog
5. Press + Button under **My Add-Ins**
6. Navigate to the containing folder for this Addin and click open at bottom - _clone-directory_/synthesis/exporters/SynthesisFusionAddin
7. Synthesis should be an option - select it and click run at the bottom of the dialog
8. There should now be a button that says Synthesis in your utilities menu
- If there is no button there may be a problem - see below for [checking log file](#debug-non-start)

---
Expand Down
2 changes: 1 addition & 1 deletion exporter/SynthesisFusionAddin/Synthesis.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": {
"": "Synthesis Exporter"
},
"version": "1.0.0",
"version": "2.0.0",
"runOnStartup": true,
"supportedOS": "windows|mac",
"editEnabled": true
Expand Down
74 changes: 35 additions & 39 deletions exporter/SynthesisFusionAddin/Synthesis.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,55 @@
# DO NOT CHANGE ORDER, OR ADD IMPORTS BEFORE UNTIL END COMMENT

import os
from shutil import rmtree
import sys
from typing import Any

import adsk.core

from .src.general_imports import APP_NAME, DESCRIPTION, INTERNAL_ID, gm
from .src.Logging import getLogger, logFailure, setupLogger
from .src.UI import (
# Required for absolute imports.
sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from src.Dependencies import resolveDependencies
from src.Logging import logFailure, setupLogger

logger = setupLogger()

try:
# Attempt to import required pip dependencies to verify their installation.
import requests

from src.Proto import (
assembly_pb2,
joint_pb2,
material_pb2,
motor_pb2,
signal_pb2,
types_pb2,
)
except (ImportError, ModuleNotFoundError, BaseException) as error: # BaseException required to catch proto.VersionError
logger.warn(f"Running resolve dependencies with error of:\n{error}")
result = resolveDependencies()
if result:
adsk.core.Application.get().userInterface.messageBox("Installed required dependencies.\nPlease restart Fusion.")


from src import APP_NAME, DESCRIPTION, INTERNAL_ID, gm
from src.UI import (
HUI,
Camera,
ConfigCommand,
Handlers,
Helper,
MarkingMenu,
ShowAPSAuthCommand,
ShowWebsiteCommand,
)
from .src.UI.Toolbar import Toolbar

# END OF RESTRICTION

# Transition: AARD-1721
# Should attempt to fix this ordering scheme within AARD-1741
from .src.APS import APS # isort:skip
from src.UI.Toolbar import Toolbar


@logFailure
def run(_):
def run(_context: dict[str, Any]) -> None:
"""## Entry point to application from Fusion.
Arguments:
**context** *context* -- Fusion context to derive app and UI.
"""
setupLogger()

# Remove all items prior to start just to make sure
unregister_all()
Expand All @@ -48,7 +64,7 @@ def run(_):


@logFailure
def stop(_):
def stop(_context: dict[str, Any]) -> None:
"""## Fusion exit point - deconstructs buttons and handlers
Arguments:
Expand All @@ -63,28 +79,8 @@ def stop(_):

# nm.deleteMe()

logger = getLogger(INTERNAL_ID)
logger.cleanupHandlers()

for file in gm.files:
try:
os.remove(file)
except OSError:
pass

# removes path so that proto files don't get confused

import sys

path = os.path.abspath(os.path.dirname(__file__))

path_proto_files = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "proto", "proto_out"))

if path in sys.path:
sys.path.remove(path)

if path_proto_files in sys.path:
sys.path.remove(path_proto_files)
gm.clear()


@logFailure
Expand Down
14 changes: 14 additions & 0 deletions exporter/SynthesisFusionAddin/mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[mypy]
files = Synthesis.py, src
warn_unused_configs = True
check_untyped_defs = True
warn_unreachable = True
warn_redundant_casts = True
warn_unused_ignores = True
warn_no_return = True
warn_return_any = True
strict = True
ignore_missing_imports = True
follow_imports = skip
disallow_subclassing_any = False
disable_error_code = no-untyped-call
2 changes: 1 addition & 1 deletion exporter/SynthesisFusionAddin/proto/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
md .\proto_out\
@RD /S /Q "./proto_out/__pycache__"
@echo on
protoc -I=../../../mirabuf --python_out=./proto_out ../../../mirabuf/*.proto
protoc -I=../../../mirabuf --python_out=./proto_out --mypy_out=./proto_out ../../../mirabuf/*.proto
@echo off
2 changes: 1 addition & 1 deletion exporter/SynthesisFusionAddin/proto/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rm -rf -v ./proto_out
mkdir ./proto_out
git submodule update --init --recursive
protoc -I=../../../mirabuf --python_out=./proto_out ../../../mirabuf/*.proto
protoc -I=../../../mirabuf --python_out=./proto_out --mypy_out=./proto_out ../../../mirabuf/*.proto
Loading

0 comments on commit 54b9323

Please sign in to comment.