Closed mrushyendra closed 3 years ago
Just a quick check, do you think it would be possible to change the way the color is chosen from three numbers to a more familiar "palette" similar to what is found in image editing software? Something like this [big disclaimer I have no idea if this is very easy or very hard to do!]:
to update lights in real time - i.e. not have to select create each time you want to re-render the light (though this does not currently seem feasible due to the time the create/remove service takes)
This would be quite interesting I think, from what I understand you mean that you can't run it at every loop iteration since the service can be quite slow (which I agree with). An alternative approach could be to cache the state of the light parameters / object pose and set a dirty
bit whenever any parameter is updated, then respawn the light and clear the dirty
bit. Does it make sense?
I've never tried implementing a color picker, but it definitely seems doable. As for the updating of lights, I imagined something even more responsive (e.g. lights change continuously as you drag the sliders, or if you move the cube to change its pose), but I think updating them whenever an edit is finished is a good middle ground.
I think that Qt has a pre-packaged standard "color-picker" dialog box somewhere.
But that could be a separate PR later, as an improvement. This is awesome as-is IMHO
I think the black circle occurs for the spotlight when the inner angle is set to a bigger value than the outer angle. Here's a screenshot of the params for a working one: I also changed the code to hide the spotlight-specific params when not needed.
Oh that makes sense :sweat_smile: feature wise this looks good to me, let me know if you want more time to look at the automatic update seg fault issue.
Pushed some additional changes that allow for the lights to be updated as you move the sliders/finish typing.
Sending create and remove requests very quickly after one another can still cause a seg fault in Ignition, I believe because of a lag between entity creation/removal and the actual rendering itself, but I believe it shouldn't happen with this plugin because the Qt signals have been chosen such that they don't fire too soon after one another.
This is really really nice, thanks for iterating!
Creates an Ignition GUI plugin to spawn lights and edit their parameters without having to modify the world SDF file and recompile each time. It supports multiple lights, pose changes by dragging on screen, and saving the sdf file snippets for each light to disk.
To enable changing light poses by dragging, it currently uses a workaround where a simple cube model is spawned at the same location as the light. The pose of this cube is used to update the pose field in the light creation menu.
Some other changes I considered, but are not included in this PR is to split the pose and direction inputs into their individual X, Y, Z etc. components (may become more cumbersome to type), to add the ability to edit lights that are already part of the world, and to update lights in real time - i.e. not have to select
create
each time you want to re-render the light (though this does not currently seem feasible due to the time the create/remove service takes). Lastly, I am very new to QT, so some of the syntax or methods used may not be the canonical ones.