Skip to content

Commit

Permalink
Merge pull request #127 from threedworld-mit/rotate_object_by_centroid
Browse files Browse the repository at this point in the history
Added optional parameter use_centroid to rotate_object_by
  • Loading branch information
alters-mit authored Jan 19, 2021
2 parents feee661 + d7f95a8 commit c56bc37
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 21 deletions.
20 changes: 20 additions & 0 deletions Documentation/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@

To upgrade from TDW v1.6 to v1.7, read [this guide](Documentation/v1.6_to_v1.7).

## v1.7.16

### Command API

#### Modified Commands

| Command | Modification |
| ------------------ | --------------------------------------- |
| `rotate_object_by` | Added optional parameter `use_centroid` |

### `tdw` module

#### `Controller`

- Fixed: Crash at start in certain Pyhon environments because there is no version number at the expected position of a string from PyPi.

#### Model Library

- Fixed: The colliders of pipe, torus, and bowl in `models.flex.json` are single convex meshes instead of a group of convex hulls.

## v1.7.15

### Output Data
Expand Down
3 changes: 2 additions & 1 deletion Documentation/api/command_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3099,14 +3099,15 @@ Rotate an object by a given angle around a given axis.
```

```python
{"$type": "rotate_object_by", "angle": 0.125, "id": 1, "axis": "yaw", "is_world": True}
{"$type": "rotate_object_by", "angle": 0.125, "id": 1, "axis": "yaw", "is_world": True, "use_centroid": False}
```

| Parameter | Type | Description | Default |
| --- | --- | --- | --- |
| `"axis"` | Axis | The axis of rotation. | "yaw" |
| `"angle"` | float | The angle of rotation. | |
| `"is_world"` | bool | If true, the object will rotate via "global" directions and angles. If false, the object will rotate locally. | True |
| `"use_centroid"` | bool | If true, rotate around the centroid of the object. If false, rotate around the bottom-center position of the object. This overrides is_world | False |
| `"id"` | int | The unique object ID. | |

#### Axis
Expand Down
2 changes: 1 addition & 1 deletion Python/setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
from pathlib import Path

__version__ = "1.7.15.0"
__version__ = "1.7.16.0"
readme_path = Path('../README.md')
if readme_path.exists():
long_description = readme_path.read_text(encoding='utf-8')
Expand Down
18 changes: 9 additions & 9 deletions Python/tdw/metadata_libraries/models_flex.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
}
],
"urls": {
"Darwin": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/osx/2019.2/bowl",
"Linux": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/linux/2019.2/bowl",
"Windows": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/windows/2019.2/bowl"
"Darwin": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/osx/2019.4/bowl",
"Linux": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/linux/2019.4/bowl",
"Windows": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/windows/2019.4/bowl"
},
"wcategory": "flex_primitive",
"wnid": ""
Expand Down Expand Up @@ -562,9 +562,9 @@
}
],
"urls": {
"Darwin": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/osx/2019.2/pipe",
"Linux": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/linux/2019.2/pipe",
"Windows": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/windows/2019.2/pipe"
"Darwin": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/osx/2019.4/pipe",
"Linux": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/linux/2019.4/pipe",
"Windows": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/windows/2019.4/pipe"
},
"wcategory": "flex_primitive",
"wnid": ""
Expand Down Expand Up @@ -846,9 +846,9 @@
}
],
"urls": {
"Darwin": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/osx/2019.2/torus",
"Linux": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/linux/2019.2/torus",
"Windows": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/windows/2019.2/torus"
"Darwin": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/osx/2019.4/torus",
"Linux": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/linux/2019.4/torus",
"Windows": "https://tdw-public.s3.amazonaws.com/models/flex_primitives/windows/2019.4/torus"
},
"wcategory": "flex_primitive",
"wnid": ""
Expand Down
16 changes: 7 additions & 9 deletions Python/tdw/release/pypi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from json import loads
from requests import get
from typing import List
from subprocess import Popen, PIPE
import re
from pkg_resources import get_distribution


Expand Down Expand Up @@ -40,13 +40,11 @@ def _get_pypi_releases() -> List[str]:
:return: A list of all available PyPi releases.
"""

# Get an error from PyPi which will list all available versions.
p = Popen(["pip3", "install", "tdw=="], stderr=PIPE, stdout=PIPE)
p.wait()
stdout, stderr = p.communicate()
# From the list of available versions, get the last one (the most recent).
versions = re.search(r"\(from versions: (.*)\)", stderr.decode("utf-8")).group(1).split(",")
return [v.strip() for v in versions]
resp = get("https://pypi.org/pypi/tdw/json")
data = loads(resp.content)
versions = list(data["releases"].keys())
versions.sort(key=lambda s: list(map(int, s.split('.'))))
return versions

@staticmethod
def get_pypi_version(truncate: bool = False) -> str:
Expand Down
2 changes: 1 addition & 1 deletion Python/tdw/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.7.15"
__version__ = "1.7.16"

0 comments on commit c56bc37

Please sign in to comment.