This is a list of third party supplied custom view codes. Just copy the code and paste it in to the code area of the custom view.
If you want to write your own code but don't know the Groovy language then the documentation can be found at http://groovy-lang.org/documentation.html or you can search the internet using 'Groovy script tutorial'. There are also plenty of code examples to be found in the External tools forum
By RobM.
Replace the text 'Replace with the name to search for' with the name of the tagged region/area you want to search for. Note for the code to work all single and double quotes used in the 'Name' field must be removed, so don't include them in your search string.
If you want to have a view that shows all area tags by name replace the line 'if(faceLink.equals(name))' with 'if(!faceLink.equals(""))' It then doesn't matter what you enter in the text for 'Replace with the name to search for'.
Whilst the results will always be valid it is up to the skin being used as to whether or not regions/area tags are shown.
def checkLink(text) {
text = text.replaceAll("'","");
text = text.replaceAll("\"","");
return text;
}
def getRegion(String name) {
if(obj.category == Category.image) {
xmp = obj.vars.xmp;
if(xmp != void && xmp != null) {
try {
for (int i=1; (face = xmp.get("mwg-rs:Regions/mwg-rs:RegionList["+ i +"]/mwg-rs:Type")) != null; i++) {
face = xmp.get("mwg-rs:Regions/mwg-rs:RegionList["+ i +"]/mwg-rs:Name");
if(face != null && xmp.get("mwg-rs:Regions/mwg-rs:RegionList["+ i +"]/mwg-rs:Description") != null) {
rDesc = xmp.get("mwg-rs:Regions/mwg-rs:RegionList["+ i +"]/mwg-rs:Description");
faceLink = checkLink(face);
rDescLink = checkLink(rDesc);
if(faceLink.equals(name))
return true
}
}
}
catch(Exception e) {
System.out.println(e);
}
}
}
}
result = getRegion("Replace with the name to search for");
By David Ekholm (now included in custom view examples) // is a comment, code not executed. Pick the flag value to use. Flag has colours/values of None, Red/Select, Yellow/Second, Blue/Review and Green/Approved.
obj.flag == Flag.Select // Red flagged //obj.flag == Flag.NoFlag // Unflagged // obj.flag == Flag.Second // Yellow flagged // obj.flag == Flag.Review // Blue flagged // obj.flag == Flag.Approved // Green flagged
By RobM
Will result in images that have been marked as either Include original or Use original being shown. Obviously, this should not be used if under Settings>Images>General>Include> Originals has been checked, as all images have originals included.
obj.isIncludeOriginal() || obj.isUseOriginal()