[Solved] NiftyGUI: CreateDroppable & DroppableDropFilter

I am making a Droppable using the CreateDroppable class. I now want to add a DroppableDropFilter to that Droppable. It seems the only way to do this is to create the Droppable, find it, then add the filter. Is this right, or is there a way to add the filter while building it?

For example, I think what has to happen currently is:
[java]
DroppableDropFilter filter;
CreateDroppable cd = new CreateDroppable();
cd.setId(“blah”);
cd.create(m_nifty, m_screen, parent);
Droppable d = parent.findNiftyControl(“blah”, Droppable.class);
d.addFilter(filter);
[/java]

What I want to do is something like:
[java]
DroppableDropFilter filter;
CreateDroppable cd = new CreateDroppable();
cd.setId(“blah”);
cd.setFilter(filter);
// or cd.set(“filter”, filter); or something similar
cd.create(m_nifty, m_screen, parent);
[/java]

Am I missing something, or is this functionality not implemented?

Thanks!

That’s a missing feature of the CreateDroppable unfortunatly. It can be easily added and so I’ve added that for you. Here is the commit: https://github.com/void256/nifty-gui/commit/a8c3619df6fc21ddeca78dbe9ae7d5696c615e28

This is the 1.4 Nifty branch though which is work in progress and therefore not yet available in JME. So if you want to test this you’ll need to build Nifty on your own. It’s still compatible with the JME3 Nifty renderer implementation but there might be other minor incompatibilites in general Nifty usage. Although only minor things so far.

1 Like

Awesome, thanks a ton!