예제 #1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        // Draw all public field using the default layout
        EditorGUILayout.PropertyField(this.workerBehaviourProp);
        EditorGUILayout.PropertyField(this.initCameraProp);
        EditorGUILayout.PropertyField(this.backgroundLayerProp);
        EditorGUILayout.PropertyField(this.useLastValidPoseProp);
        EditorGUILayout.PropertyField(this.overwriteOnLoadProp);

        // Only show the VisionLib initPose, if one object is selected
        if (this.targets.Length == 1)
        {
            VLInitCameraBehaviour behaviour =
                (VLInitCameraBehaviour)this.targets[0];
            Camera cam = (behaviour.initCamera ?
                          behaviour.initCamera :
                          behaviour.GetComponent <Camera>());
            if (cam)
            {
                UpdateInitPose(cam);
                ReadOnlyTextField(this.initPoseLabel, this.initPoseString,
                                  EditorStyles.helpBox);
            }
        }
        else
        {
            EditorGUILayout.HelpBox(
                "\"initPose\" preview does not work with multi-editing.",
                MessageType.Info);
        }

        serializedObject.ApplyModifiedProperties();
    }
예제 #2
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        // Draw all public field using the default layout
        EditorGUILayout.PropertyField(this.workerBehaviourProp);
        EditorGUILayout.PropertyField(this.initCameraProp);
        EditorGUILayout.PropertyField(this.backgroundLayerProp);
        EditorGUILayout.PropertyField(this.useLastValidPoseProp);
        EditorGUILayout.PropertyField(this.overwriteOnLoadProp);

        // Only show the VisionLib initPose, if one object is selected
        if (this.targets.Length == 1)
        {
            VLInitCameraBehaviour behaviour =
                (VLInitCameraBehaviour)this.targets[0];
            Camera cam = (behaviour.initCamera ?
                          behaviour.initCamera :
                          behaviour.GetComponent <Camera>());
            if (cam)
            {
                if (behaviour.workerBehaviour)
                {
                    UpdateInitPose(cam,
                                   behaviour.workerBehaviour.flipCoordinateSystemHandedness);
                }
                else
                {
                    this.initPoseString = "In the current version, the init pose\ncan only be generated if the\n\"WorkerBehaviour\" is set (e.g. in \nplay mode) because it depends on the\n\"flipCoordinateSystemHandedness\" variable.";
                }
                ReadOnlyTextField(this.initPoseLabel, this.initPoseString,
                                  EditorStyles.helpBox);
            }
        }
        else
        {
            EditorGUILayout.HelpBox(
                "\"initPose\" preview does not work with multi-editing.",
                MessageType.Info);
        }

        serializedObject.ApplyModifiedProperties();
    }