Here are a few comments about how Sketchlife works.
Sketchlife would not have been possible without the comprehensive and easy-to-use API that SketchUp provides.
The prims are normal SketchUp Group objects, which could have also been created manually, using the keyboard and the mouse. Groups must adhere to a very tight set of specifications to be classified valid Sketchlife prims.
The Select-All button and the Filter Selection button are both based on a test which determines whether a prim is valid or not. This system is not completely watertight, but it is good enough to ensure that prims would not be made unexportable by accident on the part of the user.
A good consequence of this approach is that SketchUp files containing Sketchlife prims could be saved, loaded, sent, safely. Being bundles of standard SketchUp Groups, Edges and Faces, there are no other data that are needed to make a valid prim.
Texture mapping in SketchUp is more general than in Second Life. Second Life has texture mapping which could be called rectangular. The U and V axes are always orthogonal, although may have differing scale factors. Sketchlife-imported prims have planar mapping on all the flat faces, which is most compatible with SketchUp. Planar texture mapping is projected onto the prim face after tapering, shearing, scaling, and otherwise defining the shape, whereas default texture mapping seems to first apply the texture to the base prim, and deform it with the prim as it undergoes tapering, shearing and scaling transformations. This results in, for example, the flat side-faces of a tapered and sheared box prim, to be split into two triangular regions with two distinct texture maps (though they are adjacent and in one plane). At the same time, there is only one set of parameters we can control for these two triangles. For these reasons we are very fortunate to have planar texture mapping available.
Curved surfaces must still use default texture mapping, and, in general, this means that we would have to mimic Second Life's model in SketchUp, in which case we would be better off writing our own set of texture positioning tools. In architecture, however, curved surfaces would be used for columns mostly, so we only needed to get the texture scaling parameters right, and to make sure that it is the right way up on vertical cylinders. This is about as much as can be relied on, for curved surfaces.
Linden Scripting Language is nice to work with, but it takes a long time to do anything, so the Sketchlife Importer does the minimal amount of work that is required of its role. Its script interact with the owner, instantiate the right number of base primitives, each of which contains another script. This other script parses commands in a simple format, which maps directly to llSetPrimitiveParams(..) function calls. Also, the primitives talk to each other to arrange linking.
Conversion of data from the format output by the SketchUp plugin, to the format expected by the Sketchlife Importer, is done on the server. It is the entity to which both of the other ones talk, since it has a known address. The SketchUp plugin also talks to the Sketchlife Importer manually — by asking the user to copy and paste a string at two instances in the upload process. This completes the triangle, and it is also the impulse for the Sketchlife Importer to initiate conversations with the server.
Evgeni Sergeev
Tuesday 07 July 2009 22:37 (Western Australia Standard Time)