タイトル通り、Unity上でSkeletonAnimationコンポーネントの操作をeditor拡張機能をつかって自動化したいです。
例)spineのデータを差し替えた後、"SkeletonData Asset"のReloadボタンを押す(押した時に実行される処理をプログラム側から行う)

こういったことは可能でしょうか?

Related Discussions
...

I would like to automate the operation of the SkeletonAnimation component in Unity using an editor extension.
For example, after replacing Spine data, I want to programmatically perform the process that is executed when the "Reload" button of "SkeletonData Asset" is pressed.

Is this kind of operation possible?

はい、常に既存のインスペクタと同じ呼び出しを行うことができます。一般的には、それぞれのインスペクタの実装コード、この場合は SkeletonAnimationInspector.cs とベースクラスの SkeletonRendererInspector.cs を見てください。SkeletonRendererInspector.cs : L291 では、それぞれのインスペクタボタンが描画され評価され、217行目SpineEditorUtilities.ReloadSkeletonDataAssetAndComponent() が効果的に呼び出されます。

独自のエディタースクリプトを書く場合、上記の既存のInspectorコードと同じ呼び出しを発行して、同じ動作を実現できるはずです。



Yes, you can always issue the same calls as an existing Inspector. In general you can look at the respective Inspector implementation code, in this case SkeletonAnimationInspector.cs and the base-class SkeletonRendererInspector.cs. In SkeletonRendererInspector.cs : L291 the respective Inspector button is drawn and evaluated, effectively calling SpineEditorUtilities.ReloadSkeletonDataAssetAndComponent() in line 217.

When you write your own Editor scripts, you should be able to issue the same calls as the existing Inspector code above to achieve the same behaviour.

ありがとうございます!試してみます!!

お陰様でコンポーネントの操作をスクリプトから出来るようになりました。
ありがとうございます。

度重なる質問で申し訳ないのですが
Skeleton Unity(script)コンポーネントの"Spawn Hierarchy"ボタンを押すと実行される処理が
SkeletonUtility.cs内の"UnregisterBone()"だという所までは突き止めたのですが引数のboneは
どこから取得するのでしょうか?

もし可能でしたらお答えいただけますと幸いです。
よろしくお願いいたします。

おそらく機械翻訳があなたの返答を翻訳する際に間違えたのでしょうが、もしあなたがSpawn HierarchyボタンがUnregisterBone()を呼び出していると言っているのであれば、それは間違いです。これは SkeletonUtility.SpawnHierarchy() を呼び出しています。

次の行を見てください:
SkeletonUtilityInspector.cs : L172
SkeletonUtility.cs : L412


Perhaps machine translation made a mistake in translating your reply, but if you're saying that the Spawn Hierarchy button is calling UnregisterBone() then this is wrong. It is calling SkeletonUtility.SpawnHierarchy().

See the following lines:
SkeletonUtilityInspector.cs#L172
SkeletonUtility.cs#L412

お返事ありがとうございます。
一旦自動化したい内容を整理しますね。
・すでにSpineのセットアップは完了している状態でSpineデータを差し替えた後、以下の作業を手動で行っているので自動化したい。
1.SkeletonAnimation_SkeletonData Assetの"Reload"ボタンを押す > 実装済み
2.Skeleton Utility (Script)の"Remove Hierarchy"ボタンを押す
3.Skeleton Utility (Script)のボタンが"Spawn Hierarchy"に変わるので押した後"Follow all bones"を選択する
4.SkeletonUtiliry-SkeletonRoot/rootのインスペクタに切り替わるのでroot以下の任意のボーンを選択し、
 SkeletonUtilityBone内の"Mode"で"Follow"を"Override"に変える。

2~4までの操作を自動化する際、必要な処理を教えていただくことは可能でしょうか?

よろしくお願いいたします。

    2.Skeleton Utility (Script)の"Remove Hierarchy"ボタンを押す

    SkeletonUtilityInspector.cs : L122-L124

    3.Skeleton Utility (Script)のボタンが"Spawn Hierarchy"に変わるので押した後"Follow all bones"を選択する

    SkeletonUtility.cs : L413-L416

    4.SkeletonUtiliry-SkeletonRoot/rootのインスペクタに切り替わるのでroot以下の任意のボーンを選択し、
    SkeletonUtilityBone内の "Mode "で "Follow "を "Override "に変える。

    SkeletonUtilityBone utilityBone = <名前または任意の基準で子を検索>.GetComponent<SkeletonUtilityBone>();
    utilityBone.mode = SkeletonUtilityBone.Mode.Override;

    ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~


    mojimoji 2.Skeleton Utility (Script)の"Remove Hierarchy"ボタンを押す

    SkeletonUtilityInspector.cs : L122-L124

    mojimoji 3.Skeleton Utility (Script)のボタンが"Spawn Hierarchy"に変わるので押した後"Follow all bones"を選択する

    SkeletonUtility.cs : L413-L416

    mojimoji 4.SkeletonUtiliry-SkeletonRoot/rootのインスペクタに切り替わるのでroot以下の任意のボーンを選択し、
     SkeletonUtilityBone内の"Mode"で"Follow"を"Override"に変える。

    SkeletonUtilityBone utilityBone = <find child by name or whatever criterion>.GetComponent<SkeletonUtilityBone>();
    utilityBone.mode = SkeletonUtilityBone.Mode.Override;
    5 dias depois

    こちらで自動かうまくいきました。
    ありがとうございました!!

    それを聞いてとても嬉しいです。お知らせいただきありがとうございました!
    Very glad to hear, thanks for letting us know!