Advanced Member thinkinmonkey Posted April 13, 2017 Advanced Member Report Share Posted April 13, 2017 Hello, I'm writing a simply script to help me creating clip mask layer for the selected one, I don't know if 3DC has a command for it. So at the moment, I take the current layer name, I create a new layer with the "m_" + the current layer name, but I don't know how to fill the mask layer with a color and how to assign it to the current layer as clip mask. I'm reading the script guide, but I cannot find something useful. Please, can someone help me? Thank you The script till now: void main(){ SetModalDialogCallback("ModalDialogCallback"); string layerName; layerName = GetCurrentPaintLayerName(); AddPaintLayer("m_" + layerName); SetPaintLayerOpacity(0); // fill the layer // assign the layer as clip mask layer to layername SelectPaintLayer(layerName); } void ModalDialogCallback(){ } Quote Link to comment Share on other sites More sharing options...
Contributor ajz3d Posted April 13, 2017 Contributor Report Share Posted April 13, 2017 (edited) This should work: void main(){ string layerName; cmd("$FREEZE_TRANSP_INV"); layerName = GetCurrentPaintLayerName(); AddPaintLayer("m_" + layerName); string maskLayerName = GetCurrentPaintLayerName(); // Fill the layer with the currently selected material or color. cmd("$FILLLAYER1"); // Hide the mask. SetPaintLayerVisibility(false); SelectPaintLayer(layerName); // Set clip mask. cmd("$COMBOBOX_LinkedLayer" + maskLayerName); // Remove the freeze. cmd("$MENU_UNFREEZE_ALL"); } Note that it is not possible to select/deselect Smart Materials with scripting, so contents of the mask layer will use whatever material or color you have currently selected. It is okay, as 3D-Coat only looks up opacity when dealing with clip masks. Just make sure your active material or colour doesn't have an alpha. Edited April 13, 2017 by ajz3d Quote Link to comment Share on other sites More sharing options...
Advanced Member thinkinmonkey Posted April 13, 2017 Author Advanced Member Report Share Posted April 13, 2017 ajz3D, it seems to me it doesn't work. What I have is what you see in pictures: it seems to me it fills the painted layer, not the mask layer, which is empty. I tried to apply some of your instructions to my purpose/script, but the results is the same. Other than that, it doesn't link the mask layer into the clip mask option of the painted layer, it's empty. I'm using 3DC 4.7.20. By the way, where can I get a list of all commands you use in the cmd() instruction? Thank you. Quote Link to comment Share on other sites More sharing options...
Contributor ajz3d Posted April 13, 2017 Contributor Report Share Posted April 13, 2017 2 hours ago, thinkinmonkey said: ajz3D, it seems to me it doesn't work. What I have is what you see in pictures: it seems to me it fills the painted layer, not the mask layer, which is empty. I tried to apply some of your instructions to my purpose/script, but the results is the same. Other than that, it doesn't link the mask layer into the clip mask option of the painted layer, it's empty. I'm using 3DC 4.7.20. That's strange. It works fine on my end (4.7.26). You can try adding Step(1) after each line. 2 hours ago, thinkinmonkey said: By the way, where can I get a list of all commands you use in the cmd() instruction? There is no such list. To find a specific command, you must RMB+MMB click on a UI element. It will store its command in clipboard from which you can paste it to your code. Quote Link to comment Share on other sites More sharing options...
Advanced Member thinkinmonkey Posted April 13, 2017 Author Advanced Member Report Share Posted April 13, 2017 Ok, I see now, it works, it was a different version number. I still have strange behavior when using clip masks with layers and I have some corrupted files, I have to show the bug. Anyway, thank you for your help, really appreciated, I learnt a lot today. Happy Easter and have a nice weekend too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.