Khronos Public Bugzilla
Bug 88 - a new "targetable_bool_type" would remove some replicated code.
a new "targetable_bool_type" would remove some replicated code.
Status: NEW
Product: COLLADA
Classification: Unclassified
Component: Schema
1.5.0
PC Windows
: P3 enhancement
: ---
Assigned To: Fabrice Robinet
COLLADA Work Group email alias
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-01 08:42 PDT by Dan Bartlett
Modified: 2014-01-07 10:23 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Bartlett 2008-09-01 08:42:28 PDT
If a new "targetable_bool_type" was added (or "targetable_boolean_type"), some parts of the schema that are replicated could be removed, and also result in fewer classes generated.

The new type would look like (copy-paste of targetable_float_type):

<xs:complexType name="targetable_bool_type">
 <xs:annotation>
  <xs:documentation>
   The targetable_bool_type element is used to represent elements which contain a single bool value which can be targeted for animation.
  </xs:documentation>
 </xs:annotation>
 <xs:simpleContent>
  <xs:extension base="xs:boolean">  //---no bool_type?----
   <xs:attribute name="sid" type="sid_type">
    <xs:annotation>
     <xs:documentation>
      The sid attribute is a text string value containing the sub-identifier of this element. This value must be unique within the scope of the parent element. Optional attribute.
     </xs:documentation>
    </xs:annotation>
   </xs:attribute>
  </xs:extension>
 </xs:simpleContent>
</xs:complexType>

The places that could be improved by using this are:

1) rigid_constraint_type/technique_common/enabled
2) rigid_constraint_type/technique_common/interpenetrate
3) rigid_body_type/technique_common/dynamic
4) rigid_body_type/technique_common/shape/hollow
5) instance_rigid_body_type/technique_common/dynamic
6) instance_rigid_body_type/technique_common/shape/hollow

since they are all in this form: <dynamic sid="...">false</dynamic> with an optional sid attribute.

The following replicated definition could be removed from (1)to(6):

<xs:complexType>
  <xs:simpleContent>
   <xs:extension base="xs:boolean">
    <xs:attribute name="sid" type="sid_type">
     <xs:annotation>
      <xs:documentation>
       The sid attribute is a text string value containing the sub-identifier of this element. 
       This value must be unique within the scope of the parent element. Optional attribute.
      </xs:documentation>
     </xs:annotation>
    </xs:attribute>
   </xs:extension>
  </xs:simpleContent>
 </xs:complexType>


The updated definitions would then look something like this: 

//--------(1) rigid_constraint_type/technique_common-------------
<xs:element name="enabled" type="targetable_bool_type" default="true" minOccurs="0">
 <xs:annotation>
  <xs:documentation>
   If false, the constraint doesn't exert any force or influence on the rigid bodies.
  </xs:documentation>
 </xs:annotation>
</xs:element>

//-------- (2) rigid_constraint_type/technique_common-------------
<xs:element name="interpenetrate" type="targetable_bool_type" default="false" minOccurs="0">
 <xs:annotation>
  <xs:documentation>
   Indicates whether the attached rigid bodies may inter-penetrate.
  </xs:documentation>
 </xs:annotation>
</xs:element>

//--------- (3) rigid_body_type / technique_common-----------
<xs:element name="dynamic" type="targetable_bool_type" minOccurs="0">
 <xs:annotation>
  <xs:documentation>
   If false, the rigid_body is not moveable
  </xs:documentation>
 </xs:annotation>
</xs:element>

//------ (4) rigid_body_type/technique_common/shape----------
<xs:element name="hollow" type="targetable_bool_type" minOccurs="0">
 <xs:annotation>
  <xs:documentation>
   If true, the mass is distributed along the surface of the shape
  </xs:documentation>
 </xs:annotation>
</xs:element>

//----- (5) instance_rigid_body_type/technique_common----------
<xs:element name="dynamic" type="targetable_bool_type" default="true" minOccurs="0"/>

//----- (6) instance_rigid_body_type/technique_common/shape--------
<xs:element name="hollow" type="targetable_bool_type" minOccurs="0"/>


The 3 without default values (3,4 & 6) might need default values added too?