JHangstoerfer Posted May 9, 2022 Share Posted May 9, 2022 (edited) We want to update the matrix of a saved view of perspective type. In the UI this is handled via "Redefine..." in the Navigation palette and also allows you to change some restore options but those are not relevant for us. I don't see any methods in the SDK that would allows us to do this. There is gSDK->EditSavedViewWithUI but that opens the Edit dialog, which does not update the matrix, only the other options and the name. A way to trigger to open up the Redefine UI would also be fine for us. "Redefine..." seems update the matrix on the saveViewNode. Would it be possible to directly modify these fields with our new matrix? Edited May 9, 2022 by JHangstoerfer Quote Link to comment
Maarten DE Posted May 9, 2022 Share Posted May 9, 2022 Since you know where the matrix is located in the aux list, you should be able to adjust it using the aux functions: https://developer.vectorworks.net/index.php/Category:VCOM:VectorWorks:ISDK(Auxiliary_and_Data_Objects) I thought I had some code where I adjusted something in an aux list, but I can't find it anymore... Quote Link to comment
JHangstoerfer Posted May 11, 2022 Author Share Posted May 11, 2022 On 5/9/2022 at 5:50 PM, Maarten DE said: Since you know where the matrix is located in the aux list, you should be able to adjust it using the aux functions: https://developer.vectorworks.net/index.php/Category:VCOM:VectorWorks:ISDK(Auxiliary_and_Data_Objects) I thought I had some code where I adjusted something in an aux list, but I can't find it anymore... I don't see a way to read or write the fields from my screenshot directly. It might be possible they are additionally saved in tagged user data but I don't have the dataTags and dataIndex to read those values without brute forcing to find them. Quote Link to comment
JHangstoerfer Posted May 12, 2022 Author Share Posted May 12, 2022 On 5/11/2022 at 10:04 AM, JHangstoerfer said: It might be possible they are additionally saved in tagged user data but I don't have the dataTags and dataIndex to read those values without brute forcing to find them. There is some tagged data below saveViewNode but nothing looks like the information that we want. Quote Link to comment
Vectorworks, Inc Employee Dave Donley Posted June 2, 2022 Vectorworks, Inc Employee Share Posted June 2, 2022 virtual GSHandle VCOM_CALLTYPE ViewCreateCurrent() = 0; virtual void VCOM_CALLTYPE ViewDelete(GSHandle hView) = 0; virtual GSHandle VCOM_CALLTYPE ViewDuplicate(GSHandle hView) = 0; virtual size_t VCOM_CALLTYPE ViewGetNumLayers(GSHandle hView) = 0; virtual void VCOM_CALLTYPE ViewGetLayerVisibility(GSHandle hView, size_t index, InternalIndex& outName, short& outVisibility) = 0; virtual size_t VCOM_CALLTYPE ViewGetNumClasses(GSHandle hView) = 0; virtual void VCOM_CALLTYPE ViewGetClassVisibility(GSHandle hView, size_t index, InternalIndex& outClassID, short& outVisibility) = 0; virtual void VCOM_CALLTYPE ViewStore(GSHandle hView) = 0; virtual void VCOM_CALLTYPE ViewRestore(GSHandle hView) = 0; @JHangstoerfer ViewStore saves the current layer's view state to the view handle you pass to it. So if you have the handle you want, then set view projection with gSDK->SetProjection and other view settings using other gSDK routines, then call ViewStore that should commit your new changes to the view handle. There is also a utility class VWViewObj that calls these gSDK routines to do the same things. Quote Link to comment
JHangstoerfer Posted June 3, 2022 Author Share Posted June 3, 2022 23 hours ago, Dave Donley said: @JHangstoerfer ViewStore saves the current layer's view state to the view handle you pass to it. So if you have the handle you want, then set view projection with gSDK->SetProjection and other view settings using other gSDK routines, then call ViewStore that should commit your new changes to the view handle. There is also a utility class VWViewObj that calls these gSDK routines to do the same things. gSDK->ViewStore is the call that we needed. The problem was that we used the VWViewObj utility class. In its constructor, it creates a duplicate of the original saved view so VWViewObj::StoreView doesn't actually commit those changes to the correct object. Here is a working sample, although this might required a RestoreView beforehand, otherwise ViewStore commits changes other than the ViewMatrix. At least I think that's how it works. auto viewParentHandle = VWFC::VWObject::GetNamedObject("Saved View Name"); auto viewHandle = gSDK->FindAuxObject(viewParentHandle, saveViewNode); auto activeLayer = gSDK->GetActiveLayer(); gSDK->SetViewMatrix(activeLayer, viewMatrix); gSDK->ViewStore(viewHandle); 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.