Project

General

Profile

Surface Comb Modifier » Test_SurfaceCombModifier.ms

Marsel Khadiyev, 08/23/2014 07:43 AM

 
struct Test_SurfaceCombModifier
(
-- Tests that sink weights have an effect on resulting strand orientation
function Test_SinkWeights =
(
-- Create a plane with 1x1 segments so we have 4 vertices all together
distributionObject = Plane lengthsegs:1 widthsegs:1

max modify mode

-- Setup guides with surface comb
select distributionObject

guidesFromSurfaceModifier = Ox_Guides_from_Surface()
guidesFromSurfaceModifier.method = 2
guidesFromSurfaceModifier.count = 10
guidesFromSurfaceModifier.numSegs = 2
modPanel.addModToSelection guidesFromSurfaceModifier

surfaceCombInstance = Ox_Surface_Comb()
modPanel.addModToSelection surfaceCombInstance
-- Create two sinks on either end of the distribution mesh, pointing away from one another
surfaceCombInstance.CreateSinkAtCoordinate 2 [20,0,0] 0 [0,0,1]
surfaceCombInstance.CreateSinkAtCoordinate 2 [-20,0,0] 1 [1,0,0]
surfaceCombInstance.SetSinkStrength 0 10
surfaceCombInstance.SetSinkStrength 1 1

-- Record current tip positions
guidesCopy = instance distributionObject
convertTo guidesCopy GuidesObject
myGuides = ( guidesCopy.GetGuides() ).AsHair()
guide1Tip = myGuides.GetPoint 4 1
guide2Tip = myGuides.GetPoint 5 1
guide3Tip = myGuides.GetPoint 6 1
guide4Tip = myGuides.GetPoint 7 1
delete guidesCopy
-- Change the strengths of the sinks and compare the new tip positions. They should be different.
surfaceCombInstance.SetSinkStrength 0 0
surfaceCombInstance.SetSinkStrength 1 100
guidesCopy = instance distributionObject
convertTo guidesCopy GuidesObject
myGuides = ( guidesCopy.GetGuides() ).AsHair()
EAssert.AreNotEqual guide1Tip ( myGuides.GetPoint 4 1 )
EAssert.AreNotEqual guide2Tip ( myGuides.GetPoint 5 1 )
EAssert.AreNotEqual guide3Tip ( myGuides.GetPoint 6 1 )
EAssert.AreNotEqual guide4Tip ( myGuides.GetPoint 7 1 )
delete guidesCopy
-- Cleanup
delete distributionObject
)
)

EUnit.AddTestClass Test_SurfaceCombModifier
ok
(9-9/9)