PickNikRobotics / rviz_visual_tools

C++ API wrapper for displaying shapes and meshes in Rviz
769 stars 243 forks source link

Added Foxglove Studio support for deleteAllMarkers function #243

Open yucedagonurcan opened 1 year ago

yucedagonurcan commented 1 year ago

Hello,

I know the filling up the namespace of the resetmarker said to be done for debugging reasons but filling it up with anything causes the Foxglove Studio to take this particular message and use the namespace to decide what namespace to remove:

https://github.com/foxglove/studio/blob/64be9e1756f4a027072eb2312a67da01122ff7e1/packages/studio-base/src/panels/ThreeDeeRender/renderables/TopicMarkers.ts#L194-L215

  #deleteAllMarkers(ns: string): void {
    const clearNamespace = (namespace: MarkersNamespace): void => {
      for (const renderable of namespace.markersById.values()) {
        this.remove(renderable);
        this.renderer.markerPool.release(renderable);
      }
      namespace.markersById.clear();
    };

    if (ns.length === 0) {
      // Delete all markers on this topic
      for (const namespace of this.namespaces.values()) {
        clearNamespace(namespace);
      }
    } else {
      // Delete all markers on the given namespace
      const namespace = this.namespaces.get(ns);
      if (namespace) {
        clearNamespace(namespace);
      }
    }
  }

https://github.com/foxglove/studio/blob/64be9e1756f4a027072eb2312a67da01122ff7e1/packages/studio-base/src/panels/ThreeDeeRender/renderables/TopicMarkers.ts#L80-L81

      case MarkerAction.DELETEALL: {
        this.#deleteAllMarkers(marker.ns);
        break;

I am suggesting we remove this one so that whole library could be used with Foxglove Studio too.