I am looking at this reference https://docs.omniverse.nvidia.com/kit/docs/omni.ui/latest/omni.ui/omni.ui.StringField.html
It would be helpful to have some explanation relating to the keywords and callbacks, especially for drop_fn.
Short of an in-depth explanation for the docs, here are some specific points of confusion (for me):
- The widget has
call_drop_fn
that Specify that this Widget accepts drops and set the callback to the drop operation. Widget — Omniverse Kit 2.23.11 documentation - The widget has
set_drop_fn
that Specify that this Widget accepts drops and set the callback to the drop operation. Widget — Omniverse Kit 2.23.11 documentation - The stringfield has
drop_fn
that Specify that this Widget accepts drops and set the callback to the drop operation https://docs.omniverse.nvidia.com/kit/docs/omni.ui/latest/omni.ui/omni.ui.StringField.html - The stringfield has
accept_drop_fn
that Specify that this Widget can accept specific drops and set the callback that is called to check if the drop can be accepted. StringField — Omniverse Kit 2.23.11 documentation
- What is the difference with
call
andset
, since they have same description? - If stringfield is a widget, why is there a drop_fn on the stringfield in addition to the call and set?
- Why would you need to use
accept_drop_fn
(or why wouldn’t you always use it)? – You still need to manually check what the drop is, which can be done in the drop_fn callback.
Following the same convention from regular callbacks, such as ui.Button("reset", clicked_fn=reset)
, I tried to use ui.StringField(drop_fn=accept_drops)
, but the callback never happens. Instead, I need to use:
asset_field = ui.StringField()
asset_field.set_accept_drop_fn(accept_drops)
asset_field.set_drop_fn(accept_drops)
- Why?