Joined: Nov 3, 2009
Post Count: 11
Status:
Offline
Re: Access the PlanController
It is a very good idea isn't it ?
In deed, we make a pluggin that extend wall creation. But we have to click first on wall creation and after on the pluggin. It is not very intuitive for users.
This access could be usefull to initiliaze the controller and so have different pluggins.
France
Joined: Nov 7, 2005
Post Count: 9427
Status:
Offline
Re: Access the PlanController
I know it could be useful. It would let the plug-in access the views too. If it's not accessible, it's because it will oblige me to maintain for ever the backward compatibility of com.eteks.sweethome3d.viewcontroller API. Even if I didn't break it in the past, only the API of com.eteks.sweethome3d.model and com.eteks.sweethome3d.plugin packages are in this case at this moment, because they are the only two packages accessible from a plug-in. If I change it, I'll add a getHomeController to Plugin class, and from the HomeController instance it will return, you'll be able to access to PlanController instance. I'll also would like to reduce PlanController class size by extracting all ControllerState classes to a com.eteks.sweethome3d.viewcontroller.plan new package, but don't want to introduce a bidirectional dependency between com.eteks.sweethome3d.viewcontroller and com.eteks.sweethome3d.viewcontroller.plan packages. I could make PlanController class and all its get...State() methods abstract, implement them in a new com.eteks.sweethome3d.viewcontroller.plan.DefaultPlanController subclass and instantiate DefaultPlanController class in com.eteks.sweethome3d assembly package. That should make it, don't you think?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Joined: Nov 3, 2009
Post Count: 11
Status:
Offline
Re: Access the PlanController
This seems like a good solution, and more "opened" than we need.
Is it too too accessible or not, I do not know... We have not the knowledge as well as you, to be sure of that. The only risk as you mentioned is the backward compatibility in the future.
If you want we can test it with our development before a public release...
France
Joined: Nov 7, 2005
Post Count: 9427
Status:
Offline
Re: Access the PlanController
Hi,
I just committed some changes in source code to grant access to controllers from plugins. Sorry if I didn't include this change in version 3.4, but once I discovered that it required to change some dependency between com.eteks.sweethome3d.viewcontroller and com.eteks.sweethome3d.plugin packages, I was reluctant to do it, because it would break code in some versions derived from Sweet Home 3D (but not existing plugins). I finally made the changes today, so please test it when you can.
To all developers who created a derived version of Sweet Home 3D: if your program uses directly com.eteks.sweethome3d.viewcontroller.HomeController class (by subclassing it or instantiating it), you should just replace it by com.eteks.sweethome3d.plugin.HomePluginController class. Sorry for any problem it might cause.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
----------------------------------------
[Edit 2 times,
last edit by Puybaret at Jan 30, 2012, 7:15:29 AM]
France
Joined: Nov 7, 2005
Post Count: 9427
Status:
Offline
Re: Access the PlanController
The access to controllers is available from version 3.5 through the getHomeController method added to com.eteks.sweethome3d.plugin.Plugin class.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator