def generate_routing_goals_for_polygon(sim,
                                       polygon,
                                       polygon_surface,
                                       scoring_functions=None,
                                       orientation_restrictions=None,
                                       object_ids_to_ignore=None,
                                       flush_planner=False,
                                       sim_location_score_offset=0.0,
                                       add_sim_location_as_goal=True,
                                       los_reference_pt=None,
                                       score_density=2.5,
                                       max_points=100,
                                       min_score_to_ignore_outer_penalty=2,
                                       target_object=2,
                                       target_object_id=0,
                                       even_coverage_step=3,
                                       single_goal_only=False,
                                       los_routing_context=None,
                                       all_blocking_edges_block_los=False):
    yield_to_irq()
    if los_routing_context is None:
        los_routing_context = sim.routing_context
    return _placement.generate_routing_goals_for_polygon(
        sim.routing_location, polygon, polygon_surface, scoring_functions,
        orientation_restrictions, object_ids_to_ignore, sim.routing_context,
        flush_planner, sim_location_score_offset, add_sim_location_as_goal,
        los_reference_pt, score_density, max_points,
        min_score_to_ignore_outer_penalty, target_object_id,
        even_coverage_step, single_goal_only, los_routing_context,
        all_blocking_edges_block_los)
Beispiel #2
0
def generate_routing_goals_for_polygon(sim,
                                       polygon,
                                       polygon_surface,
                                       scoring_functions=None,
                                       orientation_restrictions=None,
                                       object_ids_to_ignore=None,
                                       flush_planner=False,
                                       sim_location_score_offset=0.0,
                                       add_sim_location_as_goal=True,
                                       los_reference_pt=None,
                                       score_density=2.5,
                                       max_points=100,
                                       min_score_to_ignore_outer_penalty=2,
                                       target_object=2,
                                       target_object_id=0,
                                       even_coverage_step=3,
                                       single_goal_only=False,
                                       los_routing_context=None,
                                       all_blocking_edges_block_los=False):
    yield_to_irq()
    if los_routing_context is None:
        los_routing_context = sim.routing_context
    return _placement.generate_routing_goals_for_polygon(
        sim.routing_location, polygon, polygon_surface, scoring_functions,
        orientation_restrictions, object_ids_to_ignore, sim.routing_context,
        flush_planner, sim_location_score_offset, add_sim_location_as_goal,
        los_reference_pt, score_density, max_points,
        min_score_to_ignore_outer_penalty, target_object_id,
        even_coverage_step, single_goal_only, los_routing_context,
        all_blocking_edges_block_los)
    def get_score(cls, resolver: Resolver) -> int:
        """get_score(resolver)

        Calculate the score.
        """
        try:
            yield_to_irq()
            cls.get_verbose_log().format_with_message('Retrieving score.',
                                                      class_name=cls.__name__)
            source_sim = resolver.get_participant(ParticipantType.Actor)
            if source_sim is None or not CommonTypeUtils.is_sim_or_sim_info(
                    source_sim):
                cls.get_verbose_log().format_with_message(
                    'Failed, the Source was not a Sim.', source=source_sim)
                return cls.get_default_score()
            source_sim_info = CommonSimUtils.get_sim_info(source_sim)
            interaction_instance = resolver.interaction or getattr(
                resolver, 'affordance', None)
            score = cls.calculate_score(resolver, source_sim_info,
                                        interaction_instance)
            cls.get_verbose_log().format_with_message(
                'Retrieved score for Sim.',
                source_sim=source_sim_info,
                score=score)
            return score
        except Exception as ex:
            cls.get_verbose_log().error(
                'Error occurred while retrieving score.', exception=ex)
        return cls.get_default_score()
Beispiel #4
0
def generate_routing_goals_for_polygon(sim,
                                       polygon,
                                       polygon_surface,
                                       orientation_restrictions=None,
                                       object_ids_to_ignore=None,
                                       flush_planner=False,
                                       sim_location_bonus=0.0,
                                       add_sim_location_as_goal=True,
                                       los_reference_pt=None,
                                       max_points=100,
                                       ignore_outer_penalty_amount=2,
                                       target_object=2,
                                       target_object_id=0,
                                       even_coverage_step=2,
                                       single_goal_only=False,
                                       los_routing_context=None,
                                       all_blocking_edges_block_los=False,
                                       provided_points=(),
                                       min_water_depth=None,
                                       max_water_depth=None,
                                       terrain_tags=None):
    yield_to_irq()
    routing_context = sim.get_routing_context()
    if los_routing_context is None:
        los_routing_context = routing_context
    return _placement.generate_routing_goals_for_polygon(
        sim.routing_location, polygon, polygon_surface, None,
        orientation_restrictions, object_ids_to_ignore, routing_context,
        flush_planner, -sim_location_bonus, add_sim_location_as_goal,
        los_reference_pt, 2.5, max_points, ignore_outer_penalty_amount,
        target_object_id, even_coverage_step, single_goal_only,
        los_routing_context, all_blocking_edges_block_los, provided_points,
        min_water_depth, max_water_depth, terrain_tags)
Beispiel #5
0
 def get_score(cls, resolver):
     yield_to_irq()
     target = resolver.get_participant(
         ParticipantType.TargetSim) or resolver.get_participant(
             ParticipantType.Listeners)
     if has_sim_permission_for_nudity(target)[0]:
         return 100
     return 0
 def _on_sim_posture_event(self, change, dest_state, track, old_posture, new_posture):
     if not PostureTrack.is_body(track):
         return
     yield_to_irq()
     posture = new_posture or old_posture
     sim = posture.sim
     if change == PostureEvent.TRANSITION_START:
         if isinstance(self._footprints.get(sim), PolygonFootprint):
             sim.routing_context.remove_footprint_contour_override(self._footprints[sim].footprint_id)
             self._footprints[sim] = FP_REMOVED_BY_POSTURE
     elif change == PostureEvent.TRANSITION_COMPLETE and self._footprints.get(sim) == FP_REMOVED_BY_POSTURE:
         self._add_user_footprint(sim)
def generate_content_set(sim, super_affordance, super_interaction, context, potential_targets=(), include_failed_aops_with_tooltip=False, push_super_on_prepare=False, check_posture_compatibility=False, aop_kwargs=frozendict()):
    si_or_sa = super_interaction if super_interaction is not None else super_affordance
    if not si_or_sa.has_affordances():
        return ()
    yield_to_irq()
    phase_index = None
    if super_interaction and not _mixer_name_list:
        phase_index = super_interaction.phase_index
    valid = collections.defaultdict(list)
    if gsi_handlers.content_set_handlers.archiver.enabled:
        gsi_considered = {}
    else:
        gsi_considered = None
    if check_posture_compatibility and sim is not None and sim.posture.target is not None:
        show_posture_incompatible_icon = True
    else:
        show_posture_incompatible_icon = False
    if not si_or_sa.is_social or potential_targets:
        with sims4.callback_utils.invoke_enter_exit_callbacks(sims4.callback_utils.CallbackEvent.CONTENT_SET_GENERATE_ENTER, sims4.callback_utils.CallbackEvent.CONTENT_SET_GENERATE_EXIT):
            target_to_posture_icon_info = {}
            for affordance in si_or_sa.all_affordances_gen(phase_index=phase_index):
                if affordance.is_super:
                    logger.error('Content set contains a super affordance: {} has {}', si_or_sa, affordance)
                targets = _test_affordance_and_get_targets(affordance, potential_targets, sim, considered=gsi_considered)
                if targets is None:
                    pass
                for target in targets:
                    valid_aops_gen = get_valid_aops_gen(target, affordance, super_affordance, super_interaction, context, include_failed_aops_with_tooltip, push_super_on_prepare=push_super_on_prepare, considered=gsi_considered, aop_kwargs=aop_kwargs)
                    for (aop, test_result) in valid_aops_gen:
                        if not aop.affordance.is_super:
                            aop_show_posture_incompatible_icon = False
                            if show_posture_incompatible_icon:
                                aop_show_posture_incompatible_icon = show_posture_incompatible_icon
                                if target not in target_to_posture_icon_info:
                                    if aop.compatible_with_current_posture_state(sim):
                                        aop_show_posture_incompatible_icon = False
                                    target_to_posture_icon_info[target] = aop_show_posture_incompatible_icon
                                else:
                                    aop_show_posture_incompatible_icon = target_to_posture_icon_info[target]
                            aop.show_posture_incompatible_icon = aop_show_posture_incompatible_icon
                            mixer_weight = aop.affordance.calculate_autonomy_weight(sim)
                        else:
                            mixer_weight = 0
                        valid[affordance].append((mixer_weight, aop, test_result))
    if sim.posture.source_interaction is si_or_sa:
        for buff in sim.Buffs:
            buff_aops = get_buff_aops(sim, buff, sim.animation_interaction, context, potential_targets=potential_targets, gsi_considered=gsi_considered)
            while buff_aops:
                valid.update(buff_aops)
    if valid:
        return list(_select_affordances_gen(sim, super_affordance, valid, show_posture_incompatible_icon, gsi_considered))
    return ()
Beispiel #8
0
 def get_score(cls, resolver):
     yield_to_irq()
     sim = resolver.get_participant(ParticipantType.Actor)
     target = resolver.get_participant(
         ParticipantType.TargetSim) or resolver.get_participant(
             ParticipantType.Listeners)
     if sim is None or target is None:
         return 0
     pre_sex_handler = sim_ev(sim).active_pre_sex_handler
     if pre_sex_handler is not None and pre_sex_handler.is_failure_sex():
         return 0
     if pre_sex_handler is not None and pre_sex_handler.is_success_sex():
         return 1000
     return get_test_relationship_score((sim, target))
 def _on_sim_posture_event(self, change, dest_state, track, old_posture,
                           new_posture):
     if not PostureTrack.is_body(track):
         return
     yield_to_irq()
     posture = new_posture or old_posture
     sim = posture.sim
     if change == PostureEvent.TRANSITION_START:
         if isinstance(self._footprints.get(sim), PolygonFootprint):
             sim.routing_context.remove_footprint_contour_override(
                 self._footprints[sim].footprint_id)
             self._footprints[sim] = FP_REMOVED_BY_POSTURE
     elif change == PostureEvent.TRANSITION_COMPLETE and self._footprints.get(
             sim) == FP_REMOVED_BY_POSTURE:
         self._add_user_footprint(sim)
Beispiel #10
0
 def get_score(cls, resolver):
     yield_to_irq()
     sim = resolver.get_participant(ParticipantType.Actor)
     if has_sim_permission_for_nudity(sim)[0]:
         return 100
     return 0
Beispiel #11
0
 def _trigger_interaction_complete_test_event(self):
     yield_to_irq()
     super()._trigger_interaction_complete_test_event()
     self._remove_target_event_auto_update()
Beispiel #12
0
 def apply_operations(self):
     for loot_action in self._loot_actions:
         yield_to_irq()
         loot_action.apply_to_resolver(self._resolver)
Beispiel #13
0
 def apply_operations(self):
     resolver = self._interaction.get_resolver()
     for loot_action in self._loot_actions:
         yield_to_irq()
         loot_action.apply_to_resolver(resolver)
 def _trigger_interaction_complete_test_event(self):
     yield_to_irq()
     super()._trigger_interaction_complete_test_event()
     self._remove_target_event_auto_update()
Beispiel #15
0
 def _create_containment_slot_data_list(self, key, actor, actor_name, to_state_name, from_state_name, posture, entry, verbose_logging):
     cache_containment_slot_data_list = True
     param_sequence_list = self._get_param_sequences_for_cache(actor, actor_name, to_state_name, from_state_name, posture)
     boundary_to_params = {}
     for param_sequence in param_sequence_list:
         self.set_param_sequence(param_sequence)
         yield_to_irq()
         if verbose_logging:
             logger.warn('  Setting parameter list on ASM:')
             for (key, value) in param_sequence.items():
                 logger.warn('    {}:\t{}', key, value)
         boundary = self.get_boundary_conditions(actor, to_state_name, from_state_name)
         boundary.debug_info = None
         pre_condition_reference_object_name = self.get_actor_name_from_id(boundary.pre_condition_reference_object_id)
         post_condition_reference_object_name = self.get_actor_name_from_id(boundary.post_condition_reference_object_id)
         if verbose_logging:
             logger.warn('    Pre conditions')
             logger.warn('      Object: {}', pre_condition_reference_object_name)
             logger.warn('      Translation: {}', boundary.pre_condition_transform.translation)
             logger.warn('      Orientation: {}', boundary.pre_condition_transform.orientation)
             logger.warn('    Post conditions')
             logger.warn('      Object: {}', post_condition_reference_object_name)
             logger.warn('      Translation: {}', boundary.post_condition_transform.translation)
             logger.warn('      Orientation: {}', boundary.post_condition_transform.orientation)
         required_slots = []
         currently_set_actor_names = self._get_all_set_actor_names()
         if boundary.required_slots:
             for required_slot in boundary.required_slots:
                 pre_condition_surface_child_id = required_slot[0]
                 pre_condition_surface_object_id = required_slot[1]
                 pre_condition_surface_child_name = self.get_actor_name_from_id(pre_condition_surface_child_id)
                 pre_condition_surface_object_name = self.get_actor_name_from_id(pre_condition_surface_object_id)
                 if pre_condition_surface_child_name and pre_condition_surface_object_name:
                     required_slots.append((pre_condition_surface_child_name, pre_condition_surface_object_name, required_slot[2]))
                 else:
                     cache_containment_slot_data_list = False
                     self._log_bc_error(logger.error, currently_set_actor_names, key, 'missing parent or child object', "The parent or child in Maya isn't one of the following actors:")
         if not required_slots and boundary.pre_condition_reference_object_id is None:
             pass
         if boundary.pre_condition_reference_object_id is not None and pre_condition_reference_object_name is None:
             pass
         for (boundary_existing, params_list) in boundary_to_params.items():
             while pre_condition_reference_object_name == boundary_existing.pre_condition_reference_object_name and (post_condition_reference_object_name == boundary_existing.post_condition_reference_object_name and (self.transform_almost_equal_2d(boundary.pre_condition_transform, boundary_existing.pre_condition_transform) and self.transform_almost_equal_2d(boundary.post_condition_transform, boundary_existing.post_condition_transform))) and required_slots == boundary_existing.required_slots:
                 params_list.append(param_sequence)
                 break
         boundary_relative = self.BoundaryConditionRelative(pre_condition_reference_object_name, boundary.pre_condition_transform, post_condition_reference_object_name, boundary.post_condition_transform, required_slots, boundary.debug_info)
         boundary_to_params[boundary_relative] = [param_sequence]
     if verbose_logging:
         logger.warn('  Boundary -> Param Sequences')
         for (key, value) in boundary_to_params.items():
             logger.warn('    {}', key)
             for param_sequence in value:
                 logger.warn('      {}', param_sequence)
     boundary_list = []
     if len(boundary_to_params) > 0:
         if len(boundary_to_params) == 1:
             boundary_list.append((boundary_to_params.popitem()[0], [{}]))
         else:
             boundary_param_sets = partition_boundary_on_params(boundary_to_params)
             for (boundary, param_set) in boundary_param_sets.items():
                 boundary_params_list_minimal = {frozendict({k: v for (k, v) in boundary_params.items() if k in param_set}) for boundary_params in boundary_to_params[boundary]}
                 boundary_list.append((boundary, boundary_params_list_minimal))
     relative_object_name = None
     containment_slot_data_list = []
     for (boundary_condition, slot_params_list) in boundary_list:
         relative_object_name_key = boundary_condition.pre_condition_reference_object_name or boundary_condition.post_condition_reference_object_name
         if entry:
             if boundary_condition.post_condition_reference_object_name is not None:
                 containment_transform = boundary_condition.post_condition_transform
             else:
                 containment_transform = boundary_condition.pre_condition_transform
         else:
             containment_transform = boundary_condition.pre_condition_transform
         for (containment_transform_existing, slots_to_params) in containment_slot_data_list:
             while self.transform_almost_equal_2d(containment_transform, containment_transform_existing):
                 slots_to_params.append((boundary_condition, slot_params_list))
                 break
         containment_slot_data_list.append((containment_transform, [(boundary_condition, slot_params_list)]))
     if cache_containment_slot_data_list:
         self._bc_cache[key] = tuple(containment_slot_data_list)
     return containment_slot_data_list
 def get_score(cls, resolver):
     yield_to_irq()
     return sum(test_pair.score for test_pair in cls._scores if resolver(test_pair.test))
def generate_content_set(sim,
                         super_affordance,
                         super_interaction,
                         context,
                         potential_targets=(),
                         include_failed_aops_with_tooltip=False,
                         push_super_on_prepare=False,
                         check_posture_compatibility=False,
                         aop_kwargs=frozendict()):
    si_or_sa = super_interaction if super_interaction is not None else super_affordance
    if not si_or_sa.has_affordances():
        return ()
    yield_to_irq()
    phase_index = None
    if super_interaction and not _mixer_name_list:
        phase_index = super_interaction.phase_index
    valid = collections.defaultdict(list)
    if gsi_handlers.content_set_handlers.archiver.enabled:
        gsi_considered = {}
    else:
        gsi_considered = None
    if check_posture_compatibility and sim is not None and sim.posture.target is not None:
        show_posture_incompatible_icon = True
    else:
        show_posture_incompatible_icon = False
    if not si_or_sa.is_social or potential_targets:
        with sims4.callback_utils.invoke_enter_exit_callbacks(
                sims4.callback_utils.CallbackEvent.CONTENT_SET_GENERATE_ENTER,
                sims4.callback_utils.CallbackEvent.CONTENT_SET_GENERATE_EXIT):
            target_to_posture_icon_info = {}
            for affordance in si_or_sa.all_affordances_gen(
                    phase_index=phase_index):
                if affordance.is_super:
                    logger.error(
                        'Content set contains a super affordance: {} has {}',
                        si_or_sa, affordance)
                targets = _test_affordance_and_get_targets(
                    affordance,
                    potential_targets,
                    sim,
                    considered=gsi_considered)
                if targets is None:
                    pass
                for target in targets:
                    valid_aops_gen = get_valid_aops_gen(
                        target,
                        affordance,
                        super_affordance,
                        super_interaction,
                        context,
                        include_failed_aops_with_tooltip,
                        push_super_on_prepare=push_super_on_prepare,
                        considered=gsi_considered,
                        aop_kwargs=aop_kwargs)
                    for (aop, test_result) in valid_aops_gen:
                        if not aop.affordance.is_super:
                            aop_show_posture_incompatible_icon = False
                            if show_posture_incompatible_icon:
                                aop_show_posture_incompatible_icon = show_posture_incompatible_icon
                                if target not in target_to_posture_icon_info:
                                    if aop.compatible_with_current_posture_state(
                                            sim):
                                        aop_show_posture_incompatible_icon = False
                                    target_to_posture_icon_info[
                                        target] = aop_show_posture_incompatible_icon
                                else:
                                    aop_show_posture_incompatible_icon = target_to_posture_icon_info[
                                        target]
                            aop.show_posture_incompatible_icon = aop_show_posture_incompatible_icon
                            mixer_weight = aop.affordance.calculate_autonomy_weight(
                                sim)
                        else:
                            mixer_weight = 0
                        valid[affordance].append(
                            (mixer_weight, aop, test_result))
    if sim.posture.source_interaction is si_or_sa:
        for buff in sim.Buffs:
            buff_aops = get_buff_aops(sim,
                                      buff,
                                      sim.animation_interaction,
                                      context,
                                      potential_targets=potential_targets,
                                      gsi_considered=gsi_considered)
            while buff_aops:
                valid.update(buff_aops)
    if valid:
        return list(
            _select_affordances_gen(sim, super_affordance, valid,
                                    show_posture_incompatible_icon,
                                    gsi_considered))
    return ()
Beispiel #18
0
 def get_score(cls, resolver):
     yield_to_irq()
     return sum(test_pair.score for test_pair in cls._scores
                if resolver(test_pair.test))
Beispiel #19
0
def generate_content_set(sim,
                         super_affordance,
                         super_interaction,
                         context,
                         potential_targets=(),
                         scoring_gsi_handler=None,
                         include_failed_aops_with_tooltip=False,
                         push_super_on_prepare=False,
                         mixer_interaction_group=DEFAULT,
                         check_posture_compatibility=False,
                         aop_kwargs=frozendict()):
    si_or_sa = super_interaction if super_interaction is not None else super_affordance
    if not si_or_sa.has_affordances():
        return ()
    else:
        yield_to_irq()
        phase_index = None
        if super_interaction:
            if not _mixer_name_list:
                phase_index = super_interaction.phase_index
        valid = collections.defaultdict(list)
        if gsi_handlers.content_set_handlers.archiver.enabled:
            gsi_considered = {}
        else:
            gsi_considered = None
        if check_posture_compatibility and sim is not None and sim.posture.posture_type != postures.stand.StandSuperInteraction.STAND_POSTURE_TYPE:
            show_posture_incompatible_icon = True
        else:
            show_posture_incompatible_icon = False
        if not si_or_sa.is_social or potential_targets:
            for_pie_menu = context.source == InteractionContext.SOURCE_PIE_MENU
            with sims4.callback_utils.invoke_enter_exit_callbacks(
                    sims4.callback_utils.CallbackEvent.
                    CONTENT_SET_GENERATE_ENTER, sims4.callback_utils.
                    CallbackEvent.CONTENT_SET_GENERATE_EXIT):
                target_to_posture_icon_info = {}
                for affordance in si_or_sa.all_affordances_gen(
                        context=context, phase_index=phase_index):
                    if affordance.is_super:
                        logger.error(
                            'Content set contains a super affordance: {} has {}',
                            si_or_sa, affordance)
                    if for_pie_menu and not affordance.allow_user_directed:
                        if gsi_considered is not None:
                            gsi_considered[affordance] = {
                                'affordance': str(affordance),
                                'target': 'Skipped look up',
                                'test': 'Not allowed user directed'
                            }
                            if mixer_interaction_group is not DEFAULT and affordance.sub_action.mixer_group != mixer_interaction_group:
                                continue
                            targets = _test_affordance_and_get_targets(
                                affordance,
                                super_interaction,
                                potential_targets,
                                sim,
                                considered=gsi_considered)
                            if targets is None:
                                continue
                            if not include_failed_aops_with_tooltip and len(
                                    targets
                            ) >= MINIMUM_TARGETS_TO_TEST_AFFORDANCE_EARLY:
                                resolver = AffordanceResolver(affordance, sim)
                                if affordance.test_globals.run_tests(
                                        resolver,
                                        skip_safe_tests=False,
                                        search_for_tooltip=False):
                                    if not affordance.tests.run_tests(
                                            resolver,
                                            skip_safe_tests=False,
                                            search_for_tooltip=False):
                                        continue
                                    if context.source == InteractionContext.SOURCE_AUTONOMY and not affordance.test_autonomous.run_tests(
                                            resolver,
                                            skip_safe_tests=False,
                                            search_for_tooltip=False):
                                        continue
                                    for target in targets:
                                        valid_aops_gen = get_valid_aops_gen(
                                            target,
                                            affordance,
                                            super_affordance,
                                            super_interaction,
                                            context,
                                            include_failed_aops_with_tooltip,
                                            push_super_on_prepare=
                                            push_super_on_prepare,
                                            considered=gsi_considered,
                                            aop_kwargs=aop_kwargs)
                                        for (aop,
                                             test_result) in valid_aops_gen:
                                            if not aop.affordance.is_super:
                                                aop_show_posture_incompatible_icon = False
                                                if show_posture_incompatible_icon:
                                                    aop_show_posture_incompatible_icon = show_posture_incompatible_icon
                                                    if target not in target_to_posture_icon_info:
                                                        if aop.compatible_with_current_posture_state(
                                                                sim):
                                                            aop_show_posture_incompatible_icon = False
                                                        target_to_posture_icon_info[
                                                            target] = aop_show_posture_incompatible_icon
                                                    else:
                                                        aop_show_posture_incompatible_icon = target_to_posture_icon_info[
                                                            target]
                                                aop.show_posture_incompatible_icon = aop_show_posture_incompatible_icon
                                                mixer_weight = aop.affordance.calculate_autonomy_weight(
                                                    sim)
                                            else:
                                                mixer_weight = 0
                                            valid[affordance].append(
                                                (mixer_weight, aop,
                                                 test_result))
                            else:
                                for target in targets:
                                    valid_aops_gen = get_valid_aops_gen(
                                        target,
                                        affordance,
                                        super_affordance,
                                        super_interaction,
                                        context,
                                        include_failed_aops_with_tooltip,
                                        push_super_on_prepare=
                                        push_super_on_prepare,
                                        considered=gsi_considered,
                                        aop_kwargs=aop_kwargs)
                                    for (aop, test_result) in valid_aops_gen:
                                        if not aop.affordance.is_super:
                                            aop_show_posture_incompatible_icon = False
                                            if show_posture_incompatible_icon:
                                                aop_show_posture_incompatible_icon = show_posture_incompatible_icon
                                                if target not in target_to_posture_icon_info:
                                                    if aop.compatible_with_current_posture_state(
                                                            sim):
                                                        aop_show_posture_incompatible_icon = False
                                                    target_to_posture_icon_info[
                                                        target] = aop_show_posture_incompatible_icon
                                                else:
                                                    aop_show_posture_incompatible_icon = target_to_posture_icon_info[
                                                        target]
                                            aop.show_posture_incompatible_icon = aop_show_posture_incompatible_icon
                                            mixer_weight = aop.affordance.calculate_autonomy_weight(
                                                sim)
                                        else:
                                            mixer_weight = 0
                                        valid[affordance].append(
                                            (mixer_weight, aop, test_result))
                    else:
                        if mixer_interaction_group is not DEFAULT and affordance.sub_action.mixer_group != mixer_interaction_group:
                            continue
                        targets = _test_affordance_and_get_targets(
                            affordance,
                            super_interaction,
                            potential_targets,
                            sim,
                            considered=gsi_considered)
                        if targets is None:
                            continue
                        if not include_failed_aops_with_tooltip and len(
                                targets
                        ) >= MINIMUM_TARGETS_TO_TEST_AFFORDANCE_EARLY:
                            resolver = AffordanceResolver(affordance, sim)
                            if affordance.test_globals.run_tests(
                                    resolver,
                                    skip_safe_tests=False,
                                    search_for_tooltip=False):
                                if not affordance.tests.run_tests(
                                        resolver,
                                        skip_safe_tests=False,
                                        search_for_tooltip=False):
                                    continue
                                if context.source == InteractionContext.SOURCE_AUTONOMY and not affordance.test_autonomous.run_tests(
                                        resolver,
                                        skip_safe_tests=False,
                                        search_for_tooltip=False):
                                    continue
                                for target in targets:
                                    valid_aops_gen = get_valid_aops_gen(
                                        target,
                                        affordance,
                                        super_affordance,
                                        super_interaction,
                                        context,
                                        include_failed_aops_with_tooltip,
                                        push_super_on_prepare=
                                        push_super_on_prepare,
                                        considered=gsi_considered,
                                        aop_kwargs=aop_kwargs)
                                    for (aop, test_result) in valid_aops_gen:
                                        if not aop.affordance.is_super:
                                            aop_show_posture_incompatible_icon = False
                                            if show_posture_incompatible_icon:
                                                aop_show_posture_incompatible_icon = show_posture_incompatible_icon
                                                if target not in target_to_posture_icon_info:
                                                    if aop.compatible_with_current_posture_state(
                                                            sim):
                                                        aop_show_posture_incompatible_icon = False
                                                    target_to_posture_icon_info[
                                                        target] = aop_show_posture_incompatible_icon
                                                else:
                                                    aop_show_posture_incompatible_icon = target_to_posture_icon_info[
                                                        target]
                                            aop.show_posture_incompatible_icon = aop_show_posture_incompatible_icon
                                            mixer_weight = aop.affordance.calculate_autonomy_weight(
                                                sim)
                                        else:
                                            mixer_weight = 0
                                        valid[affordance].append(
                                            (mixer_weight, aop, test_result))
                        else:
                            for target in targets:
                                valid_aops_gen = get_valid_aops_gen(
                                    target,
                                    affordance,
                                    super_affordance,
                                    super_interaction,
                                    context,
                                    include_failed_aops_with_tooltip,
                                    push_super_on_prepare=push_super_on_prepare,
                                    considered=gsi_considered,
                                    aop_kwargs=aop_kwargs)
                                for (aop, test_result) in valid_aops_gen:
                                    if not aop.affordance.is_super:
                                        aop_show_posture_incompatible_icon = False
                                        if show_posture_incompatible_icon:
                                            aop_show_posture_incompatible_icon = show_posture_incompatible_icon
                                            if target not in target_to_posture_icon_info:
                                                if aop.compatible_with_current_posture_state(
                                                        sim):
                                                    aop_show_posture_incompatible_icon = False
                                                target_to_posture_icon_info[
                                                    target] = aop_show_posture_incompatible_icon
                                            else:
                                                aop_show_posture_incompatible_icon = target_to_posture_icon_info[
                                                    target]
                                        aop.show_posture_incompatible_icon = aop_show_posture_incompatible_icon
                                        mixer_weight = aop.affordance.calculate_autonomy_weight(
                                            sim)
                                    else:
                                        mixer_weight = 0
                                    valid[affordance].append(
                                        (mixer_weight, aop, test_result))
        if valid:
            return list(
                _select_affordances_gen(sim, super_interaction, valid,
                                        show_posture_incompatible_icon,
                                        gsi_considered, scoring_gsi_handler,
                                        **aop_kwargs))
    return ()