internal void SwitchToEditMode() { // Lock inspector ChangeInspectorLock(true); string assetPath = AssetDatabase.GetAssetPath(target); AvatarConfigurationStage stage = AvatarConfigurationStage.CreateStage(assetPath, this); StageUtility.GoToStage(stage, true); m_EditMode = EditMode.Starting; // Instantiate character m_GameObject = stage.gameObject; if (serializedAssetImporter.FindProperty("m_OptimizeGameObjects").boolValue) { AnimatorUtility.DeoptimizeTransformHierarchy(m_GameObject); } SerializedProperty humanBoneArray = serializedAssetImporter.FindProperty("m_HumanDescription.m_Human"); // First get all available modelBones Dictionary <Transform, bool> modelBones = AvatarSetupTool.GetModelBones(m_GameObject.transform, true, null); AvatarSetupTool.BoneWrapper[] humanBones = AvatarSetupTool.GetHumanBones(humanBoneArray, modelBones); m_ModelBones = AvatarSetupTool.GetModelBones(m_GameObject.transform, false, humanBones); // Unfold all nodes in hierarchy // TODO@MECANIM: Only expand actual bones foreach (SceneHierarchyWindow shw in Resources.FindObjectsOfTypeAll(typeof(SceneHierarchyWindow))) { shw.SetExpandedRecursive(m_GameObject.GetInstanceID(), true); } CreateEditor(); m_EditMode = EditMode.Editing; }
private void OnEnable() { NuitrackPreviewStage stage = CreateInstance <NuitrackPreviewStage>(); StageUtility.GoToStage(stage, true); stage.SceneSetup(target); Selection.activeObject = target; poseWrapper = new NuitrackPoseWrapper(serializedObject); skeletonMapper = new SkeletonMapperGUI <Transform>(NuitrackPoseWrapper.JointsMask, null, colorTheme); skeletonMapper.OnSelected += SkeletonMapper_OnSelected; skeletonPoseView = new SkeletonPoseView(null, NuitrackPoseWrapper.JointsMask, colorTheme); skeletonPoseView.OnBoneSetActive += OnBoneActivated; skeletonPoseView.OnBoneDelete += OnBoneDeactivated; skeletonPoseView.OnBoneRotate += SkeletonPoseView_OnBoneRotate; skeletonPoseView.OnBoneToleranceChanged += SkeletonPoseView_OnBoneToleranceChanged; SceneView.duringSceneGui += OnSceneGUI; }