예제 #1
0
    public void DrawCustomInspector(UnityEngine.Object target)
    {
        Undo.RecordObject(target, "HVR Asset Object");

        Object dataObj = asset.data;

        EditorGUI.BeginChangeCheck();
        {
            dataObj = EditorGUILayout.ObjectField("Folder", asset.data, typeof(Object), false);
        }
        if (EditorGUI.EndChangeCheck())
        {
            asset.SetDataFolderObject(dataObj);
        }

        asset.assetScaleFactor = EditorGUILayout.FloatField("Scale Factor", asset.assetScaleFactor);

        if (asset.data == null)
        {
            EditorGUILayout.PrefixLabel("Data not specified");
        }
        else
        {
            Inspector_HvrAsset.DrawInspector_AssetClipState(asset);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(asset);
            SceneView.RepaintAll();
        }
    }
예제 #2
0
    public void DrawCustomInspector(UnityEngine.Object target)
    {
        Undo.RecordObject(target, "HVR Actor");

        GUILayout.BeginVertical("box");
        {
            GUILayout.Label("Options", EditorStyles.boldLabel);

            actor.useBoxCollider = EditorGUILayout.ToggleLeft("Box Collider", actor.useBoxCollider);

            EditorGUILayout.BeginVertical("box");
            {
                actor.useOcclusionCulling = EditorGUILayout.ToggleLeft("Occlusion Checking", actor.useOcclusionCulling);
                EditorGUILayout.BeginHorizontal();
                {
                    if (actor.useOcclusionCulling)
                    {
                        EditorGUILayout.LabelField("Radius Offset");
                        actor.occlusionRadiusOffset = EditorGUILayout.Slider(actor.occlusionRadiusOffset, 0, 2);
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();

        GUILayout.BeginVertical("box");
        {
            GUILayout.Label("Debug", EditorStyles.boldLabel);

            actor.debugDrawBounds   = EditorGUILayout.ToggleLeft("Render Bounds", actor.debugDrawBounds);
            actor.debugDrawOccluder = EditorGUILayout.ToggleLeft("Render Occluder Bounds", actor.debugDrawOccluder);
        }
        GUILayout.EndVertical();

        GUILayout.BeginVertical("box");
        {
            GUILayout.Label("HvrAsset", EditorStyles.boldLabel);

            UnityEngine.Object assetClip = actor.GetAsset();

            EditorGUI.BeginChangeCheck();
            {
                assetClip = EditorGUILayout.ObjectField("Active Asset", assetClip, typeof(HvrAsset), false);
            }
            if (EditorGUI.EndChangeCheck())
            {
                if (assetClip == null)
                {
                    actor.SetAsset(null);
                }
                else
                {
                    if (assetClip.GetType() == typeof(HvrAsset))
                    {
                        actor.SetAsset((HvrAsset)assetClip);
                    }
                    else
                    {
                        actor.SetAsset(null);
                    }
                }
            }

            Inspector_HvrAsset.DrawInspector_AssetClipState(actor.GetAsset());
        }
        GUILayout.EndVertical();

        if (GUI.changed)
        {
            SceneView.RepaintAll();
        }
    }