@Override protected void controlRender(RenderManager rm, ViewPort vp) { if (!wasMeshUpdated) { updateTargetsAndMaterials(spatial);
/** * Access the attachments node of the named bone. If the bone doesn't * already have an attachments node, create one and attach it to the scene * graph. Models and effects attached to the attachments node will follow * the bone's motions. * * @param jointName the name of the joint * @return the attachments node of the joint */ public Node getAttachmentsNode(String jointName) { Joint b = armature.getJoint(jointName); if (b == null) { throw new IllegalArgumentException("Given bone name does not exist " + "in the armature."); } updateTargetsAndMaterials(spatial); int boneIndex = armature.getJointIndex(b); Node n = b.getAttachmentsNode(boneIndex, targets); /* * Select a node to parent the attachments node. */ Node parent; if (spatial instanceof Node) { parent = (Node) spatial; // the usual case } else { parent = spatial.getParent(); } parent.attachChild(n); return n; }
@Override public void setSpatial(Spatial spatial) { Spatial oldSpatial = this.spatial; super.setSpatial(spatial); updateTargetsAndMaterials(spatial); if (oldSpatial != null) { oldSpatial.removeMatParamOverride(numberOfJointsParam); oldSpatial.removeMatParamOverride(jointMatricesParam); } if (spatial != null) { spatial.removeMatParamOverride(numberOfJointsParam); spatial.removeMatParamOverride(jointMatricesParam); spatial.addMatParamOverride(numberOfJointsParam); spatial.addMatParamOverride(jointMatricesParam); } }