Posts Tagged ‘material’
Tree Gobos
Sunday, November 29th, 2009
I’ve added a set of 10 leafless, winter tree gel materials for Vue to my free stuff pages today. Tested in Vue 7 Pioneer, Vue 7.5 Infinite and Vue 8 Infinite.
Striped Lighting Gels for Vue
Saturday, October 17th, 2009
This is the first set of ten, free, lighting gels materials with a theme of stripes for use with Vue 7 and above. These arn’t neat, uniform stripes. Some are quite gentle wavy lines while some are broken up at varied angles.
I’ve created this set from scans of slides I made for the Kaffeine Krew (a projected effects group I was part of in the early ’90s) to add interest in otherwise unlit spaces in discos using slide projectors. We’d load a carousel of slides into a projector and set it up well out of reach of punters and could then leave it running for hours on a slow auto change to add a little bit of variety. The slides were originally made by photographing fabric and other things with bold patterns then photocopying the prints onto overhead transparency sheets which were then chopped up into appropriate sized rectangles and mounted in slides for use. While some of the slides also had offcuts of coloured filters added to change the colour of the light we usually put a piece of coloured filter over the slide projector’s lens so the colour would remain constant.
I’ve a tutorial on using gels to add interest to Vue lighting in the works but I thought I’d start releasing the materials now because I’ve not finished the tutorial but I’ve loads of gels that I can release. They are free for use in both commercial and none commercial work but please read the read me file for full copyright and other information.
Download: impworks_stripes.zip (17.5MB)
Vue EcoRotate Python Script
Friday, August 14th, 2009
This script for Vue Infinite and xStream allows all the objects / instances in an EcoSystem to point in a direction. It also allows a a bit of variation to be included in the rotation.
Download: EcoRotate (3k Zip Archive)
Python Code
#***********************************************************************
# Set all instances in an EcoSystem to point in a given direction
# - EcoRotate.py
# -
# - By Mark Caldwell
# - Version 0.2
# - 25th August 2007
# - Checked with Vue 6.5 Infinite
#
# How to use in 4 easy steps
# 1. Select an object with a populated EcoSystem
#
# 2. Run this script
#
# 3. Enter the values requested by the script
#
# 4. Wait for the script to work
#
#***********************************************************************
#----------------------------------------------------
# Get Input and Test Value for value 0-360 for Angles
#----------------------------------------------------
def TestValAngle (messagetxt,titletxt,default):
hit=-2
val=-1
while hit<0:
try:
if int(val) in range (0,360):
hit=1;
elif hit==-2:
val=Prompt (messagetxt,default,true,titletxt)
hit=-1
else:
val=Prompt ("Error: Value must be an integer between 0 and 360\n\n"+messagetxt,val,true,titletxt)
except:
hit=-1
val=Prompt ("Error: Value must be an integer between 0 and 360\n\n"+messagetxt,val,true,titletxt)
return float(val)
#--------------------------------------------
# Get Input and Test Value for valuse 0 or 1
#--------------------------------------------
def TestValZO (messagetxt,titletxt,default):
hit=-2
val=-1
while hit<0:
try:
if int(val) in range (0,2):
hit=1;
elif hit==-2:
val=Prompt (messagetxt,default,true,titletxt)
hit=-1
else:
val=Prompt ("Error: Value must be either 0 or 1\n\n"+messagetxt,val,true,titletxt)
except:
hit=-1
val=-3
return val
#--------------------------------------------
# Start of Main Code
#--------------------------------------------
import random
#--------------------------------------------------------------------------
# Test the user has a scene loaded
#--------------------------------------------------------------------------
if TestLoaded():
#--------------------------------------------------------------------------
# Test the user has 1 object selected with an Eco System on it
#--------------------------------------------------------------------------
numselected=CountSelectedObjects()
if numselected>1:
message="Please select only one object."
elif numselected<1:
message="Please select an object."
else:
#--------------------------------------------------------------------------
# Get User values for rotation required, which to rotate and randomness
#--------------------------------------------------------------------------
xon=TestValZO ('Rotate on X axis? (Enter 0 for yes and 1 for no)','Rotate on X?','0')
if xon=="1":
rx=TestValAngle ('Rotate to X (0 to 360 degrees)','X Rotation','0')
rxv=TestValAngle ('Variation of Rotation to X (0 to 360 degrees)','X Rotation Variation','0')
yon=TestValZO ('Rotate on Y axis? (Enter 0 for yes and 1 for no)','Rotate on Y?','0') # Rotate y (set to 1 to change 0 to leave alone)
if yon=="1":
ry=TestValAngle ('Rotate to Y (0 to 360 degrees)','Y Rotation','0')
ryv=TestValAngle ('Variation of Rotation to Y (0 to 360 degrees)','Y Rotation Variation','0')
zon=TestValZO ('Rotate on Z axis? (Enter 0 for yes and 1 for no)','Rotate on Z?','0') # Rotate z (set to 1 to change 0 to leave alone)
if zon=="1":
rz=TestValAngle ('Rotate to Z (0 to 360 degrees)','Z Rotation','0')
rzv=TestValAngle ('Variation of Rotation to Z (0 to 360 degrees)','Z Rotation Variation','0')
#--------------------------------------------------------------------------
#Set Up a Few Variables
#--------------------------------------------------------------------------
bObject=GetSelectedObjectByIndex(0) # Get first selected object
Eco = GetEcosystemOnObject(bObject) # Get EcoSystem on first selected
objlist=[bObject]
if Eco==None:
message="Please select an object with an EcoSystem material applied to it."
elif bObject.IsLocked(): # Check object isn't locked
message="Please select an object that isn't locked."
else:
ecocount=Eco.GetInstanceCount () # Count number of instances in EcoSystem
if ecocount==0:
message="Please select an EcoSystem that has been populated."
else:
#--------------------------------------------------------------------------
# Rotate EcoObjects
#--------------------------------------------------------------------------
for i in range(0,ecocount):
currentrotation=Eco.GetInstanceRotation (i)
if xon!="1":
rix=currentrotation[0]
else:
rix=rx+random.uniform(-rxv,rxv)
if yon!="1":
riy=currentrotation[1]
else:
riy=ry+random.uniform(-ryv,ryv)
if zon!="1":
riz=currentrotation[2]
else:
riz=rz+random.uniform(-rzv,rzv)
Eco.SetInstanceRotation(i,rix,riy,riz)
message="Eco Rotation Success"
else:
message="No Scene Loaded"
Message(message) # Display message
#--------------------------------------------------------------------------
# End of Script
#------------------------------------------------------------------------
Vue EcoSystem Vertical Scatter
Thursday, August 13th, 2009
This python script vertically scatters the objects in a Vue EcoSystem by a random amount and works with Vue Infinite and xStream.
Download: Vue EcoSystem Vertical Scatter Script (3k Zip Archive)
Python Code – Vue EcoSystem Vertical Scatter Script
#***********************************************************************
# Set all instances in an EcoSystem to have random heights
# - EcoVerticalScatter.py
# -
# - By Mark Caldwell
# - Version 0.1
# - 5th September 2007
# - Checked with Vue 6.5 Infinite
#
# How to use in 4 easy steps
# 1. Select an object with a populated EcoSystem
#
# 2. Run this script
#
# 3. Enter the values requested by the script
#
# 4. Wait for the script to work
#
#***********************************************************************
#------------------------------------------------------
# Get Input and Test Value is a positive floating point
#------------------------------------------------------
def TestVal (messagetxt,titletxt,default):
hit=-2
val=-1
while hit<0:
try:
if float(val)>=0:
hit=1;
elif hit==-2:
val=Prompt (messagetxt,default,true,titletxt)
hit=-1
else:
val=Prompt ("Error: Value must an positive number\n\n"+messagetxt,val,true,titletxt)
except:
hit=-1
val=Prompt ("Error: Value must an positive number\n\n"+messagetxt,val,true,titletxt)
return float(val)
#--------------------------------------------
# Start of Main Code
#--------------------------------------------
import random
#--------------------------------------------------------------------------
# Test the user has a scene loaded
#--------------------------------------------------------------------------
if TestLoaded():
#--------------------------------------------------------------------------
# Test the user has 1 object selected with an Eco System on it
#--------------------------------------------------------------------------
numselected=CountSelectedObjects()
if numselected>1:
message="Please select only one object."
elif numselected<1:
message="Please select an object."
else:
#--------------------------------------------------------------------------
# Get User values for rotation required, which to rotate and randomness
#--------------------------------------------------------------------------
heightup=TestVal ('Maximum Z Increase','Maximum Z Increase','100')#
heightdown=TestVal ('Maximum Z Decrease','Maximum Z Decrease','0')
#--------------------------------------------------------------------------
#Set Up a Few Variables
#--------------------------------------------------------------------------
bObject=GetSelectedObjectByIndex(0) # Get first selected object
Eco = GetEcosystemOnObject(bObject) # Get EcoSystem on first selected
objlist=[bObject]
if Eco==None:
message="Please select an object with an EcoSystem material applied to it."
elif bObject.IsLocked(): # Check object isn't locked
message="Please select an object that isn't locked."
else:
ecocount=Eco.GetInstanceCount () # Count number of instances in EcoSystem
if ecocount==0:
message="Please select an EcoSystem that has been populated."
else:
#--------------------------------------------------------------------------
# Rotate EcoObjects
#--------------------------------------------------------------------------
for i in range(0,ecocount):
currentposition=Eco.GetInstancePosition (i)
x=currentposition[0]
y=currentposition[1]
z=currentposition[2]+random.uniform((-heightdown),heightup)
Eco.SetInstancePosition(i,x,y,z)
message="Eco Vertical Scatter Complete"
else:
message="No Scene Loaded"
Refresh()
Message(message) # Display message
#--------------------------------------------------------------------------
# End of Script
#------------------------------------------------------------------------
Vue Switch Mapping Python Script
Sunday, August 9th, 2009
Here is a little python script for Vue Infinite and xStream to switch the mapping of all the images used in the selected objects materials to bicubic mapping. I’ve tested it using Vue 7 Infinite. The script is more of an experiment towards a bigger script to work with the images in Vue materials to check out how to find and then fiddle with the nodes that make up a material in Vue.
Switch Image Mapping (2k Zip Archive Released)
Hand me my Chainsaw of Editing
Thursday, July 23rd, 2009
The rebuilding and post launch work on impworks is now pretty much done which means I can get back to other projects. tonight I’ve taken an editing chainsaw to a 120 page text which is the core design for a game and so far I’ve cut it to 60 pages. Now I’m at the hard part: cutting stuff I want to keep, stuff that took hard thinking or hard research. I’ve a simple incentive. I know that if I get this right and this text ends up in print then there is a chance I can see the cut material in print as supplements.
So tomorrow its away with the chainsaw and out with the pruning knife.
EcoSystem to Objects
Friday, March 27th, 2009
This is a python script that will place a cube at the same location as each instance in an EcoSystem. It gives each cube the same rotation as the instance. It also scales it by the same scale factor in each direction as the instance. There is an additional parameter to allow the scaling to be modified to give better results. A second parameter limits the number of instances that will have objects created for them as the script can crash Vue if large numbers of objects are created. You can increase this number if your computer can cope with larger numbers of objects.
An enhanced version developed for Vue 6 using Vue 6 Pre Release is also included in the zip file. It includes a simple interface so you don’t need to edit the script. It place any of the standard Vue primitive solids at the position of each instance of an object in an ecosystem. You can optionally group or create a metablob from the objects.
These scripts have been supperseeded by the addition of a better feature to do this in Vue itself I’ve left them here as examples of what can be achieved in Vue using Python.
EcoSystem to Objects 0.1 & 0.4 (5k Zip Archive Released)
Python Code – ecotoobject_vue6.py
#******************************************************
# Place an object at the position of each instance
# in an ecosystem
#
# - ecotoobject.py
# - By Mark Caldwell
# - Version 0.4
# - 24th April 2007
# - Tested with Vue 6 Infinite
#
# How to use in 4 easy steps
#
# 1. Download this file onto your computer
#
# 2. Select an object with a populated EcoSystem applied
#
# 3. Then run script
# To run it go to Python -> Run Python Script
# Then locate the file on your computer
#
# 4. Respond to the scripts options and then wait for
# it to work
#
#******************************************************
#----------------------------------------------
# Collect the user's input
#----------------------------------------------
group=Prompt('Group Objects?\n 1: Group\n 2: Metablob \n3: No','1',true,'')
form=Prompt('Object Type?\n 1: Cube\n 2: Sphere \n3: Cylinder \n4: Pyramid\n5: Cone\n 6: Torus','1',true,'')
maximum_objects=int(Prompt('Maximum number of objects to create?','1000',true,''))
scale_factor=float(Prompt('Scale Factor for Objects','0.1',true,''))
#--------------------------------------------------------------------------
# Test the user has a scene loaded
#--------------------------------------------------------------------------
if TestLoaded():
#--------------------------------------------------------------------------
# Test the user has 1 object selected with an Eco System on it
#--------------------------------------------------------------------------
numselected=CountSelectedObjects()
if numselected>1:
message="Please select only one object."
elif numselected<1:
message="Please select an object."
else:
#--------------------------------------------------------------------------
#Set Up a Few Variables
#--------------------------------------------------------------------------
bObject=GetSelectedObjectByIndex(0) # Get first selected object
Eco = GetEcosystemOnObject(bObject) # Get EcoSystem on first selected
if Eco==None:
message="Please select an object with an EcoSystem material applied to it."
elif bObject.IsLocked(): # Check object isn't locked
message="Please select an object that isn't locked."
else:
ecocount=Eco.GetInstanceCount () # Count number of instances in EcoSystem
if ecocount>maximum_objects: # If this is greater than maximum_objects restrict it to maximum objects
ecocount=maximum_objects
if ecocount==0:
message="Please select an EcoSystem that has been populated."
else:
#--------------------------------------------------------------------------
# Create Objects
#--------------------------------------------------------------------------
for i in range(0,ecocount):
pos=Eco.GetInstancePosition (i) # Get instance position
rot=Eco.GetInstanceRotation (i) # Get instance rotation
sca=Eco.GetInstanceScale (i) # Get instance scale
if form=='2':
obj=AddSphere()
elif form=='3':
obj=AddCylinder()
elif form=='4':
obj=AddPyramid()
elif form=='5':
obj=AddCone()
elif form=='6':
obj=AddTorus()
else:
obj=AddCube() # Create Object
obj.SetPosition(pos[0],pos[1],pos[2]) # Set object's position
obj.Rotate(rot[0],rot[1],rot[2]) # Set object's rotation
obj.ResizeAxis(sca[0]*scale_factor,sca[1]*scale_factor,sca[2]*scale_factor) # Set object's size
if group=='1' or group=='2':
if i>0:
obj.SetName(name)
else:
name=obj.Name()
DeselectAll()
if group=='1':
SelectByName(name)
Group()
elif group=='2':
SelectByName(name)
MetaBlob()
DeselectAll()
Select(bObject)
message="Eco to Object Successful"
else:
message="No Scene Loaded"
Message(message) # Display message
#--------------------------------------------------------------------------
# End of Script
#--------------------------------------------------------------------------
Python Code – ecotoobject.py
#******************************************************
# Place a cube at the position of each instance of an
# object in an ecosystem
#
# - ecotoobject.py
# - By Mark Caldwell
# - Version 0.1
# - 29th June 2006
# - Tested with Vue 5 Infinite 5.10 and Vue 6 Pre Release
#
# How to use in 4 easy steps
#
# 1. Download this file onto your computer
#
# 2. Edit the configuration variable maximum_objects below
# if you want to risk more that 1000 objects
#
# 3. Select an object with a populated EcoSystem applied
#
# 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
#
#******************************************************
#----------------------------------------------
# Configuration: Set these to alter end result
#----------------------------------------------
maximum_objects=1000 # maximum_objects sets the maximum number of instances that the script will replace with objects
# this stops it running away and crashing Vue by trying to add 1 million cubes
#--------------------------------------------------------------------------
# Test the user has a scene loaded
#--------------------------------------------------------------------------
if TestLoaded():
#--------------------------------------------------------------------------
# Test the user has 1 object selected with an Eco System on it
#--------------------------------------------------------------------------
numselected=CountSelectedObjects()
if numselected>1:
message="Please select only one object."
elif numselected<1:
message="Please select an object."
else:
#--------------------------------------------------------------------------
#Set Up a Few Variables
#--------------------------------------------------------------------------
bObject=GetSelectedObjectByIndex(0) # Get first selected object
Eco = GetEcosystemOnObject(bObject) # Get EcoSystem on first selected
objlist=[bObject]
if Eco==None:
message="Please select an object with an EcoSystem material applied to it."
elif bObject.IsLocked(): # Check object isn't locked
message="Please select an object that isn't locked."
else:
ecocount=Eco.GetInstanceCount () # Count number of instances in EcoSystem
if ecocount>maximum_objects: # If this is greater than maximum_objects restrict it to maximum objects
ecocount=maximum_objects
if ecocount==0:
message="Please select an EcoSystem that has been populated."
else:
#--------------------------------------------------------------------------
# Create Objects
#--------------------------------------------------------------------------
for i in range(0,ecocount):
pos=Eco.GetInstancePosition (i) # Get instance position
rot=Eco.GetInstanceRotation (i) # Get instance rotation
sca=Eco.GetInstanceScale (i) # Get instance scale
object=AddCube() # Create Object
object.SetPosition(pos[0],pos[1],pos[2]) # Set object's position
object.Rotate(rot[0],rot[1],rot[2]) # Set object's rotation
object.ResizeAxis(sca[0],sca[1],sca[2]) # Set object's size
message="Eco to Object Successful"
else:
message="No Scene Loaded"
Message(message) # Display message
#--------------------------------------------------------------------------
# End of Script
#--------------------------------------------------------------------------
Vue EcoSystem to CSV Python Script
Friday, March 27th, 2009
This download contains two Python scripts originally written for Vue 5 Infinite. ecotocsv.py saves a selected EcoSystem as a CSV file that can be edited in most spreadsheet packages or a text editor, csvtoeco.py, loads the edited CSV file back into Vue, modifying the instances with any changes you made in the CSV. My turorial Using Eco To CSV / CSV to Eco has more detail on how to make use of these scripts.
EcoSystem to CSV / CSV to EcoSystem 0.2 (3k Zip Archive)
Python Code – Save EcoSystem
#******************************************************
# Generate a CSV file from an ecosystem
#
# - ecotocsv.py
# - By Mark Caldwell
# - Version 0.2
# - 2nd July 2006
# - Tested with Vue 5 Infinite 5.10 and Vue 6 Pre Release
#
# How to use in 4 easy steps
#
# 1. Download this file onto your computer
#
# 2. Edit the configuration variable maximum_objects below
# if you want to risk more that 1000 instances.
# Edit start if you want to start with an instance other than
# object 0
# Edit file to set where the file will be saved
#
# 3. Select an object with a populated EcoSystem applied
#
# 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
#
#******************************************************
#----------------------------------------------
# Configuration: Set these to alter end result
#----------------------------------------------
maximum_objects=15000 # maximum_objects sets the maximum number of instances that the script will read
# this stops it running away and crashing Vue by trying to create a billion line CSV file
start=0 # The number of the instance to start generating the CSV with
file="C:\Program Files\e-on software\Vue 5 Infinite\Python\Scripts\Impworks\ecotocsv2\eco.csv" # Full Path to where you want the CSV data saved
object_filename_clean="C:\Program Files\e-on software\Vue 5 Infinite\objects" # Remove this from the filename of instance object (Don't include last \ or it will break the script!)
#--------------------------------------------------------------------------
# Test the user has a scene loaded
#--------------------------------------------------------------------------
if TestLoaded():
#--------------------------------------------------------------------------
# Test the user has 1 object selected with an Eco System on it
#--------------------------------------------------------------------------
numselected=CountSelectedObjects()
if numselected>1:
message="Please select only one object."
elif numselected<1:
message="Please select an object."
else:
#--------------------------------------------------------------------------
#Set Up a Few Variables
#--------------------------------------------------------------------------
bObject=GetSelectedObjectByIndex(0) # Get first selected object
Eco = GetEcosystemOnObject(bObject) # Get EcoSystem on first selected
length=len(object_filename_clean)
objlist=[bObject]
if Eco==None:
message="Please select an object with an EcoSystem material applied to it."
elif bObject.IsLocked(): # Check object isn't locked
message="Please select an object that isn't locked."
else:
ecocount=Eco.GetInstanceCount () # Count number of instances in EcoSystem
if ecocount>(maximum_objects+start): # If this is greater than maximum_objects restrict it to maximum objects
ecocount=(maximum_objects+start)
if ecocount==0:
message="Please select an EcoSystem that has been populated."
else:
#--------------------------------------------------------------------------
# Create Objects
#--------------------------------------------------------------------------
output=open (file,'w')
firstline='Instance,Position X,Position Y,Position Z,Rotation X,Rotation Y,Rotation Z,Scale X,Scale Y,Scale Z,Filename,Action'
output.write(firstline)
output.write('\n')
for i in range(start,ecocount):
pos=Eco.GetInstancePosition (i) # Get instance position
rot=Eco.GetInstanceRotation (i) # Get instance rotation
sca=Eco.GetInstanceScale (i) # Get instance scale
filename=Eco.GetInstanceFilename (i) # Get instance filename
filename=filename[length:]
csvline=str(i)+','+str(pos[0])+','+str(pos[1])+','+str(pos[2])+','+str(rot[0])+','+str(rot[1])+','+str(rot[2])+','+str(sca[0])+','+str(sca[1])+','+str(sca[2])+','+filename+',T'
output.write(csvline)
output.write('\n')
output.close()
message="Eco to CSV Successful"
else:
message="No Scene Loaded"
Message(message) # Display message
#--------------------------------------------------------------------------
# End of Script
#--------------------------------------------------------------------------
Python Code – Load EcoSystem
#******************************************************
# Generate a CSV file from an ecosystem
#
# - csvtoeco.py
# - By Mark Caldwell
# - Version 0.2
# - 4th July 2006
# - Tested with Vue 5 Infinite 5.10 and Vue 6 Pre Release
#
# How to use in 4 easy steps
#
# 1. Download this file onto your computer
#
# 2. Edit the configuration variable file to set where the file was saved
#
# 3. Select an object with a populated EcoSystem applied
#
# 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
#
#******************************************************
#----------------------------------------------
# Configuration: Set these to alter end result
#----------------------------------------------
file='C:\Program Files\e-on software\Vue 5 Infinite\Python\Scripts\Impworks\ecotocsv2\eco.csv' # Full Path to where you want the CSV data loaded from
#--------------------------------------------------------------------------
# Test the user has a scene loaded
#--------------------------------------------------------------------------
if TestLoaded():
#--------------------------------------------------------------------------
# Test the user has 1 object selected with an Eco System on it
#--------------------------------------------------------------------------
numselected=CountSelectedObjects()
if numselected>1:
message="Please select only one object."
elif numselected<1:
message="Please select an object."
else:
#--------------------------------------------------------------------------
#Set Up a Few Variables
#--------------------------------------------------------------------------
bObject=GetSelectedObjectByIndex(0) # Get first selected object
Eco = GetEcosystemOnObject(bObject) # Get EcoSystem on first selected
objlist=[bObject]
if Eco==None:
message="Please select an object with an EcoSystem material applied to it."
elif bObject.IsLocked(): # Check object isn't locked
message="Please select an object that isn't locked."
else:
ecocount=Eco.GetInstanceCount () # Count number of instances in EcoSystem
#--------------------------------------------------------------------------
# Apply to Instances
#--------------------------------------------------------------------------
file=open(file,'r')
count=0
check=0
line = file.readline() # Throw away the header line
message="CSV to Eco Successful"
while 1:
line = file.readline()
if not(line):
break
line=line.strip()
bits=line.split(',')
if int(bits[0])<=ecocount and str(bits[11])=='T':
name=int(bits[0])
x=float(bits[1])
y=float(bits[2])
z=float(bits[3])
rx=float(bits[4])
ry=float(bits[5])
rz=float(bits[6])
sx=float(bits[7])
sy=float(bits[8])
sz=float(bits[9])
Eco.SetInstancePosition(name,x,y,z)
Eco.SetInstanceRotation(name,rx,ry,rz)
Eco.SetInstanceScale(name,sx,sy,sz)
elif int(bits[0])<=ecocount and str(bits[11])=='D':
name=int(bits[0])
Eco.DeleteInstance (name)
else:
message="CSV to Eco Fail"
break
else:
message="No Scene Loaded"
Message(message) # Display message
#--------------------------------------------------------------------------
# End of Script
#--------------------------------------------------------------------------
Eco Spray
Friday, March 27th, 2009
This python script coats the outside of an object with an EcoSystem. It won’t cover all faces because of the way it works. It will cover a sphere, cube, cone but won’t cover all of a torus.
Eco Spray 0.1 (3k Zip Archive)
Python Code
#******************************************************
# Spray an EcoSystem onto an object
#
# - ecospray.py
# - By Mark Caldwell
# - Version 0.1
# - 15th September 2006
# - Tested with Vue 5 Infinite 5.10 and Vue 6 Infinite Pre Release
# - http://www.impworks.co.uk/
#
# How to use in 3 easy steps
#
# 1. Download this file onto your computer
#
# 3. Select an object with a populated EcoSystem applied
#
# 4. Then run script and enter values when asked
# To run it go to Python -> Run Python Script
# Then locate the file on your computer
#
#******************************************************
#--------------------------------------------
# Get Input and Test Value for values 0-10000
#--------------------------------------------
def TestVal (messagetxt,titletxt,default):
hit=-2
val=-1
while hit<0:
try:
if int(val) in range (0,10000):
hit=1;
elif hit==-2:
val=Prompt (messagetxt,default,true,titletxt)
hit=-1
else:
val=Prompt ("Error: Value must be an integer between 0 and 10000\n\n"+messagetxt,val,true,titletxt)
except:
hit=-1
val=Prompt ("Error: Value must be an integer between 0 and 10000\n\n"+messagetxt,val,true,titletxt)
return val
#--------------------------------------------
# Set up Random Numbers
#--------------------------------------------
import random
ran = random.Random()
#----------------------------------------------
# Configuration: Get User Input
#----------------------------------------------
number_instances=TestVal ('Maximum Number of Instances to use (0-10000)','Select Maximum Instance','0')
#--------------------------------------------------------------------------
# Main
#--------------------------------------------------------------------------
if TestLoaded(): # Test user has a scene loaded
#--------------------------------------------------------------------------
# Test the user has 1 object selected with an Eco System on it
#--------------------------------------------------------------------------
numselected=CountSelectedObjects()
if numselected>1:
message="Please select only one object."
elif numselected<1:
message="Please select an object."
else:
#--------------------------------------------------------------------------
#Set Up a Few Variables
#--------------------------------------------------------------------------
obj=GetSelectedObjectByIndex(0) # Get selected object
mat=obj.Material(0) # Get material on selected object
Eco = GetEcosystemOnObject(obj) # Get EcoSystem on first selected
if Eco==None: # Check object has an EcoSystem Material
message="Please select an object with an EcoSystem material applied to it."
elif obj.IsLocked(): # Check object isn't locked
message="Please select an object that isn't locked."
else:
#--------------------------------------------------------------------------------
# Find out how many different objects can be used as instances for this EcoSystem
#--------------------------------------------------------------------------------
newinst=0
instcount=0
while newinst==0:
ret=Eco.AddInstance(instcount)
if ret==-1:
newinst=1
else:
instcount=instcount+1
instcount=instcount-1
#--------------------------------------------------------------------------
# Coat
#--------------------------------------------------------------------------
Eco.ClearInstances () # Clear all instances from Eco
obj2=AddCube()
obj2.Resize(0.1)
pos=obj.Position()
rot=obj.GetRotationAngles()
obj.SetPivotPosition((pos[0]),(pos[1]),(pos[2]))
obj2.SetPivotPosition((pos[0]),(pos[1]),(pos[2]))
# Now apply instances
for i in range(0,int(number_instances)):
x=random.uniform(0,360)
y=random.uniform(0,360)
z=random.uniform(0,360)
obj2.SetPosition(pos[0],pos[1],(pos[2]+1100))
obj.Rotate(x,y,z)
hitobj=GetFirstHitObject ((pos[0],pos[1],(pos[2]+1000)),(0,0,-1))
SelectOnly(hitobj)
if obj.IsSelected():
SelectOnly(obj2)
Drop()
pos2=obj2.Position()
instno=random.randint(0,instcount)
inst=Eco.AddInstance(instno)
Eco.SetInstancePosition (inst,pos2[0],pos2[1],pos2[2])
obj.SetRotationAngles(rot[0],rot[1],rot[2])
SelectOnly(obj2)
Delete()
message="Coating Completed. "+str(Eco.GetInstanceCount () )+" instances used."
else:
message="No Scene Loaded"
Message(message) # Display message
#--------------------------------------------------------------------------
# End of Script
#--------------------------------------------------------------------------
Vue Texture Resizer
Thursday, November 27th, 2008
One perenial problem reported by Vue users is running short of memory. Part of the problem is that it is so easy to import objects that are loaded down with image based textures, bump maps, reflection maps etc. At the moment its a bit of a pain to hunt down all the textures, make copies and resize them based on how they are used in your scene. I was messing round with a Vue python script earlier to find all the image nodes in materials in a scene. This will form part of a new add on for Vue that I hope will be able to find all the images and then either let you move all of them to another directory to work on with your favourite graphics package or resize the copy without leaving Vue. Tomorrow I hope to have the time to put a wxPython wrapper around it to make it a bit frendlier than it is at the moment.
