Announcement

Collapse
No announcement yet.

how to select one of each instance in a scene

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to select one of each instance in a scene

    i have a file with 45,000 trees in it. they are all instances of 12 types. i accidentaly deleted the original selection set they came from.

    now obviously since there are only 12 of them, its not tooo painful to isolate one of each type for editing,

    but im wondering if anyone knows of a script to do this?

  • #2
    i would have used a trick.. i will pick anyone of them and apply one material with instance mat option on. So this will apply same mat to all instances. It is a simple task of select object by mat from mat editor itself. no doubt script, if available will be an easier option!
    Prateek Vishwa
    sigpic
    www.prateekvishwa.com
    https://www.facebook.com/pages/PVDS/161239543925007

    Comment


    • #3
      ahh you seem to be confusing my request with "select all instances of an object" which i can do by choosing "select instances" in the edit menu.


      what i want is to open my scene with its 45000 trees in, run a script, and end up with 12 trees selected, one of each type. i can then isolate these and edit them.


      of course i can just select a tree, edit it, then select all instances and hide them, then repeat until i did all 12, but i prefer to have a "control group" of 12 trees off to one side that i can have in a selection set for editing.

      Comment


      • #4
        Code:
        (
        	fn uniqueNodes nodes = 
        	(
        		local handles = #{}
        		for node in nodes where not handles[GetHandleByAnim node] collect
        		(
        			InstanceMgr.GetInstances node &inst
        			for i in inst do handles[GetHandleByAnim i] = on
        			node
        		)
        	)
        
        	local selectedObjs = getCurrentselection()
        	local uniques  = uniqueNodes selectedObjs
        	select uniques
        )
        Select all your trees and run the script. Your unique trees should be left selected.
        Dan Brew

        Comment


        • #5
          ahh i see. anyways nice script Dan! it is very useful!
          Prateek Vishwa
          sigpic
          www.prateekvishwa.com
          https://www.facebook.com/pages/PVDS/161239543925007

          Comment


          • #6
            if i understand correctly, this script will select only the unique objects in a scene.. while this is useful, its not quite what i was after. i want to select one of each type of instance.

            as in there are 12 types of instanced trees, and in total 45000 instances. i want to run a script and get 12 trees selected/isolated. one for each type of instance. .

            Comment


            • #7
              Yes, that's what it does. By unique I meant unique from each other.
              Dan Brew

              Comment


              • #8
                ok KEWL! i should never have doubted.. many thanks

                Comment

                Working...
                X