Print at Dec 18, 2025, 6:39:33 AM

Posted by dorin at Feb 20, 2025, 7:18:43 PM
Re: SurroundRoom Plugin
@Ollie
JonnyD is right, but don't despair. I've encountered the same problem at the beginning and Emmanuel have helped me.
Now it's my turn.
You have to verify first if the home have more levels.
Study of case:
Level selectedLevel = getHome().getSelectedLevel();

-New file; draw a room; add an flower and select both. Run the plugin => OK.
selectedLevel = null

-On the same file add a level and then delete it.
selectedLevel != null
Run the plugin => Not OK.

So, in my Select/Hide Special plugin I've use something like this:
if (selectedLevel == null || selectedLevel.isVisible()) {
userView = new SelectHideView();
contentPanel = userView.createComponents(resource);
}
Of course probably you will need other conditions.
Feel free to take inspiration from other plugin sources. I do it all the time.
----------------------------------------
A computer program does what you tell it to do, not what you want it to do. Murphy's Law
When all else fails, read the instructions. Murphy's Law
If you don't like "AS IS", DIY. Dorin's law