Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Image Plane: Allow to load detached like orthographic default does in Maya #119

Open
2 tasks done
BigRoy opened this issue Sep 22, 2024 · 0 comments
Open
2 tasks done
Labels
type: enhancement Improvement of existing functionality or minor addition

Comments

@BigRoy
Copy link
Contributor

BigRoy commented Sep 22, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Please describe the feature you have in mind and explain what the current shortcomings are?

The Image Plane loader loads attached to a camera, even the orthographic ones. However, by default when you load an image plane using Maya itself to an orthographic camera (tested in Maya 2025.2) Maya loads it 'detached' but just initializes it with a transform aiming at the camera.

Currently we offer no means to create them detached. Add options to create the image planes in 'detached' mode.

How would you imagine the implementation of the feature?

Either match Maya's default behavior and create in detached mode for orthographic cameras automatically - or add an extra toggle or setting in the "select camera" that sets the attached or detached mode (that toggle could also auto-switch when selecting an orthographic or perspective camera if those settings do make more sense as defaults respectively).

Are there any labels you wish to add?

  • I have added the relevant labels to the enhancement request.

Describe alternatives you've considered:

Let users do this manually after load - but I don't know of any way to do it in the UI.
You can do it via code, by e.g. selecting the image plane and running imagePlane -e -detach.

Additional context:

Came up on discord here


Maya triggers via the UI:

importImagePlane { "topShape" };

Which triggers createImagePlane which has different logic for orthographic cameras to perspective cameras:

global proc string[] createImagePlane (string $camera)                                          
{
	//Initialize the parameters
	setOptionVars();

	// query orthographic flag of the camera.
	int $isOrtho = `camera -q -o $camera`;
	
	// Initialize the command's parameters
 	float $width  = `optionVar -query freeImageWidth`;
 	float $height = `optionVar -query freeImageHeight`;
 	int    $mr      = `optionVar -query freeImageMR`;

    // create image plane
	string $newImagePlane[];
	
	string $attrName;
	
	string $lookThruCamera = `lookThru -q`;
	
	if ( $isOrtho == 1 ) {
	
		float $widthOrtho = `camera -q -orthographicWidth $camera`;
		
		// for orthographic camera, create free imageplane.
		$newImagePlane = `imagePlane -width $widthOrtho -height $widthOrtho -maintainRatio $mr -lookThrough $lookThruCamera`;
		
		// align imageplane to camera by orient-constraint.
		// OGS_TODO: no support for camera instance case, since just use $cameraTransforms[0].
		string $cameraTransforms[] = `listTransforms $camera`;
	
		// set camera rotation to imageplane
		$attrName = $cameraTransforms[0] + ".rotate";
		float $rot[] = `getAttr $attrName`;
		$attrName = $newImagePlane[0] + ".rotate";
		setAttr $attrName $rot[0] $rot[1] $rot[2];
		
		if ($cameraTransforms[0] != "top" && $cameraTransforms[0] != "side" && $cameraTransforms[0] != "front")
		{
			string $camreraTranslate = $cameraTransforms[0] + ".translate";
			float   $translate[] = `getAttr $camreraTranslate`;	
			move -worldSpace -moveXYZ $translate[0] $translate[1] $translate[2] $newImagePlane[0];
			move -relative -objectSpace 0 0 -5 $newImagePlane[0];
		}
		
	} else {
	
		// for perspective camera, create imageplane in underworld of the camera.
		// We will consider that if user(s) detach the image plane from the camera 
		// and the image plane will still respect the optionVars
		
		$newImagePlane = `imagePlane -camera $camera -width $width -height $height -maintainRatio $mr`;
	}
			
	// make camera visible to ensure the image plane outline is drawn and selectable.
	// consider cases where the camera name may be the same as another camera,
	// but inside a different hierarchy.
	//
	string $parents[] = `listRelatives -fullPath -parent $camera`;
	for ($item in $parents) showHidden $item;        

	return $newImagePlane;
}

In Maya 2025.2 when you have an attached image plane to an orthographic camera it behaves very erratically. It incorrectly updates the scale with the orthographic camera on zooming in and out and only updates when selecting the image plane - which makes it behave very confusingly. See:

imagePlaneAyon.mp4
@BigRoy BigRoy added the type: enhancement Improvement of existing functionality or minor addition label Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

No branches or pull requests

1 participant