Game Development Community

dev|Pro Game Development Curriculum

add multiple animation clip(dsq/dae) through shape editor

by Ahsan Muzaheed · 08/30/2012 (11:51 am) · 3 comments

45 days vactation finished.now have to go back hostel.packing up everything.so no chance to check this last time fix in next 3/4 days.may be this one will also be left in my hdd for no use.
better posting it here.if u found any bug post here.


for my laziness i have added many small improvements/fixes to my t3d editor to make thinbgs quick and easy( for my own comfot).this one is part of them. few of them u can found in my only posted resource.
but most of them are scattered in 20/30 project folders(may be more).someday i will add them together.

ok.let's begin.
in shape editor u can add only 1 dsq file at once.but i have lots of dsq files.so i was trying to make my work more easy.
thanks to "guy allard"(http://www.garagegames.com/community/forums/viewthread/131483/1#comment-833048) for pointing out how openDialogue work with multipleFiles,


****************
open gui editor.

browse and open"tools\shapeEditor\gui\shapeEdPropWindow.ed.gui";

right click on "ShapeEdPropWindow";
uncheck hidden
***************************************************
select "GuiBitmapButtonCtrl[newBtn]";
copy and paste.
move to a suitable position.
now in it's command property paste "ShapeEdSequences.myonAddSequence();";
again hide "ShapeEdPropWindow".
save it.

or

open it("toolsshapeEditorguishapeEdPropWindow.ed.gui") with notpad.

search for "// Save/New/Delete buttons (node or sequence, depending on which tab is active)"
add this:
new GuiBitmapButtonCtrl() {//am
      internalName = "newDSQfiles";
      canSaveDynamicFields = "0";
      isContainer = "0";
      Profile = "GuiButtonProfile";
      HorizSizing = "left";
      VertSizing = "bottom";
      Position = "130 25";
      Extent = "17 17";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      Command = "ShapeEdSequences.myonAddSequence();";
      tooltipprofile = "GuiToolTipProfile";
      ToolTip = "";
      hovertime = "1000";
      groupNum = "0";
      buttonType = "PushButton";
      useMouseEvents = "0";
      bitmap = "core/art/gui/images/new";
   };//am


now at the end of file add this code:
function ShapeEdSequences::myonAddSequence( %this)
{
   %dlg = new OpenFileDialog()
	      {
			  Filters = "DSQ Files(*.dsq)|*.dsq|COLLADA Files|*.dae|Google Earth Files|*.kmz";
			  DefaultFile = ShapeEdFromMenu.lastPath;
			  ChangePath = false;
			  MustExist = true;
			  MultipleFiles = true;//false;
			  title="open Animation files(dae/dsq/kmz)";
	      };
		  
   %t=%dlg.Execute();

  if ( !%t )
  {
	MessageBoxOK("! !  !","eeeeeeeeeeeeeeeeeeeee");return;
  }
  else if ( %t )
  {
   
   for(%i=0; %i < %dlg.fileCount; %i++)
   {
     echo(%dlg.files[%i]);

	 %path = makeRelativePath( %dlg.files[%i], getMainDotCSDir() );//The path to the main game assets.Get the absolute path to the directory that contains the main.cs script from which the engine was started.
	 ShapeEdFromMenu.lastPath = %path;

	 %seqName = ShapeEditor.getUniqueName( "sequence", fileBase(%dlg.files[%i]) );
	 %start=0;
	 %end=-1;
	 %t = ShapeEditor.shape.addSequence( %path, %seqName, %start, %end );//Add a new sequence to the shape. true if successful, false otherwise
	 if ( %t )
	   %row = ShapeEdSequenceList.insertItem( %seqName, ShapeEdSequenceList.rowCount() );
	 else
	  MessageBoxOK( "Error", %action.actionName SPC "failed. Check the console for error messages.", "" );
	}//for
  }//if
		  
  $Tools::FileDialogs::LastFilePath = filePath( %dlg.FileName );
}

done.

load a model in shape editor.then click on button and add some sequence.



note:
i did not add code to add these changes in undo manager.so this sequence adding cannot be undone using undo or ctrl+z command.
will add later.


do not want to do any of these editing ?
ok.download this file(http://www.mediafire.com/?6ks3dtjzaj2hsej).
just replace it with your shapeEdPropWindow.ed.gui in "tools/shapeEditor/gui/"

have fun :)

About the author

Torque 3D enthusiastic since 2010.Have been working in several T3D projects besides of Unreal Engine 4 and Unity 3D. NEED a hand with your project? SHoot me a mail. http://www.garagegames.com/community/forums /viewthread/138437/


#1
09/05/2012 (12:53 pm)
Ahsan@ useful changes, I like that you have it loading all supported model types including google sketch-- add in the shortcut resource I made for saving the model and got a more complete solution there.

I spent lots of time importing/tweaking models and found it helpful to import the art, tweak a lot and save to a new model. Same could apply to adding your animations to the model ... save it when done and its all included in the newly made DST model.

But that exposed a few missing error checks that the Model editor needs ... or you will get a crash when you try to save it.
#2
09/05/2012 (1:27 pm)
"But that exposed a few missing error checks that the Model editor needs ... or you will get a crash when you try to save it."


several month ago i spend a whole day to save a model from shape editor.and failed every time.according to docs there is a function which do the saving part.and did not found any issue anywhere in forum.but it did not worked for me.so not going to do that now.

in present my concentration is on auto generation of tsshape constructor datablock and all necessary statments in onLoad().
if everything looks ok.then i will try that again.

"But that exposed a few missing error checks that the Model editor needs"
any doc or link that can give me list of those error checks?
#3
09/07/2012 (8:08 am)
go into
tools\shapeEditor\scripts\shapeEditor.ed.cs


in
function ShapeEdSelectWindow::onSelect( %this, %path )
search for
ShapeEdShapeView.fitToShape();
comment or delete it.
if u have learge amount of model then from now u will feel how easy to judge your model size for commenting this line.

now only need a way to adjust unit field for dae file.


anybody know any way to change dts model's size in datablock?
that would be very helpful for saving large amount of time for non artist.