@Override public void onAction(String name, boolean isPressed, float tpf) { if (name.equals("toggleDebug") && isPressed) { if (debugNode.getParent() == null) { rootNode.attachChild(debugNode); } else { debugNode.removeFromParent(); } } } }, "toggleDebug");
private void parseLight(Attributes attribs) throws SAXException { if (node == null || node.getParent() == null) { throw new SAXException("dotScene parse error: light can only appear under a node"); } checkTopNode("node"); String lightType = parseString(attribs.getValue("type"), "point"); if (lightType.equals("point")) { light = new PointLight(); } else if (lightType.equals("directional") || lightType.equals("sun")) { light = new DirectionalLight(); // Assuming "normal" property is not provided ((DirectionalLight) light).setDirection(Vector3f.UNIT_Z); } else if (lightType.equals("spotLight") || lightType.equals("spot")) { light = new SpotLight(); } else if (lightType.equals("omni")) { // XXX: It doesn't seem any exporters actually emit this type? light = new AmbientLight(); } else { logger.log(Level.WARNING, "No matching jME3 LightType found for OGRE LightType: {0}", lightType); } logger.log(Level.FINEST, "{0} created.", light); if (!parseBool(attribs.getValue("visible"), true)) { // set to disabled } // "attach" it to the parent of this node if (light != null) { node.getParent().addLight(light); } }
@Override public void onAction(String name, boolean isPressed, float tpf) { if (name.equals("tex") && isPressed) { if (tex == null) { tex = EnvMapUtils.getCubeMapCrossDebugViewWithMipMaps(stateManager.getState(EnvironmentCamera.class).debugEnv, assetManager); } if (tex.getParent() == null) { guiNode.attachChild(tex); } else { tex.removeFromParent(); } } if (name.equals("switch") && isPressed) { switchMat(rootNode.getChild("Scene")); } if (name.equals("ref") && isPressed) { if (ref.getParent() == null) { guiNode.attachChild(ref); } else { ref.removeFromParent(); } } } }, "tex", "switch", "ref");
/** * sets the tension of the curve (only for catmull rom) 0.0 will give a linear curve, 1.0 a round curve * @param curveTension */ public void setCurveTension(float curveTension) { spline.setCurveTension(curveTension); if (debugNode != null) { Node parent = debugNode.getParent(); debugNode.removeFromParent(); debugNode.detachAllChildren(); debugNode = null; attachDebugNode(parent); } }
/** * sets the type of spline used for the path interpolation for this path * @param pathSplineType */ public void setPathSplineType(SplineType pathSplineType) { spline.setType(pathSplineType); if (debugNode != null) { Node parent = debugNode.getParent(); debugNode.removeFromParent(); debugNode.detachAllChildren(); debugNode = null; attachDebugNode(parent); } }
/** * Sets the path to be a cycle * @param cycle */ public void setCycle(boolean cycle) { spline.setCycle(cycle); if (debugNode != null) { Node parent = debugNode.getParent(); debugNode.removeFromParent(); debugNode.detachAllChildren(); debugNode = null; attachDebugNode(parent); } }
return; if (tex.getParent() == null) { guiNode.attachChild(tex); } else {
if (object instanceof Node) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "{0}: {1}--> {2}", new Object[] { ((Node) object).getName(), ((Node) object).getLocalTranslation().toString(), ((Node) object).getParent() == null ? "null" : ((Node) object).getParent().getName() }); if (((Node) object).getParent() == null) { result.attachChild((Spatial) object);
@Override public void endElement(String uri, String name, String qName) throws SAXException { if (qName.equals("node")) { node = node.getParent(); } else if (qName.equals("nodes")) { node = null; } else if (qName.equals("entity")) { node = entityNode.getParent(); entityNode = null; } else if (qName.equals("camera")) {
Node object = (Node) objectHelper.toObject(block.getStructure(blenderContext), blenderContext); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "{0}: {1}--> {2}", new Object[] { object.getName(), object.getLocalTranslation().toString(), object.getParent() == null ? "null" : object.getParent().getName() }); if (object.getParent() == null) { loadedFeatures.objects.add(object);
@Override public void simpleUpdate(float tpf) { frame++; if (frame == 2) { modelNode.removeFromParent(); final LightProbe probe = LightProbeFactory.makeProbe(stateManager.getState(EnvironmentCamera.class), rootNode, new JobProgressAdapter<LightProbe>() { @Override public void done(LightProbe result) { System.err.println("Done rendering env maps"); tex = EnvMapUtils.getCubeMapCrossDebugViewWithMipMaps(result.getPrefilteredEnvMap(), assetManager); } }); ((SphereProbeArea) probe.getArea()).setRadius(100); rootNode.addLight(probe); //getStateManager().getState(EnvironmentManager.class).addEnvProbe(probe); } if (frame > 10 && modelNode.getParent() == null) { rootNode.attachChild(modelNode); } }
if (rootNode && spatial.getParent() != null) { throw new IllegalStateException("Given spatial must be a root node!");
Node attachParent = attachNode.getParent(); if (attachParent == null || targetGeometry == null || targetGeometry.getParent() == attachParent attachNode.setLocalRotation(modelRot); attachNode.setLocalScale(modelScale); attachNode.getLocalTransform().combineWithParent(attachNode.getParent().getWorldTransform().invert());
return; Node attachParent = attachedNode.getParent(); if (attachParent == null || targetGeometry == null || targetGeometry.getParent() == attachParent
public boolean isBodyInTheWorld(String bodyId) { Node body = availableDevices.get(bodyId); if (body != null) { return body.getParent() != null; } return false; }
protected boolean hasParent() { if( getNode() == null ) return false; return getNode().getParent() != null; }
public Vector3f getLocation(String bodyId) { Node body = availableDevices.get(bodyId); if (body != null && body.getParent() != null) { if(body.getControl(RigidBodyControl.class) != null) { return body.getControl(RigidBodyControl.class).getPhysicsLocation(); } else { return body.getWorldTranslation(); } } return null; }
public void detachAndDispose_onRendThrd() { // Clean up called when we are resized out of existence. getLogger().debug("Detach and dispose called for goody at index {}", getIndex()); Node displayNode = getDisplayNode(); if (displayNode != null) { Node parentNode = displayNode.getParent(); if (parentNode != null) { parentNode.detachChild(displayNode); } } } }
public void invalidate() { if( getNode() == null ) return; // not attached yet... no reason to be marked invalid anyway if( isChild() ) { // Our parent controls our layout getNode().getParent().getControl(GuiControl.class).invalidate(); invalid = false; } else { invalid = true; } }