Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 9
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 630 times and has 8 replies Next Thread
Walter125
Member




Joined: Sep 11, 2023
Post Count: 25
Status: Offline
Reply to this Post  Reply with Quote 
Bug found in HomefurniturePanel.java

Hi,

I'm using linux version of SweetHome3D.

When I try to modify a furniture, for example open the door of a kitchen cabinet, the most of time, the 3D view of the cabinet isn't shown, and so, I can't open the door.

After several clicks on the button to reloads of the ModelTransformationsPanel, the 3D view of the model is finally shown.

The bug doesn't appear when I compile SweetHome3D with the following modification, arround line 2111 in HomefurniturePanel.java:

private void layoutComponents() {
int standardGap = Math.round(5 * SwingTools.getResolutionScale());
// Preview

// BUG Here ?
/*
add(this.transformationsLabel, new GridBagConstraints(
0, 0, 2, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.NONE, new Insets(0, 0, standardGap, 10), 0, 0));
*/

this.previewComponent.setPreferredSize(new Dimension(400, 400));
add(this.previewComponent, new GridBagConstraints(
0, 1, 1, 10, 0, 0, GridBagConstraints.NORTH,
GridBagConstraints.NONE, new Insets(0, 2, 0, 15), 0, 0));
add(this.resetTransformationsButton, new GridBagConstraints(
1, 1, 1, 1, 0, 0, GridBagConstraints.NORTH,
GridBagConstraints.BOTH, new Insets(0, 2, standardGap, 0), 0, 0));


I have commented the lines adding a label to the grid. With this modification, the 3D view of the model is shown each time I open the transformations panel.

But I'm not used to program grid layouts, so I don't know how to correct this bug.

At a first look, the grid layouts of all the objects seem to me to be correct.
[Oct 14, 2023, 11:42:46 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 790
Status: Offline
Reply to this Post  Reply with Quote 
Re: Bug found in HomefurniturePanel.java

I've had the same but always thought is was the momentary lack of resources on my system. If it's really this bug I'm sure Emmanuel will have it solved pretty fast.
[Oct 14, 2023, 12:03:33 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Daniels118
Advanced Member
Member's Avatar

Italy
Joined: Nov 17, 2021
Post Count: 407
Status: Offline
Reply to this Post  Reply with Quote 
Re: Bug found in HomefurniturePanel.java

You may report the bug here:
https://sourceforge.net/p/sweethome3d/bugs/

It will help the developer to keep track of problems that must be solved (the forum post could be forgotten after a while).
[Oct 15, 2023, 9:06:27 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9182
Status: Offline
Reply to this Post  Reply with Quote 
Re: Bug found in HomefurniturePanel.java

This looks like the bug #1184.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Oct 15, 2023, 3:43:31 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 790
Status: Offline
Reply to this Post  Reply with Quote 
Re: Bug found in HomefurniturePanel.java

It does look like bug #1184. But I doubt it's a system update problem. I run into it every now and then on three different systems. Although all three are Debian (one host, two VM) they are different versions. The same problem persists on all three before and after system updates. Sometimes it helps to close Sweet Home 3D and restart it, other times I just keep on trying and after multiple tries it suddenly works.
It's as if the 3D view to display the model can't be painted. In rare cases just modifying a color and then trying the deformations works, as if the model wasn't fully loaded before and changing a color loaded it correctly for 3D display.
The main problem is that it isn't consistent, not even with the exact same model. This makes it very hard to determine what exactly is causing this. As far as I remember this happens with all versions of Sweet Home 3D, at least for the last 1-2 years.
[Oct 15, 2023, 4:35:19 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Walter125
Member




Joined: Sep 11, 2023
Post Count: 25
Status: Offline
Reply to this Post  Reply with Quote 
Re: Bug found in HomefurniturePanel.java

I think it is a bug internal to the java linux implementation.

It seems I have found a workarround, adding the following line before to add the Label to the grid at line 2111:

this.transformationsLabel.setPreferredSize(this.transformationsLabel.getPreferredSize());


I haven't a good knowledge of the program, but I also wonder if the size of the previewComponent should be scaled by in order to be adapted to the screen resolution, at line 2114 ?

Example of scaling:

float scale = SwingTools.getResolutionScale();

this.previewComponent.setPreferredSize(new Dimension((int)(400*scale), (int)(400*scale)));


instead of actually:

this.previewComponent.setPreferredSize(new Dimension(400, 400));

[Oct 15, 2023, 6:38:15 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Walter125
Member




Joined: Sep 11, 2023
Post Count: 25
Status: Offline
Reply to this Post  Reply with Quote 
Re: Bug found in HomefurniturePanel.java

I just noticed the previewComponent is already scaled in the function createComponents, so the line 2114 that rescale it, should be removed ?
[Oct 15, 2023, 6:47:41 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9182
Status: Offline
Reply to this Post  Reply with Quote 
Re: Bug found in HomefurniturePanel.java

Adding the line
this.transformationsLabel.setPreferredSize(this.transformationsLabel.getPreferredSize());
should have no effect, since without this line the layout will try to set the label to its preferred size.
The problem looks like the preferred size is actually different when the container is laid out and when it's displayed.
Maybe forcing the preferred size to a larger size could fix the problem (a few pixels along width or height) without breaking container layout in Java implementations where it works now. Can you try?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Oct 16, 2023, 4:43:04 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Walter125
Member




Joined: Sep 11, 2023
Post Count: 25
Status: Offline
Reply to this Post  Reply with Quote 
Re: Bug found in HomefurniturePanel.java

Following your suggestion, I tried to add 1 pixel only to the height, it also works. With the following code:

Dimension size = this.transformationsLabel.getPreferredSize();
size.height = size.height + 1;
this.transformationsLabel.setPreferredSize(size);


I tried to add 1 pixel only to the width, and 1 pixel both to the width and the height. It worked in all these cases.

About the line I suggested, I don't know why but it works on my system.

I precise that like Keet, I'm using Debian.
[Oct 16, 2023, 6:28:56 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved