Repository navigation
Send non-uniform scale and quaternions natively on gem API 0.5.0 - #36
Merged
Merged
Conversation
The AiCompanion gem's API 0.5.0 (shipping in 0.6.0) takes set_transform's scale as [x, y, z], applying a non-uniform scale through the engine's Non-uniform Scale component, and takes a rotation as rotation_quaternion. set_transform now asks the gem for its API version when a rotation or a non-uniform scale is given (cached on the connection, forgotten when it closes) and on 0.5.0+ sends both natively: no Euler conversion, no editor Python detour for rotations at a gimbal pole, and non-uniform scale works, in secure mode too. Older gems keep the previous behavior: Euler degrees, editor Python at a gimbal pole, and a non-uniform scale refused. get_transform reports the effective scale (the Transform's uniform scale times the Non-uniform Scale component) with uniform_scale and non_uniform_scale beside it. GetScale answers (0, 0, 0) rather than None on an entity without the component (seen live), so a zero vector reads as no component.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
The AiCompanion gem's API 0.5.0 (gem 0.6.0) adds two things to its native
set_transform:scaleas[x, y, z]: the gem applies a non-uniform scale with the engine's Non-uniform Scale component, the same call the Transform component's "Add non-uniform scale" button uses, in one undo step.rotation_quaternion.The editor Python API cannot add that component (tried live:
editor.AddNonUniformScaleComponentreturnsNoneand adds nothing), so a native path is the only way to get real non-uniform scale.Changes
set_transformasks the gem for its API version when a rotation or a non-uniform scale is given. The version is cached on the connection and forgotten when it closes, so position-only and uniform-scale calls cost no extra round trip.non_uniform_scale_unsupported.get_transformreports the effectivescale(the Transform's uniform scale times the component) withuniform_scaleandnon_uniform_scalebeside it. Its editor-PythonGetScaleanswers(0, 0, 0), notNone, without the component (seen live), so a zero vector reads as no component.Tests
Unit: the API 0.5.0 request shape (quaternion and array scale; a uniform scale still sent as a number), a native refusal, the version cache (asked once, forgotten on close; no gem means no version), and
get_transform's zero-vector and component cases. Existing tests now run as an API 0.4.0 gem.Live, the 0.6.0 release gate: AiCompanion gem release/0.6.0 at
54798a4(gem 0.6.0, API 0.5.0), full suite 56 of 56, run twice:[50, 50, 1]lands natively, andget_transformreports scale[50, 50, 1], uniform 1, component[50, 50, 1];[2, 2, 2]resets the component;[0.001, 1, 1]is refused (validation_failed);On older gems the same live tests assert the refusal instead.
Docs
The tool reference, the architecture doc,
CLAUDE.mdand the CHANGELOG describe both paths.