Using Global VB Function anywhere in xsi ?

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

Using Global VB Function anywhere in xsi ?

Post by eternal art » 09 May 2013, 13: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: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Using Global VB Function anywhere in xsi ?

Post by rray » 09 May 2013, 13: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 Jan 5th 2024

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

Re: Using Global VB Function anywhere in xsi ?

Post by eternal art » 09 May 2013, 13: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: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Using Global VB Function anywhere in xsi ?

Post by rray » 09 May 2013, 13: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 Jan 5th 2024

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

Re: Using Global VB Function anywhere in xsi ?

Post by eternal art » 09 May 2013, 14: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 .
Attachments
MyGlobalMessagePlugin.zip
(620 Bytes) Downloaded 60 times
3D Supervisor - Production House .

User avatar
rray
Moderator
Posts: 1774
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany
Contact:

Re: Using Global VB Function anywhere in xsi ?

Post by rray » 09 May 2013, 14: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 Jan 5th 2024

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

Re: Using Global VB Function anywhere in xsi ?

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

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

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests