JBenghiat Posted November 4, 2021 Share Posted November 4, 2021 Does anyone have any examples or insights for using TImportResourceConflictCallbackProcPtr? The issue I'm having is when I import a symbol that contain's a class name that conflicts with a non-class (like a symbol that has the same name as the class). I want the imported symbol to replace an existing symbol, but I want the incoming class to rename silently. Quote Link to comment
Maarten DE Posted November 4, 2021 Share Posted November 4, 2021 We made a function to import resources, that is using EImportResourceConflictResult, but it will prompt the user in case of a name conflict (so not 100% what you're looking for, what you ask for, I haven't come across anything like that in the SDK). MCObjectHandle ImportNestedResourceFromFile( VCOMPtr<IFolderIdentifier> idFolder, TXString extrFolder, TXString filename, eVWObjectType::Type vw_type, TXString name ) { IResourceManagerContentPtr importResManContPtr = nullptr; importResManContPtr.Query( VectorWorks::Extension::IID_ResourceManagerContent ); importResManContPtr->InitByTDType( (TDType)vw_type ); importResManContPtr->AddContent( EFolderSpecifier::kDefaultsFolder, extrFolder ); TXString fullPath; idFolder->GetFullPath( fullPath ); if ( importResManContPtr->SetSelectedItemText( name, fullPath + filename ) ) { MCObjectHandle ret = importResManContPtr->ImportSelectedResourceToCurrentFile( VectorWorks::EImportResourceConflictResult::eImportResourceConflictResult_AskWithUI, true ); DEBUG_Check2( ret != nullptr, (char*)"ERROR: Resource: %s cannot be imported to current file", (const char *)name ); return ret; } return nullptr; } 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.