godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.2k stars 20.22k forks source link

Exposing parameters #10587

Closed PLyczkowski closed 7 years ago

PLyczkowski commented 7 years ago

This is a feature request for exposing parameters of nodes, so that they would be accessible when a scene they belong to is instanced.


Usage example:

User creates a 'Custom Button' scene. It has a Label, an Icon, a Panel, and a Polygon2D for the outline that appears on hover. User RMB clicks on certain parameters in these Nodes and chooses 'Expose' - an icon appears next to them to indicate that they are exposed. The user does it with Label text, Icon texture, and Panel and Polygon2D's colors. The value that they have in this scene will be the default value for these parameters.

Next, the user goes to the 'Main Menu' scene and instances the 'Custom Button' scene multiple times. Each instance has a new parameters section, in addition to the regular parameters, called Exposed Parameters. The exposed parameters are listed there, and set to the default values. User can then set unique values for these parameters for each 'Custom Button' scene instance, or reset them to the default value.


Other usecases could be all kinds of instances that share some properties, and have other properties that are unique - widgets, tiles, power-ups, environment elements, character elements etc.

For a working example of this system check Substance Designer, which also has nodes and parameters exposing - though it's not perfect (I can clarify what could be improved there if needed).

groud commented 7 years ago

Isn't the "export" keyword for what you describe?

PLyczkowski commented 7 years ago

Export has a similar functionality, but it's not for existing parameters, but for new ones created via script. You can emulate exposing parameters though via tool mode + export + setters, but with much more work.

groud commented 7 years ago

Hum, I read again your text. If I understand well, you want to be able to select the parameters that will be displayed in the inspector when selecting a subscene. Am I right ?

PLyczkowski commented 7 years ago

Yes, parameters of the children of the instance of that scene.

reduz commented 7 years ago

You are going to instance that custom button anyway, so just use a script with a setter.

This is not a common use case and it's easy to workaround. As core developers please understand that our duty is to keep core engine code as simple as possible to avoid bloating it.

The more simple features like this that we add in core, the more difficult it becomes to maintain the engine in the long term. Given it's not an often used feature, and that the workaround is simple, the scale tilts against it.

On Aug 23, 2017 2:02 PM, "Gilles Roudiere" notifications@github.com wrote:

Hum, I read again your text. If I understand well, you want to be able to select the parameters that will be displayed in the inspector when selecting a subscene. Am I right ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/10587#issuecomment-324399200, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z21cwGkEvDmS7ZgkjbquUA1SOur90ks5sbFs6gaJpZM4PAOL1 .

groud commented 7 years ago

Ok that's more clear like that :) I think this is a duplicate of #8735 then.

PLyczkowski commented 7 years ago

@groud It is more related to #3895 and #6067, helping with similar problems.

Closing.