Hide Tags
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 02:48, xxxxxxxx wrote:
If they are not attached to an object they can not be saved with the document. Setting a pointer in the link is not going to cause the tag to be saved. Why do you need to use a selection tag? Can't you just use a BaseSelect, you just need to add the CopyTo, Read and Write. The BaseSelect has functions for these.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 02:59, xxxxxxxx wrote:
I could use a BaseSelect.. but how do I add a Baselect to my plugin BaseContainer?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 03:03, xxxxxxxx wrote:
...Wouldn't that require a CustomDataType and bc->SetData()?
...or, are you suggesting that I store the BaseSelect pointer(s) as members of my class and implement the Read()/Copy()/Write() methods in there?
I was assuming that the Read()/Copy()/Write() of the root Atom class of the SelectionTag would handle the disk stuff, but I guess the problem is that these tags are not attached to the document (they're not atached, so they don't get displayed - which is the point of the plugin).
I could switch over to just tracking the BaseSelect of the tags, with some additional work... I guess I have to implement the Read()/Copy()/Write() stuff either way - unless there's some way of storing the BaseSelect pointers in my plugin's BaseContainer... right?
Thanks. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 03:23, xxxxxxxx wrote:
...I just realized the other reason I'm using SelectionTags instead of BaseSelects... BaseSelects don't have names attached, which is needed for this plugin.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 04:26, xxxxxxxx wrote:
Without knowing what you are trying to achieve its hard to advise. Trying to use a SelectionTag not stored in a document could be messy. Add the baseselect to your class and store the selection in it, implementing the Read/Write/Copy is simple since BaseSelect has the functions for these itself. If you need a name, store this too. If you can give a little more info it might be easier to know what to advise.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 04:45, xxxxxxxx wrote:
Thanks, I think that's enough for me to go on for now - I was just hoping to avoid having to implement the Read/Write/Copy, since I hadn't messed with that before, but I'll look through the docs and sample code and give that a shot.
The basic idea is to track some Selection Tags without having them all (could be 100 of them) strung out attached to my object. It sounds like I can't 'hide' them, so they are not attached to the object/document. Since they're not attached, it sounds like they won't get auto-saved/read for me. Which means using the BaseContainer to store them is not of much use to me in this case (and a bit clumsy to start with, since it's a variable number of them).
Since it looks like I'll need to implement the R/W/C stuff anyway, that pretty much opens up other options for handling them.
Thanks again. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 10:17, xxxxxxxx wrote:
Notes:
- polyArray is a private class member to IPPFigure.
- IPPFIGURE_POLYCOUNT is a LONG resource storing the number of polyArray elements.// NodeData.Init //*---------------------------------------------------------------------------* Bool IPPFigure::Init(GeListNode* node) //*---------------------------------------------------------------------------* { polyArray = NULL; return TRUE; } // NodeData.Free //*---------------------------------------------------------------------------* void IPPFigure::Free(GeListNode* node) //*---------------------------------------------------------------------------* { GeFree(polyArray); } // NodeData.Read: Read data from HyperFile //*---------------------------------------------------------------------------* Bool IPPFigure::Read(GeListNode* node, HyperFile* hf, LONG level) //*---------------------------------------------------------------------------* { if (level >= 0) { BaseContainer* bc = ((BaseTag* )node)->GetDataInstance(); LONG size = sizeof(CPolygon)*bc->GetLong(IPPFIGURE_POLYCOUNT); polyArray = (CPolygon* )GeAlloc(size); if (!polyArray) return ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "IPPFigure.Read.polyArray"); hf->ReadMemory((void** )&polyArray;, &size;); } return TRUE; } // NodeData.Write: Write data to HyperFile //*---------------------------------------------------------------------------* Bool IPPFigure::Write(GeListNode* node, HyperFile* hf) //*---------------------------------------------------------------------------* { // Level 0 if (polyArray) hf->WriteMemory(polyArray, sizeof(CPolygon)*((BaseTag* )node)->GetDataInstance()->GetLong(IPPFIGURE_POLYCOUNT)); // Level 1 return TRUE; } // NodeData.CopyTo: Copy data to copied PluginTag //*---------------------------------------------------------------------------* Bool IPPFigure::CopyTo(NodeData* dest, GeListNode* snode, GeListNode* dnode, LONG flags, AliasTrans* trn) //*---------------------------------------------------------------------------* { if (polyArray) { BaseContainer* bc = ((BaseTag* )snode)->GetDataInstance(); IPPFigure* fdest = (IPPFigure* )dest; LONG size = sizeof(CPolygon)*bc->GetLong(IPPFIGURE_POLYCOUNT); fdest->polyArray = (CPolygon* )GeAlloc(size); if (!fdest->polyArray) return ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "IPPFigure.CopyTo.adest->polyArray"); CopyMem(polyArray, fdest->polyArray, size); } return TRUE; }
That'll get you started.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 10:40, xxxxxxxx wrote:
Hey Robert,
Thanks... you know, I didn't think to look in your code yet This is Keith, BTW.
Anyway, I got the basic framework code working under my new approach last night... now I'm of to do the R/W/C code, so this will come in handy. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 10:45, xxxxxxxx wrote:
Hi Keith,
This is widdled down code so that you can see what the bare necessities are (you'll see that a couple other things are being done in the code that would confuse things a little). Also good if anyone else needs help in implementing these methods.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 11:14, xxxxxxxx wrote:
Yep - thanks. Will be testing again in a few minutes :).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/03/2006 at 15:48, xxxxxxxx wrote:
Ok, everything is now working as expected... now I need to look into keeping the selections up to date...
David (or anyone who knows), can you tell me the functional difference between MSG_POINTS_CHANGED (which is available in R8) and MSG_TRANSLATE_POINTS (which only starts happening in R9) ?
Could I look for MSG_POINTS_CHANGED in both R8 and R9 and use that?
Thanks. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/03/2006 at 01:18, xxxxxxxx wrote:
MSG_POINTS_CHANGED will help a little, see VariableChanged in the sdk docs. The difference is that MSG_TRANSLATE_POINTS (and a number of other _TRANSLATE_ and _PRETRANSLATE_) give you more information about what its happening, like the points getting welded or cloned or deleted or moved etc. MSG_POINTS_CHANGED just gives a mapping table of the old to new points.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/03/2006 at 02:03, xxxxxxxx wrote:
Yeah, in this first case, I'm looking at Polygons, so... I'm trying to invision what the VariableChanged data is/can tell me - and whether or not that's usefull...
- There may be more polygons than there used to be:
...Probably doesn't affect my selection tags much, except where the mapping/ordering may be different.
- There may be fewer polygons than there used to be:
...so some polys in my selection tags may no longer exist (along with a potential re-ordering).
- The ordering may have changed for some reason or another.
...so the selection tags will need to get updated to match the new ordering.
As you mention, what it doesn't tell me is a lot of potentially usefull information about 'how' things are changing... for example, if a polygon/quad (that exists in one of my tags) gets 'split' into two triangles (for example), ideally, the two triangles would be part of that list in place of the one quad. The VariableChanged structure doesn't give me enough information to determine if this is te case or not.
I guess the worst-case scenerio is similar to that... my selections won't include logical changes when cutting the mesh up (as well as an issue related to expanding selections when collapsing Symmetry objects...).
Some of the other issues you mention (welding, cloning, etc) will have more meaning on the Point selections... hmmm, I guess I can start with the R8- compatible case and look at the _TRANSLATE_ messages for R9 after I get that working.
Thanks.
BTW, As a Plugin Tag, is there any way for me to know when someone is calling "doc->Polygonize()" ? Is there any way for any type of plugin to know about that? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/03/2006 at 02:08, xxxxxxxx wrote:
David, if you're interested/curious, send me an e-mail and I'll send you the plugin to see what I'm doing. typhoon[at]charter[dot]net
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/03/2006 at 05:19, xxxxxxxx wrote:
Hmm.. ok, looks like maybe MSG_POLYGONS_CHANGED is no longer sent, or at least not how I'd expect it to be...
- Doing a Subdivide sends one, but the mapping seems to be screwed up
- Knife cuts don't send one
- Triangulate doesn't send one
- Collapse and Melt don't either
.. the only thing I've found to send one (with a map) is Subdivide, but the map seems to be broken, unless I'm not reading the docs right. Here's my code...
case MSG_POLYGONS_CHANGED:
VariableChanged *pVc = (VariableChanged * )data;
if( pVc )
{
// if there's no map, we have nothing to do...
if( !pVc->map )
break;
Bool foo = 0;
//-------------------------------------------------------------------------
// ok, walk down our list of (hidden) Selection Tags and update them
// with the new mapping...
//-------------------------------------------------------------------------
linkNode *pNode = m_TagList.First();
while( pNode )
{
SelectionTag *ptag = (SelectionTag * )pNode->GetData();
if( ptag )
{
LONG i,a,b;
m_pNewBs->DeselectAll(); // start with an empty selection
m_pOldBs = ptag->GetBaseSelect();
//-------------------------------------------------------------------------
// Since any particular selection list is likely a lot fewer polygons than
// the entire polygon list, we'll just loop over the old selection list...
// of course this causes the use of an additional loop, but hopefully the
// savings is worth it.
//-------------------------------------------------------------------------
for (i=0;m_pOldBs->GetRange(i,&a,&b);i++)
{
for (;a<=b;a++)
{
LONG remap = pVc->map[a]; // map array should have 'new index for old polygon'
if( remap != NOTOK ) // or possibly NOTOK (if the polygon is gone?)
{
m_pNewBs->Select(remap);
foo++;
}
}
}
m_pNewBs->CopyTo(m_pOldBs); // copy the updated list to the selection tag
}
pNode = pNode->Next();
}
if( foo ) // poor man's debug
GePrint("Change");...note that I have valid (and working) selections on every part of the model and the only time "Change" is getting print out is when I do a Subdivide on a chunk of polygons - and then, my selection tags are completely hosed.
Any ideas? or should I just give up on that message?
Thanks.
- Keith -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/03/2006 at 15:39, xxxxxxxx wrote:
I believe that some tools don't support the map part of VariableChanged. (But you still get the message with a change in the polygon count, right?)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/03/2006 at 16:21, xxxxxxxx wrote:
Well, after a lot of further studying, it appears that the SDK docs on this subject are misleading, at best... the map that comes is NOT a map of all polygons, it appears to be a map of (only) ones that have changed in some way.
I went ahead and switched to R9 so I could look at the MSG_TRANSLATE_POLYGONS messages instead and found a similar situation. It's still not really clear exactly what that data is supposed to tell you... and a 'Subdivide' operation on a set of polygons still seems to behaive far differently from other types of operations (like knife cuts, melt, collapse, etc). Some sample code (say from the Polygon Selection Tag) would certainly be useful.
Basically, I've now re-written/structured how all this works and I am now creating individual 'hidden' selection tags (not visible in the OM). When polygons change, I need to look at this selection (a BaseSelect) and update it's values. Since the example in the SDK docs only discusses points, it's difficult to figure out what happens with polygons. I thought the helper functions alone would be enough to get the job done, but apparently not.
This is my current code:
case MSG_TRANSLATE_POLYGONS:
TranslationMaps *ptMaps = (TranslationMaps * )data;
if( ptMaps )
{
BaseSelect *oldBs;
LONG i,a,b;
//-------------------------------------------------------------------------
// Since any particular selection list is likely a lot fewer polygons than
// the entire polygon list, we'll just loop over the old selection list...
//-------------------------------------------------------------------------
m_pNewBs->DeselectAll(); // start with an empty selection
oldBs = ((PolyHideSelData * )((BaseTag * )node)->GetNodeData(0))->GetBaseSelect();
for (i=0;oldBs->GetRange(i,&a,&b);i++)
{
for (;a<=b;a++)
{
LONG orig, remap;
remap = ptMaps->FindNewPolygon(a); // get new index for old polygon
if( remap == NOTOK ) // if remap = NOTOK, then it wasn't changed, so we copy it over
{
m_pNewBs->Select(a);
}
else // otherwise, we need to figure out what happened to it.
{
//what goes here??? the simple code line below is obviously not it
m_pNewBs->Select(remap);
}
}
}
m_pNewBs->CopyTo(oldBs); // copy the updated list to the selection tag
}
return true;...if I need to do something entirely different, then that's ok - I just need some help with what that would be :). Essentually, I want to do exactly whatever a Polygon Selection Tag is doing when it gets one of these messages (I also have hidden Point and Edge selections - this is just the first one I'm trying to work out).
Thanks,
- Keith