@@ -344,13 +344,18 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102
344344 # Call the gRPC service
345345 response = self .stub .FindAndSimplify (request )
346346
347+ serialized_tracker_response = self ._serialize_tracker_command_response (
348+ response .complete_command_response
349+ )
350+
347351 # Return the response - formatted as a dictionary
348352 return {
349353 "success" : response .success ,
350354 "found" : response .found ,
351355 "repaired" : response .repaired ,
352356 "created_bodies_monikers" : [],
353357 "modified_bodies_monikers" : [],
358+ "complete_command_response" : serialized_tracker_response ,
354359 }
355360
356361 @protect_grpc
@@ -378,13 +383,18 @@ def find_and_fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
378383 # Call the gRPC service
379384 response = self .stub .FindAndFixStitchFaces (request )
380385
386+ serialized_tracker_response = self ._serialize_tracker_command_response (
387+ response .complete_command_response
388+ )
389+
381390 # Return the response - formatted as a dictionary
382391 return {
383392 "success" : response .success ,
384393 "created_bodies_monikers" : response .created_bodies_monikers ,
385394 "modified_bodies_monikers" : response .modified_bodies_monikers ,
386395 "found" : response .found ,
387396 "repaired" : response .repaired ,
397+ "complete_command_response" : serialized_tracker_response ,
388398 }
389399
390400 @protect_grpc
@@ -457,13 +467,18 @@ def find_and_fix_short_edges(self, **kwargs): # noqa: D102
457467 # Call the gRPC service
458468 response = self .stub .FindAndFixShortEdges (request )
459469
470+ serialized_tracker_response = self ._serialize_tracker_command_response (
471+ response .complete_command_response
472+ )
473+
460474 # Return the response - formatted as a dictionary
461475 return {
462476 "success" : response .success ,
463477 "found" : response .found ,
464478 "repaired" : response .repaired ,
465479 "created_bodies_monikers" : [],
466480 "modified_bodies_monikers" : [],
481+ "complete_command_response" : serialized_tracker_response ,
467482 }
468483
469484 @protect_grpc
@@ -479,13 +494,18 @@ def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102
479494 # Call the gRPC service
480495 response = self .stub .FindAndFixExtraEdges (request )
481496
497+ serialized_tracker_response = self ._serialize_tracker_command_response (
498+ response .complete_command_response
499+ )
500+
482501 # Return the response - formatted as a dictionary
483502 return {
484503 "success" : response .success ,
485504 "found" : response .found ,
486505 "repaired" : response .repaired ,
487506 "created_bodies_monikers" : response .created_bodies_monikers ,
488507 "modified_bodies_monikers" : response .modified_bodies_monikers ,
508+ "complete_command_response" : serialized_tracker_response ,
489509 }
490510
491511 @protect_grpc
@@ -505,13 +525,18 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102
505525 # Call the gRPC service
506526 response = self .stub .FindAndFixSplitEdges (request )
507527
528+ serialized_tracker_response = self ._serialize_tracker_command_response (
529+ response .complete_command_response
530+ )
531+
508532 # Return the response - formatted as a dictionary
509533 return {
510534 "success" : response .success ,
511535 "found" : response .found ,
512536 "repaired" : response .repaired ,
513537 "created_bodies_monikers" : [],
514538 "modified_bodies_monikers" : [],
539+ "complete_command_response" : serialized_tracker_response ,
515540 }
516541
517542 def __serialize_inspect_result_response (self , response ) -> dict : # noqa: D102
@@ -567,3 +592,52 @@ def serialize_issue(issue):
567592 for body_issues in response .issues_by_body
568593 ]
569594 }
595+
596+ def _serialize_tracker_command_response (self , response ) -> dict :
597+ """Serialize a TrackerCommandResponse object into a dictionary.
598+
599+ Parameters
600+ ----------
601+ response : TrackerCommandResponse
602+ The gRPC TrackerCommandResponse object to serialize.
603+
604+ Returns
605+ -------
606+ dict
607+ A dictionary representation of the TrackerCommandResponse object.
608+ """
609+
610+ def serialize_body (body ):
611+ return {
612+ "id" : body .id ,
613+ "name" : body .name ,
614+ "can_suppress" : body .can_suppress ,
615+ "transform_to_master" : {
616+ "m00" : body .transform_to_master .m00 ,
617+ "m11" : body .transform_to_master .m11 ,
618+ "m22" : body .transform_to_master .m22 ,
619+ "m33" : body .transform_to_master .m33 ,
620+ },
621+ "master_id" : body .master_id ,
622+ "parent_id" : body .parent_id ,
623+ }
624+
625+ def serialize_entity_identifier (entity ):
626+ """Serialize an EntityIdentifier object into a dictionary."""
627+ return {
628+ "id" : entity .id ,
629+ }
630+
631+ return {
632+ "success" : response .success ,
633+ "created_bodies" : [
634+ serialize_body (body ) for body in getattr (response , "created_bodies" , [])
635+ ],
636+ "modified_bodies" : [
637+ serialize_body (body ) for body in getattr (response , "modified_bodies" , [])
638+ ],
639+ "deleted_bodies" : [
640+ serialize_entity_identifier (entity )
641+ for entity in getattr (response , "deleted_bodies" , [])
642+ ],
643+ }
0 commit comments