0 Replies Latest reply on Mar 31, 2015 6:19 AM by tomvandezande

    editing (nested) symbols




      I am creating a plugin in which symbol isolation can be initiated the "normal way" (by double clicking on an instance) or programmatically. The latter uses the following code:


      To start editing:

      sAISymbol -> SetEditingSymbolDefinition(symbol, someArtHandle)


      Next I am listening to kAIBeforeIsolationModeChangedNotifier and when it occurs I am saving the symbol:

          //Get the isolated art

          AIArtHandle symbolParent;

          AIArtHandle currentSymArt;


          ai::AutoBuffer<AIArtHandle> parentChain;

          sAIIsolationMode->GetIsolatedArtAndParents(&symbolParent, &parentChain);

          err = sAIArt->GetArtFirstChild(symbolParent, &currentSymArt);


          //Get current symbol

          AIPatternHandle currentSym;

          ai::UnicodeString isolatedName;

          err = sAIArt->GetArtName(currentSymArt, isolatedName, NULL);

          err = sAISymbol->GetSymbolPatternByName(isolatedName, &currentSym);


          err = sAISymbol->EndEditingSymbolDefinition(currentSym, true);

      (There must be an easier/better way to do this, and I'd love to hear about it!)

      This all seems to work. However if there is a nested symbol, things get more complicated. The following scenario fails:

      1) initiate symbol isolation programmatically

      2) initiate symbol isolation of nested symbol by double clicking on it

      3) exit isolation mode


      There are no errors but the nested symbol isn't saved. This might have to do with the precondition of EndEditingSymbolDefinition, which is StartEditingSymbolDefinition? Double click on symbol instance doesn't seem to trigger that? What is the real difference between those anyways (under the hood i mean)? In the above scenario, how can I save the changes made to the nested symbol?