Re: Object View to Orthorgraphic via scripting

2013-09-14 Thread Edy Susanto Lim
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 squi...@gmail.com wrote:

 yup, i was missing something :)

 add me to the list of +1's


 On 13 September 2013 18:10, Daniel Brassard dbrassar...@gmail.com 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 squi...@gmail.com 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 ethivie...@hybride.comwrote:

 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 
 ethivie...@hybride.com 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
 squi...@gmail.com





 --
 Jon Swindells
 squi...@gmail.com




-- 
Edy Susanto Lim
TD
http://sawamura.neorack.com


Re: Object View to Orthorgraphic via scripting

2013-09-14 Thread Eric Thivierge
Thanks Edy,

Thought about doing that but seems so hacky. While it will work, I'll
submit the request anyway.


Eric Thivierge
http://www.ethivierge.com


On Sat, Sep 14, 2013 at 9:46 AM, Edy Susanto Lim edysusant...@gmail.comwrote:

 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 squi...@gmail.com wrote:

 yup, i was missing something :)

 add me to the list of +1's


 On 13 September 2013 18:10, Daniel Brassard dbrassar...@gmail.comwrote:

 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 squi...@gmail.comwrote:

 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 ethivie...@hybride.comwrote:

 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 
 ethivie...@hybride.com 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
 squi...@gmail.com





 --
 Jon Swindells
 squi...@gmail.com




 --
 Edy Susanto Lim
 TD
 http://sawamura.neorack.com



Re: Object View to Orthorgraphic via scripting

2013-09-13 Thread Daniel Brassard
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 squi...@gmail.com 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 ethivie...@hybride.com 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 ethivie...@hybride.com
 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
 squi...@gmail.com



Re: Object View to Orthorgraphic via scripting

2013-09-13 Thread Jon Swindells
yup, i was missing something :)

add me to the list of +1's


On 13 September 2013 18:10, Daniel Brassard dbrassar...@gmail.com 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 squi...@gmail.com 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 ethivie...@hybride.comwrote:

 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 
 ethivie...@hybride.com 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
 squi...@gmail.com





-- 
Jon Swindells
squi...@gmail.com


Re: Object View to Orthorgraphic via scripting

2013-09-12 Thread Eric Thivierge
Thanks Daniel but I'm using the default camera for the view which seems 
to be dynamically created with the view and is removed with it when you 
close it. I haven't found a way to find the camera object from the View 
object. All I get returned from the camera attribute from the view is 
the generic name and can't get the full name / path to it via 
scripting. Otherwise it's a piece of cake like you show.


On September-12-13 12:15:08 PM, Daniel Brassard wrote:

 oCamera.Parameters( “proj” ).value

1 (perspective) , 0 (orthographic)


On Thu, Sep 12, 2013 at 11:58 AM, Eric Thivierge
ethivie...@hybride.com mailto:ethivie...@hybride.com wrote:

I feel like I asked this before but came up with nothing from
searching google. Can you set an object view to orthorgraphic via
scripting? No view attributes are able to get me to the embedded
camera it's using to set this.

Eric T.






Re: Object View to Orthorgraphic via scripting

2013-09-12 Thread Eric Thivierge
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 ethivie...@hybride.com 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?





Re: Object View to Orthorgraphic via scripting

2013-09-12 Thread Jon Swindells
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 ethivie...@hybride.com 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 ethivie...@hybride.com
 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
squi...@gmail.com


Re: Object View to Orthorgraphic via scripting

2013-09-12 Thread Eric Thivierge
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?


On September-12-13 12:52:03 PM, Luc-Eric Rousseau wrote:

I think there is nothing you can do to know the real name of the
camera if it's not a scene camera.  The camera will be one of those
under Application/Views/List/View#/UserCamera.  but there is no way
for you to know for sure the # if you have multiple object views.

On Thu, Sep 12, 2013 at 11:58 AM, Eric Thivierge ethivie...@hybride.com wrote:

I feel like I asked this before but came up with nothing from searching
google. Can you set an object view to orthorgraphic via scripting? No view
attributes are able to get me to the embedded camera it's using to set this.

Eric T.





Re: Object View to Orthorgraphic via scripting

2013-09-12 Thread Luc-Eric Rousseau
I think there is nothing you can do to know the real name of the
camera if it's not a scene camera.  The camera will be one of those
under Application/Views/List/View#/UserCamera.  but there is no way
for you to know for sure the # if you have multiple object views.

On Thu, Sep 12, 2013 at 11:58 AM, Eric Thivierge ethivie...@hybride.com wrote:
 I feel like I asked this before but came up with nothing from searching
 google. Can you set an object view to orthorgraphic via scripting? No view
 attributes are able to get me to the embedded camera it's using to set this.

 Eric T.



Re: Object View to Orthorgraphic via scripting

2013-09-12 Thread Luc-Eric Rousseau
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 ethivie...@hybride.com 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?



Object View to Orthorgraphic via scripting

2013-09-12 Thread Eric Thivierge
I feel like I asked this before but came up with nothing from searching 
google. Can you set an object view to orthorgraphic via scripting? No 
view attributes are able to get me to the embedded camera it's using to 
set this.


Eric T.



Re: Object View to Orthorgraphic via scripting

2013-09-12 Thread Daniel Brassard
 oCamera.Parameters( “proj” ).value

1 (perspective) , 0 (orthographic)


On Thu, Sep 12, 2013 at 11:58 AM, Eric Thivierge ethivie...@hybride.comwrote:

 I feel like I asked this before but came up with nothing from searching
 google. Can you set an object view to orthorgraphic via scripting? No view
 attributes are able to get me to the embedded camera it's using to set this.

 Eric T.




Re: Object View to Orthorgraphic via scripting

2013-09-12 Thread Daniel Brassard
Sorry about the double post. The link should had been:

http://download.autodesk.com/global/docs/softimage2014/en_us/sdkguide/si_om/Camera.html



On Thu, Sep 12, 2013 at 12:59 PM, Eric Thivierge ethivie...@hybride.comwrote:

 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?


 On September-12-13 12:52:03 PM, Luc-Eric Rousseau wrote:

 I think there is nothing you can do to know the real name of the
 camera if it's not a scene camera.  The camera will be one of those
 under Application/Views/List/View#/**UserCamera.  but there is no way
 for you to know for sure the # if you have multiple object views.

 On Thu, Sep 12, 2013 at 11:58 AM, Eric Thivierge ethivie...@hybride.com
 wrote:

 I feel like I asked this before but came up with nothing from searching
 google. Can you set an object view to orthorgraphic via scripting? No
 view
 attributes are able to get me to the embedded camera it's using to set
 this.

 Eric T.