- Mesh upload support
- LLMesh asset decoding and encoding (inc. LLPhysicsConvex, LLSkin, LLSubMesh) - Query inventory folder by type - onSelectedObject event - fetchInventoryItem command - Fix packing/unpacking of object shape - Time sync with SimulatorViewerTimeMessage - Changed several classes to a .from style rather than setting up in the constructor (exception friendly) - Whole bunch of other improvements - Object building
This commit is contained in:
@@ -299,101 +299,7 @@ async function connect()
|
||||
new nmv.Vector3([-1.0, 0, 0]),
|
||||
new nmv.Vector3([0.0, 1.0, 0]));
|
||||
|
||||
let foundObjects = {};
|
||||
|
||||
const getAllChildren = function(obj)
|
||||
{
|
||||
let children = obj.children;
|
||||
let newChildren = [obj]
|
||||
;
|
||||
for (const child of children)
|
||||
{
|
||||
newChildren = newChildren.concat(getAllChildren(child));
|
||||
}
|
||||
return children.concat(newChildren);
|
||||
};
|
||||
|
||||
const scan = setInterval(async () => {
|
||||
const count = bot.clientCommands.region.countObjects();
|
||||
if (count > lastObjects)
|
||||
{
|
||||
console.log(count + ' objects found.');
|
||||
lastObjects = count;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (height > 4096)
|
||||
{
|
||||
if (Object.keys(foundObjects).length > lastObjects)
|
||||
{
|
||||
const index = {};
|
||||
console.log('Indexing found objects');
|
||||
for(const o of foundObjects)
|
||||
{
|
||||
index[o.FullID.toString()] = true;
|
||||
}
|
||||
console.log('Searching for missing objects');
|
||||
for(const k of Object.keys(foundObjects))
|
||||
{
|
||||
if (index[k] === undefined)
|
||||
{
|
||||
console.log('Object missing: ' + k);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('Finished scanning region! ' + lastObjects + ' objects found. Resolving all objects..');
|
||||
clearInterval(scan);
|
||||
// Query all objects in the region
|
||||
var tmr = new Date().getTime();
|
||||
const objs = await bot.clientCommands.region.getAllObjects(true);
|
||||
var tmr2 = new Date().getTime();
|
||||
|
||||
let totalObjects = 0;
|
||||
let totalLandImpact = 0;
|
||||
|
||||
for (const obj of objs)
|
||||
{
|
||||
totalObjects += (1 + obj.totalChildren);
|
||||
if (obj.landImpact)
|
||||
{
|
||||
totalLandImpact += obj.landImpact;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Found ' + objs.length + ' linksets with ' + totalObjects + ' objects in ' + (tmr2 - tmr) + 'ms. Land impact: ' + totalLandImpact);
|
||||
|
||||
let searchResults = await bot.clientCommands.region.findObjectsByName('FINDME-*');
|
||||
console.log('Found ' + searchResults.length + ' objects containing the string FINDME-*');
|
||||
for (const obj of searchResults)
|
||||
{
|
||||
console.log('Object: ' + obj.name + ', ' + obj.FullID.toString() + ', position: ' + obj.Position.toString() + ', land impact: ' + obj.landImpact)
|
||||
}
|
||||
|
||||
searchResults = await bot.clientCommands.region.findObjectsByName('rezcubes');
|
||||
console.log('Found ' + searchResults.length + ' objects containing the string rezcubes');
|
||||
for (const obj of searchResults)
|
||||
{
|
||||
console.log('Object: ' + obj.name + ', ' + obj.FullID.toString() + ', position: ' + obj.Position.toString() + ', land impact: ' + obj.landImpact)
|
||||
for (const k of Object.keys(obj.NameValue))
|
||||
{
|
||||
console.log(k + ': ' + obj.NameValue[k])
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Moving to ' + height);
|
||||
height += 128;
|
||||
bot.clientCommands.agent.setCamera(
|
||||
new nmv.Vector3([128, 128, height]),
|
||||
new nmv.Vector3([128, 128, 0]),
|
||||
5000,
|
||||
new nmv.Vector3([-1.0, 0, 0]),
|
||||
new nmv.Vector3([0.0, 1.0, 0]));
|
||||
}
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
|
||||
|
||||
//await bot.clientCommands.friends.grantFriendRights('d1cd5b71-6209-4595-9bf0-771bf689ce00', nmv.RightsFlags.CanModifyObjects | nmv.RightsFlags.CanSeeOnline | nmv.RightsFlags.CanSeeOnMap );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user