KX_CameraActuator: changing parameters from python script

Game Engine, Players & Web Plug-in, Virtual Reality, support for other engines

Moderators: jesterKing, stiv

Post Reply
mbouchard
Posts: 0
Joined: Fri Dec 17, 2004 8:30 pm

KX_CameraActuator: changing parameters from python script

Post by mbouchard »

I need to change the object to which a Camera Actuator is bounded to
from a Python script. However, KX_CameraActuator objects does not
have such attribute or method accessible from Python.

1. Is it possible to have it added to a further release of Blender?
2. Is there another way to acheive my goal?

Thanks.

z3r0_d
Posts: 289
Joined: Wed Oct 16, 2002 2:38 am
Contact:

Post by z3r0_d »

you could build your own camera actuator in python

alien-xmp
Posts: 0
Joined: Sun Apr 06, 2003 2:22 pm
Location: Wellington, New Zealand
Contact:

Post by alien-xmp »

1. Is it possible to have it added to a further release of Blender?
Yes... add it to the todo bug tracker, so I don't forget about it.

This is quite easy for someone wanting to get into Blender game engine coding. :-)

snail
Posts: 0
Joined: Sun Apr 25, 2004 11:11 pm

Post by snail »

alien-xmp wrote: This is quite easy for someone wanting to get into Blender game engine coding. :-)
I thought I would give it a try :)
camera patch

let me know if its up to standard :twisted:

alien-xmp
Posts: 0
Joined: Sun Apr 06, 2003 2:22 pm
Location: Wellington, New Zealand
Contact:

Post by alien-xmp »

Awesome! I'll apply the patch after the 2.36 cvs is unfrozen.

Only two comments:

Code: Select all

PyObject* KX_CameraActuator::PySetXY(PyObject* self, 
										PyObject* args, 
										PyObject* kwds)
{
	bool value;
	if(!PyArg_ParseTuple(args,"i", &value))
	{
		return NULL;
	}
	value == 1 ? m_x = true : m_x = false;
	Py_Return;
}
1. Any nonzero value is valid as true, so I changed it to:

Code: Select all

PyObject* KX_CameraActuator::PySetXY(PyObject* self, 
										PyObject* args, 
										PyObject* kwds)
{
	int value;
	if(PyArg_ParseTuple(args,"i", &value))
	{
		m_x = value != 0;
		Py_Return;
	}
	return NULL;
}
2. And the python doc needs to be updated. ;-)

snail
Posts: 0
Joined: Sun Apr 25, 2004 11:11 pm

Post by snail »


Post Reply