Results 1 to 4 of 4

Thread: using .Net to implement Collada tools

  1. #1
    Junior Member
    Join Date
    May 2005
    Location
    Seattle, WA
    Posts
    2

    using .Net to implement Collada tools

    Hello,

    I just started to write a tool for translating Collada
    files using .Net with C#. So far so good.

    (Maya)->Collada XML->ColladaTrans->(PSP Text Format)GMS

    I'm currently using Visual Studio .Net but the C# code
    should be portable to the opensource implementation
    of .Net (http://www.mono-project.com/Main_Page)

    I'll post more info as I go along.

    -Joseph

    --

    blog: http://spaces.msn.com/members/bytewave/

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    Santa Clara
    Posts
    356
    You should have no problem, this is a very good approach.
    I have seen other COLLADA projects using this approach successfully.
    No need for the COLLADA API in C#

    -- Remi

  3. #3
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771
    I have noticed that .NET 2003 code generation from XML schema is limited and can't process the COLLADA schema. .NET 2005 Beta2 handles it well though. Also XMLSPY 2005 works too.

  4. #4
    Junior Member
    Join Date
    May 2005
    Location
    Seattle, WA
    Posts
    2
    Thanks for the heads-up. I'm actually just using XmlTextReader class to populate a TreeView for now. But I'll be using the XmlDocument class for actual processing.

    Here's a code snippet that might be helpful...

    Code :
    if( openColladaFileDialog.ShowDialog() == DialogResult.OK )
    {
       // open xml document
       //   parse xml document
       //   store node data inside tree view
       //     -- use a Stack to keep track of the depth in the TreeView
     
       Stack nodeCollectionStack = new Stack();
       System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(openColladaFileDialog.FileName);
       System.Windows.Forms.TreeNodeCollection curNodes = xmlTreeView.Nodes;
     
       xmlTreeView.BeginUpdate();
       curNodes.Clear();
     
       statusBar.Text = "Parsing " + openColladaFileDialog.FileName;
     
       curNodes.Add(new TreeNode(openColladaFileDialog.FileName));
     
       nodeCollectionStack.Push(curNodes);
     
       curNodes = curNodes[curNodes.Count-1].Nodes;
     
       while (reader.Read())
       {
            bool emptyElement = reader.IsEmptyElement;
     
    	switch (reader.NodeType)
    	{
    	     case System.Xml.XmlNodeType.Element: 
    		  curNodes.Add(new TreeNode(reader.Name));	
    		  nodeCollectionStack.Push(curNodes);
    		  curNodes = curNodes[curNodes.Count-1].Nodes;
    		  while (reader.MoveToNextAttribute()) 
    		  {
    		        curNodes.Add(new TreeNode(reader.Name + " = " + reader.Value));
    		   }
    		  if( emptyElement )
    	          {
    		       curNodes = (System.Windows.Forms.TreeNodeCollection) nodeCollectionStack.Pop();
    		  }
    		  break;
    	    case System.Xml.XmlNodeType.EndElement: 
    		curNodes = (System.Windows.Forms.TreeNodeCollection) nodeCollectionStack.Pop();
    		 break;
         }
      }
     
      // Begin repainting the TreeView.
      xmlTreeView.EndUpdate();
      statusBar.Text = "Done " + openColladaFileDialog.FileName;
      reader.Close();
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •