Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
offset working in appearance but not adjjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
ggoneiESS committed Oct 12, 2023
1 parent cb9fb09 commit f2bf8ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions nexus_constructor/json/transformation_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,11 @@ def _create_transformations(self, json_transformations: list):
values=values,
offset_vector=QVector3D(*offset_vector)
)
offset = self._find_attribute_in_list(CommonAttrs.OFFSET, name, attributes)
if offset:
transform.attributes.set_attribute_value(
CommonAttrs.OFFSET, offset, ValueTypes.FLOAT
)
# offset = self._find_attribute_in_list(CommonAttrs.OFFSET, name, attributes)
# if offset:
# transform.attributes.set_attribute_value(
# CommonAttrs.OFFSET, offset, ValueTypes.FLOAT
# )
if depends_on not in DEPENDS_ON_IGNORE:
depends_on_id = TransformId(
*get_component_and_transform_name(depends_on)
Expand Down
10 changes: 5 additions & 5 deletions nexus_constructor/model/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,22 @@ def qmatrix(self) -> QMatrix4x4:
"""
transform = Qt3DCore.QTransform()
transform.matrix()
offset = self.attributes.get_attribute_value(CommonAttrs.OFFSET)
if not offset:
offset = 0.0
offset = QVector3D() # self.attributes.get_attribute_value(CommonAttrs.OFFSET)
# if not offset:
# offset = 0.0
if self.transform_type == TransformationType.ROTATION:
# noramlise offset to get axis, then apply a rotation offset first to translate it, and then apply rotation
# try setTranslation (to modify ({}.4))
# ORRRR
# self.vector + offset
quaternion = transform.fromAxisAndAngle(
self.vector, (self.ui_value + offset) * self._ui_scale_factor
self.vector, self.ui_value * self._ui_scale_factor #(self.ui_value + offset) * self._ui_scale_factor
)
transform.setRotation(quaternion)
elif self.transform_type == TransformationType.TRANSLATION:
transform.setTranslation(
self.vector.normalized()
* (self.ui_value + offset)
* (self.ui_value) # + offset)
* self._ui_scale_factor
)
else:
Expand Down
10 changes: 5 additions & 5 deletions nexus_constructor/transformation_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ def _fill_in_existing_fields(self, current_vector):
self.transformation.values, self.transformation_frame.magnitude_widget
)
self.transformation_frame.magnitude_widget.units = self.transformation.units
offset = QVector3D(1, 2, 3) # self.transformation.attributes.get_attribute_value(CommonAttrs.OFFSET)
if offset:
self.transformation_frame.x_spinbox_offset.setValue(offset.x())
self.transformation_frame.y_spinbox_offset.setValue(offset.y())
self.transformation_frame.z_spinbox_offset.setValue(offset.z())
offset = self.transformation.attributes.get_attribute_value(CommonAttrs.OFFSET)
if offset is not None:
self.transformation_frame.x_spinbox_offset.setValue(offset[0])
self.transformation_frame.y_spinbox_offset.setValue(offset[1])
self.transformation_frame.z_spinbox_offset.setValue(offset[2])
self.update_depends_on_ui()

def disable(self):
Expand Down

0 comments on commit f2bf8ff

Please sign in to comment.