當前位置: 首頁>>代碼示例>>Java>>正文


Java SceneExplorerTopComponent類代碼示例

本文整理匯總了Java中com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent的典型用法代碼示例。如果您正苦於以下問題:Java SceneExplorerTopComponent類的具體用法?Java SceneExplorerTopComponent怎麽用?Java SceneExplorerTopComponent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SceneExplorerTopComponent類屬於com.jme3.gde.core.sceneexplorer包,在下文中一共展示了SceneExplorerTopComponent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: select

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
private boolean select(AbstractSceneExplorerNode node) {
    if (editorController != null) {
        editorController.setSelectedExplorerNode(node);
    }
    if (node instanceof JmeSpatial) {
        selectSpatial(((JmeSpatial) node).getLookup().lookup(Spatial.class));
        SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{node});
        SceneExplorerTopComponent.findInstance().setSelectedNode(node);
        return true;
    } else if (toolController != null) {
        Spatial selectedGizmo = toolController.getMarker(node);
        if (selectedGizmo != null) {
            selectSpatial(selectedGizmo);
            SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{node});
            SceneExplorerTopComponent.findInstance().setSelectedNode(node);
            return true;
        }
    }
    return false;
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:21,代碼來源:SceneComposerTopComponent.java

示例2: duplicate

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
private void duplicate() {
    Spatial selected = toolController.getSelectedSpatial();

    Spatial clone = selected.clone();
    clone.move(1, 0, 1);

    selected.getParent().attachChild(clone);
    actionPerformed(new DuplicateUndo(clone, selected.getParent()));
    selected = clone;
    final Spatial cloned = clone;
    final JmeNode rootNode = toolController.getRootNode();
    refreshSelected(rootNode, selected.getParent());

    java.awt.EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            if (cloned != null) {
                SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{rootNode.getChild(cloned)});
                SceneExplorerTopComponent.findInstance().setSelectedNode(rootNode.getChild(cloned));
            }
        }
    });

    toolController.updateSelection(selected);
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:27,代碼來源:DuplicateShortcut.java

示例3: JmeGeometry

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
public JmeGeometry(Geometry spatial, JmeSpatialChildren children) {
    super(spatial, children);
    getLookupContents().add(spatial);
    this.geom = spatial;
    java.awt.EventQueue.invokeLater(new Runnable() {

        public void run() {
            try {
                SceneExplorerTopComponent.findInstance().addMaterialChangeListener(JmeGeometry.this);

            } catch (Exception e) {
                Exceptions.printStackTrace(e);
            }
        }
    });

}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:18,代碼來源:JmeGeometry.java

示例4: destroy

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void destroy() throws IOException {
    super.destroy();
    java.awt.EventQueue.invokeLater(new Runnable() {

        public void run() {
            try {
                SceneExplorerTopComponent.findInstance().removeMaterialChangeListener(JmeGeometry.this);

            } catch (Exception e) {
                Exceptions.printStackTrace(e);
            }
        }
    });

}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:17,代碼來源:JmeGeometry.java

示例5: propertyChange

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void propertyChange(String type, String name, final Object before, final Object after) {
    super.propertyChange(type, name, before, after);        
    if (name.equals("Material")) {           
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    String beforeName = (before == null)? null : ((Material) before).getAssetName();
                    String afterName = (after == null)? null : ((Material) after).getAssetName();
                    SceneExplorerTopComponent.findInstance().swapMaterialChangeListener(JmeGeometry.this, beforeName, afterName);
                } catch (Exception e) {
                    Exceptions.printStackTrace(e);
                }
            }
        });


    }
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:21,代碼來源:JmeGeometry.java

示例6: getAddAction

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
/**
 * This is the Add Waypoint Action. It resides in this Popup Class, however
 * it's not added to the Debug Shapes Popup. Instead it is added as a seperate action
 * @return 
 */
public AbstractAction getAddAction() {
    return new AbstractAction("Add Waypoint") {
        @Override
        public void actionPerformed(ActionEvent e) {
            Vector3f pos;
            
            SceneToolController controller = SceneApplication.getApplication().getStateManager().getState(SceneToolController.class);
            if (controller != null && (!controller.getCursorLocation().equals(Vector3f.ZERO))) { // Vector3f.ZERO means not yet clicked
                pos = controller.getCursorLocation().clone().addLocal(0, jmeMotionPath.getDebugBoxExtents() * 3f, 0); // Shifting up so a) Netbeans isn't merging Waypoints and b) it's visible
            } else {
                AbstractSceneExplorerNode node = SceneExplorerTopComponent.findInstance().getLastSelected();
                if (node instanceof JmeVector3f) { // null instanceof JmeVector3f == false
                    pos = ((JmeVector3f)node).getVector3f().clone().addLocal(0, jmeMotionPath.getDebugBoxExtents() * 3f, 0);
                } else {
                    pos = new Vector3f(0f, 1.0f, 0f); // Default is a bit over the Center
                }
            }
            
            JmeVector3fChildren children = (JmeVector3fChildren)jmeMotionPath.getChildren();
            JmeVector3f jme = new JmeVector3f(children, jmeMotionPath, pos);
            children.add(new Node[] {jme});
            jmeMotionPath.refreshChildren();
        }
    };
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:31,代碼來源:MotionPathPopup.java

示例7: JmeGeometry

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
public JmeGeometry(Geometry spatial, JmeSpatialChildren children) {
    super(spatial, children);
    getLookupContents().add(spatial);
    this.geom = spatial;
    java.awt.EventQueue.invokeLater(new Runnable() {

        public void run() {
            try {
                SceneExplorerTopComponent.findInstance().addMaterialChangeListener(JmeGeometry.this);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

    setName(spatial.getName());
}
 
開發者ID:chototsu,項目名稱:MikuMikuStudio,代碼行數:19,代碼來源:JmeGeometry.java

示例8: destroy

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void destroy() throws IOException {
    super.destroy();
    java.awt.EventQueue.invokeLater(new Runnable() {

        public void run() {
            try {
                SceneExplorerTopComponent.findInstance().removeMaterialChangeListener(JmeGeometry.this);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

}
 
開發者ID:chototsu,項目名稱:MikuMikuStudio,代碼行數:17,代碼來源:JmeGeometry.java

示例9: propertyChange

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void propertyChange(String name, final Object before, final Object after) {
    super.propertyChange(name, before, after);
      System.out.println(name);
    if (name.equals("Material")) {
        System.out.println(before.toString()+" "+after.toString());
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    SceneExplorerTopComponent.findInstance().swapMaterialChangeListener(JmeGeometry.this, ((Material) before).getAssetName(), ((Material) after).getAssetName());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });


    }
}
 
開發者ID:chototsu,項目名稱:MikuMikuStudio,代碼行數:21,代碼來源:JmeGeometry.java

示例10: componentClosed

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void componentClosed() {
    materialPreviewWidget1.cleanUp();
    for (int i = 0; i < texturePanel.getComponentCount(); i++) {
        Component c = texturePanel.getComponent(i);
        if (c instanceof MaterialPropertyWidget) {
            ((MaterialPropertyWidget) c).cleanUp();
        }
    }

    clearMaterialChangeListeners();
    SceneExplorerTopComponent.getDefault().removeMaterialChangeProvider(this);

}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:15,代碼來源:MaterialEditorTopComponent.java

示例11: setAsText

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
public void setAsText(final String text) throws IllegalArgumentException {
    if ("create j3m file".equals(text)) {
        try {
            Node geom = SceneExplorerTopComponent.findInstance().getLastSelected();
            assert (geom != null);
            ProjectAssetManager pm = geom.getLookup().lookup(ProjectAssetManager.class);
            assert (pm != null);
            DataObject obj = geom.getLookup().lookup(DataObject.class);
            assert (obj != null);
            FileObject currentFile = obj.getPrimaryFile();
            FileObject currentFolder = pm.getAssetFolder().getFileObject("Materials/Generated");
            if (currentFolder == null) {
                currentFolder = FileUtil.createFolder(pm.getAssetFolder(), "Materials/Generated");
            }
            int i = 0;
            String newFileName = currentFile.getName() + "-" + sanitizeFileName(geom.getName());
            FileObject newFile = currentFolder.getFileObject(newFileName, "j3m");
            while (newFile != null) {
                i++;
                newFileName = currentFile.getName() + "-" + sanitizeFileName(geom.getName()) + "-" + i;
                newFile = currentFolder.getFileObject(newFileName, "j3m");
            }
            newFile = currentFolder.createData(newFileName, "j3m");
            EditableMaterialFile properties = new EditableMaterialFile(newFile, pm);
            material.setKey(new MaterialKey(pm.getRelativeAssetPath(newFile.getPath())));
            properties.setAsMaterial(material);
            currentFolder.refresh();
            applyMaterial(material.getAssetName());
        } catch (Exception ex) {

            Exceptions.printStackTrace(ex);
            return;
        }
    } else {
        applyMaterial(text);
    }
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:38,代碼來源:MaterialPropertyEditor.java

示例12: duplicateSelected

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
private void duplicateSelected() {
    Spatial selected = toolController.getSelectedSpatial();
    if (selected == null) {
        return;
    }
    Spatial clone = selected.clone();
    clone.move(1, 0, 1);

    selected.getParent().attachChild(clone);
    actionPerformed(new DuplicateUndo(clone, selected.getParent()));
    selected = clone;
    final Spatial cloned = clone;
    final JmeNode rootNode = toolController.getRootNode();
    refreshSelected(rootNode, selected.getParent());

    java.awt.EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            if (cloned != null) {
                SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{rootNode.getChild(cloned)});
                SceneExplorerTopComponent.findInstance().setSelectedNode(rootNode.getChild(cloned));
            }
        }
    });

    // set to automatically 'grab'/'translate' the new cloned model
    toolController.updateSelection(selected);
    currentState = State.translate;
    currentAxis = Vector3f.UNIT_XYZ;
}
 
開發者ID:maany,項目名稱:jME-CinematicEditor,代碼行數:32,代碼來源:SelectTool.java

示例13: selectSpatial

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
private void selectSpatial(JmeNode spatial) {
    if(editorController!=null)
        editorController.setSelectedSpat(spatial);
    if(spatial==null) {
        setSelectedObjectText(null);
        return;
    } else{
        if(toolController!=null) {
            toolController.setSelectedSpatial(spatial);
            toolController.updateSelection(spatial.getLookup().lookup(Spatial.class));
        }
    }
    SceneViewerTopComponent.findInstance().setActivatedNodes(new org.openide.nodes.Node[]{spatial});
    SceneExplorerTopComponent.findInstance().setSelectedNode(spatial);
}
 
開發者ID:maany,項目名稱:jME-CinematicEditor,代碼行數:16,代碼來源:CinematicEditorTopComponent.java

示例14: setAsText

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
public void setAsText(final String text) throws IllegalArgumentException {
    if ("create j3m file".equals(text)) {            
        try {
            AbstractSceneExplorerNode geom = SceneExplorerTopComponent.findInstance().getLastSelected();
            assert (geom != null);
            ProjectAssetManager pm = geom.getLookup().lookup(ProjectAssetManager.class);
            assert (pm != null);
            DataObject obj = geom.getLookup().lookup(DataObject.class);
            assert (obj != null);
            FileObject currentFile = obj.getPrimaryFile();
            FileObject currentFolder = currentFile.getParent();

            int i = 0;
            String newFileName = currentFile.getName() + "-" + geom.getName();
            FileObject newFile = currentFolder.getFileObject(newFileName, "j3m");
            while (newFile != null) {
                i++;
                newFileName = currentFile.getName() + "-" + geom.getName() + "-" + i;
                newFile = currentFolder.getFileObject(newFileName, "j3m");
            }
            newFile = currentFolder.createData(newFileName, "j3m");
            EditableMaterialFile properties = new EditableMaterialFile(newFile, pm);
            material.setKey(new MaterialKey(pm.getRelativeAssetPath(newFile.getPath())));
            properties.setAsMaterial(material);
            currentFolder.refresh();
            applyMaterial(material.getAssetName());
        } catch (Exception ex) {

            Exceptions.printStackTrace(ex);
            return;
        }
    } else {
        applyMaterial(text);
    }
}
 
開發者ID:chototsu,項目名稱:MikuMikuStudio,代碼行數:36,代碼來源:MaterialPropertyEditor.java

示例15: componentOpened

import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent; //導入依賴的package包/類
@Override
public void componentOpened() {
    SceneExplorerTopComponent.getDefault().addMaterialChangeProvider(this);
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:5,代碼來源:MaterialEditorTopComponent.java


注:本文中的com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。