Hi Kim,
It seems XSI doesn't like the empty string parameter in AddInputPortByClassID.
If I replace the line :
newOp.AddInputPortByClassID( siPrimitiveID , L"",
oProfilePortGroup.GetIndex(), 0, siOptionalInputPort );
by
oOp.AddInputPortByClassID( siPrimitiveID ,
L"MyInputPortName",oProfilePortGroup.GetIndex(), 0L,
siOptionalInputPort );
in your code snippet then it connects fine.
Could you confirm this?
Cheers,
Fred.
On 5/24/07, Kim Aldis <XSI(at)kim-aldis.co.uk> wrote:
> Stripping it back to the bare bones, this then should work, shouldn't it.
> The Connect call fails.:-
>
> PortGroup oProfilePortGroup = newOp.AddPortGroup( L"Profiles", 0,1 ,
> CString(), CString(), siOptionalInputPort, 0 );
> newOp.AddInputPortByClassID( siPrimitiveID , L"",
> oProfilePortGroup.GetIndex(), 0, siOptionalInputPort );
>
> CStatus oStat = newOp.Connect( );
> if ( !oStat.Succeeded() ) {
> Log( L"Connect New Operator Failed" );
> Log( oStat.GetDescription() );
> }
>
> > -----Original Message-----
> > From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
> > Behalf Of Fred Valleur
> > Sent: 24 May 2007 16:50
> > To: XSI(at)Softimage.COM
> > Subject: Re: Many connections on scriptedOp
> >
> > hi,
> >
> > you need to specify your portgroup and input ports as being optionals,
> > otherwise they all need to be connected. Use the siOptionalInputPort
> > flag for both the "AddPortGroup" and "AddInputPortByClassID" methods.
> >
> > so something like :
> >
> > PortGroup oProfilePortGroup = newOp.AddPortGroup( L"Profiles", 1,500 ,
> > CString(), CString(), siOptionalInputPort, 0 );
> >
> > and idem for "AddInputPortByClassID".
> >
> > Also, each Port added with AddInputPortByClassID must be in its own
> > PortGroup.
> >
> > on a side note, you can use newOp.Connect() to connect the operator
> > to your main Input/Output, and then use "ConnectToGroup" for your
> > dynamic ports.
> >
> > Hope this helps,
> >
> > Fred.
> >
> >
> >
> > On 5/24/07, Kim Aldis <XSI(at)kim-aldis.co.uk> wrote:
> > > It's just not applying the operator. Difficult to tell why:
> > >
> > >
> > > CustomOperator newOp =
> > > Application().GetFactory().CreateObject(L"TinyCurveExtrude");
> > >
> > > newOp.AddOutputPort(oSeedMesh.GetActivePrimitive() );
> > >
> > > PortGroup oProfilePortGroup = newOp.AddPortGroup( L"Profiles", 1,500
> > );
> > >
> > > // reserve a shedload of input ports
> > > //
> > > for ( i=0; i<500; i++ ) {
> > > newOp.AddInputPortByClassID( siPrimitiveID , L"",
> > > oProfilePortGroup.GetIndex() );
> > > }
> > >
> > > // connect up the ones we have so far.
> > > // aProfileList is a collection of curves.
> > > for ( i = 0; i< aProfileList.GetCount(); i++ ) {
> > > X3DObject o = oProfileList[i];
> > > Primitive oPrim = o.GetActivePrimitive();
> > >
> > > LONG iInst;
> > > CStatus stat = newOp.ConnectToGroup(
> > oProfilePortGroup.GetIndex(),
> > > oPrim, iInst );
> > > }
> > >
> > > // omit the newOp.Connect() command here, we're using
> > ConnectToGroup()
> > > //
> > > ctxt.PutAttribute( L"ReturnValue", newOp.GetRef() );
> > >
> > > InspectObj( newOp );
> > >
> > > return CStatus::OK;
> > >
> > >
> > > > -----Original Message-----
> > > > From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
> > > > Behalf Of Fred Valleur
> > > > Sent: 24 May 2007 15:50
> > > > To: XSI(at)Softimage.COM
> > > > Subject: Re: Many connections on scriptedOp
> > > >
> > > > Hi,
> > > >
> > > > it's working fine here.
> > > > Could you be more specific as to why it's failing?
> > > >
> > > >
> > > > Fred.
> > > >
> > > >
> > > > On 5/24/07, Kim Aldis <XSI(at)kim-aldis.co.uk> wrote:
> > > > > It's not, but that's not to say it can't be done.
> > > > >
> > > > > Use the AddInputPortByClassID() method in place of AddInputPort()
> > to
> > > > add
> > > > > ports with nothing yet connected. You subsequently use the
> > > > ConnectToGroup()
> > > > > method to connect objects to those input ports. Don't use
> > Connect()
> > > > to
> > > > > connect the op, ConnectToGroup() should do that for you but you
> > can
> > > > call it
> > > > > multiple times.
> > > > >
> > > > > That's what the docs say anyway, if you dig around deeply enough.
> > > > Getting it
> > > > > to work though, that's another matter. I'll post when I finally
> > stop
> > > > it
> > > > > dying an evil dying thing's death every ten minutes.
> > > > >
> > > > > Don't suppose anyone else has done this, have they?
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]
> > On
> > > > > > Behalf Of Raffaele Fragapane
> > > > > > Sent: 16 May 2007 02:33
> > > > > > To: XSI(at)Softimage.COM
> > > > > > Subject: Re: Many connections on scriptedOp
> > > > > >
> > > > > > afarid it's not.
> > > > > > in xsi ops world, all bow down to the evil and unjust god
> > called
> > > > call
> > > > > > marshalling.
> > > > > > ops need to be fully aware of a static set of connections all
> > the
> > > > time,
> > > > > > hence dynamic I/O isn't possible.
> > > > > >
> > > > > > There are tricks to kinda almost sometimes somewhat work around
> > it
> > > > a
> > > > > > bit, but nothing pretty or universally reliable.
> > > > > >
> > > > > > ******************************
> > > > > > | Raffaele Fragapane |
> > > > > > | Rising Sun Pictures |
> > > > > > |"The only way, is all the way"|
> > > > > > ******************************
> > > > > >
> > > > > >
> > > > > >
> > > > > > Vincent Fortin wrote:
> > > > > >
> > > > > > > It looks like this is. exactly what I need ;)
> > > > > > >
> > > > > > > Thanks Steven!
> > > > > > >
> > > > > > > -------------------------------------------------------------
> > ----
> > > > ----
> > > > > > ---
> > > > > > >
> > > > > > > *From:* owner-xsi(at)Softimage.COM [mailto:owner-
> > xsi(at)Softimage.COM]
> > > > *On
> > > > > > > Behalf Of *Steven Caron
> > > > > > > *Sent:* Thursday, May 10, 2007 4:24 PM
> > > > > > > *To:* XSI(at)Softimage.COM
> > > > > > > *Subject:* Re: Many connections on scriptedOp
> > > > > > >
> > > > > > > port groups?
> > > > > > >
> > > > > > >
> > > > > >
> > > >
> > http://softimage.wiki.avid.com/sdkdocs/cus_ops_StaticversusDynamicOpera
> > > > > > tors.htm#Raan80206
> > > > > > >
> > > > > > > steven
> > > > > > >
> > > > > > > On 5/10/07, *Vincent Fortin* <vincent.fortin(at)ubisoft.com
> > > > > > > <mailto:vincent.fortin(at)ubisoft.com>> wrote:
> > > > > > >
> > > > > > > Hi all,
> > > > > > >
> > > > > > > Is there any way I can assign a scripted op to a group and
> > > > > > dynamically
> > > > > > > access all of its members?
> > > > > > >
> > > > > > > I'd like to be able to change the number of objects in the
> > group
> > > > but
> > > > > > > the last thing I want to do is manually modifying the
> > connections
> > > > on
> > > > > > > the scop.
> > > > > > >
> > > > > > > Basically I want to keep things procedural and fast. Chances
> > are
> > > > I'm
> > > > > > > going to have a lot of objects and parameters to deal with.
> > > > > > >
> > > > > > > I'm pretty sure this can be done quite easily in XSI but I
> > > > couldn't
> > > > > > > find it in the doc. Or maybe there's another way?
> > > > > > >
> > > > > > > Thank you.
> > > > > > >
> > > > > > > Vincent
> > > > > > >
> > > > > > >--------------------------------------------------------------
> > ----
> > > > ----
> > > > > > --
> > > > > > >
> > > > > > >Internal Virus Database is out-of-date.
> > > > > > >Checked by AVG Free Edition.
> > > > > > >Version: 7.5.446 / Virus Database: 269.2.0/757 - Release Date:
> > > > > > 4/11/2007 5:14 PM
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > ---
> > > > > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following
> > text
> > > > in
> > > > > > body:
> > > > > > unsubscribe xsi
> > > > >
> > > > > ---
> > > > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text
> > in
> > > > body:
> > > > > unsubscribe xsi
> > > > >
> > > >
> > > >
> > > > --
> > > > Frederic Valleur | LaMaison
> > > > ---
> > > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text
> > in
> > > > body:
> > > > unsubscribe xsi
> > >
> > > ---
> > > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> > body:
> > > unsubscribe xsi
> > >
> >
> >
> > --
> > Frederic Valleur | LaMaison
> > ---
> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> > body:
> > unsubscribe xsi
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi
>
--
Frederic Valleur | LaMaison