Polygon selection tag out of bounds
-
On 30/04/2014 at 11:51, xxxxxxxx wrote:
In a plugin that I created, when I switch modes (from Point mode to Edge mode, or from Edge mode to Polygon mode, or whatever), after having created a Polygon Selection Tag, I get this message:
A problem with this project has been detected:
Object "Landscape" - Polygon selection tag out of bounds.
Please save and contact MAXON Support
with a description of the last used commands, actions or plugins.This message only appears when I have a Polygon Selection Tag attached to the object.
What could be happening? -
On 30/04/2014 at 12:39, xxxxxxxx wrote:
What's your plugin do?
-
On 30/04/2014 at 14:15, xxxxxxxx wrote:
It is a tag that dynamically hides polygon faces from polygonal objects.
It works just fine when there is no selection tag attached to the object.
It also works fine when I attach a new selection tag manually, using the Set Selection command.
But when the object has a selection tag that was created by the plugin, it results in that error message when I switch modes. -
On 30/04/2014 at 14:51, xxxxxxxx wrote:
All of a sudden, it started to work.
Damn!! Go figure.
Got to do more testing, trying to break it.
I don't want to release plugins that return error messages at random occasions -
On 30/04/2014 at 14:58, xxxxxxxx wrote:
Ok, if I create a tag using:
result=utils.SendModelingCommand(command=c4d.MCOMMAND_GENERATESELECTION,list[op],mode=c4d.MODELINGCOMMANDMODE_POLYGONSELECTION,bc=c4d.BaseContainer(),doc=doc)
The error occasionally (most of the time) will appear.
If I create the tag with:sel_tag=op.MakeTag(c4d.Tpolygonselection)
tag_selection=sel_tag.GetBaseSelect()
selection.CopyTo(tag_selection)It all works fine.
Well, at least I found a way to make it work. -
On 30/04/2014 at 15:37, xxxxxxxx wrote:
NOPE!!! False alarm.
It still returns the error.
Damn! Could someone help me on this? -
On 30/04/2014 at 16:05, xxxxxxxx wrote:
Most of the problems I've had with adding tags & objects with code have been from the tag or object taking too long to physically create itself.
So when the code goes to the next line and tries to edit that tag or object. It can't do it because C4D hasn't finished building it yet.What seems to be the safest way (where I've had the most luck) of creating these things is to do it in the Message() method. And using MSG_MENUPREPARE to test if C4D is ready to proceed.
def Message(self, node, type, data) : #Get the object the tag will be added to obj = op.GetObject() if not obj: return False if type == c4d.MSG_MENUPREPARE: polytag = c4d.BaseTag(c4d.Tpolygonselection) obj.InsertTag(polytag, 0) return MyPlugin.Message(node, type, data)
-ScottA
-
On 30/04/2014 at 16:27, xxxxxxxx wrote:
Thank you Scott. I will give it a try.