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
   
 
“Record Animated” Call Command Python Code Help
Posted: 17 September 2020 01:19 AM   [ Ignore ]  
Total Posts:  5
Joined  2020-08-19

Hi again Dr. Sassi

Sorry for bothering you again with this, but I need help with this code:
——————————————————
import c4d
#Welcome to the world of Python


def main():
  pass #put in your code here
  onoff = op[c4d.ID_USERDATA, 1]
  if onoff == 1:
      c4d.CallCommand(202665) # Record Animated
——————————————————-

This is applied on a Python Tag with a User Data (Boolean). I am new to this C4D Python coding (but I have good grasp of the coding basics). I feel like in theory this works, but the “c4d.CallCommand(202665) (call command for record animated) does not seem to work when I turn on the User Data (Boolean). I tried soloing the line using the standalone Python script (written from Script Manager), and it works just fine:
——————- Code from Script Manager that works———————-
import c4d
from c4d import gui
# Welcome to the world of Python


# Script state in the menu or the command palette
# Return True or c4d.CMD_ENABLED to enable, False or 0 to disable
# Alternatively return c4d.CMD_ENABLED|c4d.CMD_VALUE to enable and check/mark
#def state():
#  return True

# Main function
def main():
  c4d.CallCommand(202665) # Record Animated

# Execute main()
if __name__==‘__main__’:
  main()

———————————————————————————————————-

I have tried everything I can, and this is my last resort. I really did not want to bother you, but I want to learn where this code went wrong. The first code above did not have any errors. I even used some print () codes to see, but it works just fine, just the call command does not work.

Thanks for reading

Profile
 
 
Posted: 17 September 2020 01:28 AM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Fowdy,

Thanks for the question, but sorry, Python should be discussed in the Maxon Developer Forum.

I have had mentioned it in your last thread
https://www.cineversity.com/forums/viewthread/4233/#17089
Post #1, last line.

For Python, THIS is the place to go:
https://plugincafe.maxon.net
This is the place with the best people to talk about Python and Cinema 4D.

I will add a little screen capture in the next post, with content that was discussed here many years ago in tutorials.

Perhaps this helps:
https://www.cineversity.com/wiki/Python:_DescIDs_and_Animation/

But please notice, R23 is now Python 3.7.7

I can give you only one tip, UserData should have a keyframe in R23, so an animation track is established. Secondly, right mouse click on the UserData Name and Go to Animation> Add keyframe Selection.

My best wishes

edited

 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: 17 September 2020 01:49 AM   [ Ignore ]   [ # 2 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

P.S.: In case of just the UserData, and how R23 has perhaps changed something, here is a little screen capture.

Again, I do not go into Python here in the forum; the people over at the Developer Forum are top-notch, which is the quality I like you to enjoy.

Screen capture
https://www.amazon.com/clouddrive/share/l7aPh6ObPqynq6MNEDISbpJFxrKHc0bSVvCf2nmkrOK

Note that the icon can be rendered and will show up after saving. Also, Customize-Command allows us to set short cuts.

 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: 17 September 2020 05:25 AM   [ Ignore ]   [ # 3 ]  
Total Posts:  5
Joined  2020-08-19

I actually posted at pluginscafe 2 times with the same username (since I remember you told me about it), and no one wants to help me there for some reason. But, I will try your suggestion! thank you

Profile
 
 
Posted: 17 September 2020 05:34 AM   [ Ignore ]   [ # 4 ]  
Administrator
Avatar
Total Posts:  12043
Joined  2011-03-04

Hi Fowdy,

So sorry to hear that. Fingers crossed, there will be more.

Have you tried to use: Timeline> Function> Bake Data
While Bake-Expression is checked? Perhaps as copy for a test run?

All the best


P.S.
https://www.cineversity.com/wiki/Python:_Generator/

 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