Minor modification.
This commit is contained in:
parent
965482825b
commit
9c487f48a3
@ -19,6 +19,7 @@ ImporterApp = function ()
|
|||||||
this.fileNames = null;
|
this.fileNames = null;
|
||||||
this.inGenerate = false;
|
this.inGenerate = false;
|
||||||
this.meshesGroup = null;
|
this.meshesGroup = null;
|
||||||
|
this.materialMenuItems = null;
|
||||||
this.meshMenuItems = null;
|
this.meshMenuItems = null;
|
||||||
this.extensions = [];
|
this.extensions = [];
|
||||||
this.importerButtons = null;
|
this.importerButtons = null;
|
||||||
@ -211,7 +212,7 @@ ImporterApp.prototype.GenerateMenu = function ()
|
|||||||
|
|
||||||
function AddMaterial (importerApp, importerMenu, materialsGroup, materialIndex, material)
|
function AddMaterial (importerApp, importerMenu, materialsGroup, materialIndex, material)
|
||||||
{
|
{
|
||||||
materialsGroup.AddSubItem (material.name, {
|
var materialMenuItem = materialsGroup.AddSubItem (material.name, {
|
||||||
openCloseButton : {
|
openCloseButton : {
|
||||||
title : 'Show/Hide Information',
|
title : 'Show/Hide Information',
|
||||||
onOpen : function (contentDiv, material) {
|
onOpen : function (contentDiv, material) {
|
||||||
@ -231,6 +232,7 @@ ImporterApp.prototype.GenerateMenu = function ()
|
|||||||
userData : material
|
userData : material
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return materialMenuItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddMesh (importerApp, importerMenu, meshesGroup, mesh, meshIndex)
|
function AddMesh (importerApp, importerMenu, meshesGroup, mesh, meshIndex)
|
||||||
@ -348,11 +350,13 @@ ImporterApp.prototype.GenerateMenu = function ()
|
|||||||
var infoGroup = AddDefaultGroup (importerMenu, 'Information', 'informationmenuitem');
|
var infoGroup = AddDefaultGroup (importerMenu, 'Information', 'informationmenuitem');
|
||||||
AddInformation (infoGroup, jsonData);
|
AddInformation (infoGroup, jsonData);
|
||||||
|
|
||||||
|
this.materialMenuItems = [];
|
||||||
var materialsGroup = AddDefaultGroup (importerMenu, 'Materials', 'materialsmenuitem');
|
var materialsGroup = AddDefaultGroup (importerMenu, 'Materials', 'materialsmenuitem');
|
||||||
var material;
|
var material, materialMenuItem;
|
||||||
for (i = 0; i < jsonData.materials.length; i++) {
|
for (i = 0; i < jsonData.materials.length; i++) {
|
||||||
material = jsonData.materials[i];
|
material = jsonData.materials[i];
|
||||||
AddMaterial (this, importerMenu, materialsGroup, i, material);
|
materialMenuItem = AddMaterial (this, importerMenu, materialsGroup, i, material);
|
||||||
|
this.materialMenuItems.push (materialMenuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.meshesGroup = AddDefaultGroup (importerMenu, 'Meshes', 'meshesmenuitem');
|
this.meshesGroup = AddDefaultGroup (importerMenu, 'Meshes', 'meshesmenuitem');
|
||||||
@ -622,20 +626,14 @@ ImporterApp.prototype.HighlightMesh = function (meshIndex)
|
|||||||
ImporterApp.prototype.HighlightMeshesByMaterial = function (materialIndex)
|
ImporterApp.prototype.HighlightMeshesByMaterial = function (materialIndex)
|
||||||
{
|
{
|
||||||
var meshIndices = this.viewer.GetMeshesByMaterial (materialIndex);
|
var meshIndices = this.viewer.GetMeshesByMaterial (materialIndex);
|
||||||
var i, meshIndex, menuItem;
|
var i, meshIndex, meshMenuItem;
|
||||||
|
|
||||||
for (i = 0; i < this.meshMenuItems.length; i++) {
|
this.HighlightMesh (-1);
|
||||||
menuItem = this.meshMenuItems[i];
|
|
||||||
if (menuItem.IsHighlighted ()) {
|
|
||||||
this.HighlightMeshInternal (i, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < meshIndices.length; i++) {
|
for (i = 0; i < meshIndices.length; i++) {
|
||||||
meshIndex = meshIndices[i];
|
meshIndex = meshIndices[i];
|
||||||
menuItem = this.meshMenuItems[meshIndex];
|
meshMenuItem = this.meshMenuItems[meshIndex];
|
||||||
this.HighlightMeshInternal (meshIndex, true);
|
this.HighlightMeshInternal (meshIndex, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.meshesGroup.SetOpen (true);
|
this.meshesGroup.SetOpen (true);
|
||||||
this.viewer.Draw ();
|
this.viewer.Draw ();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user