/[Sims3RigEditor]/trunk/gr2lib_cpp/gr2lib_rigeditor_frm.h
ViewVC logotype

Diff of /trunk/gr2lib_cpp/gr2lib_rigeditor_frm.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/gr2lib_cpp/gr2lib_rigeditor_frm.h	2010/08/08 08:23:57	50
+++ trunk/gr2lib_cpp/gr2lib_rigeditor_frm.h	2010/08/11 09:45:49	51
@@ -523,11 +523,11 @@
 			_grn_file->GrannyFileInfo->Textures[i]->SubFormat = (granny_int32)GR2LibPropertyWrapper->Textures[i]->SubFormat->Value;
 
 			_grn_file->GrannyFileInfo->Textures[i]->Layout.BytesPerPixel =  (granny_int32)GR2LibPropertyWrapper->Textures[i]->Layout->BytesPerPixel;
-				for(int j=0;j<granny_pixel_layout_bitshift_size;j++)
-				{
-					_grn_file->GrannyFileInfo->Textures[i]->Layout.ShiftForComponent[j] = GR2LibPropertyWrapper->Textures[i]->Layout->ShiftForComponent[j];
-					_grn_file->GrannyFileInfo->Textures[i]->Layout.BitsForComponent[j] = GR2LibPropertyWrapper->Textures[i]->Layout->BitsForComponent[j];
-				}
+			for(int j=0;j<granny_pixel_layout_bitshift_size;j++)
+			{
+				_grn_file->GrannyFileInfo->Textures[i]->Layout.ShiftForComponent[j] = GR2LibPropertyWrapper->Textures[i]->Layout->ShiftForComponent[j];
+				_grn_file->GrannyFileInfo->Textures[i]->Layout.BitsForComponent[j] = GR2LibPropertyWrapper->Textures[i]->Layout->BitsForComponent[j];
+			}
 
 			_grn_file->GrannyFileInfo->Textures[i]->ImageCount = GR2LibPropertyWrapper->Textures[i]->Images->Count;
 			_grn_file->GrannyFileInfo->Textures[i]->Images = (granny_texture_image*)malloc(_grn_file->GrannyFileInfo->Textures[i]->ImageCount);
@@ -544,7 +544,7 @@
 					_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelByteCount = GR2LibPropertyWrapper->Textures[i]->Images[j]->MIPLevels[k]->Pixels->Count;
 					_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelBytes = (unsigned char*)malloc(_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelByteCount);
 
-					
+
 					for (int l=0;l<_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelByteCount;l++)
 					{
 						_grn_file->GrannyFileInfo->Textures[i]->Images[j].MIPLevels[k].PixelBytes[l] = GR2LibPropertyWrapper->Textures[i]->Images[j]->MIPLevels[k]->Pixels[l]->UInt8;
@@ -554,23 +554,28 @@
 					//if (_grn_file->GrannyFileInfo->Textures[i]->Encoding == granny_texture_encoding::GrannyBinkTextureEncoding)
 					//{
 					//	granny_texture* src = _grn_file->GrannyFileInfo->Textures[i];
-					//	granny_texture* dest = new granny_texture();
+					//	//granny_texture* dest = new granny_texture();
+					//	unsigned char* dest;
 					//	GrannyBinkCompressTexture(
 					//		_grn_file->GrannyFileInfo->Textures[i]->Width,
 					//		_grn_file->GrannyFileInfo->Textures[i]->Height,
 					//		_grn_file->GrannyFileInfo->Textures[i]->Width * _grn_file->GrannyFileInfo->Textures[i]->Layout.BytesPerPixel,
-					//		src,
+					//		src->Images[j].MIPLevels[k].PixelBytes,
 					//		granny_bink_texture_flags::GrannyBinkEncodeAlpha,
 					//		granny_compression_type::GrannyNoCompression,
 					//		&dest);
 					//}
-				
+
 				}
 			}
 			//granny_pixel_layout _layout;
 			//GrannyGetRecommendedPixelLayout(_grn_file->GrannyFileInfo->Textures[i],&_layout);					
 			//_grn_file->GrannyFileInfo->Textures[i]->Layout = _layout;
 			_grn_file->GrannyFileInfo->Textures[i]->ExtendedData = *(new granny_variant());
+
+
+
+
 		}
 
 	}
@@ -578,6 +583,29 @@
 #pragma endregion
 
 #pragma endregion
+
+#pragma region DoPostSave_Operations
+	void DoPostSave_Operations()
+	{
+		//// Compress Bink Textures
+		//for(int i=0;i<_grn_file->GrannyFileInfo->TextureCount;i++)
+		//{
+		//	if (_grn_file->GrannyFileInfo->Textures[i]->Encoding == granny_texture_encoding::GrannyBinkTextureEncoding)
+		//	{	
+		//		int bink_compress = GrannyBinkCompressTexture(
+		//			_grn_file->GrannyFileInfo->Textures[i]->Width,
+		//			_grn_file->GrannyFileInfo->Textures[i]->Height,
+		//			_grn_file->GrannyFileInfo->Textures[i]->Width * _grn_file->GrannyFileInfo->Textures[i]->Layout.BytesPerPixel,
+		//			_grn_file->GrannyFileInfo->Textures[i]->Images,
+		//			granny_bink_texture_flags::GrannyBinkEncodeAlpha,
+		//			granny_compression_type::GrannyNoCompression,
+		//			_grn_file->GrannyFileInfo->Textures[i]);
+		//		int a = 0;
+		//	}
+		//}
+	}
+#pragma endregion
+
 private: System::Void mnuItemExit_Click(System::Object^  sender, System::EventArgs^  e) 
 		 {
 			 ConvertToNative();
@@ -686,7 +714,9 @@
 			 {				
 				 ConvertToNative();
 				 const char* filename = _grn_file->_GrannyFilename;
-				 GrannyFileWriter::WriteFile(filename,_grn_file->GrannyFileInfo,_grn_file->_logger);				 
+				 GrannyFileWriter::WriteFile(filename,_grn_file->GrannyFileInfo,_grn_file->_logger);		
+				 //DoPostSave_Operations();
+				 //GrannyFileWriter::WriteFile(filename,_grn_file->GrannyFileInfo,_grn_file->_logger);
 				 System::Windows::Forms::MessageBox::Show("Successfully Saved: \n" + gcnew String(_grn_file->GrannyFilename()),"File Writer:", MessageBoxButtons::OK,MessageBoxIcon::Information);
 			 }
 			 catch(Exception^ ex)
@@ -703,7 +733,9 @@
 				 System::Windows::Forms::DialogResult result = RigSaver->ShowDialog();
 				 if (result != System::Windows::Forms::DialogResult::OK) return;
 				 const char* filename = (char*)Marshal::StringToHGlobalAnsi(RigSaver->FileName).ToPointer();
-				 GrannyFileWriter::WriteFile(filename,_grn_file->GrannyFileInfo,_grn_file->_logger);	
+				 GrannyFileWriter::WriteFile(filename,_grn_file->GrannyFileInfo,_grn_file->_logger);		
+				 //DoPostSave_Operations();
+				 //GrannyFileWriter::WriteFile(filename,_grn_file->GrannyFileInfo,_grn_file->_logger);
 				 System::Windows::Forms::MessageBox::Show("Successfully Saved: \n" +  gcnew String(_grn_file->GrannyFilename()),"File Writer:", MessageBoxButtons::OK,MessageBoxIcon::Information);
 			 }
 			 catch(Exception^ ex)

 

  ViewVC Help
Powered by ViewVC 1.1.22