Update
1153
2025/scripts/modeling_tools/creaseplus/CreasePlus.mel
Normal file
BIN
2025/scripts/modeling_tools/creaseplus/CreasePlus_Doc.png
Normal file
|
After Width: | Height: | Size: 476 KiB |
452
2025/scripts/modeling_tools/creaseplus/CreasePlus_Extension1.mel
Normal file
@@ -0,0 +1,452 @@
|
||||
//AUTHOR : BAIDHIR HIDAIR © 2017.
|
||||
//don't modify , don't distribute.
|
||||
|
||||
//PP
|
||||
|
||||
if(!`polyCreaseCtx -ex "spWeightCtx"`){
|
||||
polyCreaseCtx -es 1 -r 1 "spWeightCtx";
|
||||
}
|
||||
///////////////////////////////////////////////////// LOCAL REALM
|
||||
|
||||
proc float spgetmaxf(float $valz[]){
|
||||
|
||||
int $tmp2 = $valz[0];
|
||||
|
||||
for($j = 0; $j < size($valz); $j++){
|
||||
|
||||
if($tmp2 < $valz[$j]){
|
||||
$tmp2 = $valz[$j];
|
||||
}
|
||||
}
|
||||
|
||||
return $tmp2;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////// GLOBAL REALM /////////////////////////////////////
|
||||
|
||||
global proc spSmartLvl(){
|
||||
|
||||
string $edges[] = `filterExpand -ex 1 -sm 32`;
|
||||
|
||||
|
||||
if(!`size $edges`){error;}
|
||||
|
||||
polyOptions -dce 0;
|
||||
|
||||
string $op[] = `listRelatives -p -f $edges`;
|
||||
|
||||
setAttr ($op[0] + ".osdSmoothTriangles") 1;
|
||||
|
||||
float $Wval[] = `polyCrease -q -v ($op[0] + ".e[*]")`;
|
||||
|
||||
float $higherW = `spgetmaxf $Wval`;
|
||||
|
||||
int $smtLvl = (int) `ceil $higherW`;
|
||||
|
||||
if($smtLvl < 1){$smtLvl = 1;}
|
||||
|
||||
setAttr ($op[0] + ".smoothLevel") ($smtLvl + 1);
|
||||
|
||||
}
|
||||
|
||||
global proc spFastCrease(){
|
||||
|
||||
if(size(`filterExpand -ex 1 -sm 12`)){
|
||||
polySelectConstraint -m 0 -dis; polySelectConstraint -m 3 -t 0x8000 -sm 1; polySelectConstraint -m 0 -dis;
|
||||
}
|
||||
|
||||
string $edges[] = `filterExpand -ex 1 -sm 32`;
|
||||
|
||||
if(!`size $edges`){ error "You must select edge components.\n";}
|
||||
|
||||
polyOptions -dce 0;
|
||||
|
||||
string $op[] = `listRelatives -p -f $edges`;
|
||||
|
||||
|
||||
setAttr ($op[0] + ".osdSmoothTriangles") 1;
|
||||
|
||||
setAttr ($op[0] + ".displaySmoothMesh") 2;
|
||||
|
||||
setToolTo "spWeightCtx";
|
||||
|
||||
scriptJob -cu 1 -ro 1 -e "PostToolChanged" "spSmartLvl";
|
||||
}
|
||||
|
||||
|
||||
global proc spNoCrease(){// Remove Crease / Weights
|
||||
|
||||
string $op[] = eval("listRelatives -p -f `eval(\"listRelatives -p -f `polyListComponentConversion -tv`\")`");
|
||||
|
||||
if(!`size $op`){ error "Select objects or components.\n"; }
|
||||
|
||||
string $opShape[] = `listRelatives -c -f $op`;
|
||||
|
||||
if(size(`filterExpand -ex 1 -sm 12`)){
|
||||
|
||||
polyOptions -dce 1;
|
||||
|
||||
for($i in $op){
|
||||
polyCrease -op 2 $i;
|
||||
setAttr ($opShape[0] + ".displaySmoothMesh") 2;
|
||||
}
|
||||
|
||||
select -r $op;
|
||||
}else{
|
||||
|
||||
polyOptions -dce 0;
|
||||
|
||||
polyCrease -op 1 `ls -sl -fl`;
|
||||
|
||||
setAttr ($opShape[0] + ".displaySmoothMesh") 2;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
global proc spSmoothOs(){ // Final Smooth
|
||||
|
||||
string $op[] = eval("listRelatives -p -f `eval(\"listRelatives -p -f `polyListComponentConversion -tv`\")`");
|
||||
|
||||
if(!`size $op`){error "You must select Object(s).\n";}
|
||||
|
||||
string $opShape[] = `listRelatives -c -f $op`;
|
||||
|
||||
polyOptions -dce 0; LowQualityDisplay;
|
||||
|
||||
for($i in $op){
|
||||
|
||||
|
||||
float $Wval[] = `polyCrease -q -v ($i + ".e[*]")`;
|
||||
|
||||
float $higherW = `spgetmaxf $Wval`;
|
||||
|
||||
int $smtLvl = (int) `ceil $higherW`;
|
||||
if($smtLvl < 1 || $smtLvl > 5){$smtLvl = 1;}
|
||||
|
||||
|
||||
string $Node[0] =`polySmooth $i`;
|
||||
|
||||
|
||||
string $ud[] = `listAttr -ud $i`;
|
||||
|
||||
for($j in $ud){
|
||||
deleteAttr -at $j $i;
|
||||
}
|
||||
|
||||
|
||||
addAttr -k 1 -ln "smoothLevel" -at "short" -dv ($smtLvl+1) -hnv 1 -min 0 -max 5 $i;
|
||||
|
||||
connectAttr ($i + ".smoothLevel") ($Node[0] + ".divisions");
|
||||
|
||||
}
|
||||
|
||||
select -r $op;
|
||||
|
||||
}
|
||||
|
||||
global proc smoothSg(){ // Smooth Based on Smoothing Groups
|
||||
|
||||
string $op[] = eval("listRelatives -p -f `eval(\"listRelatives -p -f `polyListComponentConversion -tv`\")`");
|
||||
|
||||
if(!`size $op`){error "You must select Objects.\n";}
|
||||
|
||||
|
||||
LowQualityDisplay;
|
||||
|
||||
|
||||
for($i in $op){
|
||||
|
||||
|
||||
polySelectConstraint -m 0 -dis; polySelectConstraint -m 3 -t 0x8000 -sm 1; polySelectConstraint -m 0 -dis;
|
||||
|
||||
if(size(`ls -sl -fl`)){polyCrease -op 2 $i; polyCrease -v 5.0 `ls -sl -fl`; }
|
||||
|
||||
|
||||
string $Node1[] = `polySmooth $i`;
|
||||
//basediv
|
||||
|
||||
polyCrease -op 2 $i;
|
||||
|
||||
string $ud[] = `listAttr -ud $i`;
|
||||
|
||||
for($j in $ud){
|
||||
deleteAttr -at $j $i;
|
||||
}
|
||||
|
||||
|
||||
addAttr -k 1 -ln "baseDiv" -at "short" -dv 2 -hnv 1 -min 0 -max 5 $i;
|
||||
|
||||
connectAttr ($i + ".baseDiv") ($Node1[0] + ".divisions");
|
||||
|
||||
string $Node2[] =`polySmooth $i`;
|
||||
//smoothdiv
|
||||
|
||||
|
||||
addAttr -k 1 -ln "smoothDiv" -at "short" -dv 1 -hnv 1 -min 0 -max 5 $i;
|
||||
|
||||
connectAttr ($i + ".smoothDiv") ($Node2[0] + ".divisions");
|
||||
}
|
||||
|
||||
select -r $op;
|
||||
}
|
||||
|
||||
global proc spCreasePreset(int $power){// Prefab of the creasing command
|
||||
|
||||
string $op[] = eval("listRelatives -p -f `eval(\"listRelatives -p -f `polyListComponentConversion -tv`\")`");
|
||||
|
||||
if(!`size $op`){error "Select Objects or components.\n"; }
|
||||
|
||||
polyOptions -dce 0;
|
||||
|
||||
|
||||
if(size(`filterExpand -ex 1 -sm 12`)){ // if objects are selected instead
|
||||
|
||||
for($i in $op){
|
||||
|
||||
polySelectConstraint -m 0 -dis; polySelectConstraint -m 3 -t 0x8000 -sm 1; polySelectConstraint -m 0 -dis;
|
||||
|
||||
if(!size(`ls -sl -fl`)){continue;}
|
||||
|
||||
|
||||
if($power == 1){
|
||||
polyCrease -op 2 $i;
|
||||
polyCrease -v 2.0;
|
||||
}else if($power == 2){
|
||||
polyCrease -op 2 $i;
|
||||
polyCrease -v 3.3;
|
||||
}else if($power == 3){
|
||||
polyCrease -op 2 $i;
|
||||
polyCrease -v 4.0;
|
||||
}else{
|
||||
error ("argument " + $power + " has no behavior, use 1, 2, 3 instead.\n");
|
||||
}
|
||||
|
||||
string $shape[0] = `listRelatives -c -f $i`;
|
||||
|
||||
setAttr ($shape[0] + ".osdSmoothTriangles") 1;
|
||||
|
||||
float $Wval[] = `polyCrease -q -v ($i + ".e[*]")`;
|
||||
|
||||
float $higherW = `spgetmaxf $Wval`;
|
||||
|
||||
int $smtLvl = (int) `ceil $higherW`;
|
||||
|
||||
if($smtLvl < 1){$smtLvl = 1;}
|
||||
|
||||
setAttr ($shape[0] + ".smoothLevel") ($smtLvl + 1);
|
||||
}
|
||||
select -r $op; HighQualityDisplay;
|
||||
}else{
|
||||
//components
|
||||
|
||||
if($power == 1){
|
||||
polyCrease -v 2.0;
|
||||
}else if($power == 2){
|
||||
polyCrease -v 3.0;
|
||||
}else if($power == 3){
|
||||
polyCrease -v 4.0;
|
||||
}else{
|
||||
error ("argument " + $power + " has no behavior, use 1, 2, 3 instead.\n");
|
||||
}
|
||||
|
||||
string $shape[0] = `listRelatives -c -f $op[0]`;
|
||||
|
||||
setAttr ($shape[0] + ".osdSmoothTriangles") 1;
|
||||
|
||||
float $Wval[] = `polyCrease -q -v ($op[0] + ".e[*]")`;
|
||||
|
||||
float $higherW = `spgetmaxf $Wval`;
|
||||
|
||||
int $smtLvl = (int) `ceil $higherW`;
|
||||
|
||||
if($smtLvl < 1){$smtLvl = 1;}
|
||||
|
||||
setAttr ($shape[0] + ".smoothLevel") ($smtLvl + 1);
|
||||
|
||||
|
||||
hilite; HighQualityDisplay;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
global proc spLevel(int $op){ //Utility for Levels of Weight and SubD
|
||||
|
||||
string $ops[] = eval("listRelatives -p -f `polyListComponentConversion -tv`");
|
||||
|
||||
if(!`size $ops`){error;}
|
||||
|
||||
string $edges[] = `filterExpand -ex 1 -sm 32`;
|
||||
|
||||
int $itr;
|
||||
|
||||
polyOptions -dce 0;
|
||||
|
||||
if($op == 1){//Lower Rez
|
||||
|
||||
for($i in $ops){
|
||||
|
||||
int $lvl = `getAttr ($i + ".smoothLevel")`;
|
||||
|
||||
setAttr ($i + ".smoothLevel ") ($lvl-1);
|
||||
|
||||
}
|
||||
|
||||
select -r $ops; HighQualityDisplay;
|
||||
|
||||
}else if($op == 2){//Higher Rez
|
||||
|
||||
for($i in $ops){
|
||||
|
||||
int $lvl = `getAttr ($i + ".smoothLevel")`;
|
||||
|
||||
setAttr ($i + ".smoothLevel ") ($lvl+1);
|
||||
}
|
||||
|
||||
select -r $ops; HighQualityDisplay;
|
||||
|
||||
}else if($op == 3){ //Lower Weight
|
||||
|
||||
for($i in $ops){
|
||||
|
||||
setAttr ($i + ".osdSmoothTriangles") 1;
|
||||
|
||||
float $Wval[] = `polyCrease -q -v ($i + ".e[*]")`;
|
||||
|
||||
float $higherW = `spgetmaxf $Wval`;
|
||||
|
||||
int $smtLvl = (int) `ceil $higherW`;
|
||||
|
||||
if($smtLvl < 1){$smtLvl = 1;}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for($j in $edges){
|
||||
polyCrease -v ($Wval[$itr] - 1) $j;
|
||||
$itr++;
|
||||
}
|
||||
|
||||
setAttr ($i + ".smoothLevel") ($smtLvl);
|
||||
|
||||
}
|
||||
|
||||
select -r $ops; HighQualityDisplay;
|
||||
|
||||
}else if($op == 4){ // Higher Weight
|
||||
|
||||
for($i in $ops){
|
||||
|
||||
setAttr ($i + ".osdSmoothTriangles") 1;
|
||||
|
||||
float $Wval[] = `polyCrease -q -v ($i + ".e[*]")`;
|
||||
|
||||
float $higherW = `spgetmaxf $Wval`;
|
||||
|
||||
int $smtLvl = (int) `ceil $higherW`;
|
||||
|
||||
if($smtLvl < 1){$smtLvl = 1;}
|
||||
|
||||
|
||||
|
||||
for($j in $edges){
|
||||
polyCrease -v ($Wval[$itr] + 1) $j;
|
||||
$itr++;
|
||||
}
|
||||
|
||||
setAttr ($i + ".smoothLevel") ($smtLvl + 2);
|
||||
}
|
||||
|
||||
select -r $ops; HighQualityDisplay;
|
||||
|
||||
}else{
|
||||
error ($op + " is not an option, Try with 1, 2, 3 , 4 instead.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
global proc spPhysicalCrease(){// physical Crease
|
||||
|
||||
global int $cp_maya_v1;
|
||||
|
||||
string $op[] = eval("listRelatives -p -f `eval(\"listRelatives -p -f `polyListComponentConversion -tv`\")`");
|
||||
|
||||
string $ControlNode[];
|
||||
|
||||
if(`currentCtx` == "cpCtx"){
|
||||
if(`cpIsBvlOp $op[0]`){
|
||||
select -r $op[0]; cpAttrSwitch; return;
|
||||
}
|
||||
}
|
||||
|
||||
if(size(`filterExpand -ex 1 -sm 12`)){
|
||||
|
||||
for($i in $op){
|
||||
|
||||
|
||||
select -r $i;
|
||||
|
||||
polySelectConstraint -m 0 -dis; polySelectConstraint -m 3 -t 0x8000 -sm 1; polySelectConstraint -m 0 -dis;
|
||||
|
||||
if($cp_maya_v1 > 2016){
|
||||
$ControlNode = `polyBevel3 -af 1 -oaf 0 -c 0 -sg 1 -sn 1 -sa 180 -o 0`;
|
||||
|
||||
}else{
|
||||
$ControlNode = `polyBevel3 -af 1 -oaf 0 -sg 1 -fn 1 -sa 180 -o 0`;
|
||||
|
||||
}
|
||||
|
||||
|
||||
string $ud[] = `listAttr -ud $i`;
|
||||
|
||||
for($j in $ud){
|
||||
deleteAttr -at $j $i;
|
||||
}
|
||||
|
||||
addAttr -ln "hOffset" -k 1 -at "doubleLinear" -hnv 1 -min 0 -dv 0.1 $i;
|
||||
|
||||
connectAttr ($i + ".hOffset") ($ControlNode[0] + ".offset");
|
||||
|
||||
addAttr -ln "hDivisions" -k 1 -at "long" -hnv 1 -min 0 -dv 1 $i;
|
||||
|
||||
connectAttr ($i + ".hDivisions") ($ControlNode[0] + ".segments");
|
||||
|
||||
}
|
||||
|
||||
select -r $op; cpAttrSwitch;
|
||||
|
||||
}else{
|
||||
if($cp_maya_v1 > 2016){
|
||||
$ControlNode = `polyBevel3 -af 1 -oaf 0 -c 0 -sg 1 -sn 1 -sa 180 -o 0`;
|
||||
|
||||
}else{
|
||||
$ControlNode = `polyBevel3 -af 1 -oaf 0 -sg 1 -fn 1 -sa 180 -o 0`;
|
||||
|
||||
}
|
||||
|
||||
string $ud[] = `listAttr -ud $op[0]`;
|
||||
|
||||
for($j in $ud){
|
||||
deleteAttr -at $j $op[0];
|
||||
}
|
||||
|
||||
addAttr -ln "hOffset" -k 1 -at "doubleLinear" -hnv 1 -min 0 -dv 0.1 $op[0];
|
||||
|
||||
connectAttr ($op[0] + ".hOffset") ($ControlNode[0] + ".offset");
|
||||
|
||||
addAttr -ln "hDivisions" -k 1 -at "long" -hnv 1 -min 0 -dv 1 $op[0];
|
||||
|
||||
connectAttr ($op[0] + ".hDivisions") ($ControlNode[0] + ".segments");
|
||||
|
||||
select -r $op; cpAttrSwitch;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
global proc spShowCreaseEd(){
|
||||
python "from maya.app.general import creaseSetEditor; creaseSetEditor.showCreaseSetEditor()";
|
||||
}
|
||||
31
2025/scripts/modeling_tools/creaseplus/__init__.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
CreasePlus MEL Tool Wrapper
|
||||
Provides Python interface to launch the CreasePlus MEL tool
|
||||
"""
|
||||
|
||||
import maya.cmds as cmds
|
||||
import maya.mel as mel
|
||||
import os
|
||||
|
||||
|
||||
def start():
|
||||
"""Launch CreasePlus MEL tool"""
|
||||
# Get the directory containing this script
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
icon_dir = os.path.join(script_dir, 'icons').replace('\\', '/')
|
||||
|
||||
# Set global MEL variable for icon path
|
||||
mel.eval(f'global string $cp_icon_path = "{icon_dir}/"')
|
||||
|
||||
# Source the MEL script
|
||||
mel_script = os.path.join(script_dir, 'CreasePlus.mel').replace('\\', '/')
|
||||
|
||||
try:
|
||||
mel.eval(f'source "{mel_script}"')
|
||||
mel.eval('cpUi')
|
||||
print(f"CreasePlus: UI launched successfully")
|
||||
except Exception as e:
|
||||
print(f"CreasePlus: Error launching UI: {e}")
|
||||
46
2025/scripts/modeling_tools/creaseplus/cp_(read)commands.txt
Normal file
@@ -0,0 +1,46 @@
|
||||
cpAttrSwitch;
|
||||
//Use to toggle between attributs, select object first.
|
||||
cpDisplayBool;
|
||||
//Perform boolean with operands display
|
||||
cpKeepBool;
|
||||
//perform boolean preserving the operands
|
||||
cpHbevel;
|
||||
//perform hBevel
|
||||
cpMirror;
|
||||
//Mirrors the mesh
|
||||
cpPanelBool;
|
||||
//Performs panel boolean : creates panel cutting/carving with operands
|
||||
cpMeshSlicer;
|
||||
//slice mesh with curve, select curve and mesh first.
|
||||
cpTglBoolv;
|
||||
//Toggle visibility of the boolean objects
|
||||
cpHedgeSel;
|
||||
//Select Hard edges of the selected objects
|
||||
cpShapeShifter;
|
||||
//triggers ShapeShifter if found on the disk
|
||||
cpGoz;
|
||||
//Send meshes to Zbrush, with nGon cleanup
|
||||
cpQsmooth;
|
||||
//Apply a 30 degree smoothing to selected objects are components
|
||||
cpHardDisplay;
|
||||
//Toggles display of hard edges in realtime
|
||||
cpmakeUV;
|
||||
//make UV based on hard edges
|
||||
cpCurveCham;
|
||||
//Perform curve bevel (must draw two curve point around a corner before use)
|
||||
cpTransferBevel;
|
||||
//transfer bevel settings from one object to the others
|
||||
cpCleanAttrs;
|
||||
//kills custom attributes of the objects
|
||||
cpBakThatNod;
|
||||
//Bake selected Node from the channel Box(select object then node)
|
||||
cpInstanceBool;
|
||||
// perform Instance bool
|
||||
|
||||
cpAttachCurve;
|
||||
cpCurveBool;
|
||||
cpCloseCurve;
|
||||
cpCurveMultiply;
|
||||
|
||||
cpUi;
|
||||
//Calls Crease+ 's UI
|
||||
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_bevel.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_bool.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_curve_attach.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_curve_bevel.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_curve_bool.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_curve_close.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_curve_draw.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_eye.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_goz.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_hard_display.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_keep_bool.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_mesh_slicer.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_mirror.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_panelbool.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_quicksmooth.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_sel_hard.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/cp_ss.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/sp_crease.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/sp_nocrease.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/sp_smooth.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
2025/scripts/modeling_tools/creaseplus/icons/sp_weight_tool.png
Normal file
|
After Width: | Height: | Size: 15 KiB |