So Melchior found what is either a bug or a feature. Here's the
background. I broke my model animation code into several separate xml
files that were serially included as a chain. In the last file I noticed
that the first 78 animations were being ignored (actually overwritten by
it's parent files). Then I asked for help. See Melchior's explanation
(attached). For now I will just use explicit numbering.

Perhaps the include="" parameter should be two different ones, merge=""
and append=""? While we are on the subject, I would also like to suggest
that it be possible to include more than one file from a parent file.
Perhaps what is called for is to have <merge> and <append> elements that
can be added inside an xml file an arbitrary number of times. The merge
element would use the current behavior, except allowing several files to
be merged in one spot instead of just one. The append element would do
the same, except instead of assuming that the implied index count starts
at zero at the beginning of the file, it would pick where the parent
left off.

The alternatives, individually numbering <animation> (or whatever)
elements  or lumping everything together in a tens of thousands of lines
of xml both make developing complicated models more difficult than it
has to be.

e.g.

<PropertyList include="foo.xml">
becomes:
<PropertyList>
  <merge>
    <filename>foo.xml</filename>
  </merge>
  <!-- followed by any number of additional merge or append elements -->
</PropertyList>

Also keep in mind that the xml parser will not accept the following
<PropertyList include="foo" include="bar">
leading to awkward chains of files each including only one child.

Josh

PS, Melchior just suggested an <import> element which would include a
file's contents at that particular spot. This alone would probably be a
suitable solution. I guess the imported file would not have to contain a
valid <PropertyList>, just a block of xml to be spliced into the file.
This seems to be a simpler.

--- Begin Message ---
* Melchior FRANZ -- Monday 04 December 2006 13:13:
> And I'm not sure yet if it's a bug or a feature [...]

I'm afraid it's an obscure feature. The "include" tag in

  <PropertyList include="foo.xml">

doesn't *add* that stuff, but it *merges* it! Because your
included <animation>s don't have explicit indices, the first
<animation> in each of the four *.xml files has implicit index=0,
and they are all thrown together. You get a nicety like this
for the first <animation>:

  <animation>
    <type>noshadow</type>
    <object-name>Cockpit</object-name>
    <property-base>sim/model/ch53e/materials/Warn.1antiice</property-base>
    <emission>
      <red-prop>emission/red</red-prop>
      <green-prop>emission/green</green-prop>
      <blue-prop>emission/blue</blue-prop>
    </emission>
    <property>/sim/model/ch53e/instrument-pos/ADFFreqDisp1</property>
    <factor>36</factor>
    <offset>0</offset>
    <axis>
      <x>0</x>
      <y>1</y>
      <z>0</z>
    </axis>
    <center>
      <x-m>4.045</x-m>
      <z-m>0.737</z-m>
    </center>
    <object-name n="1">FooRotor</object-name>
    <object-name n="2">FooTailRotor</object-name>
  </animation>

... which does, of course, not make a lot of sense. I doubt
that a "fix" for the XML loader would be very welcomed. The
right thing to make this work, is to assign explicit indices
in all include files (the top file doesn't need them):

in ch53e-body-anim.xml, for example:

  <animation n="1000">...</animation>
  <animation n="1001">...

The number is irrelevant, it just needs to be unique.
Or you put everything into the same file (as everybody
else does). Or you suggest an alternative "import" feature
on the devel list.

m.


--- End Message ---
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to