Using Global VB Function anywhere in xsi ?

Discussions concerning programming of SOFTIMAGE©
User avatar
eternal art
Posts: 93
Joined: 08 Jun 2009, 20:48
Location: UAE - Abu Dhabi

Using Global VB Function anywhere in xsi ?

Post by eternal art » 09 May 2013, 11:29

Hello ..
I need a VB function with one Parameter to use it whereaver i want in softimage ( Like Utility Function) , so I simplify what i need in this function just to illustrate my problem ,

Code: Select all

function XSILoadPlugin( in_reg )
	in_reg.Author = "ZZZ"
	in_reg.Name = "My ZZZ Commands"
	in_reg.Major = 1
	in_reg.Minor = 0


	in_reg.RegisterCommand "MyGlobalMessage","MyGlobalMessage"
		
	'RegistrationInsertionPoint - do not remove this line

	XSILoadPlugin = true
	
End Function

'--------------------------------------------

Function MyGlobalMessage_Execute( ZZ )

Logmessage ZZ

End Function
Now I want to use The Same Function In a Button in My Toolbar :

Code: Select all

ZZ = "Hi ...."
MyGlobalMessage_Execute( ZZ )
It's give me an error message :

Code: Select all

Type mismatch: 'MyGlobalMessage_Execute' - [line]
Anyhelp or better way to do it is really appreciated .
3D Supervisor - Production House .

User avatar
rray
Moderator
Posts: 1810
Joined: 26 Sep 2009, 13:51
Location: Bonn, Germany

Re: Using Global VB Function anywhere in xsi ?

Post by rray » 09 May 2013, 11:35

This should work when you remove the _Execute in the button code. It's just an extension so Softimage knows in what function to find the implementation of your command.
softimage resources section updated Sep 26th 2026

User avatar
eternal art
Posts: 93
Joined: 08 Jun 2009, 20:48
Location: UAE - Abu Dhabi

Re: Using Global VB Function anywhere in xsi ?

Post by eternal art » 09 May 2013, 11:52

I tried that :

Code: Select all

ZZ = "Hi ...."
MyGlobalMessage ( ZZ )
but still give me an error :

Code: Select all

' ERROR : Wrong number of arguments or invalid property assignment: 'MyGlobalMessage ' - [line 2]
3D Supervisor - Production House .

User avatar
rray
Moderator
Posts: 1810
Joined: 26 Sep 2009, 13:51
Location: Bonn, Germany

Re: Using Global VB Function anywhere in xsi ?

Post by rray » 09 May 2013, 11:59

When writing a custom command, you'll have to declare what arguments will get passed to the _Execute handler in the _Init handler. Don't know the specifics right now, it's all in the docs though.
softimage resources section updated Sep 26th 2026

User avatar
eternal art
Posts: 93
Joined: 08 Jun 2009, 20:48
Location: UAE - Abu Dhabi

Re: Using Global VB Function anywhere in xsi ?

Post by eternal art » 09 May 2013, 12:04

I'v tried to search in the doc before i post here with no success , i will try to search again .
I'v attached an example if you can take a look on it .

Thanks in advanced .
You do not have the required permissions to view the files attached to this post.
3D Supervisor - Production House .

User avatar
rray
Moderator
Posts: 1810
Joined: 26 Sep 2009, 13:51
Location: Bonn, Germany

Re: Using Global VB Function anywhere in xsi ?

Post by rray » 09 May 2013, 12:18

It's in the sdk docs, not the normal docs.
There's probably also some example code to copy paste in there.
softimage resources section updated Sep 26th 2026

User avatar
eternal art
Posts: 93
Joined: 08 Jun 2009, 20:48
Location: UAE - Abu Dhabi

Re: Using Global VB Function anywhere in xsi ?

Post by eternal art » 09 May 2013, 12:20

I'v found an example in the doc finally , many thanks rray for your help .
3D Supervisor - Production House .