MPxLocatorNode and boundingBox

74 views
Skip to first unread message

Rémi Deletrain

unread,
Mar 25, 2016, 10:57:16 AM3/25/16
to Python Programming for Autodesk Maya
Hello everybody,

I made a new node dependent of "MPxLocatorNode". It works well.

I try to define boudingbox but this time Maya crash all the time ...
I fail to understand why.
Does anyone have the answer?

That is my code.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    def isBounded(self):

        """
        !@Brief Set this node with bounding box. See doc for more infos.
        """

        return True

    def boundingBox(self):

        """
        !@Brief Set boundingbox min and max of this node. See doc for more infos.
        """

        return OpenMaya.MBoundingBox(self.bb_min, self.bb_max)

with for exemple:
self.bb_min = [-1.0, 0.0, -1.0]
self.bb_max = [1.0, 0.0, 1.0]

this two variables is calculate with point position value

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Marcus Ottosson

unread,
Mar 25, 2016, 12:31:32 PM3/25/16
to python_in...@googlegroups.com
Which Maya? Which OS? Could you post a complete example to reproduce the problem?

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d5fb60d7-9fbe-4026-bba2-76f6be42a4c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Rémi Deletrain

unread,
Mar 29, 2016, 9:47:38 AM3/29/16
to Python Programming for Autodesk Maya

Daniel Lindsey

unread,
Mar 29, 2016, 4:09:35 PM3/29/16
to Python Programming for Autodesk Maya
Try initiailizing your bb_min and bb_max to (-1,-1,-1) and (1,1,1) respectively.  Also, you could, instead of doing all that work in another method,
do something like this in your boundingBox method if you save the points you're gathering in a list, or MPointArray.

def boundingBox(self):
   bbox = om.MBoundingBox()
for point in self.pointList: bbox.expand(point) return bbox


Rémi Deletrain

unread,
Mar 30, 2016, 5:06:40 AM3/30/16
to Python Programming for Autodesk Maya
Hello Daniel,

Thank you for your answer.
I tried your solution but doesn't work either...

Daniel Lindsey

unread,
Mar 30, 2016, 2:33:28 PM3/30/16
to Python Programming for Autodesk Maya

What's the error you're getting?  Is it a hard crash?  Are you positive it's the bounding box method causing the error?


--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/T6oDTgBObrc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c8f8f194-4f21-41a8-8391-54e9e0ca413d%40googlegroups.com.

Rémi Deletrain

unread,
Mar 31, 2016, 2:37:38 AM3/31/16
to Python Programming for Autodesk Maya
I not have error... maya  just crash.
Yes i'm shure. When I comment boundingbox method my node works
Reply all
Reply to author
Forward
0 new messages