• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/07/2011 at 10:46, xxxxxxxx wrote:

After a bit of research and search here, you might want to stay with the ViewportSelect+ViewportPixel.  Michael Welter says this:

Try

ViewportPixel* GetPixelInfoPoint(LONG x, LONG y);
ViewportPixel* GetPixelInfoPolygon(LONG x, LONG y);
ViewportPixel* GetPixelInfoEdge(LONG x, LONG y);

You can iterate over all pixels in the selection area and call these. Its quite fast so it shouldn't be the bottleneck, if your are worried about that.

Note that you will need to get the pixels within the radius of the hitpoint (the selection area).

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/07/2011 at 10:49, xxxxxxxx wrote:

Yeah I saw that, and I attempted to iterate through the pixels and it lagged pretty bad,   but maybe I iterated through the pixels wrong.

If I remember correctly, I used the current mouse location,   and set up a range from negative radius to positive radius in both x and y and iterated through that to check for points at those pixel locations and that was crazy slow..

Do I interpret him meaning incorrectly?

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/07/2011 at 10:58, xxxxxxxx wrote:

so as a code example of how I had iterated through that..  I would so something like this.  :)

``````
LONG xmin = mx - radius   //mx is the current mouse x position.  :)
LONG xmax = mx + radius
LONG ymin = my - radius   //my is the current mouse y position.  :)
LONG ymax = my + radius

for(int ix = xmin; ix < xmax; ix++)
{
for(int iy = ymin; iy  < ymax; iy++)
{
ViewportPixel *vp = vps->GetPixelInfoPoint(ix, iy);
bsPoint->Select(vp->i);
}
}
``````

Is that completely wrong  HAHA?

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/07/2011 at 11:41, xxxxxxxx wrote:

Is the radius specified in pixels or in 3D (Real) units?

I'd do it more like this (minor changes) :

``````LONG xmin = mx - radius;   //mx is the current mouse x position.  :)
LONG xmax = mx + radius;
LONG ymin = my - radius;  //my is the current mouse y position.  :)
LONG ymax = my + radius;

LONG    iy;
ViewportPixel* vp = NULL;
for(LONG ix = xmin; ix < xmax; ++ix)
{
for(iy = ymin; iy  < ymax; ++iy)
{
vp = vps->GetPixelInfoPoint(ix, iy);
if (vp) bsPoint->Select(vp->i);
}
}
``````

Of course, this doesn't do a circular radius but a rectangular area.

Dan does something like this:

```````     LONG x = mx, y = my;
if(vp)
{
Vector mpt = Vector(mx,my,0.0);
Vector pxl = Vector(x,y,0.0);

{
if(ctrl) bs->Deselect(vp->i);
else bs->Select(vp->i);
}
}`
``````

Finally, check out the sculpting.cpp example in the plugins/cinema4dsdk folder.  It uses a ViewportSelect and calls GetPixelInfoPoint().

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 26/07/2011 at 11:53, xxxxxxxx wrote:

Thanks Robert,  I have talked to Dan via email about this and he ran in to the same problems that I am..  He was unable to get it to perform as efficiently as the live select tool also.
However his code for getting a circular radius is a good place to start with the pixel parsing code.

I will play around with parsing the pixels as see if I can optimize that enough to work.  :)

the radius value is a Real value obtained from the AM.  This is that same value that ShowHotSPot() uses to draw the radius guide circle.   I will take a look again at sculpting.cpp and see if I can get more from it.  :)

~Shawn

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/07/2011 at 18:33, xxxxxxxx wrote:

Just an update!  this method was the answer.. it worked very well.. the problem I was having was I was allocating the

``````GetPixelInfoPoint
``````

within the loop.  Thanks Robert!

~Shawn

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/07/2011 at 18:48, xxxxxxxx wrote:

Final Code

``````
LONG xmin = mx - radius;   //mx is the current mouse x position.  :)
LONG xmax = mx + radius;
LONG ymin = my - radius;  //my is the current mouse y position.  :)
LONG ymax = my + radius;

LONG    iy;
ViewportPixel* vp = NULL;
Vector origin = Vector(mx, my, 0);
for(LONG ix = xmin; ix < xmax; ++ix)
{
for(iy = ymin; iy  < ymax; ++iy)
{
Vector current = Vector(ix, iy, 0);
Vector dist = origin - current;
Real dis = Len(dist);
vp = vps->GetPixelInfoPoint(ix, iy);

{
if (vp) bsPoint->Select(vp->i);
}
}
}
``````

If anyone sees any optimization possibilities  I am all ears, eyes, and fingers.. HAHA..

~Shawn

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/07/2011 at 21:40, xxxxxxxx wrote:

``````LONG xmin = mx - radius;   //mx is the current mouse x position.  :)
LONG xmax = mx + radius;
LONG ymin = my - radius;  //my is the current mouse y position.  :)
LONG ymax = my + radius;

LONG    iy;
ViewportPixel* vp = NULL;
Vector origin = Vector(mx, my, 0);
Vector current;
Vector dist;
Real dis;
for(LONG ix = xmin; ix < xmax; ++ix)
{
for(iy = ymin; iy  < ymax; ++iy)
{
current = Vector(ix, iy, 0);
dist = origin - current;
dis = Len(dist);
{
vp = vps->GetPixelInfoPoint(ix, iy);
if (vp) bsPoint->Select(vp->i);
}
}
}
``````

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/07/2011 at 21:44, xxxxxxxx wrote:

Thanks Robert,  I should know not to declare variables inside of loops..  LOL

~Shawn

• THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/07/2011 at 21:59, xxxxxxxx wrote:

Another thing I was wondering,

Is there a way to keep the radius guide circle that is drawn with ShowHotSpot() in line with teh mouse tip?  I find that if I move my mouse faster, the radius circle ends up lagging behind a bit.  It's as if it can't keep up with the mouse cursor.

Have you run in to this at all?

Thanks,

Shawn