Hi Chad,

I've tried to get this working but it's not happening for me.

I'm trying to set it up as a package, <<Package,Module,Class>>

I have :-

AETemplates.AEmetaNodeTemplate.AEmetaNodeTemplate

My AEmetaNodeTemplate module looks like this, just to test.

import pymel.core as pCore

class AEmetaNodeTemplate(pCore.ui.AETemplate):
    def __init__(self, nodeName):
        self.buildBody(nodeName)

    def buildBody(self, nodeName):
        print "building", nodeName
        self.beginLayout("kParams",collapse=0)
        self.addControl("bright", label="kBright",
changeCommand=self.colorChanged)
        self.addControl("dark", label="kDark", changeCommand=self.colorChanged)
        self.addControl("spread", label="kSpread", preventOverride=True)
        self.addControl("max_distance", label="kMaxDistance")
        self.addControl("reflective", label="kReflective")
        self.addControl("output_mode", label="kOutputMode")
        self.addControl("occlusion_in_alpha", label="kOcclusionInAlpha")
        self.addControl("falloff", label="kFalloff")
        self.addControl("id_inclexcl", label="If You See This It Worked")
        self.endLayout()
        self.suppress("id_nonself")
        self.dimControl(nodeName, "spread", True)


I'd like to understand how Pymel is intercepting the AETemplate
creation, Does it matter when pymel is loaded to find this AETemplate?
 Pymel is up early in our systems but this module path isn't until
later in the maya boot sequence.

Cheers

-Dave


On Thu, Mar 18, 2010 at 3:43 PM, thirstydevil <[email protected]> wrote:
> Cool, Thanks Chad.
>
> -Dave
>
> PS, I've got pymel with git via TortoiseGit.
>
> On Mar 18, 3:13 pm, Chad Dombrova <[email protected]> wrote:
>> pymel 1.0 has support for python AETemplates using specially implemented 
>> classes. there's an example included with pymel showing how to do this using 
>> subclassing techniques.  you could easily write a function that created an 
>> AETemplate subclass for every one of your metanodes. you may even be able to 
>> do something funky like have your MetaData classes double as AETemplates.  
>> be sure to grab pymel from github, as there's been some work done on this 
>> very recently.
>>
>> -chad
>>
>> On Mar 18, 2010, at 8:07 AM, thirstydevil wrote:
>>
>> > Based on the Bungee paper we've implemented a MetaData python class
>> > that utilises a simple MPxNode as a singleton to store the MetaData
>> > attributes.  MetaData structures are connected together and Maya Nodes
>> > are tagged to the MetaData via message links.
>>
>> > for example:
>>
>> > class MetaData(obejct):
>> >    def __init__(self, node=None, **kw):
>> >         self,metaClass = self.__class__.__name__
>> >         # create the MPxNode and set the attr attaching it to Node
>>
>> > Each MetaData subclass has different methods associated with them.
>> > While I have a simple AETemplate for my MPxNode.  It's become obvious
>> > that I could have a totally different template based on the metaClass
>> > attribute on the node.  With buttons calling methods in the class that
>> > operate on the MetaData structure.
>>
>> > The only hacky way I have got this working is by reloading the
>> > AETemplate via a script job if the MetaData node is different to the
>> > last cached MetaData selection.  This works, is slow-ish, not stable
>> > because the UI doesn't seem to be thread safe.
>>
>> > So, I guess I have to create a different MPxNode for every subclass
>> > that requires a different template.  Even though my MPxNode is
>> > effectively a blank node?
>>
>> > Anyone?  You're experience with templates would be welcome.  I've just
>> > started to investigate them.
>>
>> > -Dave
>>
>> > --
>> >http://groups.google.com/group/python_inside_maya
>>
>>
>
> --
> http://groups.google.com/group/python_inside_maya
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to