Skip to content

Python ufbx API completion plan - #3

Merged
popomore merged 2 commits into
mainfrom
cursor/python-ufbx-api-completion-plan-af8c
Jan 23, 2026
Merged

Python ufbx API completion plan#3
popomore merged 2 commits into
mainfrom
cursor/python-ufbx-api-completion-plan-af8c

Conversation

@popomore

Copy link
Copy Markdown
Owner

Implement full Python API for Light, Camera, Bone, and Texture to enhance 3D asset data access.


Open in Cursor Open in Web

@cursor

cursor Bot commented Jan 22, 2026

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Base automatically changed from feat/axe to main January 22, 2026 15:51
- Extended C wrapper to expose Light, Camera, Bone, and Texture structures
- Implemented full Python bindings in Cython for all four element types
- Added properties to Scene class: lights, cameras, bones, textures
- Added properties to Node class: light, camera, bone
- Updated type hints in .pyi file with complete API signatures
- Added comprehensive tests to verify new functionality
- All tests pass (43 passed, 3 skipped)

Light properties:
- name, color, intensity, local_direction
- type, decay, area_shape, inner_angle, outer_angle
- cast_light, cast_shadows

Camera properties:
- name, projection_mode, resolution, resolution_is_pixels
- field_of_view_deg, field_of_view_tan
- orthographic_extent, orthographic_size
- aspect_ratio, near_plane, far_plane

Bone properties:
- name, radius, relative_length, is_root

Texture properties:
- name, filename, absolute_filename, relative_filename, type

Co-authored-by: sakura9515 <sakura9515@gmail.com>
@cursor
cursor Bot force-pushed the cursor/python-ufbx-api-completion-plan-af8c branch from 41f1c78 to b1128be Compare January 22, 2026 17:39
- Implemented AnimStack, AnimLayer, AnimCurve classes for animation system
- Implemented SkinDeformer, SkinCluster for skinning/rigging
- Implemented BlendDeformer, BlendChannel, BlendShape for blend shapes/morphs
- Implemented Constraint class for node constraints
- Extended C wrapper with 70+ new accessor functions
- Added Scene properties: anim_stacks, anim_curves, skin_deformers, blend_deformers, blend_shapes, constraints
- Updated type hints with complete API signatures
- Added comprehensive test suite for all new classes
- All tests pass (55 passed, 3 skipped)

AnimStack properties:
- name, time_begin, time_end, layers

AnimLayer properties:
- name, weight, weight_is_animated, blended, additive
- compose_rotation, compose_scale

AnimCurve properties:
- name, num_keyframes, min_value, max_value, min_time, max_time

SkinDeformer properties:
- name, clusters

SkinCluster properties:
- name, num_weights

BlendDeformer properties:
- name, channels

BlendChannel properties:
- name, weight

BlendShape properties:
- name, num_offsets

Constraint properties:
- name, type, weight, active

This completes the Python ufbx API coverage with all major element types now fully implemented.

Co-authored-by: sakura9515 <sakura9515@gmail.com>
@popomore
popomore marked this pull request as ready for review January 23, 2026 08:38
@popomore
popomore merged commit 4e2556a into main Jan 23, 2026
5 checks passed
@popomore
popomore deleted the cursor/python-ufbx-api-completion-plan-af8c branch January 23, 2026 08:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a2fe0705b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ufbx/_ufbx.pyx
Comment on lines +585 to +589
def type(self):
"""Light type (LightType enum)"""
if self._scene._closed:
raise RuntimeError("Scene is closed")
return LightType(ufbx_wrapper_light_get_type(self._light))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle volume light enum value

The C enum ufbx_light_type in ufbx-c/ufbx.h includes UFBX_LIGHT_VOLUME (value 4), but LightType only defines 0–3. When a scene contains a volumetric light, Light.type will call LightType(4) and raise ValueError, so accessing the property will crash instead of returning a usable value. Consider adding the missing enum value or a safe fallback for unknown values.

Useful? React with 👍 / 👎.

Comment thread ufbx/_ufbx.pyx
Comment on lines +592 to +596
def decay(self):
"""Light decay mode (LightDecay enum)"""
if self._scene._closed:
raise RuntimeError("Scene is closed")
return LightDecay(ufbx_wrapper_light_get_decay(self._light))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle cubic light decay enum value

The C enum ufbx_light_decay in ufbx-c/ufbx.h includes UFBX_LIGHT_DECAY_CUBIC (value 3), but LightDecay only defines 0–2. If an FBX uses cubic decay, Light.decay will raise ValueError when it constructs LightDecay(3), breaking access for those assets. Add the missing enum value or guard against unknown decay values.

Useful? React with 👍 / 👎.

Comment thread ufbx/_ufbx.pyx
Comment on lines +817 to +821
def type(self):
"""Texture type (TextureType enum)"""
if self._scene._closed:
raise RuntimeError("Scene is closed")
return TextureType(ufbx_wrapper_texture_get_type(self._texture))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Map texture types to ufbx_texture_type values

Texture.type wraps ufbx_texture_type from ufbx-c/ufbx.h, which is defined as FILE/LAYERED/PROCEDURAL/SHADER (values 0–3). The Python TextureType enum only defines DIFFUSE/NORMAL (0–1), so values 2 or 3 will raise ValueError, and even 0/1 are mislabeled. This makes Texture.type unreliable for real scenes. Align the enum with ufbx_texture_type or introduce a separate enum for shader map usage.

Useful? React with 👍 / 👎.

Comment thread ufbx/_ufbx.pyx
Comment on lines +1172 to +1176
def type(self):
"""Constraint type (ConstraintType enum)"""
if self._scene._closed:
raise RuntimeError("Scene is closed")
return ConstraintType(ufbx_wrapper_constraint_get_type(self._constraint))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align constraint enum values with ufbx_constraint_type

ufbx_constraint_type in ufbx-c/ufbx.h starts with UNKNOWN=0, AIM=1, PARENT=2, and includes POSITION/ROTATION/SCALE/SINGLE_CHAIN_IK. The Python ConstraintType only defines AIM=0 and PARENT=1, so Constraint.type mislabels AIM constraints as PARENT and will throw ValueError for most other constraint types. This breaks constraint inspection for many FBX files. The enum should mirror the C values or guard unknowns.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants