You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the project you are working on:
I have a plugin that expects nodes matching certain criteria to be configured in specific ways. The nodes do not necessarily all share a script or base type.
Describe the problem or limitation you are having in your project:
If I want to have a configuration warning appear to notify users that the node(s) are configured incorrectly for use with the plugin, I need to add a code change to every script (or even to nodes that may not have a script) to implement the _get_configuration_warning() method.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
EditorPlugin should have a generic callback that accepts a Node and returns a configuration warning string. The callback would get called on every node in the Scene dock and non-empty string values returned by it would generate warning icons just like the virtual method call per-script would.
Edit: As an added bonus, this helps clean up script code as editor-specific code is now moved out of a script and into plugin code (potentially allowing a tool script to stop being a tool in the first place).
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
Implement an EditorPlugin get_configuration_warning(Node p_node) method. Check if the plugin's script implements the method, and if it does, get the string results and return it.
Add a get_configuration_warning(Node p_node); public method to the EditorNode. Have it iterate through the list of EditorPlugins, and call their implementations of the same method. Concatenate the results with double newlines.
Modify the Scene dock implementation to take into account not only a potential _get_configuration_warning() method on the script, but also the results from the EditorNode via concatenation (double newlines).
If a node's script and two plugins implement it, the resulting warning tooltip would look like...
node script message
plugin A message
plugin B message
If this enhancement will not be used often, can it be worked around with a few lines of script?:
The entire point is to avoid having to reproduce multiple lines of script, and no, existing EditorPlugin features do not allow for this.
Is there a reason why this should be core and not an add-on in the asset library?:
Requires editor changes inaccessible to the existing scripting API.
The text was updated successfully, but these errors were encountered:
Calinou
changed the title
Add a generic EditorPlugin callback for Node configuration warnings.
Add a generic EditorPlugin callback for Node configuration warnings
Aug 27, 2020
Describe the project you are working on:
I have a plugin that expects nodes matching certain criteria to be configured in specific ways. The nodes do not necessarily all share a script or base type.
Describe the problem or limitation you are having in your project:
If I want to have a configuration warning appear to notify users that the node(s) are configured incorrectly for use with the plugin, I need to add a code change to every script (or even to nodes that may not have a script) to implement the
_get_configuration_warning()
method.Describe the feature / enhancement and how it helps to overcome the problem or limitation:
EditorPlugin should have a generic callback that accepts a Node and returns a configuration warning string. The callback would get called on every node in the Scene dock and non-empty string values returned by it would generate warning icons just like the virtual method call per-script would.
Edit: As an added bonus, this helps clean up script code as editor-specific code is now moved out of a script and into plugin code (potentially allowing a tool script to stop being a tool in the first place).
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
get_configuration_warning(Node p_node)
method. Check if the plugin's script implements the method, and if it does, get the string results and return it.get_configuration_warning(Node p_node);
public method to the EditorNode. Have it iterate through the list of EditorPlugins, and call their implementations of the same method. Concatenate the results with double newlines._get_configuration_warning()
method on the script, but also the results from the EditorNode via concatenation (double newlines).If a node's script and two plugins implement it, the resulting warning tooltip would look like...
If this enhancement will not be used often, can it be worked around with a few lines of script?:
The entire point is to avoid having to reproduce multiple lines of script, and no, existing EditorPlugin features do not allow for this.
Is there a reason why this should be core and not an add-on in the asset library?:
Requires editor changes inaccessible to the existing scripting API.
The text was updated successfully, but these errors were encountered: