Page Menu
Home
Search
Configure Global Search
Log In
Files
F3205
duplitruematrices.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
jean-michel soler (jms)
Nov 13 2013, 1:08 PM
Size
10 KB
Subscribers
None
duplitruematrices.patch
View Options
Index: source/blender/python/api2_2x/Object.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Object.c,v
retrieving revision 1.169
diff -u -r1.169 Object.c
--- source/blender/python/api2_2x/Object.c 16 Feb 2006 20:09:32 -0000 1.169
+++ source/blender/python/api2_2x/Object.c 21 Feb 2006 14:09:37 -0000
@@ -47,6 +47,7 @@
#include "DNA_oops_types.h"
#include "BKE_action.h"
+#include "BKE_anim.h"
#include "BKE_depsgraph.h"
#include "BKE_effect.h"
#include "BKE_font.h"
@@ -218,6 +219,11 @@
static PyObject *Object_makeParentVertex( BPy_Object * self, PyObject * args );
static PyObject *Object_materialUsage( void );
static PyObject *Object_getDupliVerts ( BPy_Object * self );
+static PyObject *Object_getDupliFrames ( BPy_Object * self );
+static PyObject *Object_getDupliGroup ( BPy_Object * self );
+static PyObject *Object_getDupliRot ( BPy_Object * self );
+static PyObject *Object_getDupliNoSpeed ( BPy_Object * self );
+static PyObject *Object_getDupliMatrices ( BPy_Object * self);
static PyObject *Object_getEffects( BPy_Object * self );
static PyObject *Object_setDeltaLocation( BPy_Object * self, PyObject * args );
static PyObject *Object_setDrawMode( BPy_Object * self, PyObject * args );
@@ -250,6 +256,10 @@
static PyObject *Object_addScriptLink( BPy_Object * self, PyObject * args );
static PyObject *Object_clearScriptLinks( BPy_Object * self, PyObject *args );
static PyObject *Object_setDupliVerts ( BPy_Object * self, PyObject * args );
+static PyObject *Object_setDupliFrames ( BPy_Object * self, PyObject * args );
+static PyObject *Object_setDupliGroup ( BPy_Object * self, PyObject * args );
+static PyObject *Object_setDupliRot ( BPy_Object * self , PyObject * args);
+static PyObject *Object_setDupliNoSpeed ( BPy_Object * self , PyObject * args);
static PyObject *Object_getPIStrength( BPy_Object * self );
static PyObject *Object_setPIStrength( BPy_Object * self, PyObject * args );
static PyObject *Object_getPIFalloff( BPy_Object * self );
@@ -474,7 +484,19 @@
{"getBoundBox", ( PyCFunction ) Object_getBoundBox, METH_NOARGS,
"Returns the object's bounding box"},
{"getDupliVerts", ( PyCFunction ) Object_getDupliVerts,
- METH_NOARGS, "Returns state of duplicates propertie"},
+ METH_VARARGS, "Returns state of duplicates propertie"},
+ {"getDupliFrames", ( PyCFunction ) Object_getDupliFrames,
+ METH_NOARGS, "Returns state of Frames duplicates propertie"},
+ {"getDupliGroup", ( PyCFunction ) Object_getDupliGroup,
+ METH_NOARGS, "Returns state of Group duplicates propertie"},
+ {"getDupliRot", ( PyCFunction ) Object_getDupliRot,
+ METH_NOARGS, "Returns state of Rot duplicates propertie"},
+ {"getDupliNoSpeed", ( PyCFunction ) Object_getDupliNoSpeed,
+ METH_NOARGS, "Returns state of Nospeed duplicates propertie"},
+ {"getDupliMatrices", ( PyCFunction ) Object_getDupliMatrices,
+ METH_NOARGS, "Returns of list of matrix for object duplicated \n\
+ by dupliframe or dupliverst state "},
+
{"makeDisplayList", ( PyCFunction ) Object_makeDisplayList,
METH_NOARGS,
"Update this object's Display List. Some changes like turning \n\
@@ -600,7 +622,16 @@
"() - Delete all scriptlinks from this object.\n"
"([s1<,s2,s3...>]) - Delete specified scriptlinks from this object."},
{"setDupliVerts", ( PyCFunction ) Object_setDupliVerts,
- METH_VARARGS, "() - set or reset duplicate child objects on all vertices"},
+ METH_VARARGS, "() - set or reset duplicate child objects on all vertices"},
+ {"setDupliFrames", ( PyCFunction ) Object_setDupliFrames,
+ METH_VARARGS, "- set or reset state of Frames duplicates propertie"},
+ {"setDupliGroup", ( PyCFunction ) Object_setDupliGroup,
+ METH_VARARGS, "- set or reset state of Group duplicates propertie"},
+ {"setDupliRot", ( PyCFunction ) Object_setDupliRot,
+ METH_VARARGS, "- set or reset state of Rot duplicates propertie"},
+ {"setDupliNoSpeed", ( PyCFunction ) Object_setDupliNoSpeed,
+ METH_VARARGS, "- set or reset state of Nospeed duplicates propertie"},
+
{"insertShapeKey", ( PyCFunction ) Object_insertShapeKey,
METH_NOARGS, "() - Insert a Shape Key in the current object"},
{NULL, NULL, 0, NULL}
@@ -3075,6 +3106,140 @@
return Py_None;
}
+static PyObject *Object_getDupliFrames ( BPy_Object * self ) {
+ if (self->object->transflag & OB_DUPLIFRAMES)
+ return EXPP_incr_ret_True ();
+ else
+ return EXPP_incr_ret_False();
+}
+
+static PyObject *Object_setDupliFrames ( BPy_Object * self, PyObject * args ) {
+ int setting= 0;
+ if( !PyArg_ParseTuple( args, "i", &setting ) ) {
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "expected a string") );
+ }
+ if (self && self->object) {
+ if (setting)
+ self->object->transflag |= OB_DUPLIFRAMES;
+ else
+ self->object->transflag &= ~OB_DUPLIFRAMES;
+ }
+ return Py_None;
+}
+
+static PyObject *Object_getDupliGroup ( BPy_Object * self ) {
+ if (self->object->transflag & OB_DUPLIGROUP)
+ return EXPP_incr_ret_True ();
+ else
+ return EXPP_incr_ret_False();
+}
+
+static PyObject *Object_setDupliGroup ( BPy_Object * self, PyObject * args ) {
+ int setting= 0;
+ if( !PyArg_ParseTuple( args, "i", &setting ) ) {
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "expected a string") );
+ }
+ if (self && self->object) {
+ if (setting)
+ self->object->transflag |= OB_DUPLIGROUP;
+ else
+ self->object->transflag &= ~OB_DUPLIGROUP;
+ }
+ return Py_None;
+}
+
+static PyObject *Object_getDupliRot ( BPy_Object * self ) {
+ if (self->object->transflag & OB_DUPLIROT)
+ return EXPP_incr_ret_True ();
+ else
+ return EXPP_incr_ret_False();
+}
+
+static PyObject *Object_setDupliRot ( BPy_Object * self, PyObject * args ) {
+ int setting= 0;
+ if( !PyArg_ParseTuple( args, "i", &setting ) ) {
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "expected a string") );
+ }
+ if (self && self->object) {
+ if (setting)
+ self->object->transflag |= OB_DUPLIROT;
+ else
+ self->object->transflag &= ~OB_DUPLIROT;
+ }
+ return Py_None;
+}
+
+static PyObject *Object_getDupliNoSpeed ( BPy_Object * self ) {
+ if (self->object->transflag & OB_DUPLINOSPEED)
+ return EXPP_incr_ret_True ();
+ else
+ return EXPP_incr_ret_False();
+}
+
+static PyObject *Object_setDupliNoSpeed ( BPy_Object * self, PyObject * args ) {
+ int setting= 0;
+ if( !PyArg_ParseTuple( args, "i", &setting ) ) {
+ return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
+ "expected a string") );
+ }
+ if (self && self->object) {
+ if (setting)
+ self->object->transflag |= OB_DUPLINOSPEED;
+ else
+ self->object->transflag &= ~OB_DUPLINOSPEED;
+ }
+ return Py_None;
+}
+
+
+static PyObject *Object_getDupliMatrices ( BPy_Object * self )
+ {
+ PyObject *dupli_objects_list;
+ Object *ob=self->object;
+ Scene *sce=G.scene;
+ dupli_objects_list= PyList_New( 0 );
+
+ if( !dupli_objects_list )
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "PyList_New() failed" );
+
+ if(ob->transflag & OB_DUPLI)
+ {
+ /* before make duplis, update particle for current frame */
+ if(ob->transflag & OB_DUPLIVERTS)
+ {
+ PartEff *paf= give_parteff(ob);
+ if(paf)
+ {
+ if(paf->flag & PAF_ANIMATED) build_particle_system(ob);
+ }
+ }
+ if(ob->type!=OB_MBALL)
+ {
+ DupliObject *dob;
+ ListBase *lb= object_duplilist(sce, ob);
+ dob = lb->first;
+ while(dob)
+ {
+ if( PyList_Append( dupli_objects_list,
+ newMatrixObject((float*)dob->mat,4,4,Py_WRAP)
+ ) < 0 )
+ {
+ Py_DECREF( dupli_objects_list );
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "Couldn't append item to PyList" );
+ }
+ dob= dob->next;
+ }
+ free_object_duplilist(lb);
+ }
+ }
+ return dupli_objects_list;
+ }
+
static PyObject *Object_getEffects( BPy_Object * self )
{
PyObject *effect_list;
@@ -3473,18 +3638,6 @@
if( StringEqual( name, "DupOff" ) )
return ( !PyArg_Parse( value, "h", &( object->dupoff ) ) );
- if( StringEqual( name, "Dupliframes" ) ) {
- short dupli;
- if ( !PyArg_Parse( value, "h", &dupli ) )
- return -1;
-
- if (dupli)
- obj->object->transflag |= OB_DUPLIFRAMES;
- else
- obj->object->transflag &= ~OB_DUPLIFRAMES;
-
- return 0;
- }
if( StringEqual( name, "colbits" ) )
return ( !PyArg_Parse( value, "h", &( object->colbits ) ) );
Index: source/blender/python/api2_2x/doc/Object.py
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/doc/Object.py,v
retrieving revision 1.61
diff -u -r1.61 Object.py
--- source/blender/python/api2_2x/doc/Object.py 16 Feb 2006 20:09:32 -0000 1.61
+++ source/blender/python/api2_2x/doc/Object.py 21 Feb 2006 14:06:18 -0000
@@ -517,6 +517,53 @@
@return: a boolean value.
"""
+ def getDupliFrames():
+ """
+ Get state of DupliFrames animation property
+ @return: a boolean value.
+ """
+
+ def getDupliGroup():
+ """
+ Get state of DupliGroup animation property
+ @return: a boolean value.
+ """
+
+ def getDupliRot():
+ """
+ Get state of DupliRot animation property
+ @return: a boolean value.
+ """
+
+ def getDupliNoSpeed():
+ """
+ Get state of DupliRot animation property
+ @return: a boolean value.
+ """
+
+ def getDupliMatrices():
+ """
+ Returns of list of matrices for object duplicated
+ by dupliframe or dupliverts animation functions .
+ @return: list of four lists of float value
+
+ I{B{Example:}}
+
+ import Blender
+ from Blender import Object, Scene, Mathutils
+
+ OBJET=Object.Get('Cube')
+ DUPLIOBJET=OBJET.getDupliMatrices()
+ SCENE=Scene.GetCurrent()
+
+ for O in DUPLIOBJET:
+ print DUPLIOBJET.index(O)
+ E=Object.New('Empty')
+ SCENE.link(E)
+ E.setMatrix(O)
+ Blender.Redraw()
+ """
+
def insertIpoKey(keytype):
"""
Inserts keytype values in object ipo at curframe. Uses module constants.
@@ -906,6 +953,24 @@
def setDupliVerts(data):
"""
Set state of DupliVerts animation property
+ @param data: boolean value True, False, 0 or not 0.
+ """
+
+ def setDupliFrames(data):
+ """
+ Set state of DupliFrames animation property
+ @param data: boolean value True, False, 0 or not 0.
+ """
+
+ def setDupliRot(data):
+ """
+ Set state of DupliRot animation property
+ @param data: boolean value True, False, 0 or not 0.
+ """
+
+ def setDupliNoSpeed (data):
+ """
+ Set state of DupliNoSpeed animation property
@param data: boolean value True, False, 0 or not 0.
"""
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0f/85/754884fd8eab4800ca16a24bf5cb
Event Timeline
Log In to Comment