Repository navigation
Mesh Uploader: Parse origin transform from glTF files & add a way to customise the pivot origin option #621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Martin-Pitt
wants to merge
26
commits into
AlchemyViewer:develop
Choose a base branch
from
Martin-Pitt:feature-ui/mesh-uploader-pivot
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
6202424
Add a pivot option to the mesh uploader
Martin-Pitt 7221019
Show the uploader pivot in percent or metres
Martin-Pitt d02c107
Merge branch 'develop' into feature-ui/mesh-uploader-pivot
Martin-Pitt 679e516
Fit the uploader's display options inside their panel
Martin-Pitt 94e2d2d
Give the pivot units their values back
Martin-Pitt ba999ae
Draw the uploader origin as the translate gizmo's arrows
Martin-Pitt b4b6b16
Merge branch 'develop' into feature-ui/mesh-uploader-pivot
Martin-Pitt ded3ab2
Colour the uploader origin's arrows per axis
Martin-Pitt 23f6854
Measure the uploader pivot along the mesh's own axes
Martin-Pitt e0db0c7
Take the uploader pivot from the file by default
Martin-Pitt 274f11e
Lay the pivot modes out in a row
Martin-Pitt 45300ab
Set the pivot spinners beside its modes
Martin-Pitt e19466f
Place uploaded meshes from the region's origin again
Martin-Pitt e25b56a
Measure the pivot's metres without scaling twice
Martin-Pitt 0fded67
Merge branch 'develop' into feature-ui/mesh-uploader-pivot
Martin-Pitt 94aea1d
Hide the uploader origin while skin weights are shown
Martin-Pitt d41e240
Settle the pivot against the data an upload sends
Martin-Pitt cd5ed5a
Guide setting object origins for the uploader's pivot
Martin-Pitt 5c751f8
Show the uploader's Pivot row in the origins guide
Martin-Pitt 23ec905
Count submodels with their root for the pivot, and warn per part
Martin-Pitt 82b3dbe
Hold only the parts that cannot take a pivot
Martin-Pitt b83cdc5
Enable the pivot by instance and show every reason it is held
Martin-Pitt 2c91233
Merge branch 'develop' into feature-ui/mesh-uploader-pivot
Martin-Pitt 10abe5f
Merge branch 'develop' into feature-ui/mesh-uploader-pivot
Martin-Pitt 20f8074
Keep rigged mesh on the default position domain
Martin-Pitt 093903c
Merge remote-tracking branch 'origin/feature-ui/mesh-uploader-pivot' …
Martin-Pitt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Object Origins for Prim-Animated Doors, Hinges and Joints | ||
|
|
||
| ## Why the origin matters | ||
|
|
||
| A prim in Second Life turns about its own position, and a mesh prim's position is the object origin it was uploaded with. Put the origin on the hinge, and a script that turns the door with `llSetLocalRot` swings it on its hinge. Leave it in the middle, and the door spins about its centre. | ||
|
|
||
| Until now the uploader always moved the origin to the middle of the object's bounding box. Doors were built with an invisible extra half, or a script had to move the prim as it turned it. The uploader's **Pivot** option keeps the origin you set in Blender instead. | ||
|
|
||
| ## Setting the origin in Blender | ||
|
|
||
| 1. Apply rotation and scale first: select the object, **Ctrl+A > Rotation & Scale**. | ||
| 2. Put the 3D cursor on the hinge or joint: in Edit Mode select the vertices along the hinge line, then **Shift+S > Cursor to Selected**. | ||
| 3. Back in Object Mode, **Object > Set Origin > Origin to 3D Cursor**. | ||
| 4. Check it: rotate the object (R, then an axis key). It should turn about the hinge, and the orange dot should sit on it. | ||
|
|
||
| - **The origin must lie inside or on the object's bounding box.** The uploader stores it as a point within the box, so an origin outside is moved back to the centre. | ||
| - **Turn about a local axis.** Model the part so the hinge runs along X, Y or Z, so a script needs only one angle. | ||
| - Each part of a linkset has its own origin. An arm needs one per joint: the turret on its vertical axis, each limb on its elbow. | ||
|
|
||
| ## The uploader's Pivot | ||
|
|
||
| The **Pivot** row is on the **Upload options** tab. It has three modes, X/Y/Z spinners beside them, and a status line under the spinners. | ||
|
|
||
|  | ||
|
|
||
| | Mode | The origin goes | Works for | | ||
| | --- | --- | --- | | ||
| | From file (default) | where Blender's origin was, for each object | one object or many | | ||
| | Centre | to the middle of the bounding box, as uploads always did | one object or many | | ||
| | Custom | where you type it in the spinners | a single object only | | ||
|
|
||
| - The spinners show the pivot along the object's own axes, in **percent** of its half size (−100 to 100, 0 = centre) or in **metres**; the dropdown beside them switches the unit. | ||
| - They are editable only in Custom, which starts from the pivot shown when you switch to it. | ||
| - Tick **Origin** under the preview to see the pivot: coloured arrows (X red, Y green, Z blue) drawn at each object's pivot. | ||
| - In a multi-object upload each part keeps its own origin, and its position in the linkset moves with it, so every part lands where it sat in Blender. | ||
|
|
||
| The status line says when the pivot is held at the centre, or when the collision stays centred: | ||
|
|
||
| | Status | Why | Fix | | ||
| | --- | --- | --- | | ||
| | Rigged mesh | rigged mesh is placed by its skeleton | none needed | | ||
| | Physics not analyzed | the sim fits a mesh physics shape to the box until it's analyzed | click **Analyze** on the Physics tab | | ||
| | No physics shape | the part moves to its pivot, but collides with a default hull centred on itself | fine for phantom parts or physics type None; otherwise add a physics shape and analyze it | | ||
|
|
||
| ## Examples and common mistakes | ||
|
|
||
| | Part | Where the origin goes | Turns about | | ||
| | --- | --- | --- | | ||
| | Door | on the hinge edge, halfway up | its vertical axis | | ||
| | Chest lid | on the back edge, along the hinge | the hinge's axis | | ||
| | Arm turret | on the base's centre line | its vertical axis | | ||
| | Arm limb | in the joint at the limb's near end | the joint's axis | | ||
|
|
||
| A limb's joint is often at the very end of the part. That's fine: the origin may sit on the box's edge, just not outside it. | ||
|
|
||
| | You see | Likely cause | | ||
| | --- | --- | | ||
| | The part spins about its middle | the pivot is on Centre, the origin lies outside the box, or the physics isn't analyzed | | ||
| | The spinners read 0 0 0 on From file | Blender's origin was at the middle, or outside the box | | ||
| | The part rotates about the wrong axis | rotation wasn't applied before export | | ||
| | Custom is greyed out | the upload has several objects; Custom is for a single one | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.