本文整理汇总了Java中com.jme3.asset.AssetKey.getName方法的典型用法代码示例。如果您正苦于以下问题:Java AssetKey.getName方法的具体用法?Java AssetKey.getName怎么用?Java AssetKey.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.asset.AssetKey
的用法示例。
在下文中一共展示了AssetKey.getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: locate
import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
@Override
@JMEThread
public AssetInfo locate(@NotNull final AssetManager manager, @NotNull final AssetKey key) {
if (IGNORE_LOCAL.get() == Boolean.TRUE) return null;
final Path absoluteFile = Paths.get(key.getName());
if (Files.exists(absoluteFile)) return null;
final EditorConfig editorConfig = EditorConfig.getInstance();
final Path currentAsset = editorConfig.getCurrentAsset();
if (currentAsset == null) return null;
final String name = key.getName();
final Path resolve = currentAsset.resolve(name);
if (!Files.exists(resolve)) return null;
return new PathAssetInfo(manager, key, resolve);
}
示例2: locate
import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
@Override
public AssetInfo locate(final AssetManager manager, final AssetKey key) {
File assetsDir = new File(Manager.getConfigManager().getMainAssetDir());
File file = new File(assetsDir, key.getName());
if (!file.exists()) {
LOG.log(Level.WARNING, "Asset not found, assetDir={0}, key={1}"
, new Object[] {assetsDir.getAbsolutePath(), key.getName()});
return null;
}
try {
return new StreamAssetInfo(manager, key, new BufferedInputStream(new FileInputStream(file)));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例3: locate
import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public AssetInfo locate(com.jme3.asset.AssetManager manager, AssetKey key)
{
InputStream in = null;
String sAssetPath = rootPath + key.getName();
// Fix path issues
if (sAssetPath.startsWith("/"))
{
// Remove leading /
sAssetPath = sAssetPath.substring(1);
}
sAssetPath = sAssetPath.replace("//", "/");
try {
in = androidManager.open(sAssetPath);
if (in == null)
return null;
return new AndroidAssetInfo(manager, key, sAssetPath);
}
catch (IOException ex)
{
//logger.log(Level.WARNING, "Failed to locate {0} ", sAssetPath);
}
return null;
}
示例4: locate
import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
public AssetInfo locate(AssetManager manager, AssetKey key) {
String name = key.getName();
File file = new File(root, name);
if (file.exists() && file.isFile()){
try {
// Now, check asset name requirements
String canonical = file.getCanonicalPath();
String absolute = file.getAbsolutePath();
if (!canonical.endsWith(absolute)){
throw new AssetNotFoundException("Asset name doesn't match requirements.\n"+
"\"" + canonical + "\" doesn't match \"" + absolute + "\"");
}
} catch (IOException ex) {
throw new AssetLoadException("Failed to get file canonical path " + file, ex);
}
return new AssetInfoFile(manager, key, file);
}else{
return null;
}
}
示例5: locate
import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
public AssetInfo locate(AssetManager manager, AssetKey key) {
String name = key.getName();
ZipEntry entry = zipfile.getEntry(name);
if (entry == null)
return null;
return new JarAssetInfo(manager, key, entry);
}
示例6: locate
import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
public AssetInfo locate(AssetManager manager, AssetKey key) {
String name = key.getName();
File file = new File(root, name);
if (file.exists() && file.isFile()){
return new AssetInfoFile(manager, key, file);
}else{
return null;
}
}
示例7: getUserPath
import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
private FileObject getUserPath(AssetKey key) {
NotifyDescriptor.Confirmation msg = new NotifyDescriptor.Confirmation(
"Referenced file " + key.getName() + " cannot be found!\nDo you want to look for it?",
NotifyDescriptor.YES_NO_OPTION,
NotifyDescriptor.WARNING_MESSAGE);
Object result = DialogDisplayer.getDefault().notify(msg);
if (!NotifyDescriptor.YES_OPTION.equals(result)) {
return null;
}
final String ext = key.getExtension();
FileChooserBuilder fcb = new FileChooserBuilder(this.getClass());
fcb.setTitle("Locate " + key.getName());
fcb.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
if (f.getName().endsWith(ext)) {
return true;
}
return false;
}
@Override
public String getDescription() {
return "Filter for " + ext;
}
});
fcb.setFilesOnly(true);
fcb.setApproveText("Select file");
File file = fcb.showOpenDialog();
if (file == null) {
return null;
}
logger.log(Level.INFO, "Got user file input");
file = FileUtil.normalizeFile(file);
return FileUtil.toFileObject(file);
}
示例8: load
import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
@Override
public Object load(AssetInfo assetInfo) throws IOException {
Node root = new Node(assetInfo.getKey().getName());
InputStream in = null ;
try {
XbufKey xbufkey=null;
AssetKey<?> key=assetInfo.getKey();
if(key instanceof XbufKey){
xbufkey=(XbufKey)key;
}else{
xbufkey=new XbufKey(key.getName());
}
in = assetInfo.openStream();
Xbuf xbuf = XbufLoader.xbufFactory.apply(assetInfo.getManager());
Data src = Data.parseFrom(in, xbuf.registry);
XbufContext context=new XbufContext();
LoggerCollector log = new LoggerCollector("parse:" + assetInfo.getKey().getName());
// context.log=log;
context.setSettings(xbufkey);
xbuf.merge(src, root, context, log);
log.debug("Context:\n{}",context.toString());
log.dumpTo(LoggerFactory.getLogger(this.getClass()));
} catch (Exception exc) {
throw new IOException("wrap xbuf loading exception", exc);
} finally {
if(in!=null)in.close();
}
// if
// MikktspaceTangentGenerator.generate(root);
// if (root.getQuantity() == 1) { < not good. will cause inconsistent behaviour ...
// return root.getChild(0);
// } else {
// return root;
// }
return root;
}
示例9: getAssetFileObject
import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
/**
* Returns the
* <code>FileObject</code> for a given asset path, or null if no such asset
* exists. First looks in the asset folder(s) for the file, then proceeds to
* scan the classpath folders and jar files for it.The returned FileObject
* might be inside a jar file and not writeable!
*
* @param assetKey The asset key to get the file object for
* @return Either a FileObject for the asset or null if not found.
*/
public FileObject getAssetFileObject(AssetKey<?> assetKey) {
String name = assetKey.getName();
return getAssetFileObject(name);
}