Example #1
0
    private void DrawVerticalNodeTransition(StoryboardNode node1, StoryboardNode node2, float yAddition)
    {
        Vector3[] points = new Vector3[4]
        {
            new Vector3(node1.m_rect.x + node1.m_rect.width / 2.0f, node1.m_rect.y + node1.m_rect.height, 0),
            new Vector3(node1.m_rect.x + node1.m_rect.width / 2.0f, node1.m_rect.y + node1.m_rect.height + yAddition / 2.0f, 0),
            new Vector3(node2.m_rect.x + node2.m_rect.width / 2.0f, node1.m_rect.y + node1.m_rect.height + yAddition / 2.0f, 0),
            new Vector3(node2.m_rect.x + node2.m_rect.width / 2.0f, node2.m_rect.y, 0),
        };

        Vector3[] pointsArrow1 = new Vector3[2]
        {
            new Vector3(node2.m_rect.x + node2.m_rect.width / 2.0f, node2.m_rect.y, 0),
            new Vector3(node2.m_rect.x + node2.m_rect.width / 2.0f - 10, node2.m_rect.y - 10, 0),
        };


        Vector3[] pointsArrow2 = new Vector3[2]
        {
            new Vector3(node2.m_rect.x + node2.m_rect.width / 2.0f, node2.m_rect.y, 0),
            new Vector3(node2.m_rect.x + node2.m_rect.width / 2.0f + 10, node2.m_rect.y - 10, 0),
        };

        Color lineColor = Color.white;

        ColorUtility.TryParseHtmlString("#A58961", out lineColor);
        Handles.color = lineColor;
        Handles.DrawAAPolyLine(3.0f, points);
        Handles.DrawAAPolyLine(3.0f, pointsArrow1);
        Handles.DrawAAPolyLine(3.0f, pointsArrow2);
    }
Example #2
0
    public override bool Simulate(StoryboardData data, StoryboardNode currentNode, StoryboardNode nextNode, SimulationTargetData targetData)
    {
        Vector3    finalPosition = Vector3.zero;
        Quaternion finalRotation = Quaternion.identity;

        int counter = 0;

        while (counter < data.m_implementationTimeout)
        {
            float distance            = Random.Range(m_distanceLB, m_distanceUB);
            float directionMultiplier = m_fixedDirection ? (m_isRight ? 1.0f : -1.0f) : ((Random.Range(0.0f, 1.0f) < 0.5f) ? -1.0f : 1.0f);
            finalPosition = targetData.m_targetPosition + targetData.m_targetRight * directionMultiplier * distance;
            finalRotation = Quaternion.LookRotation(targetData.m_targetPosition - finalPosition);

            if (CheckVisibility(data, currentNode, finalPosition, finalRotation, targetData))
            {
                SetSimulationData(currentNode, finalPosition, finalRotation, data.m_defaultFOV);
                return(true);
            }
            counter++;
        }

        SetSimulationData(currentNode, finalPosition, finalRotation, data.m_defaultFOV);
        return(false);
    }
Example #3
0
    public override bool Simulate(StoryboardData data, StoryboardNode currentNode, StoryboardNode nextNode, SimulationTargetData targetData)
    {
        Vector3    finalPosition = Vector3.zero;
        Quaternion finalRotation = Quaternion.identity;

        int counter = 0;

        while (counter < data.m_implementationTimeout)
        {
            Vector3 onSphere1 = targetData.m_targetPosition + Random.onUnitSphere * m_radiusLB;
            Vector3 onSphere2 = targetData.m_targetPosition + Random.onUnitSphere * m_radiusUB;
            finalPosition = Vector3.Lerp(onSphere1, onSphere2, Random.value);
            finalRotation = Quaternion.LookRotation(targetData.m_targetPosition - finalPosition);

            if (CheckVisibility(data, currentNode, finalPosition, finalRotation, targetData))
            {
                SetSimulationData(currentNode, finalPosition, finalRotation, data.m_defaultFOV);
                return(true);
            }
            counter++;
        }

        SetSimulationData(currentNode, finalPosition, finalRotation, data.m_defaultFOV);
        return(false);
    }
    protected bool CheckVisibility(StoryboardData data, StoryboardNode currentnode, Vector3 finalPosition, Quaternion finalRotation, SimulationTargetData targetData)
    {
        ProxySet proxySet = data.m_proxySets[currentnode.m_index];

        if (proxySet.CheckIfContains(finalPosition))
        {
            return(false);
        }

        RaycastHit hit;
        Vector3    dir = (targetData.m_targetPosition - finalPosition);

        if (Physics.SphereCast(finalPosition, data.m_visibilityCapsuleRadius, dir.normalized, out hit, dir.magnitude))
        {
            if (targetData.m_target != null && hit.transform == targetData.m_target)
            {
                return(true);
            }
            else if (targetData.m_target != null && hit.transform != targetData.m_target)
            {
                return(Vector3.Distance(hit.point, targetData.m_target.position) < data.m_visibilityContactThreshold);
            }
            else if (targetData.m_target == null)
            {
                return(Vector3.Distance(hit.point, targetData.m_targetPosition) < data.m_visibilityContactThreshold);
            }
            else
            {
                return(false);
            }
        }
        return(true);
    }
Example #5
0
    public override bool Simulate(StoryboardData data, StoryboardNode currentNode, StoryboardNode nextNode, SimulationTargetData targetData)
    {
        float      distance      = 0.0f;
        Vector3    fwPosition    = Vector3.zero;
        Vector3    rightPosition = Vector3.zero;
        Vector3    leftPosition  = Vector3.zero;
        Vector3    upPosition    = Vector3.zero;
        Vector3    downPosition  = Vector3.zero;
        Vector3    finalPosition = Vector3.zero;
        Quaternion finalRotation = Quaternion.identity;

        int counter = 0;

        while (counter < data.m_implementationTimeout)
        {
            float t = Random.Range(-m_xArc, m_xArc);
            distance      = Random.Range(m_distanceLB, m_distanceUB);
            fwPosition    = targetData.m_targetPosition + targetData.m_targetForward * distance;
            rightPosition = targetData.m_targetPosition + targetData.m_targetRight * distance;
            leftPosition  = targetData.m_targetPosition + -targetData.m_targetRight * distance;
            upPosition    = targetData.m_targetPosition + targetData.m_targetUp * distance;
            downPosition  = targetData.m_targetPosition + -targetData.m_targetUp * distance;
            finalPosition = fwPosition;

            if (t > 0)
            {
                finalPosition = MathUtility.SampleParabola(fwPosition, leftPosition, m_arcHeight, t, Quaternion.LookRotation(leftPosition - finalPosition) * Vector3.right);
            }
            else
            {
                finalPosition = MathUtility.SampleParabola(fwPosition, rightPosition, m_arcHeight, -t, Quaternion.LookRotation(rightPosition - finalPosition) * Vector3.left);
            }

            t = Random.Range(-m_yArc, m_yArc);

            if (t > 0)
            {
                finalPosition = MathUtility.SampleParabola(finalPosition, upPosition, m_arcHeight, t, Quaternion.LookRotation(upPosition - finalPosition) * Vector3.up);
            }
            else
            {
                finalPosition = MathUtility.SampleParabola(finalPosition, downPosition, m_arcHeight, -t, Quaternion.LookRotation(downPosition - finalPosition) * Vector3.down);
            }

            finalRotation = Quaternion.LookRotation(targetData.m_targetPosition - finalPosition);

            if (CheckVisibility(data, currentNode, finalPosition, finalRotation, targetData))
            {
                SetSimulationData(currentNode, finalPosition, finalRotation, data.m_defaultFOV);
                return(true);
            }

            counter++;
        }

        SetSimulationData(currentNode, finalPosition, finalRotation, data.m_defaultFOV);
        return(false);
    }
Example #6
0
    public override void Play(Camera cam, StoryboardNode node, Transform camManipulator)
    {
        Transform target = node.m_simulationData.m_targetData.m_target;

        if (target != null)
        {
            Vector3 offset = node.m_simulationData.m_targetData.m_targetPosition - camManipulator.position;
            m_routine = StoryboardPlayController.Instance.StartCoroutine(Routine(cam.transform, target, camManipulator, offset));
        }
    }
Example #7
0
    private CinematographyTechnique GetTechnique(string categoryID, StoryboardNode previousNode, StoryboardNode node, StoryboardDirectorData dirData, DecisionTechniquePreference pref, float dramThresh, float paceThresh, bool useFX)
    {
        int selectedIndex = -1;
        int it            = 0;

        CinematographyTechniqueCategory category         = dirData.m_categories.Find(o => o.m_title.CompareTo(categoryID) == 0);
        List <CinematographyTechnique>  dataList         = new List <CinematographyTechnique>(category.m_techniques);
        CinematographyTechnique         defaultTechnique = category.m_defaultTechnique;

        if (categoryID.CompareTo("FX") == 0 && !useFX)
        {
            return(dataList.Find(o => o.m_title.CompareTo("NoFX") == 0));
        }


        // Eliminate some techniques from the data list based on the previous node's technique information if necessary.
        if (previousNode != null)
        {
            ApplyShotBasedRuleset(categoryID, ref dataList, previousNode);
        }

        // Eliminate some techniques based on the current node's categories.
        ApplyNodeBasedRuleset(categoryID, ref dataList, node);

        // After we've selected the closest random technique, compare it's dramatization & pace.
        while (it < m_iterationTimeout)
        {
            // Select technique.
            if (pref == DecisionTechniquePreference.ProbabilityDistribution)
            {
                selectedIndex = MathUtility.GetCumulativeDistribution(dataList.Select(o => o.m_probabilityDistribution).ToArray());
            }
            else if (pref == DecisionTechniquePreference.ExponentialDistribution)
            {
                selectedIndex = MathUtility.GetCumulativeDistribution(dataList.Select(o => o.m_classDistribution).ToArray());
            }

            if (selectedIndex != -1)
            {
                // Check dramatization & pace thresholds for the selected technique.
                CinematographyTechnique techniqueData = dataList[selectedIndex];
                bool dramatizationChecks = dramThresh == 1.0f || (node.m_marker.m_dramatization > techniqueData.m_dramatization && node.m_marker.m_dramatization - techniqueData.m_dramatization < dramThresh);
                bool paceChecks          = paceThresh == 1.0f || (node.m_marker.m_pace > techniqueData.m_pace && node.m_marker.m_pace - techniqueData.m_pace < dramThresh);

                if (dramatizationChecks && paceChecks)
                {
                    return(techniqueData);
                }
            }

            it++;
        }
        dataList = null;
        return(defaultTechnique);
    }
Example #8
0
    private void DrawHorizontalNodeTransition(StoryboardNode node1, StoryboardNode node2)
    {
        Vector3[] points = new Vector3[2] {
            new Vector3(node1.m_rect.x + node1.m_rect.width, node1.m_rect.y + node1.m_rect.height / 2.0f, 0),
            new Vector3(node2.m_rect.x - 5.0f, node2.m_rect.y + node2.m_rect.height / 2.0f, 0),
        };

        Vector3[] pointsArrow1 = new Vector3[2] {
            points[1],
            new Vector3(points[1].x - 10, points[1].y - 10, 0),
        };


        Vector3[] pointsArrow2 = new Vector3[2] {
            points[1],
            new Vector3(points[1].x - 10, points[1].y + 10, 0),
        };

        Color lineColor = Color.white;

        ColorUtility.TryParseHtmlString("#A58961", out lineColor);
        Handles.color = lineColor;
        Handles.DrawAAPolyLine(3.0f, points);
        Handles.DrawAAPolyLine(3.0f, pointsArrow1);
        Handles.DrawAAPolyLine(3.0f, pointsArrow2);

        if (Application.isPlaying && m_storyboardData.m_transitionNode != null && m_storyboardData.m_transitionNode == node1)
        {
            Color transitionColor = Color.white;
            ColorUtility.TryParseHtmlString("#F5EBE0", out transitionColor);
            Handles.color = transitionColor;
            Vector3 target = Vector3.Lerp(points[0], points[1], s_transitionTimer);
            Handles.DrawLine(points[0], target);
            s_transitionTimer += Time.unscaledDeltaTime * 0.2f;
            if (s_transitionTimer > 1.0f)
            {
                s_transitionTimer = 0.0f;
            }
        }
    }
    public void OnNotify(Playable origin, INotification notification, object context)
    {
        if (m_storyboardData == null)
        {
            return;
        }

        if (notification is StoryboardMarker marker)
        {
            if (m_previousNode != null)
            {
                m_previousNode.m_lookTechnique.m_implementation.Stop(m_camera);
                m_previousNode.m_trackTechnique.m_implementation.Stop(m_camera);
            }

            StoryboardNode node = m_storyboardData.m_nodes.Find(o => o.m_marker == marker);

            if (node != null)
            {
                SimulationData simData = node.m_simulationData;
                m_cameraManipulator.position = simData.m_cameraPosition;
                m_cameraManipulator.rotation = simData.m_cameraRotation;
                m_camera.fieldOfView         = simData.m_cameraFOV;

                node.m_lookTechnique.m_implementation.Play(m_camera, node, m_cameraManipulator);
                node.m_trackTechnique.m_implementation.Play(m_camera, node, m_cameraManipulator);
                node.m_fxTechnique.m_implementation.Play(m_camera, node, m_cameraManipulator);
                m_previousNode = node;

#if UNITY_EDITOR
                m_storyboardData.m_transitionNode = node;
#endif
            }

            m_markerCount++;
        }
    }
Example #10
0
    public bool FillStoryboardNodes(StoryboardData storyboardData, TimelineAsset timeline, string dataDumpPath)
    {
        // Save locked nodes.
        List <StoryboardNode> lockedNodes = new List <StoryboardNode>();

        for (int i = 0; i < storyboardData.m_nodes.Count; i++)
        {
            StoryboardNode currentNode = storyboardData.m_nodes[i];

            if (currentNode.m_isLocked)
            {
                lockedNodes.Add(currentNode);
            }
            else
            {
                for (int j = 0; j < currentNode.m_simulationData.m_snapshots.Count; j++)
                {
                    string path = AssetDatabase.GetAssetPath(currentNode.m_simulationData.m_snapshots[j]);
                    AssetDatabase.DeleteAsset(path);
                    AssetDatabase.Refresh();
                }
            }
        }

        // First fill the nodes with markers.
        storyboardData.m_nodes.Clear();
        IEnumerable <IMarker> markers = timeline.markerTrack.GetMarkers();

        markers = markers.OrderBy(a => a.time);
        IEnumerator markersIt = markers.GetEnumerator();
        int         index     = 0;

        while (markersIt.MoveNext())
        {
            if (markersIt.Current is StoryboardMarker marker)
            {
                int foundIndex = lockedNodes.FindIndex(o => o.m_marker == marker);

                if (foundIndex > -1)
                {
                    if (lockedNodes[foundIndex].m_index != index)
                    {
                        for (int j = 0; j < lockedNodes[foundIndex].m_simulationData.m_snapshots.Count; j++)
                        {
                            string assetPath = dataDumpPath + "/" + storyboardData.name + "_node_" + lockedNodes[foundIndex].m_index.ToString() + "_" + j.ToString() + ".texture2d";
                            string newPath   = storyboardData.name + "_node_" + index.ToString() + "_" + j.ToString() + ".texture2d";

                            string msg = AssetDatabase.RenameAsset(assetPath, newPath);
                            AssetDatabase.SaveAssets();
                        }
                    }

                    lockedNodes[foundIndex].m_index = index;
                    storyboardData.m_nodes.Add(lockedNodes[foundIndex]);
                }
                else
                {
                    storyboardData.m_nodes.Add(new StoryboardNode());
                    StoryboardNode node = storyboardData.m_nodes.Last();
                    node.m_marker = marker;
                    node.m_index  = index;
                }

                index++;
            }
        }

        return(storyboardData.m_nodes.Count != 0);
    }
Example #11
0
 public override void Play(Camera cam, StoryboardNode node, Transform camManipulator)
 {
 }
Example #12
0
 public override void Play(Camera cam, StoryboardNode node, Transform camManipulator)
 {
     m_dollyRoutine = StoryboardPlayController.Instance.StartCoroutine(DollyRoutine(cam));
 }
Example #13
0
    public bool Simulate(StoryboardWindow window, Transform cameraTransform, StoryboardData data, TimelineAsset timeline, PlayableDirector playable,
                         ref int simulatedMarkerCount, string debugPositioning, string debugLook, string debugTrack, string debugFX, RenderTexture rt, bool simulateAll, int simulatedIndex = -1)
    {
        StoryboardNode previousNode = simulateAll ? null : (simulatedIndex == 0 ? null : data.m_nodes[simulatedIndex - 1]);

        int iStart = simulateAll ? 0 : simulatedIndex;
        int iEnd   = simulateAll ? data.m_nodes.Count : simulatedIndex + 1;

        for (int i = iStart; i < iEnd; i++)
        {
            StoryboardNode currentNode = data.m_nodes[i];

            if (currentNode.m_isLocked)
            {
                previousNode = currentNode;
                simulatedMarkerCount++;
                continue;
            }

            // Calculate target position
            SimulationTargetData targetData = new SimulationTargetData();
            targetData.m_target         = null;
            targetData.m_targetForward  = Vector3.forward;
            targetData.m_targetRight    = Vector3.right;
            targetData.m_targetUp       = Vector3.up;
            targetData.m_targetPosition = Vector3.zero;

            for (int j = 0; j < currentNode.m_marker.m_targets.Length; j++)
            {
                var objects = Resources.FindObjectsOfTypeAll <StoryboardTarget>().Where(obj => obj.gameObject.name == currentNode.m_marker.m_targets[j]);

                if (objects.Count <StoryboardTarget>() > 1)
                {
                    Debug.LogError("Multiple storyboard targets with the same name is found. Please make sure each target has a unique name to avoid any confusions.");
                    currentNode.m_simulationData = null;
                    data.m_nodes.Clear();
                    return(false);
                }

                GameObject go = GameObject.Find(currentNode.m_marker.m_targets[j]);

                if (go == null)
                {
                    Debug.LogError("The target " + currentNode.m_marker.m_targets[j] + " could not be found, aborting simulation.");
                    currentNode.m_simulationData = null;
                    data.m_nodes.Clear();
                    return(false);
                }

                targetData.m_targetPosition += go.transform.position;

                if (currentNode.m_marker.m_targets.Length == 1)
                {
                    targetData.m_target         = go.transform;
                    targetData.m_targetPosition = targetData.m_target.position;
                    targetData.m_targetForward  = targetData.m_target.forward;
                    targetData.m_targetRight    = targetData.m_target.right;
                    targetData.m_targetUp       = targetData.m_target.up;
                }
            }

            // Finalize target position as mid point.
            targetData.m_targetPosition /= currentNode.m_marker.m_targets.Length;

            StoryboardDirectorData      dirData = data.m_directorData;
            DecisionTechniquePreference pref    = data.m_decisionTechnique;
            float          dramThresh           = data.m_dramatizationThreshold;
            float          paceThresh           = data.m_paceThreshold;
            bool           useFX = data.m_useFX;
            bool           simulationSuccessful = false;
            int            timeoutCounter       = 0;
            StoryboardNode nextNode             = i < data.m_nodes.Count - 1 ? data.m_nodes[i + 1] : null;

            while (!simulationSuccessful && timeoutCounter < data.m_techniqueTimeout)
            {
                currentNode.m_positioningTechnique = GetTechnique("Positioning", previousNode, currentNode, dirData, pref, dramThresh, paceThresh, useFX);
                currentNode.m_simulationData       = new SimulationData();
                simulationSuccessful = currentNode.m_positioningTechnique.m_implementation.Simulate(data, currentNode, nextNode, targetData);
                timeoutCounter++;
            }

            // Set simulation's target data.
            currentNode.m_simulationData.m_targetData = targetData;


            //currentNode.m_lookTechnique = GetTechnique("Look", previousNode, currentNode, dirData, pref, dramThresh, paceThresh, useFX);
            //currentNode.m_trackTechnique = GetTechnique("Track", previousNode, currentNode, dirData, pref, dramThresh, paceThresh, useFX);
            //currentNode.m_fxTechnique = GetTechnique("FX", previousNode, currentNode, dirData, pref, dramThresh, paceThresh, useFX);

            // D E B U G
            if (debugPositioning != "")
            {
                currentNode.m_trackTechnique = data.m_directorData.m_categories[0].m_techniques.Find(o => o.m_title.CompareTo(debugPositioning) == 0);
            }
            if (debugLook != "")
            {
                currentNode.m_lookTechnique = data.m_directorData.m_categories[1].m_techniques.Find(o => o.m_title.CompareTo(debugLook) == 0);
            }
            if (debugTrack != "")
            {
                currentNode.m_trackTechnique = data.m_directorData.m_categories[2].m_techniques.Find(o => o.m_title.CompareTo(debugTrack) == 0);
            }
            if (debugFX != "")
            {
                currentNode.m_fxTechnique = data.m_directorData.m_categories[3].m_techniques.Find(o => o.m_title.CompareTo(debugFX) == 0);
            }

            ApplySimulationPropertiesToCamera(currentNode.m_simulationData, cameraTransform);
            currentNode.m_simulationData.m_snapshots.Add(TakeCameraSnapshot(cameraTransform.GetComponent <Camera>(), rt));

            previousNode = currentNode;
            simulatedMarkerCount++;
            targetData = null;
        }

        // Make sure we reset back the playable.
        playable.time = 0.0;
        playable.Evaluate();
        window.OnSimulationEnd();
        return(true);
    }
Example #14
0
    private void DrawBoard()
    {
        // Prepare zoomable area.
        m_zoomArea = new Rect(m_propertyPanelWidth, 0, m_boardPanelWidth, Screen.height);

        // Draw background.
        EditorGUI.DrawRect(new Rect(m_propertyPanelWidth, 0, m_boardPanelWidth, Screen.height), new Color(0.1f, 0.1f, 0.1f));

        if (m_storyboardData == null)
        {
            return;
        }

        // Information.
        if (m_storyboardData && m_storyboardData.m_nodes.Count == 0)
        {
            EditorGUI.LabelField(new Rect(m_propertyPanelWidth + 20, 20, 100, 50), "No nodes found, please generate.", m_resources.m_mediumLabel);
        }

        // Begin zoom area.
        EditorZoomArea.Begin(m_zoomScale, m_zoomArea);

        Vector2 windowStartPosition = new Vector2(50, 50);
        Vector2 windowPosition      = windowStartPosition;
        int     horizontalCounter   = 0;
        Vector2 textureSize         = new Vector2(300, 300);
        Vector2 windowSize          = new Vector2(350, 510);

        float xAddition      = 150;
        float yAddition      = 100;
        float totalXAddition = windowSize.x + xAddition;
        float totalYAddition = windowSize.y + yAddition;

        Color windowColor = new Color(0.15f, 0.15f, 0.15f, 1.0f);
        Color windowBorderColorUnlocked = new Color(0.05f, 0.05f, 0.05f, 1.0f);
        Color windowBorderColorLocked   = new Color(0.05f, 0.35f, 0.05f, 1.0f);

        Color textureBorderColor = new Color(0.05f, 0.05f, 0.05f, 1.0f);

        ColorUtility.TryParseHtmlString("#53505A", out textureBorderColor);
        ColorUtility.TryParseHtmlString("#A58961", out windowBorderColorLocked);

        for (int i = 0; i < m_storyboardData.m_nodes.Count; i++)
        {
            StoryboardNode node = m_storyboardData.m_nodes[i];

            // m_storyboardData.m_nodes[i].m_rect = GUI.Window(i, m_storyboardData.m_nodes[i].m_rect, DrawNodeWindow,"");
            node.m_rect = new Rect(windowPosition.x - m_zoomCoordsOrigin.x, windowPosition.y - m_zoomCoordsOrigin.y, windowSize.x, windowSize.y);

            if (i != 0 && horizontalCounter != 0)
            {
                StoryboardNode previousNode = m_storyboardData.m_nodes[i - 1];
                DrawHorizontalNodeTransition(previousNode, node);
            }
            else if (i != 0 && horizontalCounter == 0)
            {
                StoryboardNode previousNode = m_storyboardData.m_nodes[i - 1];
                DrawVerticalNodeTransition(previousNode, node, yAddition);
            }


            if (horizontalCounter < 3)
            {
                windowPosition.x += totalXAddition;
                horizontalCounter++;
            }
            else
            {
                horizontalCounter = 0;
                windowPosition.y += totalYAddition;
                windowPosition.x  = windowStartPosition.x;
            }
        }

        // Draw each node.
        for (int i = 0; i < m_storyboardData.m_nodes.Count; i++)
        {
            StoryboardNode node = m_storyboardData.m_nodes[i];
            Color          windowBorderColor = node.m_isLocked ? windowBorderColorLocked : windowBorderColorUnlocked;
            Rect           nodeRect          = node.m_rect;

            // Outline
            EditorGUI.DrawRect(new Rect(nodeRect.x - 2, nodeRect.y - 2, nodeRect.width + 4, nodeRect.height + 4), windowBorderColor);

            // Window.
            EditorGUI.DrawRect(new Rect(nodeRect.x, nodeRect.y, nodeRect.width, nodeRect.height), windowColor);

            // Header
            GUI.Label(new Rect(nodeRect.x + 10, nodeRect.y + 10, 100, 50), "MARKER " + i.ToString(), m_resources.m_nodeTitleLabel);

            GUI.enabled = !node.m_isLocked;

            // Header buttons.
            if (GUI.Button(new Rect(nodeRect.x + windowSize.x - 160, nodeRect.y + 5, 75, 30), "Resimulate"))
            {
                m_simulator.Simulate(this, m_camera.transform, m_storyboardData, m_timeline, m_playableDirector,
                                     ref m_simulatedMarkers, m_debugPositioning, m_debugLook, m_debugTrack, m_debugFX, m_renderTexture, false, i);

                SaveSimulationTextures(false, i);
            }

            GUI.enabled = true;

            string lockButtonText = node.m_isLocked ? "Unlock" : "Lock";
            if (GUI.Button(new Rect(nodeRect.x + windowSize.x - 80, nodeRect.y + 5, 75, 30), lockButtonText, node.m_isLocked ? m_resources.m_lockButtonLockedStyle : m_resources.m_lockButtonUnlockedStyle))
            {
                node.m_isLocked = !node.m_isLocked;
            }

            // Header separator.
            for (int j = 0; j < 10; j++)
            {
                EditorGUI.DrawRect(new Rect(nodeRect.x, nodeRect.y + 40 + ((float)j * 1), windowSize.x, 1), new Color(0.0f, 0.0f, 0.0f, 0.5f - ((j + 1) * 0.05f)));
            }


            // Information.
            Rect fieldsRect = nodeRect;

            fieldsRect.x += 10;
            fieldsRect.y += 55;
            GUI.Label(fieldsRect, "Time: " + node.m_marker.time.ToString("F2"), m_resources.m_nodeFieldLabel);

            fieldsRect.y += 17.5f;

            if (node.m_marker.m_targets.Length > 1)
            {
                GUI.Label(fieldsRect, "Target: Multiple", m_resources.m_nodeFieldLabel);
            }
            else if (node.m_marker.m_targets.Length > 0)
            {
                GUI.Label(fieldsRect, "Target: Single", m_resources.m_nodeFieldLabel);
            }

            else
            {
                GUI.Label(fieldsRect, "Target: None", m_resources.m_nodeFieldLabel);
            }

            fieldsRect.y -= 17.5f;
            fieldsRect.x += windowSize.x - 170;
            GUI.Label(fieldsRect, "Dramatization: " + node.m_marker.m_dramatization.ToString("F2"), m_resources.m_nodeFieldLabel);

            fieldsRect.y += 17.5f;
            GUI.Label(fieldsRect, "Pace: " + node.m_marker.m_pace.ToString("F2"), m_resources.m_nodeFieldLabel);

            fieldsRect.y += 25;
            EditorGUI.DrawRect(new Rect(nodeRect.x, fieldsRect.y, windowSize.x, 1), new Color(0.0f, 0.0f, 0.0f, 0.5f));

            // Separator - Techniques
            fieldsRect.x  = nodeRect.x + 10;
            fieldsRect.y += 10;
            GUI.Label(fieldsRect, "Positioning: " + node.m_positioningTechnique.m_implementation.GetType().ToString(), m_resources.m_nodeFieldLabel);

            fieldsRect.y += 17.5f;
            GUI.Label(fieldsRect, "Look: " + node.m_lookTechnique.m_implementation.GetType().ToString(), m_resources.m_nodeFieldLabel);

            fieldsRect.y -= 17.5f;
            fieldsRect.x += windowSize.x - 170;
            GUI.Label(fieldsRect, "Track: " + node.m_trackTechnique.m_implementation.GetType().ToString(), m_resources.m_nodeFieldLabel);

            fieldsRect.y += 17.5f;
            GUI.Label(fieldsRect, "FX: " + node.m_fxTechnique.m_implementation.GetType().ToString(), m_resources.m_nodeFieldLabel);

            // Seperator - Preview
            fieldsRect.x  = nodeRect.x + 10;
            fieldsRect.y += 25;
            EditorGUI.DrawRect(new Rect(nodeRect.x, fieldsRect.y, windowSize.x, 1), new Color(0.0f, 0.0f, 0.0f, 0.5f));

            fieldsRect.y += 12;
            fieldsRect.x  = nodeRect.x + windowSize.x / 2.0f - fieldsRect.width / 8.0f;
            GUI.Label(fieldsRect, "Shot Preview", m_resources.m_nodeFieldLabel);

            // Texture border.
            fieldsRect.y     += 25;
            fieldsRect.x      = nodeRect.x + 25;
            fieldsRect.width  = textureSize.x;
            fieldsRect.height = textureSize.y;
            EditorGUI.DrawRect(fieldsRect, textureBorderColor);

            // Texture
            fieldsRect.x      += 2.5f;
            fieldsRect.y      += 2.5f;
            fieldsRect.width  -= 5;
            fieldsRect.height -= 5;
            GUI.DrawTexture(fieldsRect, m_storyboardData.m_nodes[i].m_simulationData.m_snapshots[0]);

            GUI.changed = true;
        }

        EditorZoomArea.End();
    }
Example #15
0
 private void ApplyShotBasedRuleset(string categoryID, ref List <CinematographyTechnique> dataList, StoryboardNode previousNode)
 {
     if (categoryID.CompareTo("Positioning") == 0)
     {
     }
     else if (categoryID.CompareTo("Look") == 0)
     {
         if (previousNode.m_lookTechnique.m_title.CompareTo("DollyZoom") == 0)
         {
             dataList.RemoveAll(o => o.m_title.CompareTo("DollyZoom") == 0);
         }
         else if (previousNode.m_lookTechnique.m_title.CompareTo("QuickZoom") == 0)
         {
             dataList.RemoveAll(o => o.m_title.CompareTo("QuickZoom") == 0);
         }
     }
     else if (categoryID.CompareTo("Track") == 0)
     {
     }
     else if (categoryID.CompareTo("FX") == 0)
     {
         if (previousNode.m_fxTechnique.m_title.CompareTo("SlowMotion") == 0)
         {
             dataList.RemoveAll(o => o.m_title.CompareTo("SlowMotion") == 0);
         }
     }
 }
Example #16
0
 private void ApplyNodeBasedRuleset(string categoryID, ref List <CinematographyTechnique> dataList, StoryboardNode currentNode)
 {
     if (categoryID.CompareTo("Positioning") == 0)
     {
     }
     else if (categoryID.CompareTo("Look") == 0)
     {
     }
     else if (categoryID.CompareTo("Track") == 0)
     {
         if (currentNode.m_lookTechnique.m_title.CompareTo("DollyZoom") == 0)
         {
             dataList.RemoveAll(o => o.m_title.CompareTo("PositionHandheld") == 0 || o.m_title.CompareTo("PositionSteadycam") == 0 ||
                                o.m_title.CompareTo("PosRotHandheld") == 0 || o.m_title.CompareTo("PosRotHandheld") == 0);
         }
     }
     else if (categoryID.CompareTo("FX") == 0)
     {
     }
 }
 public abstract bool Simulate(StoryboardData data, StoryboardNode currentNode, StoryboardNode nextNode, SimulationTargetData targetData);
 public abstract void Play(Camera cam, StoryboardNode node, Transform camManipulator);
Example #19
0
 public override bool Simulate(StoryboardData data, StoryboardNode currentNode, StoryboardNode nextNode, SimulationTargetData targetData)
 {
     return(true);
 }
 protected void SetSimulationData(StoryboardNode node, Vector3 cameraPosition, Quaternion cameraRotation, float cameraFOV)
 {
     node.m_simulationData.m_cameraPosition = cameraPosition;
     node.m_simulationData.m_cameraRotation = cameraRotation;
     node.m_simulationData.m_cameraFOV      = cameraFOV;
 }