- Add "GET" method to Caps
- New events: ObjectPhysicsDataEvent, ParcelPropertiesEvent, NewObjectEvent, ObjectUpdateEvent, ObjectKilledEvent - Added getXML function to Color4, Vector2, Vector3, Vector4, GameObject, Region, Quaternion, UUID for opensim-compatible XML export - Added TextureAnim and ParticleSystem decoding to the "full" ObjectStore - Object store will automatically request missing "parent" prims - "setPersist" - When persist is TRUE, the ObjectStore will not forget about "killed" prims - useful for region scanning - Support for Flexible params, Light params, LightImage params, Mesh data, Sculpt maps - Fixed object scale being incorrectly calculated - Add terrain decoding (this was a ballache) - Add parcel map decoding - Add support for region windlight settings (region.environment) - Add support for materials (normal / specular maps) - Add getBuffer, getLong and bitwiseOr to UUID - Added a circular-reference-safe JSONStringify to Utils - Add XferFile capability to Circuit PUBLIC API: AssetCommands: - Rework "downloadAsset" to detect failures - NEW: downloadInventoryAsset() - uses TransferRequest for prim inventory items - NEW: getMaterials() - resolves material UUIDs RegionCommands: - NEW: getTerrainTextures() - NEW: exportSettings() - OpenSim XML export of region settings - NEW: async getTerrain() - Get binary terrain heightmap, 256x256 float32 - resolveObjects() - now fetches task inventory contents too. - resolveObjects() - fix calculation of land impact - NEW: getObjectByLocalID(localID: number, timeout: number) - NEW: getObjectByUUID(uuid: UUID, timeout: number) - NEW: getParcels(); - NEW: pruneObjects - removes missing GameObjects from a list - NEW: setPersist - prevent objectstore from forgetting about killed gameobjects
This commit is contained in:
@@ -189,6 +189,28 @@ export class Caps
|
||||
});
|
||||
}
|
||||
|
||||
requestGet(url: string): Promise<string>
|
||||
{
|
||||
return new Promise<string>((resolve, reject) =>
|
||||
{
|
||||
request({
|
||||
'uri': url,
|
||||
'rejectUnauthorized': false,
|
||||
'method': 'GET'
|
||||
}, (err, res, body) =>
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
reject(err);
|
||||
}
|
||||
else
|
||||
{
|
||||
resolve(body);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
waitForSeedCapability(): Promise<void>
|
||||
{
|
||||
return new Promise((resolve, reject) =>
|
||||
@@ -246,13 +268,54 @@ export class Caps
|
||||
});
|
||||
}
|
||||
|
||||
capsRequestXML(capability: string, data: any): Promise<any>
|
||||
capsGetXML(capability: string): Promise<any>
|
||||
{
|
||||
return new Promise<any>((resolve, reject) =>
|
||||
{
|
||||
this.getCapability(capability).then((url) =>
|
||||
{
|
||||
this.request(url, LLSD.LLSD.formatXML(data), 'application/llsd+xml').then((body: string) =>
|
||||
this.requestGet(url).then((body: string) =>
|
||||
{
|
||||
let result: any = null;
|
||||
try
|
||||
{
|
||||
result = LLSD.LLSD.parseXML(body);
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
console.error('Error parsing LLSD');
|
||||
console.error(body);
|
||||
reject(err);
|
||||
}
|
||||
resolve(result);
|
||||
}).catch((err) =>
|
||||
{
|
||||
console.error(err);
|
||||
reject(err);
|
||||
});
|
||||
}).catch((err) =>
|
||||
{
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
capsRequestXML(capability: string, data: any, debug = false): Promise<any>
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
console.log(data);
|
||||
}
|
||||
return new Promise<any>((resolve, reject) =>
|
||||
{
|
||||
this.getCapability(capability).then((url) =>
|
||||
{
|
||||
const xml = LLSD.LLSD.formatXML(data);
|
||||
if (debug)
|
||||
{
|
||||
console.log(xml);
|
||||
}
|
||||
this.request(url, xml, 'application/llsd+xml').then((body: string) =>
|
||||
{
|
||||
let result: any = null;
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user