当前位置: 首页>>代码示例>>Java>>正文


Java Geometry.getName方法代码示例

本文整理汇总了Java中com.jme3.scene.Geometry.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Geometry.getName方法的具体用法?Java Geometry.getName怎么用?Java Geometry.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.scene.Geometry的用法示例。


在下文中一共展示了Geometry.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateNames

import com.jme3.scene.Geometry; //导入方法依赖的package包/类
/**
 * Generate names for materials.
 */
private void generateNames(@NotNull final ObjectDictionary<String, Geometry> mapping,
                           @NotNull final Geometry geometry) {

    final Material material = geometry.getMaterial();
    final String originalName = material.getName();
    final String name = StringUtils.isEmpty(geometry.getName()) ? "geom" : geometry.getName();

    String resultName = StringUtils.isEmpty(originalName) ? "embedded-mat-" + name : originalName;

    if (!mapping.containsKey(resultName)) {
        mapping.put(resultName, geometry);
    } else {
        for (int i = 1; mapping.containsKey(resultName); i++) {
            resultName = (StringUtils.isEmpty(originalName) ? "embedded-mat-" : originalName) + name + "_" + i;
        }
        mapping.put(resultName, geometry);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:AbstractModelFileConverter.java

示例2: detectPickedAxis

import com.jme3.scene.Geometry; //导入方法依赖的package包/类
protected void detectPickedAxis(@NotNull final EditorTransformSupport editorControl,
                                @NotNull final CollisionResult collisionResult) {

    final Geometry geometry = collisionResult.getGeometry();
    final String geometryName = geometry.getName();

    if (geometryName.contains(getNodeX())) {
        editorControl.setPickedAxis(PickedAxis.X);
    } else if (geometryName.contains(getNodeY())) {
        editorControl.setPickedAxis(PickedAxis.Y);
    } else if (geometryName.contains(getNodeZ())) {
        editorControl.setPickedAxis(PickedAxis.Z);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:15,代码来源:AbstractTransformControl.java

示例3: fillControl

import com.jme3.scene.Geometry; //导入方法依赖的package包/类
/**
 * Fill this control.
 *
 * @param influencer the influencer
 * @param root       the root
 */
protected void fillControl(@NotNull final PhysicsInfluencer influencer, @NotNull final VBox root) {

    final GeometryList geometries = influencer.getGeometries();

    for (int i = 0, length = geometries.size(); i < length; i++) {

        final Geometry geometry = geometries.get(i);
        final Label label = new Label(Messages.MODEL_PROPERTY_GEOMETRY + ": " + geometry.getName());
        label.prefWidthProperty().bind(widthProperty());

        FXUtils.addToPane(label, root);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:20,代码来源:PhysicsNodeListControl.java

示例4: exportMaterials

import com.jme3.scene.Geometry; //导入方法依赖的package包/类
/**
 * Export all embedded materials from the external model.
 *
 * @param materialsFolder    the materials folder.
 * @param overwriteMaterials true if we can overwrite existing materials.
 * @param geometries         the found geometries in the model.
 */
@BackgroundThread
private void exportMaterials(@NotNull final Path materialsFolder, final boolean overwriteMaterials,
                             @NotNull final Array<Geometry> geometries) {

    if (geometries.isEmpty()) {
        return;
    }

    final ObjectDictionary<String, String> resultNameToKey = DictionaryFactory.newObjectDictionary();

    for (final Geometry geometry : geometries) {

        final Material material = geometry.getMaterial();
        final String originalName = material.getName();
        final String name = StringUtils.isEmpty(geometry.getName()) ? "geom" : geometry.getName();
        final String resultName = StringUtils.isEmpty(originalName) ? "embedded-mat-" + name : originalName;

        final String newKey = resultNameToKey.get(resultName);
        if (newKey != null) {
            material.setKey(new MaterialKey(newKey));
            continue;
        }

        final Path resultFile = materialsFolder.resolve(resultName + "." + FileExtensions.JME_MATERIAL);

        if (!Files.exists(resultFile) || overwriteMaterials) {
            try (PrintWriter pout = new PrintWriter(Files.newOutputStream(resultFile, WRITE, TRUNCATE_EXISTING, CREATE))) {
                pout.println(MaterialSerializer.serializeToString(material));
            } catch (final IOException e) {
                throw new RuntimeException(e);
            }
        }

        final Path assetFile = notNull(getAssetFile(resultFile));
        final String assetPath = toAssetPath(assetFile);

        material.setKey(new MaterialKey(assetPath));
        resultNameToKey.put(resultName, assetPath);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:48,代码来源:ModelImportDialog.java


注:本文中的com.jme3.scene.Geometry.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。