Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BlenderPhi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raas
BlenderPhi
Commits
4d1f58eb
Commit
4d1f58eb
authored
Mar 3, 2004
by
Joseph Gilbert
Browse files
Options
Downloads
Patches
Plain Diff
- set/get Euler works with the real thing now
- ability to set the object's matrix
parent
8771b2eb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/blender/python/api2_2x/Object.c
+55
-17
55 additions, 17 deletions
source/blender/python/api2_2x/Object.c
source/blender/python/api2_2x/Object.h
+2
-0
2 additions, 0 deletions
source/blender/python/api2_2x/Object.h
with
57 additions
and
17 deletions
source/blender/python/api2_2x/Object.c
+
55
−
17
View file @
4d1f58eb
...
@@ -112,7 +112,8 @@ static PyObject *Object_materialUsage (BPy_Object *self, PyObject *args);
...
@@ -112,7 +112,8 @@ static PyObject *Object_materialUsage (BPy_Object *self, PyObject *args);
static
PyObject
*
Object_setDeltaLocation
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setDeltaLocation
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setDrawMode
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setDrawMode
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setDrawType
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setDrawType
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setEuler
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setEuler
(
BPy_Object
*
self
,
PyObject
*
args
);
\
static
PyObject
*
Object_setMatrix
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setIpo
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setIpo
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setLocation
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setLocation
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setMaterials
(
BPy_Object
*
self
,
PyObject
*
args
);
static
PyObject
*
Object_setMaterials
(
BPy_Object
*
self
,
PyObject
*
args
);
...
@@ -194,6 +195,8 @@ Possible arguments (provide as strings):\n\
...
@@ -194,6 +195,8 @@ Possible arguments (provide as strings):\n\
{
"setEuler"
,
(
PyCFunction
)
Object_setEuler
,
METH_VARARGS
,
{
"setEuler"
,
(
PyCFunction
)
Object_setEuler
,
METH_VARARGS
,
"Set the object's rotation according to the specified Euler
\n
\
"Set the object's rotation according to the specified Euler
\n
\
angles. The argument must be a vector triple"
},
angles. The argument must be a vector triple"
},
{
"setMatrix"
,
(
PyCFunction
)
Object_setMatrix
,
METH_VARARGS
,
"Set and apply a new matrix for the object"
},
{
"setLocation"
,
(
PyCFunction
)
Object_setLocation
,
METH_VARARGS
,
{
"setLocation"
,
(
PyCFunction
)
Object_setLocation
,
METH_VARARGS
,
"Set the object's location. The first argument must be a vector
\n
\
"Set the object's location. The first argument must be a vector
\n
\
triple."
},
triple."
},
...
@@ -737,15 +740,15 @@ static PyObject *Object_getDrawType (BPy_Object *self)
...
@@ -737,15 +740,15 @@ static PyObject *Object_getDrawType (BPy_Object *self)
static
PyObject
*
Object_getEuler
(
BPy_Object
*
self
)
static
PyObject
*
Object_getEuler
(
BPy_Object
*
self
)
{
{
PyObject
*
attr
=
Py_BuildValue
(
"fff"
,
EulerObject
*
eul
;
self
->
object
->
rot
[
0
],
self
->
object
->
rot
[
1
],
self
->
object
->
rot
[
2
]);
if
(
attr
)
return
(
attr
);
eul
=
(
EulerObject
*
)
newEulerObject
(
NULL
);
eul
->
eul
[
0
]
=
self
->
object
->
rot
[
0
];
eul
->
eul
[
1
]
=
self
->
object
->
rot
[
1
];
eul
->
eul
[
2
]
=
self
->
object
->
rot
[
2
];
return
(
PyObject
*
)
eul
;
return
(
PythonReturnErrorObject
(
PyExc_RuntimeError
,
"couldn't get Object.drot attributes"
));
}
}
static
PyObject
*
Object_getInverseMatrix
(
BPy_Object
*
self
)
static
PyObject
*
Object_getInverseMatrix
(
BPy_Object
*
self
)
...
@@ -1178,15 +1181,30 @@ static PyObject *Object_setEuler (BPy_Object *self, PyObject *args)
...
@@ -1178,15 +1181,30 @@ static PyObject *Object_setEuler (BPy_Object *self, PyObject *args)
float
rot2
;
float
rot2
;
float
rot3
;
float
rot3
;
int
status
;
int
status
;
PyObject
*
ob
;
if
(
!
PyArg_ParseTuple
(
args
,
"O"
,
&
ob
))
return
(
PythonReturnErrorObject
(
PyExc_AttributeError
,
"unknown type passed to function (setEuler)"
));
//test to see if it's a list or a euler
if
(
PyList_Check
(
ob
)){
if
(
PyObject_Length
(
args
)
==
3
)
if
(
PyObject_Length
(
args
)
==
3
)
status
=
PyArg_ParseTuple
(
args
,
"fff"
,
&
rot1
,
&
rot2
,
&
rot3
);
status
=
PyArg_ParseTuple
(
args
,
"fff"
,
&
rot1
,
&
rot2
,
&
rot3
);
else
else
status
=
PyArg_ParseTuple
(
args
,
"(fff)"
,
&
rot1
,
&
rot2
,
&
rot3
);
status
=
PyArg_ParseTuple
(
args
,
"(fff)"
,
&
rot1
,
&
rot2
,
&
rot3
);
if
(
!
status
)
if
(
!
status
)
return
EXPP_ReturnPyObjError
(
PyExc_AttributeError
,
return
EXPP_ReturnPyObjError
(
PyExc_AttributeError
,
"expected list argument of 3 floats"
);
"expected list argument of 3 floats"
);
}
else
if
(
EulerObject_Check
(
ob
)){
rot1
=
((
EulerObject
*
)
ob
)
->
eul
[
0
];
rot2
=
((
EulerObject
*
)
ob
)
->
eul
[
1
];
rot3
=
((
EulerObject
*
)
ob
)
->
eul
[
2
];
}
else
{
Py_DECREF
(
ob
);
return
(
PythonReturnErrorObject
(
PyExc_AttributeError
,
"expected list of floats or euler"
));
}
self
->
object
->
rot
[
0
]
=
rot1
;
self
->
object
->
rot
[
0
]
=
rot1
;
self
->
object
->
rot
[
1
]
=
rot2
;
self
->
object
->
rot
[
1
]
=
rot2
;
...
@@ -1196,6 +1214,26 @@ static PyObject *Object_setEuler (BPy_Object *self, PyObject *args)
...
@@ -1196,6 +1214,26 @@ static PyObject *Object_setEuler (BPy_Object *self, PyObject *args)
return
(
Py_None
);
return
(
Py_None
);
}
}
static
PyObject
*
Object_setMatrix
(
BPy_Object
*
self
,
PyObject
*
args
)
{
MatrixObject
*
mat
;
int
x
,
y
;
if
(
!
PyArg_ParseTuple
(
args
,
"O!"
,
&
matrix_Type
,
&
mat
))
return
EXPP_ReturnPyObjError
(
PyExc_TypeError
,
"expected matrix object as argument"
);
for
(
x
=
0
;
x
<
4
;
x
++
){
for
(
y
=
0
;
y
<
4
;
y
++
){
self
->
object
->
obmat
[
x
][
y
]
=
mat
->
matrix
[
x
][
y
];
}
}
apply_obmat
(
self
->
object
);
Py_INCREF
(
Py_None
);
return
(
Py_None
);
}
static
PyObject
*
Object_setIpo
(
BPy_Object
*
self
,
PyObject
*
args
)
static
PyObject
*
Object_setIpo
(
BPy_Object
*
self
,
PyObject
*
args
)
{
{
PyObject
*
pyipo
=
0
;
PyObject
*
pyipo
=
0
;
...
@@ -1778,7 +1816,7 @@ static int Object_setAttr (BPy_Object *obj, char *name, PyObject *value)
...
@@ -1778,7 +1816,7 @@ static int Object_setAttr (BPy_Object *obj, char *name, PyObject *value)
{
{
/* This is not allowed. */
/* This is not allowed. */
PythonReturnErrorObject
(
PyExc_AttributeError
,
PythonReturnErrorObject
(
PyExc_AttributeError
,
"
Setting the matrix is not allowed.
"
);
"
Please use .setMatrix(matrix)
"
);
return
(
0
);
return
(
0
);
}
}
if
(
StringEqual
(
name
,
"colbits"
))
if
(
StringEqual
(
name
,
"colbits"
))
...
...
This diff is collapsed.
Click to expand it.
source/blender/python/api2_2x/Object.h
+
2
−
0
View file @
4d1f58eb
...
@@ -61,6 +61,8 @@
...
@@ -61,6 +61,8 @@
#include
"modules.h"
#include
"modules.h"
#include
"vector.h"
#include
"vector.h"
#include
"matrix.h"
#include
"matrix.h"
#include
"euler.h"
#include
"quat.h"
/* The Object PyType Object defined in Object.c */
/* The Object PyType Object defined in Object.c */
extern
PyTypeObject
Object_Type
;
extern
PyTypeObject
Object_Type
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment