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
I'm making a survivor-like type of game with a bunch of stats (per-weapon, and global to each weapon owned by an Actor) which is intended as my practicing composition pattern, with so-far heavy use of Resources, which contain the many stats for the weapons and actors.
Describe the problem or limitation you are having in your project
When there is a large (or even moderate, to be honest) number of stats, it becomes tedious to create a setget function for each. Sometimes, one might want to use a setget simply to be more threadsafe, but the function might not have anything beyond the basic return or set functionality. In these cases,, copy-pasting but changing a single word in the variable gets tedious.
(15:33 in this video is where I got the notion that it's more thread-safe, I am not knowledgeable enough to know if this is true or not, but I did decide to err on the side of caution and make setgets!)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
It might be convenient if there was a hotkey to auto-generate blank (or bare-bones) setters and getters by hovering over the base variable declaration. From there the functionality would perhaps use the var name and append "set_" and "get_" to the front for the functions declared as the setters and getters, and then generate a basic setter/getter at the bottom of the script, by those names.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Addressed in the last section mostly, however I'm not sure what hotkey would be best. Maybe Ctrl + J, since J can be a visual mnemonic for a sweeping line that loops at the bottom, adding something to your the bottom of your script.
If this enhancement will not be used often, can it be worked around with a few lines of script?
The problem can be worked around with a few lines... per variable (arguably though it's not even a workaround, it's just implementing a setget). The issue arises when there are many variables, and the cost is human lifetime and energy.
Is there a reason why this should be core and not an add-on in the asset library?
"This is about improving the usability of the code editor out of the box."
The text was updated successfully, but these errors were encountered:
Calinou
changed the title
Add a Hotkey to Auto-generate basic Setters and Getters
Add a shortcut to automatically generate a setter and getter for a property
Jan 7, 2023
Describe the project you are working on
I'm making a survivor-like type of game with a bunch of stats (per-weapon, and global to each weapon owned by an Actor) which is intended as my practicing composition pattern, with so-far heavy use of Resources, which contain the many stats for the weapons and actors.
Describe the problem or limitation you are having in your project
When there is a large (or even moderate, to be honest) number of stats, it becomes tedious to create a setget function for each. Sometimes, one might want to use a setget simply to be more threadsafe, but the function might not have anything beyond the basic return or set functionality. In these cases,, copy-pasting but changing a single word in the variable gets tedious.
(15:33 in this video is where I got the notion that it's more thread-safe, I am not knowledgeable enough to know if this is true or not, but I did decide to err on the side of caution and make setgets!)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
It might be convenient if there was a hotkey to auto-generate blank (or bare-bones) setters and getters by hovering over the base variable declaration. From there the functionality would perhaps use the var name and append "set_" and "get_" to the front for the functions declared as the setters and getters, and then generate a basic setter/getter at the bottom of the script, by those names.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Addressed in the last section mostly, however I'm not sure what hotkey would be best. Maybe Ctrl + J, since J can be a visual mnemonic for a sweeping line that loops at the bottom, adding something to your the bottom of your script.
If this enhancement will not be used often, can it be worked around with a few lines of script?
The problem can be worked around with a few lines... per variable (arguably though it's not even a workaround, it's just implementing a setget). The issue arises when there are many variables, and the cost is human lifetime and energy.
Is there a reason why this should be core and not an add-on in the asset library?
"This is about improving the usability of the code editor out of the box."
The text was updated successfully, but these errors were encountered: