コード例 #1
0
ファイル: LipSyncMapData.cs プロジェクト: thorhs/vixen
        public double ConfiguredIntensity(string itemName, PhonemeType phoneme, LipSyncMapItem item = null)
        {
            double retVal = 0;

            if (item == null)
            {
                item = FindMapItem(itemName);
            }

            if (item != null)
            {
                if (this.IsMatrix)
                {
                    if (item.ElementColors[phoneme] != Color.Black)
                    {
                        HSV hsvVal = HSV.FromRGB(new RGB(item.ElementColors[phoneme]));
                        retVal = hsvVal.V;
                        //retVal = 1.0;
                    }
                }
                else
                {
                    if (item.PhonemeList[phoneme.ToString()] == true)
                    {
                        HSV hsvVal = HSV.FromRGB(new RGB(item.ElementColor));
                        retVal = hsvVal.V;
                    }
                }
            }
            return(retVal);
        }
コード例 #2
0
ファイル: LipSyncMapData.cs プロジェクト: thorhs/vixen
        public Color ConfiguredColor(string itemName, PhonemeType phoneme, LipSyncMapItem item = null)
        {
            Color retVal = Color.Black;

            if (item == null)
            {
                item = FindMapItem(itemName);
            }

            if (item != null)
            {
                if (this.IsMatrix)
                {
                    if (item.ElementColors[phoneme] != Color.Black)
                    {
                        retVal = item.ElementColors[phoneme];
                    }
                }
                else
                {
                    if (item.PhonemeList[phoneme.ToString()] == true)
                    {
                        HSV hsvVal = HSV.FromRGB(new RGB(item.ElementColor));
                        hsvVal.V = 1;
                        retVal   = hsvVal.ToRGB().ToArgb();
                    }
                }
            }
            return(retVal);
        }
コード例 #3
0
        private LipSyncMapItem FindRenderMapItem (int row, int column)
        {
            
            if (startMapIndex == -1)
            {
                startMapIndex = _newMapping.MapItems.FindIndex(
                delegate(LipSyncMapItem mapItem)
                {
                    return mapItem.Name.Equals(_newMapping.StartNode);
                });
            }

            LipSyncMapItem retVal = null;

            int numGridCols = CalcNumDataGridCols;
            int numGridRows = CalcNumDataGridRows;
            int calcIndex;

            calcIndex = (stringsAreRows) ?
                ((numGridCols * (numGridRows - row - 1)) + column) + startMapIndex :
                ((numGridRows * column) + (numGridRows - row - 1)) + startMapIndex;

            if ((calcIndex >= 0) && (calcIndex < _newMapping.MapItems.Count))
            {
                retVal = _newMapping.MapItems.ElementAt(calcIndex);
            }

            return retVal;
        }
コード例 #4
0
ファイル: LipSyncMapData.cs プロジェクト: robness/Vixen
        public bool IsFaceComponentType(FaceComponent type, LipSyncMapItem item)
        {
            bool retVal = false;

            item?.FaceComponents.TryGetValue(type, out retVal);

            return(retVal);
        }
コード例 #5
0
ファイル: LipSyncMapData.cs プロジェクト: robness/Vixen
        public bool PhonemeState(string phonemeName, LipSyncMapItem item)
        {
            bool retVal = false;

            item?.PhonemeList.TryGetValue(phonemeName, out retVal);

            return(retVal);
        }
コード例 #6
0
ファイル: LipSyncMapMatrixEditor.cs プロジェクト: komby/vixen
        private void assignNodes()
        {
            BuildRowNameList();

            LipSyncNodeSelect nodeSelectDlg = new LipSyncNodeSelect();

            nodeSelectDlg.MaxNodes          = _newMapping.MatrixStringCount * _newMapping.MatrixPixelsPerString;
            nodeSelectDlg.MatrixOptionsOnly = true;
            nodeSelectDlg.StringsAreRows    = _newMapping.StringsAreRows;
            nodeSelectDlg.NodeNames         = _rowNames;

            DialogResult dr = nodeSelectDlg.ShowDialog();

            if ((dr == DialogResult.OK) && (nodeSelectDlg.Changed == true))
            {
                List <LipSyncMapItem> newMappings = new List <LipSyncMapItem>();
                LipSyncMapItem        tempMapItem = null;

                _newMapping.StringsAreRows = nodeSelectDlg.StringsAreRows;
                stringsAreRows             = _newMapping.StringsAreRows;

                _rowNames.Clear();
                _rowNames.AddRange(nodeSelectDlg.NodeNames);

                foreach (string nodeName in nodeSelectDlg.NodeNames)
                {
                    tempMapItem = _newMapping.MapItems.Find(
                        delegate(LipSyncMapItem item)
                    {
                        return(item.Name.Equals(nodeName));
                    });

                    if (tempMapItem != null)
                    {
                        newMappings.Add(tempMapItem);
                    }
                    else
                    {
                        newMappings.Add(new LipSyncMapItem(nodeName, -1));
                    }
                }

                _newMapping.MapItems.Clear();

                int stringCount = 0;
                foreach (LipSyncMapItem mapItem in newMappings)
                {
                    mapItem.StringNum = stringCount++;
                    _newMapping.MapItems.Add(mapItem);
                }

                _newMapping.StartNode =
                    (_newMapping.MapItems.Count != 0) ? _newMapping.MapItems[0].Name : "";

                reconfigureDataTable();
            }
        }
コード例 #7
0
ファイル: LipSyncMapEditor.cs プロジェクト: nedbert/vixen
        private void buttonAssign_Click(object sender, EventArgs e)
        {
            LipSyncNodeSelect nodeSelectDlg = new LipSyncNodeSelect();

            //nodeSelectDlg.MaxNodes = _mapping.MapItems.Count;
            nodeSelectDlg.MaxNodes          = Int32.MaxValue;
            nodeSelectDlg.MatrixOptionsOnly = false;
            nodeSelectDlg.SelectedNodeNames = _rowNames;
            nodeSelectDlg.AllowGroups       = _mapping.GroupsAllowed;
            nodeSelectDlg.AllowRecursiveAdd = _mapping.RecursionAllowed;

            DialogResult dr = nodeSelectDlg.ShowDialog();

            if ((dr == DialogResult.OK) && (nodeSelectDlg.Changed == true))
            {
                List <LipSyncMapItem> newMappings = new List <LipSyncMapItem>();
                LipSyncMapItem        tempMapItem = null;

                _mapping.LibraryReferenceName = nameTextBox.Text;
                _mapping.GroupsAllowed        = nodeSelectDlg.AllowGroups;
                _mapping.RecursionAllowed     = nodeSelectDlg.AllowRecursiveAdd;

                _rowNames.Clear();
                _rowNames.AddRange(nodeSelectDlg.SelectedNodeNames);

                foreach (string nodeName in nodeSelectDlg.SelectedNodeNames)
                {
                    tempMapItem = _mapping.MapItems.Find(
                        delegate(LipSyncMapItem item)
                    {
                        return(item.Name.Equals(nodeName));
                    });

                    if (tempMapItem != null)
                    {
                        newMappings.Add(tempMapItem);
                    }
                    else
                    {
                        newMappings.Add(new LipSyncMapItem(nodeName, -1));
                    }
                }

                _mapping.MapItems.Clear();

                int stringCount = 0;
                foreach (LipSyncMapItem mapItem in newMappings)
                {
                    mapItem.StringNum = stringCount++;
                    _mapping.MapItems.Add(mapItem);
                }

                reconfigureDataTable();
            }
            Refresh();
        }
コード例 #8
0
 private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     dataGridView1.CurrentCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
     Color newColor =
         (e.Button == MouseButtons.Left) ? lipSyncMapColorCtrl1.Color : Color.Black;
     
     LipSyncMapItem item =
         FindRenderMapItem(e.RowIndex, e.ColumnIndex);
         dataGridView1.CurrentCell.Value = (item == null) ? Color.Gray : newColor;
 }
コード例 #9
0
ファイル: LipSyncMapItem.cs プロジェクト: stewmc/vixen
        public LipSyncMapItem Clone()
        {
            LipSyncMapItem retVal = new LipSyncMapItem();
            retVal.Name = Name;
            retVal.PhonemeList = new Dictionary<string, bool>(PhonemeList);
            retVal.StringNum = StringNum;
            retVal.ElementColor = ElementColor;
            retVal.ElementGuid = ElementGuid;
            retVal.ElementColors = new Dictionary<PhonemeType, Color>(ElementColors);

            return retVal;
        }
コード例 #10
0
        public LipSyncMapItem Clone()
        {
            LipSyncMapItem retVal = new LipSyncMapItem();

            retVal.Name          = Name;
            retVal.PhonemeList   = new Dictionary <string, bool>(PhonemeList);
            retVal.StringNum     = StringNum;
            retVal.ElementColor  = ElementColor;
            retVal.ElementGuid   = ElementGuid;
            retVal.ElementColors = new Dictionary <PhonemeType, Color>(ElementColors);

            return(retVal);
        }
コード例 #11
0
ファイル: LipSyncMapItem.cs プロジェクト: robness/Vixen
        public LipSyncMapItem Clone()
        {
            LipSyncMapItem retVal = new LipSyncMapItem();

            retVal.Name           = Name;
            retVal.PhonemeList    = new Dictionary <string, bool>(PhonemeList, StringComparer.OrdinalIgnoreCase);
            retVal.StringNum      = StringNum;
            retVal.ElementColor   = ElementColor;
            retVal.ElementGuid    = ElementGuid;
            retVal.FaceComponents = new Dictionary <FaceComponent, bool>(FaceComponents);

            return(retVal);
        }
コード例 #12
0
ファイル: LipSyncMapData.cs プロジェクト: robness/Vixen
        public double ConfiguredIntensity(LipSyncMapItem item)
        {
            double retVal = 0;

            if (!IsMatrix)
            {
                if (item != null)
                {
                    retVal = HSV.VFromRgb(item.ElementColor);
                }
            }

            return(retVal);
        }
コード例 #13
0
ファイル: LipSyncMapData.cs プロジェクト: robness/Vixen
        public Color ConfiguredColor(LipSyncMapItem item)
        {
            Color retVal = Color.Black;

            if (!IsMatrix)
            {
                if (item != null)
                {
                    HSV hsvVal = HSV.FromRGB(item.ElementColor);
                    hsvVal.V = 1;
                    retVal   = hsvVal.ToRGB();
                }
            }

            return(retVal);
        }
コード例 #14
0
ファイル: LipSyncMapData.cs プロジェクト: thorhs/vixen
        public bool PhonemeState(string itemName, string phonemeName, LipSyncMapItem item = null)
        {
            bool retVal = false;

            if (item == null)
            {
                item = FindMapItem(itemName);
            }

            if (item != null)
            {
                item.PhonemeList.TryGetValue(phonemeName, out retVal);
            }

            return(retVal);
        }
コード例 #15
0
ファイル: LipSyncMapData.cs プロジェクト: robness/Vixen
        public Tuple <double, Color> ConfiguredColorAndIntensity(LipSyncMapItem item)
        {
            double intensityRetVal = 0;
            Color  colorRetVal     = Color.Black;

            if (!IsMatrix)
            {
                if (item != null)
                {
                    HSV hsvVal = HSV.FromRGB(item.ElementColor);
                    hsvVal.V        = 1;
                    colorRetVal     = hsvVal.ToRGB();
                    intensityRetVal = HSV.VFromRgb(item.ElementColor);
                }
            }

            return(new Tuple <double, Color>(intensityRetVal, colorRetVal));
        }
コード例 #16
0
ファイル: LipSyncMapData.cs プロジェクト: nedbert/vixen
        public double ConfiguredIntensity(string itemName, PhonemeType phoneme, LipSyncMapItem item = null)
        {
            double retVal = 0;

            if (item == null)
            {
                item = FindMapItem(itemName);
            }

            if (item != null)
            {
                if (!this.IsMatrix)
                {
                    if (item.PhonemeList[phoneme.ToString()] == true)
                    {
                        retVal = HSV.VFromRgb(item.ElementColor);
                    }
                }
            }
            return(retVal);
        }
コード例 #17
0
ファイル: LipSyncMapMatrixEditor.cs プロジェクト: komby/vixen
        private DataTable BuildDialogFromMap(LipSyncMapData data)
        {
            nameTextBox.Text = data.LibraryReferenceName;

            stringCount        = _newMapping.MatrixStringCount;
            pixelCount         = _newMapping.MatrixPixelsPerString;
            zoomTrackbar.Value = _newMapping.ZoomLevel;

            DataTable dt   = BuildBlankTable();
            int       cols = CalcNumDataGridCols;
            int       rows = CalcNumDataGridRows;

            LipSyncMapItem mapItem = null;

            DataRow dr;

            for (int row = 0; row < rows; row++)
            {
                dr = dt.Rows[row];
                for (int col = 0; col < cols; col++)
                {
                    mapItem = FindRenderMapItem(row, col);


                    if (mapItem != null)
                    {
                        dr[col] =
                            (mapItem.ElementColors.ContainsKey(phonemeArray[currentPhonemeIndex]) == false) ?
                            Color.Black : mapItem.ElementColors[phonemeArray[currentPhonemeIndex]];
                    }
                    else
                    {
                        dr[col] = Color.Gray;
                    }
                }
            }

            return(dt);
        }
コード例 #18
0
ファイル: LipSyncMapEditor.cs プロジェクト: nedbert/vixen
        private void BuilMapDataFromDialog()
        {
            int currentRow = 0;

            _mapping.LibraryReferenceName = nameTextBox.Text;
            _mapping.Notes = notesTextBox.Text;

            _mapping.StringCount = _rowNames.Count();
            _mapping.MapItems.Clear();

            for (int stringNum = 0; stringNum < _rowNames.Count; stringNum++)
            {
                DataRow        dr          = currentDataTable.Rows[currentRow];
                string         elementName = dr[0].ToString();
                LipSyncMapItem item        = new LipSyncMapItem();
                ElementNode    theNode     = FindElementNode(elementName);

                item.Name        = dr[0].ToString();
                item.ElementGuid = theNode.Id;
                item.StringNum   = stringNum;

                for (int theCount = 1; theCount < dr.ItemArray.Count() - 1; theCount++)
                {
                    bool checkVal =
                        (dr[theCount].GetType() == typeof(Boolean)) ? (Boolean)dr[theCount] : false;
                    item.PhonemeList.Add(
                        dr.Table.Columns[theCount].ColumnName, checkVal
                        );
                }
                item.ElementColor = (Color)dr[dr.ItemArray.Count() - 1];

                _mapping.MapItems.Add(item);
                currentRow++;
                if (currentRow >= currentDataTable.Rows.Count)
                {
                    return;
                }
            }
        }
コード例 #19
0
ファイル: LipSyncMapData.cs プロジェクト: nedbert/vixen
        public Tuple <double, Color> ConfiguredColorAndIntensity(string itemName, string phoneme, LipSyncMapItem item)
        {
            double intensityRetVal = 0;
            Color  colorRetVal     = Color.Black;

            if (item == null)
            {
                item = FindMapItem(itemName);
            }

            if (item != null)
            {
                if (!IsMatrix)
                {
                    if (item.PhonemeList[phoneme] == true)
                    {
                        HSV hsvVal = HSV.FromRGB(item.ElementColor);
                        hsvVal.V        = 1;
                        colorRetVal     = hsvVal.ToRGB().ToArgb();
                        intensityRetVal = HSV.VFromRgb(item.ElementColor);
                    }
                }
            }
            return(new Tuple <double, Color>(intensityRetVal, colorRetVal));
        }
コード例 #20
0
ファイル: LipSyncMapData.cs プロジェクト: nedbert/vixen
 public Color ConfiguredColor(string itemName, PhonemeType phoneme, LipSyncMapItem item = null)
 {
     return(ConfiguredColor(itemName, phoneme.ToString(), item));
 }
コード例 #21
0
ファイル: LipSyncMapEditor.cs プロジェクト: stewmc/vixen
        private void BuilMapDataFromDialog()
        {
            int currentRow = 0;

            _mapping.StringCount = _rowNames.Count();
            _mapping.MapItems.Clear();

            for (int stringNum = 0; stringNum < _rowNames.Count; stringNum++)
            {
                DataRow dr = currentDataTable.Rows[currentRow];
                string elementName = dr[0].ToString();
                LipSyncMapItem item = new LipSyncMapItem();
                ElementNode theNode = FindElementNode(elementName);
                    
                item.Name = dr[0].ToString();
                item.ElementGuid = theNode.Id;
                item.StringNum = stringNum;

                for (int theCount = 1; theCount < dr.ItemArray.Count() - 1; theCount++) 
                {
                    bool checkVal =
                        (dr[theCount].GetType() == typeof(Boolean)) ? (Boolean)dr[theCount] : false;
                    item.PhonemeList.Add(
                        dr.Table.Columns[theCount].ColumnName, checkVal
                        );
                }
                item.ElementColor = (Color)dr[dr.ItemArray.Count() - 1];

                _mapping.MapItems.Add(item);
                currentRow++;
                if (currentRow >= currentDataTable.Rows.Count)
                {
                    return;
                }
            }
        }
コード例 #22
0
ファイル: LipSyncMapData.cs プロジェクト: stewmc/vixen
        public bool PhonemeState(string itemName, string phonemeName, LipSyncMapItem item = null)
        {
            bool retVal = false;
            
            if (item == null)
            {
                item = FindMapItem(itemName);
            }
            
            if (item != null)
            {
                item.PhonemeList.TryGetValue(phonemeName, out retVal);
            }

            return retVal;
        }
コード例 #23
0
ファイル: LipSyncMapData.cs プロジェクト: stewmc/vixen
 public Color ConfiguredColor(string itemName, PhonemeType phoneme, LipSyncMapItem item = null)
 {
     Color retVal = Color.Black;
     
     if (item == null)
     {
         item = FindMapItem(itemName);
     }
     
     if (item != null)
     {
         if (this.IsMatrix) 
         {
             if (item.ElementColors[phoneme] != Color.Black)
             {
                 retVal = item.ElementColors[phoneme];
             }
         }
         else
         {
             if (item.PhonemeList[phoneme.ToString()] == true)
             {
                 HSV hsvVal = HSV.FromRGB(new RGB(item.ElementColor));
                 hsvVal.V = 1;
                 retVal = hsvVal.ToRGB().ToArgb();
             }
         }
     }
     return retVal;
 }
コード例 #24
0
ファイル: LipSyncMapData.cs プロジェクト: stewmc/vixen
        public double ConfiguredIntensity(string itemName, PhonemeType phoneme, LipSyncMapItem item = null)
        {
            double retVal = 0;
            
            if (item == null)
            {
                item = FindMapItem(itemName);
            }
            
            if (item != null)
            {
                if (this.IsMatrix)
                {
                    if (item.ElementColors[phoneme] != Color.Black)
                    {
                        HSV hsvVal = HSV.FromRGB(new RGB(item.ElementColors[phoneme]));
                        retVal = hsvVal.V;
                        //retVal = 1.0;
                    }

                }
                else 
                {
                    if (item.PhonemeList[phoneme.ToString()] == true)
                    {
                        HSV hsvVal = HSV.FromRGB(new RGB(item.ElementColor));
                        retVal = hsvVal.V;
                    }
                }
            }
            return retVal;

        }