Esempio n. 1
0
        //============================================================
        // <T>加载配置信息。</T>
        //
        // @param config 配置信息
        //============================================================
        public void LoadConfig(FXmlNode xconfig)
        {
            string typeName = null;

            if (xconfig.Contains("type"))
            {
                typeName = xconfig.Get("type");
            }
            else
            {
                typeName = xconfig.Get("type_name");
            }
            _typeCd = EDrTexture.Parse(typeName);
            _source = xconfig.Nvl("source").Replace('/', '\\');
            string sourceTypeName = xconfig.Nvl("source_type");

            _sourceTypeCd = EDrTexture.Parse(typeName);
            _sourceIndex  = xconfig.GetInteger("source_index", _sourceIndex);
            // 获得关联纹理
            _texture = RContent3dManager.TextureConsole.Find(Source);
            if (null == _texture)
            {
                _texture = RContent3dManager.TextureConsole.Find(Source);
                RMoCore.TrackConsole.Write(this, "LoadConfig", "Texture source is not exists. (material={0}, texture={1})",
                                           _material.Code, SourceCode);
                return;
            }
            _textureBitmap = _texture.FindByTypeCd(_sourceTypeCd, _sourceIndex);
        }
Esempio n. 2
0
        //============================================================
        // <T>加载剪辑纹理。</T>
        //
        // @prama texture 纹理对象
        //============================================================
        protected void LoadLayerTexture(FDrLayerTexture texture)
        {
            // 建立数据行集合
            txtCode.Text  = texture.Name;
            txtLabel.Text = texture.Label;
            FDrTextureBitmap firstBitmap = null;

            qgvTextures.Rows.Clear();
            int index = 0;

            foreach (FDrTextureBitmap bitmap in _texture.Bitmaps)
            {
                // 建立行
                DataGridViewRow row = new DataGridViewRow();
                // 设置数据行信息
                row.DefaultCellStyle.BackColor = Color.LightGreen;
                row.Tag = bitmap;
                // 设置单元格信息
                DataGridViewTextBoxCell cellType = new DataGridViewTextBoxCell();
                cellType.Value = (++index).ToString();
                row.Cells.Add(cellType);
                DataGridViewTextBoxCell typeType = new DataGridViewTextBoxCell();
                typeType.Value = bitmap.TypeName;
                row.Cells.Add(typeType);
                DataGridViewTextBoxCell cellSize = new DataGridViewTextBoxCell();
                cellSize.Value = bitmap.Size.Width + "×" + bitmap.Size.Height;
                row.Cells.Add(cellSize);
                DataGridViewTextBoxCell cellLength = new DataGridViewTextBoxCell();
                cellLength.Value = bitmap.Length.ToString();
                row.Cells.Add(cellLength);
                DataGridViewTextBoxCell cellSource = new DataGridViewTextBoxCell();
                cellSource.Value = bitmap.Source;
                row.Cells.Add(cellSource);
                // 增加行
                qgvTextures.Rows.Add(row);
                // 设置首行
                if (null == firstBitmap)
                {
                    row.Selected = true;
                    firstBitmap  = bitmap;
                }
            }
            // 默认显示第一张图片
            if (null != firstBitmap)
            {
                UncheckScaleButtons();
                tsbScaleAuto.Checked    = true;
                tsbScaleAuto.CheckState = CheckState.Checked;
                RefreshScaleInfo();
                qpbViewer.LoadBitmap(firstBitmap.Image.Native);
            }
        }
Esempio n. 3
0
        //============================================================
        //<T>获取相应的图片<T>
        //============================================================
        private int GetImage(int count, FDrTextureBitmap bit, string Spath)
        {
            Bitmap bitm = new Bitmap(Spath);
            string name = bit.Source;

            imageList.Images.Add(bitm);
            int n = imageList.Images.Count;

            // 将图片的名称保存在Key中
            imageList.Images.SetKeyName(n - 1, name);
            count++;
            return(count);
        }
Esempio n. 4
0
 //============================================================
 // <T>选中图片行记录。</T>
 //============================================================
 private void SelectGridRow(DataGridViewRow row)
 {
     qpbViewer.Clear();
     qpbViewer.Visible = true;
     if (null != row)
     {
         FDrTextureBitmap bitmap = row.Tag as FDrTextureBitmap;
         if (null != bitmap)
         {
             qpbViewer.LoadBitmap(bitmap.Image.Native);
             RefreshScaleInfo();
         }
     }
 }