Log in annotation tag (python)

Hello for everyone! Anybody know how to send changes of project in annotation tag?

What i mean when i talk about "changes". For example, you change position of light, color of material, position of object and so on.

As i understand i should convert changes in text and send it in tag, but i haven't got idea how to realise it.

The main idea of script:

  1. Pressing on the render button
  2. Null appears. It has the same name with render and it has an Annotation tag.
    The Annotation tag contains all changes in project.
  3. If you press the render button after that you wil have new null with new changes

It's a kind of memorization of log...

...and where would you get those changes from? Logging all activity in a scene? Or comparing the scene with a "previous" scene that you get from somewhere? Or analyzing the Undo stack? (Not sure whether that is even possible, and all undos are lost when you close the scene anyway.)

This is far from trivial.

My best approach would be to store the last scene state somewhere and then do a full comparison of all objects with the current state of the scene, including all parameters of interest. Which can be a lot; I wouldn't even be sure that an annotation tag can contain all changes that you do (e.g. moving points in a polygon object).

"...and where would you get those changes from?" That why i asked about it. Why is it mostly hardcore ideas that come to my mind...

Cairyn, thanks a lot for your answer!

As far as I know, C4D does not have an internal log of actions, so there is no easy way to access the activity history. Logging it directly would involve capturing the whole internal messaging, I don't think this is feasible.

If you're just looking for certain changes, then the comparison method is probably easiest (you can use the object's internal IDs to find out whether the hierarchy changed), as you only need to look for a predefined set of parameter changes. Although this requires storing the comparison scenes somewhere, so you need to have some agreement on how the directories on disk are supposed to be organized.

As a quick estimation, this would be a five-digit $/€ project (I'm not offering), but on the other hand you could start it slow with a small parameter set and then expand it over time.

hi,

I moved this topic to General Programming and discussions. As @Cairyn said, I'm not sure it's doable and for sure, it's a lot of work to do something like this.
We don't know if you are looking for somebody to implement such a tool or if you want to do it yourself. If you want to implement it yourself, you need to come with more direct question that we can answer. This idea is probably too wide and blurry for us to guide you.

Cheers,
Manuel

@m_magalhaes i want to write it by myself.

@Cairyn offer next way "My best approach would be to store the last scene state somewhere and then do a full comparison of all objects with the current state of the scene, including all parameters of interest."

To my mind it's a great variant.
But i haven't got any idea how to do it. I don't want to make a log for all changes it will be enough if i could do it for important parameteres of object.

@roman It is important that to recognize a change, you will need both the previous state and the current state. I recommended just storing the full scene in the previous state because then you are guaranteed to have all data available.

Of course, you may say "a full scene is too much, I just want to remember the previous state of the logged data snippets", but then you will still need to store these somewhere, and you'd end up with needing a file format of your own to store them to disk.

(You can store the old state in the scene by defining your own data set with all store/load functions, but good grief, what an effort! 😉 )

You will not escape the necessity to "remember in some form" the old states when you press your button. Losing that information means you don't have anything to compare against. Unless you want to monitor the full system, but I really don't think that is feasible.


Let me question something... do you really need to log the CHANGES? What you want is to store the "important parameters" of certain objects, which - looking at it realistically - will be a very small subset of all the data. (Havng a log that tells you e.g. that point 4837 in object xyz has been moved from position (0, 5.991, 7.634) to position (0.772, 5.991, 7.634) is going to be so large and overwhelming that it becomes utterly useless.)

Why don't you just put ALL the CURRENT data for these objects into the tag? So the annotation would say "the camera is x; the color of the flower is blue; the background is mybgr.hdri". No comparison, just the current data that you are using for this render.

It boils down to a deeper question: What is your usecase? How do you expect to use that data later on? Which data would be most useful in that situation?

Yes! Cairyn you are right! That's what i want to do. I want to remember the state of the object at a current render.

@cairyn said in Log in annotation tag (python):

Why don't you just put ALL the CURRENT data for these objects into the tag? So the annotation would say "the camera is x; the color of the flower is blue; the background is mybgr.hdri". No comparison, just the current data that you are using for this render.

@roman Well, that is much easier. Then you only need to extract the values of the parameters from the objects in question, put them into text form, and store them in the tag. Python is fairly string-friendly so this is not too difficult.

You just need to define the objects and parameters, and then research a way how to identify them (SearchObject, SearchMaterial, ...). For the extraction of the parameter IDs, you can use drag&drop into the Console, but I guess you know that already.