Another possible use for !FLOAT meta - Printable Version +- LDraw.org Discussion Forums (https://forums.ldraw.org) +-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html) +--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html) +--- Thread: Another possible use for !FLOAT meta (/thread-25098.html) |
Another possible use for !FLOAT meta - N. W. Perry - 2021-09-06 (For those not familiar, !FLOAT is my proposed, imaginary meta command that temporarily overrides the displayed position and other parameters of a part in an LDraw editor or BI maker. It is intended to replace older concepts like buffer exchange, which is confusing and requires extra copies of parts to be added to a model.) When building a model with lots of moving sections, like a Technic model, you probably build those sections as submodels or groups at orthogonal (90-degree) angles. Then when it's time to pose the model, you apply rotations to those groups or submodels. But what if you want to change the pose? Or just revert a section back to its unrotated state for some reason? At least with LDCad, you can't always just rotate the parts the same number of degrees in the opposite direction, because you'll get rounding errors in the matrix. If it's a submodel, of course you can always just reset the orientation. But then what if the unrotated state is non-orthogonal, like a piston rod or an angled link in the steering column? With !FLOAT, the idea is that you supply a temporary position/orientation in the meta command, which is what will be displayed until the command is canceled. The type 1 line for the part or submodel would always contain the final or "fixed" position, which is typically what will be displayed in the last step of the model (so you can "float" a part in the building instructions, e.g.). But if you supply a float position and just never cancel it, then it could actually be used as the position displayed in the finished model. The matrix in the type 1 line would then represent the default or unrotated position of the part, which could be an identity matrix, another orthogonal position, or a rotation of its own. You could then pose the model simply by adjusting the float position, without changing the default position and thus compounding rounding errors (or simply forgetting what that position is). The major drawback to this usage is that the fallback display (for any software that doesn't recognize !FLOAT) would be with everything in its unrotated state, rather than nicely posed. But I suppose a good editor could get around this by having an option to save a copy of the model with the float positions inlined. And in a way, the pose of a model is more a property of its display than of its construction. The actual parts of a model are immutable and so it makes sense for them to be hard-coded, but things like which way the steering wheel is turned are changeable, and so there's some logic to having that information stored at a meta level, in a way that's perhaps more interactive and portable. RE: Another possible use for !FLOAT meta - Roland Melkert - 2021-09-06 Funny this is actually, sort of, how animation works in LDCad. It pushes the current model matrix at playback start for all animated things on a stack and resets it every frame, mainly because I ran into major rounding problems otherwise I like your !FLOAT suggestion, but do you know LPUB3D is also working on a new buffer exchange replacement meta? It might be better to combine your efforts with them so we don't end up with a zillion different meta's doing the same things. RE: Another possible use for !FLOAT meta - N. W. Perry - 2021-09-07 (2021-09-06, 18:42)Roland Melkert Wrote: Funny this is actually, sort of, how animation works in LDCad. I had heard about that, actually. Biggest difference I notice is that the new LPUB meta doesn't do away with duplicate type 1 reference lines, so you don't get a failsafe fallback. But this could be as simple as adjusting the syntax of the meta so that the modified content isn't made up of "real" type 1 lines. (Similar to the way TEXMAP works with !:, I suppose.) |