Adjust View from API

52 views
Skip to first unread message

Edward Barber

unread,
Apr 1, 2021, 3:26:43 AM4/1/21
to OpenVSP
Hello all,

I have a short vspscript to adjust view parameters by modifying parm values within the vehicle "AdjustView" group (see below for a simple example that sets the view X Rot to 90). This only seems to work if I have the "Adjust View" GUI window open. Is this a bug or intentional? I am on OpenVSP 3.23.0.

Related to the above: I was thinking about adapting my script to capture images of configuration changes made from command line. But before I start down that path, I wanted to see if it is even possible to call ScreenGrab() without the GUI open. Any thoughts? (or suggestions for alternatives - I suppose I could re-draw the model from degen geometry…)

Cheers,

Edward

P.S. Sample adjustview script:

void main()
{
string vid = FindContainer( "Vehicle", 0 );
string view_x = FindParm( vid, "RotationX", "AdjustView" );
SetParmVal( view_x, 90.0 );
Update();
}

jvgr...@gmail.com

unread,
Apr 1, 2021, 12:58:08 PM4/1/21
to OpenVSP
Edward,

It does appear that the Adjust View GUI needs to be open for the view parameters to be adjusted and updated correctly. This is because the Parms reside in the screen class, which only exists when the screen is open. For what you're trying to work we'll likely need to move the Parms and parts of the Update function out of the GUI class so they can be available to non-GUI classes like the Vehicle Parm Container. 

Calling "vsp -script" from the command line without the GUI currently won't let the adjust view Parms even be set. However, ScreenGrab will work regardless of if the GUI s open or not. When it won't work is when OpenVSP is compiled without the GUI at all. 

I think it would be good to relocate the Adjust View parms so you can use them from the API without the GUI even being open. Rob, if you have any thoughts on this please let me know. 

Overall I don't think this change will be significantly difficult to support, so I'll make an effort to do so before the next release. 

Thanks,

Justin

Rob McDonald

unread,
Apr 1, 2021, 1:37:22 PM4/1/21
to ope...@googlegroups.com
There must be some reason they were put there instead of in Vehicle or some ViewMgr....  I do know that the 'real' view is stored deep in the graphics subsystem.  The edit view screen is weird because it has to interact with the authoritative versions of that information stored deep in graphics.

Are you sure the screen shot will work without a graphics window open?  I know it actually renders the screen shot to a back buffer -- this is what allows us to do the screen shot at some super-resolution that the screen is not actually displaying.  However, I thought there was something along the way that required graphics to be open for this to work...

Fixing this would be great -- unfortunately, I fear it may require diving deep into the graphics mess...

Rob


--
You received this message because you are subscribed to the Google Groups "OpenVSP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openvsp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openvsp/ac806724-6887-4f42-9515-1a05e9cdfdf3n%40googlegroups.com.

Edward Barber

unread,
Apr 2, 2021, 11:40:56 AM4/2/21
to ope...@googlegroups.com
Justin, Rob,

Thanks for your input. If it does end up being more work than you originally thought, I can live without. Will just have to remember to open the adjust view gui panel before running my script :)

Cheers, 
-Edward


You received this message because you are subscribed to a topic in the Google Groups "OpenVSP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openvsp/-79CfY1n9yA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openvsp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openvsp/CAEppYpHrT90zjwJ74kXsBEU9KOM-H-3XDB3vXUk%2B-QG%2BX8bonA%40mail.gmail.com.

ajfi...@gmail.com

unread,
Apr 5, 2021, 5:36:18 PM4/5/21
to OpenVSP
I have not had any luck trying to get a screen shot without a graphics window open, I spent a while trying a couple years back. If anyone has any luck with this I'd be interested in hearing about it!
-AJ

Reply all
Reply to author
Forward
0 new messages