Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy / paste entities from the GUI #102

Closed
chapulina opened this issue Apr 28, 2020 · 1 comment · Fixed by #1013
Closed

Copy / paste entities from the GUI #102

chapulina opened this issue Apr 28, 2020 · 1 comment · Fixed by #1013
Assignees
Labels
close the gap Features from Gazebo-classic editor Tools to edit entities in simulation enhancement New feature or request GUI Gazebo's graphical interface (not pure Ignition GUI)

Comments

@chapulina
Copy link
Contributor

Add options to copy / cut / paste models through the GUI.

Hotkeys:

  • Cut = CTRL+X
  • Copy = CTRL+C
  • Paste = CTRL+V

The option should also be available from the context (right-click) menu.

@chapulina chapulina added enhancement New feature or request GUI Gazebo's graphical interface (not pure Ignition GUI) labels Apr 28, 2020
@chapulina chapulina added the close the gap Features from Gazebo-classic label May 29, 2020
@chapulina chapulina added the editor Tools to edit entities in simulation label Jun 6, 2020
@chapulina chapulina added the help wanted We accept pull requests! label Jul 20, 2020
@adlarkin adlarkin self-assigned this Jul 27, 2021
@chapulina
Copy link
Contributor Author

chapulina commented Jul 30, 2021

I'll dump some more things I discussed with @adlarkin here:

The quick way

The quickest approach at the moment would make use of the SpawnFromDescription event and pass the contents of components::ModelSdf (requires #851)

Drawbacks of this approach:

  • Only works for models (not lights, actors, etc)
  • Requires the GUI to parse the SDF file to create the spawn preview that's attached to the mouse. This can take a non-negligible time for models with multiple links, joints and materials.

The ✨ great ❇️ way

My recommended implementation involves using the clone_name field of msgs::EntityFactory:

1: UserCommands

  • Make the UserCommands system parse the clone_name field here:

    https:/ignitionrobotics/ign-gazebo/blob/24be610ac1e8889b6c538a110c84da7f91360a39/src/systems/user_commands/UserCommands.cc#L726-L731

    This would probably entail:

    1. Getting an entity ID from its name
    2. Copying all entities and components that compose this entity
      • Recursively include all children
      • Make sure the new entities have different IDs

    This could be in its own PR. One way to verify that this works would be:

    1. Start ign gazebo shapes.sdf

    2. On another terminal, call:

       ign service -s /world/shapes/create \
           --reqtype ignition.msgs.EntityFactory \
           --reptype ignition.msgs.Boolean \
           --timeout 300 \
          --req 'clone_name: "box", pose {z: 10}, name: "box_copy"'
      
    3. A red box is spawned and falls on top of the original one.

2: 3D Scene

3: New copy / paste plugin

  • Create a new GUI plugin that calls the SpawnFromCloneName when the user requests it

@adlarkin adlarkin mentioned this issue Sep 8, 2021
8 tasks
@chapulina chapulina removed the help wanted We accept pull requests! label Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
close the gap Features from Gazebo-classic editor Tools to edit entities in simulation enhancement New feature or request GUI Gazebo's graphical interface (not pure Ignition GUI)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants