Added object.dupliGroup so objects can access the groups they instance.

This is very confusing.
Since in object has
ob.setDupliGroup() # Enable/Disable Dupligroup
ob.getDupliGroup() # see if its enabled.
ob.dupliGroup # the group data this object is instancing.

Not yet added
ob.groups # Groups that use this object.
This commit is contained in:
2006-03-18 17:24:59 +00:00
parent dc90a417cb
commit abab9fc3de
2 changed files with 26 additions and 2 deletions

View File

@@ -106,6 +106,7 @@ struct rctf;
#include "logic.h"
#include "Effect.h"
#include "Pose.h"
#include "Group.h"
#include "gen_utils.h"
#include "BIF_editkey.h"
@@ -3522,7 +3523,9 @@ static PyObject *Object_getAttr( BPy_Object * obj, char *name )
return PyInt_FromLong( obj->object->id.us );
if( StringEqual( name, "protectFlags" ) )
return PyInt_FromLong( obj->object->protectflag );
if( StringEqual( name, "dupliGroup" ) )
return Group_CreatePyObject( obj->object->dup_group );
/* not an attribute, search the methods table */
return Py_FindMethod( BPy_Object_methods, ( PyObject * ) obj, name );
}
@@ -3741,7 +3744,23 @@ static int Object_setAttr( BPy_Object * obj, char *name, PyObject * value )
object->protectflag = (short)flag;
return 0;
}
if( StringEqual( name, "dupliGroup" ) ) {
PyObject *pyob=NULL;
BPy_Group *pygrp=NULL;
Group *group;
if( !PyArg_Parse( value, "O", &pyob) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a group" ) );
if (pyob==Py_None) {
object->dup_group= NULL;
} else {
pygrp= (BPy_Group *)pyob;
object->dup_group= pygrp->group;
}
return 0;
}
/* SECOND, handle all the attributes that passes the value as a tuple to another function */

View File

@@ -261,6 +261,11 @@ class Object:
- bit 7: Y size
- bit 8: Z size
@type protectFlags: int
@ivar dupliGroup: The dupli group that this object is an instance of.
This does not enable or disable the dupligroup option, for that use
getDupliGroup and setDupliGroup.
The dupliGroup is None when this object does not have a dupliGroup.
@type dupliGroup: list of integers
"""
def buildParts():