コード例 #1
0
 def _update_broadcaster_service_visualizer(self, broadcaster_service,
                                            layer):
     for broadcaster in broadcaster_service.get_broadcasters_debug_gen():
         constraint = broadcaster.get_constraint()
         if constraint is not None:
             color = pseudo_random_color(broadcaster.guid)
             _draw_constraint(layer, constraint, color)
         broadcasting_object = broadcaster.broadcasting_object
         if broadcasting_object is not None:
             broadcaster_center = broadcasting_object.position
             layer.add_circle(broadcaster_center, radius=0.3, color=color)
         for linked_broadcaster in broadcaster.get_linked_broadcasters_gen(
         ):
             linked_broadcasting_object = linked_broadcaster.broadcasting_object
             if linked_broadcasting_object is not None:
                 layer.add_point(linked_broadcasting_object.position,
                                 size=0.25,
                                 color=color)
                 layer.add_segment(broadcaster_center,
                                   linked_broadcasting_object.position,
                                   color=color)
     for broadcaster in broadcaster_service.get_pending_broadcasters_gen():
         color = pseudo_random_color(broadcaster.guid)
         (r, g, b, a) = sims4.color.to_rgba(color)
         color = sims4.color.from_rgba(r, g, b, a * 0.5)
         broadcasting_object = broadcaster.broadcasting_object
         if broadcasting_object is not None:
             layer.add_circle(broadcasting_object.position, color=color)
コード例 #2
0
 def _on_update(self):
     broadcaster_service = services.current_zone().broadcaster_service
     with Context(self.layer) as layer:
         for broadcaster in broadcaster_service.get_broadcasters_gen(
                 inspect_only=True):
             constraint = broadcaster.get_constraint()
             if constraint is not None:
                 color = pseudo_random_color(broadcaster.guid)
                 _draw_constraint(layer, constraint, color)
             broadcasting_object = broadcaster.broadcasting_object
             if broadcasting_object is not None:
                 broadcaster_center = broadcasting_object.position
                 layer.add_circle(broadcaster_center,
                                  radius=0.3,
                                  color=color)
             for linked_broadcaster in broadcaster.get_linked_broadcasters_gen(
             ):
                 linked_broadcasting_object = linked_broadcaster.broadcasting_object
                 while linked_broadcasting_object is not None:
                     layer.add_point(linked_broadcasting_object.position,
                                     size=0.25,
                                     color=color)
                     layer.add_segment(broadcaster_center,
                                       linked_broadcasting_object.position,
                                       color=color)
         for broadcaster in broadcaster_service.get_pending_broadcasters_gen(
         ):
             color = pseudo_random_color(broadcaster.guid)
             (r, g, b, a) = sims4.color.to_rgba(color)
             color = sims4.color.from_rgba(r, g, b, a * 0.5)
             broadcasting_object = broadcaster.broadcasting_object
             while broadcasting_object is not None:
                 layer.add_circle(broadcasting_object.position, color=color)
コード例 #3
0
 def _on_transition_destinations_changed(self, sim, transition_destinations, possible_sources, max_weight, preserve=False):
     POSSIBLE_SOURCE = from_rgba(50, 50, 50, 0.5)
     with Context(self.layer, preserve=preserve) as layer:
         for (path_id, constraint, weight) in transition_destinations:
             alpha = 1.0
             if max_weight > 0:
                 alpha = weight/max_weight
             color = pseudo_random_color(path_id, a=alpha)
             _draw_constraint(layer, constraint, color)
         for constraint in possible_sources:
             _draw_constraint(layer, constraint, POSSIBLE_SOURCE, altitude_modifier=0.5)
コード例 #4
0
 def _on_transition_destinations_changed(self,
                                         sim,
                                         transition_destinations,
                                         transition_sources,
                                         max_cost,
                                         preserve=False):
     POSSIBLE_SOURCE = from_rgba(50, 50, 50, 0.5)
     with Context(self.layer, preserve=preserve) as layer:
         for (path_id, constraint, weight) in transition_destinations:
             alpha = 1.0
             if max_cost > 0:
                 alpha = alpha - weight / max_cost
                 if alpha < 0.01:
                     alpha = 0.01
             color = pseudo_random_color(path_id, a=alpha)
             if constraint.was_selected:
                 _draw_constraint(layer,
                                  constraint,
                                  color,
                                  altitude_modifier=0.5)
             else:
                 _draw_constraint(layer, constraint, color)
         for constraint in transition_sources:
             if constraint.was_selected:
                 _draw_constraint(layer,
                                  constraint,
                                  POSSIBLE_SOURCE,
                                  altitude_modifier=0.5)
             else:
                 _draw_constraint(layer, constraint, POSSIBLE_SOURCE)
コード例 #5
0
def debugvis_social_clustering(detailed_obj_id:int=None, _connection=None):
    with Context('social_clustering') as layer:
        for cluster in services.social_group_cluster_service().get_clusters_gen(regenerate=True):
            layer.routing_surface = cluster.routing_surface
            for obj in cluster.objects_gen():
                layer.set_color(Color.CYAN)
                layer.add_segment(obj.position, cluster.position)
                if obj.id == detailed_obj_id:
                    layer.set_color(Color.WHITE)
                    layer.add_polygon(cluster.polygon)
                    detailed_obj_id = None
                layer.set_color(Color.YELLOW)
                layer.add_circle(obj.position, 0.65)
            layer.set_color(Color.CYAN)
            layer.add_circle(cluster.position, 0.35)
            _draw_constraint(layer, cluster.constraint, Color.GREEN)
    sims4.commands.client_cheat('debugvis.layer.enable social_clustering', _connection)
    return True
コード例 #6
0
 def _on_transition_destinations_changed(self,
                                         sim,
                                         transition_destinations,
                                         possible_sources,
                                         max_weight,
                                         preserve=False):
     POSSIBLE_SOURCE = from_rgba(50, 50, 50, 0.5)
     with Context(self.layer, preserve=preserve) as layer:
         for (path_id, constraint, weight) in transition_destinations:
             alpha = 1.0
             if max_weight > 0:
                 alpha = weight / max_weight
             color = pseudo_random_color(path_id, a=alpha)
             _draw_constraint(layer, constraint, color)
         for constraint in possible_sources:
             _draw_constraint(layer,
                              constraint,
                              POSSIBLE_SOURCE,
                              altitude_modifier=0.5)
コード例 #7
0
def debugvis_social_clustering(detailed_obj_id: int = None, _connection=None):
    with Context('social_clustering') as layer:
        for cluster in services.social_group_cluster_service(
        ).get_clusters_gen(regenerate=True):
            layer.routing_surface = cluster.routing_surface
            for obj in cluster.objects_gen():
                layer.set_color(Color.CYAN)
                layer.add_segment(obj.position, cluster.position)
                if obj.id == detailed_obj_id:
                    layer.set_color(Color.WHITE)
                    layer.add_polygon(cluster.polygon)
                    detailed_obj_id = None
                layer.set_color(Color.YELLOW)
                layer.add_circle(obj.position, 0.65)
            layer.set_color(Color.CYAN)
            layer.add_circle(cluster.position, 0.35)
            _draw_constraint(layer, cluster.constraint, Color.GREEN)
    sims4.commands.client_cheat('debugvis.layer.enable social_clustering',
                                _connection)
    return True
コード例 #8
0
 def _update_routing_formation_visualizer(self, routing_formation,
                                          transform, layer):
     layer.add_circle(transform.translation,
                      radius=0.3,
                      color=sims4.color.Color.GREEN)
     layer.add_circle(routing_formation.slave.position,
                      radius=0.3,
                      color=sims4.color.Color.RED)
     constraint = routing_formation.get_routing_slave_constraint()
     if constraint is not None or constraint is not ANYWHERE:
         color = pseudo_random_color(routing_formation.guid)
         _draw_constraint(layer, constraint, color)
     offset = sims4.math.Vector3.ZERO()
     previous_offset = sims4.math.Vector3.ZERO()
     for attachment_info in routing_formation.attachment_info_gen():
         color = sims4.color.Color.CYAN if attachment_info.node_type is RoutingFormationFollowType.NODE_TYPE_FOLLOW_LEADER else sims4.color.Color.MAGENTA
         offset.x = offset.x + attachment_info.parent_offset.x
         offset.z = offset.z + attachment_info.parent_offset.y
         layer.add_segment(
             transform.transform_point(previous_offset),
             transform.transform_point(offset),
             color=color,
             routing_surface=routing_formation.slave.routing_surface)
         previous_offset = sims4.math.Vector3.ZERO() + offset
         offset.x = offset.x - attachment_info.offset.x
         offset.z = offset.z - attachment_info.offset.y
         transformed_point = transform.transform_point(offset)
         layer.add_segment(
             transform.transform_point(previous_offset),
             transformed_point,
             color=color,
             routing_surface=routing_formation.slave.routing_surface)
         previous_offset = sims4.math.Vector3.ZERO() + offset
         layer.add_circle(
             transformed_point,
             radius=attachment_info.radius,
             color=color,
             routing_surface=routing_formation.slave.routing_surface)
コード例 #9
0
 def _on_update(self):
     broadcaster_service = services.current_zone().broadcaster_service
     with Context(self.layer) as layer:
         for broadcaster in broadcaster_service.get_broadcasters_gen(inspect_only=True):
             constraint = broadcaster.get_constraint()
             if constraint is not None:
                 color = pseudo_random_color(broadcaster.guid)
                 _draw_constraint(layer, constraint, color)
             broadcasting_object = broadcaster.broadcasting_object
             if broadcasting_object is not None:
                 broadcaster_center = broadcasting_object.position
                 layer.add_circle(broadcaster_center, radius=0.3, color=color)
             for linked_broadcaster in broadcaster.get_linked_broadcasters_gen():
                 linked_broadcasting_object = linked_broadcaster.broadcasting_object
                 while linked_broadcasting_object is not None:
                     layer.add_point(linked_broadcasting_object.position, size=0.25, color=color)
                     layer.add_segment(broadcaster_center, linked_broadcasting_object.position, color=color)
         for broadcaster in broadcaster_service.get_pending_broadcasters_gen():
             color = pseudo_random_color(broadcaster.guid)
             (r, g, b, a) = sims4.color.to_rgba(color)
             color = sims4.color.from_rgba(r, g, b, a*0.5)
             broadcasting_object = broadcaster.broadcasting_object
             while broadcasting_object is not None:
                 layer.add_circle(broadcasting_object.position, color=color)
コード例 #10
0
 def _on_transition_constraints_changed(self, constraint_history):
     with Context(self.layer) as layer:
         for constraint in constraint_history:
             color = pseudo_random_color(id(constraint))
             _draw_constraint(layer, constraint, color)
コード例 #11
0
 def _on_transition_constraints_changed(self, constraint_history):
     with Context(self.layer) as layer:
         for constraint in constraint_history:
             color = pseudo_random_color(id(constraint))
             _draw_constraint(layer, constraint, color)