From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Learning the basics of COLLADA

May 8th

In COLLADA, primitives can be presented in 2 forms: polygons as <polygons> and <polylist> and triangles as <triangles> <trifans> and <tristrips>. Ignoring line primitives for now.

Since Blender allows only quadrilaterals and triangles, I will need to find out how to convert polygons to triangles or quads or a combination of these.

In case vertex normals are missing in a COLLADA file, they should be generated.

In COLLADA all coordinates are right-handed by definition - this is good since Blender uses right-handed too :-).

May 12th

How to determine if a MFace is a quad or triangle? According to exotic.c, if a face is quad then face->v4 is non-zero.

Now I know how to use addvertlist, addfacelist functions - progress!

Arystan introduced me to operator basics and menus based on operators.

May 17th

COLLADA DOM

There are two ways to work with COLLADA DOM: dae* classes and dom* classes. dae* classes provide a generic string interface to data. dom* classes, in contrast, provide direct access to data, i.e. floats are stored as floats. Although dae* classes are easier to learn than dom* classes (there's only a single daeElement class vs. tens of dom* classes), to keep code compact and efficient, I'll use dom* classes as much as possible.

May 18th

Studying a few build systems that Blender uses: make and scons.

Build with make succeded, but only release and with a few hacks. Debug build failed. Maybe later.

Built with scons before, very easy. Documentation on how to add a new library/module is available in the source tree in doc/blender-scons-dev.txt. Thanks jesterKing!

May 24th

Studying OpenCollada.

May 25th

  • Coding environment prepared.
  • Added "Collada Export" menu, the code is in wm_operators.c for now.

May 27th

Studying OpenCollada. It differs strongly from Collada DOM.

May 30th

Order of elements inside <Collada> (doesn't matter?) borrowed from examples in collada spec:

  • asset
    • required tags: created, modified - create with StreamWriter::appendTextElement
    • up_axis(y up by default) - z up in Blender
  • library_visual_scenes
  • scene - is necessary for programs that allow only one scene
  • library_geometries
  • other

TODO:

  • don't forget unit measurement conversions
  • parenting

May 31st

Can not create <created> and <modified> with Asset class.

June 3d

prepareToAppendValues() calls another function prepareBaseToAppendValues() which creates the following

  • Invalid language.

    You need to specify a language like this: <source lang="html4strict">...</source>

    Supported languages for syntax highlighting:

    4cs, abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm, asp, autohotkey, autoit, avisynth, awk, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_mac, caddcl, cadlisp, cfdg, cfm, cil, clojure, cmake, cobol, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, fsharp, gambas, gdb, genero, gettext, glsl, gml, gnuplot, groovy, haskell, hq9plus, html4strict, idl, ini, inno, intercal, io, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lisp, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, mapbasic, matlab, mirc, mmix, modula3, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, ocaml, ocaml-brief, oobas, oracle11, oracle8, pascal, per, perl, perl6, php, php-brief, pic16, pike, pixelbender, plsql, povray, powerbuilder, powershell, progress, prolog, properties, providex, purebasic, python, qbasic, rails, rebol, reg, robots, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf, xpp, z80

with finish()

Now I know how to create <created> <modified>. It seems that add() method creates them automatically - cool =)

June 5th

Very basic geometry exporter is almost ready!
What is left:

  • add blender's api

June 9th

Texcoords(UVs?) should be stored in

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm, asp, autohotkey, autoit, avisynth, awk, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_mac, caddcl, cadlisp, cfdg, cfm, cil, clojure, cmake, cobol, cpp, cpp-qt, csharp, css, cuesheet, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, fsharp, gambas, gdb, genero, gettext, glsl, gml, gnuplot, groovy, haskell, hq9plus, html4strict, idl, ini, inno, intercal, io, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lisp, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, mapbasic, matlab, mirc, mmix, modula3, mpasm, mxml, mysql, newlisp, nsis, oberon2, objc, ocaml, ocaml-brief, oobas, oracle11, oracle8, pascal, per, perl, perl6, php, php-brief, pic16, pike, pixelbender, plsql, povray, powerbuilder, powershell, progress, prolog, properties, providex, purebasic, python, qbasic, rails, rebol, reg, robots, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf, xpp, z80