diff options
Diffstat (limited to '')
100 files changed, 10161 insertions, 0 deletions
diff --git a/tools/MayaTools/Maya4.0/bin/plug-ins/objectsnapper.mll b/tools/MayaTools/Maya4.0/bin/plug-ins/objectsnapper.mll Binary files differnew file mode 100644 index 0000000..db95b36 --- /dev/null +++ b/tools/MayaTools/Maya4.0/bin/plug-ins/objectsnapper.mll diff --git a/tools/MayaTools/Maya4.0/bin/plug-ins/trackeditor.mll b/tools/MayaTools/Maya4.0/bin/plug-ins/trackeditor.mll Binary files differnew file mode 100644 index 0000000..ad21094 --- /dev/null +++ b/tools/MayaTools/Maya4.0/bin/plug-ins/trackeditor.mll diff --git a/tools/MayaTools/Maya4.0/bin/plug-ins/worldbuilder.mll b/tools/MayaTools/Maya4.0/bin/plug-ins/worldbuilder.mll Binary files differnew file mode 100644 index 0000000..87703bd --- /dev/null +++ b/tools/MayaTools/Maya4.0/bin/plug-ins/worldbuilder.mll diff --git a/tools/MayaTools/Maya4.0/extras/icons/bob_Mr_T.bmp b/tools/MayaTools/Maya4.0/extras/icons/bob_Mr_T.bmp Binary files differnew file mode 100644 index 0000000..3d39370 --- /dev/null +++ b/tools/MayaTools/Maya4.0/extras/icons/bob_Mr_T.bmp diff --git a/tools/MayaTools/Maya4.0/icons/actionlocator.bmp b/tools/MayaTools/Maya4.0/icons/actionlocator.bmp Binary files differnew file mode 100644 index 0000000..03ca285 --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/actionlocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/breakablecameralocator.bmp b/tools/MayaTools/Maya4.0/icons/breakablecameralocator.bmp Binary files differnew file mode 100644 index 0000000..bf05f34 --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/breakablecameralocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/carstartlocator.bmp b/tools/MayaTools/Maya4.0/icons/carstartlocator.bmp Binary files differnew file mode 100644 index 0000000..43bfc06 --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/carstartlocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/directionallocator.bmp b/tools/MayaTools/Maya4.0/icons/directionallocator.bmp Binary files differnew file mode 100644 index 0000000..5d663b5 --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/directionallocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/eventlocator.bmp b/tools/MayaTools/Maya4.0/icons/eventlocator.bmp Binary files differnew file mode 100644 index 0000000..a9c46ba --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/eventlocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/fovlocator.bmp b/tools/MayaTools/Maya4.0/icons/fovlocator.bmp Binary files differnew file mode 100644 index 0000000..0e85e2a --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/fovlocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/genericlocator.bmp b/tools/MayaTools/Maya4.0/icons/genericlocator.bmp Binary files differnew file mode 100644 index 0000000..2c598d6 --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/genericlocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/interiorlocator.bmp b/tools/MayaTools/Maya4.0/icons/interiorlocator.bmp Binary files differnew file mode 100644 index 0000000..47a2f9b --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/interiorlocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/occlusionlocator.bmp b/tools/MayaTools/Maya4.0/icons/occlusionlocator.bmp Binary files differnew file mode 100644 index 0000000..4148247 --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/occlusionlocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/pedgrouplocator.bmp b/tools/MayaTools/Maya4.0/icons/pedgrouplocator.bmp Binary files differnew file mode 100644 index 0000000..b420e53 --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/pedgrouplocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/scriptlocator.bmp b/tools/MayaTools/Maya4.0/icons/scriptlocator.bmp Binary files differnew file mode 100644 index 0000000..17ce55e --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/scriptlocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/staticcameralocator.bmp b/tools/MayaTools/Maya4.0/icons/staticcameralocator.bmp Binary files differnew file mode 100644 index 0000000..909a577 --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/staticcameralocator.bmp diff --git a/tools/MayaTools/Maya4.0/icons/zonelocator.bmp b/tools/MayaTools/Maya4.0/icons/zonelocator.bmp Binary files differnew file mode 100644 index 0000000..4a17b3a --- /dev/null +++ b/tools/MayaTools/Maya4.0/icons/zonelocator.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEActionEventLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEActionEventLocatorNodeTemplate.mel new file mode 100644 index 0000000..4c1a413 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEActionEventLocatorNodeTemplate.mel @@ -0,0 +1,34 @@ +global proc AEActionEventLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + + editorTemplate -addControl "exportTransform"; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Action Attribute" -collapse false; + editorTemplate -addControl "actionObject"; + editorTemplate -addControl "joint"; + editorTemplate -addControl "action"; + editorTemplate -addControl "buttonInput"; + editorTemplate -addControl "shouldTransform"; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + + editorTemplate -callCustom "AEWBTriggerButtonNew" + "AEWBTriggerButtonReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEBreakableCameraLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEBreakableCameraLocatorNodeTemplate.mel new file mode 100644 index 0000000..82a08f2 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEBreakableCameraLocatorNodeTemplate.mel @@ -0,0 +1,20 @@ +global proc AEBreakableCameraLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "FOV Settings" -collapse 0; + editorTemplate -addControl "fov"; + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AECarStartLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AECarStartLocatorNodeTemplate.mel new file mode 100644 index 0000000..a3e9f04 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AECarStartLocatorNodeTemplate.mel @@ -0,0 +1,21 @@ +global proc AECarStartLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Car Start Data" -collapse 0; + editorTemplate -addControl "isParked"; + editorTemplate -addControl "specialName"; + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEDirectionalLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEDirectionalLocatorNodeTemplate.mel new file mode 100644 index 0000000..cd9d34e --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEDirectionalLocatorNodeTemplate.mel @@ -0,0 +1,16 @@ +global proc AEDirectionalLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEEventLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEEventLocatorNodeTemplate.mel new file mode 100644 index 0000000..9d6443b --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEEventLocatorNodeTemplate.mel @@ -0,0 +1,28 @@ +global proc AEEventLocatorNodeTemplate( string $nodeName ) +{ + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Event Attributes" -collapse false; + editorTemplate -addControl "event"; + editorTemplate -addControl "extraData"; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + + editorTemplate -callCustom "AEWBTriggerButtonNew" + "AEWBTriggerButtonReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEFOVLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEFOVLocatorNodeTemplate.mel new file mode 100644 index 0000000..c02a84a --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEFOVLocatorNodeTemplate.mel @@ -0,0 +1,30 @@ +global proc AEFOVLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "FOV Settings" -collapse 0; + editorTemplate -addControl "fov"; + editorTemplate -addControl "time"; + editorTemplate -addControl "rate"; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + + editorTemplate -callCustom "AEWBTriggerButtonNew" + "AEWBTriggerButtonReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEGenericLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEGenericLocatorNodeTemplate.mel new file mode 100644 index 0000000..c1ed3cb --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEGenericLocatorNodeTemplate.mel @@ -0,0 +1,16 @@ +global proc AEGenericLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEInteriorEntranceLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEInteriorEntranceLocatorNodeTemplate.mel new file mode 100644 index 0000000..f23f6ee --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEInteriorEntranceLocatorNodeTemplate.mel @@ -0,0 +1,28 @@ +global proc AEInteriorEntranceLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Interior Attribute" -collapse false; + editorTemplate -addControl "zone"; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + + editorTemplate -callCustom "AEWBTriggerButtonNew" + "AEWBTriggerButtonReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEIntersectionLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEIntersectionLocatorNodeTemplate.mel new file mode 100644 index 0000000..740b05f --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEIntersectionLocatorNodeTemplate.mel @@ -0,0 +1,20 @@ +global proc AEIntersectionLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Intersection Attributes" -collapse 0; + + editorTemplate -addControl "IntersectionType"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); + + editorTemplate -suppress "localPosition"; +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEOcclusionLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEOcclusionLocatorNodeTemplate.mel new file mode 100644 index 0000000..5833530 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEOcclusionLocatorNodeTemplate.mel @@ -0,0 +1,29 @@ + +global proc AEOcclusionLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + + editorTemplate -callCustom "AEWBTriggerButtonNewOcclude" + "AEWBTriggerButtonReplaceOcclude" + "message"; + + editorTemplate -callCustom "AEWBTriggerButtonNewVisible" + "AEWBTriggerButtonReplaceVisible" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEPedGroupLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEPedGroupLocatorNodeTemplate.mel new file mode 100644 index 0000000..1dcfcce --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEPedGroupLocatorNodeTemplate.mel @@ -0,0 +1,26 @@ +global proc AEPedGroupLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Ped Group Attributes" -collapse 0; + editorTemplate -addControl "group"; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + editorTemplate -callCustom "AEWBTriggerButtonNew" + "AEWBTriggerButtonReplace" + "message"; + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AERailCamLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AERailCamLocatorNodeTemplate.mel new file mode 100644 index 0000000..7d3178c --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AERailCamLocatorNodeTemplate.mel @@ -0,0 +1,56 @@ +global proc AERailCamLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Rail Attributes" -collapse false; + editorTemplate -addControl "cutInOut"; + editorTemplate -addControl "carOnly"; + editorTemplate -addControl "onFootOnly"; + editorTemplate -addControl "reset"; + editorTemplate -addControl "noFOV"; + editorTemplate -addControl "camRail"; + editorTemplate -addControl "behaviour"; + editorTemplate -addControl "minRadius"; + editorTemplate -addControl "maxRadius"; + + editorTemplate -addSeparator; + + editorTemplate -addControl "trackRail"; + editorTemplate -addControl "trackDist"; + editorTemplate -addControl "reverseSense"; + editorTemplate -addControl "fieldOfView"; + editorTemplate -addControl "facingOffset"; + editorTemplate -addControl "axisPlay"; + + editorTemplate -addSeparator; + + editorTemplate -addControl "positionLag"; + editorTemplate -addControl "targetLag"; + + editorTemplate -addSeparator; + + editorTemplate -addControl"active"; + editorTemplate -addControl "target"; + + editorTemplate -addSeparator; + editorTemplate -addControl "transitionTo"; + + editorTemplate -callCustom "AEWBTargetSelectNew" + "AEWBTargetSelectReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AERoadNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AERoadNodeTemplate.mel new file mode 100644 index 0000000..27c4431 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AERoadNodeTemplate.mel @@ -0,0 +1,29 @@ +global proc AERoadNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Road Attributes" -collapse 0; + + editorTemplate -addControl "IntersectionStart"; + editorTemplate -addControl "IntersectionEnd"; + editorTemplate -addControl "density"; + editorTemplate -addControl "speed"; + editorTemplate -addControl "difficulty"; + editorTemplate -addControl "shortCut"; + + editorTemplate -callCustom "AETEShowRoadSegNew" + "AETEShowRoadSegReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); + + editorTemplate -suppress "localPosition"; +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEScriptLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEScriptLocatorNodeTemplate.mel new file mode 100644 index 0000000..2e800c8 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEScriptLocatorNodeTemplate.mel @@ -0,0 +1,28 @@ +global proc AEScriptLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Script Attributes" -collapse false; + editorTemplate -addControl "script"; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + + editorTemplate -callCustom "AEWBTriggerButtonNew" + "AEWBTriggerButtonReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AESplineLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AESplineLocatorNodeTemplate.mel new file mode 100644 index 0000000..57e5e2a --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AESplineLocatorNodeTemplate.mel @@ -0,0 +1,23 @@ +global proc AESplineLocatorNodeTemplate( string $nodeName ) +{ + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + + editorTemplate -callCustom "AEWBTriggerButtonNew" + "AEWBTriggerButtonReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEStaticCameraLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEStaticCameraLocatorNodeTemplate.mel new file mode 100644 index 0000000..d611957 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEStaticCameraLocatorNodeTemplate.mel @@ -0,0 +1,52 @@ +global proc AEStaticCameraLocatorNodeTemplate( string $nodeName ) +{ + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Camera Attributes" -collapse false; + editorTemplate -addControl "cutInOut"; + editorTemplate -addControl "carOnly"; + editorTemplate -addControl "onFootOnly"; + editorTemplate -addControl "oneShot"; + editorTemplate -addControl "noFOV"; + editorTemplate -addControl "fieldOfView"; + editorTemplate -addControl "facingOffset"; + + editorTemplate -addSeparator; + + editorTemplate -addControl "targetLag"; + + editorTemplate -addSeparator; + + editorTemplate -addControl "active"; + + editorTemplate -addControl "target"; + editorTemplate -addControl "tracking"; + + editorTemplate -addSeparator; + editorTemplate -addControl "transitionTo"; + + editorTemplate -callCustom "AEWBTargetSelectNew" + "AEWBTargetSelectReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + + editorTemplate -callCustom "AEWBTriggerButtonNew" + "AEWBTriggerButtonReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AETELocatorSuppress.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AETELocatorSuppress.mel new file mode 100644 index 0000000..13a6d00 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AETELocatorSuppress.mel @@ -0,0 +1,37 @@ +global proc AETELocatorSuppress( string $nodeName ) +{ + editorTemplate -suppress "inputTranslate"; + editorTemplate -suppress "input"; + editorTemplate -suppress "caching"; + editorTemplate -suppress "nodeState"; + editorTemplate -suppress "visibility"; + editorTemplate -suppress "intermediateObject"; + editorTemplate -suppress "template"; + editorTemplate -suppress "ghosting"; + editorTemplate -suppress "instObjGroups"; + editorTemplate -suppress "compInstObjGroups"; + editorTemplate -suppress "castsShadows"; + editorTemplate -suppress "receiveShadows"; + editorTemplate -suppress "depthJitter"; + editorTemplate -suppress "motionBlur"; + editorTemplate -suppress "renderInfo"; + editorTemplate -suppress "primaryVisibility"; + editorTemplate -suppress "visibleInReflections"; + editorTemplate -suppress "visibleInRefractions"; + editorTemplate -suppress "geometryAntialiasingOverride"; + editorTemplate -suppress "antialiasingLevel"; + editorTemplate -suppress "shadingSamplesOverride"; + editorTemplate -suppress "shadingSamples"; + editorTemplate -suppress "maxShadingSamples"; + editorTemplate -suppress "volumeSamplesOverride"; + editorTemplate -suppress "volumeSamples"; + editorTemplate -suppress "maxVisibilitySamplesOverride"; + editorTemplate -suppress "maxVisibilitySamples"; + editorTemplate -suppress "boundingBoxScale"; + editorTemplate -suppress "drawOverride"; + editorTemplate -suppress "useObjectColor"; + editorTemplate -suppress "objectColor"; + editorTemplate -suppress "intermediateObject"; + editorTemplate -suppress "visibility"; + editorTemplate -suppress "lodVisibility"; +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AETEShowRoadSegButton.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AETEShowRoadSegButton.mel new file mode 100644 index 0000000..3ffbeb5 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AETEShowRoadSegButton.mel @@ -0,0 +1,29 @@ +global proc AETEShowRoadSegNew( string $nodeName ) +{ + columnLayout -adj true; + + select $nodeName; + string $names[] = `ls -sl -o`; + + string $command = "te_MCB_ShowRoadFromSelected()"; + + button -label "Show Road Segments" -command $command TEShowRoadSegsButton; + + setParent ..; + + select $names[0]; +} + + +global proc AETEShowRoadSegReplace( string $nodeName ) +{ + + select $nodeName; + string $names[] = `ls -sl -o`; + + string $command = "te_MCB_ShowRoadFromSelected"; + + button -e -command $command TEShowRoadSegsButton; + + select $names[0]; +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AETreelineShapeNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AETreelineShapeNodeTemplate.mel new file mode 100644 index 0000000..766ed13 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AETreelineShapeNodeTemplate.mel @@ -0,0 +1,41 @@ +global proc AETreelineShapeNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Treeline Attributes" -collapse false; + + editorTemplate -addControl "material"; + + editorTemplate -addControl "uscale"; + + editorTemplate -addControl "height"; + + editorTemplate -suppress "colour"; + + editorTemplate -suppress "alpha"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AETELocatorSuppress( $nodeName ); + + editorTemplate -suppress "controlPoints"; + editorTemplate -suppress "weights"; + editorTemplate -suppress "uvSet"; + editorTemplate -suppress "tweak"; + editorTemplate -suppress "relativeTweak"; + editorTemplate -suppress "currentUVSet"; + editorTemplate -suppress "doubleSided"; + editorTemplate -suppress "opposite"; + editorTemplate -suppress "smoothShading"; + editorTemplate -suppress "featureDisplacement"; + editorTemplate -suppress "initialSampleRate"; + editorTemplate -suppress "textureThreshold"; + editorTemplate -suppress "normalThreshold"; + editorTemplate -suppress "extraSampleRate"; +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AETriggerVolumeNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AETriggerVolumeNodeTemplate.mel new file mode 100644 index 0000000..4166b0e --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AETriggerVolumeNodeTemplate.mel @@ -0,0 +1,18 @@ +global proc AETriggerVolumeNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Trigger Volume Attributes" -collapse 0; + AElocatorCommon $nodeName; + + editorTemplate -addControl "type"; + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEWBLocatorSuppress.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEWBLocatorSuppress.mel new file mode 100644 index 0000000..e9784d8 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEWBLocatorSuppress.mel @@ -0,0 +1,37 @@ +global proc AEWBLocatorSuppress( string $nodeName ) +{ + editorTemplate -suppress "inputTranslate"; + editorTemplate -suppress "input"; + editorTemplate -suppress "caching"; + editorTemplate -suppress "nodeState"; + editorTemplate -suppress "visibility"; + editorTemplate -suppress "intermediateObject"; + editorTemplate -suppress "template"; + editorTemplate -suppress "ghosting"; + editorTemplate -suppress "instObjGroups"; + editorTemplate -suppress "compInstObjGroups"; + editorTemplate -suppress "castsShadows"; + editorTemplate -suppress "receiveShadows"; + editorTemplate -suppress "depthJitter"; + editorTemplate -suppress "motionBlur"; + editorTemplate -suppress "renderInfo"; + editorTemplate -suppress "primaryVisibility"; + editorTemplate -suppress "visibleInReflections"; + editorTemplate -suppress "visibleInRefractions"; + editorTemplate -suppress "geometryAntialiasingOverride"; + editorTemplate -suppress "antialiasingLevel"; + editorTemplate -suppress "shadingSamplesOverride"; + editorTemplate -suppress "shadingSamples"; + editorTemplate -suppress "maxShadingSamples"; + editorTemplate -suppress "volumeSamplesOverride"; + editorTemplate -suppress "volumeSamples"; + editorTemplate -suppress "maxVisibilitySamplesOverride"; + editorTemplate -suppress "maxVisibilitySamples"; + editorTemplate -suppress "boundingBoxScale"; + editorTemplate -suppress "drawOverride"; + editorTemplate -suppress "useObjectColor"; + editorTemplate -suppress "objectColor"; + editorTemplate -suppress "intermediateObject"; + editorTemplate -suppress "visibility"; + editorTemplate -suppress "lodVisibility"; +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEWBSelectTarget.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEWBSelectTarget.mel new file mode 100644 index 0000000..d1cd428 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEWBSelectTarget.mel @@ -0,0 +1,34 @@ +global proc wb_BCB_SelectTarget( string $nodeName ) +{ + select $nodeName; + string $actNodes[] = `ls -sl -o`; + + string $text = `textField -q -text WBTargetName`; + + print ($text + "\n"); + + if ( $text != "" ) + { + evalEcho ("setAttr " + $actNodes[0] + ".target -type \"string\" \"" + $text + "\""); + } + + select $actNodes[0]; +} + +global proc AEWBTargetSelectNew( string $nodeName ) +{ + columnLayout -adj true; + + textField -ed true WBTargetName; + string $command = "wb_BCB_SelectTarget( \"" + $nodeName + "\" )"; + button -label "Select Target" -command $command WBSelectTargetButton; + + setParent ..; +} + +global proc AEWBTargetSelectReplace( string $nodeName ) +{ + textField -e -text "" WBTargetName; + string $command = "wb_BCB_SelectTarget( \"" + $nodeName + "\" )"; + button -e -command $command WBSelectTargetButton; +} diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEWBTriggerButton.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEWBTriggerButton.mel new file mode 100644 index 0000000..ddb862a --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEWBTriggerButton.mel @@ -0,0 +1,94 @@ +global int $gIsItVisibler = 0; + +global proc AEWBTriggerButtonNew( string $nodeName ) +{ + columnLayout -adj true; + + select $nodeName; + string $names[] = `ls -sl -o`; + + string $command = "wb_BCB_AttachTriggers(\"" + $names[0] + "\", 0)"; + + button -label "Attach Triggers" -command $command WBMakeTriggerButton; + + setParent ..; + + select $names[0]; +} + + +global proc AEWBTriggerButtonReplace( string $nodeName ) +{ + + select $nodeName; + string $names[] = `ls -sl -o`; + + string $command = "wb_BCB_AttachTriggers(\"" + $names[0] + "\", 0)"; + + button -e -command $command WBMakeTriggerButton; + + select $names[0]; +} + +global proc AEWBTriggerButtonNewOcclude( string $nodeName ) +{ + columnLayout -adj true; + + select $nodeName; + string $names[] = `ls -sl -o`; + + string $command = "wb_BCB_AttachTriggers(\"" + $names[0] + "\", 0)"; + + button -label "Add Occlusion Volume" -command $command WBMakeTriggerButton; + + setParent ..; + + select $names[0]; +} + +global proc AEWBTriggerButtonReplaceOcclude( string $nodeName ) +{ + select $nodeName; + string $names[] = `ls -sl -o`; + + string $command = "wb_BCB_AttachTriggers(\"" + $names[0] + "\", 0)"; + + button -e -command $command WBMakeTriggerButton; + + select $names[0]; +} + +global proc AEWBTriggerButtonNewVisible( string $nodeName ) +{ + columnLayout -adj true; + + select $nodeName; + string $names[] = `ls -sl -o`; + + string $command = "wb_BCB_AttachTriggers(\"" + $names[0] + "\", 1)"; + + button -label "Add Visibler Volume" -command $command WBMakeTriggerButton; + + setParent ..; + + select $names[0]; +} + +global proc AEWBTriggerButtonReplaceVisible( string $nodeName ) +{ + select $nodeName; + string $names[] = `ls -sl -o`; + + string $command = "wb_BCB_AttachTriggers(\"" + $names[0] + "\", 1)"; + + button -e -command $command WBMakeTriggerButton; + + select $names[0]; +} + +global proc int IsVisibler() +{ + global int $gIsItVisibler; + + return $gIsItVisibler; +} diff --git a/tools/MayaTools/Maya4.0/scripts/AETemplates/AEZoneEventLocatorNodeTemplate.mel b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEZoneEventLocatorNodeTemplate.mel new file mode 100644 index 0000000..869066a --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/AETemplates/AEZoneEventLocatorNodeTemplate.mel @@ -0,0 +1,28 @@ +global proc AEZoneEventLocatorNodeTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -beginLayout "Locator Attributes" -collapse 0; + AElocatorCommon $nodeName; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Zone Attribute" -collapse false; + editorTemplate -addControl "zone"; + editorTemplate -endLayout; + + editorTemplate -beginLayout "Triggers" -collapse 0; + + editorTemplate -callCustom "AEWBTriggerButtonNew" + "AEWBTriggerButtonReplace" + "message"; + + editorTemplate -endLayout; + + editorTemplate -addExtraControls; + + editorTemplate -endScrollLayout; + + AEWBLocatorSuppress( $nodeName ); +} +
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/ajrAutoSave.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/ajrAutoSave.mel new file mode 100644 index 0000000..d3f7f0d --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/ajrAutoSave.mel @@ -0,0 +1,532 @@ +/* This file downloaded from Highend3d.com +'' +'' Highend3d.com File Information: +'' +'' Script Name: ajrAutoSave v1.3 +'' Author: Andy Rawling +'' Last Updated: July 17, 2001 +'' Update/Change this file at: +'' http://www.highend3d.com/maya/mel/?section=utilities#198 +'' +'' Please do not alter any information above this line +'' it is generated dynamically by Highend3d.com and will +'' be changed automatically on any updates. +*/ + +// ajrAutoSave.mel +// v 1.3 July 16 2001 +// +// Tested on Maya2.5Irix Maya2.5.1NT Maya3.0Irix +// +// Provides automatic backup of scene files. +// +// When this script is first called, it creates two MEL scriptJobs to run +// short procedures whenever the user selects or de-selects an object, and +// when they change the current time. These jobs trigger backups in two +// ways, either based on the number of times the user selects objects, or +// on the amount of time since the last save. +// The script also modifies your main File menu, adding File->Autosave options... +// to the end. Choosing this menu command brings up the configuration GUI +// (by running the same script again, but that's not important right now). +// +// In selection mode, the script keeps a count of how many times the selection +// has changed, and will trigger an automatic scene backup when the number of +// selection changes passes the limit set by the user. +// +// In time mode, the script checks the time whenever the selection or the +// current time is changed by the user. The scene is backed up when the amount +// of time since the last save passes the limit +// +// This script is designed to be called from your 'userSetup.mel' script. +// +// Configuration +// ------------- +// If the script is run again, it will bring up a GUI which allows you to +// modify the way that AutoSave works. The options are: +// o Enable AutoSave +// o Save After XX minutes/selects +// o Keep up to XX backups +// o Save in XX +// o notify when saving +// +// +// Enable AutoSave: Check this option off to disable AutoSave (default=ON) +// Save After XX (things): Set the number of things which happen before the +// autosave is triggered - either the user changing which items are +// selected, or the number of minutes since the last save (default=15) +// (minutes/selects): What sort of things are we using to spot changes? Either +// number of times the selection changes, or number of minutes +// passed since the last save (default=minutes , but see the caveats +// below) +// Keep up to XX backups: AutoSave keeps a rolling sequence of backups. The +// number of separate backups can be changed here +// (default=5) +// Save in XXXX: Choose the folder where you want the backups to be kept. +// This can be relative to your current project (default="scenes") +// notify when saving: Bring up a small window to tell you when a backup is being +// made (default=OFF) +// +// +// Caveats +// ------- +// Maya has no clock event, so when the save is time-based the clock is only +// checked when the selection or the current time (as in time slider) changes. +// +// Changes (* is a highend3d release) +// ------- +// v1.3* Autosaving no longer clears the current tool - cheers to Roger Klado +// Feedback line is now more informative as the GUI settings are changed. +// v1.2 I've got M3.0, so here there are annotations all over the GUI. Removed +// the 'Include in File menu` option from the GUI - it's always included +// now. Notify defaults to off now (too many hardware render mess-ups) +// v1.1 Layout is more Irix/Motif-friendly now (was a bit squashed) +// v1.0* Fixed minor bug when the scene wasn't saved, choosing not to save +// would switch the autosave off. New behavior is to nag the user again +// after the trigger period. Now uses a timer as well as selection counter +// to trigger backups. +// +// Disclaimer +// ---------- +// This script is unsupported; neither me nor (especially) my employer accept +// liability for damage or loss resulting from its use or misuse. Use it at +// your own risk. That said - if you like it, spot a bug in it or think it +// could be improved please let me know. +// +// Andy Rawling andrew.rawling@_CUT_THIS_BIT_OUT_bigfoot.com +// Animator +// + +global proc ajrAS_SelectionHasChanged() { +// This is called even when AutoSave is disabled, it just doesn't perform the save in this case +// We're checking for time passing as well as selection changes here! + + if((`optionVar -exists "ajrAS_iSelectTrigger"`) && (`optionVar -exists "ajrAS_iEnabled"`) && (`optionVar -exists "ajrAS_iUseTime"`)) { + + if((`optionVar -query "ajrAS_iUseTime"`)) { + // We're using time to trigger saves + global float $ajrAS_fLastSave; //Absolute time of the last save (or script startup) + float $fElapsed; + + $fElapsed = `timerX -startTime $ajrAS_fLastSave`; + if(($fElapsed / 60.0) > `optionVar -query "ajrAS_iSelectTrigger"`) { + if(`optionVar -query "ajrAS_iEnabled"`) + if (`ajrAS_SaveBackupScene`) + $ajrAS_fLastSave = `timerX`; + } + } else { + // Using the number of selection changes to trigger + global int $ajrAS_iSelectCount; // The selection change counter + + $ajrAS_iSelectCount ++; + if ($ajrAS_iSelectCount >= `optionVar -query "ajrAS_iSelectTrigger"`) { + if(`optionVar -query "ajrAS_iEnabled"`) + if (`ajrAS_SaveBackupScene`) + $ajrAS_iSelectCount = 0; + } + } + } +} + +global proc ajrAS_CurrentTimeHasChanged() { +// This is called even when AutoSave is disabled, it just doesn't perform the save in this case +// We're only interested in time passing here + + if((`optionVar -exists "ajrAS_iSelectTrigger"`) && (`optionVar -exists "ajrAS_iEnabled"`)) { + + if((`optionVar -query "ajrAS_iUseTime"`)) { + global float $ajrAS_fLastSave; //Absolute time of the last save (or script startup) + float $fElapsed; + + $fElapsed = `timerX -startTime $ajrAS_fLastSave`; + if(($fElapsed / 60.0) > `optionVar -query "ajrAS_iSelectTrigger"`) { + if(`optionVar -query "ajrAS_iEnabled"`) + if (`ajrAS_SaveBackupScene`) + $ajrAS_fLastSave = `timerX`; + } + } + } +} + +global proc int ajrAS_SaveBackupScene() { +// Save the backup file +// This routine is called when the number of events reaches the level set by the user +// to trigger a backup save. +// The save routine appends "_AutoSave#1" to the scene name of the first backup, then +// #2, #3 etc, until the number of saves reaches the maximum limit, when the number +// resets to 1 again. +// If the notifier is switched on, a message window is created for the duration of the\ +// save. Either way, a message is shown on the command feedback line +// + global int $ajrAS_iBackupNumber; // Number of the current backup file + string $sSceneName; // Full name (including directory path) of the scene file + string $sBackupName; // Name (not inc. path or extension) of the backup scene + string $sBackupDir; + string $sWorkingTool; + int $iReturn = 0; + + // If these values are not in the prefs, then this function should never have been called. Check anyway. + if((`optionVar -exists "ajrAS_iSaveCopies"`) && (`optionVar -exists "ajrAS_iNotify"`) && (`optionVar -exists "ajrAS_sBackupDir"`)) { + + $sSceneName = `file -query -sceneName`; + // If the scene has no name (hasn't been saved yet) then prompt to do a "Save As" + if($sSceneName == "") { + string $sReturn = `confirmDialog -title "AutoSave" + -message "This scene has not been saved.\nAutoSave will not back up an unsaved scene\n\nDo you want to save your scene now?" + -button "Yes" + -button "No" + -button "Configure" + -defaultButton "Yes" + -cancelButton "No" + -dismissString "No"`; + switch($sReturn) { + + case "Configure": + ajrAS_GUI; + break; + + case "Yes": + projectViewer("SaveAs"); + break; + + case "No": + // Reset the event counter + // The user will be nagged again shortly + $iReturn = 1; + break; + } + } else { + $sBackupDir = `optionVar -query "ajrAS_sBackupDir"`; + if (`file -query -exists $sBackupDir`) { + $sWorkingTool = `currentCtx`; + $sBackupName = (`optionVar -query "ajrAS_sBackupDir"` + "/" + `file -query -namespace` + "_AutoSave#" + $ajrAS_iBackupNumber); + if(`optionVar -query "ajrAS_iNotify"`) + ajrAS_MakeNotifyWindow($sBackupName); + print("Auto saving file: " + $sBackupName + ".\n"); + file -rename $sBackupName; + file -save -type mayaBinary -defaultExtensions true; + $iReturn = 1; + file -rename $sSceneName; + $ajrAS_iBackupNumber ++; + if ($ajrAS_iBackupNumber > `optionVar -query "ajrAS_iSaveCopies"`) + $ajrAS_iBackupNumber = 1; + if(`optionVar -query "ajrAS_iNotify"`) { + deleteUI ui_ajrAS_NotifyWindow; + } + setToolTo $sWorkingTool; + } else { + ajrAS_CheckBackupDir; + } + } + } + return ($iReturn); +} + +global proc ajrAS_MakeNotifyWindow(string $sFileName) { + + if (`window -exists ui_ajrAS_NotifyWindow`) + deleteUI ui_ajrAS_NotifyWindow; + + window -title ("Saving backup: " + $sFileName + ", please wait...") + -iconName "Saving" + -widthHeight 500 25 + -menuBar false + ui_ajrAS_NotifyWindow; + + showWindow ui_ajrAS_NotifyWindow; +} + +global proc ajrAS_Reset() { +// Reset GUI fields & prefs to defaults. + checkBox -edit -value on ui_ajrAS_iEnabled; + intField -edit -value 15 ui_ajrAS_iSelectTrigger; + optionMenu -edit -select 2 ui_ajrAS_type; + intField -edit -value 5 ui_ajrAS_iSaveCopies; + checkBox -edit -value on ui_ajrAS_iNotify; + textField -edit -fileName "scenes" ui_ajrAS_sBackupDir; + ajrAS_Update; + $ajrAS_iSelectCount = 0; +} + +global proc ajrAS_Update() { +// Update the prefs settings + optionVar -intValue "ajrAS_iEnabled" `checkBox -query -value ui_ajrAS_iEnabled`; + optionVar -intValue "ajrAS_iSelectTrigger" `intField -query -value ui_ajrAS_iSelectTrigger`; + optionVar -intValue "ajrAS_iUseTime" (`optionMenu -query -value ui_ajrAS_type` == "minutes"); + optionVar -intValue "ajrAS_iSaveCopies" `intField -query -value ui_ajrAS_iSaveCopies`; + optionVar -intValue "ajrAS_iNotify" `checkBox -query -value ui_ajrAS_iNotify`; + optionVar -stringValue "ajrAS_sBackupDir" `textField -query -fileName ui_ajrAS_sBackupDir`; + string $sReportStr = "AutoSave: "; + if(! `optionVar -query "ajrAS_iEnabled"`) + $sReportStr += ("disabled.\n"); + else { + ajrAS_SelectionHasChanged; + ajrAS_CheckBackupDir; + $sReportStr += ("every " + `optionVar -query "ajrAS_iSelectTrigger"` + " "); + if((`optionVar -query "ajrAS_iUseTime"`)) { + global float $ajrAS_fLastSave; //Absolute time of the last save (or script startup) + $sReportStr += ("minutes (next in "); + $sReportStr += ((int)(`optionVar -query "ajrAS_iSelectTrigger"` - (`timerX -startTime $ajrAS_fLastSave` / 60.0)) + "), "); + } else { + global int $ajrAS_iSelectCount; // The selection change counter + $sReportStr += ("selects (next in "); + $sReportStr += ((`optionVar -query "ajrAS_iSelectTrigger"` - ($ajrAS_iSelectCount)) + "), "); + } + $sReportStr += ("keep " + `optionVar -query "ajrAS_iSaveCopies"` + " copies in " + `optionVar -query "ajrAS_sBackupDir"` + ".\n"); + } + print $sReportStr; +} + +global proc int ajrAS_SetBackupDir(string $sDirName, string $sDirType) { +// Callback function for 'fileBrowser' call on backup directory chooser + textField -edit -fileName `workspace -projectPath $sDirName` ui_ajrAS_sBackupDir; + ajrAS_Update; + return true; +} + +global proc int ajrAS_CheckBackupDir() { +// Check that the backup location is valid +// If not, give the option of creating the backup directory, changing the location +// or just carrying on (in which cast the save doesn't happen) + string $sBackupDir; + int $iReturn; + + $sBackupDir = `optionVar -query "ajrAS_sBackupDir"`; + if (! `file -query -exists $sBackupDir`) { + string $sQuestion; + string $sAnswer; + $sQuestion = "Your backup folder, (" + $sBackupDir + ") doesn't exist.\n" + + "Would you like to create this folder, or use select a new location?\n" + + "\n" + + "(If you choose to do neither, saving will be disabled)"; + + $sAnswer = `confirmDialog -title "AutoSave" + -message $sQuestion + -button "Create" + -button "Re-Select" + -button "Forget it" + -defaultButton "Re-Select" + -cancelButton "Forget It" + -dismissString "Forget It"`; + + switch($sAnswer) { + case "Create": + // Try to create the folder (no return value to check success) + workspace -create `workspace -expandName $sBackupDir`; + // Call this procedure again to see if it worked + ajrAS_CheckBackupDir; + break; + case "Re-Select": + optionVar -stringValue "ajrAS_sBackupDir" "scenes"; + if (`window -exists ui_ajrAS`) + textField -edit -fileName "scenes" ui_ajrAS_sBackupDir; + else + ajrAS_GUI; + break; + default: + if (`window -exists ui_ajrAS`) + checkBox -edit -value off ui_ajrAS_iEnabled; + optionVar -intValue "ajrAS_iEnabled" off; + $iReturn = 0; + break; + } + + } else + $iReturn = 1; + + return $iReturn; +} + +global proc ajrAS_FileMenu() { +// Add or remove the AutoSave item from the main File menu + global string $gMainFileMenu; // Name of Maya 'File' menu + + if(`menuItem -exists ui_ajrAS_FileAutoSaveSeperator`) + deleteUI ui_ajrAS_FileAutoSaveSeperator; + if(`menuItem -exists ui_ajrAS_FileAutoSaveMenu`) + deleteUI ui_ajrAS_FileAutoSaveMenu; + + menuItem -parent $gMainFileMenu + -divider true + ui_ajrAS_FileAutoSaveSeperator; + menuItem -parent $gMainFileMenu + -label "Auto Save options..." + -annotation "Auto Save: Configure automatic backups" + -command "ajrAutoSave" + ui_ajrAS_FileAutoSaveMenu; +} + +global proc ajrAS_GUI() { +// Call up the GUI + if (`window -exists ui_ajrAS`) + deleteUI ui_ajrAS; + + window -title "AutoSave v1.3" + -iconName "AutoSave" + -widthHeight 280 300 + -menuBar false + ui_ajrAS; + + formLayout ui_ajrAS_mainForm; + + frameLayout -borderStyle "in" + -labelVisible false + ui_ajrAS_mainFrame; + + scrollLayout -childResizable true + -verticalScrollBarThickness 10 + -horizontalScrollBarThickness 0; + + columnLayout -adjustableColumn true + -cal "left"; + + frameLayout -labelVisible false + -borderStyle "etchedIn" + -manage true; + + columnLayout -adjustableColumn true + -columnOffset "left" 30 + -columnAlign "left"; + + checkBox -label "Enable AutoSave" + -value `optionVar -query ajrAS_iEnabled` + -onCommand "ajrAS_Update" + -offCommand "ajrAS_Update; $ajrAS_iSelectCount = 0;" + -annotation "Enable: Switch the autosave feature on/off" + ui_ajrAS_iEnabled; + + setParent ..; + setParent ..; + + frameLayout -label "Options" + -borderStyle "etchedIn" + ui_ajrAS_optionsFrame; + + columnLayout -adjustableColumn true + -columnOffset "left" 30 + -columnAlign "left"; + + rowColumnLayout -numberOfColumns 3 + -columnWidth 1 70 + -columnWidth 2 40 + -columnWidth 3 100; + + text "Save after"; + intField -value `optionVar -query ajrAS_iSelectTrigger` + -width 35 + -changeCommand "ajrAS_Update" + -annotation "Save after: Good values are 200 for selects, 30 for minutes" + ui_ajrAS_iSelectTrigger; + optionMenu ui_ajrAS_type; + menuItem -label "selects"; + menuItem -label "minutes"; + optionMenu -edit + -changeCommand "ajrAS_Update" + -annotation "Save after: Will you make backups as the minutes pass, or as you pick objects" + -select (`optionVar -query ajrAS_iUseTime` + 1) + ui_ajrAS_type; + + text "Keep up to"; + intField -value `optionVar -query ajrAS_iSaveCopies` + -annotation "Keep up to: How many rolling copies do you want to keep" + -width 35 + -changeCommand "ajrAS_Update" + ui_ajrAS_iSaveCopies; + text " backups"; + + setParent ..; + + rowLayout -numberOfColumns 3 + -columnWidth3 70 100 50 + -columnAttach3 "left" "left" "left" + -columnOffset3 0 0 5 + -adjustableColumn 2; + + text -label "Save in"; + textField -fileName `optionVar -query ajrAS_sBackupDir` + -width 90 + -changeCommand "ajrAS_Update" + -annotation "Save in: Path to your backup folder (can be relative to your project)" + ui_ajrAS_sBackupDir; + symbolButton -image "navButtonBrowse.xpm" + -annotation "Save in: Browse for the backup folder" + -command "fileBrowser(\"ajrAS_SetBackupDir\",\"AutoSave\", \"folder\", 4);" + browser; + setParent ..; + + checkBox -label "notify when saving" + -annotation "Notify: Pop up an window when saving (may interfere with hardware rendering)" + -value `optionVar -query ajrAS_iNotify` + -onCommand "ajrAS_Update" + -offCommand "ajrAS_Update" + ui_ajrAS_iNotify; + + setParent ..; + + setParent ..; + + setParent ..; + setParent ..; + setParent ..; + + button -label "Close" + -command "ajrAS_Update; deleteUI ui_ajrAS" + ui_ajrAS_close; + + button -label "Reset" + -command "ajrAS_Reset" + ui_ajrAS_reset; + + formLayout -edit + -attachForm ui_ajrAS_mainFrame "left" 5 + -attachForm ui_ajrAS_mainFrame "right" 5 + -attachForm ui_ajrAS_mainFrame "top" 5 + -attachForm ui_ajrAS_mainFrame "bottom" 35 + + -attachPosition ui_ajrAS_reset "left" 2 50 + -attachForm ui_ajrAS_reset "right" 5 + -attachNone ui_ajrAS_reset "top" + -attachForm ui_ajrAS_reset "bottom" 5 + + -attachForm ui_ajrAS_close "left" 5 + -attachPosition ui_ajrAS_close "right" 2 50 + -attachNone ui_ajrAS_close "top" + -attachForm ui_ajrAS_close "bottom" 5 + + ui_ajrAS_mainForm; + + showWindow ui_ajrAS; +} + +global proc ajrAutoSave() { +// Called when Maya starts up, and when the user wants to change settings. +// If the selection script job can't be found, then assume it's startup time & just +// silently go into the preferred state; otherwise bring up the GUI + global int $ajrAS_iTimeJobNo; // The number of the time change script job + global int $ajrAS_iSelJobNo; // The number of the select change script job + global int $ajrAS_iBackupNumber; + global float $ajrAS_fLastSave; // Time of the last save, or script launch + + // If these values are not in the prefs, then set them to the defaults + if(! `optionVar -exists "ajrAS_iEnabled"`) + optionVar -intValue "ajrAS_iEnabled" off; + if(! `optionVar -exists "ajrAS_iSelectTrigger"`) + optionVar -intValue "ajrAS_iSelectTrigger" 15; + if(! `optionVar -exists "ajrAS_iUseTime"`) + optionVar -intValue "ajrAS_iUseTime" on; + if(! `optionVar -exists "ajrAS_iSaveCopies"`) + optionVar -intValue "ajrAS_iSaveCopies" 5; + if(! `optionVar -exists "ajrAS_iNotify"`) + optionVar -intValue "ajrAS_iNotify" off; + if(! `optionVar -exists "ajrAS_sBackupDir"`) + optionVar -stringValue "ajrAS_sBackupDir" "scenes"; + + if ($ajrAS_iSelJobNo != 0) + ajrAS_GUI; + else { + $ajrAS_iBackupNumber = 1; + $ajrAS_fLastSave = `timerX`; + ajrAS_FileMenu; + $ajrAS_iTimeJobNo = `scriptJob -event timeChanged ajrAS_CurrentTimeHasChanged`; + $ajrAS_iSelJobNo = `scriptJob -event SelectionChanged ajrAS_SelectionHasChanged`; + } +} diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/copyToInst.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/copyToInst.mel new file mode 100644 index 0000000..36fd6f4 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/copyToInst.mel @@ -0,0 +1,302 @@ +// copyToInst.mel +// Copy to Instance +// Alias|Wavefront Script File +// +// Creation Date: 24 Jan. 2001 +// Author: (Novy) Gurdarshan Dhillon +// +// +// +// Description: +// Copy to Instance +// Changes duplicated objects to instanced objects +// The user picks the original object and the list of duplicated +// objects. +// +// Additional Features: +// +// Additional Files needed: +// +// Input Arguments: +// None. +// Return Values: +// None. +// copyToInst +// + +global proc copyToInst() +{ + global string $copyToInst_orig; + global string $copyToInst_new; + global string $copyToInst_dup; + global string $copyToInst_origButton; + global string $copyToInst_newButton; + global string $copyToInst_dupButton; + global string $copyToInst_check; + global string $copyToInst_InstDup; + global string $copyToInst_dupName; + if (`window -exists copyToInst`) + { + deleteUI -window copyToInst; + } + window -title "Copy to Instance" -rtf true -w 590 -h 400 -sizeable true copyToInst; + scrollLayout scrollLayout; + columnLayout -rs 5; + rowColumnLayout -nc 4 -columnWidth 1 80 -columnWidth 2 200 -columnWidth 3 80 -columnWidth 4 200; + columnLayout -cw 80 -cat "left" 5; + $copyToInst_origButton = `button -label "Add Original" -w 75 -en 1 -command "CTI_addOrig"`; + $copyToInst_newButton = `button -label "Add New" -w 75 -en 0 -command "CTI_addNew"`; + text -l ""; + $copyToInst_dupName = `checkBox -label "Get Dup" -v 0`; + $copyToInst_check = `checkBox -label "Set Pivots" -v 1`; + $copyToInst_InstDup = `checkBox -label "Instance" -v 1`; + text -l "off : Duplicate"; + text -l "on : Instance"; + setParent ..; + columnLayout -cw 200 -cat "left" 0; + $copyToInst_orig = `textField -ed 0 -w 200 orig`; + $copyToInst_new = `textField -ed 0 -w 200 new`; + setParent ..; + rowLayout -w 80 -h 50 -nc 1 -cl1 "center";; + $copyToInst_dupButton = `button -label "Add Duplicates" -w 80 -en 0 -command "CTI_addDup"`; + setParent ..; + rowLayout -w 200 -h 300 -nc 1 -cl1 "center";; + $copyToInst_dup = `textScrollList -w 200 -h 300 dup`; + setParent ..; + setParent ..; + columnLayout -w 560 -h 100 -cat "left" 5; + button -label "Create" -w 550 -en 1 -command "CTI_create"; + setParent ..; + setParent ..; + setParent ..; + window -edit -w 590 -h 400 copyToInst; + showWindow; +} + +global proc CTI_addOrig() +{ + global string $copyToInst_orig; + global string $copyToInst_dup; + global string $copyToInst_origButton; + global string $copyToInst_newButton; + global string $copyToInst_dupButton; + + string $object[]; + int $numDup; + int $index; + + clear($object); + $object = `ls -sl -tr`; + textField -edit -tx $object[0] $copyToInst_orig; + button -edit -en 1 $copyToInst_newButton; + $numDup = `textScrollList -q -ni $copyToInst_dup`; + textScrollList -edit -removeAll $copyToInst_dup; +} + +global proc CTI_addNew() +{ + global string $copyToInst_new; + global string $copyToInst_dup; + global string $copyToInst_origButton; + global string $copyToInst_newButton; + global string $copyToInst_dupButton; + + string $object[]; + int $numDup; + int $index; + + clear($object); + + $object = `ls -sl -tr`; + textField -edit -tx $object[0] $copyToInst_new; + button -edit -en 1 $copyToInst_dupButton; +} + +global proc CTI_addDup() +{ + global string $copyToInst_orig; + global string $copyToInst_new; + global string $copyToInst_dup; + global string $copyToInst_dupName; + + string $object[]; + string $original; + string $new; + int $index; + textScrollList -edit -removeAll $copyToInst_dup; + clear($object); + if (`checkBox -q -v $copyToInst_dupName`) + { selectInstance `textField -q -tx $copyToInst_orig`;} + $object = `ls -sl -tr`; + $original = `textField -query -tx $copyToInst_orig`; + $new = `textField -query -tx $copyToInst_new`; + for ($index=0; $index < size($object); $index++) + { + if($object[$index]!=$original && $object[$index]!=$new) + { + textScrollList -edit -append $object[$index] $copyToInst_dup; + } + } + select -clear; +} + +global proc CTI_create() +{ + global string $copyToInst_orig; + global string $copyToInst_new; + global string $copyToInst_dup; + global string $copyToInst_check; + global string $copyToInst_InstDup; + string $objects[]; + string $inst[]; + string $inst_new[]; + string $new; + string $original; + string $attr; + string $attr2; + float $orig_pivot[]; + float $new_pivot[]; + float $orig_trans[]; + float $new_trans[]; + float $trans[]; + + float $orig_scale_pivot[]; + float $new_scale_pivot[]; + float $orig_scale[]; + float $new_scale[]; + float $scale[]; + + float $orig_rot[]; + float $orig_rotx; + float $orig_roty; + float $orig_rotz; + float $rot[]; + float $x; + float $y; + float $z; + int $index; + int $numObj; + + clear($objects); clear($trans); clear($rot); clear($inst); clear($inst_new); + clear($orig_pivot); clear($new_pivot); clear($orig_trans); clear($new_trans); + + $original = `textField -query -tx $copyToInst_orig`; + $new = `textField -query -tx $copyToInst_new`; + $objects = `textScrollList -q -allItems $copyToInst_dup`; + $numObj = size($objects); + if(`checkBox -q -v $copyToInst_check` == 1) + { + $orig_pivot = `xform -q -rp $original`; + $new_pivot = `xform -q -rp $new`; + $orig_trans = `xform -q -t $original`; + $new_trans = `xform -q -t $new`; + + $orig_scale_pivot = `xform -q -sp $original`; + $new_scale_pivot = `xform -q -sp $new`; + $orig_scale = `xform -q -s $original`; + $new_scale = `xform -q -s $new`; + + $orig_rot = `xform -q -ro $original`; + $orig_rotx = $orig_rot[0]; + $orig_roty = $orig_rot[1]; + $orig_rotz = $orig_rot[2]; +// print $orig_trans; +// print "---------\n"; +// print $new_trans; +// print "---------\n"; + } + else + { + $orig_pivot[0] = 0; $orig_pivot[1] = 0; $orig_pivot[2] = 0; + $new_pivot[0] = 0; $new_pivot[1] = 0; $new_pivot[2] = 0; + $orig_trans[0] = 0; $orig_trans[1] = 0; $orig_trans[2] = 0; + $new_trans[0] = 0; $new_trans[1] = 0; $new_trans[2] = 0; + $orig_scale_pivot[0] = 0; $orig_scale_pivot[1] = 0; $orig_scale_pivot[2] = 0; + $new_scale_pivot[0] = 0; $new_scale_pivot[1] = 0; $new_scale_pivot[2] = 0; + $orig_scale[0] = 0; $orig_scale[1] = 0; $orig_scale[2] = 0; + $new_scale[0] = 0; $new_scale[1] = 0; $new_scale[2] = 0; + $orig_rotx = 0; + $orig_roty = 0; + $orig_rotz = 0; + } + for($index=0; $index<$numObj; $index++) + { + clear($inst); + $attr = $objects[$index] + ".translate"; + $trans = `xform -ws -q -rp $objects[$index]`; + $attr = $objects[$index] + ".rotate"; + $rot = `getAttr $attr`; + $attr = $objects[$index] + ".scale"; + $scale = `getAttr $attr`; + if(`checkBox -q -v $copyToInst_InstDup`) + { $inst = `instance $new`;} + else + { $inst = `duplicate $new`;} + + $x = $trans[0] - $new_pivot[0]; + $y = $trans[1] - $new_pivot[1]; + $z = $trans[2] - $new_pivot[2]; + xform -ws -t $x $y $z $inst[0]; + + $x = $rot[0] - $orig_rotx ; + $y = $rot[1] - $orig_roty; + $z = $rot[2] - $orig_rotz; + xform -a -ro $x $y $z $inst[0]; + + $x = $scale[0]; + $y = $scale[1]; + $z = $scale[2]; + xform -ws -s $x $y $z $inst[0]; + // $inst[0] = `rename $inst[0] $objects[$index]`; + $inst_new[$index] = $inst[0]; + } + if(`checkBox -q -v $copyToInst_InstDup`==0) + { + for($obj in $inst_new) + { + string $newName = $obj + "Shape"; + string $shape[] = `pickWalk -d "down" $obj`; + rename $shape[0] $newName; + } + } + if (size($new)>0) + { + group -n "inst" $inst_new; + } +} + +global proc selectInstance(string $origObject) +{ + string $orig[]; + clear($orig); + $orig[0] = $origObject; + select -r $origObject; + string $origShape[]; + clear($origShape); + $origShape = `ls -sl -dag -lf`; + string $token[]; + clear($token); + int $numTok; + $numTok = `tokenize $origShape[0] "|" $token`; +// string $select[]; +// clear($select); + int $index; +// int $count; +// $count = 0; +// if(`strcmp $orig[0] $token[0]`!=0) +// { error "No Original Geometry Selected!!";} +// else + { + string $objects[]= `ls -tr`; + for($object in $objects) + { + string $objShape[] = `ls -dag -lf $object`; + if(`strcmp $origShape[0] $objShape[0]` == 0) + { + select -add $object; + // $select[$count] = $object; + // $count++; + } + } + } +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/forceTexture.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/forceTexture.mel new file mode 100644 index 0000000..74541f9 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/forceTexture.mel @@ -0,0 +1,44 @@ +global proc forceTexture () +{ + for ($shader in `ls -mat`) + { + if($shader == "lambert1") + { + continue; + } + if($shader == "particleCloud1") + { + continue; + } + + string $connections[] = `listConnections ($shader + ".color")`; + if(size($connections) > 0) + { + print ("Ignoring " + $shader + " since it already has a map...\n"); + continue; + } + print ("Processing " + $shader + "\n"); + float $colour[] = `getAttr ($shader + ".color")`; + int $colourR = $colour[0] * 255; + int $colourG = $colour[1] * 255; + int $colourB = $colour[2] * 255; + string $mapname = "R" + $colourR + "G" + $colourG + "B" + $colourB; + print ("Mapname " + $mapname+ "\n" ); + + shadingNode -asTexture ramp -name $mapname; + setAttr ($mapname +".colorEntryList[0].color") -type double3 $colour[0] $colour[1] $colour[2]; + setAttr ($mapname +".colorEntryList[1].color") -type double3 $colour[0] $colour[1] $colour[2]; + setAttr ($mapname +".colorEntryList[2].color") -type double3 $colour[0] $colour[1] $colour[2]; + connectAttr ($mapname + ".outColor") ($shader + ".color"); + if(`nodeType $shader` == "p3dSimpleShader") + { + setAttr ($shader +".proceduralXRes") 1; + setAttr ($shader +".proceduralYRes") 1; + }else + if(`nodeType $shader` == "lambert") + { + setAttr ($shader +".p3dProceduralTexXRes") 4; + setAttr ($shader +".p3dProceduralTexYRes") 4; + } + } +} diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/forceUniqueNames.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/forceUniqueNames.mel new file mode 100644 index 0000000..c939c2d --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/forceUniqueNames.mel @@ -0,0 +1,381 @@ +//=========================================================================== +// Copyright ©2002 Radical Entertainment Ltd. All rights reserved. +// +// Created: 26 March, 2002 +// +// Description: Forces unique names for all nodes in the scene, and ensures +// that each Shape node derives its name (and numerical suffix) +// from its Transform. +// +// Constraints: +// +// Creator: Bryan Ewert +// +//=========================================================================== + +//=========================================================================== +// version +//=========================================================================== +// Description: Returns the current version for this MEL script. +// Used for version control. +// +// Constraints: +// +//=========================================================================== +proc float version() +{ + return ( 1.1 ); // 01 May 2002 +} + +//=========================================================================== +// depth +//=========================================================================== +// Description: Determines the depth of the specified DAG; e.g. the depth +// for "|group1|transform2|transformShape2" is 3. +// +// Constraints: +// +// Parameters: string $node: The full path to the node. +// +// Return: (int): The depth of the path. +// +//=========================================================================== +proc int depth( string $node ) +{ + int $depth = 0; + + if ( `objExists $node` ) + { + string $longA[] = `ls -l $node`; + + string $tokens[]; + $depth = `tokenize $longA[0] "|" $tokens`; + } + + return $depth; +} + +//=========================================================================== +// nameNoPath +//=========================================================================== +// Description: Returns the short name for the specified node. +// "|group1|transform2|transformShape2" would return +// "transformShape2" +// +// Constraints: The pathless name may not be unique, and may not be +// sufficient for Maya to resolve the DAG! This name is +// intended for use in a rename operation, and not for +// performing edit operations on the object. +// +// Parameters: string $node: The full path to the node. +// +// Return: (string): The short path for the node. +// +//=========================================================================== +proc string nameNoPath( string $node ) +{ + return `match "[^|]*$" $node`; +} + +//=========================================================================== +// isUnique +//=========================================================================== +// Description: Determines if the specified node has a unique name. +// +// Constraints: +// +// Parameters: string $node: Name of the node (may be full path, may not). +// +// Return: (int): TRUE (non-zero) if name is unique; else FALSE (zero). +// +//=========================================================================== +proc int isUnique( string $node ) +{ + int $isUnique = true; + + string $noPath = nameNoPath( $node ); + string $wildcard = ( "*" + $noPath ); + string $potentials[] = `ls $wildcard`; + + int $numMatches = 0; + for ( $p in $potentials ) + { + string $tokens[]; + int $numTokens = `tokenize $p "|" $tokens`; + if ( $tokens[$numTokens-1] == $noPath ) + { + $numMatches++; + } + } + + $isUnique = ( $numMatches < 2 ); + + return $isUnique; +} + +//=========================================================================== +// getUniqueName +//=========================================================================== +// Description: Builds a unique name for the specified node by generating +// a numerical suffix for the node. An existing numerical +// suffix is stripped and replaced if the node's name is not +// already unique. +// +// Constraints: The returned name does _not_ contain a path and may not be +// sufficient for Maya to resolve the DAG! This name is +// intended for use in a rename operation, and not for +// performing edit operations on the object. +// +// Parameters: string $node: The full path to the node. +// +// Return: (string): A unique name for the node. +// +//=========================================================================== +proc string getUniqueName( string $node ) +{ + string $shortNode = nameNoPath( $node ); + string $unique = $shortNode; + + if ( !isUnique( $shortNode ) ) + { + // strip numeric suffix + string $suffix = `match "[0-9]*$" $shortNode`; + int $sizeShortNode = `size $shortNode`; + int $sizeSuffix = `size $suffix`; + $shortNode = `substring $shortNode 1 ( $sizeShortNode - $sizeSuffix )`; + + if ( !`objExists $shortNode` ) + { + $unique = $shortNode; + } + else + { + string $newNode; + int $u = 1; + do + { + $newNode = ( $shortNode + ($u++) ); + } while ( `objExists $newNode` ); + + $unique = $newNode; + } + } + + return $unique; +} + +//=========================================================================== +// getShape +//=========================================================================== +// Description: Returns the shape node, if any, for the specified transform. +// +// Constraints: Considers only a single shape. +// +// Parameters: string $xform: The transform node. +// +// Return: (string): The shape node. +// +//=========================================================================== +proc string getShape( string $xform ) +{ + string $shapes[]; + + $shapes[0] = $xform; + + string $isTransform[] = `ls -transforms $xform`; + + if ( `size $isTransform` > 0 ) + // If given node is not a transform, assume it is a shape + // and pass it through + { + $shapes = `listRelatives -fullPath -shapes $xform`; + } + + return $shapes[0]; +} + +//=========================================================================== +// getShapeName +//=========================================================================== +// Description: Derives a name for the shape node given the specified +// transform name. For example if the $node specified is +// "pCube23" the shape name will be "pCubeShape23". +// +// Constraints: No checking is done to verify that $node is a transform. +// +// Parameters: string $node: The name for the transform node. +// +// Return: (string): The name for the shape node. +// +//=========================================================================== +proc string getShapeName( string $node ) +{ + string $numeric = `match "[0-9]+$" $node`; + + int $strlen = `size $node`; + int $numlen = `size $numeric`; + string $alpha = `substring $node 1 ( $strlen - $numlen )`; + + string $shapeName = ( $alpha + "Shape" + $numeric ); + + return $shapeName; +} + +//=========================================================================== +// performRename +//=========================================================================== +// Description: Does the work for the rename operation -- generates unique +// names for the transform and shape nodes, assesses whether +// the names are non-unique and, if necessary, renames the +// nodes. +// +// Constraints: Read-only nodes (such as Maya's startup cameras) are a real +// pain in the keister because there is no way to detect them +// reliably ('ls -readOnly' doesn't work for this). Currently +// the workaround is to assess whether my "unique" name is +// the same as Maya's current name and, if so, don't bother +// attempting a rename operation. +// +// Parameters: string $node: The full path to the node being renamed. +// +// Return: (int): TRUE (non-zero) if successful; else FALSE. +// TRUE doesn't necessary mean it was renamed; it may +// also mean it did not need to be renamed. +// +//=========================================================================== +proc int performRename( string $node ) +{ + int $bSuccess = false; + + if ( `objExists $node` ) + { + string $unique = getUniqueName( $node ); + string $shape = getShape( $node ); + + if ( $shape != "" ) + { + string $uniqueShape = getShapeName( $unique ); + if ( $uniqueShape != nameNoPath( $shape ) ) + { + eval( "rename " + $shape + " " + $uniqueShape ); + } + } + + if ( $unique != nameNoPath( $node ) ) + { + eval( "rename " + $node + " " + $unique ); + } + + $bSuccess = true; + } + + return $bSuccess; +} + +//=========================================================================== +// performUniqueNames +//=========================================================================== +// Description: Recursive procedure for assessing the scene and looping +// through the transform nodes. The renaming is performed +// from the top-down, and if a top-level node is renamed the +// path to its children will no longer be valid. The cheap +// way around this is to detect an invalid path and signal +// a recursive call to this function. The number of retries +// is capped to prevent any possibility of infinite recursion. +// +// Constraints: +// +// Parameters: int $progress: The current progress; i.e. the number of +// nodes successfully processed so far. +// int $retry: Number of retries (recursions) remaining. +// +// Return: (none) +// +//=========================================================================== +proc performUniqueNames( int $progress, int $retry ) +{ + $retry = max( $retry, 0 ); + + int $bSuccess = true; + + string $transforms[] = `ls -long -transforms`; + int $depth[]; + int $maxDepth = 0; + + for ( $t = 0; $t < `size $transforms`; $t++ ) + { + $depth[$t] = depth( $transforms[$t] ); + $maxDepth = max( $maxDepth, $depth[$t] ); + } + + for ( $d = 1; $d <= $maxDepth; $d++ ) + { + for ( $t = 0; $t < `size $transforms`; $t++ ) + { + if ( $depth[$t] == $d ) + { + $bSuccess = performRename( $transforms[$t] ) && $bSuccess; + + if ( $bSuccess ) $progress++; + } + + progressWindow -e -progress $progress; + } + } + + if ( !$bSuccess && $retry ) performUniqueNames( $progress, --$retry ); +} + +//=========================================================================== +// forceUniqueNames +//=========================================================================== +// Description: Entry point for this script. +// +// Forces unique names for all nodes in the scene, and ensures +// that each Shape node derives its name (and numerical suffix) +// from its Transform. +// +// Constraints: +// +// Parameters: (none) +// +// Return: (none) +// +//=========================================================================== +global proc forceUniqueNames() +{ + int $numRetries = 8; + + waitCursor -state on; + + string $transforms[] = `ls -l -type "transform"`; + + int $allProgress = ( `size $transforms` ); + int $progress = 0; + int $progressThreshold = 256; // no progress window for fewer items. + + if ( $allProgress > $progressThreshold ) + { + progressWindow + -ii false // not interruptable, sorry. + -min 0 + -max $allProgress + -title "Force Unique Names" + -status "Scanning for non-unique names." + ; + } + + performUniqueNames( $progress, $numRetries ); + + if ( $allProgress > $progressThreshold ) + { + progressWindow -endProgress; + } + + waitCursor -state off; +} + + +/* +source forceUniqueNames; forceUniqueNames; +*/ diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/backfaceoff.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/backfaceoff.bmp Binary files differnew file mode 100644 index 0000000..cdcf12f --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/backfaceoff.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/movetex.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/movetex.bmp Binary files differnew file mode 100644 index 0000000..30ae56d --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/movetex.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/optimizetex.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/optimizetex.bmp Binary files differnew file mode 100644 index 0000000..af78381 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/optimizetex.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/p3d.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/p3d.bmp Binary files differnew file mode 100644 index 0000000..8e4871e --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/p3d.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/prelighttool.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/prelighttool.bmp Binary files differnew file mode 100644 index 0000000..4025c62 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/prelighttool.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/prelitoff.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/prelitoff.bmp Binary files differnew file mode 100644 index 0000000..8b08d44 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/prelitoff.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/removetxt.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/removetxt.bmp Binary files differnew file mode 100644 index 0000000..0cc5661 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/removetxt.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/renamesh.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/renamesh.bmp Binary files differnew file mode 100644 index 0000000..f0160a3 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/renamesh.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/renametex.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/renametex.bmp Binary files differnew file mode 100644 index 0000000..b00e2b5 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/renametex.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/rnd.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/rnd.bmp Binary files differnew file mode 100644 index 0000000..6ce51cc --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/rnd.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/setshape.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/setshape.bmp Binary files differnew file mode 100644 index 0000000..7571fdb --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/setshape.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/unique.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/unique.bmp Binary files differnew file mode 100644 index 0000000..d04b12b --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/unique.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/uvz.bmp b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/uvz.bmp Binary files differnew file mode 100644 index 0000000..a992bce --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/icons/uvz.bmp diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/mappedPrelight.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/mappedPrelight.mel new file mode 100644 index 0000000..6da9772 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/mappedPrelight.mel @@ -0,0 +1,126 @@ +/*=========================================================================== + File: mappedPrelight.mel + Created: January 28, 2002 + Author: Harold Westlund + + Copyright (c) 2002 Radical Entertainment, Inc. + All rights reserved. + +============================================================================= + + This procedure remaps vertex colour of a mesh. Colours within a + specified luminance range (low to high) are mapped to the corresponding + RGB color. Low-high-RGB sets are passed to this procedure as parater + arrays. + + return value: + bool = success of this procedure. + +===========================================================================*/ + +global proc int mappedPrelight ( + float $map_low[], + float $map_high[], + float $map_red[], + float $map_green[], + float $map_blue[] ) +{ + print "Remapping vertex colours.\n"; + + int $NUM_MAPS = size( $map_low ); + if( size( $map_high ) != $NUM_MAPS || + size( $map_red ) != $NUM_MAPS || + size( $map_green ) != $NUM_MAPS || + size( $map_blue ) != $NUM_MAPS ) + { + return false; + } + + string $selection[] = `ls -selection`; + + string $mesh[] = `filterExpand -sm 12 -ex true`; + + // Step through all selected meshes + for( $i = 0; $i < size($mesh); $i++ ) + { + int $verticesA[] = `polyEvaluate -v ( $mesh[$i] )`; + int $numVerts = $verticesA[0]; + clear $verticesA; + + int $vfIdx = 0; + int $viList[]; + int $fiList[]; + float $redList[]; + float $greenList[]; + float $blueList[]; + + // Step through the vertices in the mesh + for( $j = 0; $j < $numVerts; $j++ ) + { + // Find the faces which use the current vertex. + string $command = " " + $mesh[$i] + ".vtx["+$j+"]"; + string $s[] = `polyInfo -vf $command`; + string $t[]; + int $tokCount = `tokenize $s[0] $t`; + clear $s; + + // Step through the vertexFaces for this vertex + for( $k = 2; $k < $tokCount; $k++ ) + { + string $vf = " " + $mesh[$i] + ".vtxFace["+$j+"]["+$t[$k]+"]"; + float $rgb[] = `polyColorPerVertex -q -r -g -b $vf`; + float $red = $rgb[0]; + float $green = $rgb[1]; + float $blue = $rgb[2]; + clear $rgb; + + // Find the lumninance + float $y = .299 * $red + .587 * $green + .114 * $blue; + + // Apply the appropriate color maps. + int $mIdx; + for ( $mIdx = 0; $mIdx < $NUM_MAPS; $mIdx++ ) + { + if ( ($y <= ( $map_high[$mIdx] ) ) && + ($y >= ( $map_low[$mIdx] ) ) ) + { + // Luminance is within specified range + $red = $map_red[$mIdx]; + $green = $map_green[$mIdx]; + $blue = $map_blue[$mIdx]; + + // Write color back to vertexFace +// polyColorPerVertex -e -rgb $red $green $blue $vf; + break; + } + } + $viList[$vfIdx] = $j; + $fiList[$vfIdx] = $t[$k]; + $redList[$vfIdx] = $red; + $greenList[$vfIdx] = $green; + $blueList[$vfIdx] = $blue; + + $vfIdx++; + + } + clear $t; + + } + // Use the collected information to colour the mesh. + polyColorPerVertexArray( $viList, $fiList, $redList, + $greenList, $blueList, $mesh[$i] ); + clear $viList; + clear $fiList; + clear $redList; + clear $greenList; + clear $blueList; + } + clear $mesh; + + select $selection; + + print "Finished remapping.\n"; + + return true; +} + diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/mappedPrelightWindow.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/mappedPrelightWindow.mel new file mode 100644 index 0000000..c3b39cb --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/mappedPrelightWindow.mel @@ -0,0 +1,1118 @@ +/*=========================================================================== + File: mappedPrelightWindow.mel + Created: January 28, 2002 + Author: Harold Westlund + + Copyright (c) 2002 Radical Entertainment, Inc. + All rights reserved. + + Updated: April 12, 2002 + Version: 1.2.0 + +============================================================================= + + mappedPrelightWindow is the user interface for mappedPrelight. + + This program provides a means to map from a specified cbv brightness + range to another colour. Up to six maps may be specifed and used in + any combination. + +===========================================================================*/ + +// Gather global data from other functions and apply to the window. +global proc P3Dmp_updateAllMappedPrelightGlobal( int $mpNumMaps ) +{ + // Prepare for forced min value if checked. + P3Dmp_forceValues ( $mpNumMaps ); +} + + +// Add Context Sensitive Help +global proc P3Dmp_buildMappedPrelightContextHelpItems(string $nameRoot, string $menuParent) +{ + menuItem -label "Help on Mapped Prelight..." + -enableCommandRepeat false + -command "showHelp -d \"UserGuide/ModelingPoly/PolyColoring3.html\""; +} + +// Prelight the selected object using default options. +global proc P3Dmp_performPrelight () +{ + toggleMaterialMapping(0); + polyGeoSampler + -sf 0 + -su + -colorBlend overwrite + -alphaBlend overwrite; + toggleMaterialMapping(1); +} + +// Prelight conditional upon prelight checkbox being checked +// Either way, set the persistent data. +global proc P3Dmp_conditionalPerformPrelight () +{ + int $usePrelight; + $usePrelight = `checkBox -q -v performPrelightCheckBox`; + optionVar -intValue P3D_mpPerformPrelight $usePrelight; + + if ($usePrelight) + { + print "Performing prelight\n"; + + P3Dmp_performPrelight(); + } +} + +//================================================================== +// +// Modify the UI through interaction +// +//================================================================== + +// Force the minimum value of one map to be the maximum value +// of the previous map. +global proc P3Dmp_forceValues ( int $mapID ) +{ + int $forceMinValue; + $forceMinValue = `checkBox -q -v forceMinValueCheckBox`; + + int $lastMapUsed = 0; + + // Check every map's UI settings + int $i; + for( $i = 1; $i <= $mapID; $i++ ) + { + if( $forceMinValue == true ) + { + int $mapUse; + $mapUse = `checkBox -q -v ( "mpMap" + $i + "CheckBox" )`; + if($mapUse) + { + // Nothing is done to the first map in use. + // Other maps have the min set to the max of the + // last in use map, and then the min is disabled. + if( $lastMapUsed != 0 ) + { + float $mapMin = `floatField -q -v ("mpMap" + $lastMapUsed + "MaxField")`; + floatField -edit -v $mapMin ("mpMap" + $i + "MinField"); + floatField -edit -enable 0 ("mpMap" + $i + "MinField"); + } + else + { + floatField -edit -enable 1 ("mpMap" + $i + "MinField"); + } + + $lastMapUsed = $i; + } + + } + else + { + int $mapUse; + $mapUse = `checkBox -q -v ( "mpMap" + $i + "CheckBox" )`; + if($mapUse) + { + + floatField -edit -enable 1 ("mpMap" + $i + "MinField"); + } + + } + } +} + +// Turn a particular map on or off. +global proc P3Dmp_changeMapUse ( int $mapID ) +{ + string $mapName = ( "mpMap" + $mapID ); + + string $checkBox = ( $mapName + "CheckBox" ); + + string $layout = ( $mapName + "DetailsLayout" ); + + int $isOn = `checkBox -q -v $checkBox`; + + // Now enable or disable the map. + columnLayout -edit + -enable $isOn + $layout; + + // Changing the map use will affect forced minimums. + P3Dmp_forceValues ( $mapID ); +} + +// Apply the numeric RGB values to the colour slider. +global proc P3Dmp_changeMapRGB ( int $mapID, string $srcDst) +{ + string $mapName = ( "mpMap" + $mapID + $srcDst ); + + string $RedField = ( $mapName + "RedField" ); + string $GreenField = ( $mapName + "GreenField" ); + string $BlueField = ( $mapName + "BlueField" ); + + float $red, $green, $blue; + $red = `floatField -q -v $RedField`; + $green = `floatField -q -v $GreenField`; + $blue = `floatField -q -v $BlueField`; + + colorSliderButtonGrp -edit + -rgbValue $red $green $blue + ( $mapName + "ColorSlider" ); +} + +// Apply the colour slider values to the numeric RGB values. +global proc P3Dmp_changeMapRGBSlider ( int $mapID, string $srcDst ) +{ + string $mapName = ( "mpMap" + $mapID + $srcDst ); + + float $rgb[3]; + + $rgb = `colorSliderButtonGrp -q -rgbValue ( $mapName + "ColorSlider" )`; + + string $RedField = ( $mapName + "RedField" ); + string $GreenField = ( $mapName + "GreenField" ); + string $BlueField = ( $mapName + "BlueField" ); + + $red = `floatField -edit -v ( $rgb[0] ) $RedField`; + $green = `floatField -edit -v ( $rgb[1] ) $GreenField`; + $blue = `floatField -edit -v ( $rgb[2] ) $BlueField`; + + clear $rgb; +} + +// Apply the prelight maps in the range specified to the selected objects. +global proc P3Dmp_applyPrelightMaps( int $minMapNum, int $maxMapNum ) +{ + int $i; + int $numMapsInUse; + float $mapsMin[], $mapsMax[]; + float $mapsRed[], $mapsGreen[], $mapsBlue[]; + float $mapMin, $mapMax; + float $mapRed, $mapGreen, $mapBlue; + + waitCursor -state on; + + for( $i = $minMapNum; $i <= $maxMapNum; $i++ ) + { + string $mapName = ( "mpMap" + $i ); + int $mapUse; + + string $checkBox = ( $mapName + "CheckBox" ); + string $MinField = ( $mapName + "MinField" ); + string $MaxField = ( $mapName + "MaxField" ); + string $RedField = ( $mapName + "SrcRedField" ); + string $GreenField = ( $mapName + "SrcGreenField" ); + string $BlueField = ( $mapName + "SrcBlueField" ); + + $mapUse = `checkBox -q -v $checkBox`; + $mapMin = `floatField -q -v $MinField`; + $mapMax = `floatField -q -v $MaxField`; + $mapRed = `floatField -q -v $RedField`; + $mapGreen = `floatField -q -v $GreenField`; + $mapBlue = `floatField -q -v $BlueField`; + + if ($mapUse) + { + $mapsMin[$numMapsInUse] = $mapMin; + $mapsMax[$numMapsInUse] = $mapMax; + $mapsRed[$numMapsInUse] = $mapRed; + $mapsGreen[$numMapsInUse] = $mapGreen; + $mapsBlue[$numMapsInUse] = $mapBlue; + + $numMapsInUse++; + } + + string $varName = ( "P3D_" + $mapName ); + optionVar -intValue ( $varName + "Use" ) $mapUse; + optionVar -floatValue ( $varName + "Min" ) $mapMin; + optionVar -floatValue ( $varName + "Max" ) $mapMax; + optionVar -floatValue ( $varName + "SrcRed" ) $mapRed; + optionVar -floatValue ( $varName + "SrcGreen" ) $mapGreen; + optionVar -floatValue ( $varName + "SrcBlue" ) $mapBlue; + + } + + // Perform prelighting if selected + P3Dmp_conditionalPerformPrelight(); + + // Store current UI settings + int $forceMinValue, $useAveSides; + $forceMinValue = `checkBox -q -v forceMinValueCheckBox`; + $useAveSides = `checkBox -q -v useAverageSideCheckBox`; + optionVar -intValue P3D_mpforceMinValue $forceMinValue; + optionVar -intValue P3D_mpUseAveSides $useAveSides; + + if( $useAveSides ) + { + mappedAvePrelight $mapsMin $mapsMax $mapsRed $mapsGreen $mapsBlue; + } + else { + mappedPrelight $mapsMin $mapsMax $mapsRed $mapsGreen $mapsBlue; + } + + clear $mapsMin; + clear $mapsMax; + clear $mapsRed; + clear $mapsGreen; + clear $mapsBlue; + + waitCursor -state off; +} + +// Apply the colour maps in the range specified to the selected objects. +global proc P3Dmp_applyColourMaps( int $minMapNum, int $maxMapNum, int $forward ) +{ + int $i; + int $numMapsInUse; + float $mapsTolerance[]; + float $mapsSrcRed[], $mapsSrcGreen[], $mapsSrcBlue[]; + float $mapsDstRed[], $mapsDstGreen[], $mapsDstBlue[]; + float $mapTolerance; + float $mapSrcRed, $mapSrcGreen, $mapSrcBlue; + float $mapDstRed, $mapDstGreen, $mapDstBlue; + + waitCursor -state on; + + for( $i = $minMapNum; $i <= $maxMapNum; $i++ ) + { + string $mapName = ( "mpMap" + $i ); + int $mapUse; + + string $checkBox = ( $mapName + "CheckBox" ); + string $SrcRedField = ( $mapName + "SrcRedField" ); + string $SrcGreenField = ( $mapName + "SrcGreenField" ); + string $SrcBlueField = ( $mapName + "SrcBlueField" ); + string $ToleranceField = ( $mapName + "ToleranceField" ); + string $DstRedField = ( $mapName + "DstRedField" ); + string $DstGreenField = ( $mapName + "DstGreenField" ); + string $DstBlueField = ( $mapName + "DstBlueField" ); + + $mapUse = `checkBox -q -v $checkBox`; + $mapSrcRed = `floatField -q -v $SrcRedField`; + $mapSrcGreen = `floatField -q -v $SrcGreenField`; + $mapSrcBlue = `floatField -q -v $SrcBlueField`; + $mapTolerance = `floatField -q -v $ToleranceField`; + $mapDstRed = `floatField -q -v $DstRedField`; + $mapDstGreen = `floatField -q -v $DstGreenField`; + $mapDstBlue = `floatField -q -v $DstBlueField`; + + if ($mapUse) + { + $mapsSrcRed[$numMapsInUse] = $mapSrcRed; + $mapsSrcGreen[$numMapsInUse] = $mapSrcGreen; + $mapsSrcBlue[$numMapsInUse] = $mapSrcBlue; + $mapsTolerance[$numMapsInUse] = $mapTolerance; + $mapsDstRed[$numMapsInUse] = $mapDstRed; + $mapsDstGreen[$numMapsInUse] = $mapDstGreen; + $mapsDstBlue[$numMapsInUse] = $mapDstBlue; + + $numMapsInUse++; + } + + string $varName = ( "P3D_" + $mapName ); + optionVar -intValue ( $varName + "Use" ) $mapUse; + optionVar -floatValue ( $varName + "SrcRed" ) $mapSrcRed; + optionVar -floatValue ( $varName + "SrcGreen" ) $mapSrcGreen; + optionVar -floatValue ( $varName + "SrcBlue" ) $mapSrcBlue; + optionVar -floatValue ( $varName + "Tolerance" ) $mapTolerance; + optionVar -floatValue ( $varName + "DstRed" ) $mapDstRed; + optionVar -floatValue ( $varName + "DstGreen" ) $mapDstGreen; + optionVar -floatValue ( $varName + "DstBlue" ) $mapDstBlue; + + } + + // Do the action + if( $forward == 1 ) + { + mappedColour $mapsSrcRed $mapsSrcGreen $mapsSrcBlue $mapsDstRed $mapsDstGreen $mapsDstBlue $mapsTolerance; + } + else + { + mappedColour $mapsDstRed $mapsDstGreen $mapsDstBlue $mapsSrcRed $mapsSrcGreen $mapsSrcBlue $mapsTolerance; + } + + clear $mapsSrcRed; + clear $mapsSrcGreen; + clear $mapsSrcBlue; + clear $mapsTolerance; + clear $mapsDstRed; + clear $mapsDstGreen; + clear $mapsDstBlue; + + waitCursor -state off; +} + +// Deselect all maps and set their colour values to zero. +global proc P3Dmp_resetAllValues ( int $mpNumMaps ) +{ + string $cancel = `confirmDialog -message "Reset map values to zero. Are you sure?" + -button "Yes" -button "No" + -defaultButton "No" -cancelButton "No" -dismissString "No"`; + + if ($cancel == "No") + return; + + int $i; + + for( $i = 1; $i <= $mpNumMaps; $i++ ) + { + string $mapName = ( "mpMap" + $i ); + int $mapUse; + + string $checkBox = ( $mapName + "CheckBox" ); + string $MinField = ( $mapName + "MinField" ); + string $MaxField = ( $mapName + "MaxField" ); + string $SrcRedField = ( $mapName + "SrcRedField" ); + string $SrcGreenField = ( $mapName + "SrcGreenField" ); + string $SrcBlueField = ( $mapName + "SrcBlueField" ); + string $ToleranceField = ( $mapName + "ToleranceField" ); + string $DstRedField = ( $mapName + "DstRedField" ); + string $DstGreenField = ( $mapName + "DstGreenField" ); + string $DstBlueField = ( $mapName + "DstBlueField" ); + + checkBox -edit -v 0 $checkBox; + floatField -edit -v 0 $MinField; + floatField -edit -v 0 $MaxField; + floatField -edit -v 0 $SrcRedField; + floatField -edit -v 0 $SrcGreenField; + floatField -edit -v 0 $SrcBlueField; + floatField -edit -v 0.01 $ToleranceField; + floatField -edit -v 0 $DstRedField; + floatField -edit -v 0 $DstGreenField; + floatField -edit -v 0 $DstBlueField; + + P3Dmp_changeMapUse ( $i ); + P3Dmp_changeMapRGB ( $i, "Src" ); + P3Dmp_changeMapRGB ( $i, "Dst" ); + + string $varName = ( "P3D_" + $mapName ); + optionVar -intValue ( $varName + "Use" ) 0; + optionVar -floatValue ( $varName + "Min" ) 0; + optionVar -floatValue ( $varName + "Max" ) 0; + optionVar -floatValue ( $varName + "SrcRed" ) 0; + optionVar -floatValue ( $varName + "SrcGreen" ) 0; + optionVar -floatValue ( $varName + "SrcBlue" ) 0; + optionVar -floatValue ( $varName + "Tolerance" ) 0.01; + optionVar -floatValue ( $varName + "DstRed" ) 0; + optionVar -floatValue ( $varName + "DstGreen" ) 0; + optionVar -floatValue ( $varName + "DstBlue" ) 0; + } +} + +//================================================================== +// +// File IO +// +//================================================================== + +// Read in a colour map from file. +global proc P3Dmp_openColourMap ( int $mpNumMaps, string $srcDst, string $fileName, string $fileType ) +{ + if( $fileName == "" ) + { + print ("Open cancelled.\n"); + return; // Dialogue cancelled + } + print ("Retrieving map.\n"); + + int $i; + + int $n_lines; + string $lines[]; + int $fileId = `fopen $fileName "r"`; + + if ( $fileId != 0 ) + { + // Store each valid data line of the file in array. + string $nextLine = `fgetline $fileId`; + while( size( $nextLine ) > 0 ) + { + // Discard comments and blank lines + string $ch = `substring $nextLine 1 1`; + if( $ch != "#" && $ch != "\n" ) + { + $lines[$n_lines] = $nextLine; + $n_lines++; + } + + // Get the next line + $nextLine = `fgetline $fileId`; + } + fclose($fileId); + } + else + { + print ("Unable to read from " + $fileName + "\n"); + return; + } + + int $maxMapNumber = $lines[0]; + + // Ensure that the correct number of valid lines were read. + if( ( $maxMapNumber * 3 ) != ( $n_lines - 1 ) ) + { + warning -sl true ( "Invalid data in file: " + $fileName ); + warning "Map not loaded"; + + return; + } + + int $mapUse[]; + float $mapMin[], $mapMax[], $mapTolerance[]; + float $mapRed[], $mapGreen[], $mapBlue[]; + int $lineNumber = 1; + int $readError = false; + + // Read in the data for each map. + // Perform simple check for data format error. + for( $i = 1; $i <= $maxMapNumber; $i++ ) + { + $mapUse[$i] = $lines[$lineNumber++]; + + string $minmax[]; + tokenize $lines[$lineNumber++] $minmax; + if( size($minmax) != 2 && size($minmax) != 3 ) + { + $readError = true; + break; + } + + $mapMin[$i] = $minmax[0]; + $mapMax[$i] = $minmax[1]; + if( size($minmax) == 2 ) + { + $mapTolerance[$i] = 0.01; + } + else + { + $mapTolerance[$i] = $minmax[2]; + } + + clear $minmax; + + string $rgb[]; + tokenize $lines[$lineNumber++] $rgb; + if( size($rgb) != 3 ) + { + $readError = true; + break; + } + $mapRed[$i] = $rgb[0]; + $mapGreen[$i] = $rgb[1]; + $mapBlue[$i] = $rgb[2]; + clear $rgb; + } + if( $readError ) + { + warning -sl true ( "Invalid data in file: " + $fileName ); + warning "Map not loaded"; + + return; + } + + clear $lines; + + // Now update the UI and Maya's persistent data. + for( $i = 1; $i <= $maxMapNumber; $i++ ) + { + string $mapName = ( "mpMap" + $i ); + string $mapName2 = ( $mapName + $srcDst ); + string $varName = ( "P3D_" + $mapName ); + string $varName2 = ( $varName + $srcDst ); + + if( $srcDst == "Src" ) + { + optionVar -intValue ( $varName + "Use" ) $mapUse[$i]; + optionVar -floatValue ( $varName + "Min" ) $mapMin[$i]; + optionVar -floatValue ( $varName + "Max" ) $mapMax[$i]; + optionVar -floatValue ( $varName + "Tolerance" ) $mapTolerance[$i]; + } + optionVar -floatValue ( $varName2 + "Red" ) $mapRed[$i]; + optionVar -floatValue ( $varName2 + "Green" ) $mapGreen[$i]; + optionVar -floatValue ( $varName2 + "Blue" ) $mapBlue[$i]; + + if( $srcDst == "Src" ) + { + checkBox -edit -v ( $mapUse[$i] ) ( $mapName + "CheckBox" ); + floatField -edit -v ( $mapMin[$i] ) ( $mapName + "MinField" ); + floatField -edit -v ( $mapMax[$i] ) ( $mapName + "MaxField" ); + floatField -edit -v ( $mapTolerance[$i] ) ( $mapName + "ToleranceField" ); + } + floatField -edit -v ( $mapRed[$i] ) ( $mapName2 + "RedField" ); + floatField -edit -v ( $mapGreen[$i] ) ( $mapName2 + "GreenField" ); + floatField -edit -v ( $mapBlue[$i] ) ( $mapName2 + "BlueField" ); + P3Dmp_changeMapUse ( $i ); + P3Dmp_changeMapRGB ( $i, $srcDst ); + } + + clear $mapUse; + clear $mapMin; + clear $mapMax; + clear $mapTolerance; + clear $mapRed; + clear $mapGreen; + clear $mapBlue; + + print ("Open complete.\n"); +} + +// Write out a colour map to file. +global proc P3Dmp_saveColourMap ( int $mpNumMaps, string $srcDst, string $fileName, string $fileType ) +{ + if( $fileName == "" ) + { + print ("Save cancelled.\n"); + return; // Dialogue cancelled + } + print ("Saving map.\n"); + + int $i; + + int $fileId = `fopen $fileName "w"`; + + if ( $fileId != 0 ) + { + // Save out the descriptive information + string $username = strip( `system "echo %USERNAME%"` ); + string $date = strip( `system "date /t"` ); + string $time = strip( `system "time /t"` ); + fprint $fileId ( "## Generated by " + $username + "\r\n" ); + fprint $fileId ( "## on " + $date + "\r\n" ); + fprint $fileId ( "## at " + $time + "\r\n" ); + fprint $fileId ( "##\r\n" ); + fprint $fileId ( "## This file contains the map specifications for the\r\n" ); + fprint $fileId ( "## Maya mappedPrelightWindow mel script.\r\n" ); + fprint $fileId ( "##\r\n" ); + + // Save the number of maps. + fprint $fileId ( "# Number of maps\r\n" ); + fprint $fileId ( "" + $mpNumMaps + "\r\n" ); + + for( $i = 1; $i <= $mpNumMaps; $i++ ) + { + string $mapName = ( "mpMap" + $i ); + string $mapName2 = ( $mapName + $srcDst ); + + int $mapUse; + float $mapMin, $mapMax, $tolerance; + float $mapRed, $mapGreen, $mapBlue; + + $mapUse = `checkBox -q -v ( $mapName + "CheckBox" )`; + $mapMin = `floatField -q -v ( $mapName + "MinField" )`; + $mapMax = `floatField -q -v ( $mapName + "MaxField" )`; + $mapTolerance = `floatField -q -v ( $mapName + "ToleranceField" )`; + $mapRed = `floatField -q -v ( $mapName2 + "RedField" )`; + $mapGreen = `floatField -q -v ( $mapName2 + "GreenField" )`; + $mapBlue = `floatField -q -v ( $mapName2 + "BlueField" )`; + + // Write out the information for this map. + fprint $fileId ( "\r\n" ); + fprint $fileId ( "## Map " + $i + "\r\n" ); + fprint $fileId ( "# UseMap\r\n" ); + fprint $fileId ( "" + $mapUse + "\r\n" ); + fprint $fileId ( "# Min Max Tolerance\r\n" ); + fprint $fileId ( "" + $mapMin + " " + $mapMax + + " " + $mapTolerance + "\r\n" ); + fprint $fileId ( "# Red Green Blue\r\n" ); + fprint $fileId ( "" + $mapRed + " " + $mapGreen + + " " + $mapBlue + "\r\n" ); + + // Save the to Maya's persistent data + string $varName = ( "P3D_" + $mapName ); + string $varName2 = ( "P3D_" + $mapName2 ); + + // Save the data to persistent variables + optionVar -intValue ( $varName + "Use" ) $mapUse; + optionVar -floatValue ( $varName + "Min" ) $mapMin; + optionVar -floatValue ( $varName + "Max" ) $mapMax; + optionVar -floatValue ( $varName + "Tolerance" ) $mapTolerance; + optionVar -floatValue ( $varName2 + "Red" ) $mapRed; + optionVar -floatValue ( $varName2 + "Green" ) $mapGreen; + optionVar -floatValue ( $varName2 + "Blue" ) $mapBlue; + } + fclose($fileId); + } + else + { + print ("Unable to write to " + $fileName + "\n"); + return; + } + + print ("Save complete.\n"); +} + +//================================================================== +// +// Starting the UI creation section +// +//================================================================== + +proc createSamplingOptions ( string $parent ) +{ + setUITemplate -pushTemplate attributeEditorTemplate; + setParent $parent; + + // Place sampling options here. + + setParent ..; + setUITemplate -popTemplate; +} + +proc createBasicPrelight () +{ + setUITemplate -pushTemplate attributeEditorTemplate; + + columnLayout + -adjustableColumn true + mpCreateBasicPrelightLayout; + { + columnLayout -rs 5-cat "left" 150; + { + int $performPrelight; + if ( `optionVar -exists P3D_mpPerformPrelight` ) + $performPrelight = `optionVar -q P3D_mpPerformPrelight `; + checkBox + -value $performPrelight + -al left + -w 200 + -label "Prelight on each Apply" + performPrelightCheckBox; + button + -label " Prelight " + -height 22 + -command P3Dmp_performPrelight + mpPrelightButton; + } setParent ..; + } setParent ..; + + setUITemplate -popTemplate; +} + +// Create the UI for one map. +proc createMapLayout ( int $mapID, int $mpNumMaps ) +{ + setUITemplate -pushTemplate attributeEditorTemplate; + + string $mapName = ( "mpMap" + $mapID ); + float $rgbWidth = 45; + float $toleranceWidth = 30; + float $buttonWidth = 20; + + rowColumnLayout -numberOfColumns 2 + -rat 1 "top" 5 + -co 1 "left" 5 + -columnWidth 1 65 + -cal 2 "left" + -columnWidth 2 500 + ( $mapName + "Layout" ); + + { + string $checkCallback = ( "P3Dmp_changeMapUse (" + $mapID + ");" + + "P3Dmp_forceValues (" + $mpNumMaps + ")" ); + + int $mapUse=0; + float $mapMin=0, $mapMax=0; + float $mapSrcRed=0, $mapSrcGreen=0, $mapSrcBlue=0; + float $mapTolerance=0.01; + float $mapDstRed=0, $mapDstGreen=0, $mapDstBlue=0; + + string $varName = ( "P3D_" + $mapName ); + if ( `optionVar -exists ( $varName + "Use" ) ` ) + $mapUse = `optionVar -q ( $varName + "Use" ) `; + if ( `optionVar -exists ( $varName + "Min" ) ` ) + $mapMin = `optionVar -q ( $varName + "Min" ) `; + if ( `optionVar -exists ( $varName + "Max" ) ` ) + $mapMax = `optionVar -q ( $varName + "Max" ) `; + if ( `optionVar -exists ( $varName + "SrcRed" ) ` ) + $mapSrcRed = `optionVar -q ( $varName + "SrcRed" ) `; + if ( `optionVar -exists ( $varName + "SrcGreen" ) ` ) + $mapSrcGreen = `optionVar -q ( $varName + "SrcGreen" ) `; + if ( `optionVar -exists ( $varName + "SrcBlue" ) ` ) + $mapSrcBlue = `optionVar -q ( $varName + "SrcBlue" ) `; + if ( `optionVar -exists ( $varName + "Tolerance" ) ` ) + $mapTolerance = `optionVar -q ( $varName + "Tolerance" ) `; + if ( `optionVar -exists ( $varName + "DstRed" ) ` ) + $mapDstRed = `optionVar -q ( $varName + "DstRed" ) `; + if ( `optionVar -exists ( $varName + "DstGreen" ) ` ) + $mapDstGreen = `optionVar -q ( $varName + "DstGreen" ) `; + if ( `optionVar -exists ( $varName + "DstBlue" ) ` ) + $mapDstBlue = `optionVar -q ( $varName + "DstBlue" ) `; + + checkBox + -v $mapUse + -label ( "Map " + $mapID + ":" ) + -cc ( $checkCallback ) + ( $mapName + "CheckBox" ); + + columnLayout + -adjustableColumn true + -rs 3 + ( $mapName + "DetailsLayout" ); + { + rowColumnLayout -numberOfColumns 10 + -columnOffset 1 "left" 10 + -columnWidth 1 ( $rgbWidth + 10 ) + -columnWidth 2 $rgbWidth + -columnOffset 3 "left" 5 + -columnWidth 3 ( $buttonWidth + 10 ) + -columnOffset 3 "right" 5 + -columnWidth 4 $rgbWidth + -columnWidth 5 $rgbWidth + -columnWidth 6 $rgbWidth + -columnWidth 7 ( $buttonWidth + $toleranceWidth + $buttonWidth + 10 ) + -columnWidth 8 $rgbWidth + -columnWidth 9 $rgbWidth + -columnWidth 10 ( $rgbWidth + 10 ) + -columnOffset 10 "right" 10 + ( $mapName + "SelectSubLayout" ); + { + text -al "center" "Min (0-1)"; + text -al "center" "Max (0-1)"; + text -al "center" " "; + text -l "Red" -al "center" "SrcRed"; + text -l "Green" -al "center" "SrcGreen"; + text -l "Blue" -al "center" "SrcBlue"; + text -al "center" "Tolerance"; + text -l "Red" -al "center" "DstRed"; + text -l "Green" -al "center" "DstGreen"; + text -l "Blue" -al "center" "DstBlue"; + + string $minMaxCallback = ( "P3Dmp_forceValues (" + $mpNumMaps + ")" ); + string $srcRGBCallback = ( "P3Dmp_changeMapRGB ( " + $mapID + ", \"Src\"" + " )" ); + string $dstRGBCallback = ( "P3Dmp_changeMapRGB ( " + $mapID + ", \"Dst\"" + " )" ); + string $buttonCallback = ( "P3Dmp_applyPrelightMaps ( " + $mapID + ", " + $mapID + ")" ); + string $forwardCallback = ( "P3Dmp_applyColourMaps ( " + $mapID + ", " + $mapID + ", 1 )" ); + string $backwardCallback = ( "P3Dmp_applyColourMaps ( " + $mapID + ", " + $mapID + ", 0 )" ); + + floatField -value $mapMin + -cc $minMaxCallback + ( $mapName + "MinField" ); + floatField -value $mapMax + -cc $minMaxCallback + ( $mapName + "MaxField" ); + button -l "=>" -c $buttonCallback + ( $mapName + "ApplyUpToMap" ); + floatField -value $mapSrcRed -cc $srcRGBCallback + ( $mapName + "SrcRedField" ); + floatField -value $mapSrcGreen -cc $srcRGBCallback + ( $mapName + "SrcGreenField" ); + floatField -value $mapSrcBlue -cc $srcRGBCallback + ( $mapName + "SrcBlueField" ); + + rowColumnLayout -numberOfColumns 3 + -columnOffset 1 "left" 5 + -columnWidth 1 ( $buttonWidth + 5 ) + -columnWidth 2 $toleranceWidth + -columnWidth 3 ( $buttonWidth + 5 ) + -columnOffset 3 "right" 5 + ( $mapName + "ToleranceSubLayout" ); + { + button -l "<-" -c $backwardCallback + ( $mapName + "ApplyForward" ); + floatField -value $mapTolerance + ( $mapName + "ToleranceField" ); + button -l "->" -c $forwardCallback + ( $mapName + "ApplyBackward" ); + } setParent ..; + + floatField -value $mapDstRed -cc $dstRGBCallback + ( $mapName + "DstRedField" ); + floatField -value $mapDstGreen -cc $dstRGBCallback + ( $mapName + "DstGreenField" ); + floatField -value $mapDstBlue -cc $dstRGBCallback + ( $mapName + "DstBlueField" ); + + } setParent ..; // rowColumnLayout -numberOfColumns 10 + + rowColumnLayout -numberOfColumns 2 + -columnOffset 1 "left" 0 + -columnWidth 1 325 + -columnWidth 2 300 + -columnOffset 2 "right" 10 + ( $mapName + "ColorsSublayout" ); + { + string $srcColorSliderCallback = ( "P3Dmp_changeMapRGBSlider (" + $mapID + ", \"Src\"" + ")" ); + string $dstColorSliderCallback = ( "P3Dmp_changeMapRGBSlider (" + $mapID + ", \"Dst\"" + ")" ); + colorSliderButtonGrp + -rgbValue $mapSrcRed $mapSrcGreen $mapSrcBlue + -cat 1 "left" 115 + -cw 1 10 + -cw 2 50 + -cw 3 115 + -cat 4 "left" 500 + -cw 4 180 + -label "" + -symbolButtonDisplay false + -cc $srcColorSliderCallback + ( $mapName + "SrcColorSlider" ); + colorSliderButtonGrp + -rgbValue $mapDstRed $mapDstGreen $mapDstBlue + -cw 1 10 + -cw 2 50 + -cw 3 115 + -cat 4 "left" 500 + -cw 4 180 + -label "" + -symbolButtonDisplay false + -cc $dstColorSliderCallback + ( $mapName + "DstColorSlider" ); + + } setParent ..; // rowColumnLayout -numberOfColumns 2 + + } setParent ..; // columnLayout + + columnLayout -edit + -enable $mapUse + ( $mapName + "DetailsLayout" ); + + } setParent ..; //rowColumnLayout -numberOfColumns 2 + + setUITemplate -popTemplate; +} + +// Create the maps section of the UI +proc createMappedPrelight ( int $mpNumMaps ) +{ + setUITemplate -pushTemplate attributeEditorTemplate; + + columnLayout + -adjustableColumn true + mpLayout; + { + columnLayout -rs 5 -cat "left" 150; + { + int $forceMinValue; + if ( `optionVar -exists P3D_mpforceMinValue` ) + $forceMinValue = `optionVar -q P3D_mpforceMinValue`; + string $forceCallback = ( "P3Dmp_forceValues ( " + $mpNumMaps + " ) " ); + checkBox + -value $forceMinValue + -al left + -w 200 + -label "Force minimum values" + -cc $forceCallback + forceMinValueCheckBox; + int $useAveSides; + if ( `optionVar -exists P3D_mpUseAveSides` ) + $useAveSides = `optionVar -q P3D_mpUseAveSides`; + checkBox + -value $useAveSides + -al left + -w 200 + -label "Use average of side vertex colours" + useAverageSideCheckBox; + string $averageCallback = "waitCursor -st on; avePrelight; waitCursor -st off;"; + button + -label " Set to average " + -height 22 + -command $averageCallback + mpAverageSideButton; + } setParent ..; + + separator; + rowColumnLayout -numberOfColumns 2 + -rat 1 "top" 5 + -co 1 "left" 212 + -columnWidth 1 312 + -cal 2 "left" + -columnWidth 2 330 + "P3mp_colourHeader"; + { + text -al "center" "Colour 1"; + text -al "center" "Colour 2"; + } setParent ..; + + int $i; + for ( $i = 1; $i <= $mpNumMaps ; $i++ ) + { + separator; + createMapLayout ( $i, $mpNumMaps ); + } + + } setParent ..; + + setUITemplate -popTemplate; +} + +// Create the main window for all prelighting. +global proc mappedPrelightWindow() +{ + int $mpNumMaps = 6; + string $windowName = "mappedPrelightWindow"; + string $windowTitle = "Mapped Prelight (ver. 1.2.0 April 12, 2002)"; + string $iconTitle = "Map Prelight"; + int $windowWidth = 450; + int $windowHeight = 500; + int $windowPosTop = 200; + int $windowPosLft = 220; + + // If the window already exists, just make it visible. + if (`window -exists $windowName`) + { + showWindow $windowName; + P3Dmp_updateAllMappedPrelightGlobal( $mpNumMaps ); + return; + } + + // No window exists so build it. + window + -t $windowTitle + -in $iconTitle + -wh $windowWidth $windowHeight + -tlc $windowPosTop $windowPosLft + -mb true + $windowName; + + // Create the menus + menu -l "File"; + menuItem -l "New colour map" + -c ( "P3Dmp_resetAllValues( " + $mpNumMaps + " )" ); + string $openColour1Callback = ("fileBrowserDialog -m 0 -fc \"P3Dmp_openColourMap " + + $mpNumMaps + " Src \" -ft map -an Open" ); + menuItem -l "Open colour 1..." + -c $openColour1Callback; + string $openColour1Callback = ("fileBrowserDialog -m 0 -fc \"P3Dmp_openColourMap " + + $mpNumMaps + " Dst \" -ft map -an Open" ); + menuItem -l "Open colour 2..." + -c $openColour1Callback; + menuItem -d true; + string $saveColour1Callback = ("fileBrowserDialog -m 1 -fc \"P3Dmp_saveColourMap " + + $mpNumMaps + " Src \" -ft map -an Save" ); + menuItem -l "Save colour 1..." + -c $saveColour1Callback; + string $saveColour2Callback = ("fileBrowserDialog -m 1 -fc \"P3Dmp_saveColourMap " + + $mpNumMaps + " Dst \" -ft map -an Save" ); + menuItem -l "Save colour 2..." + -c $saveColour2Callback; + +// menu -l "Edit"; + + // Create the help menu + addContextHelpProc "mappedPrelightWindow" "P3Dmp_buildMappedPrelightContextHelpItems"; + doHelpMenu "mappedPrelightWindow" "mappedPrelightWindow"; + + // Create main form + setUITemplate -pushTemplate attributeEditorTemplate; + + formLayout + mpMainForm; + { + scrollLayout + -hst 0 mpMainLayout; + { + columnLayout -adjustableColumn true mpMainColumnLayout; + { + // Sampling Options + frameLayout -label "Sampling Options" + -cll 1 -cl 1 + -preExpandCommand "createSamplingOptions (\"mpSamplingOptionsFrame\")" + mpSamplingOptionsFrame; + { + } setParent ..; + + // Basic Prelight + frameLayout -label "Basic Prelight" + -cll 1 -cl 1 + mpBasicPrelight; + { + createBasicPrelight(); + } setParent ..; + + // Mapped Prelight + frameLayout -label "Mapped Prelight" + -cll 1 -cl 0 + mpMappedPrelight; + { + createMappedPrelight ( $mpNumMaps ); + } setParent ..; // mpMainColumnLayout + } setParent..; // mpMainLayout + } setParent..; // mpMainForm + } setParent..; // $windowName + + // Create the main window action buttons + + formLayout + -numberOfDivisions 5 + mpActionButtons; + { + + button + -label "Prelight => Colour 1" + -height 26 + -command ( "P3Dmp_applyPrelightMaps( 1, " + $mpNumMaps + " )" ) + mpApplyButton; + button + -label "Colour 1 <- Colour 2" + -command ( "P3Dmp_applyColourMaps( 1, " + $mpNumMaps + ", 0 )" ) + -height 26 + mpBackwardButton; + button + -label "Colour 1 -> Colour 2" + -command ( "P3Dmp_applyColourMaps( 1, " + $mpNumMaps + ", 1 )" ) + -height 26 + mpForwardButton; + button + -label "Reset" + -height 26 + -command ( "P3Dmp_resetAllValues( " + $mpNumMaps + " )" ) + mpResetButton; + button + -label "Close" + -height 26 + -command ( "deleteUI " + $windowName ) + mpCloseButton; + + formLayout + -edit + -af mpApplyButton left 5 + -ap mpApplyButton right 2 1 + -af mpApplyButton top 5 + -af mpApplyButton bottom 5 + + -ap mpBackwardButton left 3 1 + -ap mpBackwardButton right 2 2 + -af mpBackwardButton top 5 + -af mpBackwardButton bottom 5 + + -ap mpForwardButton left 3 2 + -ap mpForwardButton right 2 3 + -af mpForwardButton top 5 + -af mpForwardButton bottom 5 + + -ap mpResetButton left 3 3 + -ap mpResetButton right 2 4 + -af mpResetButton top 5 + -af mpResetButton bottom 5 + + -ap mpCloseButton left 3 4 + -af mpCloseButton right 5 + -af mpCloseButton top 5 + -af mpCloseButton bottom 5 + mpActionButtons; + } setParent ..; // mpActionButtons + + // Set the layout + formLayout -edit + -af mpMainLayout "top" 0 + -af mpMainLayout "left" 0 + -af mpMainLayout "right" 0 + -ac mpMainLayout "bottom" 5 mpActionButtons + + -an mpActionButtons "top" + -af mpActionButtons "bottom" 5 + -af mpActionButtons "left" 5 + -af mpActionButtons "right" 5 + mpMainForm; + + setUITemplate -popTemplate ; + + // Make sure associated procedures are loaded + source mappedPrelight; + + // Make the window visible + showWindow $windowName; + + // Apply any other global settings to the window. + P3Dmp_updateAllMappedPrelightGlobal( $mpNumMaps ); +} + + diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/nameSpaceGui.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/nameSpaceGui.mel new file mode 100644 index 0000000..6648922 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/nameSpaceGui.mel @@ -0,0 +1,74 @@ +global string $g_P3DNameSpaceField; + +global proc P3DRemoveNameSpaceTool_RemoveNameSpace(string $selectedNodes[], string $nameSpace) +{ + print "called P3DRemoveNameSpaceTool_RemoveNameSpace for:"; + print $selectedNodes; + print "\n"; + for($node in $selectedNodes) + { + string $newName = `substitute $nameSpace $node ""`; + if($newName != "") + { + rename -is $node $newName; + } + } +} + +global proc P3DRemoveNameSpaceTool_RemoveSelected() +{ + global string $g_P3DNameSpaceField; + string $nameSpace = `textField -q -text $g_P3DNameSpaceField`; + string $selectedNodes[] = `ls -sl`; + + P3DRemoveNameSpaceTool_RemoveNameSpace( $selectedNodes, $nameSpace ); +} + +global proc P3DRemoveNameSpaceTool_RemoveHierarchy() +{ + global string $g_P3DNameSpaceField; + string $nameSpace = `textField -q -text $g_P3DNameSpaceField`; + select -add -hi; + string $selectedNodes[] = `ls -sl`; + + P3DRemoveNameSpaceTool_RemoveNameSpace( $selectedNodes, $nameSpace ); +} + + +global proc P3DRemoveNameSpaceTool_GUICreate() +{ + string $windowName = "P3DRemoveNameSpaceTool"; + + global string $g_P3DNameSpaceField; + + if (`window -query -exists $windowName`!=1) + { + window + -width 300 + -height 140 + -minimizeButton false + -maximizeButton false + -sizeable false + -title $windowName + $windowName; + + columnLayout + -adjustableColumn true + -columnAlign "left" + -cat "left" 5; + + text -l "NameSpace"; + $g_P3DNameSpaceField = `textField -width 200`; + + button + -label "Remove Selected" + -command "P3DRemoveNameSpaceTool_RemoveSelected()"; + button + -label "Remove Hierarchy" + -command "P3DRemoveNameSpaceTool_RemoveHierarchy()"; + + showWindow $windowName; + } +} + +P3DRemoveNameSpaceTool_GUICreate();
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/optimizeShaders.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/optimizeShaders.mel new file mode 100644 index 0000000..8ddc804 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/optimizeShaders.mel @@ -0,0 +1,1046 @@ +//=========================================================================== +// Copyright ©2002 Radical Entertainment Ltd. All rights reserved. +// +// Created: 17 April, 2002 +// +// Component: optimizeShaders.mel +// +// Description: Sorts file textures by their '.fileTextureName' attributes, +// and for those whose input file matches compares all input +// attributes to see if they can be considered equivalent. +// Equivalent file textures are "merged" so one serves the +// duties previously served by both. +// +// Materials and Shading Groups are evaluated and optimized +// in similar fashion. +// +// Constraints: +// +// Creator: Bryan Ewert +// +//=========================================================================== + + +//=========================================================================== +// version +//=========================================================================== +// Description: Returns the current version for this MEL script. +// Used for version control. +// +// Constraints: Used with assertCurrent(). +// +//=========================================================================== +proc float version() +{ + return ( 1.1 ); +} + +// //////////////////////////////////////////////////////////////// +// rootNode +// +// Description: Strips the dot-suffix of the specified string. +// e.g. "object.attribute" is returned as "object" +proc string rootNode( string $object ) +{ + string $buffer[]; + tokenize $object "." $buffer; + return $buffer[0]; +} + +//=========================================================================== +// hasInput +//=========================================================================== +// Description: Returns TRUE if specified attribute has an input connection. +// +// Constraints: +// +// Parameters: string $node: The node. +// string $attr: The attribute. +// +// Return: TRUE if specified attribute has an input connection; +// else FALSE. +// +//=========================================================================== +proc int hasInput( string $node, string $attr ) +{ + int $hasInput = false; + if ( `attributeQuery -node $node -exists $attr` ) + { + string $c[] = `listConnections -d false -s true ( $node + "." + $attr )`; + $hasInput = ( $c[0] != "" ); + } + return $hasInput; +} + +//=========================================================================== +// isMinorType +//=========================================================================== +// Description: Compares the type of the specified node against those in +// a static list. If the type matches it is considered a +// minor type. This is used to determine the "significance" +// of a connection to a node. If a node's connections serve +// only nodes of these types then it is assumed that the node +// may be safely deleted without impacting scene requirements. +// +// Constraints: +// +// Parameters: string $node: The node to evaluate. +// +// Return: (int): TRUE if specified node is a minor type; else FALSE. +// +//=========================================================================== +proc int isMinorType( string $node ) +{ + int $isMinorType = false; + + string $minorNodeTypes[] = + { + "defaultLightList", + "defaultRenderUtilityList", + "defaultShaderList", + "defaultTextureList", + "lightLinker", + "materialInfo", + "partition" + }; + + string $nodeType = `nodeType $node`; + + for ( $minor in $minorNodeTypes ) + { + if ( $minor == $nodeType ) + { + $isMinorType = true; + break; + } + } + + return $isMinorType; +} + +//=========================================================================== +// hasOnlyMinorOutputConnections +//=========================================================================== +// Description: Considers all output connections from the specified node +// and determines if all of them may be considered "minor." +// A minor connection is one which serves only the node in +// question and not other parts of the scene. If a node +// provides no connections to other significant nodes in the +// scene it may be considered safe to delete without impacting +// scene requirements. +// +// Constraints: +// +// Parameters: string $node: The node to evaluate. +// +// Return: (int): TRUE if all output connections are minor, or if node +// has no output connections; FALSE if at least one +// non-minor connection exists. +// +//=========================================================================== +proc int hasOnlyMinorOutputConnections( string $node ) +{ + int $onlyMinorTypes = true; + + string $outputs[] = `listConnections -s false -d true $node`; + for ( $c in $outputs ) + { + if ( !isMinorType( $c ) ) + { + $onlyMinorTypes = false; + break; + } + } + + return $onlyMinorTypes; +} + +//=========================================================================== +// safeDelete +//=========================================================================== +// Description: Deletes the specified node _only_ if it is considered to have +// little impact on the scene. +// +// All nodes providing input connections to the specified node +// are evaluated in iterative fashion. +// +// Constraints: +// +// Parameters: string $node: The node that will be deleted. +// +// Return: (none) +// +//=========================================================================== +proc safeDelete( string $node ) +{ + if ( `objExists $node` ) + { + string $inputs[] = `listConnections -s true -d false $node`; + + if ( hasOnlyMinorOutputConnections( $node ) ) + { + delete $node; + } + + for ( $i in $inputs ) + { + safeDelete( $i ); + } + } +} + +//=========================================================================== +// compareInt +//=========================================================================== +// Description: Performs an integer comparison for one attribute on +// two nodes. +// +// Constraints: This handles all "int" relatives; e.g. enum, short, bool. +// +// Parameters: string $node1: The first node. +// string $node2: The second node. +// string $attr: The attribute for both nodes which is compared. +// +// Return: (int): TRUE if attributes match; else FALSE. +// +//=========================================================================== +proc int compareInt( string $node1, string $node2, string $attr ) +{ + int $i1 = `getAttr ( $node1 + "." + $attr )`; + int $i2 = `getAttr ( $node2 + "." + $attr )`; + return ( $i1 == $i2 ); +} + +//=========================================================================== +// compareFloat +//=========================================================================== +// Description: Performs a float comparison for one attribute on +// two nodes. +// +// Constraints: This handles all "float" relatives; e.g. doubleAngle +// +// Parameters: string $node1: The first node. +// string $node2: The second node. +// string $attr: The attribute for both nodes which is compared. +// +// Return: (int): TRUE if attributes match; else FALSE. +// +//=========================================================================== +proc int compareFloat( string $node1, string $node2, string $attr ) +{ + float $f1 = `getAttr ( $node1 + "." + $attr )`; + float $f2 = `getAttr ( $node2 + "." + $attr )`; + return ( $f1 == $f2 ); +} + +//=========================================================================== +// compareFloat2 +//=========================================================================== +// Description: Performs a float2 comparison (i.e. array of two floats) +// for one attribute on two nodes. +// +// Constraints: +// +// Parameters: string $node1: The first node. +// string $node2: The second node. +// string $attr: The attribute for both nodes which is compared. +// +// Return: (int): TRUE if attributes match; else FALSE. +// +//=========================================================================== +proc int compareFloat2( string $node1, string $node2, string $attr ) +{ + float $f1[2] = `getAttr ( $node1 + "." + $attr )`; + float $f2[2] = `getAttr ( $node2 + "." + $attr )`; + return ( ( $f1[0] == $f2[0] ) && ( $f1[1] == $f2[1] ) ); +} + +//=========================================================================== +// compareFloat3 +//=========================================================================== +// Description: Performs a vector comparison for one attribute on +// two nodes. This would commonly be used to compare +// color attributes. +// +// Constraints: +// +// Parameters: string $node1: The first node. +// string $node2: The second node. +// string $attr: The attribute for both nodes which is compared. +// +// Return: (int): TRUE if attributes match; else FALSE. +// +//=========================================================================== +proc int compareFloat3( string $node1, string $node2, string $attr ) +{ + float $f1[3] = `getAttr ( $node1 + "." + $attr )`; + float $f2[3] = `getAttr ( $node2 + "." + $attr )`; + return ( ( $f1[0] == $f2[0] ) && ( $f1[1] == $f2[1] ) && ( $f1[2] == $f2[2] ) ); +} + +//=========================================================================== +// compareString +//=========================================================================== +// Description: Performs a string comparison for one attribute on +// two nodes. +// +// Constraints: +// +// Parameters: string $node1: The first node. +// string $node2: The second node. +// string $attr: The attribute for both nodes which is compared. +// +// Return: (int): TRUE if attributes match; else FALSE. +// +//=========================================================================== +proc int compareString( string $node1, string $node2, string $attr ) +{ + string $s1 = `getAttr ( $node1 + "." + $attr )`; + string $s2 = `getAttr ( $node1 + "." + $attr )`; + return ( $s1 == $s2 ); +} + +//=========================================================================== +// compareConnections +//=========================================================================== +// Description: Compares the connections for one attribute on two nodes. +// +// If neither attribute is connected, the attributes match. +// +// If one attribute is connected but the other is not, then +// the attributes do not match. +// +// If both attributes are connected there is a match only if +// both connections are to the same node. +// +// Constraints: +// +// Parameters: string $node1: The first node. +// string $node2: The second node. +// string $attr: The attribute for both nodes which is compared. +// +// Return: (int): TRUE if attributes match; else FALSE. +// +//=========================================================================== +proc int compareConnections( string $node1, string $node2, string $attr ) +{ + // If neither has this attribute, consider it a match. + if ( !`attributeQuery -node $node1 -exists $attr` && !`attributeQuery -node $node2 -exists $attr` ) + { + return true; + } + + // If one has the attribute, but the other doesn't, no match. + if ( + ( `attributeQuery -node $node1 -exists $attr` && !`attributeQuery -node $node2 -exists $attr` ) || + ( !`attributeQuery -node $node1 -exists $attr` && `attributeQuery -node $node2 -exists $attr` ) + ) + { + return false; + } + + string $c1[] = `listConnections -d false -s true ( $node1 + "." + $attr )`; + string $c2[] = `listConnections -d false -s true ( $node2 + "." + $attr )`; + + // TRUE if neither or connected, or both are connected to the same node. + return ( $c1[0] == $c2[0] ); +} + +//=========================================================================== +// compareAttributes +//=========================================================================== +// Description: Compares the value for one attribute on two nodes. +// The attribute type is used to determine the type of +// comparison performed. The attribute must exist on both +// nodes, and the attribute type must be the same for both +// nodes, else the two do not match. +// +// Constraints: +// +// Parameters: string $node1: The first node. +// string $node2: The second node. +// string $attr: The attribute for both nodes which is compared. +// +// Return: (int): TRUE if attributes match; else FALSE. +// +//=========================================================================== +proc int compareAttributes( string $node1, string $node2, string $attr ) +{ + int $isEqual = true; + + // If neither has this attribute, consider it a match. + if ( !`attributeQuery -node $node1 -exists $attr` && !`attributeQuery -node $node2 -exists $attr` ) + { + // Some objects have different attributes than others (e.g. lambert and layered shaders) +// warning( "! Attributes don't exist in compareAttributes( " + $node1 + ", " + $node2 + " ) !" ); + return true; + } + + // If one has the attribute, but the other doesn't, no match. + if ( + ( `attributeQuery -node $node1 -exists $attr` && !`attributeQuery -node $node2 -exists $attr` ) || + ( !`attributeQuery -node $node1 -exists $attr` && `attributeQuery -node $node2 -exists $attr` ) + ) + { + // This would be a bug. The script should take care that this will not happen. + warning( "! Attribute mismatch in compareAttributes( " + $node1 + ", " + $node2 + " ) !" ); + return false; + } + + // If one is connected but the other isn't, don't consider them equal. + if ( ( hasInput( $node1, $attr ) && !hasInput( $node2, $attr ) ) || + ( !hasInput( $node1, $attr ) && hasInput( $node2, $attr ) ) + ) + { +// warning( "! Connection mismatch in compareAttributes( " + $node1 + ", " + $node2 + " ) !" ); + return false; + } + + string $attrType1 = `getAttr -type ( $node1 + "." + $attr )`; + string $attrType2 = `getAttr -type ( $node2 + "." + $attr )`; + + if ( $attrType1 != $attrType2 ) return false; + + switch ( $attrType1 ) + { + case "bool": + case "enum": + case "short": + { + $isEqual = compareInt( $node1, $node2, $attr ); + break; + } + case "doubleAngle": + case "float": + { + $isEqual = compareFloat( $node1, $node2, $attr ); + break; + } + case "float2": + { + $isEqual = compareFloat2( $node1, $node2, $attr ); + break; + } + case "float3": + { + // As if this will work... likely a colour attribute and + // this will just compare black to black. + $isEqual = compareFloat3( $node1, $node2, $attr ); + break; + } + case "string": + { + $isEqual = compareString( $node1, $node2, $attr ); + break; + } + default: + { + error ( "Unsupported attribute type: " + $attrType1 ); + break; + } + } + + return $isEqual; +} + +//=========================================================================== +// mergeShadingGroup +//=========================================================================== +// Description: The two Shading Groups have been deemed to be equal. +// The members for the latter are assigned to the former and +// the latter is deleted from the scene. +// +// Constraints: +// +// Parameters: string $sg1: The Shading Group to keep. +// string $sg2: The Shading Group to discard. +// +// Return: (none) +// +//=========================================================================== +proc mergeShadingGroup( string $sg1, string $sg2 ) +{ + string $members[] = `sets -q $sg2`; + if ( `size $members` > 0 ) // just to avert useless Maya warning + { + sets -forceElement $sg1 $members; + } + safeDelete( $sg2 ); +} + +//=========================================================================== +// compareShadingGroups +//=========================================================================== +// Description: Compares the connections and attributes for two specified +// Shading Groups and evaluates if they can be considered +// equivalent. If equivalent, the two are merged. +// +// Constraints: If the two Shading Groups are equal, $sg2 will likely be +// deleted from the scene and will not exist when this function +// call returns. +// +// Parameters: string $sg1: The first Shading Group. +// string $sg2: The second Shading Group. +// +// Return: (int): TRUE if the two Shading Groups are equal; else FALSE. +// If TRUE it is likely that $sg2 was deleted. +// +//=========================================================================== +proc int compareShadingGroups( string $sg1, string $sg2 ) +{ + int $isEqual = true; + + // Has same alpha? + $isEqual = $isEqual && compareConnections( $sg1, $sg2, "surfaceShader" ); + + $isEqual = $isEqual && compareConnections( $sg1, $sg2, "volumeShader" ); + + $isEqual = $isEqual && compareConnections( $sg1, $sg2, "displacementShader" ); + + $isEqual = $isEqual && compareAttributes( $sg1, $sg2, "memberWireframeColor" ); + + if ( $isEqual ) + { + mergeShadingGroup( $sg1, $sg2 ); + } + + return $isEqual; +} + +//=========================================================================== +// mergeMaterial +//=========================================================================== +// Description: The two Materials have been deemed to be equal. +// The former adopts the output connections for the latter and +// the latter is deleted from the scene. +// +// Constraints: +// +// Parameters: string $sg1: The Material to keep. +// string $sg2: The Material to discard. +// +// Return: (none) +// +//=========================================================================== +proc mergeMaterial( string $mat1, string $mat2 ) +{ + string $c1[] = `listConnections ( $mat1 + ".outColor" )`; + string $c2[] = `listConnections ( $mat2 + ".outColor" )`; + + // If no connection, or if connections are already the same, take no action. + if ( ( $c1[0] != "" && $c2[0] != "" ) && ( $c1[0] != $c2[0] ) ) + { + // Deprecate and delete $mat2 + string $cc[] = `listConnections -source false -d true -plugs true ( $mat2 + ".outColor" )`; + disconnectAttr ( $mat2 + ".outColor" ) $cc[0]; + + connectAttr ( $mat1 + ".outColor" ) $cc[0]; + + safeDelete( $mat2 ); + } +} + +//=========================================================================== +// compareMaterials +//=========================================================================== +// Description: Compares the connections and attributes for two specified +// Materials and evaluates if they can be considered +// equivalent. If equivalent, the two are merged. +// +// Constraints: If the two Materials are equal, $mat2 will likely be +// deleted from the scene and will not exist when this function +// call returns. +// +// Parameters: string $mat1: The first Material. +// string $mat2: The second Material. +// +// Return: (int): TRUE if the two Materials are equal; else FALSE. +// If TRUE it is likely that $mat2 was deleted. +// +//=========================================================================== +proc int compareMaterials( string $mat1, string $mat2 ) +{ + int $isEqual = true; + + $isEqual = $isEqual && compareConnections( $mat1, $mat2, "color" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "color" ); + + $isEqual = $isEqual && compareConnections( $mat1, $mat2, "transparency" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "transparency" ); + + $isEqual = $isEqual && compareConnections( $mat1, $mat2, "ambient" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "ambient" ); + + $isEqual = $isEqual && compareConnections( $mat1, $mat2, "diffuse" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "diffuse" ); + + $isEqual = $isEqual && compareConnections( $mat1, $mat2, "emissive" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "emissive" ); + + $isEqual = $isEqual && compareConnections( $mat1, $mat2, "specular" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "specular" ); + + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "shininess" ); + + // Pure3D attributes + // '.pddiShaderName' will short-circuit the remainder if shader types aren't equal. + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "pddiShaderName" ); + + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "alphaCompare" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "alphaTest" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "blendMode" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "doubleSided" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "dynamicallyLit" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "filterMode" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "isLightMapped" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "isLit" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "isTranslucent" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "K" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "L" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "mipmapmax" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "mipmapmin" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "mmsharpness" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "prelightMode" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "proceduralXRes" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "proceduralYRes" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "shadeMode" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "shininess" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "uvMode" ); + $isEqual = $isEqual && compareAttributes( $mat1, $mat2, "vertexShaderName" ); + + if ( $isEqual ) + { + // Navigate to each Material and compare them. + string $out1[] = `listConnections ( $mat1 + ".outColor" )`; + string $out2[] = `listConnections ( $mat2 + ".outColor" )`; + + mergeMaterial( $mat1, $mat2 ); + + compareShadingGroups( $out1[0], $out2[0] ); + } + + return $isEqual; +} + +//=========================================================================== +// mergeFile +//=========================================================================== +// Description: The two file textures have been deemed to be equal. +// The former adopts the output connections for the latter and +// the latter is deleted from the scene. +// +// Constraints: +// +// Parameters: string $file1: The file texture to keep. +// string $file2: The file texture to discard. +// +// Return: (none) +// +//=========================================================================== +proc mergeFile( string $file1, string $file2 ) +{ + string $c1[] = `listConnections ( $file1 + ".outColor" )`; + string $c2[] = `listConnections ( $file2 + ".outColor" )`; + + // If no connection, or if connections are already the same, take no action. + if ( ( $c1[0] != "" && $c2[0] != "" ) && ( $c1[0] != $c2[0] ) ) + { + string $cc[] = `listConnections -source false -d true -plugs true ( $file2 + ".outColor" )`; + disconnectAttr ( $file2 + ".outColor" ) $cc[0]; + + connectAttr ( $file1 + ".outColor" ) $cc[0]; + + safeDelete( $file2 ); + } +} + +//=========================================================================== +// compareFiles +//=========================================================================== +// Description: Compares the connections and attributes for two specified +// file textures and evaluates if they can be considered +// equivalent. If equivalent, the two are merged. +// +// Constraints: If the two file textures are equal, $file2 will likely be +// deleted from the scene and will not exist when this function +// call returns. +// +// Parameters: string $file1: The first file texture. +// string $file2: The second file texture. +// +// Return: (int): TRUE if the two file textures are equal; else FALSE. +// If TRUE it is likely that $file2 was deleted. +// +//=========================================================================== +global proc int compareFiles( string $file1, string $file2 ) +{ + int $isEqual = true; + + // Compare place2d attributes + $isEqual = $isEqual && compareAttributes( $file1, $file2, "coverage" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "mirror" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "noiseUV" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "offset" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "uvFilterSize" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "repeatUV" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "rotateFrame" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "rotateUV" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "stagger" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "translateFrame" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "wrapU" ); + $isEqual = $isEqual && compareAttributes( $file1, $file2, "wrapV" ); + + if ( $isEqual ) + { + // Navigate to each Material and compare them. + string $out1[] = `listConnections ( $file1 + ".outColor" )`; + string $out2[] = `listConnections ( $file2 + ".outColor" )`; + + mergeFile( $file1, $file2 ); + + if ( $out1[0] != "" && $out2[0] != "" ) + { + $isEqual = compareMaterials( $out1[0], $out2[0] ); + } + } + + return $isEqual; +} + +//=========================================================================== +// getSortedShadingGroups +//=========================================================================== +// Description: It is only relevant to compare two Shading Groups for merging +// if they share the same Surface Shader. This returns an array +// of all Shading Groups sorted by the names of the nodes +// connected to their .surfaceShader inputs. +// +// Constraints: +// +// Parameters: (none) +// +// Return: (string[]): Array of all Shading Groups, sorted by their +// '.surfaceShader' inputs. +// +//=========================================================================== +proc string[] getSortedShadingGroups() +{ + string $allShadingGroups[]; + + string $shadingGroups[] = `ls -type "shadingEngine"`; + + for ( $f in $shadingGroups ) + { + string $cc[] = `listConnections -d false -s true ( $f + ".surfaceShader" )`; + $allShadingGroups[`size $allShadingGroups`] = ( $cc[0] + "*" + $f ); + } + + $allShadingGroups = `sort $allShadingGroups`; + clear $shadingGroups; + + for ( $f in $allShadingGroups ) + { + string $tokens[]; + tokenize $f "*" $tokens; + + $shadingGroups[`size $shadingGroups`] = $tokens[1]; + } + + return $shadingGroups; +} + +//=========================================================================== +// getSortedMaterials +//=========================================================================== +// Description: It is only relevant to compare two Materials for merging +// if they share the same Color connection. This returns an +// array of all Materials sorted by the names of the nodes +// connected to their .color inputs. +// +// Constraints: +// +// Parameters: (none) +// +// Return: (string[]): Array of all Materials, sorted by their +// '.color' inputs. +// +//=========================================================================== +proc string[] getSortedMaterials() +{ + string $allMaterials[]; + + string $materials[] = `ls -materials`; + + for ( $f in $materials ) + { + string $cc[] = `listConnections -d false -s true ( $f + ".color" )`; + $allMaterials[`size $allMaterials`] = ( $cc[0] + "*" + $f ); + } + + $allMaterials = `sort $allMaterials`; + clear $materials; + + for ( $f in $allMaterials ) + { + string $tokens[]; + tokenize $f "*" $tokens; + + $materials[`size $materials`] = $tokens[1]; + } + + return $materials; +} + +//=========================================================================== +// getSortedFileTextures +//=========================================================================== +// Description: It is only relevant to compare two file textures for merging +// if they share the same input file. This returns an array +// of all file textures sorted by the names of their source +// files, obtained from the '.fileTextureName' attribute. +// +// Constraints: +// +// Parameters: (none) +// +// Return: (string[]): Array of all file textures, sorted by their +// '.fileTextureName' inputs. +// +//=========================================================================== +proc string[] getSortedFileTextures() +{ + string $allFiles[]; + + string $files[] = `ls -type "file"`; + + for ( $f in $files ) + { + string $ftn = `getAttr ( $f + ".fileTextureName" )`; + $allFiles[`size $allFiles`] = ( $ftn + "*" + $f ); + } + + $allFiles = `sort $allFiles`; + clear $files; + + for ( $f in $allFiles ) + { + string $tokens[]; + tokenize $f "*" $tokens; + + $files[`size $files`] = $tokens[1]; + } + + return $files; +} + +//=========================================================================== +// optimizeShadingGroups +//=========================================================================== +// Description: Entry point to optimize Shading Groups. +// +// Constraints: Will not attempt to merge Materials that could serve to +// optimize Shading Groups. Only Shading Groups already sharing +// a common Material will be merged. +// +// Parameters: (none) +// +// Return: (none) +// +//=========================================================================== +proc optimizeShadingGroups() +{ + waitCursor -state on; + + string $sgs[] = getSortedShadingGroups(); + + int $startSG = `size $sgs`; + + int $f; + for ( $f = 0; $f < `size $sgs` - 1; $f++ ) + { + // Previous optimization may have deleted this node + string $sg1 = ""; + while ( $f < `size $sgs` - 1 ) + { + if ( `objExists $sgs[$f]` ) + { + $sg1 = $sgs[$f]; + break; + } + + $f++; + } + + if ( $sg1 == "" ) break; + + string $sg2 = $sgs[$f+1]; + + compareShadingGroups( $sg1, $sg2 ); + } + + $sgs = `ls -type "shadingEngine"`; + int $endSG = `size $sgs`; + + print ( "optimizeShadingGroups removed " + ( $startSG- $endSG ) + " shadingGroups.\n" ); + + waitCursor -state off; +} + +//=========================================================================== +// optimizeMaterials +//=========================================================================== +// Description: Entry point to optimize Materials. +// +// Constraints: Will not attempt to merge file textures that could serve to +// optimize Materials. Only Materials already sharing a +// common file texture node will be merged. +// +// Parameters: (none) +// +// Return: (none) +// +//=========================================================================== +global proc optimizeMaterials() +{ + waitCursor -state on; + + string $materials[] = getSortedMaterials(); + int $startCount = `size $materials`; + + int $f; + for ( $f = 0; $f < `size $materials` - 1; $f++ ) + { + // Previous optimization may have deleted this node + string $mat1 = ""; + while ( $f < `size $materials` - 1 ) + { + if ( `objExists $materials[$f]` ) + { + $mat1 = $materials[$f]; + break; + } + + $f++; + } + + if ( $mat1 == "" ) break; + + string $mat2 = $materials[$f+1]; + + compareMaterials( $mat1, $mat2 ); + } + + $materials = `ls -materials`; + int $endCount = `size $materials`; + + print ( "optimizeMaterials removed " + ( $startCount - $endCount ) + " materials.\n" ); + + waitCursor -state off; +} + +//=========================================================================== +// optimizeFileTextures +//=========================================================================== +// Description: Entry point to optimize file textures. +// +// Constraints: +// +// Parameters: (none) +// +// Return: (none) +// +//=========================================================================== +global proc optimizeFileTextures() +{ + waitCursor -state on; + + string $files[] = getSortedFileTextures(); + string $materials[] = `ls -materials`; + string $sgs[] = `ls -type "shadingEngine"`; + + int $startFiles = `size $files`; + int $startMaterials = `size $materials`; + int $startSG = `size $sgs`; + + int $f; + for ( $f = 0; $f < `size $files` - 1; $f++ ) + { + // Previous optimization may have deleted this node + string $file1 = $files[$f]; + $file2 = ""; + + if ( !`objExists $file1` ) continue; + + int $g = $f+1; + while ( $g < `size $files` - 1 ) + { + if ( `objExists $files[$g]` ) + { + $file2 = $files[$g]; + break; + } + + $g++; + } + + if ( $file1 != "" && $file2 != "" ) + { + string $ftn1 = `getAttr( $file1 + ".fileTextureName" )`; + string $ftn2 = `getAttr( $file2 + ".fileTextureName" )`; + + if ( $ftn1 == $ftn2 ) + { + $isEqual = compareFiles( $file1, $file2 ); + } + } + } + + $files = `ls -type "file"`; + $materials = `ls -materials`; + $sgs = `ls -type "shadingEngine"`; + + int $endFiles = `size $files`; + int $endMaterials = `size $materials`; + int $endSG = `size $sgs`; + + print ( "optimizeFileTextures removed: " + ( $startFiles - $endFiles ) + " file textures; " + ( $startMaterials - $endMaterials ) + " materials; " + ( $startSG - $endSG ) + " shadingGroups.\n" ); + + waitCursor -state off; +} + +//=========================================================================== +// optimizeShaders +//=========================================================================== +// Description: Sorts file textures by their '.fileTextureName' attributes, +// and for those whose input file matches compares all input +// attributes to see if they can be considered equivalent. +// Equivalent file textures are "merged" so one serves the +// duties previously served by both. +// +// Materials and Shading Groups are evaluated and optimized +// in similar fashion. +// +// Constraints: Note that optimizing file textures implies optimization for +// the Material connected to the optimized file texture, which +// consequently optimizes the Shading Groups connected to +// the optimized Material. +// +// It is not uncommon that the optimizeMaterials() and +// optimizeShadingGroups() calls here will yield no additional +// results after optimizeFileTextures() has completed its run. +// +// Parameters: (none) +// +// Return: (none) +// +//=========================================================================== +global proc optimizeShaders() +{ + optimizeFileTextures(); + optimizeMaterials(); + optimizeShadingGroups(); +} + +/* +source optimizeShaders; optimizeShaders; +*/ diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/renameScripts.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/renameScripts.mel new file mode 100644 index 0000000..88045b8 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/renameScripts.mel @@ -0,0 +1,313 @@ +// Rename Shape and BV node +// Alias|Wavefront Script File +// +// Creation Date: 2001 +// Author: (Novy) Gurdarshan Dhillon +// +// +// +// Description: +// Rename the transform, shape, and BV nodes in a hierarchy +// to a specified name. +// +// +// +// Input Arguments: +// None. +// Return Values: +// None. +// renameShape +// + +global proc renameShape(string $newName) +{ + if (`size($newName)`>0) + { + string $objects[] = `ls -sl`; + + for ($object in $objects) + { + string $children[]; + clear ($children); + int $count = 1; + int $count2 = 1; + if(`nodeType $object` == "transform") + { + $object = `rename $object $newName`; + print ("\nTopnode : " + $object); + //for each object in list get the sub objects. + $children = `listRelatives -ad -pa $object`; + } + if(`nodeType $object` == "joint") + { + $children[0]= $object; + } + for($child in $children) + { + // check if the subobjects are transform and continue + string $postfix = ""; + if(`nodeType $child` == "transform") + { + print ("\nTransform : " + $child); + $child = `rename $child ($newName + $count)`; + string $shapes[] = `listRelatives -s $child`; + for ($shape in $shapes) + { + if(`nodeType $shape` == "mesh") + { + print ("\nMesh : " + $shape); + rename $shape ($newName + $count + "Shape"); + } + } + $count++; + } + // check if the sub objects are joints and continue + else if(`nodeType $child` == "joint") + { + print ("\nTransform : " + $child); + $child = `rename $child ($newName + $count + "_BV")`; + string $shapes[] = `listRelatives -s $child`; + for ($shape in $shapes) + { + if(`nodeType $shape` == "p3dBoundVolShape") + { + print ("\nMesh : " + $shape); + rename $shape ($newName + $count + "_BV" + "Shape"); + } + } + $count++; + } + } + } + } +} + + +// Rename Texture node +// Alias|Wavefront Script File +// +// Creation Date: 20 March. 2001 +// Author: (Novy) Gurdarshan Dhillon +// +// +// +// Description: +// Renames the texture node to corrisponde to the +// image file that it contains. Also outputs the +// images resolution. +// +// +// +// Input Arguments: +// None. +// Return Values: +// None. +// renameTexture +// + +global proc renameTexture() +{ + string $files[] = `ls -type "file"`; + string $imageName; + print ("\nRename Info"); + for ($file in $files) + { + print ("\n-------------------------------------"); + $imageName = `getAttr ($file + ".fileTextureName")`; + string $path[]; + string $token[]; + tokenize $imageName "/" $path; + tokenize $path[(`size $path` -1)] "." $token; + $file = `rename $file ($token[0] + "_t")`; + string $fileConnections[] = `listConnections ($file + ".outColor")`; + + float $res[] = `getAttr ($file + ".outSize")`; + print ("\nFile: " + $imageName + " " + $res[0] + " × " + $res[1]); + print ("\nFile Texture Node: " + $file); + for ($con in $fileConnections) + { + string $match1; + string $match2; + string $nodeType = `nodeType $con`; + $match1 = `match "Texture" $nodeType`; + $match2 = `match "Shader" $nodeType`; + if (`size $match1` > 0) + { + if(`nodeType $con` == "layeredTexture") + { + string $layeredShaderColor1Con[] = `listConnections ($con + ".inputs[0].color")`; + if(`nodeType $layeredShaderColor1Con[0]` == "file") + { + string $image = `getAttr ($layeredShaderColor1Con[0] + ".fileTextureName")`; + string $path[]; + string $token[]; + int $size = `tokenize $image "/" $path`; + tokenize $path[$size -1] "." $token; + $con = `rename $con ($token[0] + "_layered")`; + print ("\nLayered Texture Node: " + $con); + } + } + } + else if (`size $match2` > 0) + { + string $shadingEngines[]; + string $token[]; + if(`nodeType $con` == "pure3dLayeredShader") + { + string $layeredShaderColor1Con[] = `listConnections ($con + ".bottomtex")`; + if(`nodeType $layeredShaderColor1Con[0]` == "file") + { + string $image = `getAttr ($layeredShaderColor1Con[0] + ".fileTextureName")`; + string $path[]; + int $size = `tokenize $image "/" $path`; + tokenize $path[$size -1] "." $token; + $con = `rename $con ($token[0] + "_m")`; + $shadingEngines = `listConnections ($con + ".outColor")`; + print ("\nMaterial Node: " + $con); + } + } + else + { + string $layeredShaderColor1Con[] = `listConnections ($con + ".color")`; + if(`nodeType $layeredShaderColor1Con[0]` == "file") + { + string $image = `getAttr ($layeredShaderColor1Con[0] + ".fileTextureName")`; + string $path[]; + int $size = `tokenize $image "/" $path`; + tokenize $path[$size -1] "." $token; + $con = `rename $con ($token[0] + "_m")`; + $shadingEngines = `listConnections ($con + ".outColor")`; + print ("\nMaterial Node: " + $con); + } + } + for ($se in $shadingEngines) + { + $se = `rename $se ($token[0] + "_shg")`; + print ("\nShading Engine: " + $se); + } + } + } + } +} + + +global proc fileRes() +{ + string $textures[] = `ls -type "file"`; + for($texture in $textures) + { + string $attr = $texture + ".fileTextureName"; + string $file = `getAttr $attr`; + string $attr = $texture + ".outSize"; + float $res[] = `getAttr $attr`; + print ("\n" + $file + " " + $res[0] + " × " + $res[1]); + } +} + +global proc removeShapefromNode() +{ + string $transforms[] = `ls -sl -tr -l`; + if(size($transforms)) + { + for($transform in $transforms) + { + string $relatives[] = `listRelatives -ad -f $transform`; + if (size($relatives)) + { + for ($child in $relatives) + { + if(`nodeType($child)` == "mesh") + { + string $path[]; + int $num = `tokenize $child "|" $path`; + rename $child $path[$num-2]; + } + } + } + else + { + error("Empty Transform Node!"); + + } + } + } + else + {error ("Please select a transform node.");} +} + +global proc renameTextureOld() +{ + string $textures[] = `ls -type "file" -type "ramp"`; + for($texture in $textures) + { + string $attr; + string $image[]; + string $file; + int $num; + int $size; + string $name; + string $fileNode; + if (`nodeType $texture` == "file") + { + $attr = $texture + ".fileTextureName"; + $file = `getAttr $attr`; + + $num = `tokenize $file "/" $image`; + $num = `tokenize $image[$num-1] "." $image`; + $attr = $texture + ".outSize"; + float $res[] = `getAttr $attr`; + print ("\nFile: " + $file + " " + $res[0] + " × " + $res[1]); + $size = size($image[0]); + $name = `substring $image[0] 1 ($size)`; + $fileNode = `rename $texture ($name + "_t")`; + print ("\nFileNode: " + $fileNode); + } + else if(`nodeType $texture` == "ramp") + { + print ("ramp " + $texture); + $image[0] = $texture; + $fileNode = $texture; + } + $attr = $fileNode + ".outColor"; + string $shaders[] = `listConnections -d 1 -s 0 $attr`; + // string $shader = $shaders[(size($shaders)-1)]; + for ($shader in $shaders) + { + if ($shader != "lambert1" || $shader != "particleCloud1") + { + string $colorCon[]; + if (`nodeType $shader` != "layeredTexture") + { + $colorCon = `listConnections ($shader + ".color")`; + //if (size($colorCon[0]) > 0) + { + $name = $image[0] + "_m"; + } + } + else + { + $colorCon = `listConnections ($shader + ".inputs[0].color")`; + if (size($colorCon[0]) > 0) + { + $name = $image[0] + "_layered"; + } + } + + string $shadeNode = `rename $shader ($name)`; + print ("\nShading Node: " + $shadeNode); + $attr = $shadeNode + ".outColor"; + string $engines[] = `listConnections -d 1 -s 0 $attr`; + if (size($engines)) + { + for ($engine in $engines) + { + $name = $image[0] + "_shg"; + string $engineNode = `rename $engine ($name)`; + print ("\nShading Engine: " + $engineNode); + } + } + } + } + print ("\n----------------------------------------\n"); + } +} diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/renameTexture.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/renameTexture.mel new file mode 100644 index 0000000..4cf0db4 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/renameTexture.mel @@ -0,0 +1,94 @@ +// renameTexture.mel +// Rename Texture node +// Alias|Wavefront Script File +// +// Creation Date: 20 March. 2001 +// Author: (Novy) Gurdarshan Dhillon +// +// +// +// Description: +// Renames the texture node to corrisponde to the +// image file that it contains. Also outputs the +// images resolution. +// +// +// +// Input Arguments: +// None. +// Return Values: +// None. +// renameTexture +// + + +global proc renameTexture() +{ + string $textures[] = `ls -type "file" -type "ramp"`; + for($texture in $textures) + { + string $attr; + string $image[]; + string $file; + int $num; + int $size; + string $name; + string $fileNode; + if (`nodeType $texture` == "file") + { + $attr = $texture + ".fileTextureName"; + $file = `getAttr $attr`; + + $num = `tokenize $file "/" $image`; + $num = `tokenize $image[$num-1] "." $image`; + $attr = $texture + ".outSize"; + float $res[] = `getAttr $attr`; + print ("\nFile: " + $file + " " + $res[0] + " × " + $res[1]); + $size = size($image[0]); + $name = `substring $image[0] 1 ($size)`; + $fileNode = `rename $texture ($name + "_t")`; + print ("\nFileNode: " + $fileNode); + } + else if(`nodeType $texture` == "ramp") + { + print ("ramp " + $texture); + $image[0] = $texture; + $fileNode = $texture; + } + $attr = $fileNode + ".outColor"; + string $shaders[] = `listConnections -d 1 -s 0 -p 1 $attr`; + // string $shader = $shaders[(size($shaders)-1)]; + for ($shader in $shaders) + { + string $info[]; tokenize $shader "." $info; + if($info[1] == "color") + { + $name = $image[0] + "_m"; + string $shadeNode = `rename $info[0] ($name)`; + print ("\nShading Node: " + $shadeNode); + $attr = $shadeNode + ".outColor"; + string $engines[] = `listConnections -d 1 -s 0 $attr`; + for ($engine in $engines) + { + $name = $image[0] + "_shg"; + string $engineNode = `rename $engine ($name)`; + print ("\nShading Engine: " + $engineNode); + } + } + } + print ("\n----------------------------------------\n"); + } +} + +global proc fileRes() +{ + string $textures[] = `ls -type "file"`; + for($texture in $textures) + { + string $attr = $texture + ".fileTextureName"; + string $file = `getAttr $attr`; + string $attr = $texture + ".outSize"; + float $res[] = `getAttr $attr`; + print ("\n" + $file + " " + $res[0] + " × " + $res[1]); + } +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/replaceSimpleShaderWithLambert.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/replaceSimpleShaderWithLambert.mel new file mode 100644 index 0000000..7f56139 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/replaceSimpleShaderWithLambert.mel @@ -0,0 +1,152 @@ +//=========================================================================== +// Copyright ©2002 Radical Entertainment Ltd. All rights reserved. +// +// Created: 11 April, 2002 +// +// Component: replaceSimpleShaderWithLambert.mel +// +// Description: Replaces all pure3dSimpleShaders with Maya's lambert. +// +// Constraints: Attributes that map 1:1 are restored; anything else isn't. +// +// Creator: Bryan Ewert +// +//=========================================================================== + +proc string rootNode( string $object ) +{ + string $buffer[]; + tokenize $object "." $buffer; + return $buffer[0]; +} + +//=========================================================================== +// arrayMatch +//=========================================================================== +// Description: This is copied directly from Maya's "replaceNode.mel" +// +//=========================================================================== +proc int arrayMatch( string $array[], string $match ) +{ + for ($item in $array) + if ($item == $match) + return true; + + return false; +} + +//=========================================================================== +// myReplaceNode +//=========================================================================== +// Description: This is mostly copied directly from Maya's "replaceNode.mel" +// +// As is usual with Maya scripts, it spewed unnecessary warnings +// when connections were automatically disconnected or +// reconnected, and I just don't like Script Editor spew when +// nothing is actually wrong. +// +// All that I changed was to replace the catch() wrappers with +// less verbose isConnected() wrappers. +// +//=========================================================================== +proc myReplaceNode( string $originalNode, string $replaceNode ) +{ + // Copy the scalar values + + string $originalAttrs[] = + `listAttr -scalar -multi -read -visible $originalNode`; + + string $replaceAttrs[] = + `listAttr -scalar -multi -write -visible $replaceNode`; + + for ($attr in $originalAttrs) { + if (arrayMatch($replaceAttrs, $attr)) { + float $value = `getAttr ($originalNode+"."+$attr)`; + catch(`setAttr ($replaceNode+"."+$attr) $value`); + } + } + + string $connections[]; + + // Process the source connections + + $connections = `listConnections -source true -destination false + -connections true -plugs true $originalNode`; + + for ($i = 0; $i < size($connections); $i += 2) { + string $originalPlug = $connections[$i]; + string $srcPlug = $connections[$i+1]; + + string $replacePlug = + substitute($originalNode, $originalPlug, $replaceNode); + + catch(`connectAttr $srcPlug $replacePlug`); + } + + // Process the destination connections + + $connections = `listConnections -source false -destination true + -connections true -plugs true $originalNode`; + + for ($i = 0; $i < size($connections); $i += 2) { + string $originalPlug = $connections[$i]; + string $dstPlug = $connections[$i+1]; + + string $replacePlug = + substitute($originalNode, $originalPlug, $replaceNode); + + // First, break connections between original and dstPlug. + // Maya's 'replaceNode.mel' just wrapped this in a catch(), + // which spewed warnings if plug automatically disconnected + // due to a previous disconnect. + if ( `isConnected $originalPlug $dstPlug` ) + { + disconnectAttr $originalPlug $dstPlug; + } + + // Maya's 'replaceNode.mel' just wrapped this in a catch(), + // which spewed warnings if plug was automatically connected. + if ( !`isConnected $replacePlug $dstPlug` ) + { + connectAttr $replacePlug $dstPlug; + } + } +} + +//=========================================================================== +// replaceSimpleShaderWithLambert +//=========================================================================== +// Description: Replaces all pure3dSimpleShaders with Maya's lambert. +// +// Constraints: Attributes that map 1:1 are restored; anything else isn't. +// +// Parameters: (none) +// +// Return: (none) +// +//=========================================================================== +global proc replaceSimpleShaderWithLambert() +{ + string $ss[] = `ls -type "pure3dSimpleShader"`; + + for ( $shaderNode in $ss ) + { + string $alpha[] = `listConnections ( $shaderNode + ".transparency" )`; + + // This would be the desired Material type + string $replaceType = "lambert"; + + string $replaceWith = `createNode $replaceType`; + + myReplaceNode $shaderNode $replaceWith; + + delete $shaderNode; + + // Rename the new node to match the original. + rename $replaceWith $shaderNode; + } +} + +/* +source replaceSimpleShaderWithLambert; replaceSimpleShaderWithLambert; +*/ diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/replaceTex.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/replaceTex.mel new file mode 100644 index 0000000..19369cc --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/replaceTex.mel @@ -0,0 +1,38 @@ + +/* + | + | $Source: replaceTex.mel $ + | + | $Author: jschleifer $ + | $Revision: /main/1 $ + | $Date: 1997/11/06 10:46:33 $ + | + | Original Author: + | Jason Schleifer + | + | Description: + | Replaces strings in texture filenames. Works really well if you + | need to fix paths. + | + | Usage: + | replaceTex <old string> <new string> + | + | ex: + | + | replaceTex "/this/is/an/explicit/path" ""; + | +*/ + +global proc replaceTex (string $old, string $new) +{ + for ($item in `ls -type file`) + { + string $name = `getAttr ($item + ".fileTextureName")`; + $name = `substitute $old $name $new`; + print ("setAttr -type \"string\" " + $item + ".fileTextureName \"" + $name + "\";\n"); + $cmd = ("setAttr -type \"string\" " + $item + ".fileTextureName \"" + $name + "\";\n"); + + eval $cmd; + } + +} diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/rndPoints.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/rndPoints.mel new file mode 100644 index 0000000..7420382 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/rndPoints.mel @@ -0,0 +1,578 @@ +/* rndPoints V1.6 - Maya2.0 + +This script may be freely distributed. Modify at your own risk. + +Author: Dirk Bialluch (DirkBi@Software2000.de) + +Creation date: 21.12.98 +Last update: 15.10.00 + +Description: + Please refer to integrated help window. + +History: + V1.1 + NEW + -added lattice points and polygon vertices + V1.2 + NEW + -set world space axes + V1.3 + NEW + -store UI values + -transform mode added (world/object space) + -set intensity range + -use seed value checkbox added + -show min/max value + V1.4 + ENHANCED + -store UI values as soon as UI element changes + NEW + -randomize along normal, u & v tangent + V1.5 + FIXED + -"Use Seed Value" flag will now be recognized + NEW + -added threshold value for point randomization + V1.6 + CHANGED + -UI point count display removed, due to performance issues + ENHANCED + -poly vertices can now be randomized along the uv direction + NEW + -major UI update + -reset UI + -help window +*/ + +// +// Create UI ********************************************************************************** +// + +global proc rndPoints () +{ + // set select tool + global string $gSelect; + setToolTo $gSelect; + + int $uiLabelWidth = 140; + int $uiInputWidth = 240; + int $uiWidth = $uiLabelWidth + $uiInputWidth + 40; + + if (`window -exists rp_ui` == true) + deleteUI rp_ui; + + window + -maximizeButton 0 + -resizeToFitChildren 0 + -title "Randomize Points V1.6" + -iconName "Randomize Points" + -menuBar true + -menuBarVisible true + rp_ui; + menu + -label "Edit" + -tearOff false; + menuItem + -label "Reset Settings" + -c "rp_storeRecallUI reset; rndPoints"; + menu + -label "Help" + -tearOff 0; + menuItem + -label "Help with Randomize Points tool" + -c "rp_help 1"; + menuItem + -divider true; + menuItem + -label "Script Information" + -c "rp_help 2"; + + string $rp_form = `formLayout -numberOfDivisions 100`; + string $rp_scroll = `scrollLayout -hst 16 -vst 16 -childResizable true -minChildWidth $uiWidth`; + columnLayout -adjustableColumn true -rowSpacing 5; + frameLayout + -label "Settings" + -labelAlign "center" + -cll true + -lw $uiWidth + -mh 3 + -borderStyle "etchedIn" + -cc "rp_adjustUI nop" + -ec "rp_adjustUI nop" + -bv true + rp_sFrame; + columnLayout -adjustableColumn true; + rowLayout + -numberOfColumns 3 + -cat 1 "right" 5 + -columnWidth 1 $uiLabelWidth + -columnWidth 2 $uiInputWidth; + text -l "Intensity"; + floatSliderGrp + -field true + -precision 4 + -value .1 + -minValue 0 + -maxValue 1 + -fieldMinValue 0 + -fieldMaxValue 10000 + -sliderStep .1 + -cc "rp_adjustUI nop" + -dc "rp_adjustUI nop" + rp_intensity; + text -l "WS"; + setParent ..; + rowLayout + -numberOfColumns 3 + -cat 1 "right" 5 + -columnWidth 1 $uiLabelWidth + -columnWidth 2 $uiInputWidth; + text -l "Intensity Range"; + floatSliderGrp + -field true + -precision 4 + -value 0 + -minValue -100 + -maxValue 100 + -sliderStep 5 + -cc "rp_adjustUI nop" + -dc "rp_adjustUI nop" + rp_intensityRange; + text -l "-/+ %"; + setParent ..; + rowLayout + -numberOfColumns 4 + -cat 1 "right" 5 + -columnWidth 1 $uiLabelWidth + -columnWidth 2 ( $uiInputWidth / 2 ) + -columnWidth 3 ( $uiInputWidth / 2 ); + text -l "Min/Max Value"; + floatField + -w ( $uiInputWidth / 2 ) + -precision 4 + -editable false + rp_min; + floatField + -w ( $uiInputWidth / 2 ) + -precision 4 + -editable false + rp_max; + text -label "Info"; + setParent ..; + + separator -h 10; + + rowLayout + -numberOfColumns 3 + -cat 1 "right" 5 + -columnWidth 1 $uiLabelWidth + -columnWidth 2 $uiInputWidth; + text -l "Threshold"; + floatSliderGrp + -field true + -precision 4 + -value 0 + -minValue 0 + -maxValue 1 + -sliderStep .1 + -cc "rp_adjustUI nop" + -dc "rp_adjustUI nop" + rp_threshold; + text -l "0-1"; + setParent ..; + + separator -h 10; + + rowLayout + -numberOfColumns 2 + -cat 1 "right" 5 + -columnWidth 1 $uiLabelWidth + -columnWidth 2 $uiInputWidth; + text -label "Use Seed Value"; + checkBox + -label "" + -value true + -cc "rp_adjustUI nop" + rp_useSeed; + setParent ..; + rowLayout + -numberOfColumns 2 + -cat 1 "right" 5 + -columnWidth 1 $uiLabelWidth + -columnWidth 2 $uiInputWidth; + text -l "Seed Value"; + intSliderGrp + -field true + -value 1234 + -minValue 0 + -maxValue 99999 + -cc "rp_adjustUI nop" + rp_seed; + setParent ..; + + separator -h 10; + + rowLayout + -numberOfColumns 2 + -cat 1 "right" 5 + -columnWidth 1 $uiLabelWidth + -columnWidth 2 $uiInputWidth; + text + -label "Transform Mode"; + radioButtonGrp + -numberOfRadioButtons 3 + -cw 1 100 + -cw 2 105 + -labelArray3 "World Space" "Object Space" "Distance" + -select 1 + -cc "rp_adjustUI nop" + rp_transMode; + setParent ..; + + separator -h 10; + + rowLayout + -numberOfColumns 4 + -cat 1 "right" 5 + -columnWidth 1 $uiLabelWidth + -columnWidth 2 50 + -columnWidth 3 50; + text -label "Enable Axes"; + checkBox + -label "X" + -value true + -cc "rp_adjustUI nop" + rp_x; + checkBox + -label "Y" + -value true + -cc "rp_adjustUI nop" + rp_y; + checkBox + -label "Z" + -value true + -cc "rp_adjustUI nop" + rp_z; + setParent ..; + setParent ..; + setParent ..; + setParent ..; + setParent ..; + + button + -label "Randomize Points" + -command "rp_main" + rp_execButton; + + button + -label "Close" + -command "deleteUI rp_ui" + rp_closeButton; + + // set form layouts + formLayout -edit + -attachForm $rp_scroll "top" 2 + -attachForm $rp_scroll "left" 2 + -attachControl $rp_scroll "bottom" 2 rp_execButton + -attachForm $rp_scroll "right" 2 + + -attachNone rp_execButton "top" + -attachForm rp_execButton "left" 2 + -attachForm rp_execButton "bottom" 2 + -attachPosition rp_execButton "right" 2 50 + + -attachNone rp_closeButton "top" + -attachPosition rp_closeButton "left" 2 50 + -attachForm rp_closeButton "bottom" 2 + -attachForm rp_closeButton "right" 2 + $rp_form; + + rp_storeRecallUI recall; + + // check UI settings after restoring values + rp_adjustUI nop; + + showWindow rp_ui; +} + +global proc rp_storeRecallUI ( string $mode ) +{ + string $floatFieldList[] = { + }; + + string $intFieldList[] = { + }; + + string $optionMenuList[] = { + }; + + string $floatSliderGrpList[] = { + "rp_intensity", + "rp_intensityRange", + "rp_threshold" + }; + + string $intSliderGrpList[] = { + "rp_seed" + }; + + string $checkBoxList[] = { + "rp_useSeed", + "rp_x", + "rp_y", + "rp_z" + }; + + string $radioButtonGrpList[] = { + "rp_transMode" + }; + + string $frameLayoutList[] = { + "rp_sFrame" + }; + + int $cnt; + + if ( $mode == "store" ) + { + for ( $cnt = 0; $cnt < size( $floatFieldList ); $cnt++ ) + optionVar -floatValue $floatFieldList[$cnt] `floatField -q -value $floatFieldList[$cnt]`; + + for ( $cnt = 0; $cnt < size( $intFieldList ); $cnt++ ) + optionVar -intValue $intFieldList[$cnt] `intField -q -value $intFieldList[$cnt]`; + + for ( $cnt = 0; $cnt < size( $floatSliderGrpList ); $cnt++ ) + optionVar -floatValue $floatSliderGrpList[$cnt] `floatSliderGrp -q -value $floatSliderGrpList[$cnt]`; + + for ( $cnt = 0; $cnt < size( $intSliderGrpList ); $cnt++ ) + optionVar -intValue $intSliderGrpList[$cnt] `intSliderGrp -q -value $intSliderGrpList[$cnt]`; + + for ( $cnt = 0; $cnt < size( $checkBoxList ); $cnt++ ) + optionVar -intValue $checkBoxList[$cnt] `checkBox -q -value $checkBoxList[$cnt]`; + + for ( $cnt = 0; $cnt < size( $optionMenuList ); $cnt++ ) + optionVar -intValue $optionMenuList[$cnt] `optionMenu -q -select $optionMenuList[$cnt]`; + + for ( $cnt = 0; $cnt < size( $radioButtonGrpList ); $cnt++ ) + optionVar -intValue $radioButtonGrpList[$cnt] `radioButtonGrp -q -select $radioButtonGrpList[$cnt]`; + + for ( $cnt = 0; $cnt < size( $frameLayoutList ); $cnt++ ) + optionVar -intValue $frameLayoutList[$cnt] `frameLayout -q -collapse $frameLayoutList[$cnt]`; + } + + if ( $mode == "recall" ) + { + for ( $cnt = 0; $cnt < size( $floatFieldList ); $cnt++ ) + if ( `optionVar -exists $floatFieldList[$cnt]` ) + floatField -e -value `optionVar -q $floatFieldList[$cnt]` $floatFieldList[$cnt]; + + for ( $cnt = 0; $cnt < size( $intFieldList ); $cnt++ ) + if ( `optionVar -exists $intFieldList[$cnt]` ) + intField -e -value `optionVar -q $intFieldList[$cnt]` $intFieldList[$cnt]; + + for ( $cnt = 0; $cnt < size( $floatSliderGrpList ); $cnt++ ) + if ( `optionVar -exists $floatSliderGrpList[$cnt]` ) + floatSliderGrp -e -value `optionVar -q $floatSliderGrpList[$cnt]` $floatSliderGrpList[$cnt]; + + for ( $cnt = 0; $cnt < size( $intSliderGrpList ); $cnt++ ) + if ( `optionVar -exists $intSliderGrpList[$cnt]` ) + intSliderGrp -e -value `optionVar -q $intSliderGrpList[$cnt]` $intSliderGrpList[$cnt]; + + for ( $cnt = 0; $cnt < size( $checkBoxList ); $cnt++ ) + if ( `optionVar -exists $checkBoxList[$cnt]` ) + checkBox -e -value `optionVar -q $checkBoxList[$cnt]` $checkBoxList[$cnt]; + + for ( $cnt = 0; $cnt < size( $optionMenuList ); $cnt++ ) + if ( `optionVar -exists $optionMenuList[$cnt]` ) + optionMenu -e -select `optionVar -q $optionMenuList[$cnt]` $optionMenuList[$cnt]; + + for ( $cnt = 0; $cnt < size( $radioButtonGrpList ); $cnt++ ) + if ( `optionVar -exists $radioButtonGrpList[$cnt]` ) + radioButtonGrp -e -select `optionVar -q $radioButtonGrpList[$cnt]` $radioButtonGrpList[$cnt]; + + for ( $cnt = 0; $cnt < size( $frameLayoutList ); $cnt++ ) + if ( `optionVar -exists $frameLayoutList[$cnt]` ) + frameLayout -e -collapse `optionVar -q $frameLayoutList[$cnt]` $frameLayoutList[$cnt]; + } + + if ( $mode == "reset" ) + { + for ( $cnt = 0; $cnt < size( $floatFieldList ); $cnt++ ) + optionVar -remove $floatFieldList[$cnt]; + + for ( $cnt = 0; $cnt < size( $intFieldList ); $cnt++ ) + optionVar -remove $intFieldList[$cnt]; + + for ( $cnt = 0; $cnt < size( $floatSliderGrpList ); $cnt++ ) + optionVar -remove $floatSliderGrpList[$cnt]; + + for ( $cnt = 0; $cnt < size( $intSliderGrpList ); $cnt++ ) + optionVar -remove $intSliderGrpList[$cnt]; + + for ( $cnt = 0; $cnt < size( $checkBoxList ); $cnt++ ) + optionVar -remove $checkBoxList[$cnt]; + + for ( $cnt = 0; $cnt < size( $optionMenuList ); $cnt++ ) + optionVar -remove $optionMenuList[$cnt]; + + for ( $cnt = 0; $cnt < size( $radioButtonGrpList ); $cnt++ ) + optionVar -remove $radioButtonGrpList[$cnt]; + + for ( $cnt = 0; $cnt < size( $frameLayoutList ); $cnt++ ) + optionVar -remove $frameLayoutList[$cnt]; + } +} + +// +// Adjust UI settings +// + +global proc rp_adjustUI ( string $function ) +{ + if ( `checkBox -q -v rp_useSeed` ) + intSliderGrp -e -enable true rp_seed; + else + intSliderGrp -e -enable false rp_seed; + + if ( ( `checkBox -q -v rp_x` || `checkBox -q -v rp_y` || `checkBox -q -v rp_z` ) && `floatSliderGrp -q -value rp_intensity` ) + button -e -enable true rp_execButton; + else + button -e -enable false rp_execButton; + + if ( `radioButtonGrp -q -select rp_transMode` == 1 ) + floatSliderGrp -e -extraLabel "WS" rp_intensity; + else + floatSliderGrp -e -extraLabel "OS" rp_intensity; + + if ( `radioButtonGrp -q -select rp_transMode` == 3 ) + { + checkBox -e -label "U" rp_x; + checkBox -e -label "V" rp_y; + checkBox -e -label "N" rp_z; + } + else + { + checkBox -e -label "X" rp_x; + checkBox -e -label "Y" rp_y; + checkBox -e -label "Z" rp_z; + } + + // calculate min/max displacement value + float $intensity = `floatSliderGrp -q -value rp_intensity`; + float $intensityRange = `floatSliderGrp -q -value rp_intensityRange`; + + float $min = -($intensity / 2) + ($intensity * $intensityRange / 200); + float $max = $intensity / 2 + ($intensity * $intensityRange / 200); + + floatField -e -value $min rp_min; + floatField -e -value $max rp_max; + + rp_storeRecallUI store; +} + + +// +// Main function +// + +global proc rp_main () +{ + // get settings from UI + float $min = `floatField -q -value rp_min`; + float $max = `floatField -q -value rp_max`; + int $seed = `intSliderGrp -q -value rp_seed`; + int $useSeed = `checkBox -q -v rp_useSeed`; + int $enX = `checkBox -q -v rp_x`; + int $enY = `checkBox -q -v rp_y`; + int $enZ = `checkBox -q -v rp_z`; + int $transMode = `radioButtonGrp -q -select rp_transMode`; + float $threshold = `floatSliderGrp -q -value rp_threshold`; + + // init random function for repeatable results + if ( $useSeed ) + seed $seed; + + string $objList[]; + + // get selected points + if ( $transMode != 3 ) + // filter cv, poly vertices and lattice points + $objList = `filterExpand -ex true -sm 28 -sm 31 -sm 46`; + else + // filter cv and poly vertices + $objList = `filterExpand -ex true -sm 28 -sm 31`; + + int $listSize = size($objList); + + waitCursor -state on; + + // transform CV + float $xmin, $ymin, $zmin, $xmax, $ymax, $zmax; + int $count; + string $u = ""; + string $v = ""; + string $n = ""; + + int $threshArray[] = {}; + + for ($count = 0; $count < $listSize; $count++) + { + float $threshRnd = `rand 0 1`; + + if ( $threshRnd >= $threshold ) + { + $threshArray[$count] = 1; + + $xmin = $ymin = $zmin = $xmax = $ymax = $zmax = 0; + if ($enX) + { + $xmin = $min; + $xmax = $max; + } + if ($enY) + { + $ymin = $min; + $ymax = $max; + } + if ($enZ) + { + $zmin = $min; + $zmax = $max; + } + + if ( $transMode == 1 ) + move -r -ws `rand $xmin $xmax` `rand $ymin $ymax` `rand $zmin $zmax` $objList[$count]; + else if ( $transMode == 2 ) + move -r -os `rand $xmin $xmax` `rand $ymin $ymax` `rand $zmin $zmax` $objList[$count]; + else + { + $u += "-u " + ( `rand $xmin $xmax` ) + " "; + $v += "-v " + ( `rand $ymin $ymax` ) + " "; + $n += "-n " + ( `rand $zmin $zmax` ) + " "; + } + } + } + + if ( $transMode == 3) + { + string $pointList = ""; + + for ( $cnt = 0; $cnt < size ( $threshArray ); $cnt++ ) + { + if ( $threshArray[$cnt] ) + $pointList += ( $objList[$cnt] + " " ); + } + + if ( size ( $pointList ) ) + { + eval ( "moveVertexAlongDirection " + $n + $pointList ); + eval ( "moveVertexAlongDirection " + $u + $pointList ); + eval ( "moveVertexAlongDirection " + $v + $pointList ); + } + } + + waitCursor -state off; +} + +// end of script diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/rndPoints.xpm b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/rndPoints.xpm new file mode 100644 index 0000000..c8b61b6 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/rndPoints.xpm @@ -0,0 +1,828 @@ +/* XPM */ +static char *RNDPTS_xpm[]={ +"32 32 793 2", +" c #22651C", +" 0 c #508427", +" 1 c #5A8E2B", +" 2 c #598D2C", +" 3 c #5B902E", +" 4 c #5A8F2F", +" 5 c #5A8E30", +" 6 c #52882B", +" 7 c #2E7722", +" 8 c #226F20", +" 9 c #226E20", +" a c #58882F", +" b c #5A852B", +" c c #4F7B25", +" d c #567D26", +" e c #557B25", +" f c #527824", +" g c #507522", +" h c #37681C", +" i c #1C5C1B", +" j c #1C5A1A", +" k c #366921", +" l c #4E6E1E", +" m c #4D6C1D", +" n c #4C6B1C", +" o c #4B6A1B", +" p c #4A691A", +" q c #49671A", +" r c #426418", +" s c #205617", +" t c #195317", +" u c #185217", +" v c #41751D", +" w c #F3CB55", +" x c #FED863", +" y c #FFE36E", +" z c #FFF581", +" A c #FFFE8E", +" B c #FFFF9B", +" C c #FFFF9C", +" D c #E5E37C", +" E c #64892B", +" F c #20691F", +" G c #D7CC5B", +" H c #FFE575", +" I c #F9D365", +" J c #F0CA5D", +" K c #E3BD51", +" L c #D7B347", +" M c #D1AD42", +" N c #C6A439", +" O c #878423", +" P c #1F5919", +" Q c #9BAD4F", +" R c #BA9C39", +" S c #AF8E29", +" T c #AB8B27", +" U c #A78824", +" V c #A38522", +" W c #A18220", +" X c #9E801F", +" Y c #907B1B", +" Z c #446013", +" & c #185117", +"0 c #40771D", +"00 c #ECC44E", +"01 c #F8CF59", +"02 c #DDBD51", +"03 c #D9C259", +"04 c #D9CA60", +"05 c #D9CF67", +"06 c #E5E076", +"07 c #FFFB8B", +"08 c #E3D863", +"09 c #3C701E", +"0a c #D4C250", +"0b c #FEDB6B", +"0c c #F1CC5E", +"0d c #CBAE44", +"0e c #C2A53D", +"0f c #BB9E37", +"0g c #BA9B36", +"0h c #C7A43A", +"0i c #C19F36", +"0j c #606F19", +"0k c #A8B456", +"0l c #B99C3A", +"0m c #AE8E29", +"0n c #97801E", +"0o c #9A831D", +"0p c #98821C", +"0q c #96801B", +"0r c #A08321", +"0s c #9C7F1D", +"0t c #947B18", +"0u c #1F4811", +"0v c #3E721C", +"0w c #E2BB46", +"0x c #EEC651", +"0y c #B39721", +"0z c #6F630F", +"0A c #6A5E0F", +"0B c #968326", +"0C c #FFEA77", +"0D c #F2DB6A", +"0E c #687514", +"0F c #CCB449", +"0G c #F7D162", +"0H c #B69C34", +"0I c #74670F", +"0J c #685C0F", +"0K c #675C0E", +"0L c #7D6D14", +"0M c #CBAC3E", +"0N c #BF9D34", +"0O c #6F6515", +"0P c #9A9A3C", +"0Q c #B99C35", +"0R c #AE8E28", +"0S c #6A600B", +"0T c #63590D", +"0U c #5F560C", +"0V c #6F620D", +"0W c #D3BF67", +"0X c #9F8321", +"0Y c #9A7D1C", +"0Z c #253207", +"0& c #3B6E1C", +"1 c #DBB641", +"10 c #E6BF4A", +"11 c #E1BC45", +"12 c #D8B849", +"13 c #D7B84D", +"14 c #D9BB51", +"15 c #F6D35E", +"16 c #FEDA67", +"17 c #D9B94C", +"18 c #615E0D", +"19 c #C9AD42", +"1a c #ECC758", +"1b c #B59B2E", +"1c c #0D1D07", +"1d c #081907", +"1e c #1B280B", +"1f c #D8B549", +"1g c #BD9C33", +"1h c #736716", +"1i c #959535", +"1j c #B89B32", +"1k c #AD8E27", +"1l c #3A3F08", +"1m c #081B08", +"1n c #122308", +"1o c #E9D97D", +"1p c #9F8323", +"1q c #9A7E1B", +"1r c #243107", +"1s c #39691B", +"1t c #D5B03C", +"1u c #DFB943", +"1v c #E4BE49", +"1w c #E9C34E", +"1x c #EDC753", +"1y c #EEC854", +"1z c #F3CD5A", +"1A c #F3CD5B", +"1B c #C9AB37", +"1C c #303809", +"1D c #C3A73B", +"1E c #E4C050", +"1F c #B1972B", +"1G c #0C1D07", +"1H c #081908", +"1I c #0D2B0D", +"1J c #20320E", +"1K c #D6B047", +"1L c #BC9B31", +"1M c #726615", +"1N c #959434", +"1O c #B79B31", +"1P c #AC8D26", +"1Q c #393E08", +"1R c #16290A", +"1S c #F9E47A", +"1T c #9F8322", +"1U c #233107", +"1V c #38661A", +"1W c #D1AC38", +"1X c #D9B43E", +"1Y c #A68C24", +"1Z c #917B1D", +"1& c #927C1D", +"2 c #8B771B", +"20 c #A88E2F", +"21 c #E8C350", +"22 c #DDBA48", +"23 c #48490D", +"24 c #BBA237", +"25 c #DCB949", +"26 c #AC9228", +"27 c #0C1C07", +"28 c #103310", +"29 c #194D18", +"2a c #2B5719", +"2b c #D1AD40", +"2c c #BA9A2F", +"2d c #706515", +"2e c #938C33", +"2f c #B6982F", +"2g c #AB8D25", +"2h c #383D08", +"2i c #081A08", +"2j c #1B340E", +"2k c #FAE470", +"2l c #233007", +"2m c #386519", +"2n c #CCA934", +"2o c #D4AF39", +"2p c #AF951E", +"2q c #1F2C09", +"2r c #081A07", +"2s c #524F13", +"2t c #DEBB48", +"2u c #D7B443", +"2v c #6D650E", +"2w c #B59C37", +"2x c #D4B242", +"2y c #A88F25", +"2z c #0F2E0E", +"2A c #184917", +"2B c #2A5318", +"2C c #CDAB3B", +"2D c #B8982D", +"2E c #6D6213", +"2F c #948732", +"2G c #B5962E", +"2H c #AA8C24", +"2I c #5D5917", +"2J c #5C5816", +"2K c #636317", +"2L c #C7B04A", +"2M c #9C801B", +"2N c #967B19", +"2O c #192807", +"2P c #396418", +"2Q c #C9A631", +"2R c #CFAB36", +"2S c #AF931E", +"2T c #4F4F12", +"2U c #D7B441", +"2V c #D0AE3D", +"2W c #6C630E", +"2X c #B19636", +"2Y c #CEAD3D", +"2Z c #A48B23", +"2& c #0C1B07", +"3 c #0C250B", +"30 c #174716", +"31 c #295018", +"32 c #C9A837", +"33 c #B5962B", +"34 c #6B6012", +"35 c #93832F", +"36 c #B3942C", +"37 c #A98B23", +"38 c #A78921", +"39 c #A48720", +"3a c #A1841E", +"3b c #9F831D", +"3c c #9D811C", +"3d c #665B0E", +"3e c #081C08", +"3f c #2A5B1A", +"3g c #A48929", +"3h c #A88D29", +"3i c #A18A18", +"3j c #22350C", +"3k c #0D290C", +"3l c #0E2E0E", +"3m c #3E4715", +"3n c #AB902F", +"3o c #AA9229", +"3p c #655D0D", +"3q c #8F7B27", +"3r c #A9912B", +"3s c #927E1A", +"3t c #111F07", +"3u c #0B210A", +"3v c #164415", +"3w c #214915", +"3x c #AE9529", +"3y c #9D8720", +"3z c #635C0F", +"3A c #7A6F1B", +"3B c #9C861F", +"3C c #96821A", +"3D c #958119", +"3E c #938017", +"3F c #927F16", +"3G c #907F15", +"3H c #827411", +"3I c #55510B", +"3J c #0F2008", +"3K c #1A5519", +"3L c #102108", +"3M c #283109", +"3N c #293109", +"3O c #194F18", +"3P c #195018", +"3Q c #222E09", +"3R c #2A3109", +"3S c #55290A", +"3T c #343615", +"3U c #2B3109", +"3V c #272E09", +"3W c #071707", +"3X c #0C240B", +"3Y c #164115", +"3Z c #154015", +"3& c #2C3D0E", +"4 c #152108", +"40 c #142108", +"41 c #262E08", +"42 c #262F08", +"43 c #252F08", +"44 c #263008", +"45 c #112108", +"46 c #174A15", +"47 c #154414", +"48 c #194E17", +"49 c #184C17", +"4a c #184A17", +"4b c #394726", +"4c c #4A2F16", +"4d c #D45629", +"4e c #914C1D", +"4f c #0E1C0A", +"4g c #3D371C", +"4h c #3B401D", +"4i c #153E14", +"4j c #133912", +"4k c #081808", +"4l c #071807", +"4m c #081807", +"4n c #195318", +"4o c #184D17", +"4p c #184B17", +"4q c #174917", +"4r c #174816", +"4s c #DD9762", +"4t c #E98A54", +"4u c #6B4E22", +"4v c #604F22", +"4w c #544D22", +"4x c #43411C", +"4y c #C66232", +"4z c #C5602F", +"4A c #1A3F15", +"4B c #143C14", +"4C c #2A4419", +"4D c #614F25", +"4E c #1D1F0B", +"4F c #222B0F", +"4G c #1F220C", +"4H c #171F0A", +"4I c #101D09", +"4J c #195118", +"4K c #0C260B", +"4L c #0F300E", +"4M c #174916", +"4N c #6E8C5A", +"4O c #688054", +"4P c #7E5B28", +"4Q c #835726", +"4R c #585225", +"4S c #554E23", +"4T c #5F582B", +"4U c #BDA46C", +"4V c #A37542", +"4W c #695123", +"4X c #515524", +"4Y c #4D5424", +"4Z c #7F5626", +"4& c #DF6430", +"5 c #523915", +"50 c #273515", +"51 c #1F3012", +"52 c #AE5424", +"53 c #F46A30", +"54 c #303714", +"55 c #192A0F", +"56 c #16280E", +"57 c #92481C", +"58 c #F9672B", +"59 c #413713", +"5a c #0E2D0D", +"5b c #184F17", +"5c c #174A16", +"5d c #234C1B", +"5e c #E18C6A", +"5f c #DF7756", +"5g c #6D6331", +"5h c #626632", +"5i c #5D602C", +"5j c #565226", +"5k c #694E25", +"5l c #C25C32", +"5m c #8D4520", +"5n c #4E4B22", +"5o c #4F4C22", +"5p c #605D2B", +"5q c #846B36", +"5r c #80602C", +"5s c #615E2A", +"5t c #5F612B", +"5u c #61622C", +"5v c #885D28", +"5w c #985824", +"5x c #5F612A", +"5y c #5E6029", +"5z c #5D5F28", +"5A c #9C5622", +"5B c #AF3810", +"5C c #204012", +"5D c #144113", +"5E c #184D16", +"5F c #174C16", +"5G c #174B16", +"5H c #164515", +"5I c #5C421B", +"5J c #54280B", +"5K c #626737", +"5L c #626736", +"5M c #5E6231", +"5N c #777450", +"5O c #7D7956", +"5P c #5D4A22", +"5Q c #584A22", +"5R c #4F4A22", +"5S c #514C23", +"5T c #925C30", +"5U c #EF8A52", +"5V c #82592B", +"5W c #60612D", +"5X c #63642E", +"5Y c #946931", +"5Z c #FA7E40", +"5& c #8F612C", +"6 c #61632B", +"60 c #60622A", +"61 c #5D6029", +"62 c #EA6129", +"63 c #E5662B", +"64 c #144013", +"65 c #164715", +"66 c #224718", +"67 c #4C5326", +"68 c #51572A", +"69 c #565B2D", +"6a c #575C2F", +"6b c #575C2E", +"6c c #CC8C79", +"6d c #ECB5A4", +"6e c #633C1A", +"6f c #504A24", +"6g c #534E26", +"6h c #565128", +"6i c #645128", +"6j c #874D24", +"6k c #705D2D", +"6l c #646230", +"6m c #666330", +"6n c #895C2A", +"6o c #AF4F21", +"6p c #7A602B", +"6q c #64652E", +"6r c #62642C", +"6s c #67612A", +"6t c #A44519", +"6u c #9A320C", +"6v c #133F12", +"6w c #50733D", +"6x c #CCD59D", +"6y c #836B42", +"6z c #40481F", +"6A c #454C22", +"6B c #484E24", +"6C c #4C5126", +"6D c #505529", +"6E c #563C1C", +"6F c #661F08", +"6G c #393217", +"6H c #4F4A26", +"6I c #56512B", +"6J c #887E4F", +"6K c #C2A870", +"6L c #7C6B3F", +"6M c #686136", +"6N c #6D6739", +"6O c #76683A", +"6P c #98733F", +"6Q c #7E713A", +"6R c #6B6D36", +"6S c #696B34", +"6T c #666831", +"6U c #6E6830", +"6V c #90642C", +"6W c #3F4718", +"6X c #133E12", +"6Y c #164915", +"6Z c #164815", +"6& c #164615", +"7 c #72491E", +"70 c #D36844", +"71 c #8B3916", +"72 c #3E451D", +"73 c #3E451E", +"74 c #40471F", +"75 c #414720", +"76 c #454A21", +"77 c #454421", +"78 c #3C391B", +"79 c #413D1E", +"7a c #4F4927", +"7b c #57512E", +"7c c #9D5530", +"7d c #D67447", +"7e c #754E2C", +"7f c #7A744A", +"7g c #827A50", +"7h c #957548", +"7i c #F27F46", +"7j c #C16D3A", +"7k c #757744", +"7l c #767843", +"7m c #71733D", +"7n c #916531", +"7o c #F3632B", +"7p c #BF5D27", +"7q c #183F13", +"7r c #29260B", +"7s c #373413", +"7t c #3D441C", +"7u c #3D441D", +"7v c #75795D", +"7w c #B0B0A2", +"7x c #5A5337", +"7y c #3F3B1C", +"7z c #443F1F", +"7A c #4B4625", +"7B c #55502D", +"7C c #5B5230", +"7D c #634A2B", +"7E c #7C724A", +"7F c #837C54", +"7G c #898359", +"7H c #977C52", +"7I c #893F1F", +"7J c #804F2D", +"7K c #807D51", +"7L c #828451", +"7M c #7D804C", +"7N c #806436", +"7O c #9F3D18", +"7P c #69350D", +"7Q c #164614", +"7R c #154514", +"7S c #314218", +"7T c #2C3614", +"7U c #3A421B", +"7V c #3C431C", +"7W c #3C441C", +"7X c #AB6A52", +"7Y c #E8ADA1", +"7Z c #6B371D", +"7& c #3C391A", +"8 c #403C1D", +"80 c #464221", +"81 c #4F4A28", +"82 c #595330", +"83 c #645E38", +"84 c #6E6741", +"85 c #77714A", +"86 c #7F7850", +"87 c #827C53", +"88 c #847E54", +"89 c #827C52", +"8a c #7F7950", +"8b c #7D794D", +"8c c #7B7D4B", +"8d c #595D35", +"8e c #0D2C0D", +"8f c #113810", +"8g c #164714", +"8h c #918E53", +"8i c #6D733F", +"8j c #3A431A", +"8k c #3B431B", +"8l c #3B431C", +"8m c #3D431C", +"8n c #2F2E11", +"8o c #461B06", +"8p c #2D220D", +"8q c #3D391B", +"8r c #413D1D", +"8s c #474221", +"8t c #ABA88F", +"8u c #BEBC96", +"8v c #685C37", +"8w c #605A34", +"8x c #67613B", +"8y c #6D6740", +"8z c #716B43", +"8A c #736D45", +"8B c #756F47", +"8C c #767048", +"8D c #757047", +"8E c #746E45", +"8F c #716C43", +"8G c #595A34", +"8H c #0A2009", +"8I c #10330F", +"8J c #3C4F1D", +"8K c #EB935C", +"8L c #DA6B3C", +"8M c #3F3E17", +"8N c #3B431A", +"8O c #3C421C", +"8P c #303215", +"8Q c #2A2811", +"8R c #3E3A1B", +"8S c #423E1E", +"8T c #BB6D53", +"8U c #E49F7D", +"8V c #5F4624", +"8W c #5C5631", +"8X c #645E37", +"8Y c #CF9860", +"8Z c #DE995E", +"8& c #74623A", +"9 c #6B653E", +"90 c #6B663E", +"91 c #6B653D", +"92 c #68633B", +"93 c #8B6034", +"94 c #2F290F", +"95 c #154614", +"96 c #513A0F", +"97 c #6A380E", +"98 c #174214", +"99 c #214216", +"9a c #304218", +"9b c #39431B", +"9c c #616646", +"9d c #6E7255", +"9e c #4A502B", +"9f c #3E431D", +"9g c #3D3C1B", +"9h c #423E1D", +"9i c #464220", +"9j c #473719", +"9k c #48250D", +"9l c #59532D", +"9m c #5D5730", +"9n c #605A33", +"9o c #C8461F", +"9p c #DC6333", +"9q c #5D502D", +"9r c #666139", +"9s c #726037", +"9t c #FB7338", +"9u c #FF7538", +"9v c #1F240C", +"9w c #144313", +"9x c #144213", +"9y c #163F13", +"9z c #B6A08E", +"9A c #FBF1EF", +"9B c #874F30", +"9C c #3F451D", +"9D c #3F421D", +"9E c #403C1C", +"9F c #433F1E", +"9G c #474220", +"9H c #4C4723", +"9I c #4F4A25", +"9J c #534D28", +"9K c #56502A", +"9L c #59542D", +"9M c #5C562F", +"9N c #4E4423", +"9O c #493317", +"9P c #5D5832", +"9Q c #625C35", +"9R c #625D35", +"9S c #73542D", +"9T c #A52807", +"9U c #C5350F", +"9V c #101F09", +"9W c #081D08", +"9X c #133E13", +"9Y c #4F350D", +"9Z c #98310F", +"9& c #443910", +"a c #223E16", +"a0 c #333C19", +"a1 c #6A664A", +"a2 c #565130", +"a3 c #4E4924", +"a4 c #514C26", +"a5 c #544E29", +"a6 c #57512B", +"a7 c #59532C", +"a8 c #5A552E", +"a9 c #5E5931", +"aa c #5E5932", +"ab c #4D4A27", +"ac c #1D1F09", +"ad c #144413", +"ae c #143F13", +"af c #133D12", +"ag c #133C12", +"ah c #133B12", +"ai c #0B1B09", +"aj c #2C341E", +"ak c #FFFFFF", +"al c #F3E4D9", +"am c #534622", +"an c #504A25", +"ao c #534D27", +"ap c #554F29", +"aq c #56512A", +"ar c #58522B", +"as c #59542C", +"at c #5A552D", +"au c #5B562E", +"av c #5C572F", +"aw c #5B562F", +"ax c #13230D", +"ay c #091D08", +"az c #154413", +"aA c #131A07", +"aB c #A22F13", +"aC c #AA3E23", +"aD c #19250E", +"aE c #2E3317", +"aF c #434220", +"aG c #534E27", +"aH c #7A683C", +"aI c #BF935C", +"aJ c #866C3E", +"aK c #58532B", +"aL c #58532C", +"aM c #59552D", +"aN c #17270F", +"aO c #092009", +"aP c #0E2C0D", +"aQ c #0D1D09", +"aR c #8E6038", +"aS c #F5A266", +"aT c #B87948", +"aU c #514D27", +"aV c #57522A", +"aW c #57532B", +"aX c #5C542B", +"aY c #1C2A11", +"aZ c #091E08", +"a& c #134012", +"b c #0C280B", +"b0 c #311D07", +"b1 c #832205", +"b2 c #5B2006", +"b3 c #0B1D09", +"b4 c #19270F", +"b5 c #2A3316", +"b6 c #3D401F", +"b7 c #4E4C26", +"b8 c #C66D36", +"b9 c #E06E35", +"ba c #8B4D22", +"bb c #144513", +"bc c #0E2E0D", +"bd c #D04E1D", +"be c #F0652D", +"bf c #9F5023", +"bg c #144112", +"bh c #134112", +"bi c #123D11", +"bj c #0C280C", +"bk c #0D2B0C", +"bl c #4C2307", +"bm c #852606", +"bn c #3E2207", +" 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u", +" v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z &", +"0 000102030405060708090a0b0c0d0e0f0g0h0i0j0k0l0m0n0o0p0q0r0s0t0u", +"0v0w0x0y0z0A0A0B0C0D0E0F0G0H0I0J0K0L0M0N0O0P0Q0R0S0T0U0V0W0X0Y0Z", +"0&1 101112131415161718191a1b1c1d1d1e1f1g1h1i1j1k1l1m1m1n1o1p1q1r", +"1s1t1u1v1w1x1y1z1A1B1C1D1E1F1G1H1I1J1K1L1M1N1O1P1Q1m1m1R1S1T1q1U", +"1V1W1X1Y1Z1&2 202122232425262728292a2b2c2d2e2f2g2h2i1m2j2k0X1q2l", +"2m2n2o2p2q2i2r2s2t2u2v2w2x2y272z2A2B2C2D2E2F2G2H0O2I2J2K2L2M2N2O", +"2P2Q2R2S2q2r1d2T2U2V2W2X2Y2Z2&3 303132333435363738393a3b3c2M3d3e", +"3f3g3h3i3j3k3l3m3n3o3p3q3r3s3t3u3v3w3x3y3z3A3B3C3D3E3F3G3H3I3J3e", +"3K3L3M3N3O3P3O293Q3R3S3T3U3V3W3X3Y3Z3&3V4 40414142434344451m1m3e", +"461m2i2i4748494a4b4c4d4e4f3W4g4h4i4i4j4k3W3W4l4l4m1d1d2r2i1m1m3e", +"4n1m2i2r4o4p4q4r4s4t4u4v4w4x4y4z4A4B4C4D4E3W3W4F4G1d1d1d4H4I1m3e", +"4J4K1I4L4p4M4N4O4P4Q4R4S4T4U4V4W4X4Y4Z4&5 505152535455565758595a", +"5b4o495c4M5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5s5t5u5v5w5x5y5z5A5B5C5D", +"5E5F5G4r4r5H5I5J5K5L5M5N5O5P5Q5R5S5T5U5V5W5X5Y5Z5&6 606162636464", +"5G5c4M655H666768696a6b6c6d6e6f6g6h6i6j6k6l6m6n6o6p6q6r6s6t6u6v64", +"5c4M656w6x6y6z6A6B6C6D6E6F6G6H6I6J6K6L6M6N6O6P6Q6R6S6T6U6V6W6X6v", +"6Y6Z6&7 707172737475767778797a7b7c7d7e7f7g7h7i7j7k7l7m7n7o7p6X6v", +"6Z656&7q7r7s7t7u727v7w7x7y7z7A7B7C7D7E7F7G7H7I7J7K7L7M7N7O7P6X6v", +"6Z7Q7R7S7T7U7V7W7u7X7Y7Z7&8 80818283848586878887898a8b8c8d8e8f6X", +"8g8h8i8j8k8k8l7V8m8n8o8p8q8r8s8t8u8v8w8x8y8z8A8B8C8D8E8F8G1m8H8I", +"8J8K8L8M8N8k8k7V7t8O8P8Q8R8S8s8T8U8V8W8w8X8Y8Z8&9 90919293943e3e", +"95969798999a9b9c9d9e9f9g8R9h9i9j9k7a9l9m9n9o9p9q9r9r9r9s9t9u9v3e", +"7R479w9x5D649y9z9A9B9C9D9E9F9G9H9I9J9K9L9M9N9O9P9Q9R9R9S9T9U9V9W", +"7R479w9x5D649X9Y9Z9&a a09E9Fa1a2a3a4a5a6a7a89M9ma9aaaaa9abac3e9W", +"7Rad9w9x5Dae6v6Xafagah5aaiajakalamanaoapaqarasatauauavawauax9Way", +"az9w9w9x5D646v6Xafagag8I1daAaBaCaDaEaFaGaHaIaJaKaL9L9LaMasaNayaO", +"ad9w9w9x5D646v6XafafagaP2r2r2r2r2r2r2raQaRaSaTaUaqaVaWaWaXaYayaZ", +"adad9w9x5Da&6v6v6Xafafb 2i2i2i2i2i2i2i2ib0b1b2b3b4b5b6b7b8b9baaZ", +"bbad9w9x5Da&a&6v6X6Xafbc1m1m1m1m1m1m1m1m1m1m1m3e3e3e9WaybdbebfaZ", +"bbad9w9xbgbha&6v6vbibjbk3e1m1may1m1m1m1m3e3e3e9W9WayaZaZblbmbnaO"}; diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/rp_help.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/rp_help.mel new file mode 100644 index 0000000..3f8bd46 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/rp_help.mel @@ -0,0 +1,184 @@ +/* rpts_help.mel + +This script may be freely distributed. Modify at your own risk. + +Author: Dirk Bialluch (DirkBi@Software2000.de) + +Creation date: 15.10.2000 +Last update: 15.10.2000 + +*/ + +// +// Create UI +// + +global proc rp_help ( int $function ) +{ + int $uiLabelWidth = 150; + int $uiInputWidth = 80; + int $uiWidth = $uiLabelWidth + $uiInputWidth + 220; + + if ( `window -exists rp_help` ) + deleteUI rp_help; + + window + -maximizeButton false + -resizeToFitChildren false + -title "Randomize Points Help" + -iconName "Ranomdize Points Help" rp_help; + + tabLayout -innerMarginWidth 5 -innerMarginHeight 5 -childResizable true rp_helpTab; + string $rp1_form = `formLayout -numberOfDivisions 100 "Randomize Points"`; + string $rp1_scroll = `scrollLayout -hst 16 -vst 16 -childResizable true -minChildWidth $uiWidth`; + columnLayout -adjustableColumn true -rowSpacing 6; +// randomize points - instructions + frameLayout + -label "Instructions" + -labelAlign "center" + -cll false + -lw $uiWidth + -mh 3 + -borderStyle "etchedIn" + -bv true; + columnLayout -adjustableColumn true; + rowLayout + -numberOfColumns 1 + -cat 1 "left" 5; + text rp1_instructions; + setParent ..; + setParent ..; + setParent ..; + setParent ..; + setParent ..; + + string $rp1_button = `button + -label "Close" + -command "deleteUI rp_help"`; + setParent ..; + + string $rp2_form = `formLayout -numberOfDivisions 100 "About"`; + string $rp2_scroll = `scrollLayout -hst 16 -vst 16 -childResizable true -minChildWidth $uiWidth`; + columnLayout -adjustableColumn true -rowSpacing 6; +// about + frameLayout + -label "About Randomize Points" + -labelAlign "center" + -cll false + -lw $uiWidth + -mh 3 + -borderStyle "etchedIn" + -bv true; + columnLayout -adjustableColumn true; + rowLayout + -numberOfColumns 1 + -cat 1 "left" 5; + text rp2_instructions; + setParent ..; + setParent ..; + setParent ..; + setParent ..; + setParent ..; + + string $rp2_button = `button + -label "Close" + -command "deleteUI rp_help"`; + + // set form layouts + formLayout -edit + -attachForm $rp1_scroll "top" 4 + -attachForm $rp1_scroll "left" 4 + -attachControl $rp1_scroll "bottom" 4 $rp1_button + -attachForm $rp1_scroll "right" 4 + $rp1_form; + + formLayout -edit + -attachNone $rp1_button "top" + -attachForm $rp1_button "left" 4 + -attachForm $rp1_button "bottom" 4 + -attachForm $rp1_button "right" 4 + $rp1_form; + + formLayout -edit + -attachForm $rp2_scroll "top" 4 + -attachForm $rp2_scroll "left" 4 + -attachControl $rp2_scroll "bottom" 4 $rp2_button + -attachForm $rp2_scroll "right" 4 + $rp2_form; + + formLayout -edit + -attachNone $rp2_button "top" + -attachForm $rp2_button "left" 4 + -attachForm $rp2_button "bottom" 4 + -attachForm $rp2_button "right" 4 + $rp2_form; +/* + Enable Axes + Enable/disable the world space, object space or distance axes depending on the Transform + Mode settings. +*/ + string $rp1_instructions = + "This tool randomizes the position of selected CV´s, Poly Vertices and Lattice Points.\n" + + "\n" + + "Workflow tips\n" + + " To avoid problems at object poles when deforming eg a nurbs sphere, better bind\n" + + " the object to a lattice and randomize the lattice points instead.\n" + + "\n" + + "Intensity\n" + + " The Intensity value is measured in world or object space units depending on the.\n" + + " chosen Transform Mode. A value of 1 will displace the selected points within a\n" + + " maximum range of -0.5 to 0.5, if Intensity Range is set to 0. If you are using the\n" + + " object space mode, object scale values are taken into account.\n" + + "\n" + + "Intensity Range\n" + + " Shift the displacement toward the positive or negative value range. If Intensity is\n" + + " set to 2, an Intensity Range of 100% will shift the displacement completely to a\n" + + " positive range from 0 to 2. Setting the value to -100% would result in a range from\n" + + " -2 to 0.\n" + + "\n" + + "Min/Max Value\n" + + " These values show the final displacement range.\n" + + "\n" + + "Threshold\n" + + " Increase the Threshold value to leave a certain amount of points unaffected. When\n" + + " leaving this value at 0, all points will be affected. A value of 0.8 will skip\n" + + " approximately 80% of all selected points and randomize the remaining 20%.\n" + + "\n" + + "Use Seed Value\n" + + " Enable/disable the usage of a seed value for the randomize function.\n" + + "\n" + + "Seed\n" + + " The Seed value inits the randomize function, so the deformation is repeatable.\n" + + " The function will only produce identical results, if the points are always selected\n" + + " in the same order.\n" + + "\n" + + "Transform Mode\n" + + " World Space will displace points along the enabled world space axes.\n" + + " Object Space will displace points along the enabled object space axes.\n" + + " Distance will displace points along the enabled normal, u and v tangent.\n" + + " Lattice points are not affected by this transform node, because they do not have\n" + + " UVN properties.\n" + + "\n" + + "Enable Axes\n" + + " Enable/disable the axes depending on the Transform Mode settings.\n"; + + string $rp2_instructions = + "Randomize Points V1.6\n" + + "\n" + + "Programmed by Dirk Bialluch, 1998-2000\n" + + "\n" + + "This script may be freely distributed.\n" + + "Modify at your own risk.\n" + + "\n" + + "Email: 'DirkBi@Software2000.de'\n" + + "Homepage: 'http://dirk-bialluch.mayaring.com'"; + + text -e -label $rp1_instructions rp1_instructions; + text -e -label $rp2_instructions rp2_instructions; + + tabLayout -e -selectTabIndex $function rp_helpTab; + + showWindow rp_help; +} + +// end of script diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/searchReplaceWin.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/searchReplaceWin.mel new file mode 100644 index 0000000..2bf7f1f --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/searchReplaceWin.mel @@ -0,0 +1,87 @@ +// +// Copyright (C) 1997-2001 Alias|Wavefront, +// a division of Silicon Graphics Limited. +// +// The information in this file is provided for the exclusive use of the +// licensees of Alias|Wavefront. Such users have the right to use, modify, +// and incorporate this code into other products for purposes authorized +// by the Alias|Wavefront license agreement, without fee. +// +// ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +// EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR +// CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. +// +// Alias|Wavefront Script File +// MODIFY THIS AT YOUR OWN RISK +/// +// +// +// searchReplaceWin.mel +// CPAM June 4, 1999 +// revised July 2001 +// +// +// This will search and replace object +// names for selected objects. Suggest +// using on a skeleton after copying +// an arm or leg. +// + + +global proc searchReplace (){ + + global string $searchText; + global string $replaceText; + global string $objects[]; + + $objects = `ls -sl`; + $searchText = `textField -q -text searchText`; + $replaceText = `textField -q -text replaceText`; + + for ($object in $objects){ + + string $newName = `substitute $searchText $object $replaceText`; + print "Object: "; + print $object; + print " New name: "; + print $newName; + print "\n"; + rename $object $newName; + } + +} + + +global proc searchReplaceWin (){ + + window -title "Object Renamer" + objectRenamer; + columnLayout; + + text "Search Text:"; + textField -w 200 + -text "right" + searchText; + + text "Replace Text:"; + textField -w 200 + -text "left" + replaceText; + + button -label "Search and Replace!" + -command "searchReplace" + doIt; + + showWindow objectRenamer; + +} + + + + + + diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/selectInst.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/selectInst.mel new file mode 100644 index 0000000..3e01da5 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/selectInst.mel @@ -0,0 +1,36 @@ +global proc selectInst() +{ + string $orig[]; + clear($orig); + $orig = `ls -sl -tr`; + string $origShape[]; + clear($origShape); + $origShape = `ls -sl -dag -lf`; + string $token[]; + clear($token); + int $numTok; + $numTok = `tokenize $origShape[0] "|" $token`; + string $select[]; + clear($select); + int $index; + int $count; + $count = 0; +// if(`strcmp $orig[0] $token[0]`!=0) +// { error "No Original Geometry Selected!!";} +// else +// { + string $objects[]= `ls -tr`; + for($object in $objects) + { + string $objShape[] = `ls -dag -lf $object`; + if(`strcmp $origShape[0] $objShape[0]` == 0) + { + select -add $object; + $select[$count] = $object; + $count++; + } + } +// } + print "\n"; + print $select; +} diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/setShapeNode.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/setShapeNode.mel new file mode 100644 index 0000000..0d631df --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/setShapeNode.mel @@ -0,0 +1,17 @@ +global proc setShapeNode() +{ + string $objects[] = `ls -sl -tr`; + print ("\n"); + print $objects; + for($object in $objects) + { + string $shapes[] = `ls -dag -lf $object`; + print ("\n"); + print $shapes; + for($shape in $shapes) + { + string $parents[] = `listRelatives -p $shape`; + rename $shape ($parents[0]+ "Shape"); + } + } +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/simpsonsArt.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/simpsonsArt.mel new file mode 100644 index 0000000..0f6dcf3 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/simpsonsArt.mel @@ -0,0 +1,334 @@ +/* simpsonsArt.mel + + THIS IS AN UPDATE TO JEFF PIDSADNY'S SIMPSONS ART MENU SCRIPT. + THIS REVISION HAS MAINLY CHANGED THE LOOK OF THE GUI AND ADDED + ICONS INSTEAD OF TEXT. + + AUTHOR: ARYAN HANBECK + + JULY 03 2002 + +*/ + +// +// SOURCE ALL SCRIPTS AND DEFINE GLOBAL PROCEDURES +// + + +//=========================================================================== +// validBMP +//=========================================================================== +// Description: Maya's UI layout will BOMB if you attempt to create a UI +// control that contains an image (a 'symbolButton' for example) +// where the specified image does not exist. +// +// This function queries the folders specified in the XBMLANGPATH +// environment variable for the specified BMP image. If the +// image is found, its name is returned. If the image is not +// found, the default image "vacantCell.xpm" is returned instead. +// +// Suggested use is to specify the image for a control by +// wrapping it within validBMP(); e.g.: +// +// symbolButton -image ( validBMP( "myImage.bmp" ); +// +// Constraints: +// +// Parameters: string $bmp: The name of the BMP image (no path, please). +// +// Return: (string): If specified BMP is valid, the BMP name is +// returned; if the BMP is not valid "vacantCell.xpm" +// is returned. +// +//=========================================================================== + + + proc string validBMP( string $bmp ) +{ + string $validBMP = "vacantCell.xpm"; + + string $pathEnv = `getenv XBMLANGPATH`; + string $paths[]; + tokenize $pathEnv ";" $paths; + for ( $p in $paths ) + { + string $bmpPath = ( $p + "/" + $bmp ); + if ( `file -q -exists $bmpPath` ) + { + $validBMP = $bmp; + break; + } + } + + return $validBMP; +} + + +source "C:/AW/Maya4.0/scripts/SimpsonsArt/renameScripts.mel"; +source "C:/AW/Maya4.0/scripts/SimpsonsArt/forceUniqueNames.mel"; +source "C:/AW/Maya4.0/scripts/SimpsonsArt/optimizeShaders.mel"; +source "C:/AW/Maya4.0/scripts/SimpsonsArt/mappedPrelightWindow.mel"; +source "C:/AW/Maya4.0/scripts/SimpsonsArt/rndPoints.mel"; +source "C:/AW/Maya4.0/scripts/SimpsonsArt/setShapeNode.mel"; +source "C:/AW/Maya4.0/scripts/SimpsonsArt/yuya_copyFileTex.mel"; +source "C:/AW/Maya4.0/scripts/SimpsonsArt/uvz.mel"; + + + +global proc setShapeNode() +{ + source "C:/AW/Maya4.0/scripts/SimpsonsArt/setShapeNode.mel";setShapeNode; +} + +global proc uvz() +{ + source "C:/AW/Maya4.0/scripts/SimpsonsArt/uvz.mel"; +} + +global proc nameSpaceGui() +{ + source "C:/AW/Maya4.0/scripts/SimpsonsArt/nameSpaceGui.mel"; +} + +global proc renameTexture() +{ + source "C:/AW/Maya4.0/scripts/SimpsonsArt/renameTexture.mel";renameTexture; +} + +global proc simpsonsExporterOptions() +{ +setAttr "p3dDefaultExporterSetting.exportVertexOffsetAnims" 0; +setAttr "p3dDefaultExporterSetting.exportVisAnimations" 0; +setAttr "p3dDefaultExporterSetting.exportAnimations" 0; + +} + +global proc litOff() +{ + string $mats[] = `ls -type pure3dSimpleShader`; + for($mat in $mats) + { + $attr = $mat + ".dynamicallyLit"; + setAttr $attr 0; + $attrs = $mat + ".color"; + shadingConnection -e -cs on $attrs; + FixHWTextureInfo( $mat ); + } +// for($mat in $mats) +// { +// $attr = $mat + ".doubleSided"; +// setAttr $attr 0; +// $attrs = $mat + ".color"; +// shadingConnection -e -cs on $attrs; +// } +} + +global proc backfaceOff() +{ + string $objects[] = `ls -sl -dag -s`; + print ("\n"); + print $objects; + for($object in $objects) + { + setAttr ( $object + ".opposite") 0; + } +} + + +if(`window -ex "SAMmainwindow"`) +{ + deleteUI -wnd "SAMainWindow"; +} + +// +//CREATE THE GUI WINDOW AND ADD THE BUTTONS +// + +global proc simpsonsArt() +{ +window + -visible 1 + -title "SAM" + -sizeable 0 + -iconify 0 + -wh 147 300 + -maximizeButton 0 + SAMmainWindow; + columnLayout -adj true; + frameLayout + -label "Geometry" + -labelAlign "center" + -cll true + SAMgeometryFrame; + + rowLayout + -numberOfColumns 2 + -columnWidth 1 68 + -columnWidth 2 68 + SAMgeometryRow; + + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/rnd.bmp" + -ann "Random Points" + -c "rndPoints" + SAMrndPoints; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/backfaceoff.bmp" + -ann "Backface Off" + -c "backfaceOff" + SAMbackfaceOff; + setParent ..; + setParent ..; + + frameLayout + -label "Lighting" + -labelAlign "center" + -cll true + -bv true + SAMlightingFrame; + rowLayout + -numberOfColumns 2 + -columnWidth 1 68 + -columnWidth 2 68 + SAMlightingRow; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/prelighttool.bmp" + -ann "Simpsons Prelight" + -c "mappedPrelightWindow" + SAMsimpsonsPreLight; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/prelitoff.bmp" + -ann "Prelit Off" + -c "litOff" + SAMpreLitOff; + setParent ..; + setParent ..; + + frameLayout + -label "Textures" + -labelAlign "center" + -cll true + -bv true + SAMtextureFrame; + columnLayout -adjustableColumn 1 SAMtextureColumn; + rowLayout + -numberOfColumns 2 + -columnWidth 1 68 + -columnWidth 2 68 + SAMtextureRow; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/renametex.bmp" + -ann "RenameTextures" + -c "renameTexture" + SAMrenameTextures; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/movetex.bmp" + -ann "Move Textures" + -c "yuya_copyFileTex" + SAMoveFiles; + setParent ..; + rowLayout + -numberOfColumns 2 + -columnWidth 1 68 + -columnWidth 2 68 + SAMtextureRow2; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/optimizetex.bmp" + -ann "Optimize Shaders" + -c "optimizeShaders" + SAMoptimizeShaders; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/uvz.bmp" + -ann "UVz Utility" + -c "uvz" + SAMuvz; + setParent ..; + setParent ..; + setParent ..; + frameLayout + -label "Hypergraph" + -labelAlign "center" + -cll true + -bv true + SAMhypergraphFrame; + columnLayout -adjustableColumn 1 SAMhypegraphColumn; + rowLayout + -numberOfColumns 2 + -columnWidth 1 68 + -columnWidth 2 68 + SAMhypergraphRow; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/setshape.bmp" + -ann "Set Shape Node" + -c "setShapeNode" + SAMsetShapeNode; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/removetxt.bmp" + -ann "Remove Text String" + -c "nameSpaceGui" + SAMremoveTextString; + setParent ..; + rowLayout + -numberOfColumns 2 + -columnWidth 1 68 + -columnWidth 2 68 + SAMHypergraphRow2; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/unique.bmp" + -ann "Force Unique Names" + -c "forceUniqueNames" + SAMforceUniqueNames; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/p3d.bmp" + -ann "Set Exporter Options" + -c "simpsonsExporterOptions" + SAMsetExporterOptions; + setParent ..; + rowLayout + -numberOfColumns 2 + -columnWidth 1 68 + -columnWidth 2 68 + SAMhypergraphRow3; + string $name = `textField -width 68`; + symbolButton + -w 68 + -h 28 + -image "C:/AW/Maya4.0/scripts/SimpsonsArt/icons/renamesh.bmp" + -ann "Rename Shapes" + -c ("renameShape `textField -q -text " + $name + "`") + renameShape; + setParent ..; + setParent ..; + setParent ..; + setParent ..; + + window -e + -wh 147 295 + SAMmainWindow; + +} +// end of script
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/snapCurveY.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/snapCurveY.mel new file mode 100644 index 0000000..8292125 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/snapCurveY.mel @@ -0,0 +1,75 @@ +global proc int srrRound( float $val ) +{ + int $intPart = trunc( $val ); + float $decPart = $val - $intPart; + + $val = $intPart; + if ( $decPart >= 0.5 ) $val += 1; + + return $val; +} + + +global proc snapCurveY( float $precision ) +{ + $precision = abs( $precision ); + + string $curves[]; + $curves = `ls -type nurbsCurve`; + + string $curve; + for ( $curve in $curves ) + { + int $numcvs; + string $curvecmd = ($curve + ".cp"); + $numcvs = `eval getAttr -size $curvecmd`; + + float $cv[ 3 ]; + int $i = 0; + for ( $i = 0; $i < $numcvs; $i++ ) + { + $curvecmd = ($curve + ".cp[" + $i + "]"); + $cv = `eval getAttr $curvecmd`; + + if ( $precision == 1 ) + { + $cv[ 1 ] = ceil( $cv[ 1 ] ); + } + + if ( $precision > 1 ) + { + float $div = $cv[ 1 ] / $precision; + + int $integerpart = trunc( $div ); + float $decpart = $div - $integerpart; + + if ( $decpart < 0.5 ) + { + $decpart = 0; + } + else + { + $decpart = 1; + } + + float $newdiv = $integerpart + $decpart; + + $cv[ 1 ] = $precision * $newdiv; + } + + if ( $precision < 1 ) + { + float $div = $cv[ 1 ] / $precision; + + $div = srrRound( $div ); + + float $newdec = $precision * $div; + + $cv[ 1 ] = $newdec; + } + + $curvecmd = ($curve + ".cp[" + $i + "].yv"); + eval setAttr $curvecmd $cv[ 1 ]; + } + } +} diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/uvz.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/uvz.mel new file mode 100644 index 0000000..a53ed85 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/uvz.mel @@ -0,0 +1,226 @@ +//=========================================================================== +// Copyright ©2001 Radical Entertainment Ltd. All rights reserved. +// +// Created: 13 Nov 2001 +// +// Component: MEL Script for Maya. +// Provides useful UV editing operations. +// +// Creator: Bryan Ewert +// +// Version: 1.0 +// Tested on Maya v3 and v4. +// +//=========================================================================== + +// ×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× +// +// How to use: +// +// Call this script. A UI will be provided with the following functions: +// +// Spin: Spins the UVs around the selected face(s). +// +// Reverse Spin: Spins the UVs the other direction. +// Auto Map Cut: Cuts the UV seams on all edges of the face prior +// to performing the Spin operation. +// +// Note: The "Auto Map Cut" option is always immediately turned off. +// It is only necessary to cut the edges once for a particular +// face, and the Construction History stack will be inflated +// with unnecessary 'polyMapCut' operations if not. // +// +// ×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× + +//=========================================================================== +// getUVsInOrder +//=========================================================================== +// Description: Returns the UV components for the specified face in proper +// "construction" order. +// +// See < http://www.ewertb.com/maya/mel/mel_a55.html > +// +// Constraints: +// +// Parameters: string $face: The face component for which to retrieve the UVs. +// +// Return: (string[]) The UV components associated with the specified face. +// +//=========================================================================== +proc string[] getUVsInOrder( string $face ) +{ + string $uvOrder[]; + + string $vtxFace[] = `polyListComponentConversion -ff -tvf $face`; + $vtxFace = `filterExpand -sm 70 -ex true $vtxFace`; + + for ( $vf in $vtxFace ) + { + string $uv[] = `polyListComponentConversion -fvf -tuv $vf`; + $uvOrder[`size $uvOrder`] = $uv[0]; + } + + return $uvOrder; +} + +//=========================================================================== +// getFaceEdges +//=========================================================================== +// Description: Returns the edge components that construct the specified face. +// +// Constraints: +// +// Parameters: string $face: The face for which to retrieve the edges. +// +// Return: (string[]): The edge components. +// +//=========================================================================== +proc string[] getFaceEdges( string $face ) +{ + string $edges[] = `polyListComponentConversion -ff -te $face`; + $edges = `filterExpand -sm 32 -ex true $edges`; + + return $edges; +} + +//=========================================================================== +// performSpinUVz +//=========================================================================== +// Description: Invoked when the user presses the "Spin UVz" button. +// Spins the UVs. +// +// Constraints: If at least one polymesh face component is not selected +// then no action is taken. +// +// The "Auto Map Cut" option is always immediately turned off. +// It is only necessary to cut the edges once for a particular +// face, and the Construction History stack will be inflated +// with unnecessary 'polyMapCut' operations if not. Eventually +// I may determine a way to detect if an auto-cut is necessary +// and just skip the step when applicable. +// +// Parameters: (none) +// +// Return: (none) +// +//=========================================================================== +global proc performSpinUVz() +{ + string $faces[] = `filterExpand -sm 34 -ex true`; + + if ( `size $faces` > 0 ) + { + string $select[] = `ls -sl`; + + int $reverse = `checkBox -q -value rad_uvzReverse`; + int $autoCut = `checkBox -q -value rad_uvzAutoCut`; + + for ( $face in $faces ) + { + if ( $autoCut ) + { + // Only need to cut edges if any of the vertices + string $edges[] = getFaceEdges( $face ); + polyMapCut $edges; + } + + string $uvOrder[] = getUVsInOrder( $face ); + print $uvOrder; + print "------\n"; + int $numUVs = `size $uvOrder`; + float $uv[]; + float $u[], $v[]; + + for ( $i = 0; $i < $numUVs; $i++ ) + { + $uv = `polyEditUV -q $uvOrder[$i]`; + $u[`size $u`] = $uv[0]; + $v[`size $v`] = $uv[1]; + } + + for ( $i = 0; $i < $numUVs; $i++ ) + { + int $next; + + if ( $reverse ) + { + $next = ( $i + ( $numUVs - 1 ) ) % $numUVs; + } + else + { + $next = ( $i + 1 ) % $numUVs; + } + + polyEditUV -r false -u $u[$next] -v $v[$next] $uvOrder[$i]; + } + } + + checkBox -e -value off rad_uvzAutoCut; + + select -r $select; + } + else + { + warning( "UVz: No action taken -- Please select one or more faces." ); + } +} + +//=========================================================================== +// uvz +//=========================================================================== +// Description: Generates the UI for this script. +// +// Constraints: +// +// Parameters: (none) +// +// Return: (none) +// +//=========================================================================== +global proc uvz() +{ + if ( `window -exists raduvz` ) + deleteUI -window raduvz; + + window -title "UVz" -iconName "UVz" raduvz; + + columnLayout -adjustableColumn true; + + string $spinFrame = `frameLayout -label "Spin UVz on Face"`; + + string $spinForm = `formLayout`; + + string $spinReverse = `checkBox -label "Reverse Spin" rad_uvzReverse`; + string $spinAutoCut = `checkBox -label "Auto Map Cut" rad_uvzAutoCut`; + string $spinUVz = `button -label "Spin UVz"`; + + setParent ..; + + setParent ..; + + setParent ..; + + setParent ..; + + formLayout -e + + -af $spinReverse "top" 4 + -af $spinReverse "left" 4 + + -ac $spinAutoCut "top" 4 $spinReverse + -af $spinAutoCut "left" 4 + + -ac $spinUVz "top" 4 $spinAutoCut + -af $spinUVz "left" 4 + -af $spinUVz "right" 4 + -af $spinUVz "bottom" 2 + + $spinForm; + + // Attach command callbacks + button -e + -c performSpinUVz + $spinUVz; + + showWindow raduvz; +} diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/yuya_copyFileTex.mel b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/yuya_copyFileTex.mel new file mode 100644 index 0000000..7c018f9 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/yuya_copyFileTex.mel @@ -0,0 +1,172 @@ +// +// Copy File Textures Ver.1.51 +// +// Created by Yuya Sugiyama < yuya@sb.sakura.ne.jp > +// Last Modify : 16th/December/2001 +// Please check my web site -INVISIBLE-. +// URL : http://sb.sakura.ne.jp/~yuya/ +// +// Description: +// This script copies file textures in current scene to current sourceimages +// directory. This script makes your file management easier. +// +// Usage: +// Type +// +// yuya_copyFileTex; +// +// Then appear the window. Set options and hit "Copy File Textures" button. +// Using specify directory option, path must be terminated in "\"(backslash). +// (If you use browse button, unnecessary paying attention to this limitation.) +// +// Please use (and modify) this at your own lisk. +// + + +// Start window procedure + +global proc yuya_copyFileTex () { + +if ((`window -ex yuya_copyFileTex`) == true) deleteUI yuya_copyFileTex; +window -t "Copy File Texture" -w 420 -h 100 yuya_copyFileTex; +columnLayout -adj 1; + +frameLayout -l "Copy File Texture" -la "center" -bs "etchedIn" -cll 1 -cl 0; + +columnLayout -adj 1; +radioButtonGrp -w 330 -cw3 140 100 100 -nrb 2 -label "Which Files?" -la2 "All Files" "Selected Files" -select 1 yuya_allOrSel; + +columnLayout -adj 1; +radioButtonGrp -w 330 -cw3 140 100 100 -nrb 2 -label "Mofify Texture Node?" -la2 "Yes" "No" -select 1 yuya_modTexNode; + +checkBoxGrp -l "Specify Directory" + -onCommand + "textFieldGrp -e -ed true yuya_cftDirField; + symbolButton -e -enable true yuya_cftBrowseButton;" + -offCommand + "textFieldGrp -e -ed false yuya_cftDirField; + symbolButton -e -enable false yuya_cftBrowseButton;" + yuya_cftCB; + +rowLayout -w 330 -nc 2 -cw2 380 40 -cal 1 "right" yuya_cftDirNameLayout; +textFieldGrp -l "Directory" -ed false -w 375 yuya_cftDirField; +symbolButton + -enable false + -image "navButtonBrowse.xpm" + -c "yuya_getDirProc" yuya_cftBrowseButton; + +setParent..; +setParent..; +setParent..; +setParent..; + +button -l "Copy File Textures." -c "yuya_copyFileTexMain (`radioButtonGrp -q -select yuya_allOrSel`) (`radioButtonGrp -q -select yuya_modTexNode`)"; + +showWindow; + +} + +// End create window procedure + + +// Start copy file textures procedure + +global proc int yuya_copyFileTexMain ( int $allOrSel, int $modTexNode ) { + +if ( $allOrSel == 1 ) { + select -all; +} + +string $path[] = `ls -sl -type file`; +select -cl; + +if ( $allOrSel == 2 ) { + select -add $path; +} + +string $copyPath; + +if (`checkBoxGrp -q -value1 yuya_cftCB`){ + + $copyPath = `textFieldGrp -q -fileName yuya_cftDirField`; + +}else{ + $copyPath =`workspace -q -rd`+"sourceimages/"; + for ($i=1; $i<=17; $i++){ + $copyPath = `substitute "/" $copyPath "\\"`; + } +} + +string $batchName = `file -q -sceneName`; + +if( `size($batchName)` ){ + string $tokBatName[]; + int $numTokenB = `tokenize $batchName "/" $tokBatName`; + $batchName = $tokBatName[$numTokenB-1] +".bat"; + $batchName = `substitute ".ma" $batchName ""`; + $batchName = `substitute ".mb" $batchName ""`; + +}else{ + $batchName = "untitled.bat"; +} + +system ("echo on>"+$copyPath+"copyFileTex_"+$batchName); + +string $current; +for ( $current in $path ) { + + string $currentFullPath = `getAttr ($current + ".ftn")`; + + string $tokFileName[]; + int $numToken = `tokenize $currentFullPath "/" $tokFileName`; + string $fileName = $tokFileName[$numToken-1]; + + for ($i=1; $i<=17; $i++){ + $currentFullPath = `substitute "/" $currentFullPath "\\"`; + } + + system ("echo copy \""+$currentFullPath+"\" \""+$copyPath+"\">>\""+$copyPath+"copyFileTex_"+$batchName+"\""); + + +} + +system ("echo del \""+$copyPath+"copyFileTex_"+$batchName+"\">>\""+$copyPath+"copyFileTex_"+$batchName+"\""); +system ("start \""+$copyPath+"copyFileTex_"+$batchName+"\""); + +if ($modTexNode == 1){ + + for ( $current in $path ) { + + string $currentFullPath = `getAttr ($current + ".ftn")`; + + string $tokFileName[]; + int $numToken = `tokenize $currentFullPath "/" $tokFileName`; + string $fileName = $tokFileName[$numToken-1]; + + setAttr ( $current + ".ftn" ) -type "string" ($copyPath+$fileName); + + } + +} + +return 1; + +} + +// End copy file textures procedure + + +// Get Directory Name + +global proc yuya_getDirProc(){ + +fileBrowser "yuya_getDirNameProc" "Select Directory" "directory" 4; + +} + +global proc yuya_getDirNameProc(string $dir, string $type){ + +textFieldGrp -e -fileName ($dir+"\\") yuya_cftDirField; + +} + diff --git a/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/yuya_copyFileTex.xpm b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/yuya_copyFileTex.xpm new file mode 100644 index 0000000..ef06b32 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/SimpsonsArt/yuya_copyFileTex.xpm @@ -0,0 +1,198 @@ +/* XPM */ +static char *FILE_xpm[]={ +"32 32 163 2", +" c #C1C1C1", +" 0 c #9C9C00", +" 1 c #FFFF9C", +" 2 c #9D9C01", +" 3 c #9F9D04", +" 4 c #A29F0A", +" 5 c #A6A111", +" 6 c #ABA317", +" 7 c #AFA61E", +" 8 c #FFFE9C", +" 9 c #FFFC9C", +" a c #FFF79C", +" b c #FFF29C", +" c c #FFED9C", +" d c #F9E095", +" e c #A69720", +" f c #000000", +" g c #FFFFFF", +" h c #FFE79C", +" i c #EDCC86", +" j c #8F7717", +" k c #FFFD9C", +" l c #FFF39C", +" m c #FFE89C", +" n c #FFE29C", +" o c #E6C07E", +" p c #836614", +" q c #FFF89C", +" r c #FFE39C", +" s c #FFDE9C", +" t c #E6BC7E", +" u c #856615", +" v c #FFFB9C", +" w c #FFEE9C", +" x c #FFDA9C", +" y c #E6BA7E", +" z c #866817", +" A c #FFD69C", +" B c #8D8700", +" C c #6E5D00", +" D c #FFE99C", +" E c #9E9D03", +" F c #F0E7A5", +" G c #F0E3A5", +" H c #D0A99C", +" I c #945866", +" J c #C0AC92", +" K c #E6DD7E", +" L c #B49840", +" M c #9F9E06", +" N c #D1C8A8", +" O c #BC0000", +" P c #DD0000", +" Q c #E00305", +" R c #CF7777", +" S c #A3A33A", +" T c #E5E59B", +" U c #A29F09", +" V c #A5A10F", +" W c #A9A315", +" X c #A9A072", +" Y c #572323", +" Z c #E20507", +" & c #D26364", +"0 c #E6E6AB", +"00 c #652425", +"01 c #D50609", +"02 c #E40607", +"03 c #D65151", +"04 c #EDE6A2", +"05 c #F4F4A3", +"06 c #B7B3B3", +"07 c #591212", +"08 c #BD0304", +"09 c #FFF59C", +"0a c #BDBBBB", +"0b c #6B1313", +"0c c #D5080A", +"0d c #DB4A44", +"0e c #EDE686", +"0f c #C7B257", +"0g c #B8964B", +"0h c #B49740", +"0i c #B49640", +"0j c #B49540", +"0k c #B49440", +"0l c #C7AB57", +"0m c #EDDC86", +"0n c #A4A429", +"0o c #D81511", +"0p c #E10A09", +"0q c #E45F48", +"0r c #E3362A", +"0s c #E7090A", +"0t c #E6DC7E", +"0u c #E6DB7E", +"0v c #E6D97E", +"0w c #E6D87E", +"0x c #E6D67E", +"0y c #E6D47E", +"0z c #F9EA95", +"0A c #FFF09C", +"0B c #AAA23E", +"0C c #B57C67", +"0D c #BE0706", +"0E c #E5090B", +"0F c #FEFD9C", +"0G c #FFFA9C", +"0H c #FFF19C", +"0I c #FFEF9C", +"0J c #B40D04", +"0K c #D50508", +"0L c #E20608", +"0M c #F2D892", +"0N c #FFF99C", +"0O c #FFF69C", +"0P c #FFF49C", +"0Q c #FFEA9C", +"0R c #BBB9B9", +"0S c #652324", +"0T c #5A1614", +"0U c #773E2B", +"0V c #B60304", +"0W c #D60A0B", +"0X c #E8090B", +"0Y c #E8966D", +"0Z c #FFEC9C", +"0& c #AAAA49", +"1 c #B8AF9D", +"10 c #825757", +"11 c #86523D", +"12 c #822617", +"13 c #994D30", +"14 c #D0281C", +"15 c #E5080A", +"16 c #DA5D52", +"17 c #E9E5A9", +"18 c #FFEB9C", +"19 c #FFE59C", +"1a c #E5E5AB", +"1b c #BBAB90", +"1c c #946543", +"1d c #903E27", +"1e c #973536", +"1f c #E9E4A9", +"1g c #FFE49C", +"1h c #E4E2AC", +"1i c #E4E1AC", +"1j c #E4E0AC", +"1k c #AE9278", +"1l c #E9E2A9", +"1m c #FFE69C", +"1n c #FFE09C", +"1o c #FFE19C", +"1p c #FFDF9C", +"1q c #FFDD9C", +"1r c #FFDB9C", +"1s c #FFDC9C", +"1t c #FFD89C", +"1u c #FFD99C", +"1v c #FFD79C", +"1w c #FFD59C", +"1x c #FFD49C", +" ", +" 0 0 0 ", +" 0 0 0 1 0 0 0 ", +" 0 0 1 1 1 1 1 0 2 3 4 5 6 7 ", +" 0 1 1 1 1 1 1 8 9 a b c d e f f f g g g f f f g g g ", +" 0 1 1 1 1 1 8 9 a b c h i j f f f g g g f f f g g g ", +" 0 1 1 1 1 k 9 a l c m n o p f f f g g g f f f g g g ", +" 0 1 1 1 k 9 q l c m r s t u g g g f f f g g g f f f ", +" 0 1 1 k v q l w m r s x y z g g g f f f g g g f f f ", +" 0 8 k v q l w m r s x A B C g g g f f f g g g f f f ", +" 2 k v q l w D r s 0 0 0 B C f f f g g g f f f g g g ", +" E v q F G H I J 0 0 1 1 K L f f f g g g f f f g g g ", +" M q l N O P Q R S T 1 1 K L f f f g g g f f f g g g ", +" U V W X Y O Q Z &0 1 1 K L g g g f f f g g g f f f 0 0 ", +" 0001 Z02030405 K L g g g f f f g g g f f f a 0 ", +" 06070802020304 K L g g g f f f g g g f f f09 0 ", +" 0a0b0c02020d0e0f0g L L L L0h0h0i0j0k0l0m b 0 ", +" 0n0b0o020p0q0r0s K K0t0u0u0v0w0x0y0m0z0A 0 ", +" 0B0C0D02 Z0E0s0s0F 8 k v0G q a09 l0H0I c 0 ", +" 0J0K020L Z0s0s0s0M 9 v0N q0O0P l0H0I c0Q 0 ", +" 0R0S0T0U0V0W0s0X0s0Y v0N q0O0P b0A w0Z0Q m 0 ", +" 0&1 1011121314151617 a09 l b0I w18 D h19 0 ", +" 01a1a1a1b101c1d1e1f09 l0H0I c18 D h1g n 0 ", +" 0 1 8 k1h1i1j1f1k1l b0A w0Z0Q m1m1g n1n 0 ", +" 0 8 k 90G0N a0O0P b0A w0Z0Q m19 r1o1p1q 0 ", +" 0 k 90G q a09 l0H0I c18 D h19 r1o1p1q1r 0 ", +" 0 v0G q0O09 l0H0I c18 D1m1g n1n s1s x1t 0 ", +" 00N q0O0P b0A w0Z0Q m1m1g n1p s1r x1t A 0 ", +" 0 a090P b0A w0Z D h19 r1o1p1q1r1u1v1w1x 0 ", +" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ", +" ", +" "}; diff --git a/tools/MayaTools/Maya4.0/scripts/others/TerrainType.mel b/tools/MayaTools/Maya4.0/scripts/others/TerrainType.mel new file mode 100644 index 0000000..79026d6 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/TerrainType.mel @@ -0,0 +1,426 @@ +//=========================================================================== +// Copyright ©2002 Radical Entertainment Ltd. All rights reserved. +// +// Component: TerrainType.mel +// +// Description: Provides a UI for applying the Pure3D Game Attribute +// '.TerrainType' to Materials. +//=========================================================================== + +//=========================================================================== +// version +//=========================================================================== +// Description: Returns the current version for this MEL script. +// Used for version control. +//=========================================================================== +proc float version() +{ + return ( 1.1 ); +} + +// //////////////////////////////////////////////////////////////// +// rootNode +// +// Description: Strips the dot-suffix of the specified string. +// e.g. "object.attribute" is returned as "object" + +proc string rootNode( string $object ) +{ + string $buffer[]; + tokenize $object "." $buffer; + return $buffer[0]; +} + +proc string getFacetSG( string $facet ) +// Input (string) - facet component to query (e.g. "pSphere1.f[0]") +// Result (string) - Shading Group shading facet (e.g. "lambert2SG") +{ + string $facetSG = ""; + + // Get array of all Shading Groups + string $shadingGroups[] = `ls -type shadingEngine`; + + for ( $shadingGroup in $shadingGroups ) + { + // If this facet is a member of the shading set for this + // Shading Group, tag this as the facet's shader + + // NOTE: This _fails!_ if the entire object is assigned to the shader, + // and no face components are represented in the Shading Group set. + if ( `sets -isMember $shadingGroup $facet` ) + { + $facetSG = $shadingGroup; + break; + } + } + + return $facetSG; +} + +// ////////////////////////////////////////////////////////////////////// +// getMaterialFromSG +// +// Description: Returns the Material node feeing the '.surfaceShader' +// attribute of the specified Shading Group node (shadingEngine). + +proc string getMaterialFromSG( string $SG ) +{ + string $material = ""; + + if ( "shadingEngine" == `nodeType $SG` && `connectionInfo -id ( $SG + ".surfaceShader" )` ) + $material = rootNode( `connectionInfo -sfd ( $SG + ".surfaceShader" )` ); + + return $material; +} + +// //////////////////////////////////////////////////////////////////////// +// getSGFromMaterial +// +// Description: Returns the Shading Group node being fed by the '.outColor' +// attribute of the specified Material node +proc string[] getSGFromMaterial( string $material ) +{ + string $SG[]; + + string $class[] = getClassification( `nodeType $material` ); + + if ( "shader/surface" == $class[0] && `connectionInfo -is ( $material + ".outColor" )` ) + { + string $dests[] = `connectionInfo -dfs ( $material + ".outColor" )`; + for ( $dest in $dests ) + { + if ( "shadingEngine" == `nodeType $dest` ) + { + $SG[`size $SG`] = rootNode( $dest ); + } + } + } + + return $SG; +} + +proc int TerrainTypeEnum() +{ + string $enumUI = "TerrainTypeEnumUI"; + string $interiorUI = "TerrainTypeInteriorUI"; + + int $enumType = `optionMenu -q -select $enumUI`; + $enumType--; // Convert from 1-based to 0-based + $enumType--; // Skip "Undefined" + + int $isInterior = `checkBox -q -value $interiorUI`; + if ( $isInterior ) $enumType += 1073741824; // ( 2 ** 30 ) + + return $enumType; +} + +proc SetTerrainTypeEnum( int $enumType ) +{ + int $bIsInterior = false; + + if ( $enumType > 1073741823 ) + { + $enumType -= 1073741824; // ( 2 ** 30 ) + $bIsInterior = true; + } + + $enumType++; // Skip "Undefined" + $enumType++; // Convert from 0-based to 1-based + + string $enumUI = "TerrainTypeEnumUI"; + string $interiorUI = "TerrainTypeInteriorUI"; + + optionMenu -e -select $enumType $enumUI; + checkBox -e -value $bIsInterior $interiorUI; +} + +proc string[] GetSelectionAsFaces() +{ + string $select[] = `ls -sl`; + + $select = `polyListComponentConversion -tf $select`; + $select = `filterExpand -sm 34 -ex true $select`; + + return $select; +} + +proc int HasTerrainAttr( string $node, string $TerrainAttr ) +{ + if ( `attributeQuery -node $node -exists $TerrainAttr` ) return true; + return false; +} + +proc AssignTerrainType( string $node, string $TerrainAttr, int $type ) +{ + if ( HasTerrainAttr( $node, $TerrainAttr ) ) + { + setAttr ( $node + "." + $TerrainAttr ) $type; + } +} + +proc int GetTerrainType( string $node, string $TerrainAttr ) +{ + int $type = 0; + if ( HasTerrainAttr( $node, $TerrainAttr ) ) + { + $type = `getAttr ( $node + "." + $TerrainAttr )`; + } + return $type; +} + +proc int AddTerrainTypeAttr( string $node, string $TerrainAttr ) +{ + // Does the .TerrainType attr exist? + if ( `attributeQuery -node $node -exists $TerrainAttr` ) + { + return false; + } + + // Add the P3DGameAttr + if ( !`attributeQuery -node $node -exists "P3D_GameAttr"` ) + { + addAttr -ln P3D_GameAttr -dt "string" -hidden true $node; + } + + // Add the TerrainAttr to the P3DGameAttr + string $gameAttr = `getAttr ( $node + ".P3D_GameAttr" )`; + if ( $gameAttr != "" ) + { + $gameAttr += "~"; + } + $gameAttr = $gameAttr + $TerrainAttr; + setAttr -type "string" ( $node + ".P3D_GameAttr" ) $gameAttr; + + // Add the .TerrainType attribute + addAttr -ln $TerrainAttr -at "long" -hidden true $node; + + return true; +} + +global proc TerrainType_Apply( string $TerrainAttr ) +{ + int $type = TerrainTypeEnum(); + if ( $type < 0 ) return; // Don't bother with "Undefined" + + string $materials[] = `ls -sl -materials`; + + for ( $m in $materials ) + { + if ( ( $m == "lambert1" ) || ( $m == "particleCloud1" ) ) continue; + + AddTerrainTypeAttr( $m, $TerrainAttr ); + + AssignTerrainType( $m, $TerrainAttr, $type ); + } +} + +global proc TerrainType_ApplyIndirect( string $TerrainAttr ) +{ + int $type = TerrainTypeEnum(); + if ( $type < 0 ) return; // Don't bother with "Undefined" + + string $select[] = GetSelectionAsFaces(); + + for ( $f in $select ) + { + string $sg = getFacetSG( $f ); + + if ( ( $sg == "" ) || ( $sg == "initialShadingGroup" ) ) continue; + + string $mat = getMaterialFromSG( $sg ); + + if ( $mat != "" ) + { + AddTerrainTypeAttr( $mat, $TerrainAttr ); + + AssignTerrainType( $mat, $TerrainAttr, $type ); + } + } +} + +global proc TerrainType_Select( string $TerrainAttr ) +{ + int $enumType = TerrainTypeEnum(); + + string $matches[]; + + string $materials[] = `ls -materials`; + + for ( $m in $materials ) + { + if ( ( $m == "lambert1" ) || ( $m == "particleCloud1" ) ) continue; + + if ( + ( HasTerrainAttr( $m, $TerrainAttr ) && GetTerrainType( $m, $TerrainAttr ) == $enumType ) || + ( $enumType < 0 ) && ( !HasTerrainAttr( $m, $TerrainAttr ) ) + ) + { + $matches[`size $matches`] = $m; + } + } + + select $matches; + +} + +global proc TerrainType_SelectIndirect( string $TerrainAttr ) +{ + int $enumType = TerrainTypeEnum(); + + string $matches[]; + + string $materials[] = `ls -materials`; + + for ( $m in $materials ) + { + if ( + ( HasTerrainAttr( $m, $TerrainAttr ) && GetTerrainType( $m, $TerrainAttr ) == $enumType ) || + ( $enumType < 0 ) && ( !HasTerrainAttr( $m, $TerrainAttr ) ) + ) + { + string $sg[] = getSGFromMaterial( $m ); + for ( $s in $sg ) + { + $matches[`size $matches`] = $s; + } + } + + } + + // Don't alter user selection if nothing found. + if ( `size $matches` > 0 ) + { + select $matches; + } +} + +global proc TerrainType_SelectionCallback( string $TerrainAttr ) +{ + string $materials[] = `ls -sl -materials`; + if ( `size $materials` > 0 ) + { + if ( HasTerrainAttr( $materials[0], $TerrainAttr ) ) + { + int $type = `getAttr ( $materials[0] + "." + $TerrainAttr )`; + SetTerrainTypeEnum( $type ); + } + else + { + SetTerrainTypeEnum( -1 ); + } + + TerrainType_EnumCallback(); // update the optionMenu + } +} + +global proc TerrainType_EnumCallback() +{ + string $enumUI = "TerrainTypeEnumUI"; + string $applyMaterialUI = "TerrainTypeApplyMaterialUI"; + string $applyObjectUI = "TerrainTypeApplyObjectUI"; + + int $enable = `optionMenu -q -select $enumUI` > 1; + button -e -enable $enable $applyMaterialUI; + button -e -enable $enable $applyObjectUI; +} + +global proc TerrainType() +{ + string $TerrainAttr = "TerrainType"; + + string $windowUI = "TerrainTypeUI"; + + string $enumUI = "TerrainTypeEnumUI"; + string $interiorUI = "TerrainTypeInteriorUI"; + string $applyMaterialUI = "TerrainTypeApplyMaterialUI"; + string $applyObjectUI = "TerrainTypeApplyObjectUI"; + + string $enumArray[] = + { + "* Undefined *", + "Road", + "Grass", + "Sand", + "Gravel", + "Water", + "Wood", + "Metal", + "Dirt" + }; + + if ( `window -exists $windowUI` ) + deleteUI -window $windowUI; + + window -title ( "Terrain Type v" + version() ) $windowUI; + + columnLayout -adj true; + + frameLayout -label "Surface"; + columnLayout -adj true; + optionMenu $enumUI; + for ( $e = 0; $e < `size $enumArray`; $e++ ) + { + menuItem -label $enumArray[$e]; + } + checkBox -label "Interior" -align "left" $interiorUI; + setParent ..; + setParent ..; + + frameLayout -label "Materials"; + columnLayout -adj true; + + button + -label "Apply To Materials" + -c ( "TerrainType_Apply \"" + $TerrainAttr + "\"" ) + -ann "Applies the displayed Terrain Type to all selected Materials." + $applyMaterialUI; + button + -label "Select Assigned Materials" + -c ( "TerrainType_Select \"" + $TerrainAttr + "\"" ) + -ann "Selects all Materials assigned to the displayed Terrain Type."; + + + setParent ..; + + setParent ..; + + + frameLayout -label "Objects"; + columnLayout -adj true; + + button + -label "Apply To Objects" + -c ( "TerrainType_ApplyIndirect \"" + $TerrainAttr + "\"" ) + -ann "Applies the displayed Terrain Type to all Materials assigned to the selected objects." + $applyObjectUI; + button + -label "Select Assigned Objects" + -c ( "TerrainType_SelectIndirect \"" + $TerrainAttr + "\"" ) + -ann "Selects all objects assigned to Materials bearing the displayed Terrain Type."; + setParent ..; + + setParent ..; + + setParent ..; + + // Option Menu should respond to user selection, to reflect current type + // of selected material + scriptJob -parent $enumUI -event "SelectionChanged" ( "TerrainType_SelectionCallback \"" + $TerrainAttr + "\"" ); + + optionMenu -e + -cc TerrainType_EnumCallback + -select 2 + $enumUI; + + checkBox -e + -value off + $interiorUI; + + TerrainType_SelectionCallback $TerrainAttr; + + showWindow $windowUI; +} + +/* +source TerrainType; TerrainType; +*/ diff --git a/tools/MayaTools/Maya4.0/scripts/others/bobsMenu.mel b/tools/MayaTools/Maya4.0/scripts/others/bobsMenu.mel new file mode 100644 index 0000000..b8c5b4a --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/bobsMenu.mel @@ -0,0 +1,33 @@ +global proc bobsMenu(){ + + global string $gMainWindow; + + setParent $gMainWindow; + + menu -l "Bobs Menu" + -p MayaWindow + -to 1 + -aob true + -fi "bob_Mr_T.bmp" + bobsMenu; + + menuItem -l "Refresh Layers" + -ann ("") + -echoCommand true + -c "reBuildLayers" + reBuildLayers; + + menuItem -divider true; + + menuItem -l "Persp To Ortho" + -ann ("") + -echoCommand true + -c "swapCamera 0" + swapCamera; + + menuItem -l "Back To Persp" + -ann ("") + -echoCommand true + -c "swapCamera 1" + swapCamera2; +};
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/os_cleanup.mel b/tools/MayaTools/Maya4.0/scripts/others/os_cleanup.mel new file mode 100644 index 0000000..020de04 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/os_cleanup.mel @@ -0,0 +1,3 @@ + + +os_RemoveUI();
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/os_main.mel b/tools/MayaTools/Maya4.0/scripts/others/os_main.mel new file mode 100644 index 0000000..7a8c567 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/os_main.mel @@ -0,0 +1,228 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved. +// +// TE_main.mel +// +// Description: Installs the Object Snapper (OS) interface. +// As a convention all Object Snapper global procedures +// and global variables are prefixed with "os_". All commands +// exposed through OS plugins are prefixed with "OS_". +// +// MCB = Menu Call Back +// BCB = Button Call Back +// +// Modification History: +// + Created March 18 2002 -- Cary Brisebois +//----------------------------------------------------------------------------- + + +global float $gOS_Offset = 0.10; + + +//----------------------------------------------------------------------------- +// o s _ b r e a k p o i n t +// +// Synopsis: +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc os_breakpoint( string $tag ) +{ + confirmDialog -m ( "BreakPoint: " + $tag ); +} + +//----------------------------------------------------------------------------- +// o s _ M C B _ A b o u t +// +// Synopsis: Display an About Object Snapper window. +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc os_MCB_About() +{ + string $pluginVersion = "1.0"; + + string $message = ( "\nSimpsons Road Rage Object Snapper.\n\n" + + "Release " + $pluginVersion + "\n" + + "(c) 2001, Radical Entertainment, Ltd.\n\n" ); + + + confirmDialog -title "About Object Snapper" + -message $message + -button "OK" + -defaultButton "OK"; +} + +//----------------------------------------------------------------------------- +// o s _ d o M a i n M e n u I t e m s +// +// Synopsis: Creates the OS menu on the menu handle passed in. +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc os_doMainMenuItems( string $menu ) +{ + menu -edit -tearOff true -allowOptionBoxes true $menu; + + menuItem -label "Snap Single Selected" -command ( "os_MCB_SnapSingleSelected()" ); + + menuItem -divider true; + + menuItem -label "Snap All Selected" -command ( "os_MCB_SnapSelected()" ); + + menuItem -divider true; + + menuItem -label "Snap Tree Line" -command ( "os_MCB_SnapTreeLine()" ); + + menuItem -divider true; + + menuItem -label "About" -command "os_MCB_About()"; + + menuItem -optionBox true -command "os_MCB_OSOptions()"; + + setParent -m ..; +} + +//----------------------------------------------------------------------------- +// o s _ I n s t a l l U I +// +// Synopsis: +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc os_InstallUI() +{ + + global string $gMainWindow; + + // + // Install OS menu as a root menu. + // + if ( `menu -exists os_MainMenu` ) deleteUI os_MainMenu; + menu -label "Object Snapper" -allowOptionBoxes true -parent $gMainWindow os_MainMenu; + + os_doMainMenuItems "os_MainMenu"; +} + +//============================================================================== +// global proc os_RemoveUI +//============================================================================== +// Description: Comment +// +// Parameters: () +// +// Return: global +// +//============================================================================== +global proc os_RemoveUI() +{ + if ( `menu -exists os_MainMenu` ) deleteUI os_MainMenu; + if ( `window -exists os_OptionWindow` ) deleteUI os_OptionWindow; +} + +//============================================================================== +// global proc os_MCB_SnapSelected +//============================================================================== +// Description: Comment +// +// Parameters: () +// +// Return: global +// +//============================================================================== +global proc os_MCB_SnapSelected() +{ + global float $gOS_Offset; + + OS_SnapSelected( $gOS_Offset, 0 ); +} + + +//============================================================================== +// global proc os_MCB_SnapSingleSelected +//============================================================================== +// Description: Comment +// +// Parameters: () +// +// Return: global +// +//============================================================================== +global proc os_MCB_SnapSingleSelected() +{ + global float $gOS_Offset; + + OS_SnapSelected( $gOS_Offset, 1 ); +} + +//============================================================================= +// global proc os_MCB_SnapTreeLine +//============================================================================= +// Description: Comment +// +// Parameters: () +// +// Return: global +// +//============================================================================= +global proc os_MCB_SnapTreeLine() +{ + global float $gOS_Offset; + + OS_SnapSelected( $gOS_Offset, 2 ); +} + +//============================================================================== +// global proc os_MCB_OSOptions +//============================================================================== +// Description: Comment +// +// Parameters: () +// +// Return: global +// +//============================================================================== +global proc os_MCB_OSOptions() +{ + global float $gOS_Offset; + + if ( `window -exists os_OptionWindow` ) deleteUI os_OptionWindow; + + window -title "Object Snapper Options" os_OptionWindow; + + columnLayout; + + rowLayout -nc 2; + + text -label "Offset (M):"; + + floatField -min -10.0 -max 10.0 -value $gOS_Offset -cc ("$gOS_Offset = #1"); + + setParent ..; + + setParent ..; + + showWindow; +} + +evalDeferred "os_InstallUI";
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/reBuildLayers.mel b/tools/MayaTools/Maya4.0/scripts/others/reBuildLayers.mel new file mode 100644 index 0000000..1d126be --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/reBuildLayers.mel @@ -0,0 +1,111 @@ +global proc reBuildLayers() +{ +//Delete the first 40 layers + +$DeleteLayer_Index = 1; +$DeleteLayer_NumTimes = 40; +while ($DeleteLayer_Index++ < $DeleteLayer_NumTimes) +{ +layerEditorLayerButtonSelect 1 ""; +layerEditorDeleteLayer ""; +}; + +//list all top groups + +SelectAllCameras; +$cameras = `ls -sl`; + +SelectAllLights; +$lights = `ls -sl`; + +string $misc[]; +if (`objExists "p3dExporterOptions*"`) +{ +select "p3dExporterOptions*"; +$misc = `ls -sl`; +}; + +select -ado; +select -d $cameras $misc $lights; +$TopGroups = `ls -sl`; +string $TopGroup; + +//create a layer for each top groups + +for ($TopGroup in $TopGroups) +{ + select -r $TopGroup; + createDisplayLayer -name ("TG_" + $TopGroup); +}; + +SelectAllJoints; +createDisplayLayer -name "All_BVs"; + +if (`objExists "*L01only*"`) +{ +select -r "*L01only*"; +createDisplayLayer -name "KG_L01only"; +}; + +if (`objExists "*L02only*"`) +{ +select -r "*L02only*"; +createDisplayLayer -name "KG_L02only"; +}; + +if (`objExists "*L03only*"`) +{ +select -r "*L03only*"; +createDisplayLayer -name "KG_L03only"; +}; + +if (`objExists "*L04only*"`) +{ +select -r "*L04only*"; +createDisplayLayer -name "KG_L04only"; +}; + +if (`objExists "*L05only*"`) +{ +select -r "*L05only*"; +createDisplayLayer -name "KG_L05only"; +}; + +if (`objExists "*L06only*"`) +{ +select -r "*L06only*"; +createDisplayLayer -name "KG_L06only"; +}; + +if (`objExists "*L07only*"`) +{ +select -r "*L07only*"; +createDisplayLayer -name "KG_L07only"; +}; + + +//change color of specific layers + +if (`objExists "TG_*gens*.color"`) + setAttr "TG_*gens*.color" 29; + +if (`objExists "TG_*landmarks*.color"`) + setAttr "TG_*landmarks*.color" 30; + +if (`objExists "TG_*dynamics*.color"`) + setAttr "TG_*dynamics*.color" 22; + +if (`objExists "TG_*track*.color"`) + setAttr "TG_*track*.color" 28; + +if (`objExists "All_BVs"`) + setAttr "All_BVs.color" 6; + +if (`objExists "TG_*work*.color"`) +{ + setAttr "TG_*work*.color" 13; + setAttr "TG_*work*.visibility" 0; +}; +}; + + diff --git a/tools/MayaTools/Maya4.0/scripts/others/showAndLight.mel b/tools/MayaTools/Maya4.0/scripts/others/showAndLight.mel new file mode 100644 index 0000000..973c0d4 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/showAndLight.mel @@ -0,0 +1,113 @@ +global proc swapGeo (string $showGeo , string $hideGeo1, string $hideGeo2)
+{
+select -r ("*" + $showGeo + "only*");
+ //select -r ("*" + 02 + "only*");//
+select -hi;
+ShowSelectedObjects;
+select -r ("*" + $hideGeo1 + "only*");
+ //select -r ("*" + 05 + "only*");//
+select -add ("*" + $hideGeo2 + "only*");
+ //select -add ("*" + 05 + "only*");//
+select -hi;
+HideSelectedObjects;
+select -cl;
+};
+
+proc ShowBVShapes ()
+{
+select -r "P3D_BVol*Shape*" ;
+$select = `ls -sl`;
+string $sel;
+for ($sel in $select)
+ setAttr ($sel + ".visibility") 1;
+};
+
+
+
+//=============================================//
+global proc selectDrawableOnly ()
+{
+ $shapeSel = `ls -sl -s -v`;
+ select $shapeSel;
+}
+global proc hideDontlight ()
+{
+if ( `objExists "*dontlight*"` )
+{
+ select -r "*dontlight*";
+ select -hi;
+ HideSelectedObjects;
+}
+else
+ { warning("there are no objects that you don't want to light?"); };
+};
+
+global proc showDontlight ()
+{
+if ( `objExists "*dontlight*"` )
+{
+ select -r "*dontlight*";
+ select -hi;
+ ShowSelectedObjects;
+}
+else
+ { warning("there are no objects that you don't want to light?"); };
+};
+
+
+global proc selectVisGeo ()
+
+{
+if ( `objExists "*landmarks*"` )
+{
+ select -add -vis "*landmarks*";
+}
+else
+{
+warning("there are no landmarks in your scene?");
+};
+select -add -vis "*gens*";
+select -add -vis "*track*";
+select -add -vis "*dynamics*";
+select -hi;
+}
+;
+
+
+
+
+//=============================================//
+
+
+
+
+global proc bobPrelight ()
+{
+toggleMaterialMapping(0);polyGeoSampler -cs -ul -sf 1 -su -colorBlend "overwrite" -alphaBlend "overwrite"; toggleMaterialMapping(1);
+}
+;
+
+
+
+
+//=============================================//
+
+
+
+
+global proc showAndLight (string $wang, string $chung, string $fung)
+{
+swapGeo $wang $chung $fung;
+hideDontlight;
+selectVisGeo;
+selectDrawableOnly;
+bobPrelight;
+showDontlight;
+swapGeo $wang $chung $fung;
+ShowBVShapes;
+};
+//showAndLight 06 03 03;//
+//showAndLight 03 06 06;//
+
+
+
diff --git a/tools/MayaTools/Maya4.0/scripts/others/swapCamera.mel b/tools/MayaTools/Maya4.0/scripts/others/swapCamera.mel new file mode 100644 index 0000000..5e1a9a3 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/swapCamera.mel @@ -0,0 +1,104 @@ +proc swapCamDefaults (){ +global string $camera[]; +global float $camRotY; +global float $camRotX; +global float $camRotZ; +global float $camTranY; +global float $camTranX; +global float $camTranZ; +$camera[0]= "persp"; +float $camRotY =0; +float $camRotX =0; +float $camRotZ =0; +float $camTranY =0; +float $camTranX =0; +float $camTranZ =0; +}; + +global proc perspToOrtho(){ +global string $camera[]; +global float $camRotY; +global float $camRotX; +global float $camRotZ; +global float $camTranY; +global float $camTranX; +global float $camTranZ; + +$temp = `ls -sl`; +{ string $camera = `modelPanel -q -camera modelPanel4`; eval select `getCameraNode view $camera` `getCameraNode up $camera` $camera; }; +$camera = `ls -sl`; +$camRotY = `getAttr ($camera[0] + ".rotateY")`; +$camRotX = `getAttr ($camera[0] + ".rotateX")`; +$camRotZ = `getAttr ($camera[0] + ".rotateZ")`; +$camTranY = `getAttr ($camera[0] + ".translateY")`; +$camTranX = `getAttr ($camera[0] + ".translateX")`; +$camTranZ = `getAttr ($camera[0] + ".translateZ")`; +int $camRotY1; +int $camRotX1; +int $camRotZ1; +if ($camRotY <= 0) + $camRotY1 = (($camRotY-45) % 360.0) / 90; +else + $camRotY1 = (($camRotY+45) % 360.0) / 90; +$camRotY90 = $camRotY1 * 90; + +if ($camRotX <= 0) + $camRotX1= (($camRotX-45) % 360.0) / 90; +else + $camRotX1= (($camRotX+45) % 360.0) / 90; +$camRotX90 = $camRotX1 * 90; +if ($camRotZ <= 0) + $camRotZ1= (($camRotZ-45) % 360.0) / 90; +else + $camRotZ1= (($camRotZ+45) % 360.0) / 90; +$camRotZ90 = $camRotZ1 * 90; + +//$camRotZ90 = (floor ((($camRotZ+45) % 360.0)/90))*90;// +//makes ortho// +setAttr ($camera[0] + ".rotateY") $camRotY90; +setAttr ($camera[0] + ".rotateX") $camRotX90; +setAttr ($camera[0] + ".rotateZ") $camRotZ90; +setAttr ($camera[0] + ".orthographic") 1; +select $temp; +fitPanel -selected; +print "camera square"; +}; + + +//orthoToPersp $camera[0] $camRotY $camRotX $camRotZ $camTranY $camTranX $camTranZ +global proc orthoToPersp() +{ +global string $camera[]; +global float $camRotY; +global float $camRotX; +global float $camRotZ; +global float $camTranY; +global float $camTranX; +global float $camTranZ; +setAttr ($camera[0] + ".rotateY") $camRotY; +setAttr ($camera[0] + ".rotateX") $camRotX; +setAttr ($camera[0] + ".rotateZ") $camRotZ; +setAttr ($camera[0] + ".translateY") $camTranY; +setAttr ($camera[0] + ".translateX") $camTranX; +setAttr ($camera[0] + ".translateZ") $camTranZ; +setAttr ($camera[0] + ".orthographic") 0; +}; + +global proc swapCamera(int $sway){ +global string $camera[]; +global float $camRotY; +global float $camRotX; +global float $camRotZ; +global float $camTranY; +global float $camTranX; +global float $camTranZ; +switch ($sway){ + +case 0: + perspToOrtho; + break; +case 1: + orthoToPersp; + break; +}; +};
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_BVContext.mel b/tools/MayaTools/Maya4.0/scripts/others/te_BVContext.mel new file mode 100644 index 0000000..e835468 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/te_BVContext.mel @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved. +// +// te_BVContext.mel +// +// Description: Defines all the scripts required by the BVContext tool +// As a convention all Terrain Editor global procedures +// and global variables are prefixed with "te_". All commands +// exposed through TE plugins are prefixed with "TE_". +// +// MCB = Menu Call Back +// BCB = Button Call Back +// +// Modification History: +// + Created -- CBrisebois +//----------------------------------------------------------------------------- + +//This is the global instance of the bv context tool. + +global proc te_MCB_StartBVLoop() +{ + //Start the BV context... + if ( ! `contextInfo -exists BVCtx` ) + { + BVContext BVCtx; + } + + setToolTo BVCtx; +} + +global proc te_MCB_SplitSelectedBV() +{ + //Call the API function. + BVSplitSelected(); +} + +global proc te_Delete_BVContext() +{ + if ( `contextInfo -exists BVCtx` ) + { + deleteUI -toolContext BVCtx; + } +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_IntersectionContext.mel b/tools/MayaTools/Maya4.0/scripts/others/te_IntersectionContext.mel new file mode 100644 index 0000000..54561ff --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/te_IntersectionContext.mel @@ -0,0 +1,212 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved. +// +// te_IntersectionContext.mel +// +// Description: Defines all the scripts required by the IntersectionContext tool +// As a convention all Terrain Editor global procedures +// and global variables are prefixed with "te_". All commands +// exposed through TE plugins are prefixed with "TE_". +// +// MCB = Menu Call Back +// BCB = Button Call Back +// +// Modification History: +// + Created -- CBrisebois +//----------------------------------------------------------------------------- + +//This is the global instance of the bv context tool. + +global proc te_MCB_StartIntersection() +{ + //Start the Intersection context... + if ( ! `contextInfo -exists IntersectionCtx` ) + { + IntersectionContext IntersectionCtx; + } + + setToolTo IntersectionCtx; +} + +global string $gSelectedIntersection = ""; +global int $gIntersectionSelectionCallbackID = 0; +global string $gSelectedName; +global string $gTypeField; +global string $gIntersectionTypes[] = { "NoStop", "NWay", "FourWay", "NoStopN", "NWayN" }; + +global proc te_MCB_EditIntersection() +{ + global string $gSelectedName; + global int $gIntersectionSelectionCallbackID; + global string $gIntersectionTypes[]; + global string $gTypeField; + + if ( `window -exists TE_InteresctionEditor` ) + { + deleteUI -window TE_IntersectionEditor; + } + + window -rtf true -title "TE Road / Intersection Editor" TE_IntersectionEditor; + + columnLayout -adjustableColumn true; + + $gSelectedName = `textField -editable false -text "" -width 170`; + + $gTypeField = `optionMenu -label "Type" -width 170 -changeCommand ("te_MCB_IntersectionTypeChange( \"#1\" )")`; + + int $index; + int $size = size($gIntersectionTypes); + for ( $index = 0; $index < $size; $index++ ) + { + menuItem -label $gIntersectionTypes[ $index ]; + } + setParent ..; + + button -label "Create Road" -command ( "te_MCB_CreateRoadFromSelected()" ); + button -label "Show Whole Road" -command ( "te_MCB_ShowRoadFromSelected()" ); + button -label "Destroy Road" -command ( "te_MCB_DestroyRoadFromSelected()" ); + button -label "Set Intersection Start" -command ( "te_MCB_AddSelectedIntersectionToRoad( 0 )" ); + button -label "Set Intersection End" -command ( "te_MCB_AddSelectedIntersectionToRoad( 1 )" ); + separator; + button -label "Create Intersections" -command "te_MCB_StartIntersection()"; + + setParent ..; + + showWindow; + + //Create the selection change callback. + $gIntersectionSelectionCallbackID = `scriptJob -parent "TE_IntersectionEditor" -event "SelectionChanged" "te_UpdateIntersectionEditor()"`; + +} + +global proc te_MCB_IntersectionTypeChange( string $value ) +{ + global string $gSelectedIntersection; + + if ( $gSelectedIntersection != "" ) + { + setAttr ( $gSelectedIntersection + ".IntersectionType" ) -type "string" $value; + } +} + +global proc te_CloseIntersectionEditorWindow() +{ + global int $gIntersectionSelectionCallbackID; + + if ( `window -exists TE_InteresctionEditor` ) + { + deleteUI -window TE_IntersectionEditor; + } + + $gIntersectionSelectionCallbackID = 0; +} + +global proc te_UpdateIntersectionEditor() +{ + global string $gSelectedIntersection; + global string $gSelectedName; + global string $gTypeField; + global string $gIntersectionTypes[]; + + string $selectedObjects[] = `ls -sl -dag`; + string $selectedObjectName = $selectedObjects[0]; + string $selectedNodeType; + + if ( $selectedObjectName != "" ) + { + //There is something selected + + $selectedNodeType = `nodeType $selectedObjectName `; + + if ( $selectedNodeType == "transform" ) + { + //We don't want the transform, we want the child node. + string $children[] = `listRelatives -c $selectedObjectName`; + $selectedObjectName = $children[0]; + } + + if ( $selectedObjectName != "" ) + { + $selectedNodeType = `nodeType $selectedObjectName `; + + if ( $selectedNodeType == "IntersectionLocatorNode" ) + { + //We're in business + textField -edit -text $selectedObjectName $gSelectedName; + + string $value = `getAttr ( $selectedObjectName + ".IntersectionType" )`; + + //Which index is this string? + int $size = size( $gIntersectionTypes ); + int $index; + + for ( $index = 0; $index < $size; $index++ ) + { + if ( $gIntersectionTypes[ $index ] == $value ) + { + optionMenu -edit -sl ($index + 1) $gTypeField; + break; + } + } + + if ( $index == $size ) + { + //This node had no proper setting. Resetting it. + warning "Node had invalid type setting. Correcting to default type"; + + optionMenu -edit -sl 1 $gTypeField; + setAttr ( $selectedObjectName + ".IntersectionType" ) -type "string" $gIntersectionTypes[ 0 ]; + } + + $gSelectedIntersection = $selectedObjectName; + return; + } + else if ( $selectedNodeType == "mesh" ) + { + //This is for adding road to the selected intersection. Do not unselect the intersection. + string $whichRoad[] = `listAttr -st teWhichRoad $selectedObjectName`; + + if ( size( $whichRoad ) ) + { + return; + } + } + } + } + + textField -edit -text "" $gSelectedName; + $gSelectedIntersection = ""; + +} + + + +global proc te_MCB_CreateRoadFromSelected() +{ + TE_CreateRoad(); +} + +global proc te_MCB_ShowRoadFromSelected() +{ + TE_ShowRoad(); +} + +global proc te_MCB_DestroyRoadFromSelected() +{ + TE_DestroyRoad(); +} + +global proc te_MCB_AddSelectedIntersectionToRoad( int $isEnd ) +{ + global string $gSelectedIntersection; + + TE_AddIntersectionToRoad( $gSelectedIntersection, $isEnd ); +} + +global proc te_Delete_IntersectionContext() +{ + if ( `contextInfo -exists IntersectionCtx` ) + { + deleteUI -toolContext IntersectionCtx; + } +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_PPContext.mel b/tools/MayaTools/Maya4.0/scripts/others/te_PPContext.mel new file mode 100644 index 0000000..a8cc63f --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/te_PPContext.mel @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved. +// +// te_PPContext.mel +// +// Description: Defines all the scripts required by the PPContext tool +// As a convention all Terrain Editor global procedures +// and global variables are prefixed with "te_". All commands +// exposed through TE plugins are prefixed with "TE_". +// +// MCB = Menu Call Back +// BCB = Button Call Back +// +// Modification History: +// + Created -- CBrisebois +//----------------------------------------------------------------------------- + +//This is the global instance of the bv context tool. + +global proc te_MCB_StartPPLoop() +{ + //Start the PP context... + if ( ! `contextInfo -exists PPCtx` ) + { + PPContext PPCtx; + } + + setToolTo PPCtx; +} + +global proc te_MCB_SplitSelectedPP() +{ + //Call the API function. + PPSplitSelected(); +} + +global proc te_Delete_PPContext() +{ + if ( `contextInfo -exists PPCtx` ) + { + deleteUI -toolContext PPCtx; + } +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_cleanup.mel b/tools/MayaTools/Maya4.0/scripts/others/te_cleanup.mel new file mode 100644 index 0000000..21f39d3 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/te_cleanup.mel @@ -0,0 +1,12 @@ +te_Delete_TreeLineContext(); +te_Delete_BVContext(); +te_Delete_PPContext(); +te_Delete_IntersectionContext(); +te_CloseIntersectionEditorWindow(); + +if ( `menu -exists te_MainMenu` ) +{ + deleteUI te_MainMenu; + + flushUndo; +} diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_editorwindow.mel b/tools/MayaTools/Maya4.0/scripts/others/te_editorwindow.mel new file mode 100644 index 0000000..1504a52 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/te_editorwindow.mel @@ -0,0 +1,335 @@ +//Constant +global int $gMAX_LANES = 4; + +global string $gSelectedName; +global string $gOriginField; +global string $gRoadField; +global string $gTopField; +global string $gBottomField; +global string $gLanesField; +global string $gShoulderField; + +global int $gSelectionScriptJob; + +global string $gSelectedObjectName; + +global proc teOpenEditorWindow() +{ + global string $gSelectedName; + global string $gOriginField; + global string $gRoadField; + global string $gTopField; + global string $gBottomField; + global string $gLanesField; + global string $gShoulderField; + global int $gMAX_LANES; + + + if ( `window -exists TE_TileEditor` ) + { + deleteUI -window TE_TileEditor; + } + + window -rtf true -title "TE Tile Editor" TE_TileEditor; + + columnLayout -adjustableColumn true; + + string $selectedRow = `rowLayout -numberOfColumns 3 -columnWidth 1 170`; + $gSelectedName = `textField -editable false -text "" -width 170`; + string $selectedButton = `button -label "Select Mesh" -command ("teSelectMesh()")`; + string $doneButton = `button -label "Done" -command ("teDoneEditingMesh()")`; + + setParent ..; + + string $originRow = `rowLayout -numberOfColumns 2`; + string $originButton = `button -label "Set Origin" -command ("teSelectOrigin()")`; + $gOriginField = `intField -value -1 -editable false`; + setParent ..; + + + string $roadRow = `rowLayout -numberOfColumns 2`; + string $roadButton = `button -label "Set Road Dir" -command ("teSelectRoadDir()")`; + $gRoadField = `intField -value -1 -editable false`; + setParent ..; + + + string $topRow = `rowLayout -numberOfColumns 2`; + string $topButton = `button -label "Set TOP" -command ("teSelectTOP()")`; + $gTopField = `intField -value -1 -editable false`; + setParent ..; + + + string $bottomRow = `rowLayout -numberOfColumns 2`; + string $bottomButton = `button -label "Set BOTTOM" -command ("teSelectBOTTOM()")`; + $gBottomField = `intField -value -1 -editable false`; + setParent ..; + + //The following #1 is a trick that the scripting system converts into the value of the field/control... + string $laneRow = `rowLayout -numberOfColumns 2`; + string $laneLabel = `text -label "Num. Lanes" -align "center"`; + $gLanesField = `intField -value 1 -min 0 -max $gMAX_LANES -step 1 -editable true -changeCommand ("teSetNumLanes(#1)")`; + setParent ..; + + $gShoulderField = `checkBox -label "Has Shoulder" -value true -changeCommand ("teSetShoulder(#1)")`; + + setParent ..; //columnLayout + + showWindow; +} + +global proc teCloseEditorWindow() +{ + global string $gSelectedName; + global string $gOriginField; + global string $gRoadField; + global string $gTopField; + global string $gBottomField; + global string $gLanesField; + global string $gShoulderField; + + global int $gSelectionScriptJob; + + if ( `window -exists TE_TileEditor` ) + { + deleteUI -window TE_TileEditor; + } + + $gSelectedName = ""; + $gOriginField = ""; + $gRoadField = ""; + $gTopField = ""; + $gBottomField = ""; + $gLanesField = ""; + $gShoulderField = ""; + + $gSelectionScriptJob = 0; +} + +global proc teSelectMesh() +{ + global string $gSelectedName; + global int $gSelectionScriptJob; + global string $gSelectedObjectName; + + //May want to inform the TrackEditor of this selection if it is good. + string $selectedObjects[] = `ls -sl -dag`; + string $selectedObjectName = $selectedObjects[0]; + string $selectedNodeType; + + if ( $selectedObjectName != "" ) + { + //There is something selected + + $selectedNodeType = `nodeType $selectedObjectName `; + + if ( $selectedNodeType == "transform" ) + { + //We don't want the transform, we want the child node. + $selectedObjectName = $selectedObjects[1]; + } + + if ( $selectedObjectName != "" ) + { + $selectedNodeType = `nodeType $selectedObjectName `; + + if ( $selectedNodeType == "mesh" ) + { + //We're in business + textField -edit -text $selectedObjectName $gSelectedName; + + teSwitchToVertexSelection( 1 ); //Turn on vertex selection. + + teAddSettingsToObject( $selectedObjectName ); + + $gSelectedObjectName = $selectedObjectName; + + teUpdateEditorWindow(); + } + } + } +} + +global proc teUpdateEditorWindow() +{ + global string $gSelectedName; + global string $gOriginField; + global string $gRoadField; + global string $gTopField; + global string $gBottomField; + global string $gSelectedObjectName; + global string $gLanesField; + global string $gShoulderField; + + //Update the fields according to the selected object. + + int $valsSet = false; + + if ( $gSelectedObjectName != "" ) + { + string $attr[] = `listAttr -st teOrigin $gSelectedObjectName`; + + if ( $attr[0] != "" ) + { + textField -edit -text $gSelectedObjectName $gSelectedName; + + float $origin = `getAttr ($gSelectedObjectName + ".teOrigin")`; + intField -edit -value $origin $gOriginField; + + float $road = `getAttr ($gSelectedObjectName + ".teRoad")`; + intField -edit -value $road $gRoadField; + + float $top = `getAttr ($gSelectedObjectName + ".teTop")`; + intField -edit -value $top $gTopField; + + float $bottom = `getAttr ($gSelectedObjectName + ".teBottom")`; + intField -edit -value $bottom $gBottomField; + + int $lanes = `getAttr ($gSelectedObjectName + ".teLanes")`; + intField -edit -value $lanes $gLanesField; + + int $hasShoulder = `getAttr ($gSelectedObjectName + ".teShoulder")`; + checkBox -edit -value $hasShoulder $gShoulderField; + + $valsSet = 1; + } + } + + if ( !$valsSet ) + { + textField -edit -text "" $gSelectedName; + + intField -edit -value -1 $gOriginField; + intField -edit -value -1 $gRoadField; + intField -edit -value -1 $gTopField; + intField -edit -value -1 $gBottomField; + intField -edit -value 0 $gLanesField; + checkBox -edit -value false $gShoulderField; + } +} + +global proc teSwitchToVertexSelection( int $on ) +{ + if ( $on ) + { + selectMode -component; + selectType -vertex true; + } + else + { + selectMode -object; + } +} + +global proc teDoneEditingMesh() +{ + global string $gSelectedObjectName; + + $gSelectedObjectName = ""; //Clear the selection. + + teSwitchToVertexSelection( 0 ); //Turn on vertex selection. + + teUpdateEditorWindow(); +} + +global proc teAddSettingsToObject( string $objectName ) +{ + string $attr[] = `listAttr -st teOrigin $objectName`; + + if ( $attr[0] == "" ) + { + addAttr -ln teOrigin -sn teO -at long -defaultValue -1 $objectName; + + addAttr -ln teRoad -sn teR -at long -defaultValue -1 $objectName; + + addAttr -ln teTop -sn teT -at long -defaultValue -1 $objectName; + + addAttr -ln teBottom -sn teB -at long -defaultValue -1 $objectName; + + addAttr -ln teLanes -sn teL -at long -defaultValue 1 $objectName; + + addAttr -ln teShoulder -sn teS -at bool -defaultValue true $objectName; + + //This is for connecting to roads + addAttr -ln teWhichRoad -sn teWR -at message $objectName; + + //This is a hint of the type + addAttr -ln teTypeHint -sn teTH -at long -defaultValue -1 $objectName; + } +} + +global proc teSelectOrigin() +{ + global string $gSelectedObjectName; + + int $pos = `TE_GetSelectedVertexIndex`; + + if ( $pos >= 0 ) + { + setAttr ( $gSelectedObjectName + ".teOrigin" ) $pos; + } + + teUpdateEditorWindow(); +} + +global proc teSelectRoadDir() +{ + global string $gSelectedObjectName; + + int $pos = `TE_GetSelectedVertexIndex`; + + if ( $pos >= 0 ) + { + setAttr ( $gSelectedObjectName + ".teRoad" ) $pos; + } + + teUpdateEditorWindow(); +} + +global proc teSelectTOP() +{ + global string $gSelectedObjectName; + + int $pos = `TE_GetSelectedVertexIndex`; + + if ( $pos >= 0 ) + { + setAttr ( $gSelectedObjectName + ".teTop" ) $pos; + } + + teUpdateEditorWindow(); +} + +global proc teSelectBOTTOM() +{ + global string $gSelectedObjectName; + + int $pos = `TE_GetSelectedVertexIndex`; + + if ( $pos >= 0 ) + { + setAttr ( $gSelectedObjectName + ".teBottom" ) $pos; + } + + teUpdateEditorWindow(); +} + + +global proc teSetNumLanes( int $numLanes ) +{ + global string $gSelectedObjectName; + + if ( $gSelectedObjectName != "" ) + { + setAttr ( $gSelectedObjectName + ".teLanes" ) $numLanes; + } +} + +global proc teSetShoulder( int $hasShoulder ) +{ + global string $gSelectedObjectName; + + if ( $gSelectedObjectName != "" ) + { + setAttr ( $gSelectedObjectName + ".teShoulder" ) $hasShoulder; + } +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_globals.mel b/tools/MayaTools/Maya4.0/scripts/others/te_globals.mel new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/te_globals.mel @@ -0,0 +1 @@ + diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_main.mel b/tools/MayaTools/Maya4.0/scripts/others/te_main.mel new file mode 100644 index 0000000..6a97582 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/te_main.mel @@ -0,0 +1,195 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved. +// +// TE_main.mel +// +// Description: Installs the Terrain Editor (TE) interface. +// As a convention all Terrain Editor global procedures +// and global variables are prefixed with "te_". All commands +// exposed through TE plugins are prefixed with "TE_". +// +// MCB = Menu Call Back +// BCB = Button Call Back +// +// Modification History: +// + Created Apr 11, 2001 -- bkusy +// + Stolen & Adapted -- CBrisebois +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// t e _ b r e a k p o i n t +// +// Synopsis: +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc te_breakpoint( string $tag ) +{ + confirmDialog -m ( "BreakPoint: " + $tag ); +} + +//----------------------------------------------------------------------------- +// t e _ M C B _ A b o u t +// +// Synopsis: Display an About Terrain Editor window. +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc te_MCB_About() +{ +// string $pluginVersion = `te_GetVersion`; + + string $pluginVersion = "2.0"; + + string $message = ( "\nSimpsons Road Rage Terrain Editor.\n\n" + + "Release " + $pluginVersion + "\n" + + "(c) 2001, Radical Entertainment, Ltd.\n\n" ); + + + confirmDialog -title "About Terrain Editor" + -message $message + -button "OK" + -defaultButton "OK"; +} + +//----------------------------------------------------------------------------- +// t e _ d o M a i n M e n u I t e m s +// +// Synopsis: Creates the TE menu on the menu handle passed in. +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc te_doMainMenuItems( string $menu ) +{ + menu -edit -tearOff true -allowOptionBoxes true $menu; + + menuItem -label "Bounding Fences" -sm true; + + menuItem -label "Create fence line" -command "te_MCB_StartBVLoop()"; + + menuItem -label "Split Fence(s)" -command "te_MCB_SplitSelectedBV()"; + + setParent -menu ..; + + menuItem -label "Pedestrian Paths" -sm true; + + menuItem -label "Create path line" -command "te_MCB_StartPPLoop()"; + + menuItem -label "Split Path(s)" -command "te_MCB_SplitSelectedPP()"; + + setParent -menu ..; + + menuItem -divider true; + + menuItem -label "Track Editor" -sm true; + + radioMenuItemCollection; + + menuItem -label "Off" -radioButton on -command "TE_StateChange(0)"; + + menuItem -label "Edit Mode" -radioButton off -command "TE_StateChange(1)"; + + menuItem -label "Display Mode" -radioButton off -command "TE_StateChange(2)"; + + menuItem -divider true; + + menuItem -label "Create Intersections" -command "te_MCB_StartIntersection()"; + + menuItem -label "Edit Roads / Intersections" -command "te_MCB_EditIntersection()"; + + setParent -menu ..; + + menuItem -divider true; + + menuItem -label "Tree Line Tool" -allowOptionBoxes true -sm true; + + menuItem -label "Create Tree Lines" -command "te_MCB_CreateTreeLines()"; + + menuItem -label "Options" -optionBox true -command "te_MCB_TreelineOptions()"; + + menuItem -divider true; + + menuItem -label "Snap Selected Treelines" -command "te_MCB_SnapTreelines()"; + + menuItem -divider true; + + menuItem -label "Convert Treelines to Geometry" -command "te_MCB_ConvertToGeometry()"; + + setParent -menu ..; + + menuItem -divider true; + + menuItem -label "Export" -command "te_MCB_Export()"; + + menuItem -optionBox true -command "TE_ExportOptions()"; + + menuItem -divider true; + + menuItem -label "About" -command "te_MCB_About()"; + + setParent -m ..; +} + +//----------------------------------------------------------------------------- +// t e _ I n s t a l l U I +// +// Synopsis: +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc te_InstallUI() +{ + + global string $gMainWindow; + + // + // Install TE menu as a root menu. + // + if ( `menu -exists te_MainMenu` ) deleteUI te_MainMenu; + menu -label "Track Editor" -allowOptionBoxes true -parent $gMainWindow te_MainMenu; + + te_doMainMenuItems "te_MainMenu"; +} + +global proc te_MCB_Export() +{ + $whichCtx = `currentCtx`; + + if ( $whichCtx != "" ) + { + ctxCompletion; + } + + TE_Export(); +} + +source "te_globals.mel"; +source "te_setup.mel"; +source "te_BVContext.mel"; +source "te_PPContext.mel"; +source "te_treelineContext.mel"; +source "te_IntersectionContext.mel"; +source "te_editorWindow.mel"; +source "AETEShowRoadSegButton.mel"; + +evalDeferred "te_InstallUI";
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_setup.mel b/tools/MayaTools/Maya4.0/scripts/others/te_setup.mel new file mode 100644 index 0000000..d5ca442 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/te_setup.mel @@ -0,0 +1,15 @@ +//Create the TrackEditorNode. + + +global proc te_Create_TrackEditorNode() +{ + if ( !(`objExists TrackEditorNode`) ) + { + createNode "transform" -n "TrackEditorNode"; + createNode "transform" -n "Fences" -p "TrackEditorNode"; + createNode "transform" -n "Roads" -p "TrackEditorNode"; + createNode "transform" -n "Intersections" -p "TrackEditorNode"; + createNode "transform" -n "Treelines" -p "TrackEditorNode"; + createNode "transform" -n "PedPaths" -p "TrackEditorNode"; + } +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/te_treelineContext.mel b/tools/MayaTools/Maya4.0/scripts/others/te_treelineContext.mel new file mode 100644 index 0000000..c8120ab --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/te_treelineContext.mel @@ -0,0 +1,84 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved. +// +// te_treelineContext.mel +// +// Description: Defines all the scripts required by the TreeLineContext tool +// As a convention all Terrain Editor global procedures +// and global variables are prefixed with "te_". All commands +// exposed through TE plugins are prefixed with "TE_". +// +// MCB = Menu Call Back +// BCB = Button Call Back +// +// Modification History: +// + Created -- CBrisebois +//----------------------------------------------------------------------------- + +//This is the global instance of the tree line context tool. + +global proc te_MCB_CreateTreeLines() +{ + //Start the tree line context... + if ( ! `contextInfo -exists TreeLineCtx` ) + { + TreeLineContext TreeLineCtx; + } + + setToolTo TreeLineCtx; +} + +global proc te_Delete_TreeLineContext() +{ + if ( `contextInfo -exists TreeLineCtx` ) + { + deleteUI -toolContext TreeLineCtx; + } +} + +global proc te_MCB_SnapTreelines() +{ + TE_SnapSelectedTreelines(); +} + +global proc te_MCB_ConvertToGeometry() +{ + string $whichCtx = `currentCtx`; + + if ( $whichCtx == "TreeLineCtx" ) + { + ctxAbort; + } + + TE_ConvertTreelineToGeometry(); +} + +global int $gDeleteTreelines = true; + +global proc te_MCB_TreelineOptions() +{ + global int $gDeleteTreelines; + + if ( `window -exists TE_TreelineOptions` ) + { + deleteUI -window TE_TreelineOptions; + } + + window -rtf true -title "TE Treeline Options" TE_TreelineOptions; + + columnLayout -adjustableColumn true; + + checkBox -label "Delete Treelines" -value $gDeleteTreelines -cc "te_BCB_SetDeleteTreelines(#1)"; + + setParent ..; + + showWindow; +} + +global proc te_BCB_SetDeleteTreelines( int $delete ) +{ + global int $gDeleteTreelines; + + $gDeleteTreelines = $delete; + TE_SetDeleteTreeline($delete); +} diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_cleanup.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_cleanup.mel new file mode 100644 index 0000000..1b2f42c --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/wb_cleanup.mel @@ -0,0 +1,11 @@ + +if ( `menu -exists wb_MainMenu` ) +{ + deleteUI wb_MainMenu; + deleteShelfTab ("WorldBuilder"); + + wb_SplinesCleanup(); + wb_CoinSplinesCleanup(); + + flushUndo; +} diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_coinsplines.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_coinsplines.mel new file mode 100644 index 0000000..750eb3e --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/wb_coinsplines.mel @@ -0,0 +1,53 @@ +global int $gCoinSplineCompleteCB = -1; + +global proc wb_MCB_CreateCoinPath() +{ + global int $gCoinSplineCompleteCB; + + if ( !`contextInfo -exists CoinSplineCtx` ) + { + curveCVCtx -degree 3 -me true -un true CoinSplineCtx; + print "create\n"; + } + else + { + string $currentCtx = `currentCtx`; + + if ( $currentCtx == "CoinSplineCtx" ) + { + print "complete\n"; + ctxCompletion; + + wb_CB_CoinSplineComplete(); + } + } + + print "select\n"; + setToolTo CoinSplineCtx; + + $gCoinSplineCompleteCB = `scriptJob -ro 1 -p "WorldBuilder" -e "ToolChanged" wb_CB_CoinSplineComplete`; +} + +global proc wb_CB_CoinSplineComplete() +{ + print "complete callback\n"; + WB_CoinSplineComplete(); +} + +global proc wb_CoinSplinesCleanup() +{ + print "clean\n"; + global int $gCoinSplineCompleteCB; + + if ( $gCoinSplineCompleteCB != -1 ) + { + scriptJob -k $gCoinSplineCompleteCB; + print "kill job\n"; + } + + if ( `contextInfo -exists CoinSplineCtx` ) + { + print "delete ui\n"; + deleteUI -tc CoinSplineCtx; + } +} diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_locator.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_locator.mel new file mode 100644 index 0000000..0b46abb --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/wb_locator.mel @@ -0,0 +1,71 @@ +global float $gWB_Offset = 0; + +global proc wb_BCB_CreateLocator( string $type ) +{ + //Start the Locator context... + if ( ! `contextInfo -exists LocatorCtx` ) + { + LocatorContext LocatorCtx; + } + + WB_SetLocatorType($type); + + setToolTo LocatorCtx; +} + +global proc wb_MCB_SnapLocatorOptions() +{ + global float $gWB_Offset; + + if ( `window -exists wb_OptionWindow` ) deleteUI wb_OptionWindow; + + window -title "Snap Locator Options" wb_OptionWindow; + + columnLayout; + + rowLayout -nc 2; + + text -label "Offset (M):"; + + floatField -min -10.0 -max 10.0 -value $gWB_Offset -cc ("$gWB_Offset = #1"); + + setParent ..; + + button -label "snap locator" -command "WB_SnapLocator( $gWB_Offset )"; + + setParent ..; + + showWindow; +} + +global proc wb_BCB_AttachTriggers( string $name, int $isVisibler ) +{ + global int $gIsItVisibler; + + $gIsItVisibler = $isVisibler; + + //Start the Trigger context... + if ( ! `contextInfo -exists TriggerCtx` ) + { + TriggerContext TriggerCtx; + } + + select $name; + + WB_SelectObject( $name ); + + setToolTo TriggerCtx; +} + +global proc wb_LocatorCleanup() +{ + if ( `contextInfo -exists LocatorCtx` ) + { + deleteUI -tc LocatorCtx; + } + + if ( `contextInfo -exists TriggerCtx` ) + { + deleteUI -tc TriggerCtx; + } +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_main.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_main.mel new file mode 100644 index 0000000..8106946 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/wb_main.mel @@ -0,0 +1,274 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved. +// +// WB_main.mel +// +// Description: Installs the World Builder (WB) interface. +// As a convention all World Builder global procedures +// and global variables are prefixed with "wb_". All commands +// exposed through WB plugins are prefixed with "WB_". +// +// MCB = Menu Call Back +// BCB = Button Call Back +// +// Modification History: +// + Created Apr 11, 2001 -- bkusy +// + Stolen & Adapted -- CBrisebois +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// w b _ b r e a k p o i n t +// +// Synopsis: +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc wb_breakpoint( string $tag ) +{ + confirmDialog -m ( "BreakPoint: " + $tag ); +} + +//----------------------------------------------------------------------------- +// w b _ M C B _ A b o u t +// +// Synopsis: Display an About World Builder window. +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc wb_MCB_About() +{ + string $pluginVersion = "2.0"; + + string $message = ( "\nSimpsons Road Rage World Builder.\n\n" + + "Release " + $pluginVersion + "\n" + + "(c) 2001, Radical Entertainment, Ltd.\n\n" ); + + + confirmDialog -title "About World Builder" + -message $message + -button "OK" + -defaultButton "OK"; +} + +//----------------------------------------------------------------------------- +// w b _ d o M a i n M e n u I w b m s +// +// Synopsis: Creates the WB menu on the menu handle passed in. +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc wb_doMainMenuItems( string $menu ) +{ + global string $gMainWindow; + global float $gWB_Offset; + + menu -edit -tearOff true -allowOptionBoxes true $menu; + + menuItem -label "Display Levels" -sm true; + + menuItem -label "Event Locators" -checkBox true -command "WB_ChangeDisplay(0, #1)"; + + menuItem -label "Script Locators" -checkBox true -command "WB_ChangeDisplay(1, #1)"; + + menuItem -label "Generic Locators" -checkBox true -command "WB_ChangeDisplay(2, #1)"; + + menuItem -label "Car Start Locators" -checkBox true -command "WB_ChangeDisplay(3, #1)"; + + menuItem -label "Dynamic Zone Locators" -checkBox true -command "WB_ChangeDisplay(4, #1)"; + + menuItem -label "Occlusion Locators" -checkBox true -command "WB_ChangeDisplay(5, #1)"; + + menuItem -label "Interior Entrance Locators" -checkBox true -command "WB_ChangeDisplay(7, #1)"; + + menuItem -label "Directional Locators" -checkBox true -command "WB_ChangeDisplay(8, #1)"; + + menuItem -label "Action Locators" -checkBox true -command "WB_ChangeDisplay(9, #1)"; + + menuItem -label "FOV" -checkBox true -command "WB_ChangeDisplay(10, #1)"; + + menuItem -label "Breakable Camera" -checkBox true -command "WB_ChangeDisplay(11, #1)"; + + menuItem -label "Static Camera" -checkBox true -command "WB_ChangeDisplay(12, #1)"; + + menuItem -label "Ped Group" -checkBox true -command "WB_ChangeDisplay(13, #1)"; + + menuItem -divider true; + + menuItem -label "Trigger Volumes" -checkBox true -command "WB_ChangeDisplay(20, #1)"; + + setParent -menu ..; + + menuItem -divider true; + + menuItem -label "Create Camera Path" -command "wb_MCB_CreateCameraPath()"; + + menuItem -label "Create Coin Path" -command "wb_MCB_CreateCoinPath()"; + + menuItem -divider true; + + menuItem -label "Set Prefix" -command "WB_SetPrefix()"; + + menuItem -divider true; + + menuItem -label "Snap Locator" -command "WB_SnapLocator( $gWB_Offset )"; + + menuItem -optionBox true -command "wb_MCB_SnapLocatorOptions()"; + + menuItem -divider true; + + menuItem -label "Export" -command "WB_Export()"; + + menuItem -optionBox true -command "WB_ExportOptions()"; + + menuItem -divider true; + + menuItem -label "About" -command "wb_MCB_About()"; + + setParent -m ..; + + if ( `shelfLayout -exists "WorldBuilder"` == 0 ) + { + addNewShelfTab "WorldBuilder"; + } + + //Delete all the old buttons (in case there was a change).. + string $buttons[] = `shelfLayout -q -ca WorldBuilder`; + + int $i; + + for ( $i = 0; $i < size($buttons); $i++ ) + { + deleteUI $buttons[ $i ]; + } + + //Create all the buttons required.. + shelfButton -c ("wb_BCB_CreateLocator(\"Event\")") + -p "WorldBuilder" + -i1 "eventlocator.bmp" + -ann "Create Event Locator" + -l "Event"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Script\")") + -p "WorldBuilder" + -i1 "scriptlocator.bmp" + -ann "Create Script Locator" + -l "Script"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Generic\")") + -p "WorldBuilder" + -i1 "genericlocator.bmp" + -ann "Create Generic Locator" + -l "Generic"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Car Start\")") + -p "WorldBuilder" + -i1 "carstartlocator.bmp" + -ann "Create Car Start Locator" + -l "Car Start"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Dynamic Zone\")") + -p "WorldBuilder" + -i1 "zonelocator.bmp" + -ann "Create Dynamic Zone Locator" + -l "Dynamic Zone"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Occlusion\")") + -p "WorldBuilder" + -i1 "occlusionlocator.bmp" + -ann "Create Occlusion Locator" + -l "Occlusion"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Interior Entrance\")") + -p "WorldBuilder" + -i1 "interiorlocator.bmp" + -ann "Create Interior Entrance Locator" + -l "Interior Entrance"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Directional\")") + -p "WorldBuilder" + -i1 "directionallocator.bmp" + -ann "Create Directional Locator" + -l "Directional"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Action\")") + -p "WorldBuilder" + -i1 "actionlocator.bmp" + -ann "Create Action Locator" + -l "Action"; + + shelfButton -c ("wb_BCB_CreateLocator(\"FOV\")") + -p "WorldBuilder" + -i1 "fovlocator.bmp" + -ann "Create FOV Locator" + -l "FOV"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Breakable Camera\")") + -p "WorldBuilder" + -i1 "breakablecameralocator.bmp" + -ann "Create Breakable Camera Locator" + -l "Breakable Camera"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Static Camera\")") + -p "WorldBuilder" + -i1 "staticcameralocator.bmp" + -ann "Create Static Camera Locator" + -l "Static Camera"; + + shelfButton -c ("wb_BCB_CreateLocator(\"Ped Group\")") + -p "WorldBuilder" + -i1 "pedgrouplocator.bmp" + -ann "Create Ped Group Locator" + -l "Ped Group"; + +} + + +//----------------------------------------------------------------------------- +// w b _ I n s t a l l U I +// +// Synopsis: +// +// Parameters: NONE +// +// Returns: NOTHING +// +// Constraints: NONE +// +//----------------------------------------------------------------------------- +global proc wb_InstallUI() +{ + + global string $gMainWindow; + + // + // Install WB menu as a root menu. + // + if ( `menu -exists wb_MainMenu` ) deleteUI wb_MainMenu; + menu -label "World Builder" -allowOptionBoxes true -parent $gMainWindow wb_MainMenu; + + wb_doMainMenuItems "wb_MainMenu"; +} + +evalDeferred "wb_InstallUI"; + +source "wb_setup.mel"; +source "wb_locator.mel"; +source "wb_splines.mel"; +source "wb_coinsplines.mel"; +source "AEWBTriggerButton.mel"; +source "AEWBSelectTarget.mel";
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_setup.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_setup.mel new file mode 100644 index 0000000..9211390 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/wb_setup.mel @@ -0,0 +1,6 @@ +//Create the WorldBuilderNode. + + +global proc wb_Create_WorldBuilderNode() +{ +}
\ No newline at end of file diff --git a/tools/MayaTools/Maya4.0/scripts/others/wb_splines.mel b/tools/MayaTools/Maya4.0/scripts/others/wb_splines.mel new file mode 100644 index 0000000..ab99858 --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/others/wb_splines.mel @@ -0,0 +1,46 @@ +global int $gSplineCompleteCB = -1; + +global proc wb_MCB_CreateCameraPath() +{ + global int $gSplineCompleteCB; + + if ( !`contextInfo -exists CameraSplineCtx` ) + { + curveCVCtx -degree 3 -me false -un true CameraSplineCtx; + } + else + { + string $currentCtx = `currentCtx`; + + if ( $currentCtx == "CameraSplineCtx" ) + { + ctxCompletion; + + wb_CB_SplineComplete(); + } + } + + setToolTo CameraSplineCtx; + + $gSplineCompleteCB = `scriptJob -ro 1 -p "WorldBuilder" -e "ToolChanged" wb_CB_SplineComplete`; +} + +global proc wb_CB_SplineComplete() +{ + WB_SplineComplete(); +} + +global proc wb_SplinesCleanup() +{ + global int $gSplineCompleteCB; + + if ( $gSplineCompleteCB != -1 ) + { + scriptJob -k $gSplineCompleteCB; + } + + if ( `contextInfo -exists CameraSplineCtx` ) + { + deleteUI -tc CameraSplineCtx; + } +} diff --git a/tools/MayaTools/Maya4.0/scripts/srr2rules.txt b/tools/MayaTools/Maya4.0/scripts/srr2rules.txt new file mode 100644 index 0000000..814be8f --- /dev/null +++ b/tools/MayaTools/Maya4.0/scripts/srr2rules.txt @@ -0,0 +1,13 @@ +rule +{ + severity 9 + if type tlMeshChunk + + rule + { + scope children + label "Mesh using lambert!" + if type tlPrimGroupChunk + require Shader != "lambert[0-9]+" + } +}
\ No newline at end of file |