def get_portal_locations(self, obj): actor = StubActor(1) arb_there = self._get_arb(actor, obj, is_mirrored=False) boundary_condition = arb_there.get_boundary_conditions(actor) there_entry = Transform.concatenate( boundary_condition.pre_condition_transform, obj.transform) there_entry = Location(there_entry.translation, orientation=there_entry.orientation, routing_surface=obj.routing_surface) there_exit = Transform.concatenate( boundary_condition.post_condition_transform, obj.transform) there_exit = Location(there_exit.translation, orientation=there_exit.orientation, routing_surface=obj.routing_surface) arb_back = self._get_arb(actor, obj, is_mirrored=True) boundary_condition = arb_back.get_boundary_conditions(actor) back_entry = Transform.concatenate( boundary_condition.pre_condition_transform, obj.transform) back_entry = Location(back_entry.translation, orientation=back_entry.orientation, routing_surface=obj.routing_surface) back_exit = Transform.concatenate( boundary_condition.post_condition_transform, obj.transform) back_exit = Location(back_exit.translation, orientation=back_exit.orientation, routing_surface=obj.routing_surface) return ((there_entry, there_exit, back_entry, back_exit, 0), )
def get_transforms(self, asm, part): pre_condition_transform = self.pre_condition_transform post_condition_transform = self.post_condition_transform pre_condition_reference_object = asm.get_actor_by_name(self.pre_condition_reference_object_name) if pre_condition_reference_object is not None: pre_obj_transform = pre_condition_reference_object.transform pre_condition_transform = Transform.concatenate(pre_condition_transform, pre_obj_transform) if self.post_condition_reference_object_name is None: return (pre_condition_transform, pre_condition_transform) post_condition_reference_object = asm.get_actor_by_name(self.post_condition_reference_object_name) if post_condition_reference_object is not None: post_obj_transform = post_condition_reference_object.transform post_condition_transform = Transform.concatenate(post_condition_transform, post_obj_transform) return (pre_condition_transform, post_condition_transform)
def get_world_transform(parent, transform, joint_name_or_hash): if parent.is_part: parent_transform = parent.part_owner.transform else: parent_transform = parent.transform if joint_name_or_hash is None: if transform is None: return parent_transform return Transform.concatenate(transform, parent_transform) try: joint_transform = native.animation.get_joint_transform_from_rig(parent.rig, joint_name_or_hash) except (KeyError, ValueError) as e: return parent_transform if transform is None: return Transform.concatenate(joint_transform, parent_transform) local_transform = Transform.concatenate(transform, joint_transform) return Transform.concatenate(local_transform, parent_transform)
def transform(self): if self._joint_transform is None: try: self._joint_transform = get_joint_transform_from_rig( self.rig, ArbElement._BASE_ROOT_STRING) except KeyError: raise KeyError('Unable to find joint {} on {}'.format( ArbElement._BASE_ROOT_STRING, self)) return Transform.concatenate(self._joint_transform, self._location.world_transform)
def get_joint_transform_for_joint(self, joint_name): transform = get_joint_transform_from_rig(self.rig, joint_name) transform = Transform.concatenate(transform, self.transform) return transform
def _get_bone_transform(self): joint_transform = get_joint_transform_from_rig(self._owner.rig, self._bone_name) offset_from_joint = joint_transform.transform_point(self._bone_offset) final_transform = Transform.concatenate(Transform(offset_from_joint), self._owner.transform) return final_transform