<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Mel Script newbie Questions.(slider, optionmenu for vray) in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-script-newbie-questions-slider-optionmenu-for-vray/m-p/10182386#M4550</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Creating a V-ray 'Round edge' script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But there's a problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It was 'slider' and 'option menu'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It was okay until the UI was created.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But there was a problem connecting the function to the button.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Slider and option menu are the problems.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I don't know what the problem is when I check.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need your help. please&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm posting a script here, so please review it.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;window -title "Vray Round Edges" -widthHeight 350 200;
  columnLayout -adjustableColumn true;
    frameLayout -label "Add / Delete" -collapsable true -collapse true;
      rowLayout -numberOfColumns 2 -columnWidth2 70 70 -columnAttach 1 "both" 5 -columnAttach 2 "both" 5;
      button -l "Add" -c "Add"; button -l "Delete" -c "Delete";
      setParent ..;
    setParent ..;

    frameLayout -label "Round edges" -collapsable true -collapse true;
      columnLayout;
      checkBox -l "Enable Round Edges" -v 1 -onc "Enable" -ofc "Disable";
      text -align left -l "";
      text -align left -l "Radius";
      floatSliderGrp -field 1 -precision 3 -min 0 -max 1 -fmn -100 -fmx -100 radiusslider;
      text -l "";
      checkBox -l "Consider Same Objects Only" -v 1 -onc "ConsiderEnable" -ofc "ConsiderDisable";
      optionMenuGrp -l "Corners" -cc "CornerMenu" Cmenu;
        menuItem -l "Convex and Concave";
        menuItem -l "Convex only";
        menuItem -l "Concave only";
        setParent ..;
      setParent ..;
    setParent ..; 
showWindow;

global proc Add()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes)
    {
    vray addAttributesFromGroup $each vray_roundedges 1;
    }
}

global proc Delete()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    vray addAttributesFromGroup $each vray_roundedges 0;
    }
}

global proc Enable()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdges") 1;
    }
}

global proc Disable()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdges") 0;
    }
}

global proc ConsiderEnable()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdgesConsiderSameObjectsOnly") 1;
    }
}

global proc ConsiderDisable()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdgesConsiderSameObjectsOnly") 0;
    }
}

global proc radiusslider()
{
  float $rad = `floatSliderGrp -q -value edgeLength `;
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
  {
    setAttr ($each + ".vrayRoundEdgesRadius") $rad;
  }
}

global proc CornerMenu()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdgesCorners") 0;
{
if (`attributeExists vrayRoundEdgesCorners $each`) {
if (`optionMenuGrp -q -v Cmenu` == "Convex and Concave") {
 vraySetAttr("$each", "vrayRoundEdgesCorners", "0", "int");
}
else if (`optionMenuGrp -q -v Cmenu` == "Convex Only") {
 vraySetAttr("$each", "vrayRoundEdgesCorners", "1", "int");
}
else if (`optionMenuGrp -q -v Cmenu` == "Concave Only") {
 vraySetAttr("$each", "vrayRoundEdgesCorners", "2", "int");
}
}
}
    }
}&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 24 Mar 2021 12:28:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-03-24T12:28:38Z</dc:date>
    <item>
      <title>Mel Script newbie Questions.(slider, optionmenu for vray)</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/mel-script-newbie-questions-slider-optionmenu-for-vray/m-p/10182386#M4550</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Creating a V-ray 'Round edge' script.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But there's a problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It was 'slider' and 'option menu'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It was okay until the UI was created.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But there was a problem connecting the function to the button.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Slider and option menu are the problems.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I don't know what the problem is when I check.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need your help. please&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm posting a script here, so please review it.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;window -title "Vray Round Edges" -widthHeight 350 200;
  columnLayout -adjustableColumn true;
    frameLayout -label "Add / Delete" -collapsable true -collapse true;
      rowLayout -numberOfColumns 2 -columnWidth2 70 70 -columnAttach 1 "both" 5 -columnAttach 2 "both" 5;
      button -l "Add" -c "Add"; button -l "Delete" -c "Delete";
      setParent ..;
    setParent ..;

    frameLayout -label "Round edges" -collapsable true -collapse true;
      columnLayout;
      checkBox -l "Enable Round Edges" -v 1 -onc "Enable" -ofc "Disable";
      text -align left -l "";
      text -align left -l "Radius";
      floatSliderGrp -field 1 -precision 3 -min 0 -max 1 -fmn -100 -fmx -100 radiusslider;
      text -l "";
      checkBox -l "Consider Same Objects Only" -v 1 -onc "ConsiderEnable" -ofc "ConsiderDisable";
      optionMenuGrp -l "Corners" -cc "CornerMenu" Cmenu;
        menuItem -l "Convex and Concave";
        menuItem -l "Convex only";
        menuItem -l "Concave only";
        setParent ..;
      setParent ..;
    setParent ..; 
showWindow;

global proc Add()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes)
    {
    vray addAttributesFromGroup $each vray_roundedges 1;
    }
}

global proc Delete()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    vray addAttributesFromGroup $each vray_roundedges 0;
    }
}

global proc Enable()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdges") 1;
    }
}

global proc Disable()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdges") 0;
    }
}

global proc ConsiderEnable()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdgesConsiderSameObjectsOnly") 1;
    }
}

global proc ConsiderDisable()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdgesConsiderSameObjectsOnly") 0;
    }
}

global proc radiusslider()
{
  float $rad = `floatSliderGrp -q -value edgeLength `;
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
  {
    setAttr ($each + ".vrayRoundEdgesRadius") $rad;
  }
}

global proc CornerMenu()
{
  string $mySelection[] = `ls -sl`;
  string $shapes[] = `listRelatives -shapes -path $mySelection`;
  for($each in $shapes) 
    {
    setAttr ($each + ".vrayRoundEdgesCorners") 0;
{
if (`attributeExists vrayRoundEdgesCorners $each`) {
if (`optionMenuGrp -q -v Cmenu` == "Convex and Concave") {
 vraySetAttr("$each", "vrayRoundEdgesCorners", "0", "int");
}
else if (`optionMenuGrp -q -v Cmenu` == "Convex Only") {
 vraySetAttr("$each", "vrayRoundEdgesCorners", "1", "int");
}
else if (`optionMenuGrp -q -v Cmenu` == "Concave Only") {
 vraySetAttr("$each", "vrayRoundEdgesCorners", "2", "int");
}
}
}
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Mar 2021 12:28:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/mel-script-newbie-questions-slider-optionmenu-for-vray/m-p/10182386#M4550</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-24T12:28:38Z</dc:date>
    </item>
  </channel>
</rss>

