MediaPlane/install/Maya2023/scripts/AETemplateMediaPlane.mel

113 lines
3.9 KiB
Plaintext

// AETemplateMediaPlane.mel
// Attribute Editor Template for MayaMediaPlaneNode
// This file customizes the appearance of MediaPlane node attributes in Maya's Attribute Editor
global proc AETemplateMediaPlane(string $nodeName)
{
editorTemplate -beginScrollLayout;
// Video File Section
editorTemplate -beginLayout "Video File" -collapse 0;
// Use custom control for video file with browse button
editorTemplate -callCustom "AETemplateMediaPlaneVideoFileCreate" "AETemplateMediaPlaneVideoFileUpdate" "videoFile";
editorTemplate -endLayout;
// Playback Section
editorTemplate -beginLayout "Playback" -collapse 0;
editorTemplate -addControl "currentTime";
editorTemplate -addControl "frameRate";
editorTemplate -addControl "playbackRate";
editorTemplate -addControl "useMayaFrameRate";
editorTemplate -addControl "loop";
editorTemplate -endLayout;
// Post Effects Section
editorTemplate -beginLayout "Post Effects" -collapse 0;
editorTemplate -addControl "postEffectCrop";
editorTemplate -addControl "postEffectResize";
editorTemplate -addControl "postEffectFlip";
editorTemplate -endLayout;
// Cache Section
editorTemplate -beginLayout "Cache" -collapse 0;
editorTemplate -addControl "cachePolicy";
editorTemplate -addControl "cacheSize";
editorTemplate -addControl "clearCache";
editorTemplate -addControl "outCacheHitRatio";
editorTemplate -endLayout;
// Output Section
editorTemplate -beginLayout "Output" -collapse 0;
editorTemplate -addControl "outFrameWidth";
editorTemplate -addControl "outFrameHeight";
editorTemplate -addControl "outFrameTimestamp";
editorTemplate -addControl "outFrameCount";
editorTemplate -addControl "outIsValid";
editorTemplate -endLayout;
// Add AE call to the base class
editorTemplate -addExtraControls;
editorTemplate -endScrollLayout;
}
// Custom control creation for video file with browse button
global proc AETemplateMediaPlaneVideoFileCreate(string $nodeName)
{
setUITemplate -pushTemplate attributeEditorTemplate;
// Create label and textField in a row
rowLayout -numberOfColumns 3
-columnWidth3 120 320 80
-adjustableColumn 2
-columnAlign3 "right" "center" "center"
-rowAttach 1 "left" 0;
text -label "videoFile";
textField -tx "" -width 320 "AETemplateMediaPlaneVideoFileTextField";
button -label "Browse..." -width 80
-command "AETemplateMediaPlaneBrowseButton()"
"AETemplateMediaPlaneBrowseButton";
setUITemplate -popTemplate;
}
// Update callback for video file control
global proc AETemplateMediaPlaneVideoFileUpdate(string $nodeName)
{
string $value = `getAttr ($nodeName + ".videoFile")`;
textField -edit -tx $value "AETemplateMediaPlaneVideoFileTextField";
}
// Browse button command
global proc AETemplateMediaPlaneBrowseButton()
{
// Get the current text field value
string $currentFile = `textField -q -tx "AETemplateMediaPlaneVideoFileTextField"`;
// Set up file filters
string $filters = "Video Files (*.mp4 *.mov *.avi *.mkv *.webm);;MP4 (*.mp4);;MOV (*.mov);;AVI (*.avi);;MKV (*.mkv);;WebM (*.webm);;All Files (*.*)";
// Open file dialog
string $result[] = `fileDialog2
-fileFilter $filters
-dialogStyle 2
-caption "Select Video File"
-startingDirectory ($currentFile != "" ? `dirname $currentFile` : "")`;
// If user selected a file, update the text field
if (size($result) > 0)
{
textField -edit -tx $result[0] "AETemplateMediaPlaneVideoFileTextField";
}
}
// Registration procedure
global proc AEregisterMediaPlaneNode()
{
// Register the AE template for MediaPlane node
// This is called from the plugin initialization
}