| pljones | posted: Thu Sep 22, 2005 6:24 pm | |
Member since: 2005-04-02 From: London, UK Posts: 610
| Well, the FileTable in general, I guess.
This appears to handle multiple package files quite nicely except it doesn't seem to include the current package in the file table - unless I'm missing something. It would be really useful if, when opening a package file, SimPE added it to the file table - and then removed it when it was closed, or on changing to another package.
I'd also hope that the core would handle packed files being added or removed in any of the packages in the file table.
Then FindFile() could be used consistently, without having to special case searches in the current package. |
| quaxi | posted: Thu Sep 22, 2005 6:26 pm | |
Member since: 2006-04-28 Posts: 3154
| You can manually add .packages to the FileTable (as a workaround for the time beeing). I'll post some sample code later today. |
| pljones | posted: Thu Sep 22, 2005 7:59 pm | |
Member since: 2005-04-02 From: London, UK Posts: 610
| "quaxi" wrote: You can manually add .packages to the FileTable (as a workaround for the time beeing). I'll post some sample code later today. Yes, but removing them again seems to be a little tricky. And particularly knowing when to remove them -- the package does appear to have a signal for when it's changed but I couldn't see one for when it's closed.
At the moment, I'll work around it "manually". I'm actually thinking that the current package shouldn't actually be in the FileTable - just the methods on FileIndex should make it look like it is - they'd search the current package first, then go to the FileTable if they didn't find what they'd been asked for (essentially what I'll be doing "manually"). |
| quaxi | posted: Thu Sep 22, 2005 8:06 pm | |
Member since: 2006-04-28 Posts: 3154
| Here is what I did in the past, as the FIleTable was developed, befor the package Manager used Events.
FileTable.FileIndex.StoreCurrentState();
FileTable.FileIndex.AddIndexFromPackage(currentpackage);
//her is your Search Stuff
FileTable.FileIndex.RestoreLastState();
However, I will extend the FileTable to check the currently loaded package First. Gonna be in the next QA-Release.
This is gonna be changed quite q bit in the next QA, so please don't rely on those methods for the Time beeing! |
| pljones | posted: Thu Sep 22, 2005 8:40 pm | |
Member since: 2005-04-02 From: London, UK Posts: 610
| Yes, that's how I was trying to avoid doing it - every time I look up the name of a BHAV, I'd have to have that code around the look up. That's bound to slow it down...
If you'll have the change in that soon, I'll wait! :D |
| Inge Jones | posted: Thu Sep 22, 2005 9:04 pm | |
Member since: 2005-03-06 Posts: 1899
| One of you two developers has wiped out my objects.package from my Nightlife installation. I am not sure exactly who to point the finger at... :D
Or maybe it was me ending the game from task manager. I am not sure exactly *when* it went missing, but I am sure the game shouldn't have it open for write access. Except we know it does, for no good reason. |
| quaxi | posted: Thu Sep 22, 2005 9:12 pm | |
Member since: 2006-04-28 Posts: 3154
| Oh I fear that was me :(
Remember, when you delete a sim, how simPe is asking you if it is allowed to delete the character File?
If you try to delete a NPC, the character File is objects.package, so that could be the Problem. |
| Inge Jones | posted: Thu Sep 22, 2005 9:19 pm | |
Member since: 2005-03-06 Posts: 1899
| Oh lol! I didn't realise that, I assumed old crumplebiddy would be a character like the others. Oh well I've got objects.package back off CD now, and I have my neighbourhood backups. |
| quaxi | posted: Thu Sep 22, 2005 9:54 pm | |
Member since: 2006-04-28 Posts: 3154
| The changed FileTable will now contain the package loaded into the new GUI. (This does not work with the classic GUI yet).
The main SimPe.FileTable.FileIndex was estended by child FileIndices, which means, when ever you trigger a search in the SimPe.FileTable.FileIndex, it will also search all assigned Child instances of the FileIndex class.
When you load a package in the new GUI, it gets added to one of those Child FileIndex Instances, and thus is allways available.
Your Plugins can add new FileIndex Intsnaces too (like, when you need to add packages, that are not by default included into the SimPe FileTable). Here is how it is done:
//this is creating and adding a ChildNode in the Main FileTable you can use for you own
SimPe.Interfaces.Scenegraph.IScenegraphFileIndex localfileindex =
FileTable.FileIndex.AddNewChild();
//next, simply add a package File to your FileTable
if (!FileTable.FileIndex.Contains(pkg)) localfileindex.AddFromPackage(pkg);
//perform any search you want
FileTable.FileIndex.FindFile(...);
//if you don't need your FT anymore, remove it and clear it
FileTable.FileIndex.RemoveChild( localfileindex );
localfileindex.Clear();
FileTable.FileIndex.Contains is checking the FT and ll known Childs if this package was already addded somewhere.
You could create your own FT in the constructor of you Wrapper Factory as a static Variable, and acces it from your Plugins.
I plan to extend the FileTable to work with the classic GUI as well. The bigges drawback at the Moment is, that it does not get updated when you add or delete a Resource in SimPE yet.
But it should give you an idea how it is goonna work, and you can start testing with the instructions from Above. |
| quaxi | posted: Thu Sep 22, 2005 11:09 pm | |
Member since: 2006-04-28 Posts: 3154
| The extension in the SimPE Version in the CVS also supports the classic GUI now. |