Keyframe on visibility shows up orange
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/04/2011 at 21:01, xxxxxxxx wrote:
The visibility option is a combo box with three states.
So I'm not sure that doing this from the timeline curve (with it's infinite available values) is the best way to do it.Here's a different approach:
#This is an example of using Keyframe Selections to toggle an object's on/off/default visibility setting import c4d from c4d import gui def main() : fps = doc.GetFps() frame = doc.GetMinTime().GetFrame(fps) #set min time doc.SetTime(c4d.BaseTime(frame, fps)) #sets time slider to frame 0 obj = doc.GetActiveObject() obj.SetEditorMode(c4d.MODE_UNDEF) #Sets the default mode for visibilty id = c4d.DescID(c4d.ID_BASEOBJECT_VISIBILITY_EDITOR) #Assigns a variable to Visibilty obj.SetKeyframeSelection(id, 1) #Adds a Keyframe Selection to the Visibility c4d.CallCommand(12410) #Record Button doc.SetTime(c4d.BaseTime(frame +10, fps)) #sets time slider to frame 10 obj.SetEditorMode(c4d.MODE_OFF) #Sets the default mode for visibilty c4d.CallCommand(12410) #Record Button doc.SetTime(c4d.BaseTime(frame +20, fps)) #sets time slider to frame 20 obj.SetEditorMode(c4d.MODE_ON) #Sets the default mode for visibilty c4d.CallCommand(12410) #Record Button obj.SetKeyframeSelection(id, 0) #Removes the Keyframe Selection option obj.ClearKeyframeSelection() #Clears the Keyframe Selections c4d.EventAdd() if __name__=='__main__': main()
Keyframe Selections seem to be most useful when you want to execute the Record button. But only wish to record specific things instead of everything. So that you don't have to resort to diving into the timeline to do it.
But that's just a guess on my part.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2011 at 04:07, xxxxxxxx wrote:
Hi Scott,
Thanks! I think you're onto something there, I'll continue to experiment with it. The Record call works fine from within the Python Editor in the GUI, but from my tag plugin it doesn't for some reason. The setting of the editor/render mode works however, so it must be getting the correct object - it just does not set a key at that position.
Cheers
Michael -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2011 at 08:00, xxxxxxxx wrote:
I ran a very quick little test. And c4d.CallCommand(12410) works in the python tag for me.
However,
Using something like the SetTime function can cause it to fail if you don't have it set up properly inside the tag to happen only once at a specific time.
Because the code inside of the tag is constanly looping. And that's where you can easily run into trouble.Setting the scrubber to a frame and setting a key is a one time event. While a tag is one giant constantly running loop.
So if you don't have those things set up so they are only triggered once while the tag is running the entire code. You can get yourself into an infinite loop situation. And that will prevent the CallCommand() from working properly.Tags can be tricky that way.
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2011 at 09:25, xxxxxxxx wrote:
Do you know what the orangeyellow keyframe icon means exactly? Because while with the command(12410) I don't get any keys at all, with the key.SetValue() approach I at least get those (even though they do not work).
It almost feels like the keys are halfway set, but have not been properly commited? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2011 at 09:53, xxxxxxxx wrote:
Looks like FindCTrack() is also not working as expected? This (c4d.DescLevel(c4d.ID_BASEOBJECT_VISIBILITY_RENDER,c4d.DTYPE_LONG,0,)) returns TypeError: FindCTrack() takes no arguments (1 given), while with no argument at all it returns SystemError: .\source\embedding\interface\i_getargs\i_getargs.cpp:1355: bad argument to internal function
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2011 at 10:06, xxxxxxxx wrote:
To give you a better idea what I'm talking about... as you can see with my original approach the keys are written and they do hold the correct value (see on the right where it says Visible in Editor). However also not the orange bubbles in the attribute editor - the keys take no effect, the state is still at "default".
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2011 at 10:16, xxxxxxxx wrote:
Ok another update: in the same process I'm now setting a key for Position X - and that one shows up correctly. So it has to do specifically with the visibility tracks. Only I have no clue what....
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2011 at 10:24, xxxxxxxx wrote:
Yellow/orange means that the object has at least one key on it. But it has been moved and C4D is waiting for you to record another key.
It's a visual way to let the user know he/she has forgotten to set a new key for the changes they've just made.The CallCommand does work inside of a tag. But you have to make absolutely sure you're not running the code before it in an infinite loop, or else it won't work.
This is very easy to do. Don't assume you've got your code right...It's tricky.Put this code into your python tag. Then enable the "Frame Dependent" checkbox.
When you drag the scrubber it should create a key on the timeline. But only if the default visibility option is selected:import c4d #Enable the Frame Dependent checkbox so you can keep the tag from looping #when the scrubber is not being moved #This sometimes makes it easier to test out code in a tag #on = 0 #off = 1 #default= 2 def main() : obj = op.GetObject()#The object the python tag is on if obj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] == 2: # 2 is the "Default" visibility setting print "true" c4d.CallCommand(12410) #Record Button c4d.EventAdd()
*Notice how the the id numbers don't match the order in which they are listed in the combo box.
That might trip you up...It looks like a bug to me.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2011 at 10:38, xxxxxxxx wrote:
Hi Scott,
I'm pretty sure it's only running once since it's executed when I press a button, not automatically. I've output some debug messages and they only show up once too.
One thing to note is that the keyframe is not meant for the object the tag is on, that's a null. The tag creates a bunch of additional objects who then get keyframed. For position keys this works perfectly fine, it's just the visibility ones that fail. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/04/2011 at 12:59, xxxxxxxx wrote:
Ok, so I've finally found out what the problem was.... :nerd: I was a bit confused by the mentioning of Data Key vs. Value Key in the GUI and started digging in the C++ documentation... and guess what, there's a special command to set those keys. Unfortunately that's missing from the Python documentation, so, note to self: always check all docs.
Aaanyway, for future reference this is how you set a VALUE key, e.g. position etc:
key.SetValue(trackX.GetCurve(),o.GetAbsPos().x)and this is how you set a DATA key, e.g. visibility:
key.SetGeData(trackRender.GetCurve(),0L)Oh and I now also know what the orange bubble means: there's a keyframe, but the data is invalid.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/04/2011 at 23:25, xxxxxxxx wrote:
Use something like SetTime function can cause it to fail if you do not have it set up properly on the label in a specific time only once. Because there is a continuous cycle of the tag code. This is what you can easily run into trouble.
-
On 29/04/2014 at 06:27, xxxxxxxx wrote:
Hi guys, I am trying to figure out what the difference between a Value Key and a Data Key is, and what use cases there are for each of them. Can you please help me with this?
Also I noticed that between the value keys there is also a function curve displayed but there is none between the data keys. Why is that?