示例#1
0
        public void LoadSettings(FileParser.Block block)
        {
            string oldSource = sourceFileName;

            sourceFileName = block.GetString("Obj File", false);
            if (sourceFileName == "")
            {
                sourceFileName = oldSource;
            }
            conversionSettings.colorInterpretation = (ConversionSettings.ColorInterpretation)block.GetInt("Color Interpretation", false);
            if (sourceFileName != "")
            {
                LoadObj();
            }
            pointerControl.SetROMPointers(block.GetIntArray("ROM Pointers"));
            pointerControl.SetRAMPointers(block.GetIntArray("RAM Pointers"));

            numLayer.Value = block.GetInt("Layer");
            for (int i = 0; i < paramControls.Length; i++)
            {
                paramControls[i].cmbType.SelectedIndex = block.GetInt(paramControls[i].ParameterName, false);
                if (paramControls[i].cmbType.SelectedIndex == paramControls[i].cmbType.Items.Count - 1)
                {
                    paramControls[i].customValue = block.GetInt("Custom " + paramControls[i].ParameterName, false);
                }
            }

            if (textureControl.materialLibrary != null)
            {
                foreach (KeyValuePair <string, TextureInfo> tex in textureControl.materialLibrary)
                {
                    FileParser.Block b = block.GetBlock(tex.Key, false);
                    if (b != null)
                    {
                        tex.Value.LoadSettings(b);
                    }
                }
            }


            if (displayList != null)
            {
                displayList.renderstates.cycleType      = (BlenderControl.CycleModes)block.GetInt("Cycle Type", false);
                displayList.renderstates.blendMode      = block.GetInt("Blend modes");
                displayList.renderstates.otherModesLow  = block.GetInt("Render states");
                displayList.renderstates.RCPSet         = block.GetInt("RCP Set", false);
                displayList.renderstates.RCPUnset       = block.GetInt("RCP Unset", false);
                displayList.renderstates.combiner.state = ((long)(block.GetInt("Combiner High") & 0xFFFFFFFF) << 0x20) | ((long)block.GetInt("Combiner Low") & 0xFFFFFFFF);
                displayList.renderstates.textureScaleX  = block.GetDouble("Texture Scale X");
                displayList.renderstates.textureScaleY  = block.GetDouble("Texture Scale Y");

                renderStateControl.Bind(displayList.renderstates);
                combinerStateControl.Bind(displayList.renderstates.combiner);
                blenderControl1.SetValues(displayList.renderstates.blendMode);
                blenderControl1.SetCycleType(displayList.renderstates.cycleType);
            }
            if (oldSource != sourceFileName)
            {
                updateImportEnable(null, null);
            }
        }