Page Menu
Home
Search
Configure Global Search
Log In
Files
F1802
scene_layer.txt
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Campbell Barton (campbellbarton)
Nov 13 2013, 1:00 PM
Size
3 KB
Subscribers
None
scene_layer.txt
View Options
Index: source/blender/python/api2_2x/Scene.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Scene.c,v
retrieving revision 1.28
diff -u -p -r1.28 Scene.c
--- source/blender/python/api2_2x/Scene.c 31 Mar 2005 18:49:52 -0000 1.28
+++ source/blender/python/api2_2x/Scene.c 20 Apr 2005 03:44:42 -0000
@@ -264,9 +264,12 @@ static PyObject *Scene_getAttr( BPy_Scen
if( strcmp( name, "name" ) == 0 )
attr = PyString_FromString( self->scene->id.name + 2 );
-
+
+ else if( strcmp( name, "Layer" ) == 0 )
+ attr = PyInt_FromLong( self->scene->lay );
+
else if( strcmp( name, "__members__" ) == 0 )
- attr = Py_BuildValue( "[s]", "name" );
+ attr = Py_BuildValue( "[ss]", "name", "Leyer" );
if( !attr )
@@ -300,16 +303,33 @@ static int Scene_setAttr( BPy_Scene * se
"SceneSetAttr: couldn't create PyTuple" );
/* Now we just compare "name" with all possible BPy_Scene member variables */
- if( strcmp( name, "name" ) == 0 )
+ if( strcmp( name, "name" ) == 0 ) {
error = Scene_setName( self, valtuple );
-
- else { /* Error: no member with the given name was found */
- Py_DECREF( valtuple );
+ /* valtuple won't be returned to the caller, so we need to DECREF it */
+ Py_DECREF( valtuple );
+
+ } else if( strcmp( name, "Layer" ) == 0 ) {
+ int newLayer;
+
+ if( ! PyArg_Parse( value, "i", &newLayer ) ) {
+ return EXPP_ReturnIntError( PyExc_AttributeError,
+ "expected int as bitmask" );
+ }
+
+ if( newLayer != 0 ) { /* make sure theres something to do */
+ self->scene->lay = newLayer;
+ /* If this is the current scene then apply the scene layer to the view layer*/
+ if (self->scene == G.scene)
+ G.vd->lay = newLayer;
+
+ Py_DECREF( Py_None );
+ return 0; /* normal exit */
+ }
+ } else { /* Error: no member with the given name was found */
return ( EXPP_ReturnIntError( PyExc_AttributeError, name ) );
}
-/* valtuple won't be returned to the caller, so we need to DECREF it */
- Py_DECREF( valtuple );
+
if( error != Py_None )
return -1;
Index: source/blender/python/api2_2x/doc/Scene.py
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/doc/Scene.py,v
retrieving revision 1.11
diff -u -p -r1.11 Scene.py
--- source/blender/python/api2_2x/doc/Scene.py 17 Aug 2004 04:26:00 -0000 1.11
+++ source/blender/python/api2_2x/doc/Scene.py 20 Apr 2005 03:44:43 -0000
@@ -76,6 +76,13 @@ class Scene:
================
This object gives access to Scene data in Blender.
@cvar name: The Scene name.
+ @cvar Layer: The scene layer. This value is a bitmask with one position
+ set for each of the 20 possible layers starting from the low order bit.
+ The easiest way to deal with these values in in hexadecimal notation.
+ Example::
+ scn.Layer = 0x04 # sets layer 3 ( bit pattern 0100 )
+ After setting the Layer value, call Blender.Redraw( -1 ) to update
+ the interface.
"""
def getName():
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e8/8f/effffe997506d606c17bbce5896f
Event Timeline
Log In to Comment