I previously use this code for creating a view with headlight on.
but this should also be useful for your case, sexy Eric.
xsi = Application
import win32com.client
def getLastView():
coll = win32com.client.Dispatch( "XSI.Collection" )
coll.Items = "Views.View*"
return coll(coll.Count-1)
def createOrthoView(objColl=None):
layout = xsi.Desktop.ActiveLayout
orthoView = layout.CreateView2( "Object View", "OrthoCam")
orthoView.Resize(400,500)
# this has to be called to force xsi to immediately create the view
# then we can set it's attribute
xsi.Desktop.RedrawUI()
# get last view returns the latest created view
viewName = getLastView().Fullname
# get the active camera
cameraName = orthoView.GetAttributeValue("camera")
if cameraName == "default":
cameraName = "%s.UserCamera"%viewName
orthoCam = xsi.Dictionary.GetObject(cameraName)
# enable headlight
orthoCam.Properties("Camera Display").Parameters("headlight").Value =
True
# set ortho
orthoCam.Parameters("proj").Value = 0
orthoView.SetAttributeValue("autoframe","True")
if objColl:
orthoView.SetAttributeValue("targetcontent", objColl.GetAsText() )
orthoView.SetAttributeValue("displayall","False")
orthoView.SetAttributeValue("autoframe","False")
orthoView.SetAttributeValue("lockstatus","True")
orthoView.SetAttributeValue("autoalign","True")
orthoView.SetAttributeValue("displaymode","shaded")
orthoView.SetAttributeValue("modifycameras", "False")
# test create cylinder and create a view for it
xsi.CreatePrim("Cylinder", "MeshSurface", "", "")
createOrthoView(xsi.Selection)
Have fun,
edy
On Fri, Sep 13, 2013 at 11:52 PM, Jon Swindells <[email protected]> wrote:
> yup, i was missing something :)
>
> add me to the list of +1's
>
>
> On 13 September 2013 18:10, Daniel Brassard <[email protected]> wrote:
>
>> I understand Eric predicament. The objectview by default open to
>> perspective, if you tick orthographic, the objectview does not retain the
>> setting when closed and their is not current setting in the attributes to
>> change it in the preference setting either.
>>
>>
>> http://download.autodesk.com/global/docs/softimage2014/en_us/sdkguide/si_cmds/ObjectViewAttributes.html
>>
>> I tried the SetValue("preferences.objectview. ....) way and it is not
>> accessible.
>>
>> +1 on Eric request.
>>
>>
>> On Thu, Sep 12, 2013 at 4:35 PM, Jon Swindells <[email protected]> wrote:
>>
>>> wouldn't a relational view with max instance prop set to 1 be the way to
>>> go ?
>>>
>>> if you are popping it up through script i don't see a problem with
>>> getting the camera properties also,
>>> you'd have an easy to search for named singleton if you need it
>>>
>>> or am i missing the obvious here ?
>>>
>>>
>>> On 12 September 2013 20:40, Eric Thivierge <[email protected]>wrote:
>>>
>>>> I'd like to open the object view and have it set to ortho
>>>> automatically. For creating and editing bone chains and other things that
>>>> need to lay flat on the plane between root, 2nd bone and effector
>>>> orthographic is usually best. I'd like to not have to add additional
>>>> objects or edit objects already in the scene but looks like I'll have to do
>>>> so.
>>>>
>>>> If I could get at the camera under the view I could automatically set
>>>> the ortho so the user doesn't have to and I don't change anything else in
>>>> the scene and I can create a simple and streamlined workflow for the tools
>>>> I'm building.
>>>>
>>>>
>>>> On September-12-13 1:35:16 PM, Luc-Eric Rousseau wrote:
>>>>
>>>>> there is no technical reason for that attribute return value to be so
>>>>> terse, but I'm not sure exactly what you need. maybe you need a user
>>>>> pref to the default camera mode, or maybe you want to open the object
>>>>> view with a scene camera that you control (which should be possible
>>>>> with setattribute)
>>>>>
>>>>> On Thu, Sep 12, 2013 at 12:59 PM, Eric Thivierge <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Should I even bother logging a feature request or is it something
>>>>>> that isn't
>>>>>> possible because they are dynamic and tied to the view?
>>>>>>
>>>>>>
>>>>
>>>
>>>
>>> --
>>> Jon Swindells
>>> [email protected]
>>>
>>
>>
>
>
> --
> Jon Swindells
> [email protected]
>
--
Edy Susanto Lim
TD
http://sawamura.neorack.com