I think we'll have to wait for bugfixes for js. Anyway, I tried the
following workaround:
//use the selection list for R3RA_HookData
var faceSelList = new Array();
// R3RA_Hook to be used for face handles
function faceHook(data, obj, primface, faceindex, handletype)
{
data[faceindex] = obj.HANDLESELECTED(faceindex, handletype);
return 1;
}
//then enumerate faces like this (ENUMFACES is in r3prim.js):
sds.ENUMFACES([R3RA_Hook, faceHook,
R3RA_HookData, faceSelList,
R3PRIMA_PointSpace, R3SPACE_OBJECT]);
After this the faceSelList should contain selection states of faces with
indexes in the list
corresponding to the faceindexes, but RS crashes and points the blame at
js32.dll.
Maybe the problem is that a pointer to primface is passed to the hook...
Timo Mikkolainen kirjoitti:
I tried adding them to r3subdiv.js myself:
R3SUBDIVA_FaceSelection = 1235506;
function GetR3SUBDIVA_FaceSelection() {
return R3Get(this.r3obj, R3SUBDIVA_FaceSelection, R3TID_INTEGER,
R3TNF_ARRAY);
}
R3SUBDIVA_EdgeSelection = 1235507;
function GetR3SUBDIVA_EdgeSelection() {
return R3Get(this.r3obj, R3SUBDIVA_EdgeSelection, R3TID_INTEGER,
R3TNF_ARRAY);
}
R3SUBDIVA_VertexSelection = 1235508;
function GetR3SUBDIVA_VertexSelection() {
return R3Get(this.r3obj, R3SUBDIVA_VertexSelection, R3TID_INTEGER,
R3TNF_ARRAY);
}
this.GetFaceSelection=GetR3SUBDIVA_FaceSelection;
this.GetEdgeSelection=GetR3SUBDIVA_EdgeSelection;
this.GetVertexSelection=GetR3SUBDIVA_VertexSelection;
they do return something, but I have no idea what... most likely
pointers or something equally useful.
On 17/12/2007, Timo Mikkolainen <[EMAIL PROTECTED]> wrote:
Aand none of the R3SUBDIVA types are defined in js, so meh.
On 17/12/2007, Timo Mikkolainen <[EMAIL PROTECTED]> wrote:
(Boring day at work...)
I looked through the mailing list archives and found something on this issue:
http://www.mail-archive.com/[email protected]/msg03616.html
It looks like all kinds of array related stuff is busted in JS. I'm
not sure if this is even fixed in V6 yet (at least bug 2097 is still
open and unconfirmed). I'll test all this when I get home.
On 17/12/2007, Timo Mikkolainen <[EMAIL PROTECTED]> wrote:
Looking at the Low Level API section in the reference manual, I'd
quess the correct call would actually be something like:
var faceSelection = R3Get(sdsObject, R3SUBDIVA_FaceSelection,
R3TID_INTEGER, R3TNS_ARRAY);
I'm not sure of the typeid and array flag, they might very well be
wrong. It might also need some additional flags (like R3TNF_READONLY
and R3TNF_BYVALUE).
On 17/12/2007, Timo Mikkolainen <[EMAIL PROTECTED]> wrote:
Looking at r3subdiv.h, it does have these:
R3SUBDIVA_FaceSelection,
R3SUBDIVA_EdgeSelection,
R3SUBDIVA_VertexSelection
that apparently hold the selection data.
I'd imagine these can be (somehow) accessed with R3GetAttrs(), but I
haven't tested it yet.
I could only find examples of this on the SDK side, I don't even know
if the function exists on the JS side. If it does, I have no idea what
to pass as params (using the SDK it would be something like
R3GetAttrs(sdsObject, R3SUBDIVA_FaceSelection, &faceSelection,
R3RA_Done);).
On 16/12/2007, Juha Sunnari <[EMAIL PROTECTED]> wrote:
Eh, nevermind, further investigation reveals that there are methods in
r3prim.js
called SELECTNEXT, SELECTUP, SELECTPREV, etc...
Juha Sunnari kirjoitti:
That's what I would like to know, too. In the sdk it looks like
adjacency information for edges
and faces are stored in R3EDGELISTNODE and R3FACEPEREDGENODE.
structs defined in r3subdiv.h. However I haven't really looked into
how to manipulate these in js or
if it is even possible at the moment. Maybe the RS folks could give
some information on this. :)
Timo Mikkolainen kirjoitti:
I'm trying to create a generic function library for SDS manipulation,
starting with modifying the handle selection (e.g. selecting an edge
loop or -ring, selecting connected faces etc.). Going through all
handles and checking which ones are selected is slow and hack-ish and
I can't access the selection order. I take it that the selected
handles (with the correct order) are stored as tags in the sds object,
but I don't know how to access them through JS, any ideas?