svn merge ^/trunk/blender -r49520:49531
authorCampbell Barton <ideasman42@gmail.com>
Fri, 3 Aug 2012 13:29:33 +0000 (13:29 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 3 Aug 2012 13:29:33 +0000 (13:29 +0000)
35 files changed:
source/blender/compositor/COM_compositor.h
source/blender/compositor/intern/COM_ExecutionGroup.h
source/blender/compositor/intern/COM_ExecutionSystem.h
source/blender/compositor/intern/COM_MemoryBuffer.cpp
source/blender/compositor/intern/COM_NodeOperation.h
source/blender/compositor/intern/COM_OpenCLDevice.cpp
source/blender/compositor/intern/COM_OpenCLDevice.h
source/blender/compositor/intern/COM_WorkScheduler.cpp
source/blender/compositor/intern/COM_compositor.cpp
source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
source/blender/compositor/operations/COM_BokehBlurOperation.cpp
source/blender/compositor/operations/COM_BokehBlurOperation.h
source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
source/blender/compositor/operations/COM_ColorMatteOperation.cpp
source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
source/blender/compositor/operations/COM_DilateErodeOperation.cpp
source/blender/compositor/operations/COM_DilateErodeOperation.h
source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp
source/blender/compositor/operations/COM_DirectionalBlurOperation.h
source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
source/blender/compositor/operations/COM_OpenCLKernels.cl.h
source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h
source/blender/compositor/operations/COM_WriteBufferOperation.cpp
source/blender/compositor/operations/COM_WriteBufferOperation.h
source/blender/editors/object/object_relations.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_edit.c
source/blender/makesrna/intern/rna_vfont.c

index cd1615c909449efec4f0c8ad011e034b7e5b542c..4e955ea3df19291695db7998065af877a25912b3 100644 (file)
@@ -297,7 +297,7 @@ extern "C" {
  *     - output nodes can have different priorities in the WorkScheduler.
  * This is implemented in the COM_execute function.
  */
-void COM_execute(RenderDatard, bNodeTree *editingtree, int rendering);
+void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering);
 
 /**
  * @brief Return a list of highlighted bnodes pointers.
@@ -310,7 +310,7 @@ void COM_startReadHighlights(void);
  * @param bnode
  * @return 
  */
-int COM_isHighlightedbNode(bNodebnode);
+int COM_isHighlightedbNode(bNode *bnode);
 
 #ifdef __cplusplus
 }
index e890715cafe80622fc77c54d0dab13760b5fcc51..a87b40af89ddd1e84d43a7e6de4b4212f8830a17 100644 (file)
@@ -316,7 +316,7 @@ public:
         * @brief get all inputbuffers needed to calculate an chunk
         * @note all inputbuffers must be executed
         * @param chunkNumber the chunk to be calculated
-        * @return MemoryBuffer** the inputbuffers
+        * @return (MemoryBuffer **) the inputbuffers
         */
        MemoryBuffer **getInputBuffersCPU();
 
@@ -324,7 +324,7 @@ public:
         * @brief get all inputbuffers needed to calculate an chunk
         * @note all inputbuffers must be executed
         * @param chunkNumber the chunk to be calculated
-        * @return MemoryBuffer** the inputbuffers
+        * @return (MemoryBuffer **) the inputbuffers
         */
        MemoryBuffer **getInputBuffersOpenCL(int chunkNumber);
 
index 4f6780c8d0b2d976798e950bd5509e1958f4fb98..ac849bf4f6cae1b1dae6132933f654f1ba79a817 100644 (file)
@@ -153,7 +153,7 @@ public:
         * @brief Create a new ExecutionSystem and initialize it with the
         * editingtree.
         *
-        * @param editingtree [bNodeTree*]
+        * @param editingtree [bNodeTree *]
         * @param rendering [true false]
         */
        ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation);
index eae98a1211f454b1e891cd897ac1ad9983ec0b62..3b8fbd6d708fb2b39a78bdf817580d4b0ba39969 100644 (file)
@@ -248,7 +248,7 @@ static void imp2radangle(float A, float B, float C, float F, float *a, float *b,
                        *b = sqrtf(F2 / d);
                        *ecc = *a / *b;
                }
-               // incr theta by 0.5*pi (angle of major axis)
+               /* incr theta by 0.5 * pi (angle of major axis) */
                *th = 0.5f * (atan2f(B, AmC) + (float)M_PI);
        }
 }
index 9b6d574e321742e2dfe2fb55d49f4af61a9fd5da..a9cf281b02f88166bc0d8703f9cd74480870d387 100644 (file)
@@ -148,7 +148,7 @@ public:
         * @param memoryBuffers all input MemoryBuffer's needed
         * @param outputBuffer the outputbuffer to write to
         */
-       virtual void executeOpenCLRegion(OpenCLDevicedevice, rcti *rect,
+       virtual void executeOpenCLRegion(OpenCLDevice *device, rcti *rect,
                                         unsigned int chunkNumber, MemoryBuffer **memoryBuffers, MemoryBuffer *outputBuffer) {}
 
        /**
@@ -163,7 +163,7 @@ public:
         * @param clMemToCleanUp all created cl_mem references must be added to this list. Framework will clean this after execution
         * @param clKernelsToCleanUp all created cl_kernel references must be added to this list. Framework will clean this after execution
         */
-       virtual void executeOpenCL(OpenCLDevicedevice, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp) {}
+       virtual void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp) {}
        virtual void deinitExecution();
 
        bool isResolutionSet() {
index 63f7568177988ef08a5a217285dc124451b30911..be5936b495e96f391e80b108298799e87acd1ae6 100644 (file)
@@ -67,7 +67,7 @@ void OpenCLDevice::execute(WorkPackage *work)
 }
 cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader)
 {
-       return COM_clAttachMemoryBufferToKernelParameter(kernel, parameterIndex, offsetIndex, cleanup, inputMemoryBuffers, (ReadBufferOperation*)reader);
+       return COM_clAttachMemoryBufferToKernelParameter(kernel, parameterIndex, offsetIndex, cleanup, inputMemoryBuffers, (ReadBufferOperation *)reader);
 }
 
 cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, ReadBufferOperation *reader)
@@ -106,7 +106,7 @@ void OpenCLDevice::COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel ker
        }
 }
 
-void OpenCLDevice::COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offsetIndex, NodeOperationoperation)
+void OpenCLDevice::COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offsetIndex, NodeOperation *operation)
 {
        if (offsetIndex != -1) {
                cl_int error;
@@ -133,7 +133,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo
        if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
 }
 
-void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer, int offsetIndex, NodeOperationoperation)
+void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer, int offsetIndex, NodeOperation *operation)
 {
        cl_int error;
        const int width = outputMemoryBuffer->getWidth();
index f1a1e31c9300e7fc1aac394acf6433e25acedf99..2021cacabcceec93f682a331781f8502c0917f3b 100644 (file)
@@ -100,9 +100,9 @@ public:
        cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, ReadBufferOperation *reader);
        void COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel kernel, int offsetIndex, MemoryBuffer *memoryBuffers);
        void COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, cl_mem clOutputMemoryBuffer);
-       void COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offsetIndex, NodeOperationoperation);
+       void COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offsetIndex, NodeOperation *operation);
        void COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer);
-       void COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer, int offsetIndex, NodeOperationoperation);
+       void COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer, int offsetIndex, NodeOperation *operation);
        cl_kernel COM_clCreateKernel(const char *kernelname, list<cl_kernel> *clKernelsToCleanUp);
 };
 
index 7d4134aca13e8c2699fd3c4487f89ca4eb368d1a..849c4affd9ccb3e6860368700440eae70fe7cb83 100644 (file)
@@ -77,20 +77,20 @@ void ** g_highlightedNodesRead;
 
 #define HIGHLIGHT(wp) \
 { \
-       ExecutionGroupgroup = wp->getExecutionGroup(); \
+       ExecutionGroup *group = wp->getExecutionGroup(); \
        if (group->isComplex()) { \
-               NodeOperationoperation = group->getOutputNodeOperation(); \
-               if (operation->isWriteBufferOperation()) {\
-                       WriteBufferOperation *writeOperation = (WriteBufferOperation*)operation;\
+               NodeOperation *operation = group->getOutputNodeOperation(); \
+               if (operation->isWriteBufferOperation()) { \
+                       WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation; \
                        NodeOperation *complexOperation = writeOperation->getInput(); \
                        bNode *node = complexOperation->getbNode(); \
                        if (node) { \
                                if (node->original) { \
-                                       node = node->original;\
-                               }\
-                               if (g_highlightIndex < MAX_HIGHLIGHT) {\
-                                       g_highlightedNodes[g_highlightIndex++] = node;\
-                               }\
+                                       node = node->original; \
+                               } \
+                               if (g_highlightIndex < MAX_HIGHLIGHT) { \
+                                       g_highlightedNodes[g_highlightIndex++] = node; \
+                               } \
                        } \
                } \
        } \
@@ -103,18 +103,18 @@ void COM_startReadHighlights()
        }
        
        g_highlightedNodesRead = g_highlightedNodes;
-       g_highlightedNodes = new void*[MAX_HIGHLIGHT];
+       g_highlightedNodes = new void *[MAX_HIGHLIGHT];
        g_highlightIndex = 0;
        for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
                g_highlightedNodes[i] = 0;
        }
 }
 
-int COM_isHighlightedbNode(bNodebnode)
+int COM_isHighlightedbNode(bNode *bnode)
 {
        if (!g_highlightedNodesRead) return false;
        for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
-               voidp = g_highlightedNodesRead[i];
+               void *p = g_highlightedNodesRead[i];
                if (!p) return false;
                if (p == bnode) return true;
        }
index ab64f8f7bf18f93113c816c6c9943885fe5ded78..2402f9a11638a7f3f39b4754fb356982bee40395 100644 (file)
@@ -54,7 +54,7 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
        }
 
 
-       /* set progress bar to 0% and status to init compositing*/
+       /* set progress bar to 0% and status to init compositing */
        editingtree->progress(editingtree->prh, 0.0);
 
        bool twopass = (editingtree->flag&NTREE_TWO_PASS) > 0 && !rendering;
index 69f396396602f97aedad83874594da669d353e06..eab921863e917df82978e236061d028cef8645bd 100644 (file)
@@ -45,13 +45,13 @@ void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCon
        switch (node->custom1) {
                case CMP_NODE_CHANNEL_MATTE_CS_RGB:
                        break;
-               case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
+               case CMP_NODE_CHANNEL_MATTE_CS_HSV: /* HSV */
                        convert = new ConvertRGBToHSVOperation();
                        break;
-               case CMP_NODE_CHANNEL_MATTE_CS_YUV: /*YUV*/
+               case CMP_NODE_CHANNEL_MATTE_CS_YUV: /* YUV */
                        convert = new ConvertRGBToYUVOperation();
                        break;
-               case CMP_NODE_CHANNEL_MATTE_CS_YCC: /*YCC*/
+               case CMP_NODE_CHANNEL_MATTE_CS_YCC: /* YCC */
                        convert = new ConvertRGBToYCCOperation();
                        ((ConvertRGBToYCCOperation *)convert)->setMode(0); /* BLI_YCC_ITU_BT601 */
                        break;
index a3d685de9a6fcf06534ca052479d81b5a579face..7d190332c37de5006ffaf6f316b98df537e8d017 100644 (file)
@@ -193,7 +193,7 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
        return false;
 }
 
-void BokehBlurOperation::executeOpenCL(OpenCLDevicedevice,
+void BokehBlurOperation::executeOpenCL(OpenCLDevice *device,
                                        MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, 
                                        MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, 
                                        list<cl_kernel> *clKernelsToCleanUp) 
index eef5429c409960ebb7e8fd211c9318416313f5d8..646587197a9517893d01f0fe5196d06f7ba05ac9 100644 (file)
@@ -59,6 +59,6 @@ public:
 
        void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; }
        
-       void executeOpenCL(OpenCLDevicedevice, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp);
+       void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp);
 };
 #endif
index 85f606fafdf1801b6e70c1b242ab9f6d67167cae..e0e68f902891335b124f05c2ebfe87ec0a404c02 100644 (file)
@@ -100,7 +100,7 @@ void ChannelMatteOperation::executePixel(float *outputValue, float x, float y, P
        /* flip because 0.0 is transparent, not 1.0 */
        alpha = 1.0f - alpha;
        
-       /* test range*/
+       /* test range */
        if (alpha > limit_max) {
                alpha = inColor[3]; /*whatever it was prior */
        }
index 85a19d7c60fffc4dc8a451972e4fae8cf417dd7d..4be03e9d9149224142bec81e86cebcdcf6498717 100644 (file)
@@ -65,7 +65,7 @@ void ChromaMatteOperation::executePixel(float *outputValue, float x, float y, Pi
         */
 
        /* Algorithm from book "Video Demistified," does not include the spill reduction part */
-       /* find theta, the angle that the color space should be rotated based on key*/
+       /* find theta, the angle that the color space should be rotated based on key */
        theta = atan2(inKey[2], inKey[1]);
 
        /*rotate the cb and cr into x/z space */
index 5326e397494aaa1df0a284a3cf99bce6c688a821..26fbd99b43aeca73da9376239470ede2897fdf69 100644 (file)
@@ -75,7 +75,7 @@ void ColorMatteOperation::executePixel(float *outputValue, float x, float y, Pix
            /* hue */ ((h_wrap = 2.f * fabsf(inColor[0] - inKey[0])) < hue || (2.f - h_wrap) < hue)
            )
        {
-               outputValue[0] = 0.0f; /*make transparent*/
+               outputValue[0] = 0.0f; /* make transparent */
        }
 
        else { /*pixel is outside key color */
index 80416bbccdf83574518ea597a6d3b7a5b4123f1b..e3f95eac3b4f1c150744e64189313f0cd1b4f338 100644 (file)
@@ -71,7 +71,7 @@ void ConvertDepthToRadiusOperation::initExecution()
        this->m_dof_sp = (float)minsz / (16.f / this->m_cam_lens);    // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
        
        if (this->m_blurPostOperation) {
-               m_blurPostOperation->setSigma(m_aperture*128.0f);
+               m_blurPostOperation->setSigma(m_aperture * 128.0f);
        }
 }
 
@@ -87,9 +87,9 @@ void ConvertDepthToRadiusOperation::executePixel(float *outputValue, float x, fl
                
                // bug #6656 part 2b, do not rescale
 #if 0
-               bcrad = 0.5f*fabs(aperture*(dof_sp*(cam_invfdist - iZ) - 1.f));
+               bcrad = 0.5f * fabs(aperture * (dof_sp * (cam_invfdist - iZ) - 1.0f));
                // scale crad back to original maximum and blend
-               crad->rect[px] = bcrad + wts->rect[px]*(scf*crad->rect[px] - bcrad);
+               crad->rect[px] = bcrad + wts->rect[px] * (scf * crad->rect[px] - bcrad);
 #endif
                radius = 0.5f * fabsf(this->m_aperture * (this->m_dof_sp * (this->m_inverseFocalDistance - iZ) - 1.f));
                // 'bug' #6615, limit minimum radius to 1 pixel, not really a solution, but somewhat mitigates the problem
index ed3799fff5e0dea108530b65e33d7288a30989d5..a95d1eec2903e388071fa8c06a8775d7b3d8e577 100644 (file)
@@ -64,7 +64,7 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y
        /* average together the distances */
        difference = difference / 3.0f;
 
-       /*make 100% transparent*/
+       /* make 100% transparent */
        if (difference < tolerance) {
                outputValue[0] = 0.0f;
        }
@@ -81,7 +81,7 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y
                }
        }
        else {
-               /*foreground object*/
+               /* foreground object */
                outputValue[0] = inColor1[3];
        }
 }
index 2752c6a7b90ee1113f43146d12050c492106badb..0890bc750492ddee4905a6f2ba00fb5b34e29fe0 100644 (file)
@@ -234,7 +234,7 @@ bool DilateDistanceOperation::determineDependingAreaOfInterest(rcti *input, Read
        return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
 }
 
-void DilateDistanceOperation::executeOpenCL(OpenCLDevicedevice,
+void DilateDistanceOperation::executeOpenCL(OpenCLDevice *device,
                                             MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
                                             MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
                                             list<cl_kernel> *clKernelsToCleanUp)
@@ -291,7 +291,7 @@ void ErodeDistanceOperation::executePixel(float *color, int x, int y, void *data
        color[0] = value;
 }
 
-void ErodeDistanceOperation::executeOpenCL(OpenCLDevicedevice,
+void ErodeDistanceOperation::executeOpenCL(OpenCLDevice *device,
                                            MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
                                            MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
                                            list<cl_kernel> *clKernelsToCleanUp)
index 8c3eefb97e44c638419be228ca266c074d3a021a..bd044e79fbe6fbece99cdbd305897192d50b474f 100644 (file)
@@ -99,7 +99,7 @@ public:
        void setDistance(float distance) { this->m_distance = distance; }
        bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
        
-       void executeOpenCL(OpenCLDevicedevice,
+       void executeOpenCL(OpenCLDevice *device,
                           MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, 
                           MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
                           list<cl_kernel> *clKernelsToCleanUp);
@@ -113,7 +113,7 @@ public:
         */
        void executePixel(float *color, int x, int y, void *data);
 
-       void executeOpenCL(OpenCLDevicedevice,
+       void executeOpenCL(OpenCLDevice *device,
                           MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, 
                           MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, 
                           list<cl_kernel> *clKernelsToCleanUp);
index 5e6ff2c7da1d08d070794c626ad22e03d4139064..34bf9db77cef585bf8e831948834b934fe136400 100644 (file)
@@ -101,7 +101,7 @@ void DirectionalBlurOperation::executePixel(float *color, int x, int y, void *da
        mul_v4_v4fl(color, col2, 1.0f / (iterations+1));
 }
 
-void DirectionalBlurOperation::executeOpenCL(OpenCLDevicedevice,
+void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device,
                                        MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, 
                                        MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, 
                                        list<cl_kernel> *clKernelsToCleanUp) 
index cc49e947f9575181bb6c04f1f9946cd5672ce343..4de435a14181dd6728edbc6e98070a1542179ba5 100644 (file)
@@ -56,7 +56,7 @@ public:
        
        void setData(NodeDBlurData *data) { this->m_data = data; }
 
-       void executeOpenCL(OpenCLDevicedevice,
+       void executeOpenCL(OpenCLDevice *device,
                                               MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, 
                                               MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, 
                                               list<cl_kernel> *clKernelsToCleanUp);
index 7c5614c0de15c26ea1fe733363e699ad1c673ea5..847e58176755a4acf057d21f4f5870ed46d4aed0 100644 (file)
@@ -907,7 +907,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
         * or outer edge.
         *
         * Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even
-        * though gbuf[] is declared as unsigned short* (2 bytes) because we don't
+        * though gbuf[] is declared as (unsigned short *) (2 bytes) because we don't
         * store the pixel indexes, we only store x,y location of pixel in buffer.
         *
         * This does make the assumption that x and y can fit in 16 unsigned bits
index fd70d0d329a15e3e999ab13c6c6196e8fe95110b..f7ad3115f24825506a5d4197d84f53764c481077 100644 (file)
@@ -257,14 +257,14 @@ void GaussianBlurReferenceOperation::updateGauss()
 {
        int i;
        int x = MAX2(m_radx, m_rady);
-       this->m_maintabs = (float**)MEM_mallocN(x * sizeof(float *), "gauss array");
+       this->m_maintabs = (float **)MEM_mallocN(x * sizeof(float *), "gauss array");
        for (i = 0; i < x; i++)
                m_maintabs[i] = make_gausstab(i + 1);
 }
 
 void GaussianBlurReferenceOperation::executePixel(float *color, int x, int y, void *data)
 {
-       MemoryBuffer *memorybuffer = (MemoryBuffer*)data;
+       MemoryBuffer *memorybuffer = (MemoryBuffer *)data;
        float *buffer = memorybuffer->getBuffer();
        float *gausstabx, *gausstabcenty;
        float *gausstaby, *gausstabcentx;
index 7f637c127c1ff92b200f4d2f693601dffa684bad..31aae18992b7170b6b985d1145afb9b45e4211dd 100644 (file)
@@ -55,7 +55,7 @@ void LuminanceMatteOperation::executePixel(float *outputValue, float x, float y,
         * outputValue[0] = max(inputValue[3], min(high, max(low, ((inColor[0]-low)/(high-low))))
         */
                
-       /* test range*/
+       /* test range */
        if (inColor[0] > high) {
                alpha = 1.f;
        }
index cc18039c5b1dd449a0153d430eec3f657a392c50..7f60f97dfe8b03a09643986af801d7fe12867b98 100644 (file)
@@ -41,7 +41,7 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \
 "      float4 color = {0.0f,0.0f,0.0f,0.0f};\n" \
 "      float4 multiplyer = {0.0f,0.0f,0.0f,0.0f};\n" \
 "      float4 bokeh;\n" \
-"      const float radius2 = radius*2.0f;\n" \
+"      const float radius2 = radius * 2.0f;\n" \
 "      const int2 realCoordinate = coords + offsetOutput;\n" \
 "\n" \
 "      tempBoundingBox = read_imagef(boundingBox, SAMPLER_NEAREST, coords).s0;\n" \
@@ -56,10 +56,10 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \
 "              float2 uv;\n" \
 "              int2 inputXy;\n" \
 "\n" \
-"              for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny +=step, inputXy.y+=step) {\n" \
+"              for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny += step, inputXy.y += step) {\n" \
 "                      uv.y = ((realCoordinate.y-ny)/radius2)*bokehImageDim.y+bokehImageCenter.y;\n" \
 "\n" \
-"                      for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx +=step, inputXy.x+=step) {\n" \
+"                      for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx += step, inputXy.x += step) {\n" \
 "                              uv.x = ((realCoordinate.x-nx)/radius2)*bokehImageDim.x+bokehImageCenter.x;\n" \
 "                              bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);\n" \
 "                              color += bokeh * read_imagef(inputImage, SAMPLER_NEAREST, inputXy);\n" \
@@ -117,7 +117,7 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \
 "                                                              float2 uv = { 256.0f + dx * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize};\n" \
 "                                                              bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);\n" \
 "                                                              readColor = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);\n" \
-"                                                              color_accum += bokeh*readColor;\n" \
+"                                                              color_accum += bokeh * readColor;\n" \
 "                                                              multiplier_accum += bokeh;\n" \
 "                                                      }\n" \
 "                                              }\n" \
@@ -152,7 +152,7 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \
 "              const float deltaY = (realCoordinate.y - ny);\n" \
 "              for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx ++, inputXy.x++) {\n" \
 "                      const float deltaX = (realCoordinate.x - nx);\n" \
-"                      const float measuredDistance = deltaX*deltaX+deltaY*deltaY;\n" \
+"                      const float measuredDistance = deltaX * deltaX + deltaY * deltaY;\n" \
 "                      if (measuredDistance <= distanceSquared) {\n" \
 "                              value = max(value, read_imagef(inputImage, SAMPLER_NEAREST, inputXy).s0);\n" \
 "                      }\n" \
@@ -183,7 +183,7 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \
 "              for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx ++, inputXy.x++) {\n" \
 "                      const float deltaX = (realCoordinate.x - nx);\n" \
 "                      const float deltaY = (realCoordinate.y - ny);\n" \
-"                      const float measuredDistance = deltaX*deltaX+deltaY*deltaY;\n" \
+"                      const float measuredDistance = deltaX * deltaX + deltaY * deltaY;\n" \
 "                      if (measuredDistance <= distanceSquared) {\n" \
 "                              value = min(value, read_imagef(inputImage, SAMPLER_NEAREST, inputXy).s0);\n" \
 "                      }\n" \
index e28e77a5f5e2d7e7a5c0cbd0ee1ac6430f8c59a2..dcf9262d6460413db1f960a59cede571b33019ef 100644 (file)
@@ -79,10 +79,10 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *in
                newInput.xmin = input->xmin - this->m_kr2 - 2;
                newInput.xmax = input->xmax + this->m_kr2 + 2;
        } else {
-               newInput.xmin = input->xmin - 7; //(0.25f*20*1)+2 == worse case dispersion
+               newInput.xmin = input->xmin - 7;  /* (0.25f * 20 * 1) + 2 == worse case dispersion */
                newInput.ymin = input->ymin;
                newInput.ymax = input->ymax;
-               newInput.xmax = input->xmax + 7; //(0.25f*20*1)+2 == worse case dispersion
+               newInput.xmax = input->xmax + 7;  /* (0.25f * 20 * 1) + 2 == worse case dispersion */
        }
        return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
 }
index 66d7e9d4d99a8058043e76a71d2a1d95613af5b4..cd2438ecd12ed9eeca071ddfc39a7b71d6d79cd0 100644 (file)
@@ -63,22 +63,22 @@ void VariableSizeBokehBlurOperation::initExecution()
 }
 struct VariableSizeBokehBlurTileData
 {
-       MemoryBuffercolor;
-       MemoryBufferbokeh;
-       MemoryBuffersize;
+       MemoryBuffer *color;
+       MemoryBuffer *bokeh;
+       MemoryBuffer *size;
        int maxBlur;
 };
 
 void *VariableSizeBokehBlurOperation::initializeTileData(rcti *rect)
 {
        VariableSizeBokehBlurTileData *data = new VariableSizeBokehBlurTileData();
-       data->color = (MemoryBuffer*)this->m_inputProgram->initializeTileData(rect);
-       data->bokeh = (MemoryBuffer*)this->m_inputBokehProgram->initializeTileData(rect);
-       data->size = (MemoryBuffer*)this->m_inputSizeProgram->initializeTileData(rect);
+       data->color = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect);
+       data->bokeh = (MemoryBuffer *)this->m_inputBokehProgram->initializeTileData(rect);
+       data->size = (MemoryBuffer *)this->m_inputSizeProgram->initializeTileData(rect);
 
 
        rcti rect2;
-       this->determineDependingAreaOfInterest(rect, (ReadBufferOperation*)this->m_inputSizeProgram, &rect2);
+       this->determineDependingAreaOfInterest(rect, (ReadBufferOperation *)this->m_inputSizeProgram, &rect2);
        data->maxBlur = (int)data->size->getMaximumValue(&rect2);
        CLAMP(data->maxBlur, 1.0f, this->m_maxBlur);
        return data;
@@ -86,18 +86,18 @@ void *VariableSizeBokehBlurOperation::initializeTileData(rcti *rect)
 
 void VariableSizeBokehBlurOperation::deinitializeTileData(rcti *rect, void *data)
 {
-       VariableSizeBokehBlurTileData* result = (VariableSizeBokehBlurTileData*)data;
+       VariableSizeBokehBlurTileData *result = (VariableSizeBokehBlurTileData *)data;
        delete result;
 }
 
 void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, void *data)
 {
-       VariableSizeBokehBlurTileData* tileData = (VariableSizeBokehBlurTileData*)data;
-       MemoryBufferinputProgramBuffer = tileData->color;
-       MemoryBufferinputBokehBuffer = tileData->bokeh;
-       MemoryBufferinputSizeBuffer = tileData->size;
-       floatinputSizeFloatBuffer = inputSizeBuffer->getBuffer();
-       floatinputProgramFloatBuffer = inputProgramBuffer->getBuffer();
+       VariableSizeBokehBlurTileData *tileData = (VariableSizeBokehBlurTileData *)data;
+       MemoryBuffer *inputProgramBuffer = tileData->color;
+       MemoryBuffer *inputBokehBuffer = tileData->bokeh;
+       MemoryBuffer *inputSizeBuffer = tileData->size;
+       float *inputSizeFloatBuffer = inputSizeBuffer->getBuffer();
+       float *inputProgramFloatBuffer = inputProgramBuffer->getBuffer();
        float readColor[4];
        float bokeh[4];
        float tempSize[4];
@@ -126,13 +126,13 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, vo
                add_v4_fl(multiplier_accum, 1.0f);
                float sizeCenter = tempSize[0];
                
-               const int addXStep = QualityStepHelper::getStep()*COM_NUMBER_OF_CHANNELS;
+               const int addXStep = QualityStepHelper::getStep() * COM_NUMBER_OF_CHANNELS;
                
                if (sizeCenter > this->m_threshold) {
                        for (int ny = miny; ny < maxy; ny += QualityStepHelper::getStep()) {
                                float dy = ny - y;
                                int offsetNy = ny * inputSizeBuffer->getWidth() * COM_NUMBER_OF_CHANNELS;
-                               int offsetNxNy = offsetNy + (minx*COM_NUMBER_OF_CHANNELS);
+                               int offsetNxNy = offsetNy + (minx * COM_NUMBER_OF_CHANNELS);
                                for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
                                        if (nx != x || ny != y) 
                                        {
@@ -162,7 +162,7 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, vo
 
 }
 
-void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevicedevice,
+void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device,
                                        MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, 
                                        MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, 
                                        list<cl_kernel> *clKernelsToCleanUp) 
@@ -256,10 +256,10 @@ void InverseSearchRadiusOperation::initExecution()
        this->m_inputRadius = this->getInputSocketReader(0);
 }
 
-void* InverseSearchRadiusOperation::initializeTileData(rcti *rect) 
+voi *InverseSearchRadiusOperation::initializeTileData(rcti *rect)
 {
        MemoryBuffer * data = new MemoryBuffer(NULL, rect);
-       floatbuffer = data->getBuffer();
+       float *buffer = data->getBuffer();
        int x, y;
        int width = this->m_inputRadius->getWidth();
        int height = this->m_inputRadius->getHeight();
@@ -312,14 +312,14 @@ void* InverseSearchRadiusOperation::initializeTileData(rcti *rect)
 
 void InverseSearchRadiusOperation::executePixel(float *color, int x, int y, void *data) 
 {
-       MemoryBuffer *buffer = (MemoryBuffer*)data;
+       MemoryBuffer *buffer = (MemoryBuffer *)data;
        buffer->readNoCheck(color, x, y);
 }
 
 void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data) 
 {
        if (data) {
-               MemoryBuffer* mb = (MemoryBuffer*)data;
+               MemoryBuffer *mb = (MemoryBuffer *)data;
                delete mb;
        }
 }
@@ -339,10 +339,10 @@ void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[]
 bool InverseSearchRadiusOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
 {
        rcti newRect;
-       newRect.ymin = input->ymin*DIVIDER - m_maxBlur;
-       newRect.ymax = input->ymax*DIVIDER + m_maxBlur;
-       newRect.xmin = input->xmin*DIVIDER - m_maxBlur;
-       newRect.xmax = input->xmax*DIVIDER + m_maxBlur;
+       newRect.ymin = input->ymin * DIVIDER - m_maxBlur;
+       newRect.ymax = input->ymax * DIVIDER + m_maxBlur;
+       newRect.xmin = input->xmin * DIVIDER - m_maxBlur;
+       newRect.xmax = input->xmax * DIVIDER + m_maxBlur;
        return NodeOperation::determineDependingAreaOfInterest(&newRect, readOperation, output);
 }
 #endif
index e5430545323375b113b1efe4f671308bde6a53af..f53d54f8c2c42929014af843ce274ed631eed8d4 100644 (file)
@@ -66,7 +66,7 @@ public:
 
        void setThreshold(float threshold) { this->m_threshold = threshold; }
 
-       void executeOpenCL(OpenCLDevicedevice, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp);
+       void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp);
 };
 
 #ifdef COM_DEFOCUS_SEARCH
@@ -88,7 +88,7 @@ public:
         * Initialize the execution
         */
        void initExecution();
-       voidinitializeTileData(rcti *rect);
+       void *initializeTileData(rcti *rect);
        void deinitializeTileData(rcti *rect, void *data);
        
        /**
index 0a31a6e170bad206556012d9add905e13e0d5753..06ec5b51efd2ccc0ee546c00bf632cc4e5d1e2f8 100644 (file)
@@ -110,7 +110,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber)
        memoryBuffer->setCreatedState();
 }
 
-void WriteBufferOperation::executeOpenCLRegion(OpenCLDevicedevice, rcti *rect, unsigned int chunkNumber, MemoryBuffer **inputMemoryBuffers, MemoryBuffer *outputBuffer)
+void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, rcti *rect, unsigned int chunkNumber, MemoryBuffer **inputMemoryBuffers, MemoryBuffer *outputBuffer)
 {
        float *outputFloatBuffer = outputBuffer->getBuffer();
        cl_int error;
index 1aa93c658cb92f0284a92639c405986b94679161..f1632689dbe120ad45b40ba56edace75c5d37540 100644 (file)
@@ -44,7 +44,7 @@ public:
        void executeRegion(rcti *rect, unsigned int tileNumber);
        void initExecution();
        void deinitExecution();
-       void executeOpenCLRegion(OpenCLDevicedevice, rcti *rect, unsigned int chunkNumber, MemoryBuffer **memoryBuffers, MemoryBuffer *outputBuffer);
+       void executeOpenCLRegion(OpenCLDevice *device, rcti *rect, unsigned int chunkNumber, MemoryBuffer **memoryBuffers, MemoryBuffer *outputBuffer);
        void readResolutionFromInputSocket();
        inline NodeOperation *getInput() {
                return m_input;
index 28a8b4f3b2d0b000969e303fe0b622171f885887..561ebafc0d7be1c42ff76a4046a8e49eb1753170 100644 (file)
@@ -47,6 +47,7 @@
 #include "DNA_speaker_types.h"
 #include "DNA_world_types.h"
 #include "DNA_object_types.h"
+#include "DNA_vfont_types.h"
 
 #include "BLI_math.h"
 #include "BLI_listbase.h"
@@ -1284,20 +1285,21 @@ enum {
        MAKE_LINKS_ANIMDATA,
        MAKE_LINKS_GROUP,
        MAKE_LINKS_DUPLIGROUP,
-       MAKE_LINKS_MODIFIERS
+       MAKE_LINKS_MODIFIERS,
+       MAKE_LINKS_FONTS
 };
 
 /* Return 1 if make link data is allow, zero otherwise */
-static int allow_make_links_data(const int type, Object *ob, Object *obt)
+static int allow_make_links_data(const int type, Object *ob_src, Object *ob_dst)
 {
        switch (type) {
                case MAKE_LINKS_OBDATA:
-                       if (ob->type == obt->type && ob->type != OB_EMPTY)
+                       if (ob_src->type == ob_dst->type && ob_src->type != OB_EMPTY)
                                return 1;
                        break;
                case MAKE_LINKS_MATERIALS:
-                       if (OB_TYPE_SUPPORT_MATERIAL(ob->type) &&
-                           OB_TYPE_SUPPORT_MATERIAL(obt->type))
+                       if (OB_TYPE_SUPPORT_MATERIAL(ob_src->type) &&
+                           OB_TYPE_SUPPORT_MATERIAL(ob_dst->type))
                        {
                                return 1;
                        }
@@ -1307,9 +1309,17 @@ static int allow_make_links_data(const int type, Object *ob, Object *obt)
                case MAKE_LINKS_DUPLIGROUP:
                        return 1;
                case MAKE_LINKS_MODIFIERS:
-                       if (ob->type != OB_EMPTY && obt->type != OB_EMPTY)
+                       if (ob_src->type != OB_EMPTY && ob_dst->type != OB_EMPTY)
                                return 1;
                        break;
+               case MAKE_LINKS_FONTS:
+                       if ((ob_src->data != ob_dst->data) &&
+                           (ob_src->type == OB_FONT) &&
+                           (ob_dst->type == OB_FONT))
+                       {
+                               return 1;
+                       }
+                       break;
        }
        return 0;
 }
@@ -1393,6 +1403,27 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
                                                BKE_object_link_modifiers(ob_dst, ob_src);
                                                ob_dst->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
                                                break;
+                                       case MAKE_LINKS_FONTS:
+                                       {
+                                               Curve *cu_src = ob_src->data;
+                                               Curve *cu_dst = ob_dst->data;
+
+                                               if (cu_dst->vfont) cu_dst->vfont->id.us--;
+                                               cu_dst->vfont = cu_src->vfont;
+                                               id_us_plus((ID *)cu_dst->vfont);
+                                               if (cu_dst->vfontb) cu_dst->vfontb->id.us--;
+                                               cu_dst->vfontb = cu_src->vfontb;
+                                               id_us_plus((ID *)cu_dst->vfontb);
+                                               if (cu_dst->vfonti) cu_dst->vfonti->id.us--;
+                                               cu_dst->vfonti = cu_src->vfonti;
+                                               id_us_plus((ID *)cu_dst->vfonti);
+                                               if (cu_dst->vfontbi) cu_dst->vfontbi->id.us--;
+                                               cu_dst->vfontbi = cu_src->vfontbi;
+                                               id_us_plus((ID *)cu_dst->vfontbi);
+
+                                               ob_dst->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+                                               break;
+                                       }
                                }
                        }
                }
@@ -1449,6 +1480,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
                {MAKE_LINKS_GROUP,      "GROUPS", 0, "Group", ""},
                {MAKE_LINKS_DUPLIGROUP, "DUPLIGROUP", 0, "DupliGroup", ""},
                {MAKE_LINKS_MODIFIERS,  "MODIFIERS", 0, "Modifiers", ""},
+               {MAKE_LINKS_FONTS,      "FONTS", 0, "Fonts", ""},
                {0, NULL, 0, NULL, NULL}};
 
        /* identifiers */
index 7b55560dca60bf0fd0c594178b6cab74cbd91511..3c61f68b9e4931639dbf2265a24279f9618fa7c7 100644 (file)
@@ -1136,7 +1136,7 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
        glDisable(GL_BLEND);
 
        /* outline active and selected emphasis */
-       if (node->flag & (NODE_ACTIVE | SELECT)) {
+       if (node->flag & SELECT) {
                glEnable(GL_BLEND);
                glEnable(GL_LINE_SMOOTH);
                /* using different shades of TH_TEXT_HI for the empasis, like triangle */
index a429f41620cac972847e71e17c2829b764172728..f1ba81acf903b7768673e8e3a228521f67625d4b 100644 (file)
@@ -881,7 +881,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
        uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
        
        /* outline active and selected emphasis */
-       if (node->flag & (NODE_ACTIVE | SELECT)) {
+       if (node->flag & SELECT) {
                glEnable(GL_BLEND);
                glEnable(GL_LINE_SMOOTH);
                
index c3e5337b642a130c37b036cc74bbe6e56b71fba9..d32303b27d1eb8f7f1268ec07a9e2b31d5766a48 100644 (file)
@@ -1904,7 +1904,9 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
 {
        SpaceNode *snode = CTX_wm_space_node(C);
        bNodeTree *ntree = snode->edittree;
-       bNode *node, *newnode;
+       bNode *gnode = node_tree_get_editgroup(snode->nodetree);
+       float gnode_x = 0.0f, gnode_y = 0.0f;
+       bNode *node, *new_node;
        bNodeLink *link, *newlink;
 
        ED_preview_kill_jobs(C);
@@ -1912,10 +1914,37 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
        /* clear current clipboard */
        nodeClipboardClear();
 
+       /* get group node offset */
+       if (gnode)
+               nodeToView(gnode, 0.0f, 0.0f, &gnode_x, &gnode_y);
+       
        for (node = ntree->nodes.first; node; node = node->next) {
                if (node->flag & SELECT) {
-                       newnode = nodeCopyNode(NULL, node);
-                       nodeClipboardAddNode(newnode);
+                       new_node = nodeCopyNode(NULL, node);
+                       nodeClipboardAddNode(new_node);
+               }
+       }
+
+       for (node = ntree->nodes.first; node; node = node->next) {
+               if (node->flag & SELECT) {
+                       bNode *new_node = node->new_node;
+                       
+                       /* ensure valid pointers */
+                       if (new_node->parent) {
+                               /* parent pointer must be redirected to new node or detached if parent is not copied */
+                               if (new_node->parent->flag & NODE_SELECT) {
+                                       new_node->parent = new_node->parent->new_node;
+                               }
+                               else {
+                                       nodeDetachNode(new_node);
+                               }
+                       }
+
+                       /* transform to basic view space. child node location is relative to parent */
+                       if (!new_node->parent) {        
+                               new_node->locx += gnode_x;
+                               new_node->locy += gnode_y;
+                       }
                }
        }
 
@@ -1938,16 +1967,6 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
                }
        }
 
-       /* reparent copied nodes */
-       for (node = ntree->nodes.first; node; node = node->next) {
-               if ((node->flag & SELECT) && node->parent) {
-                       if (node->parent->flag & SELECT)
-                               node->parent = node->parent->new_node;
-                       else
-                               node->parent = NULL;
-               }
-       }
-
        return OPERATOR_FINISHED;
 }
 
@@ -1972,6 +1991,8 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *UNUSED(op))
 {
        SpaceNode *snode = CTX_wm_space_node(C);
        bNodeTree *ntree = snode->edittree;
+       bNode *gnode = node_tree_get_editgroup(snode->nodetree);
+       float gnode_x = 0.0f, gnode_y = 0.0f;
        bNode *node;
        bNodeLink *link;
        int num_nodes;
@@ -1982,27 +2003,41 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *UNUSED(op))
        /* deselect old nodes */
        node_deselect_all(snode);
 
+       /* get group node offset */
+       if (gnode)
+               nodeToView(gnode, 0.0f, 0.0f, &gnode_x, &gnode_y);
+
        /* calculate "barycenter" for placing on mouse cursor */
        num_nodes = 0;
        centerx = centery = 0.0f;
        for (node = nodeClipboardGetNodes()->first; node; node = node->next) {
                ++num_nodes;
-               centerx += node->locx + 0.5f * node->width;
-               centery += node->locy - 0.5f * node->height;
+               centerx += 0.5f * (node->totr.xmin + node->totr.xmax);
+               centery += 0.5f * (node->totr.ymin + node->totr.ymax);
        }
        centerx /= num_nodes;
        centery /= num_nodes;
 
        /* copy nodes from clipboard */
        for (node = nodeClipboardGetNodes()->first; node; node = node->next) {
-               bNode *newnode = nodeCopyNode(ntree, node);
+               bNode *new_node = nodeCopyNode(ntree, node);
 
                /* pasted nodes are selected */
-               node_select(newnode);
-
-               /* place nodes around the mouse cursor */
-               newnode->locx += snode->mx - centerx;
-               newnode->locy += snode->my - centery;
+               node_select(new_node);
+       }
+       
+       /* reparent copied nodes */
+       for (node = nodeClipboardGetNodes()->first; node; node = node->next) {
+               bNode *new_node = node->new_node;
+               if (new_node->parent)
+                       new_node->parent = new_node->parent->new_node;
+               
+               
+               /* place nodes around the mouse cursor. child nodes locations are relative to parent */
+               if (!new_node->parent) {
+                       new_node->locx += snode->mx - centerx - gnode_x;
+                       new_node->locy += snode->my - centery - gnode_y;
+               }
        }
 
        for (link = nodeClipboardGetLinks()->first; link; link = link->next) {
@@ -2010,12 +2045,6 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *UNUSED(op))
                            link->tonode->new_node, link->tosock->new_sock);
        }
 
-       /* reparent copied nodes */
-       for (node = nodeClipboardGetNodes()->first; node; node = node->next) {
-               if (node->new_node->parent)
-                       node->new_node->parent = node->new_node->parent->new_node;
-       }
-
        ntreeUpdateTree(snode->edittree);
 
        snode_notify(C, snode);
index aca25252d2e87e626c4d3d0ee0295c4bebed5949..ad9c91b3623aa8d4dfe74b2c13e152b2ce9f2439 100644 (file)
@@ -24,7 +24,6 @@
  *  \ingroup RNA
  */
 
-
 #include <stdlib.h>
 
 #include "RNA_define.h"
 
 #ifdef RNA_RUNTIME
 
+/* matching fnction in rna_ID.c */
+static int rna_VectorFont_filepath_editable(PointerRNA *ptr)
+{
+       VFont *vf = (VFont *)ptr->data;
+       if (strcmp(vf->name, FO_BUILTIN_NAME) == 0) {
+               return 0;
+       }
+
+       return 1;
+}
+
 #else
 
 void RNA_def_vfont(BlenderRNA *brna)
@@ -48,8 +58,8 @@ void RNA_def_vfont(BlenderRNA *brna)
        RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
 
        prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
-       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_string_sdna(prop, NULL, "name");
+       RNA_def_property_editable_func(prop, "rna_VectorFont_filepath_editable");
        RNA_def_property_ui_text(prop, "File Path", "");
 
        prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
@@ -58,4 +68,3 @@ void RNA_def_vfont(BlenderRNA *brna)
 }
 
 #endif
-