svn merge ^/trunk/blender -r48168:48188
This commit is contained in:
@@ -1532,6 +1532,7 @@ if(WITH_IMAGE_OPENJPEG)
|
||||
# dealt with above
|
||||
else()
|
||||
set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
|
||||
add_definitions(-DOPJ_STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ CXX = 'g++'
|
||||
CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
|
||||
CXXFLAGS = []
|
||||
|
||||
CPPFLAGS = ['-DWIN32', '-DFREE_WINDOWS', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC']
|
||||
CPPFLAGS = ['-DWIN32', '-DFREE_WINDOWS', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-DOPJ_STATIC']
|
||||
REL_CFLAGS = []
|
||||
REL_CXXFLAGS = []
|
||||
REL_CCFLAGS = ['-DNDEBUG', '-O2']
|
||||
|
||||
@@ -194,7 +194,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE']
|
||||
|
||||
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
|
||||
|
||||
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE']
|
||||
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE', '-DOPJ_STATIC']
|
||||
REL_CFLAGS = []
|
||||
REL_CXXFLAGS = []
|
||||
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
||||
|
||||
@@ -185,7 +185,7 @@ CXX = 'g++'
|
||||
CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
|
||||
CXXFLAGS = [ '-fpermissive' ]
|
||||
|
||||
CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC']
|
||||
CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-DOPJ_STATIC']
|
||||
REL_CFLAGS = []
|
||||
REL_CXXFLAGS = []
|
||||
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-ftree-vectorize']
|
||||
|
||||
@@ -193,7 +193,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast']
|
||||
|
||||
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od']
|
||||
|
||||
CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE']
|
||||
CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE', '-DOPJ_STATIC']
|
||||
REL_CFLAGS = []
|
||||
REL_CXXFLAGS = []
|
||||
REL_CCFLAGS = ['-O2', '-DNDEBUG']
|
||||
|
||||
@@ -1326,6 +1326,7 @@ class CLIP_MT_mask_animation(Menu):
|
||||
layout.operator("mask.shape_key_clear")
|
||||
layout.operator("mask.shape_key_insert")
|
||||
layout.operator("mask.shape_key_feather_reset")
|
||||
layout.operator("mask.shape_key_rekey")
|
||||
|
||||
|
||||
class CLIP_MT_camera_presets(Menu):
|
||||
|
||||
@@ -122,6 +122,7 @@ void BKE_mask_update_display(struct Mask *mask, float ctime);
|
||||
|
||||
void BKE_mask_evaluate_all_masks(struct Main *bmain, float ctime, const int do_newframe);
|
||||
void BKE_mask_evaluate(struct Mask *mask, const float ctime, const int do_newframe);
|
||||
void BKE_mask_layer_evaluate(struct MaskLayer *masklay, const float ctime, const int do_newframe);
|
||||
void BKE_mask_update_scene(struct Main *bmain, struct Scene *scene, const int do_newframe);
|
||||
void BKE_mask_parent_init(struct MaskParent *parent);
|
||||
void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
|
||||
|
||||
@@ -1473,51 +1473,46 @@ void BKE_mask_spline_ensure_deform(MaskSpline *spline)
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_mask_evaluate(Mask *mask, const float ctime, const int do_newframe)
|
||||
void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const int do_newframe)
|
||||
{
|
||||
MaskLayer *masklay;
|
||||
/* animation if available */
|
||||
if (do_newframe) {
|
||||
MaskLayerShape *masklay_shape_a;
|
||||
MaskLayerShape *masklay_shape_b;
|
||||
int found;
|
||||
|
||||
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||
|
||||
/* animation if available */
|
||||
if (do_newframe) {
|
||||
MaskLayerShape *masklay_shape_a;
|
||||
MaskLayerShape *masklay_shape_b;
|
||||
int found;
|
||||
|
||||
if ((found = BKE_mask_layer_shape_find_frame_range(masklay, ctime,
|
||||
&masklay_shape_a, &masklay_shape_b)))
|
||||
{
|
||||
if (found == 1) {
|
||||
if ((found = BKE_mask_layer_shape_find_frame_range(masklay, ctime,
|
||||
&masklay_shape_a, &masklay_shape_b)))
|
||||
{
|
||||
if (found == 1) {
|
||||
#if 0
|
||||
printf("%s: exact %d %d (%d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
|
||||
masklay_shape_a->frame);
|
||||
printf("%s: exact %d %d (%d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
|
||||
masklay_shape_a->frame);
|
||||
#endif
|
||||
|
||||
BKE_mask_layer_shape_to_mask(masklay, masklay_shape_a);
|
||||
}
|
||||
else if (found == 2) {
|
||||
float w = masklay_shape_b->frame - masklay_shape_a->frame;
|
||||
BKE_mask_layer_shape_to_mask(masklay, masklay_shape_a);
|
||||
}
|
||||
else if (found == 2) {
|
||||
float w = masklay_shape_b->frame - masklay_shape_a->frame;
|
||||
#if 0
|
||||
printf("%s: tween %d %d (%d %d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
|
||||
masklay_shape_a->frame, masklay_shape_b->frame);
|
||||
printf("%s: tween %d %d (%d %d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes),
|
||||
masklay_shape_a->frame, masklay_shape_b->frame);
|
||||
#endif
|
||||
BKE_mask_layer_shape_to_mask_interp(masklay, masklay_shape_a, masklay_shape_b,
|
||||
(ctime - masklay_shape_a->frame) / w);
|
||||
}
|
||||
else {
|
||||
/* always fail, should never happen */
|
||||
BLI_assert(found == 2);
|
||||
}
|
||||
BKE_mask_layer_shape_to_mask_interp(masklay, masklay_shape_a, masklay_shape_b,
|
||||
(ctime - masklay_shape_a->frame) / w);
|
||||
}
|
||||
else {
|
||||
/* always fail, should never happen */
|
||||
BLI_assert(found == 2);
|
||||
}
|
||||
}
|
||||
/* animation done... */
|
||||
}
|
||||
/* animation done... */
|
||||
|
||||
BKE_mask_calc_handles(mask);
|
||||
BKE_mask_layer_calc_handles(masklay);
|
||||
|
||||
|
||||
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||
/* update deform */
|
||||
{
|
||||
MaskSpline *spline;
|
||||
|
||||
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||
@@ -1561,6 +1556,15 @@ void BKE_mask_evaluate(Mask *mask, const float ctime, const int do_newframe)
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_mask_evaluate(Mask *mask, const float ctime, const int do_newframe)
|
||||
{
|
||||
MaskLayer *masklay;
|
||||
|
||||
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||
BKE_mask_layer_evaluate(masklay, ctime, do_newframe);
|
||||
}
|
||||
}
|
||||
|
||||
/* the purpose of this function is to ensure spline->points_deform is never out of date.
|
||||
* for now re-evaluate all. eventually this might work differently */
|
||||
void BKE_mask_update_display(Mask *mask, float ctime)
|
||||
|
||||
@@ -2396,7 +2396,7 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
|
||||
ImBuf *destination_ibuf;
|
||||
int frame_delta = context->backwards ? -1 : 1;
|
||||
int curfra = BKE_movieclip_remap_scene_to_clip_frame(context->clip, context->user.framenr);
|
||||
int nextfra;
|
||||
/* int nextfra; */ /* UNUSED */
|
||||
int a, ok = FALSE, map_size;
|
||||
|
||||
int frame_width, frame_height;
|
||||
@@ -2414,7 +2414,7 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
|
||||
if (!destination_ibuf)
|
||||
return FALSE;
|
||||
|
||||
nextfra = curfra + frame_delta;
|
||||
/* nextfra = curfra + frame_delta; */ /* UNUSED */
|
||||
|
||||
frame_width = destination_ibuf->x;
|
||||
frame_height = destination_ibuf->y;
|
||||
|
||||
@@ -222,6 +222,12 @@ MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack)
|
||||
r_col[2] = ((pack) >> 16) & 0xFF;
|
||||
}
|
||||
|
||||
/* XXX - investigate when/why rgb_to_bw & rgb_to_grayscale are different,
|
||||
* and why we use both! whats the purpose of this? */
|
||||
MINLINE float rgb_to_bw(const float rgb[3])
|
||||
{
|
||||
return 0.35f * rgb[0] + 0.45f * rgb[1] + 0.2f * rgb[2];
|
||||
}
|
||||
|
||||
MINLINE float rgb_to_grayscale(const float rgb[3])
|
||||
{
|
||||
|
||||
@@ -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(bNodeTree *editingtree, int rendering);
|
||||
void COM_execute(RenderData* rd, bNodeTree *editingtree, int rendering);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
#include "BKE_global.h"
|
||||
|
||||
ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
|
||||
ExecutionSystem::ExecutionSystem(Scene *scene, bNodeTree *editingtree, bool rendering)
|
||||
{
|
||||
context.setbNodeTree(editingtree);
|
||||
bNode *gnode;
|
||||
@@ -62,22 +62,18 @@ ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
|
||||
context.setRendering(rendering);
|
||||
context.setHasActiveOpenCLDevices(WorkScheduler::hasGPUDevices() && (editingtree->flag & NTREE_COM_OPENCL));
|
||||
|
||||
Node *mainOutputNode = NULL;
|
||||
ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree, NULL);
|
||||
|
||||
mainOutputNode = ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree, NULL);
|
||||
|
||||
if (mainOutputNode) {
|
||||
context.setScene((Scene *)mainOutputNode->getbNode()->id);
|
||||
this->convertToOperations();
|
||||
this->groupOperations(); /* group operations in ExecutionGroups */
|
||||
unsigned int index;
|
||||
unsigned int resolution[2];
|
||||
for (index = 0; index < this->groups.size(); index++) {
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
ExecutionGroup *executionGroup = groups[index];
|
||||
executionGroup->determineResolution(resolution);
|
||||
}
|
||||
context.setScene(scene);
|
||||
this->convertToOperations();
|
||||
this->groupOperations(); /* group operations in ExecutionGroups */
|
||||
unsigned int index;
|
||||
unsigned int resolution[2];
|
||||
for (index = 0; index < this->groups.size(); index++) {
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
ExecutionGroup *executionGroup = groups[index];
|
||||
executionGroup->determineResolution(resolution);
|
||||
}
|
||||
|
||||
#ifdef COM_DEBUG
|
||||
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
* @param editingtree [bNodeTree*]
|
||||
* @param rendering [true false]
|
||||
*/
|
||||
ExecutionSystem(bNodeTree *editingtree, bool rendering);
|
||||
ExecutionSystem(Scene *scene, bNodeTree *editingtree, bool rendering);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
||||
@@ -39,21 +39,17 @@
|
||||
#include "COM_ReadBufferOperation.h"
|
||||
#include "COM_ViewerBaseOperation.h"
|
||||
|
||||
Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode)
|
||||
void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode)
|
||||
{
|
||||
vector<Node *>& nodes = system.getNodes();
|
||||
vector<SocketConnection *>& links = system.getConnections();
|
||||
Node *mainnode = NULL;
|
||||
const bNode *activeGroupNode = system.getContext().getActivegNode();
|
||||
bool isActiveGroup = activeGroupNode == groupnode;
|
||||
|
||||
/* add all nodes of the tree to the node list */
|
||||
bNode *node = (bNode *)tree->nodes.first;
|
||||
while (node != NULL) {
|
||||
Node *execnode = addNode(nodes, node, isActiveGroup);
|
||||
if (node->type == CMP_NODE_COMPOSITE) {
|
||||
mainnode = execnode;
|
||||
}
|
||||
addNode(nodes, node, isActiveGroup);
|
||||
node = (bNode *)node->next;
|
||||
}
|
||||
|
||||
@@ -74,8 +70,6 @@ Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_sta
|
||||
groupNode->ungroup(system);
|
||||
}
|
||||
}
|
||||
|
||||
return mainnode;
|
||||
}
|
||||
|
||||
void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node)
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
* @param tree bNodeTree to add
|
||||
* @return Node representing the "Compositor node" of the maintree. or NULL when a subtree is added
|
||||
*/
|
||||
static Node *addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode);
|
||||
static void addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode);
|
||||
|
||||
/**
|
||||
* @brief add an editor node to the system.
|
||||
|
||||
@@ -87,11 +87,15 @@ void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket
|
||||
void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket)
|
||||
{
|
||||
if (this->isInActiveGroup()) {
|
||||
PreviewOperation *operation = new PreviewOperation();
|
||||
system->addOperation(operation);
|
||||
operation->setbNode(this->getbNode());
|
||||
operation->setbNodeTree(system->getContext().getbNodeTree());
|
||||
this->addLink(system, outputSocket, operation->getInputSocket(0));
|
||||
if (!(this->getbNode()->flag & NODE_HIDDEN)) { // do not calculate previews of hidden nodes.
|
||||
if (this->getbNode()->flag & NODE_PREVIEW) {
|
||||
PreviewOperation *operation = new PreviewOperation();
|
||||
system->addOperation(operation);
|
||||
operation->setbNode(this->getbNode());
|
||||
operation->setbNodeTree(system->getContext().getbNodeTree());
|
||||
this->addLink(system, outputSocket, operation->getInputSocket(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,63 +217,46 @@ void WorkScheduler::initialize()
|
||||
cl_platform_id *platforms = new cl_platform_id[numberOfPlatforms];
|
||||
error = clGetPlatformIDs(numberOfPlatforms, platforms, 0);
|
||||
unsigned int indexPlatform;
|
||||
cl_uint totalNumberOfDevices = 0;
|
||||
for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) {
|
||||
cl_platform_id platform = platforms[indexPlatform];
|
||||
cl_uint numberOfDevices;
|
||||
cl_uint numberOfDevices = 0;
|
||||
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices);
|
||||
totalNumberOfDevices += numberOfDevices;
|
||||
}
|
||||
if (numberOfDevices>0) {
|
||||
cl_device_id *cldevices = new cl_device_id[numberOfDevices];
|
||||
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices, 0);
|
||||
|
||||
cl_device_id *cldevices = new cl_device_id[totalNumberOfDevices];
|
||||
unsigned int numberOfDevicesReceived = 0;
|
||||
for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) {
|
||||
cl_platform_id platform = platforms[indexPlatform];
|
||||
cl_uint numberOfDevices;
|
||||
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices);
|
||||
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices + numberOfDevicesReceived * sizeof(cl_device_id), 0);
|
||||
numberOfDevicesReceived += numberOfDevices;
|
||||
}
|
||||
if (totalNumberOfDevices > 0) {
|
||||
context = clCreateContext(NULL, totalNumberOfDevices, cldevices, clContextError, NULL, &error);
|
||||
if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
program = clCreateProgramWithSource(context, 1, &clkernelstoh_COM_OpenCLKernels_cl, 0, &error);
|
||||
error = clBuildProgram(program, totalNumberOfDevices, cldevices, 0, 0, 0);
|
||||
if (error != CL_SUCCESS) {
|
||||
cl_int error2;
|
||||
size_t ret_val_size = 0;
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size);
|
||||
if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
char *build_log = new char[ret_val_size + 1];
|
||||
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL);
|
||||
if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
build_log[ret_val_size] = '\0';
|
||||
printf("%s", build_log);
|
||||
delete build_log;
|
||||
|
||||
}
|
||||
else {
|
||||
unsigned int indexDevices;
|
||||
for (indexDevices = 0; indexDevices < totalNumberOfDevices; indexDevices++) {
|
||||
cl_device_id device = cldevices[indexDevices];
|
||||
cl_int vendorID = 0;
|
||||
cl_int error = clGetDeviceInfo(device, CL_DEVICE_VENDOR_ID, sizeof(cl_int), &vendorID, NULL);
|
||||
if (error!= CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
OpenCLDevice *clDevice = new OpenCLDevice(context, device, program, vendorID);
|
||||
clDevice->initialize(),
|
||||
gpudevices.push_back(clDevice);
|
||||
if (G.f & G_DEBUG) {
|
||||
char resultString[32];
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_NAME, 32, resultString, 0);
|
||||
printf("OPENCL_DEVICE: %s, ", resultString);
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_VENDOR, 32, resultString, 0);
|
||||
printf("%s\n", resultString);
|
||||
context = clCreateContext(NULL, numberOfDevices, cldevices, clContextError, NULL, &error);
|
||||
if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
program = clCreateProgramWithSource(context, 1, &clkernelstoh_COM_OpenCLKernels_cl, 0, &error);
|
||||
error = clBuildProgram(program, numberOfDevices, cldevices, 0, 0, 0);
|
||||
if (error != CL_SUCCESS) {
|
||||
cl_int error2;
|
||||
size_t ret_val_size = 0;
|
||||
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
|
||||
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size);
|
||||
if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
char *build_log = new char[ret_val_size + 1];
|
||||
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL);
|
||||
if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
build_log[ret_val_size] = '\0';
|
||||
printf("%s", build_log);
|
||||
delete build_log;
|
||||
}
|
||||
else {
|
||||
unsigned int indexDevices;
|
||||
for (indexDevices = 0; indexDevices < numberOfDevices; indexDevices++) {
|
||||
cl_device_id device = cldevices[indexDevices];
|
||||
cl_int vendorID = 0;
|
||||
cl_int error = clGetDeviceInfo(device, CL_DEVICE_VENDOR_ID, sizeof(cl_int), &vendorID, NULL);
|
||||
if (error!= CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
|
||||
OpenCLDevice *clDevice = new OpenCLDevice(context, device, program, vendorID);
|
||||
clDevice->initialize();
|
||||
gpudevices.push_back(clDevice);
|
||||
}
|
||||
}
|
||||
delete cldevices;
|
||||
}
|
||||
}
|
||||
delete[] cldevices;
|
||||
delete[] platforms;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
extern "C" {
|
||||
#include "BLI_threads.h"
|
||||
}
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_global.h"
|
||||
|
||||
#include "COM_compositor.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
@@ -32,7 +34,7 @@ extern "C" {
|
||||
#include "OCL_opencl.h"
|
||||
|
||||
static ThreadMutex *compositorMutex;
|
||||
void COM_execute(bNodeTree *editingtree, int rendering)
|
||||
void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
|
||||
{
|
||||
if (compositorMutex == NULL) { /// TODO: move to blender startup phase
|
||||
compositorMutex = new ThreadMutex();
|
||||
@@ -41,7 +43,7 @@ void COM_execute(bNodeTree *editingtree, int rendering)
|
||||
WorkScheduler::initialize(); ///TODO: call workscheduler.deinitialize somewhere
|
||||
}
|
||||
BLI_mutex_lock(compositorMutex);
|
||||
if (editingtree->test_break && editingtree->test_break(editingtree->tbh)) {
|
||||
if (editingtree->test_break(editingtree->tbh)) {
|
||||
// during editing multiple calls to this method can be triggered.
|
||||
// make sure one the last one will be doing the work.
|
||||
BLI_mutex_unlock(compositorMutex);
|
||||
@@ -49,13 +51,20 @@ void COM_execute(bNodeTree *editingtree, int rendering)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* set progress bar to 0% and status to init compositing*/
|
||||
editingtree->progress(editingtree->prh, 0.0);
|
||||
|
||||
/* initialize execution system */
|
||||
ExecutionSystem *system = new ExecutionSystem(editingtree, rendering);
|
||||
system->execute();
|
||||
delete system;
|
||||
Scene *scene;
|
||||
for (scene = (Scene*)G.main->scene.first; scene != NULL ; scene = (Scene*)scene->id.next) {
|
||||
if (&scene->r == rd) {
|
||||
ExecutionSystem *system = new ExecutionSystem(scene, editingtree, rendering);
|
||||
system->execute();
|
||||
delete system;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BLI_mutex_unlock(compositorMutex);
|
||||
}
|
||||
|
||||
@@ -46,27 +46,25 @@ void HueSaturationValueCorrectNode::convertToOperations(ExecutionSystem *graph,
|
||||
bNode *editorsnode = getbNode();
|
||||
CurveMapping *storage = (CurveMapping *)editorsnode->storage;
|
||||
|
||||
if (colourSocket->isConnected() && outputSocket->isConnected()) {
|
||||
ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation();
|
||||
ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation();
|
||||
HueSaturationValueCorrectOperation *changeHSV = new HueSaturationValueCorrectOperation();
|
||||
MixBlendOperation *blend = new MixBlendOperation();
|
||||
|
||||
colourSocket->relinkConnections(rgbToHSV->getInputSocket(0), 1, graph);
|
||||
addLink(graph, rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0));
|
||||
addLink(graph, changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0));
|
||||
addLink(graph, hsvToRGB->getOutputSocket(), blend->getInputSocket(2));
|
||||
addLink(graph, rgbToHSV->getInputSocket(0)->getConnection()->getFromSocket(), blend->getInputSocket(1));
|
||||
valueSocket->relinkConnections(blend->getInputSocket(0), 0, graph);
|
||||
outputSocket->relinkConnections(blend->getOutputSocket());
|
||||
|
||||
changeHSV->setCurveMapping(storage);
|
||||
|
||||
blend->setResolutionInputSocketIndex(1);
|
||||
|
||||
graph->addOperation(rgbToHSV);
|
||||
graph->addOperation(hsvToRGB);
|
||||
graph->addOperation(changeHSV);
|
||||
graph->addOperation(blend);
|
||||
}
|
||||
ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation();
|
||||
ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation();
|
||||
HueSaturationValueCorrectOperation *changeHSV = new HueSaturationValueCorrectOperation();
|
||||
MixBlendOperation *blend = new MixBlendOperation();
|
||||
|
||||
colourSocket->relinkConnections(rgbToHSV->getInputSocket(0), 1, graph);
|
||||
addLink(graph, rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0));
|
||||
addLink(graph, changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0));
|
||||
addLink(graph, hsvToRGB->getOutputSocket(), blend->getInputSocket(2));
|
||||
addLink(graph, rgbToHSV->getInputSocket(0)->getConnection()->getFromSocket(), blend->getInputSocket(1));
|
||||
valueSocket->relinkConnections(blend->getInputSocket(0), 0, graph);
|
||||
outputSocket->relinkConnections(blend->getOutputSocket());
|
||||
|
||||
changeHSV->setCurveMapping(storage);
|
||||
|
||||
blend->setResolutionInputSocketIndex(1);
|
||||
|
||||
graph->addOperation(rgbToHSV);
|
||||
graph->addOperation(hsvToRGB);
|
||||
graph->addOperation(changeHSV);
|
||||
graph->addOperation(blend);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer *tile)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
sum += buffer[offset] * 0.35f + buffer[offset + 1] * 0.45f + buffer[offset + 2] * 0.2f;
|
||||
sum += rgb_to_bw(&buffer[offset]);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
|
||||
@@ -56,7 +56,7 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect, Memory
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
float value = buffer[offset] * 0.35f + buffer[offset + 1] * 0.45f + buffer[offset + 2] * 0.2f;
|
||||
float value = rgb_to_bw(&buffer[offset]);
|
||||
sum += (value - mean) * (value - mean);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ void ConvertColorToBWOperation::executePixel(float *outputValue, float x, float
|
||||
{
|
||||
float inputColor[4];
|
||||
inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers);
|
||||
outputValue[0] = inputColor[0] * 0.35f + inputColor[1] * 0.45f + inputColor[2] * 0.2f;
|
||||
outputValue[0] = rgb_to_bw(inputColor);
|
||||
}
|
||||
|
||||
void ConvertColorToBWOperation::deinitExecution()
|
||||
|
||||
@@ -1310,7 +1310,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
|
||||
fx = rect->xmin + zoomx * (-offsx);
|
||||
if (fx > rect->xmin) fx -= dx * (floorf(fx - rect->xmin));
|
||||
while (fx < rect->xmax) {
|
||||
glVertex2f(fx, rect->ymin);
|
||||
glVertex2f(fx, rect->ymin);
|
||||
glVertex2f(fx, rect->ymax);
|
||||
fx += dx;
|
||||
}
|
||||
@@ -1319,7 +1319,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
|
||||
fy = rect->ymin + zoomy * (-offsy);
|
||||
if (fy > rect->ymin) fy -= dy * (floorf(fy - rect->ymin));
|
||||
while (fy < rect->ymax) {
|
||||
glVertex2f(rect->xmin, fy);
|
||||
glVertex2f(rect->xmin, fy);
|
||||
glVertex2f(rect->xmax, fy);
|
||||
fy += dy;
|
||||
}
|
||||
@@ -1363,53 +1363,54 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
|
||||
offsy = cumap->curr.ymin - but->aspect / zoomy;
|
||||
|
||||
/* backdrop */
|
||||
if (cumap->flag & CUMA_DO_CLIP) {
|
||||
gl_shaded_color((unsigned char *)wcol->inner, -20);
|
||||
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
||||
glColor3ubv((unsigned char *)wcol->inner);
|
||||
glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
|
||||
rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
|
||||
rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
|
||||
rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
|
||||
if (but->a1 == UI_GRAD_H) {
|
||||
/* magic trigger for curve backgrounds */
|
||||
rcti grid;
|
||||
float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */
|
||||
|
||||
grid.xmin = rect->xmin + zoomx * (-offsx);
|
||||
grid.xmax = rect->xmax + zoomx * (-offsx);
|
||||
grid.ymin = rect->ymin + zoomy * (-offsy);
|
||||
grid.ymax = rect->ymax + zoomy * (-offsy);
|
||||
|
||||
ui_draw_gradient(&grid, col, UI_GRAD_H, 1.0f);
|
||||
|
||||
/* grid, hsv uses different grid */
|
||||
gl_shaded_color((unsigned char *)wcol->inner, -16);
|
||||
/* TODO, grid lines does not line up with colors, need to look into this */
|
||||
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.1666666f);
|
||||
}
|
||||
else {
|
||||
glColor3ubv((unsigned char *)wcol->inner);
|
||||
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
||||
}
|
||||
|
||||
/* grid, every 0.25 step */
|
||||
gl_shaded_color((unsigned char *)wcol->inner, -16);
|
||||
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
|
||||
/* grid, every 1.0 step */
|
||||
gl_shaded_color((unsigned char *)wcol->inner, -24);
|
||||
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
|
||||
/* axes */
|
||||
gl_shaded_color((unsigned char *)wcol->inner, -50);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy));
|
||||
glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy));
|
||||
glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymin);
|
||||
glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymax);
|
||||
glEnd();
|
||||
|
||||
/* magic trigger for curve backgrounds */
|
||||
if (but->a1 != -1) {
|
||||
if (but->a1 == UI_GRAD_H) {
|
||||
rcti grid;
|
||||
float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */
|
||||
|
||||
grid.xmin = rect->xmin + zoomx * (-offsx);
|
||||
grid.xmax = rect->xmax + zoomx * (-offsx);
|
||||
grid.ymin = rect->ymin + zoomy * (-offsy);
|
||||
grid.ymax = rect->ymax + zoomy * (-offsy);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
ui_draw_gradient(&grid, col, UI_GRAD_H, 0.5f);
|
||||
glDisable(GL_BLEND);
|
||||
if (cumap->flag & CUMA_DO_CLIP) {
|
||||
gl_shaded_color((unsigned char *)wcol->inner, -20);
|
||||
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
||||
glColor3ubv((unsigned char *)wcol->inner);
|
||||
glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
|
||||
rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
|
||||
rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
|
||||
rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
|
||||
}
|
||||
else {
|
||||
glColor3ubv((unsigned char *)wcol->inner);
|
||||
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
||||
}
|
||||
|
||||
/* grid, every 0.25 step */
|
||||
gl_shaded_color((unsigned char *)wcol->inner, -16);
|
||||
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
|
||||
/* grid, every 1.0 step */
|
||||
gl_shaded_color((unsigned char *)wcol->inner, -24);
|
||||
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
|
||||
/* axes */
|
||||
gl_shaded_color((unsigned char *)wcol->inner, -50);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy));
|
||||
glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy));
|
||||
glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymin);
|
||||
glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymax);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* cfra option */
|
||||
/* XXX 2.48 */
|
||||
#if 0
|
||||
@@ -1437,7 +1438,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
|
||||
glEnd();
|
||||
}
|
||||
else if (cumap->cur == 3) {
|
||||
float lum = cumap->sample[0] * 0.35f + cumap->sample[1] * 0.45f + cumap->sample[2] * 0.2f;
|
||||
float lum = rgb_to_bw(cumap->sample);
|
||||
glColor3ub(240, 240, 240);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
|
||||
@@ -447,7 +447,7 @@ extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *r
|
||||
/* interface_draw.c */
|
||||
extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
|
||||
|
||||
void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha);
|
||||
void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const float alpha);
|
||||
|
||||
void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
|
||||
@@ -843,6 +843,14 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
|
||||
MEM_freeN(item);
|
||||
}
|
||||
}
|
||||
else if (prop && RNA_property_type(prop) != PROP_ENUM) {
|
||||
RNA_warning("%s.%s, not an enum type", RNA_struct_identifier(ptr.type), propname);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
RNA_warning("%s.%s not found", RNA_struct_identifier(ptr.type), propname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname)
|
||||
|
||||
@@ -1946,8 +1946,9 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
|
||||
/* ************ custom buttons, old stuff ************** */
|
||||
|
||||
/* draws in resolution of 20x4 colors */
|
||||
void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
|
||||
void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const float alpha)
|
||||
{
|
||||
const float color_step = (type == UI_GRAD_H) ? 0.02 : 0.05f;
|
||||
int a;
|
||||
float h = hsv[0], s = hsv[1], v = hsv[2];
|
||||
float dx, dy, sx1, sx2, sy;
|
||||
@@ -2004,7 +2005,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
|
||||
|
||||
/* old below */
|
||||
|
||||
for (dx = 0.0f; dx < 1.0f; dx += 0.05f) {
|
||||
for (dx = 0.0f; dx < 1.0f; dx += color_step) {
|
||||
// previous color
|
||||
copy_v3_v3(col0[0], col1[0]);
|
||||
copy_v3_v3(col0[1], col1[1]);
|
||||
@@ -2032,11 +2033,15 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
|
||||
hsv_to_rgb(dx, 1.0, v, &col1[3][0], &col1[3][1], &col1[3][2]);
|
||||
break;
|
||||
case UI_GRAD_H:
|
||||
hsv_to_rgb(dx, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
|
||||
{
|
||||
/* annoying but without this the color shifts - could be solved some other way
|
||||
* - campbell */
|
||||
hsv_to_rgb(dx + color_step, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
|
||||
copy_v3_v3(col1[1], col1[0]);
|
||||
copy_v3_v3(col1[2], col1[0]);
|
||||
copy_v3_v3(col1[3], col1[0]);
|
||||
break;
|
||||
}
|
||||
case UI_GRAD_S:
|
||||
hsv_to_rgb(h, dx, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]);
|
||||
copy_v3_v3(col1[0], col1[1]);
|
||||
@@ -2053,7 +2058,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
|
||||
|
||||
// rect
|
||||
sx1 = rect->xmin + dx * (rect->xmax - rect->xmin);
|
||||
sx2 = rect->xmin + (dx + 0.05f) * (rect->xmax - rect->xmin);
|
||||
sx2 = rect->xmin + (dx + color_step) * (rect->xmax - rect->xmin);
|
||||
sy = rect->ymin;
|
||||
dy = (rect->ymax - rect->ymin) / 3.0;
|
||||
|
||||
|
||||
@@ -237,6 +237,7 @@ void ED_operatortypes_mask(void)
|
||||
WM_operatortype_append(MASK_OT_shape_key_insert);
|
||||
WM_operatortype_append(MASK_OT_shape_key_clear);
|
||||
WM_operatortype_append(MASK_OT_shape_key_feather_reset);
|
||||
WM_operatortype_append(MASK_OT_shape_key_rekey);
|
||||
}
|
||||
|
||||
void ED_keymap_mask(wmKeyConfig *keyconf)
|
||||
|
||||
@@ -110,5 +110,6 @@ void ED_mask_point_pos__reverse(const struct bContext *C, float x, float y, floa
|
||||
void MASK_OT_shape_key_insert(struct wmOperatorType *ot);
|
||||
void MASK_OT_shape_key_clear(struct wmOperatorType *ot);
|
||||
void MASK_OT_shape_key_feather_reset(struct wmOperatorType *ot);
|
||||
void MASK_OT_shape_key_rekey(struct wmOperatorType *ot);
|
||||
|
||||
#endif /* __MASK_INTERN_H__ */
|
||||
|
||||
@@ -29,7 +29,11 @@
|
||||
* \ingroup edmask
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
@@ -39,6 +43,9 @@
|
||||
#include "DNA_mask_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
@@ -233,6 +240,175 @@ void MASK_OT_shape_key_feather_reset(wmOperatorType *ot)
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/*
|
||||
* - loop over selected shapekeys.
|
||||
* - find firstsel/lastsel pairs.
|
||||
* - move these into a temp list.
|
||||
* - re-key all the original shapes.
|
||||
* - copy unselected values back from the original.
|
||||
* - free the original.
|
||||
*/
|
||||
static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const int frame = CFRA;
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskLayer *masklay;
|
||||
int change = FALSE;
|
||||
|
||||
const short do_feather = RNA_boolean_get(op->ptr, "feather");
|
||||
const short do_location = RNA_boolean_get(op->ptr, "location");
|
||||
|
||||
for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
|
||||
|
||||
if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* we need at least one point selected here to bother re-interpolating */
|
||||
if (!ED_mask_layer_select_check(masklay)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (masklay->splines_shapes.first) {
|
||||
MaskLayerShape *masklay_shape;
|
||||
MaskLayerShape *masklay_shape_lastsel = NULL;
|
||||
|
||||
for (masklay_shape = masklay->splines_shapes.first;
|
||||
masklay_shape;
|
||||
masklay_shape = masklay_shape->next)
|
||||
{
|
||||
MaskLayerShape *masklay_shape_a = NULL;
|
||||
MaskLayerShape *masklay_shape_b = NULL;
|
||||
|
||||
/* find contiguous selections */
|
||||
if (masklay_shape->flag & MASK_SHAPE_SELECT) {
|
||||
if (masklay_shape_lastsel == NULL) {
|
||||
masklay_shape_lastsel = masklay_shape;
|
||||
}
|
||||
if ((masklay_shape->next == NULL) ||
|
||||
(((MaskLayerShape *)masklay_shape->next)->flag & MASK_SHAPE_SELECT) == 0)
|
||||
{
|
||||
masklay_shape_a = masklay_shape_lastsel;
|
||||
masklay_shape_b = masklay_shape;
|
||||
masklay_shape_lastsel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* we have a from<>to? - re-interpolate! */
|
||||
if (masklay_shape_a && masklay_shape_b) {
|
||||
ListBase shapes_tmp = {NULL, NULL};
|
||||
MaskLayerShape *masklay_shape_tmp;
|
||||
MaskLayerShape *masklay_shape_tmp_next;
|
||||
MaskLayerShape *masklay_shape_tmp_last = masklay_shape_b->next;
|
||||
MaskLayerShape *masklay_shape_tmp_rekey;
|
||||
|
||||
/* move keys */
|
||||
for (masklay_shape_tmp = masklay_shape_a;
|
||||
masklay_shape_tmp && (masklay_shape_tmp != masklay_shape_tmp_last);
|
||||
masklay_shape_tmp = masklay_shape_tmp_next)
|
||||
{
|
||||
masklay_shape_tmp_next = masklay_shape_tmp->next;
|
||||
BLI_remlink(&masklay->splines_shapes, masklay_shape_tmp);
|
||||
BLI_addtail(&shapes_tmp, masklay_shape_tmp);
|
||||
}
|
||||
|
||||
/* re-key, note: cant modify the keys here since it messes uop */
|
||||
for (masklay_shape_tmp = shapes_tmp.first;
|
||||
masklay_shape_tmp;
|
||||
masklay_shape_tmp = masklay_shape_tmp->next)
|
||||
{
|
||||
BKE_mask_layer_evaluate(masklay, masklay_shape_tmp->frame, TRUE);
|
||||
masklay_shape_tmp_rekey = BKE_mask_layer_shape_varify_frame(masklay, masklay_shape_tmp->frame);
|
||||
BKE_mask_layer_shape_from_mask(masklay, masklay_shape_tmp_rekey);
|
||||
masklay_shape_tmp_rekey->flag = masklay_shape_tmp->flag & MASK_SHAPE_SELECT;
|
||||
}
|
||||
|
||||
/* restore unselected points and free copies */
|
||||
for (masklay_shape_tmp = shapes_tmp.first;
|
||||
masklay_shape_tmp;
|
||||
masklay_shape_tmp = masklay_shape_tmp_next)
|
||||
{
|
||||
/* restore */
|
||||
int i_abs = 0;
|
||||
int i;
|
||||
MaskSpline *spline;
|
||||
MaskLayerShapeElem *shape_ele_src;
|
||||
MaskLayerShapeElem *shape_ele_dst;
|
||||
|
||||
masklay_shape_tmp_next = masklay_shape_tmp->next;
|
||||
|
||||
/* we know this exists, added above */
|
||||
masklay_shape_tmp_rekey = BKE_mask_layer_shape_find_frame(masklay, masklay_shape_tmp->frame);
|
||||
|
||||
shape_ele_src = (MaskLayerShapeElem *)masklay_shape_tmp->data;
|
||||
shape_ele_dst = (MaskLayerShapeElem *)masklay_shape_tmp_rekey->data;
|
||||
|
||||
for (spline = masklay->splines.first; spline; spline = spline->next) {
|
||||
for (i = 0; i < spline->tot_point; i++) {
|
||||
MaskSplinePoint *point = &spline->points[i];
|
||||
|
||||
/* not especially efficient but makes this easier to follow */
|
||||
SWAP(MaskLayerShapeElem, *shape_ele_src, *shape_ele_dst);
|
||||
|
||||
if (MASKPOINT_ISSEL_ANY(point)) {
|
||||
if (do_location) {
|
||||
memcpy(shape_ele_dst->value, shape_ele_src->value, sizeof(float) * 6);
|
||||
}
|
||||
if (do_feather) {
|
||||
shape_ele_dst->value[6] = shape_ele_src->value[6];
|
||||
}
|
||||
}
|
||||
|
||||
shape_ele_src++;
|
||||
shape_ele_dst++;
|
||||
|
||||
i_abs++;
|
||||
}
|
||||
}
|
||||
|
||||
BKE_mask_layer_shape_free(masklay_shape_tmp);
|
||||
}
|
||||
|
||||
change = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* re-evaluate */
|
||||
BKE_mask_layer_evaluate(masklay, frame, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (change) {
|
||||
WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
|
||||
DAG_id_tag_update(&mask->id, 0);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
void MASK_OT_shape_key_rekey(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Re-Key Points of Selected Shapes";
|
||||
ot->description = "Recalculates animation data on selected points for frames selected in the dopesheet";
|
||||
ot->idname = "MASK_OT_shape_key_rekey";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = mask_shape_key_rekey_exec;
|
||||
ot->poll = ED_maskedit_mask_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "location", TRUE, "Location", "");
|
||||
RNA_def_boolean(ot->srna, "feather", TRUE, "Feather", "");
|
||||
}
|
||||
|
||||
|
||||
/* *** Shape Key Utils *** */
|
||||
|
||||
|
||||
@@ -1631,15 +1631,13 @@ static int knife_update_active(KnifeTool_OpData *kcd)
|
||||
kcd->cur.mval[0] = kcd->vc.mval[0];
|
||||
kcd->cur.mval[1] = kcd->vc.mval[1];
|
||||
|
||||
/* if angle snapping is enabled, don't snap to edges/vertices */
|
||||
if (kcd->angle_snapping == ANGLE_FREE) {
|
||||
|
||||
kcd->cur.vert = knife_find_closest_vert(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
|
||||
|
||||
if (!kcd->cur.vert) {
|
||||
kcd->cur.edge = knife_find_closest_edge(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
|
||||
}
|
||||
/* XXX knife_snap_angle updates the view coordinate mouse values to constrained angles,
|
||||
* which current mouse values are set to current mouse values are then used
|
||||
* for vertex and edge snap detection, without regard to the exact angle constraint */
|
||||
kcd->cur.vert = knife_find_closest_vert(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
|
||||
|
||||
if (!kcd->cur.vert) {
|
||||
kcd->cur.edge = knife_find_closest_edge(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
|
||||
}
|
||||
|
||||
/* if no hits are found this would normally default to (0, 0, 0) so instead
|
||||
|
||||
@@ -683,7 +683,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int
|
||||
if (G.rt == 200)
|
||||
ntreeCompositExecTreeOld(ntree, rd, do_preview);
|
||||
else
|
||||
COM_execute(ntree, rendering);
|
||||
COM_execute(rd, ntree, rendering);
|
||||
}
|
||||
|
||||
/* *********************************************** */
|
||||
|
||||
@@ -207,7 +207,7 @@ void typecheck_compbuf_color(float *out, float *in, int outtype, int intype)
|
||||
*out= 0.333333f*(in[0]+in[1]+in[2]);
|
||||
}
|
||||
else if (intype==CB_RGBA) {
|
||||
*out= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f;
|
||||
*out = rgb_to_bw(in);
|
||||
}
|
||||
}
|
||||
else if (outtype==CB_VEC2) {
|
||||
@@ -300,7 +300,7 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
|
||||
}
|
||||
else if (inbuf->type==CB_RGBA) {
|
||||
for (; x>0; x--, outrf+= 1, inrf+= 4)
|
||||
*outrf= inrf[0]*0.35f + inrf[1]*0.45f + inrf[2]*0.2f;
|
||||
*outrf = rgb_to_bw(inrf);
|
||||
}
|
||||
}
|
||||
else if (type==CB_VEC2) {
|
||||
|
||||
@@ -45,11 +45,6 @@ static bNodeSocketTemplate cmp_node_view_levels_out[]={
|
||||
{-1, 0, ""}
|
||||
};
|
||||
|
||||
static void rgb_tobw(float r, float g, float b, float* out)
|
||||
{
|
||||
*out= r*0.35f + g*0.45f + b*0.2f;
|
||||
}
|
||||
|
||||
static void fill_bins(bNode* node, CompBuf* in, int* bins)
|
||||
{
|
||||
float value[4];
|
||||
@@ -66,7 +61,7 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
|
||||
if (value[3] > 0.0f) { /* don't count transparent pixels */
|
||||
switch (node->custom1) {
|
||||
case 1: { /* all colors */
|
||||
rgb_tobw(value[0], value[1], value[2], &value[0]);
|
||||
value[0] = rgb_to_bw(value);
|
||||
value[0]=value[0]*255; /* scale to 0-255 range */
|
||||
ivalue=(int)value[0];
|
||||
break;
|
||||
@@ -125,7 +120,7 @@ static float brightness_mean(bNode* node, CompBuf* in)
|
||||
switch (node->custom1) {
|
||||
case 1:
|
||||
{
|
||||
rgb_tobw(value[0], value[1], value[2], &value[0]);
|
||||
value[0] = rgb_to_bw(value);
|
||||
sum+=value[0];
|
||||
break;
|
||||
}
|
||||
@@ -176,7 +171,7 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean)
|
||||
switch (node->custom1) {
|
||||
case 1:
|
||||
{
|
||||
rgb_tobw(value[0], value[1], value[2], &value[0]);
|
||||
value[0] = rgb_to_bw(value);
|
||||
sum+=(value[0]-mean)*(value[0]-mean);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ static bNodeSocketTemplate cmp_node_rgbtobw_out[]= {
|
||||
|
||||
static void do_rgbtobw(bNode *UNUSED(node), float *out, float *in)
|
||||
{
|
||||
out[0]= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f;
|
||||
out[0] = rgb_to_bw(in);
|
||||
}
|
||||
|
||||
static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
|
||||
@@ -104,7 +104,7 @@ static void node_shader_exec_rgbtobw(void *UNUSED(data), bNode *UNUSED(node), bN
|
||||
/* stack order out: bw */
|
||||
/* stack order in: col */
|
||||
|
||||
out[0]->vec[0]= in[0]->vec[0]*0.35f + in[0]->vec[1]*0.45f + in[0]->vec[2]*0.2f;
|
||||
out[0]->vec[0] = rgb_to_bw(in[0]->vec);
|
||||
}
|
||||
|
||||
static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
|
||||
|
||||
@@ -91,8 +91,7 @@ static void rgbtobw_valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNode
|
||||
{
|
||||
float cin[4];
|
||||
tex_input_rgba(cin, in[0], p, thread);
|
||||
|
||||
*out = cin[0] * 0.35f + cin[1] * 0.45f + cin[2] * 0.2f;
|
||||
*out = rgb_to_bw(cin);
|
||||
}
|
||||
|
||||
static void rgbtobw_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
|
||||
@@ -2852,7 +2852,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
|
||||
|
||||
/* texture output */
|
||||
if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||
texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
|
||||
texres.tin = rgb_to_bw(&texres.tr);
|
||||
rgb= 0;
|
||||
}
|
||||
if (mtex->texflag & MTEX_NEGATIVE) {
|
||||
@@ -2919,7 +2919,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
|
||||
if (mtex->mapto & MAP_ALPHA) {
|
||||
if (rgb) {
|
||||
if (texres.talpha) texres.tin= texres.ta;
|
||||
else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
|
||||
else texres.tin = rgb_to_bw(&texres.tr);
|
||||
}
|
||||
|
||||
col_r[3]*= texres.tin;
|
||||
@@ -3051,7 +3051,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
|
||||
|
||||
/* texture output */
|
||||
if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||
texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
|
||||
texres.tin = rgb_to_bw(&texres.tr);
|
||||
rgb= 0;
|
||||
}
|
||||
if (mtex->texflag & MTEX_NEGATIVE) {
|
||||
@@ -3124,7 +3124,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
|
||||
}
|
||||
}
|
||||
if (mtex->mapto & WOMAP_BLEND) {
|
||||
if (rgb) texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
|
||||
if (rgb) texres.tin = rgb_to_bw(&texres.tr);
|
||||
|
||||
*blend= texture_value_blend(mtex->def_var, *blend, texres.tin, mtex->blendfac, mtex->blendtype);
|
||||
}
|
||||
@@ -3264,7 +3264,7 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
|
||||
|
||||
/* texture output */
|
||||
if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
|
||||
texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
|
||||
texres.tin = rgb_to_bw(&texres.tr);
|
||||
rgb= 0;
|
||||
}
|
||||
if (mtex->texflag & MTEX_NEGATIVE) {
|
||||
@@ -3358,7 +3358,7 @@ int externtex(MTex *mtex, const float vec[3], float *tin, float *tr, float *tg,
|
||||
rgb= multitex(tex, texvec, dxt, dyt, 0, &texr, thread, mtex->which_output);
|
||||
|
||||
if (rgb) {
|
||||
texr.tin= (0.35f*texr.tr+0.45f*texr.tg+0.2f*texr.tb);
|
||||
texr.tin = rgb_to_bw(&texr.tr);
|
||||
}
|
||||
else {
|
||||
texr.tr= mtex->r;
|
||||
|
||||
Reference in New Issue
Block a user