Skip to content

Commit

Permalink
feat(properties): add transformation property to display and interact…
Browse files Browse the repository at this point in the history
… with i3d coordinates
  • Loading branch information
NMC-TBone committed Feb 2, 2025
1 parent 2761581 commit 893783a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions i3d_exporter_additionals/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,29 @@ class I3DEA_PG_List(bpy.types.PropertyGroup):
_register, _unregister = bpy.utils.register_classes_factory(classes)


def get_translation(self) -> tuple:
from mathutils import Vector
# blender vs giants coordinate
# x = x, y = z, z = -y
return Vector((self.location[0], self.location[2], -self.location[1]))


def set_translation(self, value) -> None:
self.location = (value[0], -value[2], value[1])


def register() -> None:
_register()
bpy.types.Scene.i3dea = bpy.props.PointerProperty(type=I3DEA_PG_List)
bpy.types.Object.test_translation = bpy.props.FloatVectorProperty(
name="Location",
default=(0, 0, 0),
subtype='TRANSLATION',
size=3,
get=get_translation,
set=set_translation,
precision=3
)


def unregister() -> None:
Expand Down
9 changes: 9 additions & 0 deletions i3d_exporter_additionals/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ class I3DEA_PT_MainPanel(Panel):
def draw(self, context):
giants_i3d, stjerne_i3d = check_i3d_exporter_type()
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False

obj = context.object

if obj:
layout.use_property_split = False
col = layout.column(align=True)
col.prop(obj, "test_translation")
if giants_i3d and stjerne_i3d:
# "Exporter selection" box
layout.label(text="Both Giants & Stjerne I3D exporter is enabled", icon='ERROR')
Expand Down

0 comments on commit 893783a

Please sign in to comment.