use of artisynth.core.modelbase.ModelComponent in project artisynth_core by artisynth.
the class MuscleElementDesc method setExcitationColors.
void setExcitationColors(RenderProps props) {
ModelComponent gparent = getGrandParent();
if (gparent instanceof MuscleBundle) {
MuscleBundle bundle = (MuscleBundle) gparent;
float[] excitationColor = bundle.myExcitationColor;
if (excitationColor != null) {
double s = Math.min(getNetExcitation() / bundle.myMaxColoredExcitation, 1);
float[] baseColor;
if (myDirectionColor == null) {
myDirectionColor = new float[4];
}
myDirectionColor[3] = (float) props.getAlpha();
baseColor = props.getLineColorF();
ColorUtils.interpolateColor(myDirectionColor, baseColor, excitationColor, s);
if (myWidgetColor == null) {
myWidgetColor = new float[4];
}
baseColor = props.getFaceColorF();
ColorUtils.interpolateColor(myWidgetColor, baseColor, excitationColor, s);
myWidgetColor[3] = (float) props.getAlpha();
} else {
myDirectionColor = null;
myWidgetColor = null;
}
}
}
use of artisynth.core.modelbase.ModelComponent in project artisynth_core by artisynth.
the class AuxMaterialElementDesc method render.
public void render(Renderer renderer, RenderProps props, int flags) {
double widgetSize = 0;
double rad = 0;
FractionRenderType renderType = AuxMaterialBundle.DEFAULT_FRACTION_RENDER_TYPE;
ModelComponent gparent = getGrandParent();
if (gparent instanceof AuxMaterialBundle) {
AuxMaterialBundle bundle = (AuxMaterialBundle) gparent;
widgetSize = bundle.getElementWidgetSize();
rad = bundle.getFractionRenderRadius();
renderType = bundle.getFractionRenderType();
}
if (widgetSize != 0 || rad > 0) {
Shading savedShading = renderer.setPropsShading(props);
renderer.setFaceColoring(props, myWidgetColor, isSelected());
if (widgetSize != 0) {
myElement.renderWidget(renderer, widgetSize, props);
}
if (rad > 0) {
renderFraction(renderer, props, rad, renderType);
}
renderer.setShading(savedShading);
}
}
use of artisynth.core.modelbase.ModelComponent in project artisynth_core by artisynth.
the class PointSkinAttachment method getSoftReferences.
@Override
public void getSoftReferences(List<ModelComponent> refs) {
super.getSoftReferences(refs);
Point point = getPoint();
if (point != null) {
refs.add(point);
}
for (int i = 0; i < myNumConnections; i++) {
ModelComponent m = myConnections[i].getMaster();
if (m != null) {
refs.add(myConnections[i].getMaster());
}
}
}
use of artisynth.core.modelbase.ModelComponent in project artisynth_core by artisynth.
the class FemNode3d method connectToHierarchy.
@Override
public void connectToHierarchy() {
super.connectToHierarchy();
// paranoid; do this in both connect and disconnect
myNodeNeighbors.clear();
clearIndirectNeighbors();
ModelComponent gp = getGrandParent();
if (gp instanceof FemModel3d) {
FemModel3d fem = (FemModel3d) gp;
if (fem.isFrameRelative()) {
setFrame(fem.getFrame());
}
}
}
use of artisynth.core.modelbase.ModelComponent in project artisynth_core by artisynth.
the class AddPropertyPane method getPropFromString.
/**
* finds a property as defined by the input string. Everything after the "."
* should be property names.
*
* @param pathName
* @return true if property can be found from the string input.
*/
private Property getPropFromString(String pathName) {
if (pathName == null) {
return null;
}
// System.out.println("looking for Property path: " + pathName);
if (// the path could contain properties,
pathName.indexOf(".") != -1) // or
// even sub properties
{
String compName = pathName.substring(0, pathName.indexOf("."));
String propPath = pathName.substring(pathName.indexOf(".") + 1, pathName.length());
System.out.println("comp: " + compName + "; prop: " + propPath);
// propPath is everything after the . - e.g. renderProps.visible
ModelComponent component = getCompFromStr(compName);
if (component != null) {
return RecursePropString(propPath, component);
} else {
return null;
}
} else {
return null;
}
}
Aggregations