Re: [Maya-Python] Controlled Class instantiation with multiple constructors

2020-04-15 Thread Justin Israel
On Wed, Apr 15, 2020, 11:01 PM HarshadB wrote: > @alok > Thank you for your reply. > > I already have working class constructors(classmethods) that do what I > want. That part is done. > Sorry, I should have asked the question clearly in the first line. > > What I am actually doing is to further

[Maya-Python] Re: Controlled Class instantiation with multiple constructors

2020-04-15 Thread HarshadB
Here's an excerpt from the Pastebin code linked in the original post, this is the __new__ method from the class: [image: component_new.png] -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group

[Maya-Python] Re: Custom plugin node crashes, can't figure out why

2020-04-15 Thread Peter Jemstedt
Even better, since I'm not treating the data from the active and passive handles, I could just set the output using setMObject() with the data from the input handle: for m_id in range(multi_output_length): multi_output_handle.jumpToLogicalElement(m_id) output_handle =

Re: [Maya-Python] Controlled Class instantiation with multiple constructors

2020-04-15 Thread HarshadB
@alok Thank you for your reply. I already have working class constructors(classmethods) that do what I want. That part is done. Sorry, I should have asked the question clearly in the first line. What I am actually doing is to further automate the instance creation of the class based on the

[Maya-Python] Re: Custom plugin node crashes, can't figure out why

2020-04-15 Thread Peter Jemstedt
Well, I found how not to get it to crash! In my loop over the multi indexes, which I've now turned into a for m_id in range(multi_output_handle.__len__(): where before, I got every child output handle with: for m_id in multi_indices: m_child = plug.selectAncestorLogicalIndex(m_id)

Re: [Maya-Python] Controlled Class instantiation with multiple constructors

2020-04-15 Thread Alok Gandhi
Python @classmethod were added for this exact reason - Alternative Contructors. class Foo(object): def __init__(self, bar=None, baz=None): self._bar = bar self._baz = baz print 'bar: {}, baz: {}'.format(self._bar, self._baz) @classmethod def from_bar(cls,