hello, 

I'm trying to create some specific widgets in an AEtemplate. While I was 
almost sure I had to do it in PySide with a hack, it turns out Maya 
provides (on paper) everything needed.
I can't find any exhaustive documentation on the xml tags expected by an 
AEtemplate.xml, just the existing examples.

1. What's the benefit of using xml over mel? It seems that xml is the 
proper way, as per Autodesk, but at least Mel is somewhat documented...

2. What's the matter with all the views ? "look", "default", "anim", 
etc.... ? I never noticed that before. What if I want my AEtemplate to 
affect the default view and only the default view?

3. To create a callback in the AEtemplate, linked to a custom python 
script, you can use 
<https://help.autodesk.com/view/MAYAUL/2024/ENU/?guid=GUID-C71F52F9-5437-45AD-A6B6-B43D6D95E93A>
<description language="cb">*py.{file_name}.{function_name}*</description> 
<https://help.autodesk.com/view/MAYAUL/2024/ENU/?guid=GUID-C71F52F9-5437-45AD-A6B6-B43D6D95E93A>.
 
I managed to make it work once, so I know it is doable. However, no way to 
make it work again, and since everything fails totally silently (which the 
core of my problem and what's been driving me crazy for the past few days), 
I have no idea what I'm doing wrong.
Here is what I have:

*Maya.env:*
MAYA_CUSTOM_TEMPLATE_PATH = 
$MAYA_APP_DIR:$MAYA_SCRIPT_PATH:/Users/{me}/Library/Preferences/Autodesk/maya/2024/scripts
PYTHONPATH = /Users/{me}/Library/Preferences/Autodesk/maya/2024/scripts

*.../Preferences/Autodesk/maya2024/scripts/AEtransform.fooTemplate.xml (my 
script folder):*

   1. <?xml version='1.0' encoding='UTF-8'?>
   2. <templates>
   3.   <using package='maya'/>
   4.   <template name='AEtransform'>
   5.     <!-- WORKS -->
   6.     <attribute name='translateX' type='maya.doubleLinear'>
   7.       <label>Translate X</label>
   8.     </attribute>
   9.     <!-- WORKS (apparently, doubleLinear or float are the same) -->
   10.     <attribute name='translateY' type='maya.float'>
   11.       <label>Translate Y</label>
   12.     </attribute>
   13.     <!-- DOESN'T WORK -->
   14.     <attribute name='custom_attr' type='maya.float'>
   15.       <label>Custom Attr</label>
   16.       <description language="cb">
   17.           py.AEaddFloatSlider.AEaddFloatSliderModule
   18.       </description>
   19.     </attribute>
   20.   </template>
   21.  
   22.   <view name="Anim" template="AEtransform">
   23.     <property name='translateX'/>
   24.     <property name='translateY'/>
   25.     <property name='custom_attr'>
   26.     </property>
   27.   </view>
   28. </templates>
   

*.../Preferences/Autodesk/maya2024/scripts/*AEaddFloatSlider.py

   1. import maya.cmds as cmds
   2.  
   3. def AEaddFloatSliderModule( plug, sliderLabel, annot ):
   4.     cmds.rowLayout( nc=2 )
   5.     val = cmds.getAttr( plug )
   6.     cmds.text( label=sliderLabel )
   7.     slider = cmds.floatSlider( annotation=annot, v=val )
   8.     def AEaddFloatSliderModuleCB( *args ):
   9.         val = cmds.floatSlider( slider, q=1, v=1 )
   10.         cmds.setAttr( plug, val )
   11.     cmds.floatSlider( slider, e=1, cc=AEaddFloatSliderModuleCB )
   12.     cmds.setParent( u=1 )
   

Inside maya:
cmds.createNode('transform', n='foo')
cmds.addAttr('foo', ln='custom_attr', at='float')


If anyone has any idea of why this is not working (or how I could get some 
sort of verbosity from maya), that will be more than appreciated!

Thank you so much

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/46eb3f0c-f41f-4b53-8a39-0ffbdad7b16dn%40googlegroups.com.

Reply via email to