Author Topic: Copying a brick's properties to another brick  (Read 1234 times)

I would like to know how you guys would go about copying all the events and properties of one brick to another. I've been trying to do this for a while, but I don't know all of the function names.
« Last Edit: March 24, 2014, 02:16:42 PM by chrisbot6 »

Got part of this from the duplicator:

%this = %brick;


for(%i=0;%i<%this.numEvents;%i++)
   {
      //+-EVENT num enabled input delay target output par1 par2 par3
      %data = %data NL "+-EVENT" TAB %i TAB %this.eventEnabled[%i] TAB %this.eventInput[%i] TAB %this.eventDelay[%i] TAB %this.eventTarget[%i] TAB %this.eventNT[%i] TAB %this.eventOutput[%i];
      //Parameters
      %outputClass = %this.eventTargetIdx[%i] == -1 ? "fxDtsBrick" : inputEvent_GetTargetClass("fxDtsBrick", %this.eventInputIdx[%i], %this.eventTargetIdx[%i]);
      for(%p=1;%p<=4;%p++)
      {
         %param = %this.eventOutputParameter[%i,%p];
         if(getWord(getField($OutputEvent_parameterList[%outputClass, %this.eventOutputIdx[%i]], %p - 1), 0) $= "dataBlock" && isObject(%param))
            %param = %param.getName();
         %data = %data TAB %param;
      }
   }

Got part of this from the duplicator:

%this = %brick;


for(%i=0;%i<%this.numEvents;%i++)
   {
      //+-EVENT num enabled input delay target output par1 par2 par3
      %data = %data NL "+-EVENT" TAB %i TAB %this.eventEnabled[%i] TAB %this.eventInput[%i] TAB %this.eventDelay[%i] TAB %this.eventTarget[%i] TAB %this.eventNT[%i] TAB %this.eventOutput[%i];
      //Parameters
      %outputClass = %this.eventTargetIdx[%i] == -1 ? "fxDtsBrick" : inputEvent_GetTargetClass("fxDtsBrick", %this.eventInputIdx[%i], %this.eventTargetIdx[%i]);
      for(%p=1;%p<=4;%p++)
      {
         %param = %this.eventOutputParameter[%i,%p];
         if(getWord(getField($OutputEvent_parameterList[%outputClass, %this.eventOutputIdx[%i]], %p - 1), 0) $= "dataBlock" && isObject(%param))
            %param = %param.getName();
         %data = %data TAB %param;
      }
   }

Thanks. This should work.

Edit: Actually this doesn't help at all, mainly because it's a snippet from a much bigger script and I can't see what it's meant to be doing.
« Last Edit: March 25, 2014, 02:04:37 PM by chrisbot6 »

would just making a new object that inherits the old one not work for this

i thought i did that once but maybe i wasn't working with bricks

edit: oh you aren't making a new brick ghrouh

would just making a new object that inherits the old one not work for this

i thought i did that once but maybe i wasn't working with bricks

edit: oh you aren't making a new brick ghrouh
Actually I am.

How does that work?

new fxdtsbrick(newbrick : oldbrick);