use of artisynth.core.modelbase.ModelComponent in project artisynth_core by artisynth.
the class ComponentPropertyField method updateInternalValue.
protected boolean updateInternalValue(Object value) {
ModelComponent newComp = getComponent(value);
if (mySelectionEnabled) {
if (newComp != null && mySelectionManager.getLastSelected() != newComp) {
mySelectionListenerMasked = true;
mySelectionManager.clearSelections();
mySelectionManager.addSelected(newComp);
mySelectionListenerMasked = false;
}
}
if (!valuesEqual(value, myValue)) {
// ModelComponent oldComp = getComponent (myValue);
// ModelComponent newComp = getComponent (value);
myValue = value;
// }
if (myPropertySelector != null) {
updatePropertySelector();
}
return true;
} else {
return false;
}
}
use of artisynth.core.modelbase.ModelComponent in project artisynth_core by artisynth.
the class ComponentPropertyField method valueToText.
protected String valueToText(Object value) {
ModelComponent comp = getComponent(value);
RootModel root = myMain.getRootModel();
if (root == null || comp == null) {
return "";
}
if (value instanceof ModelComponent) {
return ComponentUtils.getPathName(root, comp);
} else if (value instanceof Property) {
Property prop = (Property) value;
boolean excludeLeaf = (myPropertySelector != null && !(prop.get() instanceof CompositeProperty));
String path = ComponentUtils.getPropertyPathName(prop, root, false);
if (!path.contains(":")) {
// root component + property
path = "/:" + path;
}
return path;
} else {
throw new InternalErrorException("Unknown value type: " + value.getClass());
}
// String text = ComponentUtils.getPathName(root, comp);
// if (value instanceof Property)
// { Property prop = (Property)value;
// String propPath = getPropertyPath (prop, myPropertySelector != null);
// if (propPath.length() > 0)
// { text += "/" + propPath;
// }
// }
// return text;
}
use of artisynth.core.modelbase.ModelComponent in project artisynth_core by artisynth.
the class HydrostatInvDemo method addInverseController.
protected void addInverseController() {
trackingController = new TrackingController(mech, "tcon");
for (ModelComponent comp : hydro.createTargetList()) {
trackingController.addMotionTarget((MotionTargetComponent) comp);
}
if (useBundlesForInverse) {
for (MuscleBundle b : hydro.getMuscleBundles()) {
trackingController.addExciter(b);
Color exColor = b.getRenderProps().getLineColor();
b.setExcitationColor(exColor);
RenderProps.setLineColor(b, Color.WHITE);
}
} else {
for (ExcitationComponent exciter : hydro.getMuscleExciters()) {
trackingController.addExciter(exciter);
}
}
trackingController.addL2RegularizationTerm(100 * 100);
trackingController.setProbeDuration(5.0);
trackingController.setProbeUpdateInterval(stepsize);
trackingController.createProbesAndPanel(this);
addController(trackingController);
}
Aggregations