PracticalExampleoftheDivision-by-zeroCatch.......402
7.2.10 Floating-pointErrors ....................403
AnAlternativetotheEqualityConditional..........404
7.2.11 CreatethevectorOnCircle()Procedure ..........405
7.2.12 Createthereflect()Procedure ...............410
7.2.13 ThedotCommand......................412
7.2.14 AnalogywithRays......................414
7.2.15 Createthetree()Procedure.................415
7.2.16 TherotCommand......................417
GettingGeekywithIt .....................419
7.2.17 Returningtothetree()Procedure .............422
Chapter 8 MELandExpressions.........................425
8.1 What Are Expressions and How Do They Differ from MEL? . . . 425
8.1.1 NormalExpressions .....................425
8.1.2 ParticleExpressions.....................427
8.1.3 TheDifferencebetweenExpressionsandMEL ......429
Difference1:DirectAccesstoObjectAttributes.......429
Difference2:TimeandFrameVariables............430
Difference3:Comments....................430
8.2 ProceduralDustwithExpressions.................430
8.2.1 Overview ...........................430
8.2.2 Outline.............................431
8.2.3 SceneSetupSummary....................432
8.2.4 CreatingtheParticleSystems................434
8.2.5 SettinguptheExpressions..................436
ThednoiseCommand .....................441
TheemitCommand.......................442
AddTurbulenceandGravity..................442
Conserve............................443
(Fixing) Collisions .......................443
Lather.Rinse.Repeat......................444
DustShapeExpressions....................444
8.2.6 Setting up a Customized Z-depth Pass for Compositing . . 445
8.2.7 ParticleDiskCache......................450
WhatIsaPDC?.........................450
FileFormatandLocationofPDCs...............450
WhatIsParticleStartupCaching?...............450
FileFormatandLocationofStartupCaches..........451
CreatingaPDCforOurScene.................451
8.3 Annotating Collision Positions ...................453
Contents
xv
8.3.1 Overview ...........................453
8.3.2 How Do I Get the Exact Position of a Collision? ......453
Using collisionWorldPosition and collisionTime........453
Creating Locators at the Collision Position ..........455
Creating Annotations at the Collision Position ........455
8.4 AddingExpressionswithMEL...................457
8.4.1 Overview ...........................457
8.4.2 Workflow............................457
8.4.3 TheCreationExpression...................459
8.4.4 TheRuntimeExpression...................460
8.4.5 IntegratingExpressionsinMEL...............460
getShapesProcedure......................460
randomInstanceRotation Procedure: Getting the
RightSelection .......................461
randomInstanceRotation Procedure: Adding the Attributes . 461
randomInstanceRotation Procedure: The Creation
Expression..........................462
randomInstanceRotation Procedure: The Runtime
Expression..........................463
Chapter 9 AnnotatingtheTimeline:anno.mel.................465
9.1 Introduction.............................465
9.1.1 Origin.............................465
9.1.2 WhatDoesItDo?.......................466
9.1.3 TheExplanation........................467
9.1.4 SyntaxofDelimiters.....................468
9.1.5 TheStructure.........................469
9.1.6 TheFunctionalityoftheIndividualScriptFiles.......470
9.2 SourcingAlltheScripts:anno.mel.................472
9.2.1 Outline.............................472
9.2.2 CodeandComments.....................472
9.3 Storage and Manipulation of Annotation Data: annoData.mel . . . 474
9.3.1 Outline.............................474
9.3.2 Using a scriptNode to Store Annotation Data:
annoDataAddAttrsandannoDataGetStorage.........474
9.3.3 ComplexAttributes:Introduction..............475
9.3.4 WhatIsaCompoundAttribute?...............476
MoreaboutChildAttributes..................477
9.3.5 WhatIsaMultiAttribute?..................478
ComplexAttributes:Summary.................480
Contents
xvi
9.3.6 Code and Comments of annoDataAddAttrs and
annoDataGetStorage......................481
9.3.7 WhyattributeQueryandNotattributeExists? .......483
9.4 annoDataGetExistingElements...................484
9.4.1 Outline.............................484
9.4.2 What Is a Logical Index? ...................484
9.4.3 annoDataGetExistingElements as a Memory Efficient
Procedure............................486
9.4.4 FinerPointsofannoDataGetExistingElements.......489
9.4.5 CodeandComments.....................490
9.5 annoDataGetVisibleElements....................490
9.5.1 Outline.............................490
9.5.2 GettingTwoValuesintheCorrectOrder..........491
9.5.3 CodeandComments.....................492
9.6 annoDataCutExisting........................493
9.6.1 Outline.............................493
9.6.2 TheArguments........................494
9.6.3 FinerPointsofannoDataCutExisting............495
9.6.4 ThecontinueCommand ...................496
9.6.5 FlowoftheConditionals...................496
9.6.6 TheremoveMultiInstanceCommand............497
9.7 annoDataEditTime.........................497
9.7.1 Outline.............................497
9.7.2 TheArguments........................498
9.7.3 FinerPointsofannoDataEditTime..............499
9.7.4 AWordaboutGlobalVariables................499
9.8 CreatingaSingleAnnotationMarker:annoMarker.mel......501
9.8.1 Outline.............................501
9.8.2 ConfiguringtheText,Color,andFontoftheMarker....502
annoMarkerGetFont ......................502
annoMarkerConfigureText...................502
annoMarkerConfigureColor ..................503
annoMarkerConfigureFont...................504
9.8.3 TheAnnotationPop-upCallback...............504
9.8.4 Retrieving the Data, Storage Node, and Logical Index
ofaMarkerUI .........................505
annoMarkerGetData......................505
9.8.5 Connecting the Marker UI to a Particular Annotation . . . 507
9.8.6 CreatingtheUIControlsforaMarker............507
9.9 Drag-and-dropFunctionality ....................508
Contents
xvii
9.9.1 GruntsandFrustrations...................508
9.9.2 TheBasics...........................509
9.9.3 Like Slowly Pulling Off a Band-Aid .............511
9.9.4 LimitationsofDrag-and-dropFunctionality.........513
9.9.5 IllustrationofFunctionalityandLimitations ........514
9.10 Updating the Display of All Annotation Markers:
annoDisplay.mel...........................520
9.10.1 Arranging the Annotation Markers under the Timeline . . 520
annoFrameToPixel.......................520
annoPixelToFrame.......................521
TypeCasting ..........................521
annoDisplayGetTopForm....................522
annoDisplayUpdate.......................522
9.10.2 The Drag and Drop Callbacks: annoDisplayDragCallback
andannoDisplayDropCallback.................523
annoDisplayDragCallback ...................523
annoDisplayDropCallback ...................524
9.10.3 GettingaMarkersNeighbors:
annoDisplayGetNeighbors...................524
9.10.4 Nudging the Annotation Markers: annoNudge.mel ....525
9.11 DisplayingtheannoUIintheMainWindow:annoUI.mel.....526
9.11.1 annoUIFindTimeControl...................526
9.11.2 annoUICreateUnderTimeSlider...............526
9.11.3 annoUIDestroy and annoUIAuxiliaryControls .......528
9.11.4 annoUIOpen.........................528
9.11.5 TheAdd/Close/Options/EditAllDialogScripts.......529
9.12 MEL Implementation of the Quicksort
Algorithm: annoSort.mel ......................530
9.12.1 Motivation..........................530
9.12.2 WhatIsaBinarySearch?..................531
9.12.3 WhatIsQuicksort? .....................532
9.12.4 Why Not Use the Built-in Sort Function MEL
AlreadyHas?..........................533
9.12.5 CodeandComments.....................534
9.12.6 PracticalExampleofannoSortElements..........537
9.12.7 Conclusion..........................538
Index.................................. 541
Contents
xviii

Get Professional MEL Solutions for Production now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.