Hi;
I have a custom property created through a self installing plugin. I want to be able to point to it as an object so as to be able to find other objects relative to the model it's under. I couldn't do it using the ocustomProperty declared under the define(in_ctxt) function. How can I point to it as an object?
Thank you and sorry for the simple question
Cheers;
AJ
How to reference to a custom property
-
- Moderator
- Posts: 754
- Joined: 25 Nov 2009, 01:41
- Contact:
Re: How to reference to a custom property
Well when you call the "AddProperty" method it should return a pointer to the newly created custom property. From there you can find the Parent3dObject through scripting.
If you're trying to find that property on a random object you'll have to be a bit creative and use some of the other scripting methods like Application.FindObjects2() to find all custom properties then filter that collection by iterating and checking type or name.
Need some more context in what you're looking to do to be more helpful I think.
If you're trying to find that property on a random object you'll have to be a bit creative and use some of the other scripting methods like Application.FindObjects2() to find all custom properties then filter that collection by iterating and checking type or name.
Need some more context in what you're looking to do to be more helpful I think.
Re: How to reference to a custom property
Hi Eric;
Thanx a lot for your reply. The ppg is to be created only once under the root of a model, which has controls for a rig that's under the same model. I want to be able to first point to this very ppg so as to be able to point to its parenting Model and then dig in and find the objects and/or properties/params to be controlled relative to this Model. The reason for this is that there may be more than one of this Character model present in the scene and I want to avoid confusions and/or conflicts. I tried declaring the ppg inside the onInit function, but I just couldn't get the assigned variable to be recognized throughout the rest of the script. It would be great if I could say at the beginning, "This is the pgg and the parenting Model" and filter out and/or search inside that model for the objects whose specific properties are to be altered through the use of this PPG.
Any help would be wildly appreciated.
Cheers;
AJ
Thanx a lot for your reply. The ppg is to be created only once under the root of a model, which has controls for a rig that's under the same model. I want to be able to first point to this very ppg so as to be able to point to its parenting Model and then dig in and find the objects and/or properties/params to be controlled relative to this Model. The reason for this is that there may be more than one of this Character model present in the scene and I want to avoid confusions and/or conflicts. I tried declaring the ppg inside the onInit function, but I just couldn't get the assigned variable to be recognized throughout the rest of the script. It would be great if I could say at the beginning, "This is the pgg and the parenting Model" and filter out and/or search inside that model for the objects whose specific properties are to be altered through the use of this PPG.
Any help would be wildly appreciated.
Cheers;
AJ
-
- Moderator
- Posts: 754
- Joined: 25 Nov 2009, 01:41
- Contact:
Re: How to reference to a custom property
hmm. not sure that is going to work but you could try using:
property = PPG.Inspected(0)
parent = property.Parent3DObject
Inside the plugin.
property = PPG.Inspected(0)
parent = property.Parent3DObject
Inside the plugin.
Re: How to reference to a custom property
Thanx Eric for taking the time to help me out, I appreciate it a lot. I'm enclosing the script so that you could have a clearer idea. onInit function seemed the most ideal place to make the declaration, yet I couldn't get the defined objects to be recognized in the following parts like function Aa() that executes a snippet when the assigned button is pressed through the function AJ_ARAYUZ_DENE_IconSel_OnChanged(). Is there any way to point to this ppg through its code so that its variable is recognized in every function that follows?
Code: Select all
function XSILoadPlugin( in_reg )
in_reg.Author = "AJ"
in_reg.Name = "AJ_ARAYUZ_DENEPlugin"
in_reg.Major = 1
in_reg.Minor = 1
in_reg.RegisterProperty "AJ_ARAYUZ_DENE"
in_reg.RegisterCommand "AJ_ARAYUZ_DENE", "StartAJ_ARAYUZ_DENE"
XSILoadPlugin = true
end function
function AJ_ARAYUZ_DENE_Define( ctxt )
dim oCustomProperty
set oCustomProperty = ctxt.Source
oCustomProperty.AddParameter2 "IconSel", siInt4, -1,-1, 9 ,-1, 9,0
oCustomProperty.AddParameter2 "SyNop",siString,"",,,,,0,siPersistable
oCustomProperty.AddParameter2 "StaticBitmapControl",siString
oCustomProperty.SyNop.value = "G:\AJ_XSI_WGROUP\Application\synoptic\embeddedsynoptic.htm"
AJ_ARAYUZ_DENE_Define = true
end function
function AJ_ARAYUZ_DENE_DefineLayout( ctxt )
dim oLayout,iList,oItem
set oLayout = ctxt.Source
oLayout.Clear
iconpath = "C:\Users\JACOBO\Desktop\EYE"
aBitmaplist=array( _
iconpath + "\RIGHT_EYE_NORMAL.bmp" , 0 , _
iconpath + "\RIGHT_EYE_SHOCKED.bmp" , 1)
oLayout.AddTab "EXAMPLE"
oLayout.AddGroup "BITMAP"
Set oItem = oLayout.AddItem( "StaticBitmapControl", "Static Bitmap", siControlBitmap )
oItem.SetAttribute siUIFilePath, ActiveProject2.Path + "\Pictures\INTERFACE\MAKEITS.bmp"
oItem.setattribute siUINoLabel,true
oLayout.EndGroup
oLayout.AddGroup "Tools"
oLayout.AddRow
set iList=oLayout.AddEnumControl ("IconSel", aBitmaplist, , siControlIconList)
iList.SetAttribute "Nolabel", true
iList.SetAttribute "UseSelIcon", 1
oLayout.EndRow
oLayout.EndGroup
oLayout.AddGroup "SYNOPTIC"
set oItem = oLayout.AddItem("SyNop", "", siControlSynoptic)
oItem.setattribute siUINoLabel,true
oLayout.EndGroup
oLayout.AddTab "EXAMPLE"
oLayout.AddGroup "BITMAP"
Set oItem = oLayout.AddItem( "StaticBitmapControl", "Static Bitmap", siControlBitmap )
oItem.SetAttribute siUIFilePath, ActiveProject2.Path + "\Pictures\INTERFACE\MAKEITS.bmp"
oItem.setattribute siUINoLabel,true
oLayout.EndGroup
AJ_ARAYUZ_DENE_DefineLayout = true
end function
function AJ_ARAYUZ_DENE_OnInit( )
Application.LogMessage "OnInit called"
end function
function AJ_ARAYUZ_DENE_IconSel_OnChanged()
pIconSel=PPG.IconSel.Value
select case pIconSel
case 0
Aa()
case 1
Ba()
case else
fToolbar(pIconSel)
end select
end function
function Aa()
end function
function Ba()
end function
-
- Moderator
- Posts: 754
- Joined: 25 Nov 2009, 01:41
- Contact:
Re: How to reference to a custom property
Well not sure how it could be done in vb script. I played a little but each time I ran a SelectObj command it selected the control and crashed.
In the Aa() function I did this:
just trying to select a control in the model named "eye_L_ctrl" but again once it selects the object it crashes not sure why.
In the Aa() function I did this:
Code: Select all
function Aa()
set ctrl=PPG.Inspected(0).Model.FindChild("eye_L_ctrl")
LogMessage ctrl.FullName
SelectObj ctrl
end function
Re: How to reference to a custom property
Eric, I thank you for your patience and help. I'll investigate further and maybe dissect a few more scripts to see how others handled the situation.
Cheers and take care.
AJ
Cheers and take care.
AJ
Who is online
Users browsing this forum: No registered users and 25 guests