-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.add( controller ) #4
Comments
This is a great idea! I'll patch that in. |
I imagine we would have another handlerType, perhaps called anonymous to serve this purpose |
I also like this idea, but I want to be sure people are extending our controller class properly -- there are specific things you have to do if you want them to work in accordance with .listen() for example, or further, the sort of save features I'm adding now. I feel like the syntax should look something more like gui.custom(ClassName, CustomControllerClassName); // i.e. HOWEVER I was thinking we should do this in addition to another, simpler thing that may suffice for a lot of situations in which: gui.add( myObj ) would just add all of that object's public properties to a given panel. So, if you happened to have given myObj a property of type Vector2D, its control could be registered automatically. |
I find that gui.add( myObj ) would be insanely helpful, even to the point where the GUI could expose things that you probably didn't even know you wanted to control :) Great idea George. |
This would be a great addition, but I see last update is 2yrs ago. Did development stop? Thx. |
I'm open to merging a PR along these lines, if someone would like to look into implementing it without scrambling internal code too much. :) |
I use my own CustomController for resolving of the problem. See my code. var gui = new dat.GUI(); For more details see gui.add |
Hi @anhr, thanks for working on this. You'll need to open a pull request against this repository rather than yours. Make sure to use the latest version of the master branch when making the pull request, as well, to avoid including unrelated changes. Is it possible to do this without creating a new method ( import { GUI, Controller } from 'dat.gui';
class FooController extends Controller {
// ...
}
var gui = new GUI();
gui.add( new FooController( object, 'property' ) ); /cc @MacroMan |
Currently I try to do it |
Thanks for the CC @donmccurdy. @anhr If you want any input or assistance with coding it, let me know. |
Would it be a good idea to expose ColorController to use via this new method and depreciate addColor? |
Let's keep |
See my new pull reuest.
Extension version of using. The NumberControllerSlider was added also.
Example of using. |
Thanks! Added a review on the PR. This example doesn't look quite right to me: new dat.GUI.CustomController( {
constructor: function ( controller ) {
//Add your custom elements into controller.domElement
}} We shouldn't be passing the prototype into the constructor. Instead, we want developers to use it this way: import { GUI, controllers } from 'dat.gui';
class KnobController extends controllers.CustomController {
constructor ( object, property, a, b ) {
super( object, property );
this.a = a;
this.b = b;
}
// ...
}
const ctrl = new KnobController( ... ); |
I was wondering if it would be possible to allow this approach:
Maybe with a patch like this?
This would allow people to create their own custom controllers without having to mess up with the GUI internal code.
The text was updated successfully, but these errors were encountered: