View Full Version : Implict Selection
How do i get the currently implicitly selected object when using a sub component filter on an object, such as Polygon Filter on a Polygonal Mesh.
Selection only returns sub components in this case, and when none is selected i can't look up their parent either.
This is just convenience for a conditional selection script, eliminating the step of having to step out of the current filter and select the object.
Chinny
03-06-2008, 05:16 PM
logmessage Selection(0).Name
I think should work for you
Chin
PS I find using the SDK Explorer amazing for this type of info. It has helped me so much in the past. If you don't use it already I highly recommend it!
Cntrl+Shift+4 = hotkey
StephenBlair
03-06-2008, 05:43 PM
If you want to get the X3DObject directly:
LogMessage( classname(Selection(0).Subcomponent.Parent3DObject ) );
Selection(0).Name, // ERROR : Object required - [line 1] (In Vertex and Edge Filters, Polygon Filter returns a valid name.
The latter requires a component to be selected tho.
Guess a fair compromise is to either have the user select an object, or add to the current selection.
Chinny
03-06-2008, 06:38 PM
Ah I did not realise you meant when no component selected. This is a workaround:
set sel = Application.Selection
set currentFilter = sel.Filter
logmessage currentFilter.Name
ActivateObjectSelTool
LogMessage Selection(0)
'Set back to the current filter
if currentFilter.Name = "Vertex" then
ActivateVertexSelTool
elseif currentFilter.Name = "Edge" then
ActivateEdgeSelTool
elseif currentFilter.Name = "Polygon" then
ActivateRaycastPolySelTool
end if
Thanks Chinny, Actually works quite well.
var filter = Selection.Filter;
SelectObjectFilter();
var objectName = Selection(0).Name;
LogMessage( objectName );
SelectFilter(filter);
var object = ActiveSceneRoot.FindChild(objectName);
LogMessage( object.Name );
I'll try to put the script in a presentable form sometime next week :)
As a side note, just trying to match XSI's behaviour.
Should the script be expected to work with multiple objects? Seems like i.e the select n-sided polygons is able to work with multiple objects. (Just a user leisure question)
Edit: Wait, why am i traversing the scene to find the object when i have it right there in Selection?
A Cleaner version would obviously be
var filter = Selection.Filter;
SelectObjectFilter();
var oObject = Selection(0);
SelectFilter(filter);
Another side note, Point::Position seem to hold relative (local transform) values?
How do i get absolute values? ;)
Edit: Yet another thing. is there a C++ equivalent to SelectFilter? digging trough the docs i can't seem to find a method to set the selection filter.
CiaranM
03-15-2008, 10:23 PM
Another side note, Point::Position seem to hold relative (local transform) values?
How do i get absolute values? ;)
Perhaps XSIMath.MapObjectPositionToWorldSpace?
Still looking for a way of setting the current selection filter using the object model as Selection.Filter is read only.
Ended up just writing a wrapper using Application.ExecuteCommand.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.