MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / fixPathName

Method fixPathName

Engine/NodeGroup.cpp:880–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

878}
879
880void
881NodeCollection::fixPathName(const std::string& oldName,
882 const std::string& newName)
883{
884 NodesList nodes = getNodes();
885 AppInstancePtr appInst = getApplication();
886 if (!appInst) {
887 return;
888 }
889 ProjectPtr project = appInst->getProject();
890
891 for (NodesList::iterator it = nodes.begin(); it != nodes.end(); ++it) {
892 if ( (*it)->isActivated() ) {
893 const KnobsVec& knobs = (*it)->getKnobs();
894 for (U32 j = 0; j < knobs.size(); ++j) {
895 KnobStringBase* isString = dynamic_cast< KnobStringBase* >( knobs[j].get() );
896 KnobString* isStringKnob = dynamic_cast<KnobString*>(isString);
897 if ( !isString || isStringKnob || ( knobs[j] == project->getEnvVarKnob() ) ) {
898 continue;
899 }
900
901 std::string filepath = isString->getValue();
902
903 if ( ( filepath.size() >= (oldName.size() + 2) ) &&
904 ( filepath[0] == '[') &&
905 ( filepath[oldName.size() + 1] == ']') &&
906 ( filepath.substr( 1, oldName.size() ) == oldName) ) {
907 filepath.replace(1, oldName.size(), newName);
908 isString->setValue(filepath);
909 }
910 }
911
912 NodeGroup* isGrp = (*it)->isEffectGroup();
913 if (isGrp) {
914 isGrp->fixPathName(oldName, newName);
915 }
916 }
917 }
918}
919
920bool
921NodeCollection::checkIfNodeLabelExists(const std::string & n,

Callers 1

tableChangedMethod · 0.80

Calls 9

getProjectMethod · 0.80
getEnvVarKnobMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
isActivatedMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
getValueMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected