|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: How to save a user's (plugin-related) preferences? |
|
| Print at Feb 6, 2026, 9:35:12 AM | View all posts in this thread on one page |
| Posted by shmuelzon at Jul 19, 2024, 3:14:51 PM |
|
How to save a user's (plugin-related) preferences? Hey, I was wondering if there was some mechanism with which I can persistently save a few settings the user can modify within my plugin. I've seen the UserPreferences class but it has setters/getters only for the specific options SH3D supports. Is there some generic tags, key-value-pairs or anything that a plugin can set that will be saved as a part of the SH3D project file? Thanks in advance! |
| Posted by Daniels118 at Jul 19, 2024, 9:49:56 PM |
|
Re: How to save a user's (plugin-related) preferences? The Home class allows to set custom properties. |
| Posted by shmuelzon at Jul 20, 2024, 6:45:11 AM |
|
Re: How to save a user's (plugin-related) preferences? Thanks, I believe you're referring to getProperty()/getNumericProperty()/setProperty()? They seem to do the job, assuming I save the project file but setting a property doesn't seem to mark the project as modified so the user will be alerted that they need to save it. Is the plugin expected to call setModified() when a property's value changes? |
| Posted by Puybaret at Jul 20, 2024, 8:34:35 AM |
|
Re: How to save a user's (plugin-related) preferences? Some properties are not so important to save like window size after resizing it. Some other properties should be saved and in that case, you should call setModified method. Prefer to use properties with a unique prefix to avoid any clash with future ones or properties managed by other plug-ins. Note that these home properties are saved for a project, not for all projects like you seemed to want by speaking about "preferences". As you noticed, there are no setProperty / getProperty in UserPreferences class at the moment, but can save additional data at the same place as where preferences.xm file is saved if needed. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by shmuelzon at Jul 20, 2024, 9:20:43 AM |
|
Re: How to save a user's (plugin-related) preferences? Hey, saving per home/project is good for my purposes. Thanks for the explanations! |
|
|
Current timezone is GMT Feb 6, 2026, 9:35:12 AM |