[Bf-cycles] XML API proposal - objects and mesh instances

Nathan Letwory nathan at mcneel.com
Thu Mar 17 09:46:15 CET 2016


I have been improving the XML API somewhat in my CCSycles project. I've
added in my own XML parsing implementation a way to essentially do mesh
instancing.

In Cycles stand-alone XML implementation the <mesh> tag also results in
the creation of an object, but it'd be better if mesh and object
creation were separated.

I propose that the <mesh> tag only creates meshes, and that we introduce
the <object> tag that can reference then <mesh>es.

For this to work I propose <mesh> gets a new attribute 'name'. The
<object> tag takes a 'mesh' attribute that should have a value that was
introduced by a <mesh> with a 'name'.

Example:

<shader name="plane">
	<diffuse_bsdf name="cube_closure" roughness="0.0" color="0.8 0.8 0.8" />
	<connect from="cube_closure bsdf" to="output surface" />
</shader

<state interpolation="smooth" shader="plane">
	<mesh name="groundplane" P="1.0 1.0 0.0 -1.0 1.0 0.0 -1.0 -1.0 0.0 1.0
-1.0 0.0" nverts="4" verts="0 1 2 3" />
</state>

<transform translate="0 0 0" scale="1000 1000 0">
	<object mesh="groundplane" />
</transform>

End example.

For a larger example see
https://github.com/jesterKing/CCSycles/blob/master/tests/scene_many_cubes.xml

Now, I know that some want to move away from XML, but at this point I'd
prefer the Cycles file format stay in XML, since there is already a
wealth of tools out there that help with authoring XML, it is easy to
parse and transport.

That said, I'm not much interested in writing the C code to do this
myself - my parser is in C# and will stay like that. But perhaps this
could be part of someones GSoC efforts.

Cheers,

/Nathan



-- 
Nathan Letwory

Integrating Cycles into Rhino 3D

https://github.com/jesterKing/CCSycles
https://github.com/mcneel/RhinoCycles

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
Url : http://lists.blender.org/pipermail/bf-cycles/attachments/20160317/442217b3/attachment.pgp 


More information about the Bf-cycles mailing list