convert this script into a blender script using System.Collections; using…
- User
convert this script into a blender script
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CombineBoners : MonoBehaviour { void Snap_Bones(Transform bone) { foreach(Transform boneer in Base_Bones) { if(boneer.name == bone.name) { //RESIZE 'OTHER' BONE TO MATCH BASE BONE. bone.localScale = boneer.localScale;
code//PARENT 'OTHER' BONE TO BASE BONE. bone.parent = boneer; //ROTATE 'OTHER' BONE TO MATCH BASE BONE. bone.rotation = boneer.rotation; //POSITION 'OTHER' BONE TO MATCH BASE BONE. bone.position = boneer.position; } } } public List<Transform> Base_Bones = new List<Transform>(); public List<Transform> Other_Bones = new List<Transform>(); public GameObject Base_Rig; public GameObject Other_Rig; public void Start() { //GET ALL BASE RIG BONES & ORGANIZE THEM IN A LIST. ///////////////////////////////////////////////////////////////////////// foreach (Transform Bone in Base_Rig.GetComponentsInChildren<Transform>()) { Base_Bones.Add(Bone); } ///////////////////////////////////////////////////////////////////////// //GET ALL OTHER RIG BONES & ORGANIZE THEM IN A LIST. ///////////////////////////////////////////////////////////////////////// foreach (Transform Bone in Other_Rig.GetComponentsInChildren<Transform>()) { Other_Bones.Add(Bone); } ///////////////////////////////////////////////////////////////////////////////////// //SNAP OTHER BONES TO BASE RIG BONES | LOCATION | ROTATION | SCALE | TRANSFORM PARENT ///////////////////////////////////////////////////////////////////////////////////// foreach (Transform bone in Other_Bones) { Snap_Bones(bone); } }}
- Assistant
Here's a Blender script that replicates the functionality of your Unity C# script. This script will adjust the location, rotation, and scale of the bones from one armature to match those of another armature. Please ensure you have both armatures in your Blender scene before running the script.
- User
give it a button and input fields
- Assistant