|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: The concept of custom properties » » » » Post: The concept of custom properties |
Print at Dec 20, 2025, 6:16:55 PM |
| Posted by Alex42 at Dec 22, 2011, 7:11:01 PM |
|
The concept of custom properties Hello, I want to use SH3D to design the visualization of my home automation system. My idea was to write a plugin to be able to add some additional properties (e.g. address of lamp in automation, visual parameters, ...) to Level, Room and some PieceOfFurnitures to be able to generate the definition of my visualization. Unfortunately I've noticed that attaching custom properties to SH3D objects is not as easy as I thought. As I found other similar requests this wish seems to be common. After some walks through the code I can thought of two approaches to implement this: 1) add a Map<String, Serializable> to the classes of the model this would be the easiest way because storing Home would also store the custom properties. On the other hand could this lead to issues if the value is of a type provided by a plugin and the plugin is not installed at the time of opening a drawing (maybe got from another person). Maybe allowing only some predefined types (String, Integer, ..., Map, List) could solve this issue. 2) store/handle custom properties "beside" the objects if every object of the model would have a unique id (e.g. java.util.UUID) and Home would provide methods to get objects by this id the custom properties could be handled without touching the code of the model classes. An extension of HomeFileRecorder could read/write these properties to a separate file inside the SH3D zip. Some CollectionListeners (Room, HomePieceOfFurniture, ...) could keep these properties and the model in sync. As I'm quite new to SH3D I'm interested in your opinion. Am I wrong and missed something? I think to add the concept of custom properties to SH3D could offer a lot of other possibilities, too. Regards, Alex |
|
|
Current timezone is GMT Dec 20, 2025, 6:16:55 PM |