Cmb Posted October 31, 2018 Share Posted October 31, 2018 Hello ! I'd like to know if there is an equivalent as this method in Vectorscript in the SDK : AddAssociation(obj1, kOnDeleteDelete, obj2); or what is the best way to have the same behavior, as I want to delete a child when an Object is removed. I also tried to catch the event in VWParametric_EventSink, but can't find a virtual for that. Is there a way to do this without having to override : virtual Sint32 VCOM_CALLTYPE Execute(ParametricMessage* message); Thanks Quote Link to comment
JBenghiat Posted October 31, 2018 Share Posted October 31, 2018 You can add an association with Kludge. I couldn't find a way to remove an association, so I call VS. // ------------------------------------------------------------------------------------------------------ void AddDeleteAssociation(MCObjectHandle FromObject, MCObjectHandle ToObject) { PluginLibraryArgTable argTable; argTable.args[0].argType = kHandleArgType; argTable.args[0].handleValue = FromObject; argTable.args[1].argType = kIntegerArgType; argTable.args[1].intValue = 4; argTable.args[2].argType = kHandleArgType; argTable.args[2].handleValue = ToObject; EPE_Kludge in( EPE_Kludge::kKludgeAddAssociation, & argTable ); ::GS_Kludge( gCBP, EPE_Kludge::kKludgeSelector, & in, nil ) && argTable.functionResult.boolValue;; } void RemoveDeleteAssociation(MCObjectHandle FromObject, MCObjectHandle ToObject) { PluginLibraryArgTable argTable; argTable.args[0].argType = kHandleArgType; argTable.args[0].handleValue = ToObject; argTable.args[1].argType = kIntegerArgType; argTable.args[1].intValue = 4; argTable.args[2].argType = kHandleArgType; argTable.args[2].handleValue = FromObject; gSDK->CallPluginLibrary("RemoveAssociation", &argTable, 0); } // ------------------------------------------------------------------------------------------------------ If you want to handle deletions on the event level, look at the UpdateSupport example in the SDK. The update manager runs independently of the plug-in objects, so it can handle deletions. 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.