Skip to content

Any example of how to select and copy using the API? #1101

Answered by Variable-ind
devmark404 asked this question in Q&A
Discussion options

You must be logged in to vote

Hy, what happens when you use the paste shortcut (Ctrl + V).
I tried this but it seems to work for me.

test-.9.mp4
extends Node

var extension_api: Node
var selection_node: Node  ## Used to interact with the selection directly, instead of through api

# This script acts as a setup for the extension
func _enter_tree() -> void:
	## NOTE: use get_node_or_null("/root/ExtensionsApi") to access api.
	extension_api = get_node_or_null("/root/ExtensionsApi")
	extension_api.menu.add_menu_item(extension_api.menu.SELECT, "Copy 9 Pixels", self)
	## NOTE: You may want to get some other properties of the selection e.g size.
	## for the moment those aren't exposed to API,
	## so you have to inte…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@Variable-ind
Comment options

@devmark404
Comment options

@Variable-ind
Comment options

@devmark404
Comment options

@Variable-ind
Comment options

Answer selected by devmark404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants