Jump to content
Developer Wiki and Function Reference Links ×

Custom handling of resource conflicts


JBenghiat

Recommended Posts

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.

Link to comment

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;
	}

 

 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...