I want to change a Scene property in editor ,how to do it

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 2439905184

I am creating a 3d pose bone plugin .
how to chang skelenton bone pose by using plugin
and see it in editor
Do I really need to create a main scene plugin to change the other scene’s node’s property
here is my work
tool
extends EditorPlugin

var slide=preload(“res://addons/bone/Panel.tscn”).instance()
func _enter_tree():
add_control_to_dock(DOCK_SLOT_LEFT_UL,slide)
pass

func _exit_tree():
remove_control_from_docks(slide)
pass

this is in a tscn ,panel.gd (root node )
func _on_HSlider_value_changed(value):
emit_signal(“Xin_hao_rotate”)
pass

this is in my game scene skelenton.gd
func _on_Panel_Xin_hao_rotate():
spatial.rotation_degrees.x+=1
print(“xingao”)
set_bone_pose(0,spatial.get_transform())
I use print here try to print things .but It doesn’t print

I tried to use AutoLoad function and global Variable to do this
But the editor says invalid call .
so can any one give a help?
I tried use a similar plugin in assetlib,but it doesn’t work .
So I want to create my own plugin .
godot 3.2 stable

Just saying, but someone is working on a built-in way to edit bone poses in this pull request. It might be merged in Godot 4.0.

Calinou | 2020-03-05 08:34

Could you format the question by indenting the code a few spaces? Sorry, but its hard to read. Thank you.

CharlesMerriam | 2022-05-22 04:24

:bust_in_silhouette: Reply From: CharlesMerriam

Hello. I’m guessing at your question so please bear with me.

First, you can use export var my_var setget my_var_set_func my_var_get_func to make a property that can be set in the property editor and then call items to update your display. I believe you can do this without making it a tool. It seems unclear if the autoload variables will be available to tools.

Second, I constantly run into ordering problems among the nodes when setting up signals with connect. I often do this trick:

 var Skeleton
 # called when this scene is loaded
 def _ready():
       ...
       self.call_deferred("_started")

 # called when all scenes are loaded
 def _started():
      Skeleton = my_global_vars.Skeleton
      # connect to signals only after everything is initialized
      Skeleton.connect("broken_bone", self, "on_broken_bone")