Navigation

    • Register
    • Login
    • Search
    • Categories
    • Forum Guidelines
    1. Home
    2. delizade
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by delizade

    • A GetClone problem about takes

      GetClone creates a take from a source take but its overrides are linked to source take. if I remove overrides from cloned take, original take's overrides also deleted. Is this a bug or GetClone produces a kind of instance object with linking to source object? How can I fix this? How can I break them from the source take?

      1. open attached c4d doc
      2. select Sphere take
      3. run this script
      4. script will clone sphare take under main take. Newly cloned take have 2 overrides: 1) for X location and 2) for layer properties.
      5. activate newly cloned Sphere take
      6. activate AutoTake and Lock Override buttons
      7. change Sphere's X location and/or sphare layer visibility values
      8. you will see that c4d will add another override lines under already existent overrides
      import c4d
      # Script clones selected take to under Main Take
      
      # AliasTrans did not work
          #trans = c4d.AliasTrans()
          #if trans is None or trans.Init(doc) is False:
          #    return False
          #clonedTake=selectedTake[0].GetClone(c4d.COPYFLAGS_0)
          #trans.Translate(False)
      
      def main():
          takeData = doc.GetTakeData()
          mainTake=takeData.GetMainTake()
          selectedTake=takeData.GetTakeSelection(0)
          doc.StartUndo()
          doc.AddUndo(c4d.UNDOTYPE_CHANGE, mainTake)
      
          clonedTake=selectedTake[0].GetClone(c4d.COPYFLAGS_0)
          clonedTake.InsertUnder(mainTake)
          doc.EndUndo()
          c4d.EventAdd()    
          #gui.MessageDialog('Hello World!')
      
      # Execute main()
      if __name__=='__main__':
          main()
      

      test.c4d

      posted in General Programming & Plugin Discussions
      delizade
    • RE: A problem about getting an object width value with python

      @a_block I tried your suggestion and it is working.

      First tag setting instance links. Tag priority: Generator and index: -1
      Second tag is getting width value and sets cube position with it. priority: Generator index:0

      I moved user data to null object instead of using it on python tag. (Some one have suggested this before for another issue but I don't understand why we should use user data on python tag instead of object)

      By the way after @zipit reply I tried to research about priority but could not find them in 3d4 doc. if you know a good page I would want to know it.

      thank you both again.

      posted in Cinema 4D Development
      delizade
    • RE: A problem about getting an object width value with python

      @a_block hi,
      thank you for the suggestion. I really did not think that using 2 tags instead of one. This may be work and thank you so much for this I hope it works (probably will work I'm guessing)

      posted in Cinema 4D Development
      delizade
    • RE: A problem about getting an object width value with python

      @zipit hi,
      thank you for your help. I tested it but in this case it can't get currently assigned linked object. Old shape assignment is staying after new shape assignment. if you have time you can see this by assigning different shape objects.

      posted in Cinema 4D Development
      delizade
    • A problem about getting an object width value with python

      Hello,
      I have an null container with a python tag. Object structure as below:
      Null
      --Loft Object
      ----start
      ----end
      --cube

      1. Python tag has a single user data that holds an object link value
      2. Loft object uses two instances: start and end.
      3. Their link values are assigned by python tag.
      4. and lastly I grab loft object's width value and use that value as cube object X location.

      problem is when I assign new value to loftShapeLink user data I can't get loft object's width value correctly. I have to trigger python tag again and that time it runs perfectly. As you can see in sample file, after new shape assignments instance object link value is correctly assigned but width value is not updated(I got previous value).

      How can I get correct width value after first execution of the script? This is a problem because I can't use takes to render scenes. Because when marked takes render is started scripts run only 1 time for active take and shape positions are not correctly rendered.

      Note: I have to use null containers for shapes just because axis points. I tried only shape objects as link objects but it is not effect the result.
      thank you
      getting_an_object_with_issue_python.c4d

      posted in Cinema 4D Development
      delizade
    • RE: How to use/import another script file in Python tag correctly?

      hi @x_nerve thank you for your time.
      code is not simple actually it has about 500 lines as far as I remember. To make scenario clear here I wrote very simple scripts. I needed to use external link for all python tags because that code is changing time to time (bug or new features etc) so with this way I change code in a single source.

      With this entry I had an "infinitely running script" problem and it was solved by removing "c4d.EventAdd()" line from external function. After this I had another issue with python tags. It was triggered whenever is changed in the scene. To prevent that I tried frame triggered python tags so with your answer it mixed with that issue below paragraph is my further step about the main topic)

      I've tried frame triggered tags but not by your way. I added null object and attach a python tag on it. This simple code watch current take changing and if take is changed it changes the frame so tags are triggered that way. Because I use takes. every take holds different data values. So when I changed active take, python tags has to be run.

      I will check your code as well currently I've been struggling with new issue about takes - user data - scene update :/
      thank you again.

      posted in Cinema 4D Development
      delizade
    • User data and take overriding issue

      Hi,
      I have a null object that has 3 user data variable on it. My take structure is like below. Every branch null object's data values are changed as mentioned below:

      • Main (data values are %1)
        ---- Step1 (data values are %2)
        ------- Step 1a_Change Data values : %10
        ------- Step 1a_Change Data values : %20
        ------- Step 1a_Change Data values : %30

      but, for example after data values are changed (while auto take and lock overrides are active) parent values are changing (Step1 and Main)

      My explanation may be confusing so you can find the scene file below. Please try to

      1. change Step1a, Step1b and Step1c (all of sub takes) and after changes go back to Step 1 and Main takes and see correct values
      2. again, try to change values of parent takes Step1a or Step1b or Step1c
        and make active Step 1 take or main take. you will see that values were changed with previous values.

      I tried to understand this behavior but I could not understand yet. could anyone know why parent take values are changing after sub take values are changed?

      (Cinema 4D Latest version)
      scene file:UserData_Take_problem.c4d

      thank you

      posted in Cinema 4D Development
      delizade
    • RE: How to use/import another script file in Python tag correctly?

      hi @r_gigante,
      I've created the scene again because I changed that workflow tons of time. You can find scene file and script. If I remove "c4d.EventAdd()" line from external code problem is gone.

      External Script file: customCode.py
      Scene file: externalPythonSample-infinity_problem.c4d

      thank you

      posted in Cinema 4D Development
      delizade
    • RE: How can I control a Python Tag's execution?

      thank you for that suggestion. I did not think that method frankly. I will try it.
      Currently I made all python tags as frame dependent. I wrote a script and assign it to a null object in my scene. This script checks current take and compare it previous one. If takes are different it changes current frame +1. In that way other python tags are running only one time.

      there is a issue but I could not achieve to solve it that as if some part of the script does not work properly :) anyway I guess your suggestion may help me rather than using frame dependent Python tags.

      thank you again.

      posted in Cinema 4D Development
      delizade
    • RE: How to use/import another script file in Python tag correctly?

      I've solved the issue
      c4d.EventAdd() was added end of my external function script. I removed it and used it in tag script. I think after that line python tag was triggered again.

      posted in Cinema 4D Development
      delizade
    • How to use/import another script file in Python tag correctly?

      Hello,

      I have 50 objects that every one of them should use a python tag. Tag Script will be same for 50 objects but that script will be changed time to time so I tried to import this script from python tags but code running infinitely. I placed my custom code (customCode.py) to "C:\Program Files\Maxon Cinema 4D R23\resource\modules\python\libs\python37" library and I added a python tag and its script is below:

      import c4d
      
      import customCode
      
      def main():
      
      print ("test")
      
      customCode.myFunction(op)
      

      my function is running correctly. But tag script runs infinitely. I printed "test" text and I could see this situation.

      Could anyone give me information what I did wrong here please?

      By the way customCode.py is like below:

      import c4d
      
      def myFunction(getObj):
      
      obj=getObj.GetObject()
      
      var1=obj[c4d.ID_USERDATA,9]
      
      posted in Cinema 4D Development
      delizade
    • How can I control a Python Tag's execution?

      Hello,
      I have 50 objects in my scene. Every object has user data values and python tag on it. After an object's user data is changed its python tag should run only one time.

      But scripts are running after whenever I changed something in the scene (or after clicking on Object manager panel's empty area too)
      I have to control this because script is a little bit heavy and my scene is heavy too. But every time scripts are running.

      Currently I disabled all of them. After I changed user data values of an object I execute script of that object manually. But this is a big problem actually because I use takes and user values are changed by takes. After changing active take, objects can't be refreshed via their scripts because I disabled them. So after changing active take I have to enable all python tags and disable them again. I can do this via script and a shortcut so after change active take I can re-enable tags and then disable again via that script but I wanted to ask this here.

      any idea about the situation? I hope I could explain my problem :/

      posted in Cinema 4D Development
      delizade
    • RE: "Current Take" doesn't override layer processes that made by scripting

      thank you for your help.

      posted in Cinema 4D Development
      delizade
    • "Current Take" doesn't override layer processes that made by scripting

      hi,

      I change layer properties via script and I need current take override those layer processes. But when I changed a property via scripting current take can't see any changins and does not override any data.

      How can I do that?

      layer_and_takes_problem.png

      posted in Cinema 4D Development
      delizade