A new version of Cineversity has been launched. This legacy site and its tutorials will remain accessible for a limited transition period

Visit the New Cineversity
   
 
Create simple scripts for loop selections (and other commands)?
Posted: 15 June 2018 06:02 AM   [ Ignore ]  
Avatar
Total Posts:  12
Joined  2014-09-14

Hi! In earlier versions of C4D (prior to R19) then I could right click on some attributes and select “Create script” to create my own basic scripts with some options already preset. For example, I could create a script for making a “closed loop selection” (or “Ring selection”, “open loop seelction” etc) and have the script first change to “Edge mode” and the change the loop selection options.. and then I just added a hotkey to run this script. Made my workflow a Little faster.

My old scripts won’t work in R19.. any tips on how I can create new script for this functionality?

Thanks!
Frederik

Profile
 
 
Posted: 15 June 2018 01:58 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Frederik,

Please have a look at the screen capture, this is a way that I use often.
https://www.amazon.com/clouddrive/share/LEdTEdxc94sHjTwgR0oDe4J67F34Xfb5caTQLA6YAv6

Please note that the undo options are not part of this, to get this as well, please have a look here:
https://www.cineversity.com/vidplaylist/python_scripting1/zero_out_script

More about scripting
https://www.cineversity.com/learn/scripting

Perhaps some useful scripts to explore are here
https://labs.maxon.net

All the best

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 28 June 2018 06:47 PM   [ Ignore ]   [ # 2 ]  
Avatar
Total Posts:  12
Joined  2014-09-14

Thanks for your quick reply Dr Sassi! Your screen capture solved all my problems, the new scripts are working perfectly. I will check out the other links as well. Many thanks again!

Profile
 
 
Posted: 28 June 2018 07:07 PM   [ Ignore ]   [ # 3 ]  
Avatar
Total Posts:  12
Joined  2014-09-14

OK, I have a following question.. I haven’t watched the “Zero Out script” tutorial yet, but is it possible to create a Python script (or any other c4d script) that is connected to “Switch Layout -> (to chosen layout)” so I can create a shortcut for quick layout switches between, for example, ‘Modeling’ and ‘UV editing’?

I tried to use the first method for this and copied the line ‘c4d.CallCommand(56000, 112) # Switch Layout’ to the ‘Script Manager’, but this didn’t work (not like in the video anyways).. This only generated a ‘folded menu button/icon’ for choosing layouts (like the default one on the top right).

Is it possible to make this work? It would be a nice feature for a quick workflow..

Profile
 
 
Posted: 28 June 2018 09:40 PM   [ Ignore ]   [ # 4 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

HI Frederik,

Thanks for the nice feedback.

I have to leave this question to more knowledgable people, as in this Maxon Forum:
http://www.plugincafe.com/forum/default.asp

I checked the
https://developers.maxon.net/docs/Cinema4DPythonSDK/html/index.html
but as often, I get lost and can’t find something like what you have asked for.

There was a thread -but I tried the script, and well, not working here. Look for yourself, if you like:
http://www.plugincafe.com/forum/forum_posts.asp?TID=7689

I checked as well the Customize Commands list, just in case if there is an option, but also here, I come back empty handed. Really sorry.

My best wishes.

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 29 June 2018 05:54 PM   [ Ignore ]   [ # 5 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

P.S.: that worked out great, thanks for posting your question over there. (I guess that you posted there, based on the question/time.)
http://www.plugincafe.com/forum/forum_posts.asp?TID=14291

I tested it and it works here. Create an icon and save it. In the Customize Commands you can then set a short cut, (if anyone has that question at all, writing for a forum)

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile
 
 
Posted: 30 June 2018 06:28 AM   [ Ignore ]   [ # 6 ]  
Avatar
Total Posts:  12
Joined  2014-09-14

Yes, that was me posting! smile I tried it myself, but I can’t make it load my layout? Not sure what I am doing wrong.. My script looks like this (just changed their example layout name to my layout name):

—-

import c4d
import os

def main():
  libPath = c4d.storage.GeGetC4DPath(c4d.C4D_PATH_LIBRARY)
  layoutPath = os.path.join(libPath, “layout”)
  animPath = os.path.join(layoutPath, “TENNET-modeling.l4d”)
  c4d.documents.LoadFile(animPath)

if __name__==‘__main__’:
  main()

—-

Can you see what is wrong in my script? Thanks again! smile

Best,
Frederik

Profile
 
 
Posted: 30 June 2018 07:00 AM   [ Ignore ]   [ # 7 ]  
Avatar
Total Posts:  12
Joined  2014-09-14

Hi again! I believe I managed to solve it myself.. I needed to add the first ‘CallCommand’ (for switching layouts) before the above code. Now it seems to work perfectly! Many thanks for the tips and scripting advice. This is something I’ve really been looking for and trying to fix for years… and all I needed was two days here. grin

Not an important question though, but thought it may be worth understanding.. But why are the CallCommands different when switching between different layouts? I noticed I couldn’t use the same CallCommand line for different “layout-switching-scripts” (the numbers between the brackets are different).

For example:

“c4d.CallCommand(56000, 112) # Switch Layout” (for calling my Modeling layout)
“c4d.CallCommand(56000, 113) # Switch Layout” (for calling my UV_Edit layout)

Thank you!

Frederik

Profile
 
 
Posted: 30 June 2018 11:10 AM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Frederik,

Great that you got what you where after. grin

I love first hand information, and with Python one gets this information in the forum you got this script from. It can’t be more first hand than that. This is the best source and you will find people who created the SDK for C4D there. Hence why I re-direct everyone to this forum.

You will find that the user l4d are in a different spot (Preferences) than the default l4d files. To keep things organized it should stay that way, but it works when you copy them over (to the App>library)and then the script works with personalized layouts. I guess the support team might not suggest this, as one might lose those with each update, but to understand it more, this might help.

In a nut shell, python works for me like a “mamushka puppet”, first one needs the main information (python language for c4d), then the document (where is it what we want>path), then the object in question, next shell, then the parts to work on, then parameter, then … then, until the smallest puppet is given and perhaps changed.

All the best

 Signature 

Dr. Sassi V. Sassmannshausen Ph.D.
Cinema 4D Mentor since 2004
Maxon Master Trainer, VES, DCS

Photography For C4D Artists: 200 Free Tutorials.
https://www.youtube.com/user/DrSassiLA/playlists

NEW:

NEW: Cineversity [CV4]

Profile