Hi Carsten,
Carsten Neumann wrote:
> [cc'ing the core list, as there is an underlying issue in the system]
Yup. Has been known for a while, but has never shown up as a problem. Ah well,
had to happen at some point. ;)
> Please find attached a slightly modified file that works for me.
> The problem is actually quite easy, but admittedly hard to find and
> somewhat surprising. I'm not sure if it is feasible to remove this
> source of surprise.
> Anyways, here is the problem:
> The Transformation cores in your scene are actually ComponentTransforms,
> that derive from Transform, but internally store individual
> transformations instead of just a matrix.
> When you set the matrix, with this line:
>
> TransformPtr parent_xform = TransformPtr::dcast(parentPtr->getCore());
> beginEditCP(parent_xform);
> parent_xform->setMatrix(worldMatrix);
> endEditCP(parent_xform);
> The update function of ComponentTransform runs and since no field mask
> is explicitly given, the assumption is that all fields have changed.
> Therefore the update function of ComponentTransform recomputes the
> matrix from the individual components (which are really unchanged) and
> overwrites the matrix you just set.
> To prevent this, change the begin/endEditCP calls to contain the field
> mask of the fields that you really edit, i.e.:
>
> beginEditCP(parent_xfrom, Transform::MatrixFieldMask);
> parent_xform->setMatrix(worldMatrix);
> endEditCP(parent_xfrom, Transform::MatrixFieldMask);
>
Hm, that's a problem. Honestly I think the only solution is to not derive
ComponentTransform from Transform, which is not very intuitive, but otherwise
you will always hae the problem that people will try to set the Transform
manually, which CT doesn't handle gracefully.
Other ideas?
Dirk
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core