- #******************************************************
- # Replace Place Holder Object With Plant
- # - plant_replace.py
- # - Replace Selected Objects with Plants
- # - By Mark Caldwell
- # - Version 0.2
- # - 5th October 2006
- # - Tested with Vue 5 Infinite 5.09 and Vue 6 Pre Release
- #
- # How to use in 4 easy steps
- #
- # 1. Download this file onto your computer
- #
- # 2. Edit the configuration variables below
- #
- # 3. Select Objects to be Replace in Vue Infinite
- #
- # 4. Then run script and wait for it to work
- # To run it go to Python -> Run Python Script
- # Then locate the file on your computer
- #
- #******************************************************
-
- import random
-
- #----------------------------------------------
- # Configuration: Set these to alter end result
- #----------------------------------------------
-
- plantlist = ["08wMapleR",
- "08uMaple",
- "07_Plum",
- "08tmSummerCherry",
- "08tnFallCherry",
- "08toBlossomingCherry",
- "09_Acacia",
- "06_Fir",
- "10_Coconut"] # This is the file names of the plant to use
-
- directory="C:\Documents and Settings\Mark Caldwell\My Documents\e-on software\Vue 6 Infinite\Plants\" # set the directory your plants are stored in
-
- displacement_x=0 # This is added to the objects x position when placing the plant
- displacement_y=0 # This is added to the objects y position when placing the plant
- displacement_z=0 # This is added to the objects z position when placing the plant
- scale=1 # This is used to scale the plant
- drop=0 # If this is set to 1 the plant is dropped onto the nearest object under it
- shift_z=0 # If the plant is dropped the replaced object must be moved out of the way.
- # This is the z displacement applied to move them after they have been replaced
-
- #----------------------------------------------
- # Internal Variables Set Up: Don't alter these
- #----------------------------------------------
-
- poso=[]
- ran = random.Random()
- count=CountSelectedObjects()
- countplant=len(plantlist)-1
-
- #----------------------------------------------
- # Find Selected Objects
- #----------------------------------------------
-
- for i in range(0,count):
- object=GetSelectedObjectByIndex(i)
- poso.append(object.Position())
- object.SetPosition (0,0,shift_z)
-
- #----------------------------------------------
- # Add Plants
- #----------------------------------------------
-
- for i in range(0,count):
- file=directory+plantlist[ran.randint(0,countplant)];
- plant = AddPlant(file)
- posp=poso[i]
- plant.SetPosition((posp[0]+displacement_x),(posp[1]+displacement_y),(posp[2]+displacement_z))
- plant.Resize(scale)
- if drop==1:
- Drop()
Plant Replace
- Plant Replace
- Version: 0.1
- April 13, 2015
- 1.8 KB
This python script replaces selected objects with plants from a random list of Vue’s plants.