Skip to content

Commit

Permalink
Spec updates; renamed members, case normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
eoineoineoin committed Nov 1, 2023
1 parent 3698d60 commit e0bc410
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def _generateJointData(self, node, glNode, export_settings):
linLimit.min_limit = joint.limit_lin_x_lower
linLimit.max_limit = joint.limit_lin_x_upper
if joint.type == "GENERIC_SPRING" and joint.use_spring_x:
linLimit.spring_constant = joint.spring_stiffness_x
linLimit.spring_stiffness = joint.spring_stiffness_x
linLimit.spring_damping = joint.spring_damping_x
jointDesc.limits.append(linLimit)
if joint.use_limit_lin_y:
Expand All @@ -457,7 +457,7 @@ def _generateJointData(self, node, glNode, export_settings):
linLimit.min_limit = joint.limit_lin_y_lower
linLimit.max_limit = joint.limit_lin_y_upper
if joint.type == "GENERIC_SPRING" and joint.use_spring_y:
linLimit.spring_constant = joint.spring_stiffness_y
linLimit.spring_stiffness = joint.spring_stiffness_y
linLimit.spring_damping = joint.spring_damping_y
jointDesc.limits.append(linLimit)
if joint.use_limit_lin_z:
Expand All @@ -466,7 +466,7 @@ def _generateJointData(self, node, glNode, export_settings):
linLimit.min_limit = joint.limit_lin_z_lower
linLimit.max_limit = joint.limit_lin_z_upper
if joint.type == "GENERIC_SPRING" and joint.use_spring_z:
linLimit.spring_constant = joint.spring_stiffness_z
linLimit.spring_stiffness = joint.spring_stiffness_z
linLimit.spring_damping = joint.spring_damping_z
jointDesc.limits.append(linLimit)
if joint.use_limit_ang_x:
Expand All @@ -475,7 +475,7 @@ def _generateJointData(self, node, glNode, export_settings):
angLimit.min_limit = joint.limit_ang_x_lower
angLimit.max_limit = joint.limit_ang_x_upper
if joint.type == "GENERIC_SPRING" and joint.use_spring_ang_x:
angLimit.spring_constant = joint.spring_stiffness_ang_x
angLimit.spring_stiffness = joint.spring_stiffness_ang_x
angLimit.spring_damping = joint.spring_damping_ang_x
jointDesc.limits.append(angLimit)
if joint.use_limit_ang_y:
Expand All @@ -488,7 +488,7 @@ def _generateJointData(self, node, glNode, export_settings):
angLimit.min_limit = joint.limit_ang_y_lower
angLimit.max_limit = joint.limit_ang_y_upper
if joint.type == "GENERIC_SPRING" and joint.use_spring_ang_y:
angLimit.spring_constant = joint.spring_stiffness_ang_y
angLimit.spring_stiffness = joint.spring_stiffness_ang_y
angLimit.spring_damping = joint.spring_damping_ang_y
jointDesc.limits.append(angLimit)
if joint.use_limit_ang_z:
Expand All @@ -497,7 +497,7 @@ def _generateJointData(self, node, glNode, export_settings):
angLimit.min_limit = joint.limit_ang_z_lower
angLimit.max_limit = joint.limit_ang_z_upper
if joint.type == "GENERIC_SPRING" and joint.use_spring_ang_z:
angLimit.spring_constant = joint.spring_stiffness_ang_z
angLimit.spring_stiffness = joint.spring_stiffness_ang_z
angLimit.spring_damping = joint.spring_damping_ang_z
jointDesc.limits.append(angLimit)

Expand Down Expand Up @@ -525,7 +525,7 @@ def _makeDrives(joint_extra, export_settings) -> Optional[list[JointDrive]]:
drive_mode = getattr(
joint_extra, "%s_%s_drive_mode" % (typeprefix, axisname)
)
isAcceleration = drive_mode == "ACCELERATION"
isAcceleration = drive_mode == "acceleration"

drive = JointDrive(
axIdx, isLinear=(typeprefix == "lin"), isAcceleration=isAcceleration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def gather_import_node_after_hook_2(self, vnode, gltf_node, blender_object, gltf
use_limit = limit.min_limit != None or limit.max_limit != None
minLimit = limit.min_limit if limit.min_limit != None else 0
maxLimit = limit.max_limit if limit.max_limit != None else 0
(spring, damping) = (limit.spring_constant, limit.spring_damping)
(spring, damping) = (limit.spring_stiffness, limit.spring_damping)
X, Y, Z = (0, 2, 1)
if limit.linear_axes != None:
for axIdx in limit.linear_axes:
Expand Down Expand Up @@ -309,10 +309,10 @@ def _populateDrive(

if acceleration:
setattr(
joint_extra, "%s_%s_drive_mode" % (typeprefix, axisname), "ACCELERATION"
joint_extra, "%s_%s_drive_mode" % (typeprefix, axisname), "acceleration"
)
else:
setattr(joint_extra, "%s_%s_drive_mode" % (typeprefix, axisname), "FORCE")
setattr(joint_extra, "%s_%s_drive_mode" % (typeprefix, axisname), "force")

postarget = drive.position_target
if postarget:
Expand Down
26 changes: 13 additions & 13 deletions addons/KHR_rigid_bodies/io/com/gltf2_io_rigid_bodies.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

# Enum values for friction/restitution combine modes
physics_material_combine_types = [
("AVERAGE", "Average", "", 0),
("MINIMUM", "Minimum", "", 1),
("MAXIMUM", "Maximum", "", 2),
("MULTIPLY", "Multiply", "", 3),
("average", "Average", "", 0),
("minimum", "Minimum", "", 1),
("maximum", "Maximum", "", 2),
("multiply", "Multiply", "", 3),
]

physics_drive_mode_types = [
("FORCE", "Force", "", 0),
("ACCELERATION", "Acceleration", "", 1),
("force", "Force", "", 0),
("acceleration", "Acceleration", "", 1),
]


Expand Down Expand Up @@ -278,7 +278,7 @@ class JointLimit:
linear_axes: Optional[list[int]] = None
min_limit: Optional[float] = None
max_limit: Optional[float] = None
spring_constant: Optional[float] = None
spring_stiffness: Optional[float] = None
spring_damping: Optional[float] = None
extensions: Optional[Dict[str, Any]] = None
extras: Any = None
Expand Down Expand Up @@ -309,10 +309,10 @@ def to_dict(self):
)
result["min"] = from_union([from_float, from_none], self.min_limit)
result["max"] = from_union([from_float, from_none], self.max_limit)
result["springConstant"] = from_union(
[from_float, from_none], self.spring_constant
result["stiffness"] = from_union(
[from_float, from_none], self.spring_stiffness
)
result["springDamping"] = from_union(
result["damping"] = from_union(
[from_float, from_none], self.spring_damping
)
result["extensions"] = from_union(
Expand All @@ -333,11 +333,11 @@ def from_dict(obj):
)
limit.min_limit = from_union([from_float, from_none], obj.get("min"))
limit.max_limit = from_union([from_float, from_none], obj.get("max"))
limit.spring_constant = from_union(
[from_float, from_none], obj.get("springConstant")
limit.spring_stiffness = from_union(
[from_float, from_none], obj.get("stiffness")
)
limit.spring_damping = from_union(
[from_float, from_none], obj.get("springDamping")
[from_float, from_none], obj.get("damping")
)
limit.extensions = from_union(
[lambda x: from_dict(lambda x: from_dict(lambda x: x, x), x), from_none],
Expand Down

0 comments on commit e0bc410

Please sign in to comment.