I am making a plugin to help make post project details when posting here...but I need help getting it to work in the editor properly

The main point of this plugin is to help people make a succinct, organized post with the details of settings and scripts and scenes so it is easier to help them here.

Fortunately, since I am making something to help with forum posts, I can use it now. You can see the details of my project that it output below (starting with the Godot version).

Anyway, the issue I am having is that this works great when I play the scene in the editor, but when I enable it as a plugin and access it through the menu, it doesnt behave properly. The buttons dont work. I cant close it (minimizing works).

I am assuming it has to do with how godot handles menus vs windows…but I am driving in circles at this point.

I’d love to get this last piece working so that I can share this plugin.

4.3-stable (official) 77dcf97d8

Project Settings
config_version: <null>
application
config/name: Project Documentation
run/main_scene: res://addons/project_documentation/documetation_generator_dialog.tscn
config/features: ["4.3", "Mobile"]
config/icon: res://icon.svg
rendering
renderer/rendering_method: mobile

Scenes

res://addons/project_documentation/documetation_generator_dialog.tscn
Scene Tree
DocumentationGeneratorDialog (Window)
  VBoxContainer (VBoxContainer)
	ExportSceneTree (CheckBox)
	ExportSignalConnections (CheckBox)
	ExportChangedProperties (CheckBox)
	ExportNodeGroups (CheckBox)
	ExportScripts (CheckBox)
	ExportResources (CheckBox)
	ExportShaders (CheckBox)
	GenerateButton (Button)
	CancelButton (Button)
Signal Connections
  Signal Connections:
	..close_requested -> .._on_cancel_pressed (Flags: PERSIST)
	VBoxContainer/GenerateButton.pressed -> .._on_generate_pressed (Flags: PERSIST)
	VBoxContainer/CancelButton.pressed -> .._on_cancel_pressed (Flags: PERSIST)
Nodes
. (Window)

Script: res://addons/project_documentation/documentation_generator_dialog.gd
Changed Properties:

  position = (0, 36)
  size = (250, 400)
./VBoxContainer (VBoxContainer)

Changed Properties:

  custom_minimum_size = (0, 1000)
  offset_right = 236
  offset_bottom = 288
  size_flags_horizontal = 3
  size_flags_vertical = 3
./VBoxContainer/ExportSceneTree (CheckBox)

Changed Properties:

  layout_mode = 2
  button_pressed = true
  text = Export Scene Tree

./VBoxContainer/ExportSignalConnections (CheckBox)

Changed Properties:

  layout_mode = 2
  button_pressed = true
  text = Export Signal Connections
./VBoxContainer/ExportChangedProperties (CheckBox)

Changed Properties:

  layout_mode = 2
  button_pressed = true
  text = Export Changed Properties
./VBoxContainer/ExportNodeGroups (CheckBox)

Changed Properties:

  layout_mode = 2
  button_pressed = true
  text = Export Node Groups
./VBoxContainer/ExportScripts (CheckBox)

Changed Properties:

  layout_mode = 2
  button_pressed = true
  text = Export Scripts
./VBoxContainer/ExportResources (CheckBox)

Changed Properties:

  layout_mode = 2
  button_pressed = true
  text = Export Resources
./VBoxContainer/ExportShaders (CheckBox)

Changed Properties:

  layout_mode = 2
  button_pressed = true
  text = Export Shaders
./VBoxContainer/GenerateButton (Button)

Changed Properties:

  layout_mode = 2
  text = Generate
./VBoxContainer/CancelButton (Button)

Changed Properties:

  layout_mode = 2

Scripts

res://addons/project_documentation/documentation_generator_dialog.gd
# documentation_generator_dialog.gd
extends Window

func _ready():
	show()

func _on_generate_pressed():
	print("generate pressed")
	var options = {
		"export_scene_tree": $VBoxContainer/ExportSceneTree.is_pressed() ,
		"export_signal_connections": $VBoxContainer/ExportSignalConnections.is_pressed(),
		"export_changed_properties": $VBoxContainer/ExportChangedProperties.is_pressed(),
		"export_node_groups": $VBoxContainer/ExportNodeGroups.is_pressed(),
		"export_scripts": $VBoxContainer/ExportScripts.is_pressed(),
		"export_resources": $VBoxContainer/ExportResources.is_pressed(),
		"export_shaders": $VBoxContainer/ExportShaders.is_pressed()
	}
	var doc_generator = preload("res://addons/project_documentation/documentation_generator.gd").new()
	doc_generator.set_options(options)
	doc_generator.generate()
	hide()


func _on_cancel_pressed():
	print("cancel/close pressed")
	hide()

Resources

Shaders

1 Like

hide() might be behind it, other windows like project settings lock up the editor until they are closed, minimizing said windows still locks the editor.

Does this script work if you queue_free() the window instead of hiding it?


Really like this project by the way, very cool!

1 Like

Both queue_free() and hide() work when I launch the scene in editor, but not when I am using it from the menu as the addon.

But, the generate, close, and “X” buttons dont do anything either. I cant figure it out.

I am also not married to the idea of having it launched this way. I just want something simple enough that a new user here could use it to help succinctly share their projects.

So, if there is a different root node I could use rather than window and still get it to work fine, I’d be open to that.

Turns out, I needed to make that a @tool script. It works now.

I will make a post about it all tomorrow.

@gertkeno thanks for the help, it was the bump I needed. Also, I am really hoping to get some feedback from you specifically about the tool when I upload the whole thing.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.