I have to make a documentation for my program, and that documentation have to contains class diagrams too.
My problem is, some method has too many parameters, and it makes the class diagram very long horizontally. And these large diagrams doesn't fit in the documentation.
Is there any way to break the line of the parameters? (I tried ctrl+enter) So the method will take place two lines, and it won't be that large horizontally.
How to resize the class elements in VP
For already existing classes:
Right click on the class - not on a class element.
On Popup menu choose Presentation Options -> Configure Class Presentation Options
Check Wrap Members , OK
Change the width of the class box and be happy.
For new classes from now on:
Tools-> Project Options->Diagramming->Class->Presentation
Check Wrap class Member, OK/Apply.
If you don't see some options
Go into Tools -> Application Options -> General -> Environment, check Advanced UI mode, apply and restart the whole application.
You can also divide a line by hand, using Alt+Enter
The Visual Paradigm documentation says to use Ctrl+Enter but on a OS X at least, it is opt+return.
Note that experience has shown that if you hold down opt too long before pressing return it will activate a menu shortcut mode*. When this happens it also leaves edit mode so hitting return at that point has no effect.
So on OS X be sure to hit return immediately after pressing down opt.
You can change the key sequence for line breaks on OS X by going to Windows -> Application Options -> Diagramming, and changing the drop-down value for "Create new line key".
*I tried several different Google searches to find the Visual Paradigm documentation that explains this "mode" but didn't have any luck. I invented the term "menu shortcut mode" to describe it.
Related
I come from Unity, and there you can use ContextMenu method attribute. It will add a button in the editor you can click and the method in your script will be invoked.
This is very helpful for testing/debugging purposes. When you are testing a functionality and you want an easy way to trigger it.
Is there something similar in Godot, or any workaround I can use?
(Godot 3.5 here)
There are multiple ways to run code in the editor.
In fact, Godot games and the Godot editor are built on the same core. One way to say is that Godot is build on Godot… But a more accurate way to say it is that your games are Godot without the editor, plus whatever you built on top.
As a consequence, you have a lot of freedom when extending the Godot editor.
For starters you will be making a tool script. To do that you the tool keyword on the top of the script file. This allows the script to run in the editor.
Warning: Remember that in Godot the Game is not running inside the Editor. Anything that your script moves while running in the Editor would be a modification to the project, for good or ill. And it does not come with build-in undo functionality. It is possible to add undo functionality (with the UndoRedo class), but that is also something you would have to program.
By the way, you might want to know if your code is running on the editor or not. For that, you can check Engine.editor_hint which will be true in the editor.
Read more on the article Running code in the editor.
Since the tool script modify the project. What I present below is more often used to setup parts of the scene or to automate parts of the development workflow. Not for testing features. However since the linked documentation about ContextMenu mentions that it is useful for…
automatically setting up Scene data from the script
I believe what present below is not out of place.
With that said, some modifications of the editor are harder than others. I believe you don't really want to go into the trouble of adding a button to the editor (which is perfectly possible) or an option to the menus (which is also possible, but not everywhere, at least not easily). Instead, I'll stay with the easy options for this answer:
You can make an EditorScript. That is a script that extends the EditorScript class and overrides the _run method. For example:
tool
extends EditorScript
func _run():
print("Hello from the Godot Editor!")
To execute it, have it open in the Script Editor, and to the File menu, and select Run. You can also use secondary click on the script on the "Scripts Panel (on the left of the Script Editor) and select Run in the contextual menu.
The drawback is that is script does not work in the game. It is only for the editor.
Although Godot 3.x does not have official (there is a plugin) support for inspector actions (it might land in Godot 4), we can workaround that. What we will do is export a bool property, and handle (with a setter, which we specify with setget) what happens when you set it. Like this:
tool
extends Node # or whatever
export var do_something:bool setget on_do_something
func on_do_something(_mod_value:bool) -> void:
# do whatever you want
pass
The property should show up as a checkbox in the Inspector panel when the node is selected. And clicking the checkbox will trigger the setter method on_do_something… Which will do whatever you want it to do. Notice also that I'm discarding the value that Godot is trying to set to the property (_mod_value) so it will remain false.
This pattern has got popularity among Godot developers.
If you want to add elements to the Godot UI you would have to make an EditorPlugin (see the Editor Plugins section in the documentation).
Alright but, since the tool script could cause modifications to the project, which might be a problem for testing… What do we do for testing?
Well, I will remind you that you can tell Godot to execute specific scenes (it does not have to run the main scene), and that can another way to test your code.
Furthermore, when your game is running you can go to the Scene panel and select the Remote tab to see the Nodes that exist in the game. Which will allow you to select them, which shows their properties in the Inspector, which would be able to modify (having an effect in real time on the executing game).
… And thus something similar to what I described above about using a setter would work. Except it does not need the tool keyword since it won't be running in the editor:
# No tool
extends Node # or whatever
export var do_something:bool setget on_do_something
func on_do_something(_mod_value:bool) -> void:
# do whatever you want
pass
By the way, in the inspector, when the game is executing and you have the relevant Node selected, you will see your property twice. The first one will trigger the setter, while the second one bypasses it. So pay attention which one you are using.
You might also be interested in the "Project Camera Override" feature, which allows you to freely move the game camera from the editor. You access the feature via the top bar in the editor.
You will also find that it is possible to modify Resources in the editor and see the effect in real time while the game is running. And a Script is a Resource… However pause the game from the Debugger panel (or use a breakpoint) and make sure the script you want to modify is not being executed before you modify it.
I'm trying to lock an entry widget in tool mode like this:
tool
extends Node
export(bool) var locked=false
export(String) var entry="" setget set_entry
func set_entry(new_val):
if!(locked):
entry=new_val
In theory, this should prevent any changes made to the entry widget
as It would rapidly change back to the previous value hence giving the illusion of being disabled
but in reality, you can type freely and after you select another node and then reselect the original node then the value returns to what it was before locking
How do I disable it completely? (perhaps using _set()?)
Edit
This is the problem I'm facing
To disable it completely, I think you need an Inspector Plugin (I talked a little about creating one elsewhere). You could make one that handles the property you are interested in and displays its value, but does not allow to edit it, or only allows to edit it conditionally.
However, for a quick and dirty approach you can do is tell the inspector that the properties changed:
func set_entry(new_val):
if!(locked):
entry=new_val
property_list_changed_notify()
This will cause the inspector to re-read the values of the properties. It can be a bit annoying, depending on the case. By the way, it seems to be ignored in sub-resources, which I find frustrating.
By the way, Godot 4 has PROPERTY_USAGE_READ_ONLY.
Addendum: We can be a little more aggressive than property_list_changed_notify, by using EditorInterface.inspect_object (we can get an instance of EditorInterface from an instance of EditorPlugin). Godot would reload the inspector (which also results in losing the keyboard focus).
I have been messing around with Android Studio and so far I like most of what I have seen. One thing that has been annoying me though is this lack of "Table of Contents" for a class. I apologize for not knowing exactly what to call it. But what I am referring to is the dropdown menu in eclipse that lists all the methods, interfaces, classes and so on that are in that class file. This then allows you to jump to that position. This view is when you are in "Package Explorer" and click the arrow to the left of the class. This is one thing that makes me really miss eclipse. I know that you can easily search with Ctrl+F inside a document but I often forget the method names. I tried looking through here but to no avail. Just wondering if anyone knows some way to handle this.
IDEA has a tab called "Structure", which shows all the methods, fields, etc. of the currently-open class.
I've just got a Tip of the Day popup in Android Studio helping with exactly this problem.
You can quickly navigate in the currently edited file with
Ctrl/⌘+F12 (Navigate | File Structure).
It shows the list of members of the current class. Select an element you want to navigate to and press the Enter key or the F4 key. To easily locate an item in the
list, just start typing its name.
Also, as danny117 points out, you can use Alt/⌘+7 to show / hide the same content in a side panel view (shown above in Chris Jester-Young's answer).
View > Tool Windows > Structure
In addition to what Chris Jester-Young said, it's worth pointing out how to see the methods and properties of a class pointed by the cursor.
a) Type Ctrl + H in the class pointed by cursor.
b) In the class name, in the hierarchy window, double-click the class name. The system, upon confirmation, will decompile and open the class code.
c) Alt + 7 (Windows) or Command + 7 (MAC) to display the structure window.
d) One can now visualize properties, methods, derived classes, derived interfaces, and even include inherited items. All related to the class under the caret.
I'm currently using Beta 0.8.9 of the Android Studio and what you need to do is click on the settings icon in the Android Project View. If you select 'Show Members' then the Classes become expandable and you can navigate around the class using the project view.
have any of you dreamweaver users had cases in which you are programming and finding yourself to use a particular piece of code over and over...
and over? See, I use all day the following pieces of code:
<?=__("
&
")?>
Question:
Is there anyway you programmers have found out a way to assign your favourite/most used code into a keyboard shortcut? I would love to put assign my two things to something like
Ctr+Shift+Num7 = [whatever programming code]
Ctr+Shift+Num9 = [whatever programming code]
Any suggestions would be very awesome as I know this is very specific...
I have tagged this question ad dreamweaver & adobe-dreamweaver only, this way hoping to find folks who have programming experience and have come across this real-world issue.
Dreamweaver allows you to assign keyboard shortcuts to Snippets.
Window -> Snippets
Create a snippet (click + button at bottom of the panel, or right click within the panel and choose New Snippet), in this case it appears that you want to have "wrap selection". Place the snippet content into the appropriate areas, give it a name an option description.
Edit -> Keyboard Shortcuts (or right-click in the Snippets panel select Edit Keyboard shortcuts.
Create a new keyboard shortcut set if have don't already have a custom set.
In the short cuts editor, make sure to select Snippets in the Commands list.
Select your snippet (it may be nested within a "folder", so drill in to the snippets locations).
Click + by Shortcuts
Enter your keyboard combination by hitting the key combo you want to use for this snippet.
Click OK
test your new snippet keyboard combo.
I am just getting into the WMD editor varieties out there :) Of all of them I like MarkEdit because of the ability to modify the menu items quite easily, but it doesn't do a couple of things that I really like in a couple of forks, for example, http://github.com/openlibrary/wmd.
Ideally my perfect WMD editor would:
create list items automatically on pressing return when in a list block (not implemented in MarkEdit)
allow the removal of menu items (implemented in MarkEdit)
the cheat of making a newline without the need for two spaces (implemented in MarkEdit)
As point 1. and 2. are both quite important to me, but I imagine 1. is harder to implement, I may have to use the forks such as the openlibrary-wmd rather than my preferred choice of MarkEdit.
How can I modify the menu buttons in a fork like openlibrary-wmd? The configuration function no longer seems to work as described for the original.
I recently used the markitup editor and found the skin implementation pretty useful. Each skin has its own images and styles which you can easily override if you need to. The editor is also jQuery-driven, which is nice if you're used to that syntax. Check it out