Example #1
0
 void appendGroupCode(AMGroup _grp, ref string code)
 {
     foreach (int element_id in _grp.elements)
     {
         // track
         if (element_id > 0)
         {
             if (!dictTracks.ContainsKey(element_id))
             {
                 dictTracks.Add(element_id, true);
             }
             if (dictTracks[element_id] == true)
             {
                 AMTrack track = aData.getCurrentTake().getTrack(element_id);
                 appendTrackCode(track, ref code);
             }
         }
         // group
         else if (element_id < 0)
         {
             AMGroup grp = aData.getCurrentTake().getGroup(element_id);
             //code += "\n// "+grp.group_name+"\n";
             appendGroupCode(grp, ref code);
         }
     }
 }
Example #2
0
 public AMGroup duplicate()
 {
     AMGroup ngrp = new AMGroup();
     ngrp.group_name = group_name;
     ngrp.group_id = group_id;
     ngrp.elements = new List<int>(elements);
     return ngrp;
 }
Example #3
0
    public void addGroup(AMTakeData take)
    {
        take.initGroups();
        AMGroup g = new AMGroup();
        g.init(take.getUniqueGroupID());
        take.groupValues.Add(g);
        take.rootGroup.elements.Add(g.group_id);

        // select new group when it has been created
        selectedGroup = g.group_id;
    }
Example #4
0
 bool hasTracks(AMGroup grp)
 {
     foreach (int id in grp.elements)
     {
         if (id >= 0)
         {
             return(true);
         }
         else if (hasTracks(aData.getCurrentTake().getGroup(id)))
         {
             return(true);
         }
     }
     return(false);
 }
Example #5
0
 void toggleChildren(AMGroup grp, ref bool?newValue)
 {
     foreach (int _id in grp.elements)
     {
         if (_id < 0)
         {
             toggleChildren(aData.getCurrentTake().getGroup(_id), ref newValue);
         }
         else
         {
             if (newValue == null)
             {
                 newValue = !dictTracks[_id];
             }
             dictTracks[_id] = (bool)newValue;
         }
     }
 }
Example #6
0
    void showGroup(int id, int group_lvl)
    {
        // show group
        //float group_x = width_subtrack_space*group_lvl;

        //Rect rectGroup = new Rect(group_x,track_y,width_track-group_x,height_group);
        if (!dictGroups.ContainsKey(id))
        {
            dictGroups.Add(id, true);
        }
        AMGroup grp = aData.getCurrentTake().getGroup(id);

        GUILayout.BeginHorizontal();
        GUILayout.Space(width_indent * (group_lvl));                    // indent
        // foldout
        GUILayout.BeginVertical(GUILayout.Width(15f));
        GUILayout.Space(height_label_offset - 1f);
        if (GUILayout.Button("", "label", GUILayout.Width(15f)))
        {
            dictGroups[id] = !dictGroups[id];
        }
        GUI.DrawTexture(GUILayoutUtility.GetLastRect(), (dictGroups[id] ? GUI.skin.GetStyle("GroupElementFoldout").normal.background : GUI.skin.GetStyle("GroupElementFoldout").active.background));
        GUILayout.EndVertical();
        // select children button
        if (hasTracks(grp))
        {
            GUILayout.BeginVertical(GUILayout.Width(13f));
            GUILayout.Space(height_label_offset + 1f);
            if (GUILayout.Button("", GUILayout.Width(13f), GUILayout.Height(15f)))
            {
                bool?newValue = null;
                toggleChildren(grp, ref newValue);
                refreshCode();

                /*if(gameObjsSelected[i] != null) {
                 *      gameObjsSelected[i] = !gameObjsSelected[i];
                 *      setAllChildrenSelection((bool)gameObjsSelected[i], i, gameObjsDepth[i]);
                 * }*/
            }
            Rect rectSelectAllTexture = GUILayoutUtility.GetLastRect();
            GUILayout.EndVertical();

            rectSelectAllTexture.x     += 3f;
            rectSelectAllTexture.y     += 4f;
            rectSelectAllTexture.width  = 7f;
            rectSelectAllTexture.height = 8f;
            if (!GUI.enabled)
            {
                GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.25f);
            }
            GUI.DrawTexture(rectSelectAllTexture, AMTimeline.getSkinTextureStyleState("select_all").background);
            GUI.color = Color.white;
        }
        GUILayout.BeginVertical();
        GUILayout.Space(height_label_offset);
        GUILayout.Label(grp.group_name);
        GUILayout.EndHorizontal();
        GUILayout.EndHorizontal();
        group_lvl++;            // increment group_lvl for sub-elements
        if (dictGroups[id])
        {
            for (int j = 0; j < grp.elements.Count; j++)
            {
                int _id = grp.elements[j];
                showGroupElement(_id, group_lvl);
            }
        }
    }
Example #7
0
 public void initGroups()
 {
     if(rootGroup == null) {
         AMGroup g = ScriptableObject.CreateInstance<AMGroup>();
         g.init(0);
         rootGroup = g;
     }
 }
Example #8
0
 public void initGroups()
 {
     if(rootGroup == null) {
         AMGroup g = new AMGroup();
         g.init(0);
         rootGroup = g;
     }
 }
Example #9
0
    public void destroy()
    {
        foreach(AMTrack track in trackValues) {
            track.destroy();
        }
        trackValues.Clear();

        if(groupValues != null)
            groupValues.Clear();
        rootGroup = null;

        if(mSequence != null) {
            HOTween.Kill(mSequence);
            mSequence = null;
        }

        sequenceCompleteCallback = null;

        DestroyImmediate(this);
    }
Example #10
0
    public void addGroup()
    {
        initGroups();
        AMGroup g = new AMGroup();
        g.init(getUniqueGroupID());
        groupValues.Add(g);
        rootGroup.elements.Add(g.group_id);

        // select new group when it has been created
        selectedGroup = g.group_id;
    }
Example #11
0
    //Only used by editor
    public void RevertToDefault()
    {
        trackValues.Clear();
        groupValues.Clear();
        contextSelection.Clear();
        ghostSelection.Clear();
        contextSelectionTracks.Clear();

        rootGroup = null;
        initGroups();
        name = "Take 1";
        frameRate = 24;
        numFrames = 1440;
        startFrame = 1f;
        endFrame = 100f;
        playbackSpeedIndex = 2;

        numLoop = 1;
        loopMode = LoopType.Restart;
        loopBackToFrame = -1;

        selectedTrack = -1;
        selectedFrame = 1;
        selectedGroup = 0;

        track_count = 1;
        group_count = 0;
    }
Example #12
0
    void toggleChildren(AMGroup grp, ref bool? newValue)
    {
        foreach(int _id in grp.elements) {
            if(_id < 0) toggleChildren(aData.getCurrentTake().getGroup(_id), ref newValue);
            else {
                if(newValue == null) newValue = !dictTracks[_id];
                dictTracks[_id] = (bool)newValue;
            }

        }
    }
Example #13
0
 bool hasTracks(AMGroup grp)
 {
     foreach(int id in grp.elements) {
         if(id >= 0) return true;
         else if(hasTracks(aData.getCurrentTake().getGroup(id))) return true;
     }
     return false;
 }
Example #14
0
 void appendGroupCode(AMGroup _grp, ref string code)
 {
     foreach(int element_id in _grp.elements) {
         // track
         if(element_id > 0) {
             if(!dictTracks.ContainsKey(element_id)) dictTracks.Add(element_id, true);
             if(dictTracks[element_id] == true) {
                 AMTrack track = aData.getCurrentTake().getTrack(element_id);
                 appendTrackCode(track,ref code);
             }
         }
         // group
         else if(element_id < 0) {
             AMGroup grp = aData.getCurrentTake().getGroup(element_id);
             //code += "\n// "+grp.group_name+"\n";
             appendGroupCode(grp, ref code);
         }
     }
 }
Example #15
0
    //Only used by editor
    public void RevertToDefault()
    {
        trackValues.Clear();
        groupValues.Clear();

        rootGroup = null;
        initGroups();
        name = "Take 1";
        frameRate = 24;
        numFrames = 1440;
        startFrame = 1f;
        endFrame = 100f;

        numLoop = 1;
        loopMode = LoopType.Restart;
        loopBackToFrame = -1;

        track_count = 1;
        group_count = 0;
    }