本文整理了Java中com.jme3.scene.Spatial.getUserData()
方法的一些代码示例,展示了Spatial.getUserData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.getUserData()
方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:getUserData
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void simpleInitApp() {
Node scene = (Node) assetManager.loadModel("Scenes/DotScene/DotScene.scene");
System.out.println("Scene: " + scene);
Spatial testNode = scene.getChild("TestNode");
System.out.println("TestNode: "+ testNode);
for (String key : testNode.getUserDataKeys()){
System.out.println("Property " + key + " = " + testNode.getUserData(key));
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
Map<String, Map<String, Object>> linkedData = loadedAsset.getUserData("linkedData");
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
Number curveLength = spatial.getUserData("curveLength");
if (curveLength != null && !referencesToCurveLengths.contains(curveLength)) {
length += curveLength.floatValue();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private static void dumpSpatialProperties( String indent, Spatial s ) {
dumpProperties(indent, s, "children");
if( !s.getUserDataKeys().isEmpty() ) {
System.out.println(indent + "userData:");
for( String key : s.getUserDataKeys() ) {
System.out.println(indent + " " + key + ":" + objectToString(s.getUserData(key)));
}
}
if( s.getNumControls() > 0 ) {
System.out.println(indent + "controls:");
for( int i = 0; i < s.getNumControls(); i++ ) {
Control ctl = s.getControl(i);
//dump(indent + " ", ctl);
dumpObject(indent + " ", ctl);
}
}
LightList lights = s.getLocalLightList();
if( lights.size() > 0 ) {
System.out.println(indent + "lights:");
for( Light l : lights ) {
dumpObject(indent + " ", l);
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
float val = ((Float)child.getUserData("height")).floatValue();
float dir = ((Float)child.getUserData("dir")).floatValue();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
for (Spatial spatial : rootNode.getChildren()) {
if (spatial instanceof TerrainQuad) {
Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
if (bool != null && bool.booleanValue()) {
continue; // go to the next child in the loop
createCompoundShape(realRootNode, (Node) spatial, shape, meshAccurate, dynamic);
} else if (spatial instanceof TerrainPatch) {
Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
if (bool != null && bool.booleanValue()) {
continue; // go to the next child in the loop
trans.getRotation().toRotationMatrix());
} else if (spatial instanceof Geometry) {
Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
if (bool != null && bool.booleanValue()) {
continue; // go to the next child in the loop
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
for (Spatial spatial : rootNode.getChildren()) {
if (spatial instanceof TerrainQuad) {
Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
if (bool != null && bool.booleanValue()) {
continue; // go to the next child in the loop
createCompoundShape(realRootNode, (Node) spatial, shape, meshAccurate, dynamic);
} else if (spatial instanceof TerrainPatch) {
Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
if (bool != null && bool.booleanValue()) {
continue; // go to the next child in the loop
trans.getRotation().toRotationMatrix());
} else if (spatial instanceof Geometry) {
Boolean bool = spatial.getUserData(UserData.JME_PHYSICSIGNORE);
if (bool != null && bool.booleanValue()) {
continue; // go to the next child in the loop
代码示例来源:origin: jMonkeyEngine-Contributions/Lemur
public static Integer getLayer( Spatial s ) {
return s.getUserData(LAYER);
}
代码示例来源:origin: net.sf.phat/phat-core
@Override
public boolean visit(Spatial spat) {
String id = spat.getUserData("ID");
if (id != null && id.equals(entityId)) {
result = spat;
return true;
}
return false;
}
代码示例来源:origin: net.sf.phat/phat-core
@Override
public void visit(Spatial spat) {
String id = spat.getUserData("ID");
if (id != null) {
store.put(id, spat);
}
}
};
代码示例来源:origin: net.sf.phat/phat-core
@Override
public void visit(Spatial spat) {
String rol = spat.getUserData("ROLE");
if (rol != null && rol.equals(targetRol)) {
result.add(spat);
}
}
};
代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit
public static boolean isVisualization(Spatial spatial)
{
String rayCastOpacity = spatial.getUserData(JMERayCastOpacity.USER_DATA_FIELD);
if (rayCastOpacity != null && rayCastOpacity.equals(JMERayCastOpacity.TRANSPARENT.toString()))
{
return true;
}
return false;
}
}
代码示例来源:origin: net.sf.phat/phat-core
public static Spatial getParentSpatialWithRole(Spatial spatial, String role) {
Spatial cSpatial = spatial;
String cRole;
while(cSpatial != null) {
cRole = cSpatial.getUserData("ROLE");
if(cRole != null && cRole.equals(role)) {
return cSpatial;
}
cSpatial = cSpatial.getParent();
}
return null;
}
代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit
public static boolean isVisualization(Spatial spatial)
{
String rayCastOpacity = spatial.getUserData(JMERayCastOpacity.USER_DATA_FIELD);
if (rayCastOpacity != null && rayCastOpacity.equals(JMERayCastOpacity.TRANSPARENT.toString()))
{
return true;
}
return false;
}
}
代码示例来源:origin: net.sf.phat/phat-api-server
public static JSONObject getIDAndRole(Spatial spatial) {
System.out.println("spatial Name = "+spatial.getName());
String id = spatial.getUserData("ID");
System.out.println("id = "+id);
System.out.println("");
if (id != null) {
Map<String, Object> map = new HashMap<>();
map.put(PHATObjectToJSON.KEYS.id.name(), id);
map.put(PHATObjectToJSON.KEYS.role.name(), spatial.getUserData("ROLE"));
return new JSONObject(map);
}
return null;
}
}
代码示例来源:origin: net.sf.phat/phat-devices
public static boolean isTVOn(String tvId) {
Spatial tv = SpatialUtils.getSpatialById(SpatialFactory.getRootNode(), tvId);
Boolean state = tv.getUserData(TV_STATE_KEY);
if(state != null && state) {
return true;
}
return false;
}
@Override
代码示例来源:origin: net.sf.phat/phat-devices
public void registerAllAndroidDevicesInScenario() {
List<Spatial> devices = SpatialUtils.getSpatialsByRole(app.getRootNode(), "AndroidDevice");
for (Spatial device : devices) {
String id = device.getUserData("ID");
if (id != null) {
addDevice(id, (Node) device);
}
}
}
代码示例来源:origin: tonihele/OpenKeeper
public static void setLoopModeOnChannel(final Spatial spat, final AnimChannel channel) {
final Anim.FrameFactorFunction func = Anim.FrameFactorFunction.valueOf(spat.getUserData(KmfModelLoader.FRAME_FACTOR_FUNCTION));
switch (func) {
case CLAMP: {
channel.setLoopMode(LoopMode.Cycle);
break;
}
case WRAP: {
channel.setLoopMode(LoopMode.Loop);
break;
}
}
}
代码示例来源:origin: tonihele/OpenKeeper
private static void hideAllNodes(Node root) {
UnitFlowerControl aufc = root.getControl(UnitFlowerControl.class);
for (Spatial child : root.getChildren()) {
// Don't hide the unit flower
if (Boolean.FALSE.equals(child.getUserData(AssetUtils.USER_DATA_KEY_REMOVABLE))) {
continue;
}
child.setCullHint(Spatial.CullHint.Always);
// Also stop any animations
AnimControl animControl = (AnimControl) child.getControl(AnimControl.class);
if (animControl != null) {
animControl.setEnabled(false);
}
}
}
代码示例来源:origin: tonihele/OpenKeeper
@Override
public void visit(Spatial spatial) {
if (!(spatial instanceof Geometry)) {
return;
}
// Don't highlight non-removables
if (Boolean.FALSE.equals(spatial.getUserData(AssetUtils.USER_DATA_KEY_REMOVABLE))) {
return;
}
try {
Material mat = new Material(assetManager,
"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", new ColorRGBA(0, 0, 0.8f, 0.4f));
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
spatial.setMaterial(mat);
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to set material color!", e);
}
}
});
内容来源于网络,如有侵权,请联系作者删除!