[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42313] branches/tile/source/blender/ compositor: Tile-branch
Jeroen Bakker
j.bakker at atmind.nl
Thu Dec 1 15:46:43 CET 2011
Revision: 42313
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42313
Author: jbakker
Date: 2011-12-01 14:46:36 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
Tile-branch
removed the strange vector allocations in NodeBase. This stabelize the code a lot.
Next crash was about preview images. In order to do dynamic screen update the data can be lost during drawing. this needs to be fixed by working on copies.
Modified Paths:
--------------
branches/tile/source/blender/compositor/intern/COM_ExecutionGroup.cpp
branches/tile/source/blender/compositor/intern/COM_Node.cpp
branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp
branches/tile/source/blender/compositor/intern/COM_NodeBase.h
branches/tile/source/blender/compositor/intern/COM_NodeOperation.cpp
branches/tile/source/blender/compositor/nodes/COM_GroupNode.cpp
branches/tile/source/blender/compositor/nodes/COM_MuteNode.cpp
branches/tile/source/blender/compositor/nodes/COM_MuteNode.h
Modified: branches/tile/source/blender/compositor/intern/COM_ExecutionGroup.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_ExecutionGroup.cpp 2011-12-01 14:12:43 UTC (rev 42312)
+++ branches/tile/source/blender/compositor/intern/COM_ExecutionGroup.cpp 2011-12-01 14:46:36 UTC (rev 42313)
@@ -113,12 +113,15 @@
unsigned int index;
determineNumberOfChunks();
- this->chunkExecutionStates = new ChunkExecutionState[numberOfChunks];
-
- for (index = 0 ; index < numberOfChunks ; index ++) {
- this->chunkExecutionStates[index] = COM_ES_NOT_SCHEDULED;
+ this->chunkExecutionStates = NULL;
+ if (this->numberOfChunks != 0) {
+ this->chunkExecutionStates = new ChunkExecutionState[numberOfChunks];
+ for (index = 0 ; index < numberOfChunks ; index ++) {
+ this->chunkExecutionStates[index] = COM_ES_NOT_SCHEDULED;
+ }
}
+
unsigned int maxNumber = 0;
for (index = 0 ; index < this->operations.size(); index ++) {
Modified: branches/tile/source/blender/compositor/intern/COM_Node.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_Node.cpp 2011-12-01 14:12:43 UTC (rev 42312)
+++ branches/tile/source/blender/compositor/intern/COM_Node.cpp 2011-12-01 14:46:36 UTC (rev 42313)
@@ -143,18 +143,18 @@
}
InputSocket* Node::findInputSocketBybNodeSocket(bNodeSocket* socket) {
- vector<InputSocket> &inputsockets = this->getInputSockets();
+ vector<InputSocket*> &inputsockets = this->getInputSockets();
unsigned int index;
for (index = 0 ; index < inputsockets.size(); index ++) {
- InputSocket* input = &inputsockets[index];
+ InputSocket* input = inputsockets[index];
if (input->getbNodeSocket() == socket) {
return input;
}
}
if (this->isGroupNode()) {
- vector<OutputSocket> &outputsockets = this->getOutputSockets();
+ vector<OutputSocket*> &outputsockets = this->getOutputSockets();
for (index = 0 ; index < outputsockets.size(); index ++) {
- OutputSocket* output = &outputsockets[index];
+ OutputSocket* output = outputsockets[index];
if (output->getGroupInputSocket() != NULL) {
if (output->getGroupInputSocket()->getbNodeSocket() == socket) {
return output->getGroupInputSocket();
@@ -166,18 +166,18 @@
}
OutputSocket* Node::findOutputSocketBybNodeSocket(bNodeSocket* socket) {
- vector<OutputSocket> &outputsockets = this->getOutputSockets();
+ vector<OutputSocket*> &outputsockets = this->getOutputSockets();
unsigned int index;
for (index = 0 ; index < outputsockets.size(); index ++) {
- OutputSocket* output = &outputsockets[index];
+ OutputSocket* output = outputsockets[index];
if (output->getbNodeSocket() == socket) {
return output;
}
}
if (this->isGroupNode()) {
- vector<InputSocket> &inputsockets = this->getInputSockets();
+ vector<InputSocket*> &inputsockets = this->getInputSockets();
for (index = 0 ; index < inputsockets.size(); index ++) {
- InputSocket* input = &inputsockets[index];
+ InputSocket* input = inputsockets[index];
if (input->getGroupOutputSocket() != NULL) {
if (input->getGroupOutputSocket()->getbNodeSocket() == socket) {
return input->getGroupOutputSocket();
Modified: branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp 2011-12-01 14:12:43 UTC (rev 42312)
+++ branches/tile/source/blender/compositor/intern/COM_NodeBase.cpp 2011-12-01 14:46:36 UTC (rev 42313)
@@ -12,7 +12,16 @@
NodeBase::~NodeBase(){
+ unsigned int index;
+ for (index = 0 ; index < this->outputsockets.size(); index ++) {
+ OutputSocket * socket = this->outputsockets[index];
+ delete socket;
+ }
this->outputsockets.clear();
+ for (index = 0 ; index < this->inputsockets.size(); index ++) {
+ InputSocket * socket = this->inputsockets[index];
+ delete socket;
+ }
this->inputsockets.clear();
}
@@ -27,7 +36,7 @@
InputSocket *socket = new InputSocket(datatype, resizeMode);
socket->setEditorSocket(bSocket);
socket->setNode(this);
- this->inputsockets.push_back(*socket);
+ this->inputsockets.push_back(socket);
}
void NodeBase::addOutputSocket(DataType datatype) {
@@ -38,31 +47,31 @@
OutputSocket *socket = new OutputSocket(datatype);
socket->setEditorSocket(bSocket);
socket->setNode(this);
- this->outputsockets.push_back(*socket);
+ this->outputsockets.push_back(socket);
}
const bool NodeBase::isInputNode() const {
return this->inputsockets.size() == 0;
}
OutputSocket* NodeBase::getOutputSocket(int index) {
- return &this->outputsockets[index];
+ return this->outputsockets[index];
}
InputSocket* NodeBase::getInputSocket(int index) {
- return &this->inputsockets[index];
+ return this->inputsockets[index];
}
void NodeBase::determineActualSocketDataTypes() {
unsigned int index;
for (index = 0 ; index < this->outputsockets.size() ; index ++) {
- OutputSocket* socket = &(this->outputsockets[index]);
+ OutputSocket* socket = this->outputsockets[index];
if (socket->getActualDataType() ==COM_DT_UNKNOWN && socket->isConnected()) {
socket->determineActualDataType();
}
}
for (index = 0 ; index < this->inputsockets.size() ; index ++) {
- InputSocket* socket = &(this->inputsockets[index]);
+ InputSocket* socket = this->inputsockets[index];
if (socket->getActualDataType() ==COM_DT_UNKNOWN) {
socket->determineActualDataType();
}
@@ -82,7 +91,7 @@
unsigned int index;
int socketIndex = -1;
for (index = 0 ; index < this->inputsockets.size() ; index ++) {
- if (&this->inputsockets[index] == socket) {
+ if (this->inputsockets[index] == socket) {
socketIndex = (int)index;
break;
}
@@ -90,7 +99,7 @@
if (socketIndex == -1) return;
for (index = 0 ; index < this->outputsockets.size() ; index ++) {
- OutputSocket* socket = &(this->outputsockets[index]);
+ OutputSocket* socket = this->outputsockets[index];
if (socket->isActualDataTypeDeterminedByInputSocket() &&
socket->getInputSocketDataTypeDeterminatorIndex() == socketIndex) {
socket->setActualDataType(actualType);
Modified: branches/tile/source/blender/compositor/intern/COM_NodeBase.h
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_NodeBase.h 2011-12-01 14:12:43 UTC (rev 42312)
+++ branches/tile/source/blender/compositor/intern/COM_NodeBase.h 2011-12-01 14:46:36 UTC (rev 42313)
@@ -25,23 +25,23 @@
/**
* @brief the list of actual inputsockets @see InputSocket
*/
- vector<InputSocket> inputsockets;
+ vector<InputSocket*> inputsockets;
/**
* @brief the list of actual outputsockets @see OutputSocket
*/
- vector<OutputSocket> outputsockets;
+ vector<OutputSocket*> outputsockets;
protected:
/**
* @brief get access to the vector of input sockets
*/
- inline vector<InputSocket>& getInputSockets() {return this->inputsockets;}
+ inline vector<InputSocket*>& getInputSockets() {return this->inputsockets;}
/**
* @brief get access to the vector of input sockets
*/
- inline vector<OutputSocket>& getOutputSockets() {return this->outputsockets;}
+ inline vector<OutputSocket*>& getOutputSockets() {return this->outputsockets;}
public:
Modified: branches/tile/source/blender/compositor/intern/COM_NodeOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/intern/COM_NodeOperation.cpp 2011-12-01 14:12:43 UTC (rev 42312)
+++ branches/tile/source/blender/compositor/intern/COM_NodeOperation.cpp 2011-12-01 14:46:36 UTC (rev 42313)
@@ -16,13 +16,13 @@
void NodeOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) {
unsigned int temp[2];
unsigned int temp2[2];
- vector<InputSocket> &inputsockets = this->getInputSockets();
+ vector<InputSocket*> &inputsockets = this->getInputSockets();
for (unsigned int index = 0 ; index < inputsockets.size();index++) {
- InputSocket& inputSocket = inputsockets[index];
- if (inputSocket.isConnected()) {
+ InputSocket* inputSocket = inputsockets[index];
+ if (inputSocket->isConnected()) {
if (index == this->resolutionInputSocketIndex) {
- inputSocket.determineResolution(resolution, preferredResolution);
+ inputSocket->determineResolution(resolution, preferredResolution);
temp2[0] = resolution[0];
temp2[1] = resolution[1];
break;
@@ -30,10 +30,10 @@
}
}
for (unsigned int index = 0 ; index < inputsockets.size();index++) {
- InputSocket& inputSocket = inputsockets[index];
- if (inputSocket.isConnected()) {
+ InputSocket* inputSocket = inputsockets[index];
+ if (inputSocket->isConnected()) {
if (index != resolutionInputSocketIndex) {
- inputSocket.determineResolution(temp, temp2);
+ inputSocket->determineResolution(temp, temp2);
}
}
}
@@ -60,9 +60,9 @@
}
void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets) {
- vector<InputSocket> &inputsockets = this->getInputSockets();
- for (vector<InputSocket>::iterator iterator = inputsockets.begin() ; iterator!= inputsockets.end() ; iterator++) {
- InputSocket *socket = &(*iterator);
+ vector<InputSocket*> &inputsockets = this->getInputSockets();
+ for (vector<InputSocket*>::iterator iterator = inputsockets.begin() ; iterator!= inputsockets.end() ; iterator++) {
+ InputSocket *socket = *iterator;
if (socket->isConnected()) {
sockets->push_back(socket);
}
@@ -75,12 +75,12 @@
return false;
} else {
unsigned int index;
- vector<InputSocket> &inputsockets = this->getInputSockets();
+ vector<InputSocket*> &inputsockets = this->getInputSockets();
for (index = 0 ; index < inputsockets.size() ; index++) {
- InputSocket& inputsocket = inputsockets[index];
- if (inputsocket.isConnected()) {
- NodeOperation* inputoperation = (NodeOperation*)inputsocket.getConnection()->getFromNode();
+ InputSocket* inputsocket = inputsockets[index];
+ if (inputsocket->isConnected()) {
+ NodeOperation* inputoperation = (NodeOperation*)inputsocket->getConnection()->getFromNode();
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list