Open ghost opened 11 years ago
This problem still applies to 4.5. I can access and manipulate all data elements via xflow, but I have not yet found a way to do something similar with the transform element. Any advice?
Hi,
the convenience function that you describe above would only work for internal resources, because external resources can be of any format and what would be the result then? So I'd prefer to stick to the getElementById solution.
I can access and manipulate all data elements via xflow, but I have not yet found a way to do something similar with the transform element.
What exactly do you want to do? You can reference a data node with float4x4 result named "transform" as a transformation.
I just want to be able to transform certain meshes without the need to create a new transform element, ideally by manipulating the data that is already referenced by the mesh, eg:
<group id="object" transform="#t_object">
<group id="object_part1" transform="external.xml#t_object_part1">
<mesh type="triangles">
<data src="external.xml#mesh_object_part1"/>
</mesh>
</group>
[...]
</group>
If I now want to change the transform for the object_part1
mesh I'd have to be able to access its transform. Since it is in an external file I obviously can't get it by using getElementById. It would be nice to access this transform directly using XML3D (which obviously has to have a copy of it stored in some form somewhere).
As mentioned above I could wrap the mesh in yet another group element with a local transform (which I then would be able to access), but this seems unneccessarily complex, chaining several transforms. I also tried using the <float4x4 name="transform">
solution you suggested, but neither adding it directly into the mesh data element nor creating a new data element and then referencing it using <data src=".."/>
alongside the already existing data element seems to work.
As I said in my first post, it would be nice to just be able to do something like this:
var group = document.getElementById('object_part1');
group.transform.rotation.angle = 1.57
But currently transform only contains the reference string external.xml#t_object_part1
, which is pretty useless to me unless I'd want to change it to reference another already existing transform element.
It would be nice to be able to call something like
group.getTransform()
or maybe even simplergroup.transform
to be able to manipulate the referenced element. This also applies to all other referenced elements such asshader
ordata
for all elements that reference these.Usually this can be done by simply removing the # in front of the reference and do a
document.getElementById
but this gets increasingly difficult with external resources, especially if those are not in xml format. Having an interface provided by xml3d.js would remedy this problem.