2003-05-08 03:06:46 +00:00
|
|
|
/*
|
2004-09-18 18:47:03 +00:00
|
|
|
* $Id$
|
2003-05-08 03:06:46 +00:00
|
|
|
*
|
|
|
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version. The Blender
|
|
|
|
* Foundation also sells licenses for use in proprietary software under
|
|
|
|
* the Blender License. See http://www.blender.org/BL/ for information
|
|
|
|
* about this.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2003-12-14 01:18:09 +00:00
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
2003-05-08 03:06:46 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This is a new part of Blender.
|
|
|
|
*
|
2005-05-20 05:14:03 +00:00
|
|
|
* Contributor(s): Willian P. Germano, Tom Musgrove, Michael Reimpell,
|
|
|
|
* Yann Vernier, Ken Hughes
|
2003-05-08 03:06:46 +00:00
|
|
|
*
|
|
|
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
#include <Python.h>
|
|
|
|
|
Mathutils update
- also included is some fixes for preprocessor inclues and some clean up of the previous commit
-rewrite and bugfixes
----------------------------------
Here's my changelog:
-fixed Rand() so that it doesn't seed everytime and should generate better random numbers
- changed a few error return types to something more appropriate
- clean up of uninitialized variables & removal of unneccessary objects
- NMesh returns wrapped vectors now
- World returns wrapped matrices now
- Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
- Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
- Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
- Removed memory allocation (unneeded) from all methods
- Vector's resize methods are only applicable to new vectors not wrapped data.
- Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
- Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
- Euler.rotate does internal rotation now
- Slice assignment now works better for all types
- Vector * Vector and Quat * Quat are defined and return the DOT product
- Mat * Vec and Vec * Mat are defined now
- Moved #includes to .c file from headers. Also fixed prototypes in mathutils
- Added new helper functions for incref'ing to genutils
- Major cleanup of header files includes - include Mathutils.h for access to math types
- matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
- Matrix() with no parameters now returns an identity matrix by default not a zero matrix
- printf() now prints with 6 digits instead of 4
- printf() now prints output with object descriptor
- Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
- Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence. index cannot go above the row size of the matrix.
- slice operations on matrices work with sequences now (rows of the matrix) example: mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
- slice assignment will no longer modify the data if the assignment operation fails
- fixed error in matrix * scalar multiplication
- euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
- Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
- Quats can be created with angle/axis, axis/angle
- 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
- vec *quat / quat * vec is now defined
- vec.magnitude alias for vec.length
- all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
- these methods have been deprecated (still functioning but suggested to use the corrected functionality):
* CopyVec() - replaced by Vector() functionality
* CopyMat() - replaced by Matrix() functionality
* CopyQuat() - replace by Quaternion() functionality
* CopyEuler() - replaced by Euler() functionality
* RotateEuler() - replaced by Euler.rotate() funtionality
* MatMultVec() - replaced by matrix * vector
* VecMultMat() - replaced by vector * matrix
- New struct containers references to python object data or internally allocated blender data for wrapping
* Explaination here: math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
* otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
2005-07-14 03:34:56 +00:00
|
|
|
#include "BDR_editobject.h" /* enter / leave editmode */
|
|
|
|
#include "BKE_global.h"
|
2005-07-18 03:50:37 +00:00
|
|
|
#include "BKE_main.h"
|
Mathutils update
- also included is some fixes for preprocessor inclues and some clean up of the previous commit
-rewrite and bugfixes
----------------------------------
Here's my changelog:
-fixed Rand() so that it doesn't seed everytime and should generate better random numbers
- changed a few error return types to something more appropriate
- clean up of uninitialized variables & removal of unneccessary objects
- NMesh returns wrapped vectors now
- World returns wrapped matrices now
- Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
- Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
- Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
- Removed memory allocation (unneeded) from all methods
- Vector's resize methods are only applicable to new vectors not wrapped data.
- Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
- Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
- Euler.rotate does internal rotation now
- Slice assignment now works better for all types
- Vector * Vector and Quat * Quat are defined and return the DOT product
- Mat * Vec and Vec * Mat are defined now
- Moved #includes to .c file from headers. Also fixed prototypes in mathutils
- Added new helper functions for incref'ing to genutils
- Major cleanup of header files includes - include Mathutils.h for access to math types
- matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
- Matrix() with no parameters now returns an identity matrix by default not a zero matrix
- printf() now prints with 6 digits instead of 4
- printf() now prints output with object descriptor
- Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
- Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence. index cannot go above the row size of the matrix.
- slice operations on matrices work with sequences now (rows of the matrix) example: mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
- slice assignment will no longer modify the data if the assignment operation fails
- fixed error in matrix * scalar multiplication
- euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
- Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
- Quats can be created with angle/axis, axis/angle
- 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
- vec *quat / quat * vec is now defined
- vec.magnitude alias for vec.length
- all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
- these methods have been deprecated (still functioning but suggested to use the corrected functionality):
* CopyVec() - replaced by Vector() functionality
* CopyMat() - replaced by Matrix() functionality
* CopyQuat() - replace by Quaternion() functionality
* CopyEuler() - replaced by Euler() functionality
* RotateEuler() - replaced by Euler.rotate() funtionality
* MatMultVec() - replaced by matrix * vector
* VecMultMat() - replaced by vector * matrix
- New struct containers references to python object data or internally allocated blender data for wrapping
* Explaination here: math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
* otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
2005-07-14 03:34:56 +00:00
|
|
|
#include "BKE_object.h" /* for during_script() and during_scriptlink() */
|
|
|
|
#include "BKE_scene.h" /* scene_find_camera() */
|
2005-07-18 03:50:37 +00:00
|
|
|
#include "BPI_script.h"
|
Mathutils update
- also included is some fixes for preprocessor inclues and some clean up of the previous commit
-rewrite and bugfixes
----------------------------------
Here's my changelog:
-fixed Rand() so that it doesn't seed everytime and should generate better random numbers
- changed a few error return types to something more appropriate
- clean up of uninitialized variables & removal of unneccessary objects
- NMesh returns wrapped vectors now
- World returns wrapped matrices now
- Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
- Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
- Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
- Removed memory allocation (unneeded) from all methods
- Vector's resize methods are only applicable to new vectors not wrapped data.
- Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
- Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
- Euler.rotate does internal rotation now
- Slice assignment now works better for all types
- Vector * Vector and Quat * Quat are defined and return the DOT product
- Mat * Vec and Vec * Mat are defined now
- Moved #includes to .c file from headers. Also fixed prototypes in mathutils
- Added new helper functions for incref'ing to genutils
- Major cleanup of header files includes - include Mathutils.h for access to math types
- matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
- Matrix() with no parameters now returns an identity matrix by default not a zero matrix
- printf() now prints with 6 digits instead of 4
- printf() now prints output with object descriptor
- Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
- Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence. index cannot go above the row size of the matrix.
- slice operations on matrices work with sequences now (rows of the matrix) example: mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
- slice assignment will no longer modify the data if the assignment operation fails
- fixed error in matrix * scalar multiplication
- euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
- Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
- Quats can be created with angle/axis, axis/angle
- 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
- vec *quat / quat * vec is now defined
- vec.magnitude alias for vec.length
- all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
- these methods have been deprecated (still functioning but suggested to use the corrected functionality):
* CopyVec() - replaced by Vector() functionality
* CopyMat() - replaced by Matrix() functionality
* CopyQuat() - replace by Quaternion() functionality
* CopyEuler() - replaced by Euler() functionality
* RotateEuler() - replaced by Euler.rotate() funtionality
* MatMultVec() - replaced by matrix * vector
* VecMultMat() - replaced by vector * matrix
- New struct containers references to python object data or internally allocated blender data for wrapping
* Explaination here: math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
* otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
2005-07-14 03:34:56 +00:00
|
|
|
#include "BIF_mywindow.h"
|
2007-09-02 17:25:03 +00:00
|
|
|
#include "BIF_imasel.h"
|
Mathutils update
- also included is some fixes for preprocessor inclues and some clean up of the previous commit
-rewrite and bugfixes
----------------------------------
Here's my changelog:
-fixed Rand() so that it doesn't seed everytime and should generate better random numbers
- changed a few error return types to something more appropriate
- clean up of uninitialized variables & removal of unneccessary objects
- NMesh returns wrapped vectors now
- World returns wrapped matrices now
- Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
- Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
- Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
- Removed memory allocation (unneeded) from all methods
- Vector's resize methods are only applicable to new vectors not wrapped data.
- Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
- Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
- Euler.rotate does internal rotation now
- Slice assignment now works better for all types
- Vector * Vector and Quat * Quat are defined and return the DOT product
- Mat * Vec and Vec * Mat are defined now
- Moved #includes to .c file from headers. Also fixed prototypes in mathutils
- Added new helper functions for incref'ing to genutils
- Major cleanup of header files includes - include Mathutils.h for access to math types
- matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
- Matrix() with no parameters now returns an identity matrix by default not a zero matrix
- printf() now prints with 6 digits instead of 4
- printf() now prints output with object descriptor
- Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
- Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence. index cannot go above the row size of the matrix.
- slice operations on matrices work with sequences now (rows of the matrix) example: mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
- slice assignment will no longer modify the data if the assignment operation fails
- fixed error in matrix * scalar multiplication
- euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
- Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
- Quats can be created with angle/axis, axis/angle
- 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
- vec *quat / quat * vec is now defined
- vec.magnitude alias for vec.length
- all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
- these methods have been deprecated (still functioning but suggested to use the corrected functionality):
* CopyVec() - replaced by Vector() functionality
* CopyMat() - replaced by Matrix() functionality
* CopyQuat() - replace by Quaternion() functionality
* CopyEuler() - replaced by Euler() functionality
* RotateEuler() - replaced by Euler.rotate() funtionality
* MatMultVec() - replaced by matrix * vector
* VecMultMat() - replaced by vector * matrix
- New struct containers references to python object data or internally allocated blender data for wrapping
* Explaination here: math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
* otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
2005-07-14 03:34:56 +00:00
|
|
|
#include "BSE_headerbuttons.h"
|
|
|
|
#include "BSE_filesel.h"
|
|
|
|
#include "BIF_editmesh.h" /* for undo_push_mesh() */
|
|
|
|
#include "BIF_screen.h"
|
|
|
|
#include "BIF_space.h"
|
|
|
|
#include "BIF_drawtext.h"
|
2007-10-26 08:19:40 +00:00
|
|
|
#include "BIF_poseobject.h"
|
Mathutils update
- also included is some fixes for preprocessor inclues and some clean up of the previous commit
-rewrite and bugfixes
----------------------------------
Here's my changelog:
-fixed Rand() so that it doesn't seed everytime and should generate better random numbers
- changed a few error return types to something more appropriate
- clean up of uninitialized variables & removal of unneccessary objects
- NMesh returns wrapped vectors now
- World returns wrapped matrices now
- Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
- Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
- Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
- Removed memory allocation (unneeded) from all methods
- Vector's resize methods are only applicable to new vectors not wrapped data.
- Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
- Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
- Euler.rotate does internal rotation now
- Slice assignment now works better for all types
- Vector * Vector and Quat * Quat are defined and return the DOT product
- Mat * Vec and Vec * Mat are defined now
- Moved #includes to .c file from headers. Also fixed prototypes in mathutils
- Added new helper functions for incref'ing to genutils
- Major cleanup of header files includes - include Mathutils.h for access to math types
- matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
- Matrix() with no parameters now returns an identity matrix by default not a zero matrix
- printf() now prints with 6 digits instead of 4
- printf() now prints output with object descriptor
- Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
- Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence. index cannot go above the row size of the matrix.
- slice operations on matrices work with sequences now (rows of the matrix) example: mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
- slice assignment will no longer modify the data if the assignment operation fails
- fixed error in matrix * scalar multiplication
- euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
- Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
- Quats can be created with angle/axis, axis/angle
- 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
- vec *quat / quat * vec is now defined
- vec.magnitude alias for vec.length
- all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
- these methods have been deprecated (still functioning but suggested to use the corrected functionality):
* CopyVec() - replaced by Vector() functionality
* CopyMat() - replaced by Matrix() functionality
* CopyQuat() - replace by Quaternion() functionality
* CopyEuler() - replaced by Euler() functionality
* RotateEuler() - replaced by Euler.rotate() funtionality
* MatMultVec() - replaced by matrix * vector
* VecMultMat() - replaced by vector * matrix
- New struct containers references to python object data or internally allocated blender data for wrapping
* Explaination here: math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
* otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
2005-07-14 03:34:56 +00:00
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_text_types.h"
|
2005-07-18 03:50:37 +00:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "mydevice.h"
|
|
|
|
#include "blendef.h" /* OBACT */
|
2004-10-07 19:25:40 +00:00
|
|
|
#include "windowTheme.h"
|
2005-07-18 03:50:37 +00:00
|
|
|
#include "Mathutils.h"
|
2004-07-16 03:08:43 +00:00
|
|
|
#include "constant.h"
|
2005-07-18 03:50:37 +00:00
|
|
|
#include "gen_utils.h"
|
2007-01-25 15:19:28 +00:00
|
|
|
#include "Armature.h"
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
|
|
|
/* See Draw.c */
|
|
|
|
extern int EXPP_disable_force_draw;
|
2005-07-18 03:50:37 +00:00
|
|
|
extern void setcameratoview3d(void);
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Python API function prototypes for the Window module. */
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
PyObject *M_Window_Redraw( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_RedrawAll( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_QRedrawAll( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_DrawProgressBar( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_GetCursorPos( PyObject * self );
|
|
|
|
static PyObject *M_Window_SetCursorPos( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_WaitCursor( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_GetViewVector( PyObject * self );
|
2007-03-30 08:20:37 +00:00
|
|
|
static PyObject *M_Window_GetActiveLayer( PyObject * self );
|
|
|
|
static PyObject *M_Window_SetActiveLayer( PyObject * self, PyObject * args );
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetViewQuat( PyObject * self );
|
|
|
|
static PyObject *M_Window_SetViewQuat( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_GetViewOffset( PyObject * self );
|
|
|
|
static PyObject *M_Window_SetViewOffset( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_GetViewMatrix( PyObject * self );
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
static PyObject *M_Window_GetPerspMatrix( PyObject * self );
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_FileSelector( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_ImageSelector( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_EditMode( PyObject * self, PyObject * args );
|
2007-10-26 08:19:40 +00:00
|
|
|
static PyObject *M_Window_PoseMode( PyObject * self, PyObject * args );
|
2005-04-21 19:44:52 +00:00
|
|
|
static PyObject *M_Window_ViewLayers( PyObject * self, PyObject * args );
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_CameraView( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_QTest( PyObject * self );
|
|
|
|
static PyObject *M_Window_QRead( PyObject * self );
|
|
|
|
static PyObject *M_Window_QAdd( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_QHandle( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_GetMouseCoords( PyObject * self );
|
|
|
|
static PyObject *M_Window_SetMouseCoords( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_GetMouseButtons( PyObject * self );
|
|
|
|
static PyObject *M_Window_GetKeyQualifiers( PyObject * self );
|
|
|
|
static PyObject *M_Window_SetKeyQualifiers( PyObject * self, PyObject * args );
|
|
|
|
static PyObject *M_Window_GetAreaSize( PyObject * self );
|
|
|
|
static PyObject *M_Window_GetAreaID( PyObject * self );
|
|
|
|
static PyObject *M_Window_GetScreenSize( PyObject * self );
|
|
|
|
static PyObject *M_Window_GetScreens( PyObject * self );
|
2007-06-16 13:17:41 +00:00
|
|
|
static PyObject *M_Window_SetScreen( PyObject * self, PyObject * value );
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetScreenInfo( PyObject * self, PyObject * args,
|
|
|
|
PyObject * kwords );
|
2005-03-09 19:45:59 +00:00
|
|
|
PyObject *Window_Init( void );
|
|
|
|
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* The following string definitions are used for documentation strings. */
|
|
|
|
/* In Python these will be written to the console when doing a */
|
|
|
|
/* Blender.Window.__doc__ */
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
static char M_Window_doc[] = "The Blender Window module\n\n";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
|
|
|
static char M_Window_Redraw_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Force a redraw of a specific Window Type (see Window.Types)";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static char M_Window_RedrawAll_doc[] = "() - Redraw all windows";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
|
|
|
static char M_Window_QRedrawAll_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Redraw all windows by queue event";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
|
|
|
static char M_Window_FileSelector_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(callback [, title, filename]) - Open a file selector window.\n\
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
The selected file name is used as argument to a function callback f(name)\n\
|
|
|
|
that you must provide. 'title' is optional and defaults to 'SELECT FILE'.\n\
|
|
|
|
'filename' is optional and defaults to Blender.Get('filename').\n\n\
|
|
|
|
Example:\n\n\
|
|
|
|
import Blender\n\n\
|
|
|
|
def my_function(filename):\n\
|
|
|
|
print 'The selected file was: ', filename\n\n\
|
|
|
|
Blender.Window.FileSelector(my_function, 'SAVE FILE')\n";
|
|
|
|
|
|
|
|
static char M_Window_ImageSelector_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(callback [, title, filename]) - Open an image selector window.\n\
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
The selected file name is used as argument to a function callback f(name)\n\
|
|
|
|
that you must provide. 'title' is optional and defaults to 'SELECT IMAGE'.\n\
|
|
|
|
'filename' is optional and defaults to Blender.Get('filename').\n\n\
|
|
|
|
Example:\n\n\
|
|
|
|
import Blender\n\n\
|
|
|
|
def my_function(filename):\n\
|
|
|
|
print 'The selected image file was: ', filename\n\n\
|
|
|
|
Blender.Window.ImageSelector(my_function, 'LOAD IMAGE')\n";
|
|
|
|
|
|
|
|
static char M_Window_DrawProgressBar_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(done, text) - Draw a progress bar.\n\
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
'done' is a float value <= 1.0, 'text' contains info about what is\n\
|
|
|
|
currently being done.";
|
|
|
|
|
|
|
|
static char M_Window_GetCursorPos_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the current 3d cursor position as a list of three floats.";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
|
|
|
static char M_Window_SetCursorPos_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"([f,f,f]) - Set the current 3d cursor position from a list of three floats.";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
static char M_Window_WaitCursor_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(bool) - Set cursor to wait mode (nonzero bool) or normal mode (0).";
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
static char M_Window_GetViewVector_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the current 3d view vector as a list of three floats [x,y,z].";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
static char M_Window_GetActiveLayer_doc[] =
|
|
|
|
"() - Get the current 3d views active layer where new objects are created.";
|
|
|
|
|
|
|
|
static char M_Window_SetActiveLayer_doc[] =
|
|
|
|
"(int) - Set the current 3d views active layer where new objects are created.";
|
|
|
|
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
static char M_Window_GetViewMatrix_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the current 3d view matrix.";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
static char M_Window_GetPerspMatrix_doc[] =
|
|
|
|
"() - Get the current 3d Persp matrix.";
|
|
|
|
|
Interface:
- added submenu "Scripts" in both View3D->Object and Mesh menus.
Put them on top (it's better to follow some guideline, so users don't have to search for "Scripts" submenu in a different position in each menu), feel free to change.
- added button 'previous win' to SpaceScript, makes accessing buttons win, for example, much faster. Maybe all spaces could have this button.
BPython:
- added Window.EditMode(), to check, enter and leave edit mode. Scripts that change mesh data need this to leave edit mode before making changes to the active (G.obedit) mesh, of course.
- updated script bevel_center to use the above function and also popup an error msg if the active obj is not a mesh.
- doc updates, minor fixes.
Forgot to mention in my previous commit that I also updated the "-P" command-line option (for running script files) to be able to run already loaded Blender Texts, too. So, if you have a script called 'Text' in foo.blend, you can run it with blender foo.blend -P Text .
2004-07-03 17:28:15 +00:00
|
|
|
static char M_Window_EditMode_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the current status -- 0: not in edit mode; 1: in edit mode.\n\
|
Interface:
- added submenu "Scripts" in both View3D->Object and Mesh menus.
Put them on top (it's better to follow some guideline, so users don't have to search for "Scripts" submenu in a different position in each menu), feel free to change.
- added button 'previous win' to SpaceScript, makes accessing buttons win, for example, much faster. Maybe all spaces could have this button.
BPython:
- added Window.EditMode(), to check, enter and leave edit mode. Scripts that change mesh data need this to leave edit mode before making changes to the active (G.obedit) mesh, of course.
- updated script bevel_center to use the above function and also popup an error msg if the active obj is not a mesh.
- doc updates, minor fixes.
Forgot to mention in my previous commit that I also updated the "-P" command-line option (for running script files) to be able to run already loaded Blender Texts, too. So, if you have a script called 'Text' in foo.blend, you can run it with blender foo.blend -P Text .
2004-07-03 17:28:15 +00:00
|
|
|
(status) - if 1: enter edit mode; if 0: leave edit mode.\n\
|
|
|
|
Returns the current status. This function is mostly useful to leave\n\
|
|
|
|
edit mode before applying changes to a mesh (otherwise the changes will\n\
|
|
|
|
be lost) and then returning to it upon leaving.";
|
|
|
|
|
2007-10-26 08:19:40 +00:00
|
|
|
static char M_Window_PoseMode_doc[] =
|
|
|
|
"() - Get the current status -- 0: not in pose mode; 1: in edit mode";
|
|
|
|
|
2005-04-21 19:44:52 +00:00
|
|
|
static char M_Window_ViewLayers_doc[] =
|
2007-06-08 15:41:31 +00:00
|
|
|
"(layers = [], winid = None) - Get/set active layers in all 3d View windows.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
() - Make no changes, only return currently visible layers.\n\
|
|
|
|
(layers = []) - a list of integers, each in the range [1, 20].\n\
|
2007-06-08 15:41:31 +00:00
|
|
|
(layers = [], winid = int) - layers as above, winid is an optional.\n\
|
|
|
|
arg that makes the function only set layers for that view.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
This function returns the currently visible layers as a list of ints.";
|
|
|
|
|
|
|
|
static char M_Window_GetViewQuat_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the current VIEW3D view quaternion values.";
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
static char M_Window_SetViewQuat_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(quat) - Set the current VIEW3D view quaternion values.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
(quat) - [f,f,f,f] or f,f,f,f: the new float values.";
|
|
|
|
|
|
|
|
static char M_Window_GetViewOffset_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the current VIEW3D view offset values.";
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
static char M_Window_SetViewOffset_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(ofs) - Set the current VIEW3D view offset values.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
(ofs) - [f,f,f] or f,f,f: the new float values.";
|
|
|
|
|
|
|
|
static char M_Window_CameraView_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(camtov3d = 0) - Set the current VIEW3D view to the active camera's view.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
(camtov3d = 0) - bool: if nonzero it's the camera that gets positioned at the\n\
|
|
|
|
current view, instead of the view being changed to that of the camera.\n\n\
|
|
|
|
If no camera is the active object, the active camera for the current scene\n\
|
|
|
|
is used.";
|
|
|
|
|
|
|
|
static char M_Window_QTest_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Check if there are pending events in the event queue.";
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
static char M_Window_QRead_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the next pending event from the event queue.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
This function returns a list [event, val], where:\n\
|
|
|
|
event - int: the key or mouse event (see Blender.Draw module);\n\
|
|
|
|
val - int: if 1 it's a key or mouse button press, if 0 a release. For\n\
|
|
|
|
mouse movement events 'val' returns the new coordinates in x or y.";
|
|
|
|
|
|
|
|
static char M_Window_QAdd_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(win, evt, val, after = 0) - Add an event to some window's event queue.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
(win) - int: the win id, see Blender.Window.GetScreenInfo();\n\
|
|
|
|
(evt) - int: the event number, see events in Blender.Draw;\n\
|
|
|
|
(val) - bool: 1 for a key press, 0 for a release;\n\
|
|
|
|
(after) - bool: if 1 the event is put after the current queue and added later.";
|
|
|
|
|
|
|
|
static char M_Window_QHandle_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(win) - Process all events for the given window (area) now.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
(win) - int: the window id, see Blender.Window.GetScreenInfo().\n\n\
|
|
|
|
See Blender.Window.QAdd() for how to send events to a particular window.";
|
|
|
|
|
|
|
|
static char M_Window_GetMouseCoords_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get mouse pointer's current screen coordinates.";
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
|
|
|
static char M_Window_SetMouseCoords_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(x, y) - Set mouse pointer's current screen coordinates.\n\
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
(x,y) - ints ([x, y] also accepted): the new x, y coordinates.";
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
static char M_Window_GetMouseButtons_doc[] =
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
"() - Get the current mouse button state (see Blender.Window.MButs dict).";
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
static char M_Window_GetKeyQualifiers_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the current qualifier keys state.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
An int is returned: or'ed combination of values in Blender.Window.Qual's dict.";
|
|
|
|
|
|
|
|
static char M_Window_SetKeyQualifiers_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(qual) - Fake qualifier keys state.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
(qual) - int: an or'ed combination of the values in Blender.Window.Qual dict.\n\
|
|
|
|
Note: remember to reset to 0 after handling the related event (see QAdd()).";
|
|
|
|
|
|
|
|
static char M_Window_GetAreaID_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the current window's (area) ID.";
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
static char M_Window_GetAreaSize_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the current window's (area) size as [width, height].";
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
|
|
|
static char M_Window_GetScreenSize_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get the screen's size as [width, height].";
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-07-20 08:16:46 +00:00
|
|
|
static char M_Window_GetScreens_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"() - Get a list with the names of all available screens.";
|
2004-07-20 08:16:46 +00:00
|
|
|
|
|
|
|
static char M_Window_SetScreen_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(name) - Set current screen to the one with the given 'name'.";
|
2004-07-20 08:16:46 +00:00
|
|
|
|
2004-07-16 03:08:43 +00:00
|
|
|
static char M_Window_GetScreenInfo_doc[] =
|
2004-09-25 20:30:40 +00:00
|
|
|
"(type = -1, rect = 'win', screen = None)\n\
|
2004-07-20 08:16:46 +00:00
|
|
|
- Get info about the the areas in the current screen setup.\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
(type = -1) - int: the space type (Blender.Window.Types) to restrict the\n\
|
|
|
|
results to, all if -1;\n\
|
2004-07-20 08:16:46 +00:00
|
|
|
(rect = 'win') - str: the rectangle of interest. This defines if the corner\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
coordinates returned will refer to:\n\
|
|
|
|
- the whole area: 'total';\n\
|
|
|
|
- only the header: 'header';\n\
|
2004-07-20 08:16:46 +00:00
|
|
|
- only the window content (default): 'win'.\n\
|
|
|
|
(screen = None) - str: the screen name, current if not given.\n\n\
|
2004-07-16 03:08:43 +00:00
|
|
|
A list of dictionaries (one for each area) is returned.\n\
|
|
|
|
Each dictionary has keys:\n\
|
|
|
|
'vertices': [xmin, ymin, xmax, ymax] area corners;\n\
|
|
|
|
'win': window type, see Blender.Window.Types dict;\n\
|
2004-07-20 08:16:46 +00:00
|
|
|
'id': area's id.";
|
2004-07-16 03:08:43 +00:00
|
|
|
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Python method structure definition for Blender.Window module: */
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
struct PyMethodDef M_Window_methods[] = {
|
2004-09-25 20:30:40 +00:00
|
|
|
{"Redraw", M_Window_Redraw, METH_VARARGS, M_Window_Redraw_doc},
|
|
|
|
{"RedrawAll", M_Window_RedrawAll, METH_VARARGS,
|
|
|
|
M_Window_RedrawAll_doc},
|
|
|
|
{"QRedrawAll", M_Window_QRedrawAll, METH_VARARGS,
|
|
|
|
M_Window_QRedrawAll_doc},
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
{"FileSelector", M_Window_FileSelector, METH_VARARGS,
|
2004-09-25 20:30:40 +00:00
|
|
|
M_Window_FileSelector_doc},
|
|
|
|
{"ImageSelector", ( PyCFunction ) M_Window_ImageSelector, METH_VARARGS,
|
|
|
|
M_Window_ImageSelector_doc},
|
|
|
|
{"DrawProgressBar", M_Window_DrawProgressBar, METH_VARARGS,
|
|
|
|
M_Window_DrawProgressBar_doc},
|
|
|
|
{"drawProgressBar", M_Window_DrawProgressBar, METH_VARARGS,
|
|
|
|
M_Window_DrawProgressBar_doc},
|
|
|
|
{"GetCursorPos", ( PyCFunction ) M_Window_GetCursorPos, METH_NOARGS,
|
|
|
|
M_Window_GetCursorPos_doc},
|
|
|
|
{"SetCursorPos", M_Window_SetCursorPos, METH_VARARGS,
|
|
|
|
M_Window_SetCursorPos_doc},
|
|
|
|
{"WaitCursor", M_Window_WaitCursor, METH_VARARGS,
|
|
|
|
M_Window_WaitCursor_doc},
|
|
|
|
{"GetViewVector", ( PyCFunction ) M_Window_GetViewVector, METH_NOARGS,
|
|
|
|
M_Window_GetViewVector_doc},
|
2007-03-30 08:20:37 +00:00
|
|
|
{"GetActiveLayer", ( PyCFunction ) M_Window_GetActiveLayer, METH_NOARGS,
|
|
|
|
M_Window_GetActiveLayer_doc},
|
|
|
|
{"SetActiveLayer", ( PyCFunction ) M_Window_SetActiveLayer, METH_VARARGS,
|
|
|
|
M_Window_SetActiveLayer_doc},
|
2004-09-25 20:30:40 +00:00
|
|
|
{"GetViewQuat", ( PyCFunction ) M_Window_GetViewQuat, METH_NOARGS,
|
|
|
|
M_Window_GetViewQuat_doc},
|
|
|
|
{"SetViewQuat", ( PyCFunction ) M_Window_SetViewQuat, METH_VARARGS,
|
|
|
|
M_Window_SetViewQuat_doc},
|
|
|
|
{"GetViewOffset", ( PyCFunction ) M_Window_GetViewOffset, METH_NOARGS,
|
|
|
|
M_Window_GetViewOffset_doc},
|
|
|
|
{"SetViewOffset", ( PyCFunction ) M_Window_SetViewOffset, METH_VARARGS,
|
|
|
|
M_Window_SetViewOffset_doc},
|
|
|
|
{"GetViewMatrix", ( PyCFunction ) M_Window_GetViewMatrix, METH_NOARGS,
|
|
|
|
M_Window_GetViewMatrix_doc},
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
{"GetPerspMatrix", ( PyCFunction ) M_Window_GetPerspMatrix, METH_NOARGS,
|
|
|
|
M_Window_GetPerspMatrix_doc},
|
2004-09-25 20:30:40 +00:00
|
|
|
{"EditMode", ( PyCFunction ) M_Window_EditMode, METH_VARARGS,
|
|
|
|
M_Window_EditMode_doc},
|
2007-10-26 08:19:40 +00:00
|
|
|
{"PoseMode", ( PyCFunction ) M_Window_PoseMode, METH_VARARGS,
|
|
|
|
M_Window_PoseMode_doc},
|
2005-04-21 19:44:52 +00:00
|
|
|
{"ViewLayers", ( PyCFunction ) M_Window_ViewLayers, METH_VARARGS,
|
|
|
|
M_Window_ViewLayers_doc},
|
|
|
|
/* typo, deprecate someday: */
|
|
|
|
{"ViewLayer", ( PyCFunction ) M_Window_ViewLayers, METH_VARARGS,
|
|
|
|
M_Window_ViewLayers_doc},
|
2004-09-25 20:30:40 +00:00
|
|
|
{"CameraView", ( PyCFunction ) M_Window_CameraView, METH_VARARGS,
|
|
|
|
M_Window_CameraView_doc},
|
|
|
|
{"QTest", ( PyCFunction ) M_Window_QTest, METH_NOARGS,
|
|
|
|
M_Window_QTest_doc},
|
|
|
|
{"QRead", ( PyCFunction ) M_Window_QRead, METH_NOARGS,
|
|
|
|
M_Window_QRead_doc},
|
|
|
|
{"QAdd", ( PyCFunction ) M_Window_QAdd, METH_VARARGS,
|
|
|
|
M_Window_QAdd_doc},
|
|
|
|
{"QHandle", ( PyCFunction ) M_Window_QHandle, METH_VARARGS,
|
|
|
|
M_Window_QHandle_doc},
|
|
|
|
{"GetMouseCoords", ( PyCFunction ) M_Window_GetMouseCoords,
|
|
|
|
METH_NOARGS,
|
|
|
|
M_Window_GetMouseCoords_doc},
|
|
|
|
{"SetMouseCoords", ( PyCFunction ) M_Window_SetMouseCoords,
|
|
|
|
METH_VARARGS,
|
|
|
|
M_Window_SetMouseCoords_doc},
|
|
|
|
{"GetMouseButtons", ( PyCFunction ) M_Window_GetMouseButtons,
|
|
|
|
METH_NOARGS,
|
|
|
|
M_Window_GetMouseButtons_doc},
|
|
|
|
{"GetKeyQualifiers", ( PyCFunction ) M_Window_GetKeyQualifiers,
|
|
|
|
METH_NOARGS,
|
|
|
|
M_Window_GetKeyQualifiers_doc},
|
|
|
|
{"SetKeyQualifiers", ( PyCFunction ) M_Window_SetKeyQualifiers,
|
|
|
|
METH_VARARGS,
|
|
|
|
M_Window_SetKeyQualifiers_doc},
|
|
|
|
{"GetAreaSize", ( PyCFunction ) M_Window_GetAreaSize, METH_NOARGS,
|
|
|
|
M_Window_GetAreaSize_doc},
|
|
|
|
{"GetAreaID", ( PyCFunction ) M_Window_GetAreaID, METH_NOARGS,
|
|
|
|
M_Window_GetAreaID_doc},
|
|
|
|
{"GetScreenSize", ( PyCFunction ) M_Window_GetScreenSize, METH_NOARGS,
|
|
|
|
M_Window_GetScreenSize_doc},
|
|
|
|
{"GetScreens", ( PyCFunction ) M_Window_GetScreens, METH_NOARGS,
|
|
|
|
M_Window_GetScreens_doc},
|
2007-06-16 13:17:41 +00:00
|
|
|
{"SetScreen", ( PyCFunction ) M_Window_SetScreen, METH_O,
|
2004-09-25 20:30:40 +00:00
|
|
|
M_Window_SetScreen_doc},
|
|
|
|
{"GetScreenInfo", ( PyCFunction ) M_Window_GetScreenInfo,
|
|
|
|
METH_VARARGS | METH_KEYWORDS, M_Window_GetScreenInfo_doc},
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
{NULL, NULL, 0, NULL}
|
|
|
|
};
|
|
|
|
|
2003-05-08 03:06:46 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: M_Window_Redraw */
|
|
|
|
/* Python equivalent: Blender.Window.Redraw */
|
2003-05-08 03:06:46 +00:00
|
|
|
/*****************************************************************************/
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
/* not static so py_slider_update in Draw.[ch] can use it */
|
2004-09-25 20:30:40 +00:00
|
|
|
PyObject *M_Window_Redraw( PyObject * self, PyObject * args )
|
|
|
|
{
|
2003-12-14 01:18:09 +00:00
|
|
|
ScrArea *tempsa, *sa;
|
|
|
|
int wintype = SPACE_VIEW3D;
|
|
|
|
short redraw_all = 0;
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !PyArg_ParseTuple( args, "|i", &wintype ) )
|
|
|
|
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
|
|
|
|
"expected int argument (or nothing)" ) );
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( wintype < 0 )
|
2003-12-14 01:18:09 +00:00
|
|
|
redraw_all = 1;
|
2003-05-08 03:06:46 +00:00
|
|
|
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
if( !during_script( ) && !G.background ) {
|
2004-09-25 20:30:40 +00:00
|
|
|
tempsa = curarea;
|
2003-12-14 01:18:09 +00:00
|
|
|
sa = G.curscreen->areabase.first;
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
while( sa ) {
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( sa->spacetype == wintype || redraw_all ) {
|
2005-02-16 03:32:57 +00:00
|
|
|
if (sa->spacetype == SPACE_SCRIPT && EXPP_disable_force_draw) {
|
|
|
|
scrarea_queue_redraw(sa);
|
|
|
|
}
|
|
|
|
else {
|
2007-02-15 11:26:19 +00:00
|
|
|
/* do not call fancy hacks here like pop_space_text(st); (ton) */
|
2005-02-16 03:32:57 +00:00
|
|
|
scrarea_do_windraw( sa );
|
|
|
|
if( sa->headwin ) scrarea_do_headdraw( sa );
|
2004-09-25 20:30:40 +00:00
|
|
|
}
|
2003-12-14 01:18:09 +00:00
|
|
|
}
|
2004-09-25 20:30:40 +00:00
|
|
|
sa = sa->next;
|
2003-12-14 01:18:09 +00:00
|
|
|
}
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( curarea != tempsa )
|
|
|
|
areawinset( tempsa->win );
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( curarea ) { /* is null if Blender is in bg mode */
|
|
|
|
if( curarea->headwin )
|
|
|
|
scrarea_do_headdraw( curarea );
|
|
|
|
screen_swapbuffers( );
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
}
|
2003-12-14 01:18:09 +00:00
|
|
|
}
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2003-05-08 03:06:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: M_Window_RedrawAll */
|
|
|
|
/* Python equivalent: Blender.Window.RedrawAll */
|
2003-05-08 03:06:46 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_RedrawAll( PyObject * self, PyObject * args )
|
2003-05-08 03:06:46 +00:00
|
|
|
{
|
2007-06-16 13:57:39 +00:00
|
|
|
PyObject *arg = Py_BuildValue( "(i)", -1 );
|
|
|
|
PyObject *ret = M_Window_Redraw( self, arg );
|
|
|
|
Py_DECREF(arg);
|
|
|
|
return ret;
|
2003-05-08 03:06:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: M_Window_QRedrawAll */
|
|
|
|
/* Python equivalent: Blender.Window.QRedrawAll */
|
2003-05-08 03:06:46 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_QRedrawAll( PyObject * self, PyObject * args )
|
2003-05-08 03:06:46 +00:00
|
|
|
{
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
EXPP_allqueue( REDRAWALL, 0 );
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2003-05-08 03:06:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: M_Window_FileSelector */
|
|
|
|
/* Python equivalent: Blender.Window.FileSelector */
|
2003-05-08 03:06:46 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/* This is the callback to "activate_fileselect" below. It receives the
|
|
|
|
* selected filename and (using it as argument) calls the Python callback
|
|
|
|
* provided by the script writer and stored in EXPP_FS_PyCallback. */
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static void getSelectedFile( char *name )
|
2003-05-08 03:06:46 +00:00
|
|
|
{
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
PyObject *pycallback;
|
|
|
|
PyObject *result;
|
|
|
|
Script *script;
|
|
|
|
|
|
|
|
/* let's find the script that owns this callback */
|
|
|
|
script = G.main->script.first;
|
|
|
|
while (script) {
|
|
|
|
if (script->flags & SCRIPT_RUNNING) break;
|
|
|
|
script = script->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!script) {
|
|
|
|
if (curarea->spacetype == SPACE_SCRIPT) {
|
|
|
|
SpaceScript *sc = curarea->spacedata.first;
|
|
|
|
script = sc->script;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pycallback = script->py_browsercallback;
|
|
|
|
|
|
|
|
if (pycallback) {
|
|
|
|
result = PyObject_CallFunction( pycallback, "s", name );
|
|
|
|
|
|
|
|
if (!result) {
|
|
|
|
if (G.f & G_DEBUG)
|
|
|
|
fprintf(stderr, "BPy error: Callback call failed!\n");
|
|
|
|
}
|
|
|
|
else Py_DECREF(result);
|
|
|
|
|
|
|
|
if (script->py_browsercallback == pycallback)
|
|
|
|
script->py_browsercallback = NULL;
|
|
|
|
/* else another call to selector was made inside pycallback */
|
|
|
|
|
|
|
|
Py_DECREF(pycallback);
|
2005-01-22 02:48:03 +00:00
|
|
|
}
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
|
2003-12-14 01:18:09 +00:00
|
|
|
return;
|
2003-05-08 03:06:46 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_FileSelector( PyObject * self, PyObject * args )
|
2003-05-08 03:06:46 +00:00
|
|
|
{
|
2003-12-14 01:18:09 +00:00
|
|
|
char *title = "SELECT FILE";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
char *filename = G.sce;
|
2003-12-14 01:18:09 +00:00
|
|
|
SpaceScript *sc;
|
2005-02-16 03:32:57 +00:00
|
|
|
Script *script = NULL;
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
PyObject *pycallback = NULL;
|
2003-12-14 01:18:09 +00:00
|
|
|
int startspace = 0;
|
|
|
|
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
if (during_scriptlink())
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
"script links can't call the file selector");
|
|
|
|
|
|
|
|
if (G.background)
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
"the file selector is not available in background mode");
|
|
|
|
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
if((!PyArg_ParseTuple( args, "O|ss", &pycallback, &title, &filename))
|
|
|
|
|| (!PyCallable_Check(pycallback)))
|
2004-09-25 20:30:40 +00:00
|
|
|
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
"\nexpected a callback function (and optionally one or two strings) "
|
|
|
|
"as argument(s)" );
|
|
|
|
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
Py_INCREF(pycallback);
|
2003-12-14 01:18:09 +00:00
|
|
|
|
|
|
|
/* trick: we move to a spacescript because then the fileselector will properly
|
|
|
|
* unset our SCRIPT_FILESEL flag when the user chooses a file or cancels the
|
|
|
|
* selection. This is necessary because when a user cancels, the
|
|
|
|
* getSelectedFile function above doesn't get called and so couldn't unset the
|
|
|
|
* flag. */
|
|
|
|
startspace = curarea->spacetype;
|
2004-09-25 20:30:40 +00:00
|
|
|
if( startspace != SPACE_SCRIPT )
|
|
|
|
newspace( curarea, SPACE_SCRIPT );
|
2003-12-14 01:18:09 +00:00
|
|
|
|
|
|
|
sc = curarea->spacedata.first;
|
|
|
|
|
2005-02-16 03:32:57 +00:00
|
|
|
/* let's find the script that called us */
|
|
|
|
script = G.main->script.first;
|
|
|
|
while (script) {
|
|
|
|
if (script->flags & SCRIPT_RUNNING) break;
|
|
|
|
script = script->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !script ) {
|
2003-12-14 01:18:09 +00:00
|
|
|
/* if not running, then we were already on a SpaceScript space, executing
|
|
|
|
* a registered callback -- aka: this script has a gui */
|
2004-09-25 20:30:40 +00:00
|
|
|
script = sc->script; /* this is the right script */
|
|
|
|
} else { /* still running, use the trick */
|
2003-12-14 01:18:09 +00:00
|
|
|
script->lastspace = startspace;
|
|
|
|
sc->script = script;
|
|
|
|
}
|
2003-06-14 10:10:01 +00:00
|
|
|
|
2003-12-14 01:18:09 +00:00
|
|
|
script->flags |= SCRIPT_FILESEL;
|
2003-05-08 03:06:46 +00:00
|
|
|
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
/* clear any previous callback (nested calls to selector) */
|
|
|
|
if (script->py_browsercallback) {
|
|
|
|
Py_DECREF((PyObject *)script->py_browsercallback);
|
|
|
|
}
|
|
|
|
script->py_browsercallback = pycallback;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
activate_fileselect( FILE_BLENDER, title, filename, getSelectedFile );
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2003-05-08 03:06:46 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_ImageSelector( PyObject * self, PyObject * args )
|
2003-05-08 03:06:46 +00:00
|
|
|
{
|
2003-12-14 01:18:09 +00:00
|
|
|
char *title = "SELECT IMAGE";
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
char *filename = G.sce;
|
2003-12-14 01:18:09 +00:00
|
|
|
SpaceScript *sc;
|
2005-02-16 03:32:57 +00:00
|
|
|
Script *script = NULL;
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
PyObject *pycallback = NULL;
|
2003-12-14 01:18:09 +00:00
|
|
|
int startspace = 0;
|
|
|
|
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
if (during_scriptlink())
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
"script links can't call the image selector");
|
|
|
|
|
|
|
|
if (G.background)
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
"the image selector is not available in background mode");
|
|
|
|
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
if( !PyArg_ParseTuple( args, "O|ss", &pycallback, &title, &filename )
|
|
|
|
|| (!PyCallable_Check(pycallback)))
|
|
|
|
return EXPP_ReturnPyObjError ( PyExc_AttributeError,
|
|
|
|
"\nexpected a callback function (and optionally one or two strings) "
|
|
|
|
"as argument(s)" );
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
Py_INCREF(pycallback);
|
2003-12-14 01:18:09 +00:00
|
|
|
|
|
|
|
/* trick: we move to a spacescript because then the fileselector will properly
|
|
|
|
* unset our SCRIPT_FILESEL flag when the user chooses a file or cancels the
|
|
|
|
* selection. This is necessary because when a user cancels, the
|
|
|
|
* getSelectedFile function above doesn't get called and so couldn't unset the
|
|
|
|
* flag. */
|
|
|
|
startspace = curarea->spacetype;
|
2004-09-25 20:30:40 +00:00
|
|
|
if( startspace != SPACE_SCRIPT )
|
|
|
|
newspace( curarea, SPACE_SCRIPT );
|
2003-12-14 01:18:09 +00:00
|
|
|
|
|
|
|
sc = curarea->spacedata.first;
|
|
|
|
|
2005-02-16 03:32:57 +00:00
|
|
|
/* let's find the script that called us */
|
|
|
|
script = G.main->script.first;
|
|
|
|
while (script) {
|
|
|
|
if (script->flags & SCRIPT_RUNNING) break;
|
|
|
|
script = script->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !script ) {
|
|
|
|
/* if not running, then we were already on a SpaceScript space, executing
|
|
|
|
* a registered callback -- aka: this script has a gui */
|
2004-09-25 20:30:40 +00:00
|
|
|
script = sc->script; /* this is the right script */
|
|
|
|
} else { /* still running, use the trick */
|
2003-12-14 01:18:09 +00:00
|
|
|
script->lastspace = startspace;
|
|
|
|
sc->script = script;
|
|
|
|
}
|
2003-06-14 10:10:01 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
script->flags |= SCRIPT_FILESEL; /* same flag as filesel */
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
/* clear any previous callback (nested calls to selector) */
|
|
|
|
if (script->py_browsercallback) {
|
|
|
|
Py_DECREF((PyObject *)script->py_browsercallback);
|
|
|
|
}
|
|
|
|
script->py_browsercallback = pycallback;
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
activate_imageselect( FILE_BLENDER, title, filename, getSelectedFile );
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2003-05-08 03:06:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: M_Window_DrawProgressBar */
|
|
|
|
/* Python equivalent: Blender.Window.DrawProgressBar */
|
2003-05-08 03:06:46 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_DrawProgressBar( PyObject * self, PyObject * args )
|
2003-05-08 03:06:46 +00:00
|
|
|
{
|
2003-12-14 01:18:09 +00:00
|
|
|
float done;
|
|
|
|
char *info = NULL;
|
BPython: cleaning some bug tracker entries:
(excuse me for doing all in a single commit, but they are tiny
fixes and it's bpython, that dark corner ...)
#1025 - FileSelector SEGV on dynamic callback Category:
Can't reproduce with current cvs, I'd say recent changes to fix
another crash related to FileSelector in gui-less scripts solved this
one, too.
#1028 - Reserved button event number:
Menu choices generate two events, one extra related to the menu
itself, with value=4. Made bpython ignore this extra event.
#1068 - FileSelector No file extension support:
As Ton wrote there, Blender itself doesn't support this yet. But the
requester also wanted Window.File/ImageSelector to accept a pathname. Done. Also updated doc.
#959 - Segfault on background rendering:
This happened in bg mode (blender -b filename -a, for example) when
a script with the line "Blender.Redraw()" was linked to FRAMECHANGED events. As reported in the bug page, it was because curarea is NULL in bg mode. Made Redraw() check for this and not call functions that expected curarea in Redraw, like one to swap buffers.
#1072 - Blender.Redraw() Segfault:
Good catch : ). Scripts called from the scripts win that called
Blender.Redraw() or Blender.Window.Redraw() would crash Blender because of a dirty pointer in Spacescript->script. Fixed.
2004-04-11 04:41:33 +00:00
|
|
|
int retval = 0;
|
2005-05-20 05:14:03 +00:00
|
|
|
ScrArea *sa = curarea;
|
2003-05-08 03:06:46 +00:00
|
|
|
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
if (G.background)
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
"the progress bar is not available in background mode");
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !PyArg_ParseTuple( args, "fs", &done, &info ) )
|
|
|
|
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
"expected a float and a string as arguments" ) );
|
2003-05-08 03:06:46 +00:00
|
|
|
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
retval = progress_bar( done, info );
|
2003-05-08 03:06:46 +00:00
|
|
|
|
BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9
- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9
- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example). Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.
- added syntax colors access to Window.Theme module.
Scripts:
- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.
Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
|
|
|
areawinset(sa->win);
|
2005-05-20 05:14:03 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
return Py_BuildValue( "i", retval );
|
2003-05-08 03:06:46 +00:00
|
|
|
}
|
|
|
|
|
2003-09-03 04:13:08 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: M_Window_GetCursorPos */
|
|
|
|
/* Python equivalent: Blender.Window.GetCursorPos */
|
2003-09-03 04:13:08 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetCursorPos( PyObject * self )
|
2003-09-03 04:13:08 +00:00
|
|
|
{
|
2003-12-14 01:18:09 +00:00
|
|
|
float *cursor = NULL;
|
|
|
|
PyObject *pylist;
|
2003-09-03 04:13:08 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( G.vd && G.vd->localview )
|
2003-12-14 01:18:09 +00:00
|
|
|
cursor = G.vd->cursor;
|
2004-09-25 20:30:40 +00:00
|
|
|
else
|
|
|
|
cursor = G.scene->cursor;
|
2003-09-03 04:13:08 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
pylist = Py_BuildValue( "[fff]", cursor[0], cursor[1], cursor[2] );
|
2003-09-03 04:13:08 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !pylist )
|
|
|
|
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
|
|
|
"GetCursorPos: couldn't create pylist" ) );
|
2003-09-03 04:13:08 +00:00
|
|
|
|
2003-12-14 01:18:09 +00:00
|
|
|
return pylist;
|
2003-09-03 04:13:08 +00:00
|
|
|
}
|
|
|
|
|
2003-09-18 00:54:43 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: M_Window_SetCursorPos */
|
|
|
|
/* Python equivalent: Blender.Window.SetCursorPos */
|
2003-09-18 00:54:43 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_SetCursorPos( PyObject * self, PyObject * args )
|
2003-09-18 00:54:43 +00:00
|
|
|
{
|
|
|
|
int ok = 0;
|
2003-12-14 01:18:09 +00:00
|
|
|
float val[3];
|
2003-09-18 00:54:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( PyObject_Length( args ) == 3 )
|
|
|
|
ok = PyArg_ParseTuple( args, "fff", &val[0], &val[1],
|
|
|
|
&val[2] );
|
2003-09-18 00:54:43 +00:00
|
|
|
else
|
2004-09-25 20:30:40 +00:00
|
|
|
ok = PyArg_ParseTuple( args, "(fff)", &val[0], &val[1],
|
|
|
|
&val[2] );
|
2003-09-18 00:54:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !ok )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected [f,f,f] or f,f,f as arguments" );
|
2003-09-18 00:54:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( G.vd && G.vd->localview ) {
|
2003-09-18 00:54:43 +00:00
|
|
|
G.vd->cursor[0] = val[0];
|
|
|
|
G.vd->cursor[1] = val[1];
|
|
|
|
G.vd->cursor[2] = val[2];
|
2004-09-25 20:30:40 +00:00
|
|
|
} else {
|
2003-09-18 00:54:43 +00:00
|
|
|
G.scene->cursor[0] = val[0];
|
|
|
|
G.scene->cursor[1] = val[1];
|
|
|
|
G.scene->cursor[2] = val[2];
|
|
|
|
}
|
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2003-09-18 00:54:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_WaitCursor( PyObject * self, PyObject * args )
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
{
|
|
|
|
int bool;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !PyArg_ParseTuple( args, "i", &bool ) )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected bool (0 or 1) or nothing as argument" );
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
waitcursor( bool ); /* nonzero bool sets, zero unsets */
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
}
|
|
|
|
|
2003-09-18 00:54:43 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: M_Window_GetViewVector */
|
|
|
|
/* Python equivalent: Blender.Window.GetViewVector */
|
2003-09-18 00:54:43 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetViewVector( PyObject * self )
|
2003-09-18 00:54:43 +00:00
|
|
|
{
|
|
|
|
float *vec = NULL;
|
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
if( !G.vd )
|
|
|
|
Py_RETURN_NONE;
|
2003-09-18 00:54:43 +00:00
|
|
|
|
|
|
|
vec = G.vd->viewinv[2];
|
|
|
|
|
2007-07-25 04:45:20 +00:00
|
|
|
return Py_BuildValue( "[fff]", vec[0], vec[1], vec[2] );
|
2003-09-18 00:54:43 +00:00
|
|
|
}
|
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* Function: M_Window_GetActiveLayer */
|
|
|
|
/* Python equivalent: Blender.Window.GetActiveLayer */
|
|
|
|
/*****************************************************************************/
|
|
|
|
static PyObject *M_Window_GetActiveLayer( PyObject * self )
|
|
|
|
{
|
|
|
|
if (!G.vd) {
|
|
|
|
return PyInt_FromLong(0);
|
|
|
|
} else {
|
|
|
|
return PyInt_FromLong( G.vd->layact );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyObject *M_Window_SetActiveLayer( PyObject * self, PyObject * args )
|
|
|
|
{
|
|
|
|
int layer, bit=1;
|
|
|
|
if( !PyArg_ParseTuple( args, "i", &layer ) )
|
|
|
|
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected an int" ) );
|
|
|
|
|
|
|
|
if (!G.vd)
|
|
|
|
Py_RETURN_FALSE;
|
|
|
|
|
|
|
|
bit= 0;
|
|
|
|
while(bit<32) {
|
|
|
|
if(layer & (1<<bit)) {
|
|
|
|
G.vd->layact= 1<<bit;
|
|
|
|
G.vd->lay |= G.vd->layact;
|
|
|
|
|
|
|
|
if (G.vd->scenelock) {
|
|
|
|
G.scene->lay |= G.vd->layact;
|
|
|
|
}
|
|
|
|
bit = -1; /* no error */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
bit++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bit != -1)
|
|
|
|
return ( EXPP_ReturnPyObjError( PyExc_ValueError,
|
|
|
|
"The flag could not be used for the active layer" ) );
|
|
|
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetViewQuat( PyObject * self )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
float *vec = NULL;
|
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
if( !G.vd )
|
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
vec = G.vd->viewquat;
|
|
|
|
|
2007-07-25 04:45:20 +00:00
|
|
|
return Py_BuildValue( "[ffff]", vec[0], vec[1], vec[2], vec[3] );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_SetViewQuat( PyObject * self, PyObject * args )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
int ok = 0;
|
|
|
|
float val[4];
|
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
if( !G.vd )
|
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( PyObject_Length( args ) == 4 )
|
|
|
|
ok = PyArg_ParseTuple( args, "ffff", &val[0], &val[1], &val[2],
|
|
|
|
&val[3] );
|
2004-07-16 03:08:43 +00:00
|
|
|
else
|
2004-09-25 20:30:40 +00:00
|
|
|
ok = PyArg_ParseTuple( args, "(ffff)", &val[0], &val[1],
|
|
|
|
&val[2], &val[3] );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !ok )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected [f,f,f,f] or f,f,f,f as arguments" );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
G.vd->viewquat[0] = val[0];
|
|
|
|
G.vd->viewquat[1] = val[1];
|
|
|
|
G.vd->viewquat[2] = val[2];
|
|
|
|
G.vd->viewquat[3] = val[3];
|
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetViewOffset( PyObject * self )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
2007-03-30 08:20:37 +00:00
|
|
|
if( !G.vd )
|
|
|
|
Py_RETURN_NONE;
|
2007-07-25 04:45:20 +00:00
|
|
|
return Py_BuildValue( "[fff]", G.vd->ofs[0], G.vd->ofs[1], G.vd->ofs[2] );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_SetViewOffset( PyObject * self, PyObject * args )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
int ok = 0;
|
|
|
|
float val[3];
|
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
if( !G.vd )
|
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( PyObject_Length( args ) == 3 )
|
|
|
|
ok = PyArg_ParseTuple( args, "fff", &val[0], &val[1],
|
|
|
|
&val[2] );
|
2004-07-16 03:08:43 +00:00
|
|
|
else
|
2004-09-25 20:30:40 +00:00
|
|
|
ok = PyArg_ParseTuple( args, "(fff)", &val[0], &val[1],
|
|
|
|
&val[2] );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !ok )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected [f,f,f] or f,f,f as arguments" );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
G.vd->ofs[0] = val[0];
|
|
|
|
G.vd->ofs[1] = val[1];
|
|
|
|
G.vd->ofs[2] = val[2];
|
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-09-18 00:54:43 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: M_Window_GetViewMatrix */
|
|
|
|
/* Python equivalent: Blender.Window.GetViewMatrix */
|
2003-09-18 00:54:43 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetViewMatrix( PyObject * self )
|
2003-09-18 00:54:43 +00:00
|
|
|
{
|
2007-03-30 08:20:37 +00:00
|
|
|
if( !G.vd )
|
|
|
|
Py_RETURN_NONE;
|
2003-09-18 00:54:43 +00:00
|
|
|
|
2007-07-25 04:45:20 +00:00
|
|
|
return newMatrixObject( ( float * ) G.vd->viewmat, 4, 4, Py_WRAP );
|
2003-09-18 00:54:43 +00:00
|
|
|
}
|
|
|
|
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* Function: M_Window_GetPerspMatrix */
|
|
|
|
/* Python equivalent: Blender.Window.GetPerspMatrix */
|
|
|
|
/*****************************************************************************/
|
|
|
|
static PyObject *M_Window_GetPerspMatrix( PyObject * self )
|
|
|
|
{
|
2007-03-30 08:20:37 +00:00
|
|
|
if( !G.vd )
|
|
|
|
Py_RETURN_NONE;
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
|
2007-07-25 04:45:20 +00:00
|
|
|
return newMatrixObject( ( float * ) G.vd->persmat, 4, 4, Py_WRAP );
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
}
|
|
|
|
|
2007-01-31 03:12:26 +00:00
|
|
|
|
|
|
|
/* update_armature_weakrefs()
|
|
|
|
* helper function used in M_Window_EditMode.
|
|
|
|
* rebuilds list of Armature weakrefs in __main__
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int update_armature_weakrefs()
|
|
|
|
{
|
|
|
|
/* stuff for armature weak refs */
|
|
|
|
char *list_name = ARM_WEAKREF_LIST_NAME;
|
|
|
|
PyObject *maindict = NULL, *armlist = NULL;
|
|
|
|
PyObject *pyarmature = NULL;
|
|
|
|
int x;
|
|
|
|
|
|
|
|
maindict= PyModule_GetDict(PyImport_AddModule( "__main__"));
|
|
|
|
armlist = PyDict_GetItemString(maindict, list_name);
|
|
|
|
if( !armlist){
|
|
|
|
printf("Oops - update_armature_weakrefs()\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (x = 0; x < PySequence_Size(armlist); x++){
|
|
|
|
pyarmature = PyWeakref_GetObject(PySequence_GetItem( armlist, x));
|
|
|
|
if (pyarmature != Py_None)
|
|
|
|
Armature_RebuildEditbones(pyarmature);
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_EditMode( PyObject * self, PyObject * args )
|
Interface:
- added submenu "Scripts" in both View3D->Object and Mesh menus.
Put them on top (it's better to follow some guideline, so users don't have to search for "Scripts" submenu in a different position in each menu), feel free to change.
- added button 'previous win' to SpaceScript, makes accessing buttons win, for example, much faster. Maybe all spaces could have this button.
BPython:
- added Window.EditMode(), to check, enter and leave edit mode. Scripts that change mesh data need this to leave edit mode before making changes to the active (G.obedit) mesh, of course.
- updated script bevel_center to use the above function and also popup an error msg if the active obj is not a mesh.
- doc updates, minor fixes.
Forgot to mention in my previous commit that I also updated the "-P" command-line option (for running script files) to be able to run already loaded Blender Texts, too. So, if you have a script called 'Text' in foo.blend, you can run it with blender foo.blend -P Text .
2004-07-03 17:28:15 +00:00
|
|
|
{
|
|
|
|
short status = -1;
|
2004-08-17 04:26:00 +00:00
|
|
|
char *undo_str = "From script";
|
|
|
|
int undo_str_len = 11;
|
2006-01-16 02:06:02 +00:00
|
|
|
int do_undo = 1;
|
Interface:
- added submenu "Scripts" in both View3D->Object and Mesh menus.
Put them on top (it's better to follow some guideline, so users don't have to search for "Scripts" submenu in a different position in each menu), feel free to change.
- added button 'previous win' to SpaceScript, makes accessing buttons win, for example, much faster. Maybe all spaces could have this button.
BPython:
- added Window.EditMode(), to check, enter and leave edit mode. Scripts that change mesh data need this to leave edit mode before making changes to the active (G.obedit) mesh, of course.
- updated script bevel_center to use the above function and also popup an error msg if the active obj is not a mesh.
- doc updates, minor fixes.
Forgot to mention in my previous commit that I also updated the "-P" command-line option (for running script files) to be able to run already loaded Blender Texts, too. So, if you have a script called 'Text' in foo.blend, you can run it with blender foo.blend -P Text .
2004-07-03 17:28:15 +00:00
|
|
|
|
2006-01-16 02:06:02 +00:00
|
|
|
if( !PyArg_ParseTuple( args,
|
|
|
|
"|hs#i", &status, &undo_str, &undo_str_len, &do_undo ) )
|
2004-09-25 20:30:40 +00:00
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
2006-01-16 02:06:02 +00:00
|
|
|
"expected optional int (bool), string and int (bool) as arguments" );
|
2004-09-25 20:30:40 +00:00
|
|
|
|
|
|
|
if( status >= 0 ) {
|
|
|
|
if( status ) {
|
2007-01-29 01:27:07 +00:00
|
|
|
if( !G.obedit ){
|
2007-01-31 03:12:26 +00:00
|
|
|
|
2007-01-25 15:19:28 +00:00
|
|
|
//update armatures
|
2007-01-31 03:12:26 +00:00
|
|
|
if(! update_armature_weakrefs()){
|
|
|
|
return EXPP_ReturnPyObjError(
|
|
|
|
PyExc_RuntimeError,
|
|
|
|
"internal error - update_armature_weakrefs");
|
2007-01-25 15:19:28 +00:00
|
|
|
}
|
2007-01-31 03:12:26 +00:00
|
|
|
|
2007-01-25 15:19:28 +00:00
|
|
|
//enter editmode
|
2006-09-28 01:55:44 +00:00
|
|
|
enter_editmode(0);
|
2007-01-29 01:27:07 +00:00
|
|
|
}
|
2004-09-25 20:30:40 +00:00
|
|
|
} else if( G.obedit ) {
|
2007-01-09 05:28:37 +00:00
|
|
|
if( undo_str_len > 63 )
|
|
|
|
undo_str[63] = '\0'; /* 64 is max */
|
|
|
|
BIF_undo_push( undo_str ); /* This checks user undo settings */
|
2006-09-28 01:55:44 +00:00
|
|
|
exit_editmode( EM_FREEDATA );
|
2007-01-25 15:19:28 +00:00
|
|
|
|
|
|
|
//update armatures
|
2007-01-31 03:12:26 +00:00
|
|
|
if(! update_armature_weakrefs()){
|
|
|
|
return EXPP_ReturnPyObjError(
|
|
|
|
PyExc_RuntimeError,
|
|
|
|
"internal error - update_armature_weakrefs");
|
2007-01-25 15:19:28 +00:00
|
|
|
}
|
2007-01-31 03:12:26 +00:00
|
|
|
|
2004-07-28 17:46:29 +00:00
|
|
|
}
|
Interface:
- added submenu "Scripts" in both View3D->Object and Mesh menus.
Put them on top (it's better to follow some guideline, so users don't have to search for "Scripts" submenu in a different position in each menu), feel free to change.
- added button 'previous win' to SpaceScript, makes accessing buttons win, for example, much faster. Maybe all spaces could have this button.
BPython:
- added Window.EditMode(), to check, enter and leave edit mode. Scripts that change mesh data need this to leave edit mode before making changes to the active (G.obedit) mesh, of course.
- updated script bevel_center to use the above function and also popup an error msg if the active obj is not a mesh.
- doc updates, minor fixes.
Forgot to mention in my previous commit that I also updated the "-P" command-line option (for running script files) to be able to run already loaded Blender Texts, too. So, if you have a script called 'Text' in foo.blend, you can run it with blender foo.blend -P Text .
2004-07-03 17:28:15 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
return Py_BuildValue( "h", G.obedit ? 1 : 0 );
|
Interface:
- added submenu "Scripts" in both View3D->Object and Mesh menus.
Put them on top (it's better to follow some guideline, so users don't have to search for "Scripts" submenu in a different position in each menu), feel free to change.
- added button 'previous win' to SpaceScript, makes accessing buttons win, for example, much faster. Maybe all spaces could have this button.
BPython:
- added Window.EditMode(), to check, enter and leave edit mode. Scripts that change mesh data need this to leave edit mode before making changes to the active (G.obedit) mesh, of course.
- updated script bevel_center to use the above function and also popup an error msg if the active obj is not a mesh.
- doc updates, minor fixes.
Forgot to mention in my previous commit that I also updated the "-P" command-line option (for running script files) to be able to run already loaded Blender Texts, too. So, if you have a script called 'Text' in foo.blend, you can run it with blender foo.blend -P Text .
2004-07-03 17:28:15 +00:00
|
|
|
}
|
|
|
|
|
2007-10-26 08:19:40 +00:00
|
|
|
static PyObject *M_Window_PoseMode( PyObject * self, PyObject * args )
|
|
|
|
{
|
|
|
|
short status = -1;
|
|
|
|
short is_posemode = 0;
|
|
|
|
Base *base;
|
|
|
|
|
|
|
|
if( !PyArg_ParseTuple( args, "|h", &status ) )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected optional int (bool) as argument" );
|
|
|
|
|
|
|
|
if( status >= 0 ) {
|
|
|
|
if( status ) {
|
|
|
|
enter_posemode();
|
|
|
|
} else if( G.obedit ) {
|
|
|
|
exit_posemode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
base= BASACT;
|
|
|
|
if (base && base->object->flag & OB_POSEMODE) {
|
|
|
|
is_posemode = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Py_BuildValue( "h", is_posemode );
|
|
|
|
}
|
|
|
|
|
2005-04-21 19:44:52 +00:00
|
|
|
static PyObject *M_Window_ViewLayers( PyObject * self, PyObject * args )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
PyObject *item = NULL;
|
|
|
|
PyObject *list = NULL, *resl = NULL;
|
2007-06-08 15:41:31 +00:00
|
|
|
int val, i, bit = 0, layer = 0, len_list;
|
|
|
|
short winid = -1;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2005-04-21 19:44:52 +00:00
|
|
|
if( !G.scene ) {
|
2004-12-05 04:01:57 +00:00
|
|
|
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
2005-04-21 19:44:52 +00:00
|
|
|
"can't get pointer to global scene" );
|
2004-12-05 04:01:57 +00:00
|
|
|
}
|
|
|
|
|
2007-06-08 15:41:31 +00:00
|
|
|
/* Pase Args, Nothing, One list, Or a list and an int */
|
|
|
|
if (PyTuple_GET_SIZE(args)!=0) {
|
|
|
|
if( !PyArg_ParseTuple ( args, "O!|h", &PyList_Type, &list, &winid) ) {
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"nothing or a list and optionaly a window ID argument" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( list ) {
|
2007-06-08 15:41:31 +00:00
|
|
|
len_list = PyList_Size(list);
|
2005-04-21 19:44:52 +00:00
|
|
|
|
|
|
|
if (len_list == 0)
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
|
|
|
"list can't be empty, at list one layer must be set" );
|
|
|
|
|
|
|
|
for( i = 0; i < len_list; i++ ) {
|
2004-09-25 20:30:40 +00:00
|
|
|
item = PyList_GetItem( list, i );
|
|
|
|
if( !PyInt_Check( item ) )
|
|
|
|
return EXPP_ReturnPyObjError
|
|
|
|
( PyExc_AttributeError,
|
|
|
|
"list must contain only integer numbers" );
|
|
|
|
|
|
|
|
val = ( int ) PyInt_AsLong( item );
|
|
|
|
if( val < 1 || val > 20 )
|
|
|
|
return EXPP_ReturnPyObjError
|
|
|
|
( PyExc_AttributeError,
|
|
|
|
"layer values must be in the range [1, 20]" );
|
|
|
|
|
|
|
|
layer |= 1 << ( val - 1 );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
2007-06-08 15:41:31 +00:00
|
|
|
|
|
|
|
if (winid==-1) {
|
|
|
|
/* set scene and viewport */
|
|
|
|
G.scene->lay = layer;
|
|
|
|
if (G.vd) {
|
|
|
|
G.vd->lay = layer;
|
|
|
|
|
|
|
|
while( bit < 20 ) {
|
|
|
|
val = 1 << bit;
|
|
|
|
if( layer & val ) {
|
|
|
|
G.vd->layact = val;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
bit++;
|
2005-04-21 19:44:52 +00:00
|
|
|
}
|
2007-06-08 15:41:31 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* only set the windows layer */
|
|
|
|
ScrArea *sa;
|
|
|
|
SpaceLink *sl;
|
|
|
|
View3D *vd;
|
|
|
|
|
|
|
|
if (G.curscreen) { /* can never be too careful */
|
|
|
|
for (sa=G.curscreen->areabase.first; sa; sa= sa->next) {
|
|
|
|
if (winid == sa->win) {
|
|
|
|
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next)
|
|
|
|
if(sl->spacetype==SPACE_VIEW3D)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (!sl)
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
|
|
|
"The window matching the winid has no 3d viewport" );
|
|
|
|
|
|
|
|
vd= (View3D *) sl;
|
|
|
|
vd->lay = layer;
|
|
|
|
|
|
|
|
for(bit= 0; bit < 20; bit++) {
|
|
|
|
val = 1 << bit;
|
|
|
|
if( layer & val ) {
|
|
|
|
vd->layact = val;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
winid = -1; /* so we know its done */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (winid!=-1)
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"The winid argument did not match any window" );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-09-25 20:30:40 +00:00
|
|
|
|
|
|
|
resl = PyList_New( 0 );
|
|
|
|
if( !resl )
|
|
|
|
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
|
|
|
|
"couldn't create pylist!" ) );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2005-04-21 19:44:52 +00:00
|
|
|
layer = G.scene->lay;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
bit = 0;
|
2004-09-25 20:30:40 +00:00
|
|
|
while( bit < 20 ) {
|
|
|
|
val = 1 << bit;
|
|
|
|
if( layer & val ) {
|
|
|
|
item = Py_BuildValue( "i", bit + 1 );
|
|
|
|
PyList_Append( resl, item );
|
|
|
|
Py_DECREF( item );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
bit++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return resl;
|
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_CameraView( PyObject * self, PyObject * args )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
short camtov3d = 0;
|
2004-09-25 20:30:40 +00:00
|
|
|
|
|
|
|
if( !PyArg_ParseTuple( args, "|i", &camtov3d ) )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected an int (from Window.Views) as argument" );
|
|
|
|
|
|
|
|
if( !G.vd )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
2004-12-05 04:01:57 +00:00
|
|
|
"this function can only be used after a 3d View has been initialized" );
|
2004-09-25 20:30:40 +00:00
|
|
|
|
|
|
|
if( !G.vd->camera ) {
|
|
|
|
if( BASACT && OBACT->type == OB_CAMERA )
|
|
|
|
G.vd->camera = OBACT;
|
|
|
|
else
|
|
|
|
G.vd->camera = scene_find_camera( G.scene );
|
|
|
|
handle_view3d_lock( );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
G.vd->persp = 2;
|
|
|
|
G.vd->view = 0;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( camtov3d )
|
|
|
|
setcameratoview3d( );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_QTest( PyObject * self )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
2004-09-25 20:30:40 +00:00
|
|
|
return Py_BuildValue( "h", qtest( ) );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_QRead( PyObject * self )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
short val = 0;
|
|
|
|
unsigned short event;
|
|
|
|
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
if (G.background)
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
"QRead is not available in background mode");
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
event = extern_qread( &val );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
return Py_BuildValue( "ii", event, val );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_QAdd( PyObject * self, PyObject * args )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
short win;
|
2004-09-25 20:30:40 +00:00
|
|
|
short evt; /* unsigned, we check below */
|
2004-07-16 03:08:43 +00:00
|
|
|
short val;
|
|
|
|
short after = 0;
|
|
|
|
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
if (G.background)
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
"QAdd is not available in background mode");
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !PyArg_ParseTuple( args, "hhh|h", &win, &evt, &val, &after ) )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected three or four ints as arguments" );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( evt < 0 ) /* evt is unsigned short */
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
|
|
|
"event value must be a positive int, check events in Blender.Draw" );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( after )
|
|
|
|
addafterqueue( win, evt, val );
|
|
|
|
else
|
|
|
|
addqueue( win, evt, val );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_QHandle( PyObject * self, PyObject * args )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
short win;
|
2007-06-08 15:41:31 +00:00
|
|
|
ScrArea *sa;
|
2004-07-16 03:08:43 +00:00
|
|
|
ScrArea *oldsa = NULL;
|
|
|
|
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
if (G.background)
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
"QHandle is not available in background mode");
|
|
|
|
|
2007-06-08 15:41:31 +00:00
|
|
|
if (!G.curscreen)
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
"No screens available");
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !PyArg_ParseTuple( args, "h", &win ) )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected an int as argument" );
|
2007-06-08 15:41:31 +00:00
|
|
|
|
|
|
|
for (sa= G.curscreen->areabase.first; sa; sa= sa->next)
|
2004-09-25 20:30:40 +00:00
|
|
|
if( sa->win == win )
|
|
|
|
break;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( sa ) {
|
2004-07-16 03:08:43 +00:00
|
|
|
BWinEvent evt;
|
|
|
|
short do_redraw = 0, do_change = 0;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( sa != curarea || sa->win != mywinget( ) ) {
|
2004-07-16 03:08:43 +00:00
|
|
|
oldsa = curarea;
|
2004-09-25 20:30:40 +00:00
|
|
|
areawinset( sa->win );
|
|
|
|
set_g_activearea( sa );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
2004-09-25 20:30:40 +00:00
|
|
|
while( bwin_qread( sa->win, &evt ) ) {
|
|
|
|
if( evt.event == REDRAW ) {
|
2004-07-16 03:08:43 +00:00
|
|
|
do_redraw = 1;
|
2004-09-25 20:30:40 +00:00
|
|
|
} else if( evt.event == CHANGED ) {
|
2004-07-16 03:08:43 +00:00
|
|
|
sa->win_swap = 0;
|
|
|
|
do_change = 1;
|
|
|
|
do_redraw = 1;
|
2004-09-25 20:30:40 +00:00
|
|
|
} else {
|
|
|
|
scrarea_do_winhandle( sa, &evt );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( oldsa ) {
|
|
|
|
areawinset( oldsa->win );
|
|
|
|
set_g_activearea( oldsa );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetMouseCoords( PyObject * self )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
short mval[2];
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
getmouse( mval );
|
|
|
|
|
|
|
|
return Py_BuildValue( "hh", mval[0], mval[1] );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_SetMouseCoords( PyObject * self, PyObject * args )
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
{
|
|
|
|
int ok, x, y;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !G.curscreen )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
|
|
|
"no current screen to retrieve info from!" );
|
|
|
|
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
x = G.curscreen->sizex / 2;
|
|
|
|
y = G.curscreen->sizey / 2;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( PyObject_Length( args ) == 2 )
|
|
|
|
ok = PyArg_ParseTuple( args, "hh", &x, &y );
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
else
|
2004-09-25 20:30:40 +00:00
|
|
|
ok = PyArg_ParseTuple( args, "|(hh)", &x, &y );
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !ok )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected [i, i] or i,i as arguments (or nothing)." );
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
warp_pointer( x, y );
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetMouseButtons( PyObject * self )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
2004-09-25 20:30:40 +00:00
|
|
|
short mbut = get_mbut( );
|
|
|
|
|
|
|
|
return Py_BuildValue( "h", mbut );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetKeyQualifiers( PyObject * self )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
2004-09-25 20:30:40 +00:00
|
|
|
short qual = get_qual( );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
return Py_BuildValue( "h", qual );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_SetKeyQualifiers( PyObject * self, PyObject * args )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
short qual = 0;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !PyArg_ParseTuple( args, "|h", &qual ) )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected nothing or an int (or'ed flags) as argument" );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( qual < 0 )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
|
|
|
"value must be a positive int, check Blender.Window.Qual" );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
G.qual = qual;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
return Py_BuildValue( "h", qual );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetAreaSize( PyObject * self )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
ScrArea *sa = curarea;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !sa )
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
return Py_BuildValue( "hh", sa->winx, sa->winy );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetAreaID( PyObject * self )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
ScrArea *sa = curarea;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !sa )
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
return Py_BuildValue( "h", sa->win );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetScreenSize( PyObject * self )
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
{
|
|
|
|
bScreen *scr = G.curscreen;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !scr )
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
return Py_BuildValue( "hh", scr->sizex, scr->sizey );
|
BPython:
- new submodule Scene.Radio, for radiosity: still incomplete, but in shape for demos, updated SConscript to include it;
- new functions in Window module;
- doc updates: adding a todo file and a new start page for our docs: API_intro.py + other updates;
- small fix in Ipo.c provided by Damien McGuinnes (thanks!): Nathan has a patch with IPO additions and fixes for this and more, but until it is committed, there's this fix for Ipo.getCurve('LocX'), LocY, Z and QuatW,X,Y,Z too, according to Damien.
Other files:
- radpreprocess.c: added check for "during_script()" so eventual msgs don't popup during scripts;
- drawmesh.c: made a pointer (display list) be checked before accessed, fixes crash in scripts that forget to update display lists for subsurf meshes when a 3d view is in textured view mode.
Script: updated bevel_center by Loic Berthe.
2004-07-25 16:55:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-16 13:17:41 +00:00
|
|
|
static PyObject *M_Window_SetScreen( PyObject * self, PyObject * value )
|
2004-07-20 08:16:46 +00:00
|
|
|
{
|
|
|
|
bScreen *scr = G.main->screen.first;
|
2007-06-16 13:17:41 +00:00
|
|
|
char *name = PyString_AsString(value);
|
2004-07-20 08:16:46 +00:00
|
|
|
|
2007-06-16 13:17:41 +00:00
|
|
|
if( !name )
|
2004-09-25 20:30:40 +00:00
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected string as argument" );
|
2004-07-20 08:16:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
while( scr ) {
|
|
|
|
if( !strcmp( scr->id.name + 2, name ) ) {
|
|
|
|
setscreen( scr );
|
2004-07-20 08:16:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
scr = scr->id.next;
|
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !scr )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
BPython:
- Scripts:
fixed error in "Save Current Theme" which prevented it from automatically updating script registration in menus.
cosmetic changes in a couple of Campbell's sel_same.py script strings + more descriptive name for its new menu place (3d view, face mode -> select menu).
small updates to help_browser.py script.
The above changes are related to this:
- Added new script menu entries: Render (for exporters to renderers), Themes, FaceSelect (this already at the proper place). Updated Scripts win->Scripts menu so it won't show all available entries, only the ones we mean to see there.
- Updated menu registration so that scripts folders can become trees. The release/scripts/ dir should be updated soon with subdirs like converters/, modifiers/, generators/ or whatever -- better discuss first (or is it? /me afraid of long irc discussions during meetings :) ).
- Modules:
Blender: added 'udatadir' option to .Get() function and added var Blender.mode to tell if Blender is in bg or interactive mode.
NMesh: added Campbell's nmesh.transform(matrix, recalc_normals = False) method (reworked, so my fault if it doesn't work).
- Bugs fixed:
#2123: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2123&group_id=9
Reported by Ken Hughes (thanks!), who also found the exact problem later (it was in Text.Load, not with script links -- if only I had checked emails these days ... lost > 1 hour today to find the problem: passed filename to M_Text_Load was later being written over by a function called by add_text). Also saw that Text.Load wasn't checking existence of passed filename (duh!), now it does.
#1655: http://projects.blender.org/tracker/?func=detail&atid=125&aid=1655&group_id=9
Reported by Chris Want (thanks!): command line "blender -P script" not working properly for bg mode ("blender -b blendfile -P script").
Had to make some small updates to get it working (bg mode for scripts was never explicitely handled, it worked due to collateral effects, let's say), interested readers can check the report after I update it or the API_intro.py doc file. After more testing we can make further updates. Updated many places to not call redraws if in bg mode, now it is officially available. Blender outputs its own info when rendering in bg mode, if that is considered a nuissance we'll have to add a few "if (during_script())" calls outside bpython.
- Removed a few warnings here and there and also updated docs.
2005-03-19 06:24:55 +00:00
|
|
|
"no such screen, check Window.GetScreens() for valid names" );
|
2004-07-20 08:16:46 +00:00
|
|
|
|
2007-03-30 08:20:37 +00:00
|
|
|
Py_RETURN_NONE;
|
2004-07-20 08:16:46 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetScreens( PyObject * self )
|
2004-07-20 08:16:46 +00:00
|
|
|
{
|
|
|
|
bScreen *scr = G.main->screen.first;
|
2004-09-25 20:30:40 +00:00
|
|
|
PyObject *list = PyList_New( 0 );
|
2004-07-20 08:16:46 +00:00
|
|
|
PyObject *str = NULL;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !list )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_MemoryError,
|
|
|
|
"couldn't create py list!" );
|
2004-07-20 08:16:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
while( scr ) {
|
|
|
|
str = PyString_FromString( scr->id.name + 2 );
|
2004-07-20 08:16:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !str ) {
|
|
|
|
Py_DECREF( list );
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_MemoryError,
|
|
|
|
"couldn't create py string!" );
|
2004-07-20 08:16:46 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
PyList_Append( list, str ); /* incref's str */
|
|
|
|
Py_DECREF( str );
|
2004-07-20 08:16:46 +00:00
|
|
|
|
|
|
|
scr = scr->id.next;
|
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
return list;
|
2004-07-20 08:16:46 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
static PyObject *M_Window_GetScreenInfo( PyObject * self, PyObject * args,
|
|
|
|
PyObject * kwords )
|
2004-07-16 03:08:43 +00:00
|
|
|
{
|
|
|
|
ScrArea *sa = G.curscreen->areabase.first;
|
2004-07-20 08:16:46 +00:00
|
|
|
bScreen *scr = G.main->screen.first;
|
2004-07-16 03:08:43 +00:00
|
|
|
PyObject *item, *list;
|
|
|
|
rcti *rct;
|
|
|
|
int type = -1;
|
|
|
|
char *rect = "win";
|
2004-07-20 08:16:46 +00:00
|
|
|
char *screen = "";
|
2004-09-25 20:30:40 +00:00
|
|
|
static char *kwlist[] = { "type", "rect", "screen", NULL };
|
2004-07-16 03:08:43 +00:00
|
|
|
int rctype = 0;
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !PyArg_ParseTupleAndKeywords( args, kwords, "|iss", kwlist, &type,
|
|
|
|
&rect, &screen ) )
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
"expected nothing or an int and two strings as arguments" );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !strcmp( rect, "win" ) )
|
2004-07-16 03:08:43 +00:00
|
|
|
rctype = 0;
|
2004-09-25 20:30:40 +00:00
|
|
|
else if( !strcmp( rect, "total" ) )
|
2004-07-16 03:08:43 +00:00
|
|
|
rctype = 1;
|
2004-09-25 20:30:40 +00:00
|
|
|
else if( !strcmp( rect, "header" ) )
|
2004-07-16 03:08:43 +00:00
|
|
|
rctype = 2;
|
|
|
|
else
|
2004-09-25 20:30:40 +00:00
|
|
|
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
|
|
|
"requested invalid type for area rectangle coordinates." );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
list = PyList_New( 0 );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( screen && screen[0] != '\0' ) {
|
|
|
|
while( scr ) {
|
|
|
|
if( !strcmp( scr->id.name + 2, screen ) ) {
|
2004-07-20 08:16:46 +00:00
|
|
|
sa = scr->areabase.first;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
scr = scr->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( !scr ) {
|
|
|
|
Py_DECREF( list );
|
|
|
|
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
|
|
|
"no such screen, see existing ones with Window.GetScreens." );
|
2004-07-20 08:16:46 +00:00
|
|
|
}
|
2004-09-25 20:30:40 +00:00
|
|
|
|
|
|
|
while( sa ) {
|
|
|
|
if( type != -1 && sa->spacetype != type ) {
|
2004-07-16 03:08:43 +00:00
|
|
|
sa = sa->next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
switch ( rctype ) {
|
|
|
|
case 0:
|
|
|
|
rct = &sa->winrct;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
rct = &sa->totrct;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
default:
|
|
|
|
rct = &sa->headrct;
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
item = Py_BuildValue( "{s:[h,h,h,h],s:h,s:h}",
|
|
|
|
"vertices", rct->xmin, rct->ymin,
|
|
|
|
rct->xmax, rct->ymax, "type",
|
|
|
|
( short ) sa->spacetype, "id",
|
|
|
|
( short ) sa->win );
|
|
|
|
PyList_Append( list, item );
|
|
|
|
Py_DECREF( item );
|
2004-07-16 03:08:43 +00:00
|
|
|
|
|
|
|
sa = sa->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
Interface:
- added submenu "Scripts" in both View3D->Object and Mesh menus.
Put them on top (it's better to follow some guideline, so users don't have to search for "Scripts" submenu in a different position in each menu), feel free to change.
- added button 'previous win' to SpaceScript, makes accessing buttons win, for example, much faster. Maybe all spaces could have this button.
BPython:
- added Window.EditMode(), to check, enter and leave edit mode. Scripts that change mesh data need this to leave edit mode before making changes to the active (G.obedit) mesh, of course.
- updated script bevel_center to use the above function and also popup an error msg if the active obj is not a mesh.
- doc updates, minor fixes.
Forgot to mention in my previous commit that I also updated the "-P" command-line option (for running script files) to be able to run already loaded Blender Texts, too. So, if you have a script called 'Text' in foo.blend, you can run it with blender foo.blend -P Text .
2004-07-03 17:28:15 +00:00
|
|
|
|
2003-05-08 03:06:46 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
/* Function: Window_Init */
|
2003-05-08 03:06:46 +00:00
|
|
|
/*****************************************************************************/
|
2004-09-25 20:30:40 +00:00
|
|
|
PyObject *Window_Init( void )
|
2003-05-08 03:06:46 +00:00
|
|
|
{
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
PyObject *submodule, *Types, *Qual, *MButs, *dict;
|
2004-09-25 20:30:40 +00:00
|
|
|
|
|
|
|
submodule =
|
|
|
|
Py_InitModule3( "Blender.Window", M_Window_methods,
|
|
|
|
M_Window_doc );
|
|
|
|
|
|
|
|
dict = PyModule_GetDict( submodule );
|
|
|
|
if( dict )
|
|
|
|
PyDict_SetItemString( dict, "Theme", Theme_Init( ) );
|
|
|
|
|
2005-08-17 14:26:00 +00:00
|
|
|
Types = PyConstant_New( );
|
|
|
|
Qual = PyConstant_New( );
|
|
|
|
MButs = PyConstant_New( );
|
2004-09-25 20:30:40 +00:00
|
|
|
|
|
|
|
if( Types ) {
|
|
|
|
BPy_constant *d = ( BPy_constant * ) Types;
|
|
|
|
|
2005-08-17 14:26:00 +00:00
|
|
|
PyConstant_Insert( d, "VIEW3D", PyInt_FromLong( SPACE_VIEW3D ) );
|
|
|
|
PyConstant_Insert( d, "IPO", PyInt_FromLong( SPACE_IPO ) );
|
|
|
|
PyConstant_Insert( d, "OOPS", PyInt_FromLong( SPACE_OOPS ) );
|
|
|
|
PyConstant_Insert( d, "BUTS", PyInt_FromLong( SPACE_BUTS ) );
|
|
|
|
PyConstant_Insert( d, "FILE", PyInt_FromLong( SPACE_FILE ) );
|
|
|
|
PyConstant_Insert( d, "IMAGE", PyInt_FromLong( SPACE_IMAGE ) );
|
|
|
|
PyConstant_Insert( d, "INFO", PyInt_FromLong( SPACE_INFO ) );
|
|
|
|
PyConstant_Insert( d, "SEQ", PyInt_FromLong( SPACE_SEQ ) );
|
|
|
|
PyConstant_Insert( d, "IMASEL", PyInt_FromLong( SPACE_IMASEL ) );
|
|
|
|
PyConstant_Insert( d, "SOUND", PyInt_FromLong( SPACE_SOUND ) );
|
|
|
|
PyConstant_Insert( d, "ACTION", PyInt_FromLong( SPACE_ACTION ) );
|
|
|
|
PyConstant_Insert( d, "TEXT", PyInt_FromLong( SPACE_TEXT ) );
|
|
|
|
PyConstant_Insert( d, "NLA", PyInt_FromLong( SPACE_NLA ) );
|
|
|
|
PyConstant_Insert( d, "SCRIPT", PyInt_FromLong( SPACE_SCRIPT ) );
|
|
|
|
PyConstant_Insert( d, "TIME", PyInt_FromLong( SPACE_TIME ) );
|
2006-12-30 18:28:49 +00:00
|
|
|
PyConstant_Insert( d, "NODE", PyInt_FromLong( SPACE_NODE ) );
|
2004-09-25 20:30:40 +00:00
|
|
|
|
|
|
|
PyModule_AddObject( submodule, "Types", Types );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
if( Qual ) {
|
|
|
|
BPy_constant *d = ( BPy_constant * ) Qual;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2005-08-17 14:26:00 +00:00
|
|
|
PyConstant_Insert( d, "LALT", PyInt_FromLong( L_ALTKEY ) );
|
|
|
|
PyConstant_Insert( d, "RALT", PyInt_FromLong( R_ALTKEY ) );
|
|
|
|
PyConstant_Insert( d, "ALT", PyInt_FromLong( LR_ALTKEY ) );
|
|
|
|
PyConstant_Insert( d, "LCTRL", PyInt_FromLong( L_CTRLKEY ) );
|
|
|
|
PyConstant_Insert( d, "RCTRL", PyInt_FromLong( R_CTRLKEY ) );
|
|
|
|
PyConstant_Insert( d, "CTRL", PyInt_FromLong( LR_CTRLKEY ) );
|
|
|
|
PyConstant_Insert( d, "LSHIFT", PyInt_FromLong( L_SHIFTKEY ) );
|
|
|
|
PyConstant_Insert( d, "RSHIFT", PyInt_FromLong( R_SHIFTKEY ) );
|
|
|
|
PyConstant_Insert( d, "SHIFT", PyInt_FromLong( LR_SHIFTKEY ) );
|
2003-05-08 03:06:46 +00:00
|
|
|
|
2004-09-25 20:30:40 +00:00
|
|
|
PyModule_AddObject( submodule, "Qual", Qual );
|
2004-07-16 03:08:43 +00:00
|
|
|
}
|
2003-05-08 03:06:46 +00:00
|
|
|
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
if( MButs ) {
|
|
|
|
BPy_constant *d = ( BPy_constant * ) MButs;
|
|
|
|
|
2005-08-17 14:26:00 +00:00
|
|
|
PyConstant_Insert( d, "L", PyInt_FromLong( L_MOUSE ) );
|
|
|
|
PyConstant_Insert( d, "M", PyInt_FromLong( M_MOUSE ) );
|
|
|
|
PyConstant_Insert( d, "R", PyInt_FromLong( R_MOUSE ) );
|
BPython:
- Blender.Window: added function GetPerspMatrix() (Tom Musgrave's patch, thanks);
- added Chris Want's patch to tell argc, argv to the Python interpreter (thanks, Hos);
- Blender.Image: added image.glFree() to free textures bound by the recently added
image.glLoad() (both suggested by Campbell Barton -- thanks, with these Blender can
be used to load textures for scripts);
- Blender.Sound: removed for now at least a few get/set methods of vars that can't be
accessed via interface;
- renamed Get/makeActive to Get/setCurrent in Blender.World (actually added alias for
now), same in Blender.Sound: renamed makeActive to setCurrent. Stephen Swaney
pointed this some weeks ago, we should stick to one naming convention.
- added documentation for Sound and Window.Theme modules and the other added
functions, made other small updates.
- Blender.Object: made 'worldspace' become the default output of .getMatrix and .mat/.matrix:
after reading a discussion on blender.org's Python forum where eeshlo mentioned the
pre 2.34 default was worldspace, I took a better look at Blender's relevant code,
confirmed, talked to Theeth about this and as he suggested am changing the default
back to 'worldspace'.
2004-10-20 05:51:24 +00:00
|
|
|
|
|
|
|
PyModule_AddObject( submodule, "MButs", MButs );
|
|
|
|
}
|
|
|
|
|
2003-12-14 01:18:09 +00:00
|
|
|
return submodule;
|
2003-05-08 03:06:46 +00:00
|
|
|
}
|