Skip to content

Commit 3fdc5df

Browse files
committed
Enable default parameter values in scripts
You can now write: @int(value = 5) sigma And the sigma variable will have a default value of 5 the first time the script is run. Nicer would be: @int sigma = 5 But implementing that would be more involved, and so should probably wait till script parameter parsing is truly fixed as described in #156.
1 parent dfd2657 commit 3fdc5df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/scijava/script/ScriptInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ else if ("visibility".equalsIgnoreCase(key)) {
461461
item.setVisibility(convertService.convert(value, ItemVisibility.class));
462462
}
463463
else if ("value".equalsIgnoreCase(key)) {
464-
item.setWidgetStyle(value);
464+
item.setDefaultValue(convertService.convert(value, item.getType()));
465465
}
466466
else {
467467
throw new ScriptException("Invalid attribute name: " + key);

0 commit comments

Comments
 (0)