Hey Doktor,

I have attached a screenshot about what I am trying to achieve.

For example:

   - I have selected 3 imagePlane nodes as seen in my "front" camera 
   viewport/ modelPanel, assuming the position of three planes are at origin 
   point initially.
   - If I choose the `direction` to be `left` (if I am able to script it), 
   the script will 're-arrange' the selected imagePlanes to the left-hand side 
   of the said viewport and spaced them out evenly.. See attached for the 
   expected result.
   - If I choose `top` as the direction, it will be on the top of the 
   viewport, so on and forth as described in my first post.




[image: screen_left.png]




On Friday, January 24, 2020 at 12:39:12 PM UTC-8, Doktor Weeny wrote:
>
> I have two snippets that might help :
>
> # First Snippet
>
> import maya.OpenMayaUI as omui
>
> view = omui.M3dView.active3dView()
> x = view.portWidth()
> y = view.portHeight()
>
>
> # Second Snippet
>
> import maya.OpenMayaUI as omui
>
> mdag_path = om.MDagPath()
> sel = om.MSelectionList()
> sel.add(cam)
> sel.getDagPath(0, mdag_path)
>
> # Create frustum object with camera.
> draw_traversal = omui.MDrawTraversal()
> draw_traversal.setFrustum(mdag_path,
>                           cmds.getAttr("defaultResolution.width"),
>                           cmds.getAttr(
>                               "defaultResolution.height"))  # Use render's 
> resolution.
>
>
> Im not sure to understand what you are trying to do. Are you trying to do 
> something like this : https://github.com/imageworks/spReticle
>
>
> On Thursday, January 23, 2020 at 8:30:23 PM UTC-5, kiteh wrote:
>>
>> I have a number of image planes (created using Free Image Plane), of 
>> varying sizes. By varying sizes, I mean to say that the image sources are 
>> of different dimensions. (No changes are made towards the scale attributes)
>>
>> Even so, I am trying to create a script in which it will allows me to 
>> rearrange these image planes (spaced out nicely) if I choose a direction 
>> (see attached)
>>
>> Currently, I was able to conjure up a script that allows me to grab all 
>> the image planes based on the modelPanels of a specified camera. However I 
>> have no clue on how should I query for the width or height of the viewport, 
>> or the way of how these varying image plane sizes will fit to one of the 5 
>> directions (top, left, right, bottom, all)
>>
>> Need some insights on how I should proceed or if this is even doable?
>>
>> [image: directions.png]
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/9ce63f1e-e9a3-4b4f-853b-518a759a6a3d%40googlegroups.com.

Reply via email to