Update AETemplete
This commit is contained in:
parent
61ddd2a067
commit
5d393a1e30
22
README.md
22
README.md
|
|
@ -34,6 +34,7 @@ MediaPlane/
|
|||
│ └── MayaImagePlaneNode/
|
||||
│ ├── CMakeLists.txt # Plugin CMake configuration
|
||||
│ ├── Plugin.cpp # Maya plugin entry point
|
||||
│ ├── AETemplateMediaPlane.mel # Attribute Editor template
|
||||
│ ├── MayaMediaPlaneNode.h # Node header file
|
||||
│ ├── MayaMediaPlaneNode.cpp # Node implementation
|
||||
│ ├── FFmpegVideoDecoder.h # FFmpeg decoder header
|
||||
|
|
@ -108,6 +109,27 @@ C:\Program Files\Autodesk\Maya2023\plug-ins\
|
|||
createNode MediaPlane;
|
||||
```
|
||||
|
||||
### Use AE Template
|
||||
|
||||
The plugin includes a custom Attribute Editor template. When the plugin loads, you'll see instructions in the Script Editor. To manually load the AE template:
|
||||
|
||||
```mel
|
||||
// Source the AE template
|
||||
source "AETemplateMediaPlane.mel";
|
||||
```
|
||||
|
||||
For automatic loading, copy the MEL file to your Maya scripts directory:
|
||||
```
|
||||
C:\Users\<username>\Documents\maya\2023\scripts\
|
||||
```
|
||||
|
||||
Or add this to your `userSetup.mel`:
|
||||
```mel
|
||||
// Add to userSetup.mel
|
||||
if (!`exists AETemplateMediaPlane`)
|
||||
source "AETemplateMediaPlane.mel";
|
||||
```
|
||||
|
||||
### Set Video File
|
||||
|
||||
```mel
|
||||
|
|
|
|||
|
|
@ -0,0 +1,112 @@
|
|||
// 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
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@ set(PLUGIN_SRCS
|
|||
|
||||
set(MOD_FILES
|
||||
MediaPlane.mod
|
||||
AETemplateMediaPlane.mel
|
||||
)
|
||||
|
||||
# ============================================
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "MayaMediaPlaneNode.h"
|
||||
#include <maya/MFnPlugin.h>
|
||||
#include <maya/MGlobal.h>
|
||||
|
||||
// Forward declaration
|
||||
MStatus initializeMediaPlaneNode();
|
||||
|
|
@ -23,7 +24,10 @@ MStatus initializePlugin(MObject obj)
|
|||
&MayaMediaPlaneNode::kNodeClassification);
|
||||
if (!status) return status;
|
||||
|
||||
// Display info about AE Template
|
||||
MGlobal::displayInfo("MayaMediaPlaneNode plugin loaded");
|
||||
MGlobal::displayInfo("For Attribute Editor customization, source: source \"AETemplate_MediaPlane.mel\"");
|
||||
|
||||
return MS::kSuccess;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue