How to change one property in every exemplar

Started by Lowkee33, February 03, 2011, 08:03:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Ever go through a pack and say to yourself "Hey, these shouldn't Orient to Slope"?  Well, here is a way to fix this quickly.

The Exemplar Analyzer in Reader is a powerful too and will let you target one property in a MEGA pack of props.

-Make a backup of your file and then open it in Reader.
-Before "Fillling the List" you can click on the Exemplar Analyzer (The Blue Box #1)
-A new window will pop up, and click on "Search" (The Green Box #2)
-Then click on the "Property Search" button (The Purple Box #3)
-This will open the window on the right (within the brown box)

-A property is found in the "Name" box either by going through the list, or typing the property in.   (I have done "Query as Main Building")
-When you fill in the property you want to change, click "Find"
-This will give you a list of every occurrence of that property.
-These properties can be Edited/Deleted from this list.  You can use Ctrl or Shift to select more than one.

Notice the button two to the right of the "Properties Search".  This is the "Cohort Search".  This works similarly to the search I just mentioned, but it can be used to give every exemplar the same "Parent Cohort" very quickly.  (In case you notice something like every prop in the pack has "Query as Main Building" set to false.)


That's a really handy tutorial, which will save me LOTS of time.  Thanks!  :thumbsup:


The Floraler

This is the end, hold your breath and count to ten, feel the earth move, and then...

*   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *    *   *   *   *   *    * 


Great tutorial. Made cleaning up the BSC Park lots a lot easier. &apls
David, aka deadwoods


Great little Tutorial. Makes life a little easier. Thank you :thumbsup:
"It's not a design flaw, It's my signature"


Thank you for this nice tutorial; very helpful!  &apls


Thanks for the comments everyone :)

Just wanted to add a few disclaimers.

1)This should not be used to change all of a type of Property at once.  Meaning, don't change every RKT1 prop into a RKT4 prop at once.  The entry of the property will also change for every item selected, meaning you will have however many identical RKT4s.  Fastest way to do this example seems to be one at a time in PIMX (which will also set the right amount of reps and "0"s).

Likewise, say you have a bunch of non-timed props you want day and night versions of  ::):

First, enter PIMX and change them to RKT4 and save.  Copy the file and paste it in another folder.  Change one file name to have "day" and the other to have "night".  The Instances of either the day or night need to be changed to not conflict, but now you have a bunch of props with Exemplar Names that are duplicates (and every other property as well).  So, you want to add "Day" to the end of the day ones, and "Night" to the end of the night ones.  Although the Exemplar Analyzer will make it less complicated to see all of the Exemplar Names, you must type "day" or "night" into each property one at a time.

2)The list created by doing "search" must be done after every change to be updated.  So, say you search, find a property and change it.  Then you close the whole Exemplar Analyzer and start changing properties the regular way.  If you re-open the Exemplar Analyzer, you will have to re-click "search", even though it tells you that the list is already filled.  Failure to do this will give you the old values when you click "find".

Also, doing things like changing the Property type (like RKT1 to RKT4) and then "finding" RKT4 without researching will not work. At that point, finding RKT1 and changing the values may even cause a crash.   



Okay, so we can do better  :)

Reader 1.4 allows scripting by Lua Here

Chances are if you have made flora then you have copy/pasted/cloned exemplars to create new ones.  There are a few drawbacks of this, considering now you have to change a whole bunch of Instances and properties to make it unique.  Here is a script that will change all of the Exemplar ID's to match the Instance of the Exemplar.

Quotefunction reader.main (this)
   pos = reader:entries_GetHeadPosition()
   while pos~=0 do
   entry,pos = reader:entries_GetNext(pos)   
   exemplar =  reader:ex_Decode(entry)
   A1,A2,A3 = reader:entry_GetTGI(entry)
   proppos = reader:exprop_GetHeadPosition(exemplar)
   while proppos~=0 do
   exprop, proppos = reader:exprop_GetNext(exemplar,proppos)
   desc,descname = reader:exprop_GetDesc(exprop)
   if (desc == 0x00000021) then
   reader:exprop_SetValue(exprop, A3, 0)

Basically, it goes through every Entry (be warned: recommend. that you only have exemplars in the .dat) and stores the TGI as A1, A2, and A3.  It then goes through each exemplar searching for the property "0x00000021" (which is Exemplar ID) and changes it to A3 (the Instance).

I have attatched it here because it is quite versatile.  Just place it in the Reader's folder. While on the topic of Flora, another property that needs to be set is Flora: Cluster Type, which is commonly the Instance +1.  To do this, after the line "A1,A2,A3 = reader:entry_GetTGI(entry)" place the line:

A3= A3+1

Then change the "0x00000021" to "0x2a0348ba".  This will now search for Flora: Cluster Type and give it a value of the Instance of the exemplar +1.

Properties with with more than one REP can also be changed.  To set a RKT1 to the TGI (completely useless) you would change the lines to:
if (desc == 0x27812821) then
reader:exprop_SetValue(exprop, A1, 0)
reader:exprop_SetValue(exprop, A2, 1)
reader:exprop_SetValue(exprop, A3, 2)

0, 1, and 2 represent the 1st, 2nd, and 3rd rep of the RKT1.

If you don't need the TGI, then that line can be removed.  Variables "like A3" are set like that line "A3= A3+1" 

Finally, Exemplar Name is a little more tricky.  In the end, this value will probably describe the model in some way, but if you have many exemplars (I now have 4096 to deal with, and no models yet), changing them by hand isn't so great.  I tried to name them by Instance - 0x33aa2000 (the flora range I used.  The name would be something like 0xE13, which is actually it's location in the FloraPreferences property, the 15th altitude level, the 2nd moisture level with a value of 1-(3/16) :)  ).

My problem is that it seems that Exemplar Name is not HEX by default, so when A3 as a Hex is inputted as the SetValue, it comes back as a very large integer in the Exemplar Name.  However, it does seem that the "valuestr = reader:exprop_GetValueStr(exprop)" does return a literal value.  I set the Value of Exemplar ID to "Instance - 0x33aa2000), used the GetValueStr function (to now have a literal Hex value stored), then SetValue on the Exemplar name, and finally went through and corrected the Exemplar ID.