Layer Browser
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2011 at 04:51, xxxxxxxx wrote:
Hi everyone,
I'm looking for a way to access the switches on the active layer in the Layer Browser.
Is this possible?
I'm just starting out with Python for C4D, so a lot of this is very new to me.
Thanks. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2011 at 07:02, xxxxxxxx wrote:
You can use doc.GetLayerObjectRoot() to access the root of layers (only call GetDown() here!!).
If root.GetDown()!=None layers exist in the document, otherwise not. You can browse the hierarchy
of layers and check GetBit(c4d.BIT_ACTIVE) on each layer if its enabled.Cheers, Sebastian
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2011 at 07:24, xxxxxxxx wrote:
Thanks, that got me access to the layer name at least. Phew!
This is what I have so far:import c4d, math, random from c4d import bitmaps, documents, gui, modules, plugins, storage, utils def main() : c4d.CallCommand(100004738) # New Layer root = doc.GetLayerObjectRoot() root.GetDown().SetName("NEWLAYER") if __name__ == '__main__': main()
What I'm trying to do is change the switches on the layer, like Solo, Visible, etc.
I think I need to use SetLayerData, but cannot for the life of me get it to work.
Also, is there a more elegant way to create a layer other than CallCommand? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2011 at 22:33, xxxxxxxx wrote:
Hello. I found this bit of code on CGSociety. I cannot get it to work though. Neither can I find any documentation about ID_LAYER_LINK.
Can anyone help me out here?def main() : obj = doc.GetActiveObject() layer = obj[c4d.ID_LAYER_LINK] color = layer[c4d.ID_LAYER_COLOR] = c4d.Vector(0,0,0)# Sets layer color to black c4d.EventAdd() print color
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/03/2011 at 01:38, xxxxxxxx wrote:
I am (95%) convinced that GetLayerData and SetLayerData are not implemented yet. Can anyone please confirm this?
Using this code:import c4d, math, random from c4d import* def main() : c4d.CallCommand(100004738) # New Layer c4d.CallCommand(100004736) # Add Objects to Layer lay = op.GetLayerObject(doc) lay.SetName("NEWLAYER") lay.GetLayerData(doc, True) c4d.EventAdd() if __name__ == '__main__': main()
throws the error "AttributeError: 'c4d.documents.LayerObject' object has no attribute 'GetLayerData'"
****
Am I using it incorrectly? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/03/2011 at 02:34, xxxxxxxx wrote:
Yes, these methods are currently not implemented yet.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/03/2011 at 03:54, xxxxxxxx wrote:
Thanks again.
I'm curious how a newcomer is supposed to accomplish anything when the documentation is so badly misleading. The earlier function GetLayerObjectRoot() that you mentioned doesn't even exist in the docs, even though it's implemented. The reverse is true for Set and GetLayerData. They're in the docs, but don't actually exist.
Am I looking at the wrong docs? How is it that you are aware of these things? Are you a Maxon developer? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/03/2011 at 04:14, xxxxxxxx wrote:
Please note, the current documentation is still preliminary and will be updated. If a function is not part of the documentation, it was added in the latest C4D update.