Merging r48829 through r48861 from trunk into soc-2011-tomato
This commit is contained in:
@@ -26,8 +26,6 @@
|
||||
#include "util_path.h"
|
||||
#include "util_types.h"
|
||||
|
||||
#define BOOST_FILESYSTEM_VERSION 2
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@@ -117,7 +115,7 @@ void Cache::clear_except(const string& name, const set<string>& except)
|
||||
boost::filesystem::directory_iterator it(dir), it_end;
|
||||
|
||||
for(; it != it_end; it++) {
|
||||
string filename = it->path().filename();
|
||||
string filename = it->path().filename().string();
|
||||
|
||||
if(boost::starts_with(filename, name))
|
||||
if(except.find(filename) == except.end())
|
||||
|
||||
@@ -26,8 +26,6 @@ OIIO_NAMESPACE_USING
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define BOOST_FILESYSTEM_VERSION 2
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@@ -60,7 +58,7 @@ string path_user_get(const string& sub)
|
||||
|
||||
string path_filename(const string& path)
|
||||
{
|
||||
return boost::filesystem::path(path).filename();
|
||||
return boost::filesystem::path(path).filename().string();
|
||||
}
|
||||
|
||||
string path_dirname(const string& path)
|
||||
|
||||
@@ -1235,9 +1235,11 @@ GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress)
|
||||
|
||||
// Progress fill
|
||||
progressBox = NSInsetRect(progressBox, 1, 1);
|
||||
[[NSColor knobColor] setFill];
|
||||
|
||||
progressBox.size.width = progressBox.size.width * progress;
|
||||
NSRectFill(progressBox);
|
||||
NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor darkGrayColor] endingColor:[NSColor lightGrayColor]];
|
||||
[gradient drawInRect:progressBox angle:90];
|
||||
[gradient release];
|
||||
|
||||
[dockIcon unlockFocus];
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
|
||||
col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="")
|
||||
col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="")
|
||||
if group:
|
||||
col.separator()
|
||||
col.operator("object.vertex_group_move", icon='TRIA_UP', text="").direction = 'UP'
|
||||
col.operator("object.vertex_group_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
|
||||
|
||||
|
||||
@@ -1309,6 +1309,17 @@ class CLIP_MT_mask(Menu):
|
||||
layout.menu("CLIP_MT_mask_animation")
|
||||
|
||||
|
||||
class CLIP_MT_select_mode(Menu):
|
||||
bl_label = "Select Mode"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
|
||||
layout.operator_enum("clip.mode_set", "mode")
|
||||
|
||||
|
||||
class CLIP_MT_mask_visibility(Menu):
|
||||
bl_label = "Show/Hide"
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ class INFO_MT_help(Menu):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("wm.url_open", text="Manual", icon='HELP').url = "http://wiki.blender.org/index.php/Doc:2.6/Manual"
|
||||
layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-263"
|
||||
layout.operator("wm.url_open", text="Release Log", icon='URL').url = "http://www.blender.org/development/release-logs/blender-264"
|
||||
layout.separator()
|
||||
|
||||
layout.operator("wm.url_open", text="Blender Website", icon='URL').url = "http://www.blender.org"
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p class="title"><b>Blender 2.63</b></p>
|
||||
<p class="title"><b>Blender 2.64</b></p>
|
||||
<p><br></p>
|
||||
<p class="header"><b>About</b></p>
|
||||
<p class="body">Welcome to Blender, the free, open source 3D application for modeling, animation, rendering, compositing, video editing and game creation. Blender is available for Linux, Mac OS X, Windows and FreeBSD and has a large world-wide community.</p>
|
||||
<p class="body">Blender can be used freely for any purpose, including commercial use and distribution. It's free and open-source software, released under the GNU GPL licence. The entire source code is available on our website.</p>
|
||||
<p class="body">For more information, visit <a href="http://www.blender.org">blender.org</a>.</p>
|
||||
<p><br></p>
|
||||
<p class="header"><b>2.63</b></p>
|
||||
<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.63. This release is the fourth official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features. <a href="http://www.blender.org/development/release-logs/blender-263/">More information about this release</a>.</p>
|
||||
<p class="header"><b>2.64</b></p>
|
||||
<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.64. This release is the fifth official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features. <a href="http://www.blender.org/development/release-logs/blender-263/">More information about this release</a>.</p>
|
||||
<p><br></p>
|
||||
<p class="header"><b>Bugs</b></p>
|
||||
<p class="body">Although Blender 2.63 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
|
||||
<p class="body">Although Blender 2.64 is considered a stable release, you may encounter a bug. If you do, please help us by posting it in the bug tracker or using Help → Report a Bug from inside Blender. If it wasn’t reported yet, please log in (or register) and fill in detailed information about the error. Please post detailed instructions on how to reproduce it or post a .blend file showcasing the bug.</p>
|
||||
<p><br></p>
|
||||
<p class="header"><b>Package Contents</b></p>
|
||||
<p class="body">The downloaded Blender package includes:</p>
|
||||
@@ -47,7 +47,7 @@
|
||||
<p class="header"><b>Links</b></p>
|
||||
<p class="body">Users:</p>
|
||||
<p class="body"> General information <a href="http://www.blender.org">www.blender.org</a> <br>
|
||||
Full release log <a href="http://www.blender.org/development/release-logs/blender-263/">www.blender.org/development/release-logs/blender-263/</a><br>
|
||||
Full release log <a href="http://www.blender.org/development/release-logs/blender-264/">www.blender.org/development/release-logs/blender-264/</a><br>
|
||||
Tutorials <a href="http://www.blender.org/education-help/">www.blender.org/education-help/</a> <br>
|
||||
Manual <a href="http://wiki.blender.org/index.php/Doc:2.6/Manual">wiki.blender.org/index.php/Doc:2.6/Manual</a><br>
|
||||
User Forum <a href="http://www.blenderartists.org">www.blenderartists.org</a><br>
|
||||
|
||||
@@ -67,9 +67,10 @@ struct MaskSpline *BKE_mask_spline_add(struct MaskLayer *masklay);
|
||||
float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point))[2];
|
||||
float (*BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, int *tot_feather_point))[2];
|
||||
|
||||
float (*BKE_mask_spline_differentiate_with_resolution_ex(struct MaskSpline *spline, const int resol, int *tot_diff_point))[2];
|
||||
float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_diff_point))[2];
|
||||
float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline,
|
||||
int width, int height, int *tot_feather_point))[2];
|
||||
float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(struct MaskSpline *spline, const int resol, int *tot_feather_point))[2];
|
||||
float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_feather_point))[2];
|
||||
|
||||
float (*BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2];
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa
|
||||
clipmaxx = MAX2(minx, maxx);
|
||||
clipmaxy = MAX2(miny, maxy);
|
||||
|
||||
BLI_init_rctf(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy);
|
||||
BLI_rctf_init(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy);
|
||||
cumap->clipr = cumap->curr;
|
||||
|
||||
cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f;
|
||||
|
||||
@@ -365,10 +365,10 @@ static void dag_add_material_nodetree_driver_relations(DagForest *dag, DagNode *
|
||||
/* nodetree's nodes... */
|
||||
for (n = ntree->nodes.first; n; n = n->next) {
|
||||
if (n->id && GS(n->id->name) == ID_MA) {
|
||||
ma = (Material *)n->id;
|
||||
if (ma != rootma) {
|
||||
dag_add_material_driver_relations(dag, node, ma);
|
||||
}
|
||||
ma = (Material *)n->id;
|
||||
if (ma != rootma) {
|
||||
dag_add_material_driver_relations(dag, node, ma);
|
||||
}
|
||||
}
|
||||
else if (n->type == NODE_GROUP && n->id) {
|
||||
dag_add_material_nodetree_driver_relations(dag, node, (bNodeTree *)n->id, rootma);
|
||||
@@ -672,7 +672,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
|
||||
* engine instancing assumes particular ordering of objects in list */
|
||||
dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualization");
|
||||
if (part->dup_ob->type == OB_MBALL)
|
||||
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Object Visualization");
|
||||
dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA, "Particle Object Visualization");
|
||||
}
|
||||
|
||||
if (part->ren_as == PART_DRAW_GR && part->dup_group) {
|
||||
|
||||
@@ -499,16 +499,14 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
|
||||
/* vert data */
|
||||
f1 = dlnew->verts;
|
||||
totvert = 0;
|
||||
sf_vert = sf_ctx.fillvertbase.first;
|
||||
while (sf_vert) {
|
||||
|
||||
for (sf_vert = sf_ctx.fillvertbase.first; sf_vert; sf_vert = sf_vert->next) {
|
||||
copy_v3_v3(f1, sf_vert->co);
|
||||
f1 += 3;
|
||||
|
||||
/* index number */
|
||||
sf_vert->tmp.l = totvert;
|
||||
totvert++;
|
||||
|
||||
sf_vert = sf_vert->next;
|
||||
}
|
||||
|
||||
/* index data */
|
||||
|
||||
@@ -329,14 +329,32 @@ static int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int
|
||||
return resol;
|
||||
}
|
||||
|
||||
float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int width, int height,
|
||||
int *tot_diff_point))[2]
|
||||
static int mask_spline_points_calc_tot(const MaskSpline *spline, const int resol)
|
||||
{
|
||||
int len;
|
||||
|
||||
/* count */
|
||||
len = (spline->tot_point - 1) * resol;
|
||||
|
||||
if (spline->flag & MASK_SPLINE_CYCLIC) {
|
||||
len += resol;
|
||||
}
|
||||
else {
|
||||
len++;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
float (*BKE_mask_spline_differentiate_with_resolution_ex(MaskSpline *spline, const int resol,
|
||||
int *tot_diff_point))[2]
|
||||
{
|
||||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||
|
||||
MaskSplinePoint *point, *prev;
|
||||
float (*diff_points)[2], (*fp)[2];
|
||||
int a, len, resol = BKE_mask_spline_resolution(spline, width, height);
|
||||
const int tot = mask_spline_points_calc_tot(spline, resol);
|
||||
int a;
|
||||
|
||||
if (spline->tot_point <= 1) {
|
||||
/* nothing to differentiate */
|
||||
@@ -344,17 +362,9 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int wi
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* count */
|
||||
len = (spline->tot_point - 1) * resol;
|
||||
|
||||
if (spline->flag & MASK_SPLINE_CYCLIC)
|
||||
len += resol;
|
||||
else
|
||||
len++;
|
||||
|
||||
/* len+1 because of 'forward_diff_bezier' function */
|
||||
*tot_diff_point = len;
|
||||
diff_points = fp = MEM_mallocN((len + 1) * sizeof(*diff_points), "mask spline vets");
|
||||
*tot_diff_point = tot;
|
||||
diff_points = fp = MEM_mallocN((tot + 1) * sizeof(*diff_points), "mask spline vets");
|
||||
|
||||
a = spline->tot_point - 1;
|
||||
if (spline->flag & MASK_SPLINE_CYCLIC)
|
||||
@@ -393,24 +403,54 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int wi
|
||||
return diff_points;
|
||||
}
|
||||
|
||||
float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline, int width, int height,
|
||||
int *tot_diff_point))[2]
|
||||
{
|
||||
int resol = BKE_mask_spline_resolution(spline, width, height);
|
||||
|
||||
return BKE_mask_spline_differentiate_with_resolution_ex(spline, resol, tot_diff_point);
|
||||
}
|
||||
|
||||
float (*BKE_mask_spline_differentiate(MaskSpline *spline, int *tot_diff_point))[2]
|
||||
{
|
||||
return BKE_mask_spline_differentiate_with_resolution(spline, 0, 0, tot_diff_point);
|
||||
}
|
||||
|
||||
float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, int width, int height,
|
||||
int *tot_feather_point))[2]
|
||||
/**
|
||||
* values align with #BKE_mask_spline_differentiate_with_resolution_ex
|
||||
* when \a resol arguments match.
|
||||
*/
|
||||
float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpline *spline, const int resol,
|
||||
int *tot_feather_point))[2]
|
||||
{
|
||||
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
|
||||
|
||||
MaskSplinePoint *point, *prev;
|
||||
float (*feather)[2], (*fp)[2];
|
||||
int i, j, tot, resol = BKE_mask_spline_feather_resolution(spline, width, height);
|
||||
|
||||
tot = resol * spline->tot_point;
|
||||
feather = fp = MEM_mallocN(tot * sizeof(*feather), "mask spline feather diff points");
|
||||
const int tot = mask_spline_points_calc_tot(spline, resol);
|
||||
int a;
|
||||
|
||||
for (i = 0; i < spline->tot_point; i++) {
|
||||
MaskSplinePoint *point = &points_array[i];
|
||||
/* tot+1 because of 'forward_diff_bezier' function */
|
||||
feather = fp = MEM_mallocN((tot + 1) * sizeof(*feather), "mask spline feather diff points");
|
||||
|
||||
a = spline->tot_point - 1;
|
||||
if (spline->flag & MASK_SPLINE_CYCLIC)
|
||||
a++;
|
||||
|
||||
prev = points_array;
|
||||
point = prev + 1;
|
||||
|
||||
while (a--) {
|
||||
/* BezTriple *prevbezt; */ /* UNUSED */
|
||||
/* BezTriple *bezt; */ /* UNUSED */
|
||||
int j;
|
||||
|
||||
if (a == 0 && (spline->flag & MASK_SPLINE_CYCLIC))
|
||||
point = points_array;
|
||||
|
||||
|
||||
/* prevbezt = &prev->bezt; */
|
||||
/* bezt = &point->bezt; */
|
||||
|
||||
for (j = 0; j < resol; j++, fp++) {
|
||||
float u = (float) j / resol, weight;
|
||||
@@ -418,12 +458,26 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline
|
||||
|
||||
/* TODO - these calls all calculate similar things
|
||||
* could be unified for some speed */
|
||||
BKE_mask_point_segment_co(spline, point, u, co);
|
||||
BKE_mask_point_normal(spline, point, u, n);
|
||||
weight = BKE_mask_point_weight(spline, point, u);
|
||||
BKE_mask_point_segment_co(spline, prev, u, co);
|
||||
BKE_mask_point_normal(spline, prev, u, n);
|
||||
weight = BKE_mask_point_weight(spline, prev, u);
|
||||
|
||||
madd_v2_v2v2fl(*fp, co, n, weight);
|
||||
}
|
||||
|
||||
if (a == 0 && (spline->flag & MASK_SPLINE_CYCLIC) == 0) {
|
||||
float u = 1.0f, weight;
|
||||
float co[2], n[2];
|
||||
|
||||
BKE_mask_point_segment_co(spline, prev, u, co);
|
||||
BKE_mask_point_normal(spline, prev, u, n);
|
||||
weight = BKE_mask_point_weight(spline, prev, u);
|
||||
|
||||
madd_v2_v2v2fl(*fp, co, n, weight);
|
||||
}
|
||||
|
||||
prev = point;
|
||||
point++;
|
||||
}
|
||||
|
||||
*tot_feather_point = tot;
|
||||
@@ -431,6 +485,14 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline
|
||||
return feather;
|
||||
}
|
||||
|
||||
float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, int width, int height,
|
||||
int *tot_feather_point))[2]
|
||||
{
|
||||
int resol = BKE_mask_spline_feather_resolution(spline, width, height);
|
||||
|
||||
return BKE_mask_spline_feather_differentiated_points_with_resolution_ex(spline, resol, tot_feather_point);
|
||||
}
|
||||
|
||||
float (*BKE_mask_spline_feather_differentiated_points(MaskSpline *spline, int *tot_feather_point))[2]
|
||||
{
|
||||
return BKE_mask_spline_feather_differentiated_points_with_resolution(spline, 0, 0, tot_feather_point);
|
||||
|
||||
@@ -2300,14 +2300,21 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3])
|
||||
}
|
||||
|
||||
if (change == FALSE) {
|
||||
float size[3];
|
||||
|
||||
copy_v3_v3(size, ob->size);
|
||||
if (ob->type == OB_EMPTY) {
|
||||
mul_v3_fl(size, ob->empty_drawsize);
|
||||
}
|
||||
|
||||
minmax_v3v3_v3(min_r, max_r, ob->obmat[3]);
|
||||
|
||||
copy_v3_v3(vec, ob->obmat[3]);
|
||||
add_v3_v3(vec, ob->size);
|
||||
add_v3_v3(vec, size);
|
||||
minmax_v3v3_v3(min_r, max_r, vec);
|
||||
|
||||
copy_v3_v3(vec, ob->obmat[3]);
|
||||
sub_v3_v3(vec, ob->size);
|
||||
sub_v3_v3(vec, size);
|
||||
minmax_v3v3_v3(min_r, max_r, vec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3400,6 +3400,12 @@ void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, Pa
|
||||
{
|
||||
float vec[3];
|
||||
|
||||
/* can happen when called from a different object's modifier */
|
||||
if (!dm) {
|
||||
unit_m4(hairmat);
|
||||
return;
|
||||
}
|
||||
|
||||
psys_face_mat(0, dm, pa, hairmat, 0);
|
||||
psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0, 0);
|
||||
copy_v3_v3(hairmat[3], vec);
|
||||
|
||||
@@ -487,7 +487,7 @@ Scene *BKE_scene_add(const char *name)
|
||||
|
||||
BLI_strncpy(sce->r.pic, U.renderdir, sizeof(sce->r.pic));
|
||||
|
||||
BLI_init_rctf(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
|
||||
BLI_rctf_init(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
|
||||
sce->r.osa = 8;
|
||||
|
||||
/* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
|
||||
|
||||
@@ -383,7 +383,7 @@ int BKE_frameserver_append(RenderData *UNUSED(rd), int UNUSED(start_frame), int
|
||||
connsock = -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void BKE_frameserver_end(void)
|
||||
|
||||
@@ -104,7 +104,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
|
||||
|
||||
int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float *dir, float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata);
|
||||
|
||||
float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float light_end[3], float pos[3]);
|
||||
float BLI_bvhtree_bb_raycast(const float *bv, const float light_start[3], const float light_end[3], float pos[3]);
|
||||
|
||||
/* range query */
|
||||
int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata);
|
||||
|
||||
@@ -40,34 +40,35 @@ struct rcti;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* BLI_rct.c */
|
||||
/**
|
||||
* Determine if a rect is empty. An empty
|
||||
* rect is one with a zero (or negative)
|
||||
* width or height.
|
||||
*
|
||||
* \return True if \a rect is empty.
|
||||
*/
|
||||
int BLI_rcti_is_empty(struct rcti *rect);
|
||||
int BLI_rctf_is_empty(struct rctf *rect);
|
||||
void BLI_init_rctf(struct rctf *rect, float xmin, float xmax, float ymin, float ymax);
|
||||
void BLI_init_rcti(struct rcti *rect, int xmin, int xmax, int ymin, int ymax);
|
||||
int BLI_rcti_is_empty(const struct rcti *rect);
|
||||
int BLI_rctf_is_empty(const struct rctf *rect);
|
||||
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax);
|
||||
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax);
|
||||
void BLI_rcti_init_minmax(struct rcti *rect);
|
||||
void BLI_rctf_init_minmax(struct rctf *rect);
|
||||
void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2]);
|
||||
void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2]);
|
||||
|
||||
void BLI_translate_rctf(struct rctf *rect, float x, float y);
|
||||
void BLI_translate_rcti(struct rcti *rect, int x, int y);
|
||||
void BLI_resize_rcti(struct rcti *rect, int x, int y);
|
||||
void BLI_resize_rctf(struct rctf *rect, float x, float y);
|
||||
int BLI_in_rcti(struct rcti *rect, int x, int y);
|
||||
int BLI_in_rctf(struct rctf *rect, float x, float y);
|
||||
int BLI_segment_in_rcti(struct rcti *rect, int s1[2], int s2[2]);
|
||||
// int BLI_segment_in_rctf(struct rcti *rect, int s1[2], int s2[2]); // NOT NEEDED YET
|
||||
int BLI_isect_rctf(struct rctf *src1, struct rctf *src2, struct rctf *dest);
|
||||
int BLI_isect_rcti(struct rcti *src1, struct rcti *src2, struct rcti *dest);
|
||||
void BLI_union_rctf(struct rctf *rcta, struct rctf *rctb);
|
||||
void BLI_union_rcti(struct rcti *rcti1, struct rcti *rcti2);
|
||||
int BLI_in_rcti(const struct rcti *rect, const int x, const int y);
|
||||
int BLI_in_rcti_v(const struct rcti *rect, const int xy[2]);
|
||||
int BLI_in_rctf(const struct rctf *rect, const float x, const float y);
|
||||
int BLI_in_rctf_v(const struct rctf *rect, const float xy[2]);
|
||||
int BLI_segment_in_rcti(const struct rcti *rect, const int s1[2], const int s2[2]);
|
||||
#if 0 /* NOT NEEDED YET */
|
||||
int BLI_segment_in_rctf(struct rcti *rect, int s1[2], int s2[2]);
|
||||
#endif
|
||||
int BLI_isect_rctf(const struct rctf *src1, const struct rctf *src2, struct rctf *dest);
|
||||
int BLI_isect_rcti(const struct rcti *src1, const struct rcti *src2, struct rcti *dest);
|
||||
void BLI_union_rctf(struct rctf *rctf1, const struct rctf *rctf2);
|
||||
void BLI_union_rcti(struct rcti *rcti1, const struct rcti *rcti2);
|
||||
void BLI_copy_rcti_rctf(struct rcti *tar, const struct rctf *src);
|
||||
|
||||
void print_rctf(const char *str, struct rctf *rect);
|
||||
void print_rcti(const char *str, struct rcti *rect);
|
||||
void print_rctf(const char *str, const struct rctf *rect);
|
||||
void print_rcti(const char *str, const struct rcti *rect);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -65,11 +65,12 @@ typedef struct ScanFillVert {
|
||||
union {
|
||||
struct ScanFillVert *v;
|
||||
void *p;
|
||||
intptr_t l;
|
||||
intptr_t l;
|
||||
unsigned int u;
|
||||
} tmp;
|
||||
float co[3]; /* vertex location */
|
||||
float xy[2]; /* 2D copy of vertex location (using dominant axis) */
|
||||
int keyindex; /* original index #, for restoring key information */
|
||||
unsigned int keyindex; /* original index #, for restoring key information */
|
||||
short poly_nr;
|
||||
unsigned char f, h;
|
||||
} ScanFillVert;
|
||||
@@ -79,6 +80,9 @@ typedef struct ScanFillEdge {
|
||||
struct ScanFillVert *v1, *v2;
|
||||
short poly_nr;
|
||||
unsigned char f;
|
||||
union {
|
||||
unsigned char c;
|
||||
} tmp;
|
||||
} ScanFillEdge;
|
||||
|
||||
typedef struct ScanFillFace {
|
||||
|
||||
@@ -1343,7 +1343,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
|
||||
|
||||
|
||||
/* Determines the distance that the ray must travel to hit the bounding volume of the given node */
|
||||
static float ray_nearest_hit(BVHRayCastData *data, float *bv)
|
||||
static float ray_nearest_hit(BVHRayCastData *data, const float *bv)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1521,7 +1521,7 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
|
||||
return data.hit.index;
|
||||
}
|
||||
|
||||
float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float light_end[3], float pos[3])
|
||||
float BLI_bvhtree_bb_raycast(const float *bv, const float light_start[3], const float light_end[3], float pos[3])
|
||||
{
|
||||
BVHRayCastData data;
|
||||
float dist = 0.0;
|
||||
|
||||
@@ -35,20 +35,23 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "DNA_vec_types.h"
|
||||
#include "BLI_rect.h"
|
||||
|
||||
int BLI_rcti_is_empty(rcti *rect)
|
||||
int BLI_rcti_is_empty(const rcti *rect)
|
||||
{
|
||||
return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
|
||||
}
|
||||
|
||||
int BLI_rctf_is_empty(rctf *rect)
|
||||
int BLI_rctf_is_empty(const rctf *rect)
|
||||
{
|
||||
return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
|
||||
}
|
||||
|
||||
int BLI_in_rcti(rcti *rect, int x, int y)
|
||||
int BLI_in_rcti(const rcti *rect, const int x, const int y)
|
||||
{
|
||||
if (x < rect->xmin) return 0;
|
||||
if (x > rect->xmax) return 0;
|
||||
@@ -57,7 +60,23 @@ int BLI_in_rcti(rcti *rect, int x, int y)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BLI_in_rctf(rctf *rect, float x, float y)
|
||||
/**
|
||||
* Determine if a rect is empty. An empty
|
||||
* rect is one with a zero (or negative)
|
||||
* width or height.
|
||||
*
|
||||
* \return True if \a rect is empty.
|
||||
*/
|
||||
int BLI_in_rcti_v(const rcti *rect, const int xy[2])
|
||||
{
|
||||
if (xy[0] < rect->xmin) return 0;
|
||||
if (xy[0] > rect->xmax) return 0;
|
||||
if (xy[1] < rect->ymin) return 0;
|
||||
if (xy[1] > rect->ymax) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BLI_in_rctf(const rctf *rect, const float x, const float y)
|
||||
{
|
||||
if (x < rect->xmin) return 0;
|
||||
if (x > rect->xmax) return 0;
|
||||
@@ -66,6 +85,15 @@ int BLI_in_rctf(rctf *rect, float x, float y)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BLI_in_rctf_v(const rctf *rect, const float xy[2])
|
||||
{
|
||||
if (xy[0] < rect->xmin) return 0;
|
||||
if (xy[0] > rect->xmax) return 0;
|
||||
if (xy[1] < rect->ymin) return 0;
|
||||
if (xy[1] > rect->ymax) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* based closely on 'isect_line_line_v2_int', but in modified so corner cases are treated as intersections */
|
||||
static int isect_segments(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
|
||||
{
|
||||
@@ -80,7 +108,7 @@ static int isect_segments(const int v1[2], const int v2[2], const int v3[2], con
|
||||
}
|
||||
}
|
||||
|
||||
int BLI_segment_in_rcti(rcti *rect, int s1[2], int s2[2])
|
||||
int BLI_segment_in_rcti(const rcti *rect, const int s1[2], const int s2[2])
|
||||
{
|
||||
/* first do outside-bounds check for both points of the segment */
|
||||
if (s1[0] < rect->xmin && s2[0] < rect->xmin) return 0;
|
||||
@@ -89,7 +117,7 @@ int BLI_segment_in_rcti(rcti *rect, int s1[2], int s2[2])
|
||||
if (s1[1] > rect->ymax && s2[1] > rect->ymax) return 0;
|
||||
|
||||
/* if either points intersect then we definetly intersect */
|
||||
if (BLI_in_rcti(rect, s1[0], s1[1]) || BLI_in_rcti(rect, s2[0], s2[1])) {
|
||||
if (BLI_in_rcti_v(rect, s1) || BLI_in_rcti_v(rect, s2)) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
@@ -115,7 +143,7 @@ int BLI_segment_in_rcti(rcti *rect, int s1[2], int s2[2])
|
||||
}
|
||||
}
|
||||
|
||||
void BLI_union_rctf(rctf *rct1, rctf *rct2)
|
||||
void BLI_union_rctf(rctf *rct1, const rctf *rct2)
|
||||
{
|
||||
if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
|
||||
if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
|
||||
@@ -123,7 +151,7 @@ void BLI_union_rctf(rctf *rct1, rctf *rct2)
|
||||
if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
|
||||
}
|
||||
|
||||
void BLI_union_rcti(rcti *rct1, rcti *rct2)
|
||||
void BLI_union_rcti(rcti *rct1, const rcti *rct2)
|
||||
{
|
||||
if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
|
||||
if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
|
||||
@@ -131,7 +159,7 @@ void BLI_union_rcti(rcti *rct1, rcti *rct2)
|
||||
if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
|
||||
}
|
||||
|
||||
void BLI_init_rctf(rctf *rect, float xmin, float xmax, float ymin, float ymax)
|
||||
void BLI_rctf_init(rctf *rect, float xmin, float xmax, float ymin, float ymax)
|
||||
{
|
||||
if (xmin <= xmax) {
|
||||
rect->xmin = xmin;
|
||||
@@ -151,7 +179,7 @@ void BLI_init_rctf(rctf *rect, float xmin, float xmax, float ymin, float ymax)
|
||||
}
|
||||
}
|
||||
|
||||
void BLI_init_rcti(rcti *rect, int xmin, int xmax, int ymin, int ymax)
|
||||
void BLI_rcti_init(rcti *rect, int xmin, int xmax, int ymin, int ymax)
|
||||
{
|
||||
if (xmin <= xmax) {
|
||||
rect->xmin = xmin;
|
||||
@@ -171,6 +199,34 @@ void BLI_init_rcti(rcti *rect, int xmin, int xmax, int ymin, int ymax)
|
||||
}
|
||||
}
|
||||
|
||||
void BLI_rcti_init_minmax(struct rcti *rect)
|
||||
{
|
||||
rect->xmin = rect->ymin = INT_MAX;
|
||||
rect->xmax = rect->ymax = INT_MIN;
|
||||
}
|
||||
|
||||
void BLI_rctf_init_minmax(struct rctf *rect)
|
||||
{
|
||||
rect->xmin = rect->ymin = FLT_MAX;
|
||||
rect->xmax = rect->ymax = FLT_MIN;
|
||||
}
|
||||
|
||||
void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2])
|
||||
{
|
||||
if (xy[0] < rect->xmin) rect->xmin = xy[0];
|
||||
if (xy[0] > rect->xmax) rect->xmax = xy[0];
|
||||
if (xy[1] < rect->ymin) rect->ymin = xy[1];
|
||||
if (xy[1] > rect->ymax) rect->ymax = xy[1];
|
||||
}
|
||||
|
||||
void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2])
|
||||
{
|
||||
if (xy[0] < rect->xmin) rect->xmin = xy[0];
|
||||
if (xy[0] > rect->xmax) rect->xmax = xy[0];
|
||||
if (xy[1] < rect->ymin) rect->ymin = xy[1];
|
||||
if (xy[1] > rect->ymax) rect->ymax = xy[1];
|
||||
}
|
||||
|
||||
void BLI_translate_rcti(rcti *rect, int x, int y)
|
||||
{
|
||||
rect->xmin += x;
|
||||
@@ -207,7 +263,7 @@ void BLI_resize_rctf(rctf *rect, float x, float y)
|
||||
rect->ymax = rect->ymin + y;
|
||||
}
|
||||
|
||||
int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
|
||||
int BLI_isect_rctf(const rctf *src1, const rctf *src2, rctf *dest)
|
||||
{
|
||||
float xmin, xmax;
|
||||
float ymin, ymax;
|
||||
@@ -237,7 +293,7 @@ int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
|
||||
}
|
||||
}
|
||||
|
||||
int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
|
||||
int BLI_isect_rcti(const rcti *src1, const rcti *src2, rcti *dest)
|
||||
{
|
||||
int xmin, xmax;
|
||||
int ymin, ymax;
|
||||
@@ -269,19 +325,19 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
|
||||
|
||||
void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
|
||||
{
|
||||
tar->xmin = floor(src->xmin + 0.5f);
|
||||
tar->xmax = floor((src->xmax - src->xmin) + 0.5f);
|
||||
tar->ymin = floor(src->ymin + 0.5f);
|
||||
tar->ymax = floor((src->ymax - src->ymin) + 0.5f);
|
||||
tar->xmin = floorf(src->xmin + 0.5f);
|
||||
tar->xmax = floorf((src->xmax - src->xmin) + 0.5f);
|
||||
tar->ymin = floorf(src->ymin + 0.5f);
|
||||
tar->ymax = floorf((src->ymax - src->ymin) + 0.5f);
|
||||
}
|
||||
|
||||
void print_rctf(const char *str, rctf *rect)
|
||||
void print_rctf(const char *str, const rctf *rect)
|
||||
{
|
||||
printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str,
|
||||
rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
|
||||
}
|
||||
|
||||
void print_rcti(const char *str, rcti *rect)
|
||||
void print_rcti(const char *str, const rcti *rect)
|
||||
{
|
||||
printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str,
|
||||
rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
|
||||
|
||||
@@ -8569,7 +8569,6 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
|
||||
static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
|
||||
{
|
||||
CustomDataLayer *layer;
|
||||
MTFace *mtf;
|
||||
TFace *tf;
|
||||
int a, i;
|
||||
|
||||
@@ -8591,14 +8590,34 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
|
||||
}
|
||||
}
|
||||
|
||||
for (a = 0; a < me->fdata.totlayer; a++) {
|
||||
layer = &me->fdata.layers[a];
|
||||
|
||||
if (layer->type == CD_MTFACE) {
|
||||
mtf = (MTFace*)layer->data;
|
||||
for (i = 0; i < me->totface; i++, mtf++) {
|
||||
if (mtf->tpage)
|
||||
expand_doit(fd, mainvar, mtf->tpage);
|
||||
if (me->mface && !me->mpoly) {
|
||||
MTFace *mtf;
|
||||
|
||||
for (a = 0; a < me->fdata.totlayer; a++) {
|
||||
layer = &me->fdata.layers[a];
|
||||
|
||||
if (layer->type == CD_MTFACE) {
|
||||
mtf = (MTFace *) layer->data;
|
||||
for (i = 0; i < me->totface; i++, mtf++) {
|
||||
if (mtf->tpage)
|
||||
expand_doit(fd, mainvar, mtf->tpage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
MTexPoly *mtp;
|
||||
|
||||
for (a = 0; a < me->pdata.totlayer; a++) {
|
||||
layer = &me->pdata.layers[a];
|
||||
|
||||
if (layer->type == CD_MTEXPOLY) {
|
||||
mtp = (MTexPoly *) layer->data;
|
||||
|
||||
for (i = 0; i < me->totpoly; i++, mtp++) {
|
||||
if (mtp->tpage)
|
||||
expand_doit(fd, mainvar, mtp->tpage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,9 @@ void CPUDevice::execute(WorkPackage *work)
|
||||
rcti rect;
|
||||
|
||||
executionGroup->determineChunkRect(&rect, chunkNumber);
|
||||
MemoryBuffer **inputBuffers = executionGroup->getInputBuffersCPU();
|
||||
|
||||
executionGroup->getOutputNodeOperation()->executeRegion(&rect, chunkNumber, inputBuffers);
|
||||
executionGroup->getOutputNodeOperation()->executeRegion(&rect, chunkNumber);
|
||||
|
||||
executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers);
|
||||
executionGroup->finalizeChunkExecution(chunkNumber, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -372,23 +372,6 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
delete[] chunkOrder;
|
||||
}
|
||||
|
||||
MemoryBuffer **ExecutionGroup::getInputBuffersCPU()
|
||||
{
|
||||
vector<MemoryProxy *> memoryproxies;
|
||||
unsigned int index;
|
||||
|
||||
this->determineDependingMemoryProxies(&memoryproxies);
|
||||
MemoryBuffer **memoryBuffers = new MemoryBuffer *[this->m_cachedMaxReadBufferOffset];
|
||||
for (index = 0; index < this->m_cachedMaxReadBufferOffset; index++) {
|
||||
memoryBuffers[index] = NULL;
|
||||
}
|
||||
for (index = 0; index < this->m_cachedReadOperations.size(); index++) {
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation *)this->m_cachedReadOperations[index];
|
||||
memoryBuffers[readOperation->getOffset()] = readOperation->getMemoryProxy()->getBuffer();
|
||||
}
|
||||
return memoryBuffers;
|
||||
}
|
||||
|
||||
MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
|
||||
{
|
||||
rcti rect;
|
||||
@@ -449,12 +432,12 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
|
||||
inline void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const
|
||||
{
|
||||
if (this->m_singleThreaded) {
|
||||
BLI_init_rcti(rect, 0, this->m_width, 0, this->m_height);
|
||||
BLI_rcti_init(rect, 0, this->m_width, 0, this->m_height);
|
||||
}
|
||||
else {
|
||||
const unsigned int minx = xChunk * this->m_chunkSize;
|
||||
const unsigned int miny = yChunk * this->m_chunkSize;
|
||||
BLI_init_rcti(rect, minx, min(minx + this->m_chunkSize, this->m_width), miny, min(miny + this->m_chunkSize, this->m_height));
|
||||
BLI_rcti_init(rect, minx, min(minx + this->m_chunkSize, this->m_width), miny, min(miny + this->m_chunkSize, this->m_height));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,7 +534,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChun
|
||||
|
||||
for (index = 0; index < this->m_cachedReadOperations.size(); index++) {
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation *)this->m_cachedReadOperations[index];
|
||||
BLI_init_rcti(&area, 0, 0, 0, 0);
|
||||
BLI_rcti_init(&area, 0, 0, 0, 0);
|
||||
MemoryProxy *memoryProxy = memoryProxies[index];
|
||||
determineDependingAreaOfInterest(&rect, readOperation, &area);
|
||||
ExecutionGroup *group = memoryProxy->getExecutor();
|
||||
|
||||
@@ -129,6 +129,13 @@ void ExecutionSystem::execute()
|
||||
operation->setbNodeTree(this->m_context.getbNodeTree());
|
||||
operation->initExecution();
|
||||
}
|
||||
for (index = 0; index < this->m_operations.size(); index++) {
|
||||
NodeOperation *operation = this->m_operations[index];
|
||||
if (operation->isReadBufferOperation()) {
|
||||
ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
|
||||
readOperation->updateMemoryBuffer();
|
||||
}
|
||||
}
|
||||
for (index = 0; index < this->m_groups.size(); index++) {
|
||||
ExecutionGroup *executionGroup = this->m_groups[index];
|
||||
executionGroup->setChunksize(this->m_context.getChunksize());
|
||||
|
||||
@@ -40,7 +40,7 @@ int MemoryBuffer::getHeight() const
|
||||
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect)
|
||||
{
|
||||
BLI_init_rcti(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
BLI_rcti_init(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
this->m_memoryProxy = memoryProxy;
|
||||
this->m_chunkNumber = chunkNumber;
|
||||
this->m_buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
|
||||
@@ -51,7 +51,7 @@ MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, r
|
||||
|
||||
MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
|
||||
{
|
||||
BLI_init_rcti(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
BLI_rcti_init(&this->m_rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
this->m_memoryProxy = memoryProxy;
|
||||
this->m_chunkNumber = -1;
|
||||
this->m_buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
|
||||
|
||||
@@ -140,6 +140,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
inline void readNoCheck(float result[4], int x, int y) {
|
||||
const int dx = x - this->m_rect.xmin;
|
||||
const int dy = y - this->m_rect.ymin;
|
||||
const int offset = (this->m_chunkWidth * dy + dx) * COM_NUMBER_OF_CHANNELS;
|
||||
copy_v4_v4(result, &this->m_buffer[offset]);
|
||||
}
|
||||
|
||||
void writePixel(int x, int y, const float color[4]);
|
||||
void addPixel(int x, int y, const float color[4]);
|
||||
inline void readCubic(float result[4], float x, float y)
|
||||
|
||||
@@ -120,7 +120,7 @@ void NodeOperation::getConnectedInputSockets(vector<InputSocket *> *sockets)
|
||||
bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
if (this->isInputNode()) {
|
||||
BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
|
||||
BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
* @param chunkNumber the chunkNumber to be calculated
|
||||
* @param memoryBuffers all input MemoryBuffer's needed
|
||||
*/
|
||||
virtual void executeRegion(rcti *rect, unsigned int chunkNumber, MemoryBuffer **memoryBuffers) {}
|
||||
virtual void executeRegion(rcti *rect, unsigned int chunkNumber) {}
|
||||
|
||||
/**
|
||||
* @brief when a chunk is executed by an OpenCLDevice, this method is called
|
||||
|
||||
@@ -65,11 +65,16 @@ void OpenCLDevice::execute(WorkPackage *work)
|
||||
|
||||
executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, ReadBufferOperation *reader)
|
||||
{
|
||||
cl_int error;
|
||||
MemoryBuffer *result = (MemoryBuffer *)reader->initializeTileData(NULL, inputMemoryBuffers);
|
||||
|
||||
MemoryBuffer *result = (MemoryBuffer *)reader->getInputMemoryBuffer(inputMemoryBuffers);
|
||||
|
||||
const cl_image_format imageFormat = {
|
||||
CL_RGBA,
|
||||
|
||||
@@ -28,6 +28,7 @@ class OpenCLDevice;
|
||||
#include "COM_Device.h"
|
||||
#include "OCL_opencl.h"
|
||||
#include "COM_WorkScheduler.h"
|
||||
#include "COM_ReadBufferOperation.h"
|
||||
|
||||
/**
|
||||
* @brief device representing an GPU OpenCL device.
|
||||
@@ -96,6 +97,7 @@ public:
|
||||
cl_command_queue getQueue(){ return this->m_queue; }
|
||||
|
||||
cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader);
|
||||
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, NodeOperation* operation);
|
||||
|
||||
@@ -94,7 +94,7 @@ void ** g_highlightedNodesRead;
|
||||
}
|
||||
void COM_startReadHighlights() {
|
||||
if (g_highlightedNodesRead) {
|
||||
delete g_highlightedNodesRead;
|
||||
delete [] g_highlightedNodesRead;
|
||||
}
|
||||
|
||||
g_highlightedNodesRead = g_highlightedNodes;
|
||||
|
||||
@@ -37,6 +37,7 @@ void DirectionalBlurNode::convertToOperations(ExecutionSystem *graph, Compositor
|
||||
DirectionalBlurOperation *operation = new DirectionalBlurOperation();
|
||||
operation->setQuality(context->getQuality());
|
||||
operation->setData(data);
|
||||
operation->setbNode(this->getbNode());
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
|
||||
graph->addOperation(operation);
|
||||
|
||||
@@ -94,7 +94,7 @@ void CompositorOperation::deinitExecution()
|
||||
}
|
||||
|
||||
|
||||
void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||
void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber)
|
||||
{
|
||||
float color[8]; // 7 is enough
|
||||
float *buffer = this->m_outputBuffer;
|
||||
@@ -111,9 +111,9 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber, Mem
|
||||
|
||||
for (y = y1; y < y2 && (!breaked); y++) {
|
||||
for (x = x1; x < x2 && (!breaked); x++) {
|
||||
this->m_imageInput->read(color, x, y, COM_PS_NEAREST, memoryBuffers);
|
||||
this->m_imageInput->read(color, x, y, COM_PS_NEAREST, NULL);
|
||||
if (this->m_alphaInput != NULL) {
|
||||
this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST, memoryBuffers);
|
||||
this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST, NULL);
|
||||
}
|
||||
copy_v4_v4(buffer + offset, color);
|
||||
offset += COM_NUMBER_OF_CHANNELS;
|
||||
|
||||
@@ -52,7 +52,7 @@ private:
|
||||
SocketReader *m_alphaInput;
|
||||
public:
|
||||
CompositorOperation();
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber);
|
||||
void setRenderData(const RenderData *rd) { this->m_rd = rd; }
|
||||
bool isOutputOperation(bool rendering) const { return true; }
|
||||
void initExecution();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "COM_DirectionalBlurOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "COM_OpenCLDevice.h"
|
||||
extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
}
|
||||
@@ -33,6 +33,7 @@ DirectionalBlurOperation::DirectionalBlurOperation() : NodeOperation()
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
|
||||
this->setOpenCL(true);
|
||||
this->m_inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -97,9 +98,35 @@ void DirectionalBlurOperation::executePixel(float *color, int x, int y, MemoryBu
|
||||
lsc += this->m_sc;
|
||||
}
|
||||
|
||||
mul_v4_v4fl(color, col2, 1.0f / iterations);
|
||||
mul_v4_v4fl(color, col2, 1.0f / (iterations+1));
|
||||
}
|
||||
|
||||
void DirectionalBlurOperation::executeOpenCL(OpenCLDevice* device,
|
||||
MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
|
||||
MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
|
||||
list<cl_kernel> *clKernelsToCleanUp)
|
||||
{
|
||||
cl_kernel directionalBlurKernel = device->COM_clCreateKernel("directionalBlurKernel", NULL);
|
||||
|
||||
cl_int iterations = pow(2.0f, this->m_data->iter);
|
||||
cl_float2 ltxy = {this->m_tx, this->m_ty};
|
||||
cl_float2 centerpix = {this->m_center_x_pix, this->m_center_y_pix};
|
||||
cl_float lsc = this->m_sc;
|
||||
cl_float lrot = this->m_rot;
|
||||
|
||||
device->COM_clAttachMemoryBufferToKernelParameter(directionalBlurKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
|
||||
device->COM_clAttachOutputMemoryBufferToKernelParameter(directionalBlurKernel, 1, clOutputBuffer);
|
||||
device->COM_clAttachMemoryBufferOffsetToKernelParameter(directionalBlurKernel, 2, outputMemoryBuffer);
|
||||
clSetKernelArg(directionalBlurKernel, 3, sizeof(cl_int), &iterations);
|
||||
clSetKernelArg(directionalBlurKernel, 4, sizeof(cl_float), &lsc);
|
||||
clSetKernelArg(directionalBlurKernel, 5, sizeof(cl_float), &lrot);
|
||||
clSetKernelArg(directionalBlurKernel, 6, sizeof(cl_float2), <xy);
|
||||
clSetKernelArg(directionalBlurKernel, 7, sizeof(cl_float2), ¢erpix);
|
||||
|
||||
device->COM_clEnqueueRange(directionalBlurKernel, outputMemoryBuffer, 8, this);
|
||||
}
|
||||
|
||||
|
||||
void DirectionalBlurOperation::deinitExecution()
|
||||
{
|
||||
this->m_inputProgram = NULL;
|
||||
|
||||
@@ -55,5 +55,11 @@ public:
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
void setData(NodeDBlurData *data) { this->m_data = data; }
|
||||
|
||||
void executeOpenCL(OpenCLDevice* device,
|
||||
MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer,
|
||||
MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp,
|
||||
list<cl_kernel> *clKernelsToCleanUp);
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -379,7 +379,7 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile,
|
||||
// temp. src image
|
||||
// make the convolution kernel
|
||||
rcti kernelRect;
|
||||
BLI_init_rcti(&kernelRect, 0, sz, 0, sz);
|
||||
BLI_rcti_init(&kernelRect, 0, sz, 0, sz);
|
||||
ckrn = new MemoryBuffer(NULL, &kernelRect);
|
||||
|
||||
scale = 0.25f * sqrtf((float)(sz * sz));
|
||||
|
||||
@@ -242,7 +242,7 @@ void *KeyingScreenOperation::initializeTileData(rcti *rect, MemoryBuffer **memor
|
||||
if (!triangulation)
|
||||
return NULL;
|
||||
|
||||
BLI_init_rctf(&rect_float, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
BLI_rctf_init(&rect_float, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
|
||||
|
||||
tile_data = (TileData *) MEM_callocN(sizeof(TileData), "keying screen tile data");
|
||||
|
||||
|
||||
@@ -1,7 +1,30 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
/// This file contains all opencl kernels for node-operation implementations
|
||||
|
||||
// Global SAMPLERS
|
||||
const sampler_t SAMPLER_NEAREST = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
|
||||
const sampler_t SAMPLER_NEAREST = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
|
||||
const sampler_t SAMPLER_NEAREST_CLAMP = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
|
||||
|
||||
__constant const int2 zero = {0,0};
|
||||
|
||||
@@ -78,16 +101,16 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
|
||||
float size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
|
||||
color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);
|
||||
|
||||
for (int ny = miny; ny < maxy; ny += step) {
|
||||
for (int nx = minx; nx < maxx; nx += step) {
|
||||
if (nx >= 0 && nx < dimension.s0 && ny >= 0 && ny < dimension.s1) {
|
||||
inputCoordinate.s0 = nx - offsetInput.s0;
|
||||
inputCoordinate.s1 = ny - offsetInput.s1;
|
||||
tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
|
||||
if (size > threshold && tempSize > threshold) {
|
||||
float dx = nx - realCoordinate.s0;
|
||||
float dy = ny - realCoordinate.s1;
|
||||
if (dx != 0 || dy != 0) {
|
||||
if (size > threshold) {
|
||||
for (int ny = miny; ny < maxy; ny += step) {
|
||||
inputCoordinate.s1 = ny - offsetInput.s1;
|
||||
float dy = ny - realCoordinate.s1;
|
||||
for (int nx = minx; nx < maxx; nx += step) {
|
||||
float dx = nx - realCoordinate.s0;
|
||||
if (dx != 0 || dy != 0) {
|
||||
inputCoordinate.s0 = nx - offsetInput.s0;
|
||||
tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;
|
||||
if (tempSize > threshold) {
|
||||
if (tempSize >= fabs(dx) && tempSize >= fabs(dy)) {
|
||||
float2 uv = { 256.0f + dx * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize};
|
||||
bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);
|
||||
@@ -98,8 +121,8 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
color = color_accum * (1.0f / multiplier_accum);
|
||||
@@ -168,3 +191,44 @@ __kernel void erodeKernel(__read_only image2d_t inputImage, __write_only image2
|
||||
float4 color = {value,0.0f,0.0f,0.0f};
|
||||
write_imagef(output, coords, color);
|
||||
}
|
||||
|
||||
// KERNEL --- DIRECTIONAL BLUR ---
|
||||
__kernel void directionalBlurKernel(__read_only image2d_t inputImage, __write_only image2d_t output,
|
||||
int2 offsetOutput, int iterations, float scale, float rotation, float2 translate,
|
||||
float2 center, int2 offset)
|
||||
{
|
||||
int2 coords = {get_global_id(0), get_global_id(1)};
|
||||
coords += offset;
|
||||
const int2 realCoordinate = coords + offsetOutput;
|
||||
|
||||
float4 col;
|
||||
float2 ltxy = translate;
|
||||
float lsc = scale;
|
||||
float lrot = rotation;
|
||||
|
||||
col = read_imagef(inputImage, SAMPLER_NEAREST, realCoordinate);
|
||||
|
||||
/* blur the image */
|
||||
for (int i = 0; i < iterations; ++i) {
|
||||
const float cs = cos(lrot), ss = sin(lrot);
|
||||
const float isc = 1.0f / (1.0f + lsc);
|
||||
|
||||
const float v = isc * (realCoordinate.s1 - center.s1) + ltxy.s1;
|
||||
const float u = isc * (realCoordinate.s0 - center.s0) + ltxy.s0;
|
||||
float2 uv = {
|
||||
cs * u + ss * v + center.s0,
|
||||
cs * v - ss * u + center.s1
|
||||
};
|
||||
|
||||
col += read_imagef(inputImage, SAMPLER_NEAREST_CLAMP, uv);
|
||||
|
||||
/* double transformations */
|
||||
ltxy += translate;
|
||||
lrot += rotation;
|
||||
lsc += scale;
|
||||
}
|
||||
|
||||
col *= (1.0f/(iterations+1));
|
||||
|
||||
write_imagef(output, coords, col);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,32 @@
|
||||
/* clkernelstoh output of file <COM_OpenCLKernels_cl> */
|
||||
|
||||
const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all opencl kernels for node-operation implementations\n" \
|
||||
const char * clkernelstoh_COM_OpenCLKernels_cl = "/*\n" \
|
||||
" * Copyright 2011, Blender Foundation.\n" \
|
||||
" *\n" \
|
||||
" * This program is free software; you can redistribute it and/or\n" \
|
||||
" * modify it under the terms of the GNU General Public License\n" \
|
||||
" * as published by the Free Software Foundation; either version 2\n" \
|
||||
" * of the License, or (at your option) any later version.\n" \
|
||||
" *\n" \
|
||||
" * This program is distributed in the hope that it will be useful,\n" \
|
||||
" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \
|
||||
" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \
|
||||
" * GNU General Public License for more details.\n" \
|
||||
" *\n" \
|
||||
" * You should have received a copy of the GNU General Public License\n" \
|
||||
" * along with this program; if not, write to the Free Software Foundation,\n" \
|
||||
" * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n" \
|
||||
" *\n" \
|
||||
" * Contributor:\n" \
|
||||
" * Jeroen Bakker\n" \
|
||||
" * Monique Dewanchand\n" \
|
||||
" */\n" \
|
||||
"\n" \
|
||||
"/// This file contains all opencl kernels for node-operation implementations\n" \
|
||||
"\n" \
|
||||
"// Global SAMPLERS\n" \
|
||||
"const sampler_t SAMPLER_NEAREST = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;\n" \
|
||||
"const sampler_t SAMPLER_NEAREST = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;\n" \
|
||||
"const sampler_t SAMPLER_NEAREST_CLAMP = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;\n" \
|
||||
"\n" \
|
||||
"__constant const int2 zero = {0,0};\n" \
|
||||
"\n" \
|
||||
@@ -80,16 +103,16 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope
|
||||
" float size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \
|
||||
" color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);\n" \
|
||||
"\n" \
|
||||
" for (int ny = miny; ny < maxy; ny += step) {\n" \
|
||||
" for (int nx = minx; nx < maxx; nx += step) {\n" \
|
||||
" if (nx >= 0 && nx < dimension.s0 && ny >= 0 && ny < dimension.s1) {\n" \
|
||||
" inputCoordinate.s0 = nx - offsetInput.s0;\n" \
|
||||
" inputCoordinate.s1 = ny - offsetInput.s1;\n" \
|
||||
" tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \
|
||||
" if (size > threshold && tempSize > threshold) {\n" \
|
||||
" float dx = nx - realCoordinate.s0;\n" \
|
||||
" float dy = ny - realCoordinate.s1;\n" \
|
||||
" if (dx != 0 || dy != 0) {\n" \
|
||||
" if (size > threshold) {\n" \
|
||||
" for (int ny = miny; ny < maxy; ny += step) {\n" \
|
||||
" inputCoordinate.s1 = ny - offsetInput.s1;\n" \
|
||||
" float dy = ny - realCoordinate.s1;\n" \
|
||||
" for (int nx = minx; nx < maxx; nx += step) {\n" \
|
||||
" float dx = nx - realCoordinate.s0;\n" \
|
||||
" if (dx != 0 || dy != 0) {\n" \
|
||||
" inputCoordinate.s0 = nx - offsetInput.s0;\n" \
|
||||
" tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \
|
||||
" if (tempSize > threshold) {\n" \
|
||||
" if (tempSize >= fabs(dx) && tempSize >= fabs(dy)) {\n" \
|
||||
" float2 uv = { 256.0f + dx * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize};\n" \
|
||||
" bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);\n" \
|
||||
@@ -170,4 +193,45 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope
|
||||
" float4 color = {value,0.0f,0.0f,0.0f};\n" \
|
||||
" write_imagef(output, coords, color);\n" \
|
||||
"}\n" \
|
||||
"\n" \
|
||||
"// KERNEL --- DIRECTIONAL BLUR ---\n" \
|
||||
"__kernel void directionalBlurKernel(__read_only image2d_t inputImage, __write_only image2d_t output,\n" \
|
||||
" int2 offsetOutput, int iterations, float scale, float rotation, float2 translate,\n" \
|
||||
" float2 center, int2 offset)\n" \
|
||||
"{\n" \
|
||||
" int2 coords = {get_global_id(0), get_global_id(1)};\n" \
|
||||
" coords += offset;\n" \
|
||||
" const int2 realCoordinate = coords + offsetOutput;\n" \
|
||||
"\n" \
|
||||
" float4 col;\n" \
|
||||
" float2 ltxy = translate;\n" \
|
||||
" float lsc = scale;\n" \
|
||||
" float lrot = rotation;\n" \
|
||||
"\n" \
|
||||
" col = read_imagef(inputImage, SAMPLER_NEAREST, realCoordinate);\n" \
|
||||
"\n" \
|
||||
" /* blur the image */\n" \
|
||||
" for (int i = 0; i < iterations; ++i) {\n" \
|
||||
" const float cs = cos(lrot), ss = sin(lrot);\n" \
|
||||
" const float isc = 1.0f / (1.0f + lsc);\n" \
|
||||
"\n" \
|
||||
" const float v = isc * (realCoordinate.s1 - center.s1) + ltxy.s1;\n" \
|
||||
" const float u = isc * (realCoordinate.s0 - center.s0) + ltxy.s0;\n" \
|
||||
" float2 uv = {\n" \
|
||||
" cs * u + ss * v + center.s0,\n" \
|
||||
" cs * v - ss * u + center.s1\n" \
|
||||
" };\n" \
|
||||
"\n" \
|
||||
" col += read_imagef(inputImage, SAMPLER_NEAREST_CLAMP, uv);\n" \
|
||||
"\n" \
|
||||
" /* double transformations */\n" \
|
||||
" ltxy += translate;\n" \
|
||||
" lrot += rotation;\n" \
|
||||
" lsc += scale;\n" \
|
||||
" }\n" \
|
||||
"\n" \
|
||||
" col *= (1.0f/(iterations+1));\n" \
|
||||
"\n" \
|
||||
" write_imagef(output, coords, col);\n" \
|
||||
"}\n" \
|
||||
"\0";
|
||||
|
||||
@@ -59,7 +59,7 @@ static float *init_buffer(unsigned int width, unsigned int height, DataType data
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void write_buffer_rect(rcti *rect, MemoryBuffer **memoryBuffers, const bNodeTree *tree,
|
||||
static void write_buffer_rect(rcti *rect, const bNodeTree *tree,
|
||||
SocketReader *reader, float *buffer, unsigned int width, DataType datatype)
|
||||
{
|
||||
float color[4];
|
||||
@@ -77,7 +77,7 @@ static void write_buffer_rect(rcti *rect, MemoryBuffer **memoryBuffers, const bN
|
||||
|
||||
for (y = y1; y < y2 && (!breaked); y++) {
|
||||
for (x = x1; x < x2 && (!breaked); x++) {
|
||||
reader->read(color, x, y, COM_PS_NEAREST, memoryBuffers);
|
||||
reader->read(color, x, y, COM_PS_NEAREST, NULL);
|
||||
|
||||
for (i = 0; i < size; ++i)
|
||||
buffer[offset + i] = color[i];
|
||||
@@ -113,9 +113,9 @@ void OutputSingleLayerOperation::initExecution()
|
||||
this->m_outputBuffer = init_buffer(this->getWidth(), this->getHeight(), this->m_datatype);
|
||||
}
|
||||
|
||||
void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||
void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
|
||||
{
|
||||
write_buffer_rect(rect, memoryBuffers, this->m_tree, this->m_imageInput, this->m_outputBuffer, this->getWidth(), this->m_datatype);
|
||||
write_buffer_rect(rect, this->m_tree, this->m_imageInput, this->m_outputBuffer, this->getWidth(), this->m_datatype);
|
||||
}
|
||||
|
||||
void OutputSingleLayerOperation::deinitExecution()
|
||||
@@ -183,10 +183,10 @@ void OutputOpenExrMultiLayerOperation::initExecution()
|
||||
}
|
||||
}
|
||||
|
||||
void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||
void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
|
||||
{
|
||||
for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
|
||||
write_buffer_rect(rect, memoryBuffers, this->m_tree, this->m_layers[i].imageInput, this->m_layers[i].outputBuffer, this->getWidth(), this->m_layers[i].datatype);
|
||||
write_buffer_rect(rect, this->m_tree, this->m_layers[i].imageInput, this->m_layers[i].outputBuffer, this->getWidth(), this->m_layers[i].datatype);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
public:
|
||||
OutputSingleLayerOperation(const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path);
|
||||
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber);
|
||||
bool isOutputOperation(bool rendering) const { return true; }
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
void add_layer(const char *name, DataType datatype);
|
||||
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber);
|
||||
bool isOutputOperation(bool rendering) const { return true; }
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
@@ -79,7 +79,7 @@ void PreviewOperation::deinitExecution()
|
||||
this->m_input = NULL;
|
||||
}
|
||||
|
||||
void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||
void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber)
|
||||
{
|
||||
int offset;
|
||||
float color[4];
|
||||
@@ -93,7 +93,7 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber, Memory
|
||||
color[1] = 0.0f;
|
||||
color[2] = 0.0f;
|
||||
color[3] = 1.0f;
|
||||
this->m_input->read(color, rx, ry, COM_PS_NEAREST, memoryBuffers);
|
||||
this->m_input->read(color, rx, ry, COM_PS_NEAREST, NULL);
|
||||
linearrgb_to_srgb_v4(color, color);
|
||||
F4TOCHAR4(color, this->m_outputBuffer + offset);
|
||||
offset += 4;
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
void deinitExecution();
|
||||
const CompositorPriority getRenderPriority() const;
|
||||
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber);
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
void setbNode(bNode *node) { this->m_node = node; }
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
|
||||
@@ -28,11 +28,12 @@ ReadBufferOperation::ReadBufferOperation() : NodeOperation()
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_offset = 0;
|
||||
this->m_buffer = NULL;
|
||||
}
|
||||
|
||||
void *ReadBufferOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
return getInputMemoryBuffer(memoryBuffers);
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
@@ -50,36 +51,23 @@ void ReadBufferOperation::determineResolution(unsigned int resolution[], unsigne
|
||||
}
|
||||
void ReadBufferOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
if (inputBuffers) {
|
||||
MemoryBuffer *inputBuffer = inputBuffers[this->m_offset];
|
||||
if (inputBuffer) {
|
||||
if (sampler == COM_PS_NEAREST) {
|
||||
inputBuffer->read(color, x, y);
|
||||
}
|
||||
else {
|
||||
inputBuffer->readCubic(color, x, y);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
color[0] = 0.0f;
|
||||
color[1] = 0.0f;
|
||||
color[2] = 0.0f;
|
||||
color[3] = 0.0f;
|
||||
if (sampler == COM_PS_NEAREST) {
|
||||
m_buffer->read(color, x, y);
|
||||
}
|
||||
else {
|
||||
m_buffer->readCubic(color, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadBufferOperation::executePixel(float *color, float x, float y, float dx, float dy, MemoryBuffer *inputBuffers[])
|
||||
{
|
||||
MemoryBuffer *inputBuffer = inputBuffers[this->m_offset];
|
||||
if (inputBuffer) {
|
||||
inputBuffer->readEWA(color, x, y, dx, dy);
|
||||
}
|
||||
m_buffer->readEWA(color, x, y, dx, dy);
|
||||
}
|
||||
|
||||
bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
if (this == readOperation) {
|
||||
BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
|
||||
BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -93,3 +81,9 @@ void ReadBufferOperation::readResolutionFromWriteBuffer()
|
||||
this->setHeight(operation->getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
void ReadBufferOperation::updateMemoryBuffer()
|
||||
{
|
||||
this->m_buffer = this->getMemoryProxy()->getBuffer();
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class ReadBufferOperation : public NodeOperation {
|
||||
private:
|
||||
MemoryProxy *m_memoryProxy;
|
||||
unsigned int m_offset;
|
||||
MemoryBuffer *m_buffer;
|
||||
public:
|
||||
ReadBufferOperation();
|
||||
int isBufferOperation() { return true; }
|
||||
@@ -46,6 +47,7 @@ public:
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
MemoryBuffer *getInputMemoryBuffer(MemoryBuffer **memoryBuffers) { return memoryBuffers[this->m_offset]; }
|
||||
void readResolutionFromWriteBuffer();
|
||||
void updateMemoryBuffer();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -60,7 +60,7 @@ void SplitViewerOperation::deinitExecution()
|
||||
}
|
||||
|
||||
|
||||
void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||
void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
|
||||
{
|
||||
float *buffer = this->m_outputBuffer;
|
||||
unsigned char *bufferDisplay = this->m_outputBufferDisplay;
|
||||
@@ -80,10 +80,10 @@ void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
|
||||
float srgb[4];
|
||||
image1 = this->m_xSplit ? x > perc : y > perc;
|
||||
if (image1) {
|
||||
this->m_image1Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
|
||||
this->m_image1Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, NULL);
|
||||
}
|
||||
else {
|
||||
this->m_image2Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
|
||||
this->m_image2Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, NULL);
|
||||
}
|
||||
/// @todo: linear conversion only when scene color management is selected, also check predivide.
|
||||
if (this->m_doColorManagement) {
|
||||
|
||||
@@ -35,7 +35,7 @@ private:
|
||||
bool m_xSplit;
|
||||
public:
|
||||
SplitViewerOperation();
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber);
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
void setSplitPercentage(float splitPercentage) { this->m_splitPercentage = splitPercentage; }
|
||||
|
||||
@@ -62,8 +62,29 @@ void VariableSizeBokehBlurOperation::initExecution()
|
||||
QualityStepHelper::initExecution(COM_QH_INCREASE);
|
||||
}
|
||||
|
||||
void *VariableSizeBokehBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
MemoryBuffer** result = new MemoryBuffer*[3];
|
||||
result[0] = (MemoryBuffer*)this->m_inputProgram->initializeTileData(rect, memoryBuffers);
|
||||
result[1] = (MemoryBuffer*)this->m_inputBokehProgram->initializeTileData(rect, memoryBuffers);
|
||||
result[2] = (MemoryBuffer*)this->m_inputSizeProgram->initializeTileData(rect, memoryBuffers);
|
||||
return result;
|
||||
}
|
||||
|
||||
void VariableSizeBokehBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
|
||||
{
|
||||
MemoryBuffer** result = (MemoryBuffer**)data;
|
||||
delete[] result;
|
||||
}
|
||||
|
||||
void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
MemoryBuffer** buffers = (MemoryBuffer**)data;
|
||||
MemoryBuffer* inputProgramBuffer = buffers[0];
|
||||
MemoryBuffer* inputBokehBuffer = buffers[1];
|
||||
MemoryBuffer* inputSizeBuffer = buffers[2];
|
||||
float* inputSizeFloatBuffer = inputSizeBuffer->getBuffer();
|
||||
float* inputProgramFloatBuffer = inputProgramBuffer->getBuffer();
|
||||
float readColor[4];
|
||||
float bokeh[4];
|
||||
float tempSize[4];
|
||||
@@ -84,32 +105,37 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
|
||||
int maxy = MIN2(y + this->m_maxBlur, m_height);
|
||||
#endif
|
||||
{
|
||||
this->m_inputSizeProgram->read(tempSize, x, y, COM_PS_NEAREST, inputBuffers);
|
||||
this->m_inputProgram->read(readColor, x, y, COM_PS_NEAREST, inputBuffers);
|
||||
inputSizeBuffer->readNoCheck(tempSize, x, y);
|
||||
inputProgramBuffer->readNoCheck(readColor, x, y);
|
||||
|
||||
add_v4_v4(color_accum, readColor);
|
||||
add_v4_fl(multiplier_accum, 1.0f);
|
||||
float sizeCenter = tempSize[0];
|
||||
|
||||
for (int ny = miny; ny < maxy; ny += QualityStepHelper::getStep()) {
|
||||
for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
|
||||
if (nx >= 0 && nx < this->getWidth() && ny >= 0 && ny < getHeight()) {
|
||||
this->m_inputSizeProgram->read(tempSize, nx, ny, COM_PS_NEAREST, inputBuffers);
|
||||
float size = tempSize[0];
|
||||
float fsize = fabsf(size);
|
||||
if (sizeCenter > this->m_threshold && size > this->m_threshold) {
|
||||
float dx = nx - x;
|
||||
float dy = ny - y;
|
||||
if (nx == x && ny == y) {
|
||||
}
|
||||
else if (fsize > fabsf(dx) && fsize > fabsf(dy)) {
|
||||
float u = (256 + (dx/size) * 256);
|
||||
float v = (256 + (dy/size) * 256);
|
||||
this->m_inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers);
|
||||
this->m_inputProgram->read(readColor, nx, ny, COM_PS_NEAREST, inputBuffers);
|
||||
madd_v4_v4v4(color_accum, bokeh, readColor);
|
||||
add_v4_v4(multiplier_accum, bokeh);
|
||||
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);
|
||||
for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
|
||||
if (nx != x || ny != y)
|
||||
{
|
||||
float size = inputSizeFloatBuffer[offsetNxNy];
|
||||
if (size > this->m_threshold) {
|
||||
float fsize = fabsf(size);
|
||||
float dx = nx - x;
|
||||
if (fsize > fabsf(dx) && fsize > fabsf(dy)) {
|
||||
float u = (256.0f + (dx/size) * 256.0f);
|
||||
float v = (256.0f + (dy/size) * 256.0f);
|
||||
inputBokehBuffer->readNoCheck(bokeh, u, v);
|
||||
madd_v4_v4v4(color_accum, bokeh, &inputProgramFloatBuffer[offsetNxNy]);
|
||||
add_v4_v4(multiplier_accum, bokeh);
|
||||
}
|
||||
}
|
||||
}
|
||||
offsetNxNy += addXStep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ public:
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
void *initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
|
||||
void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
|
||||
@@ -64,7 +64,7 @@ void ViewerOperation::deinitExecution()
|
||||
}
|
||||
|
||||
|
||||
void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||
void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
|
||||
{
|
||||
float *buffer = this->m_outputBuffer;
|
||||
unsigned char *bufferDisplay = this->m_outputBufferDisplay;
|
||||
@@ -82,9 +82,9 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryB
|
||||
|
||||
for (y = y1; y < y2 && (!breaked); y++) {
|
||||
for (x = x1; x < x2; x++) {
|
||||
this->m_imageInput->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers);
|
||||
this->m_imageInput->read(&(buffer[offset]), x, y, COM_PS_NEAREST, NULL);
|
||||
if (this->m_alphaInput != NULL) {
|
||||
this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST, memoryBuffers);
|
||||
this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST, NULL);
|
||||
buffer[offset + 3] = alpha[0];
|
||||
}
|
||||
/// @todo: linear conversion only when scene color management is selected, also check predivide.
|
||||
|
||||
@@ -34,7 +34,7 @@ private:
|
||||
|
||||
public:
|
||||
ViewerOperation();
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber);
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
};
|
||||
|
||||
@@ -57,13 +57,12 @@ void WriteBufferOperation::deinitExecution()
|
||||
this->m_memoryProxy->free();
|
||||
}
|
||||
|
||||
void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers)
|
||||
void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber)
|
||||
{
|
||||
//MemoryBuffer *memoryBuffer = MemoryManager::getMemoryBuffer(this->getMemoryProxy(), tileNumber);
|
||||
MemoryBuffer *memoryBuffer = this->m_memoryProxy->getBuffer();
|
||||
float *buffer = memoryBuffer->getBuffer();
|
||||
if (this->m_input->isComplex()) {
|
||||
void *data = this->m_input->initializeTileData(rect, memoryBuffers);
|
||||
void *data = this->m_input->initializeTileData(rect, NULL);
|
||||
int x1 = rect->xmin;
|
||||
int y1 = rect->ymin;
|
||||
int x2 = rect->xmax;
|
||||
@@ -74,7 +73,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
|
||||
for (y = y1; y < y2 && (!breaked); y++) {
|
||||
int offset4 = (y * memoryBuffer->getWidth() + x1) * COM_NUMBER_OF_CHANNELS;
|
||||
for (x = x1; x < x2; x++) {
|
||||
this->m_input->read(&(buffer[offset4]), x, y, memoryBuffers, data);
|
||||
this->m_input->read(&(buffer[offset4]), x, y, NULL, data);
|
||||
offset4 += COM_NUMBER_OF_CHANNELS;
|
||||
|
||||
}
|
||||
@@ -84,7 +83,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
|
||||
|
||||
}
|
||||
if (data) {
|
||||
this->m_input->deinitializeTileData(rect, memoryBuffers, data);
|
||||
this->m_input->deinitializeTileData(rect, NULL, data);
|
||||
data = NULL;
|
||||
}
|
||||
}
|
||||
@@ -100,7 +99,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
|
||||
for (y = y1; y < y2 && (!breaked); y++) {
|
||||
int offset4 = (y * memoryBuffer->getWidth() + x1) * COM_NUMBER_OF_CHANNELS;
|
||||
for (x = x1; x < x2; x++) {
|
||||
this->m_input->read(&(buffer[offset4]), x, y, COM_PS_NEAREST, memoryBuffers);
|
||||
this->m_input->read(&(buffer[offset4]), x, y, COM_PS_NEAREST, NULL);
|
||||
offset4 += COM_NUMBER_OF_CHANNELS;
|
||||
}
|
||||
if (isBreaked()) {
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
|
||||
const bool isWriteBufferOperation() const { return true; }
|
||||
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber);
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
void executeOpenCLRegion(OpenCLDevice* device, rcti *rect, unsigned int chunkNumber, MemoryBuffer **memoryBuffers, MemoryBuffer *outputBuffer);
|
||||
|
||||
@@ -505,7 +505,7 @@ static short ok_bezier_region(KeyframeEditData *ked, BezTriple *bezt)
|
||||
if (ked->data) {
|
||||
short ok = 0;
|
||||
|
||||
#define KEY_CHECK_OK(_index) BLI_in_rctf(ked->data, bezt->vec[_index][0], bezt->vec[_index][1])
|
||||
#define KEY_CHECK_OK(_index) BLI_in_rctf_v(ked->data, bezt->vec[_index])
|
||||
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
|
||||
#undef KEY_CHECK_OK
|
||||
|
||||
|
||||
@@ -120,8 +120,8 @@ enum {
|
||||
/* Macros: */
|
||||
|
||||
/* test if mouse in a scrollbar (assume that scroller availability has been tested) */
|
||||
#define IN_2D_VERT_SCROLL(v2d, co) (BLI_in_rcti(&v2d->vert, co[0], co[1]))
|
||||
#define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_in_rcti(&v2d->hor, co[0], co[1]))
|
||||
#define IN_2D_VERT_SCROLL(v2d, co) (BLI_in_rcti_v(&v2d->vert, co))
|
||||
#define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_in_rcti_v(&v2d->hor, co))
|
||||
|
||||
/* ------------------------------------------ */
|
||||
/* Type definitions: */
|
||||
|
||||
@@ -3792,12 +3792,14 @@ void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (type == BUT_GET_RNAENUM_IDENTIFIER)
|
||||
tmp = BLI_strdup(item->identifier);
|
||||
else if (type == BUT_GET_RNAENUM_LABEL)
|
||||
tmp = BLI_strdup(item->name);
|
||||
else if (item->description && item->description[0])
|
||||
tmp = BLI_strdup(item->description);
|
||||
if (item && item->identifier) {
|
||||
if (type == BUT_GET_RNAENUM_IDENTIFIER)
|
||||
tmp = BLI_strdup(item->identifier);
|
||||
else if (type == BUT_GET_RNAENUM_LABEL)
|
||||
tmp = BLI_strdup(item->name);
|
||||
else if (item->description && item->description[0])
|
||||
tmp = BLI_strdup(item->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == BUT_GET_OP_KEYMAP) {
|
||||
|
||||
@@ -978,7 +978,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
|
||||
short align = panel_aligned(sa, ar), dx = 0, dy = 0;
|
||||
|
||||
/* first clip for window, no dragging outside */
|
||||
if (!BLI_in_rcti(&ar->winrct, event->x, event->y))
|
||||
if (!BLI_in_rcti_v(&ar->winrct, &event->x))
|
||||
return;
|
||||
|
||||
dx = (event->x - data->startx) & ~(PNL_GRID - 1);
|
||||
|
||||
@@ -418,7 +418,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
||||
/* TODO: handles? */
|
||||
/* TODO: uw? */
|
||||
|
||||
if (BLI_in_rctf(&rectf, point_deform->bezt.vec[1][0], point_deform->bezt.vec[1][1])) {
|
||||
if (BLI_in_rctf_v(&rectf, point_deform->bezt.vec[1])) {
|
||||
BKE_mask_point_select_set(point, mode == GESTURE_MODAL_SELECT);
|
||||
BKE_mask_point_select_set_handle(point, mode == GESTURE_MODAL_SELECT);
|
||||
}
|
||||
|
||||
@@ -607,7 +607,7 @@ static void area_azone_initialize(ScrArea *sa)
|
||||
az->y1 = sa->totrct.ymin - 1;
|
||||
az->x2 = sa->totrct.xmin + (AZONESPOT - 1);
|
||||
az->y2 = sa->totrct.ymin + (AZONESPOT - 1);
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
|
||||
az = (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
|
||||
BLI_addtail(&(sa->actionzones), az);
|
||||
@@ -616,7 +616,7 @@ static void area_azone_initialize(ScrArea *sa)
|
||||
az->y1 = sa->totrct.ymax + 1;
|
||||
az->x2 = sa->totrct.xmax - (AZONESPOT - 1);
|
||||
az->y2 = sa->totrct.ymax - (AZONESPOT - 1);
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
}
|
||||
|
||||
#define AZONEPAD_EDGE 4
|
||||
@@ -650,7 +650,7 @@ static void region_azone_edge(AZone *az, ARegion *ar)
|
||||
break;
|
||||
}
|
||||
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
}
|
||||
|
||||
static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
|
||||
@@ -692,7 +692,7 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
|
||||
break;
|
||||
}
|
||||
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
|
||||
/* if more azones on 1 spot, set offset */
|
||||
for (azt = sa->actionzones.first; azt; azt = azt->next) {
|
||||
@@ -706,7 +706,7 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
|
||||
az->y1 -= AZONESPOT;
|
||||
az->y2 -= AZONESPOT;
|
||||
}
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -753,7 +753,7 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
|
||||
break;
|
||||
}
|
||||
/* rect needed for mouse pointer test */
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
}
|
||||
|
||||
|
||||
@@ -798,7 +798,7 @@ static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
|
||||
break;
|
||||
}
|
||||
/* rect needed for mouse pointer test */
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
}
|
||||
|
||||
#define AZONEPAD_TRIAW 16
|
||||
@@ -843,7 +843,7 @@ static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
|
||||
break;
|
||||
}
|
||||
/* rect needed for mouse pointer test */
|
||||
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
BLI_rcti_init(&az->rect, az->x1, az->x2, az->y1, az->y2);
|
||||
}
|
||||
|
||||
|
||||
@@ -911,7 +911,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
|
||||
return;
|
||||
|
||||
/* no returns in function, winrct gets set in the end again */
|
||||
BLI_init_rcti(&ar->winrct, 0, 0, 0, 0);
|
||||
BLI_rcti_init(&ar->winrct, 0, 0, 0, 0);
|
||||
|
||||
/* for test; allow split of previously defined region */
|
||||
if (ar->alignment & RGN_SPLIT_PREV)
|
||||
@@ -947,7 +947,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
|
||||
else if (alignment == RGN_ALIGN_NONE) {
|
||||
/* typically last region */
|
||||
ar->winrct = *remainder;
|
||||
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
||||
BLI_rcti_init(remainder, 0, 0, 0, 0);
|
||||
}
|
||||
else if (alignment == RGN_ALIGN_TOP || alignment == RGN_ALIGN_BOTTOM) {
|
||||
|
||||
@@ -1007,7 +1007,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
|
||||
remainder->xmin = ar->winrct.xmax + 1;
|
||||
}
|
||||
else {
|
||||
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
||||
BLI_rcti_init(remainder, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1016,7 +1016,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
|
||||
remainder->ymin = ar->winrct.ymax + 1;
|
||||
}
|
||||
else {
|
||||
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
||||
BLI_rcti_init(remainder, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1036,7 +1036,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
|
||||
|
||||
if (count != 4) {
|
||||
/* let's stop adding regions */
|
||||
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
||||
BLI_rcti_init(remainder, 0, 0, 0, 0);
|
||||
if (G.debug & G_DEBUG)
|
||||
printf("region quadsplit failed\n");
|
||||
}
|
||||
@@ -1058,7 +1058,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
|
||||
else { /* right top */
|
||||
ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax) / 2;
|
||||
ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax) / 2;
|
||||
BLI_init_rcti(remainder, 0, 0, 0, 0);
|
||||
BLI_rcti_init(remainder, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
quad++;
|
||||
|
||||
@@ -1219,7 +1219,7 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
|
||||
ScrArea *sa;
|
||||
|
||||
for (sa = win->screen->areabase.first; sa; sa = sa->next)
|
||||
if ((az = is_in_area_actionzone(sa, event->x, event->y)))
|
||||
if ((az = is_in_area_actionzone(sa, &event->x)))
|
||||
break;
|
||||
|
||||
if (sa) {
|
||||
@@ -1262,12 +1262,12 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
|
||||
for (sa = scr->areabase.first; sa; sa = sa->next) {
|
||||
if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
|
||||
if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
|
||||
if (NULL == is_in_area_actionzone(sa, event->x, event->y))
|
||||
if (NULL == is_in_area_actionzone(sa, &event->x))
|
||||
break;
|
||||
}
|
||||
if (sa) {
|
||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||
if (BLI_in_rcti(&ar->winrct, event->x, event->y))
|
||||
if (BLI_in_rcti_v(&ar->winrct, &event->x))
|
||||
scr->subwinactive = ar->swinid;
|
||||
}
|
||||
}
|
||||
@@ -1314,7 +1314,7 @@ int ED_screen_area_active(const bContext *C)
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
|
||||
if (win && sc && sa) {
|
||||
AZone *az = is_in_area_actionzone(sa, win->eventstate->x, win->eventstate->y);
|
||||
AZone *az = is_in_area_actionzone(sa, &win->eventstate->x);
|
||||
ARegion *ar;
|
||||
|
||||
if (az && az->type == AZONE_REGION)
|
||||
|
||||
@@ -54,7 +54,7 @@ void removenotused_scredges(bScreen *sc);
|
||||
int scredge_is_horizontal(ScrEdge *se);
|
||||
ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my);
|
||||
|
||||
struct AZone *is_in_area_actionzone(ScrArea *sa, int x, int y);
|
||||
struct AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2]);
|
||||
|
||||
/* screen_context.c */
|
||||
int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result);
|
||||
|
||||
@@ -525,15 +525,15 @@ static int actionzone_area_poll(bContext *C)
|
||||
return 0;
|
||||
}
|
||||
|
||||
AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
|
||||
AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2])
|
||||
{
|
||||
AZone *az = NULL;
|
||||
|
||||
for (az = sa->actionzones.first; az; az = az->next) {
|
||||
if (BLI_in_rcti(&az->rect, x, y)) {
|
||||
if (BLI_in_rcti_v(&az->rect, xy)) {
|
||||
if (az->type == AZONE_AREA) {
|
||||
/* no triangle intersect but a hotspot circle based on corner */
|
||||
int radius = (x - az->x1) * (x - az->x1) + (y - az->y1) * (y - az->y1);
|
||||
int radius = (xy[0] - az->x1) * (xy[0] - az->x1) + (xy[1] - az->y1) * (xy[1] - az->y1);
|
||||
|
||||
if (radius <= AZONESPOT * AZONESPOT)
|
||||
break;
|
||||
@@ -578,7 +578,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
|
||||
|
||||
static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
{
|
||||
AZone *az = is_in_area_actionzone(CTX_wm_area(C), event->x, event->y);
|
||||
AZone *az = is_in_area_actionzone(CTX_wm_area(C), &event->x);
|
||||
sActionzoneData *sad;
|
||||
|
||||
/* quick escape */
|
||||
|
||||
@@ -583,7 +583,7 @@ static int project_bucket_offset_safe(const ProjPaintState *ps, const float proj
|
||||
}
|
||||
|
||||
/* still use 2D X,Y space but this works for verts transformed by a perspective matrix, using their 4th component as a weight */
|
||||
static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4], float co[2], float w[3])
|
||||
static void barycentric_weights_v2_persp(const float v1[4], const float v2[4], const float v3[4], const float co[2], float w[3])
|
||||
{
|
||||
float wtot_inv, wtot;
|
||||
|
||||
@@ -603,13 +603,17 @@ static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4],
|
||||
w[0] = w[1] = w[2] = 1.0f / 3.0f;
|
||||
}
|
||||
|
||||
static float VecZDepthOrtho(float pt[2], float v1[3], float v2[3], float v3[3], float w[3])
|
||||
static float VecZDepthOrtho(const float pt[2],
|
||||
const float v1[3], const float v2[3], const float v3[3],
|
||||
float w[3])
|
||||
{
|
||||
barycentric_weights_v2(v1, v2, v3, pt, w);
|
||||
return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]);
|
||||
}
|
||||
|
||||
static float VecZDepthPersp(float pt[2], float v1[4], float v2[4], float v3[4], float w[3])
|
||||
static float VecZDepthPersp(const float pt[2],
|
||||
const float v1[4], const float v2[4], const float v3[4],
|
||||
float w[3])
|
||||
{
|
||||
float wtot_inv, wtot;
|
||||
float w_tmp[3];
|
||||
@@ -1611,7 +1615,7 @@ static int line_clip_rect2f(
|
||||
|
||||
|
||||
if (fabsf(l1[0] - l2[0]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
|
||||
if (BLI_in_rctf(rect, l1[0], l1[1])) {
|
||||
if (BLI_in_rctf_v(rect, l1)) {
|
||||
copy_v2_v2(l1_clip, l1);
|
||||
copy_v2_v2(l2_clip, l2);
|
||||
return 1;
|
||||
@@ -1639,7 +1643,7 @@ static int line_clip_rect2f(
|
||||
}
|
||||
|
||||
if (fabsf(l1[1] - l2[1]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
|
||||
if (BLI_in_rctf(rect, l1[0], l1[1])) {
|
||||
if (BLI_in_rctf_v(rect, l1)) {
|
||||
copy_v2_v2(l1_clip, l1);
|
||||
copy_v2_v2(l2_clip, l2);
|
||||
return 1;
|
||||
@@ -1663,12 +1667,12 @@ static int line_clip_rect2f(
|
||||
/* Done with vertical lines */
|
||||
|
||||
/* are either of the points inside the rectangle ? */
|
||||
if (BLI_in_rctf(rect, l1[0], l1[1])) {
|
||||
if (BLI_in_rctf_v(rect, l1)) {
|
||||
copy_v2_v2(l1_clip, l1);
|
||||
ok1 = 1;
|
||||
}
|
||||
|
||||
if (BLI_in_rctf(rect, l2[0], l2[1])) {
|
||||
if (BLI_in_rctf_v(rect, l2)) {
|
||||
copy_v2_v2(l2_clip, l2);
|
||||
ok2 = 1;
|
||||
}
|
||||
@@ -1816,7 +1820,7 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
|
||||
* this is even less work then an intersection test
|
||||
*/
|
||||
#if 0
|
||||
if (BLI_in_rctf(bucket_bounds, cent[0], cent[1]))
|
||||
if (BLI_in_rctf_v(bucket_bounds, cent))
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
@@ -1983,9 +1987,9 @@ static void project_bucket_clip_face(
|
||||
float bucket_bounds_ss[4][2];
|
||||
|
||||
/* get the UV space bounding box */
|
||||
inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v1coSS[0], v1coSS[1]);
|
||||
inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v2coSS[0], v2coSS[1]) << 1;
|
||||
inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v3coSS[0], v3coSS[1]) << 2;
|
||||
inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v1coSS);
|
||||
inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v2coSS) << 1;
|
||||
inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v3coSS) << 2;
|
||||
|
||||
if (inside_bucket_flag == ISECT_ALL3) {
|
||||
/* all screenspace points are inside the bucket bounding box, this means we don't need to clip and can simply return the UVs */
|
||||
@@ -2812,7 +2816,7 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
|
||||
fidx = mf->v4 ? 3 : 2;
|
||||
do {
|
||||
v = ps->screenCoords[(*(&mf->v1 + fidx))];
|
||||
if (BLI_in_rctf(&bucket_bounds, v[0], v[1])) {
|
||||
if (BLI_in_rctf_v(&bucket_bounds, v)) {
|
||||
return 1;
|
||||
}
|
||||
} while (fidx--);
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_rect.h"
|
||||
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_context.h"
|
||||
@@ -80,8 +81,7 @@ int paint_convert_bb_to_rect(rcti *rect,
|
||||
float projection_mat[4][4];
|
||||
int i, j, k;
|
||||
|
||||
rect->xmin = rect->ymin = INT_MAX;
|
||||
rect->xmax = rect->ymax = INT_MIN;
|
||||
BLI_rcti_init_minmax(rect);
|
||||
|
||||
/* return zero if the bounding box has non-positive volume */
|
||||
if (bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2])
|
||||
@@ -93,16 +93,19 @@ int paint_convert_bb_to_rect(rcti *rect,
|
||||
for (j = 0; j < 2; ++j) {
|
||||
for (k = 0; k < 2; ++k) {
|
||||
float vec[3], proj[2];
|
||||
int proj_i[2];
|
||||
vec[0] = i ? bb_min[0] : bb_max[0];
|
||||
vec[1] = j ? bb_min[1] : bb_max[1];
|
||||
vec[2] = k ? bb_min[2] : bb_max[2];
|
||||
/* convert corner to screen space */
|
||||
ED_view3d_project_float_v2(ar, vec, proj, projection_mat);
|
||||
/* expand 2D rectangle */
|
||||
rect->xmin = MIN2(rect->xmin, proj[0]);
|
||||
rect->xmax = MAX2(rect->xmax, proj[0]);
|
||||
rect->ymin = MIN2(rect->ymin, proj[1]);
|
||||
rect->ymax = MAX2(rect->ymax, proj[1]);
|
||||
|
||||
/* we could project directly to int? */
|
||||
proj_i[0] = proj[0];
|
||||
proj_i[1] = proj[1];
|
||||
|
||||
BLI_rcti_do_minmax_v(rect, proj_i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
#include "RNA_enum_types.h"
|
||||
|
||||
#include "UI_view2d.h"
|
||||
|
||||
@@ -239,12 +240,12 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
|
||||
strncpy(path, U.textudir, sizeof(path));
|
||||
}
|
||||
|
||||
if (RNA_struct_property_is_set(op->ptr, "files"))
|
||||
return open_exec(C, op);
|
||||
|
||||
if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
|
||||
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
|
||||
|
||||
if (RNA_struct_property_is_set(op->ptr, "filepath"))
|
||||
return open_exec(C, op);
|
||||
|
||||
open_init(C, op);
|
||||
|
||||
clip_filesel(C, op, path);
|
||||
@@ -1074,15 +1075,8 @@ static int mode_set_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceClip *sc = CTX_wm_space_clip(C);
|
||||
int mode = RNA_enum_get(op->ptr, "mode");
|
||||
int toggle = RNA_boolean_get(op->ptr, "toggle");
|
||||
|
||||
if (sc->mode == mode) {
|
||||
if (toggle)
|
||||
sc->mode = SC_MODE_TRACKING;
|
||||
}
|
||||
else {
|
||||
sc->mode = mode;
|
||||
}
|
||||
sc->mode = mode;
|
||||
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CLIP, NULL);
|
||||
|
||||
@@ -1091,13 +1085,6 @@ static int mode_set_exec(bContext *C, wmOperator *op)
|
||||
|
||||
void CLIP_OT_mode_set(wmOperatorType *ot)
|
||||
{
|
||||
static EnumPropertyItem mode_items[] = {
|
||||
{SC_MODE_TRACKING, "TRACKING", 0, "Tracking", "Show tracking and solving tools"},
|
||||
{SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", 0, "Reconstruction", "Show tracking/reconstruction tools"},
|
||||
{SC_MODE_DISTORTION, "DISTORTION", 0, "Distortion", "Show distortion tools"},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
|
||||
/* identifiers */
|
||||
ot->name = "Set Clip Mode";
|
||||
ot->description = "Set the clip interaction mode";
|
||||
@@ -1109,8 +1096,7 @@ void CLIP_OT_mode_set(wmOperatorType *ot)
|
||||
ot->poll = ED_space_clip_poll;
|
||||
|
||||
/* properties */
|
||||
RNA_def_enum(ot->srna, "mode", mode_items, SC_MODE_TRACKING, "Mode", "");
|
||||
RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "");
|
||||
RNA_def_enum(ot->srna, "mode", clip_editor_mode_items, SC_MODE_TRACKING, "Mode", "");
|
||||
}
|
||||
|
||||
/********************** macroses *********************/
|
||||
|
||||
@@ -565,13 +565,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
|
||||
RNA_boolean_set(kmi->ptr, "sequence", TRUE);
|
||||
|
||||
/* mode */
|
||||
kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", SC_MODE_RECONSTRUCTION);
|
||||
RNA_boolean_set(kmi->ptr, "toggle", TRUE);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_enum_set(kmi->ptr, "mode", SC_MODE_DISTORTION);
|
||||
RNA_boolean_set(kmi->ptr, "toggle", TRUE);
|
||||
WM_keymap_add_menu(keymap, "CLIP_MT_select_mode", TABKEY, KM_PRESS, 0, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "CLIP_OT_solve_camera", SKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
@@ -798,8 +792,16 @@ static int clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(eve
|
||||
|
||||
static void clip_drop_copy(wmDrag *drag, wmDropBox *drop)
|
||||
{
|
||||
/* copy drag path to properties */
|
||||
RNA_string_set(drop->ptr, "filepath", drag->path);
|
||||
PointerRNA itemptr;
|
||||
char dir[FILE_MAX], file[FILE_MAX];
|
||||
|
||||
BLI_split_dirfile(drag->path, dir, file, sizeof(dir), sizeof(file));
|
||||
|
||||
RNA_string_set(drop->ptr, "directory", dir);
|
||||
|
||||
RNA_collection_clear(drop->ptr, "files");
|
||||
RNA_collection_add(drop->ptr, "files", &itemptr);
|
||||
RNA_string_set(&itemptr, "name", file);
|
||||
}
|
||||
|
||||
/* area+region dropbox definition */
|
||||
|
||||
@@ -361,7 +361,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
||||
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
|
||||
|
||||
if (MARKER_VISIBLE(sc, track, marker)) {
|
||||
if (BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
|
||||
if (BLI_in_rctf_v(&rectf, marker->pos)) {
|
||||
if (mode == GESTURE_MODAL_SELECT)
|
||||
BKE_tracking_track_flag_set(track, TRACK_AREA_ALL, SELECT);
|
||||
else
|
||||
|
||||
@@ -81,7 +81,7 @@ static FileSelection find_file_mouse_rect(SpaceFile *sfile, struct ARegion *ar,
|
||||
UI_view2d_region_to_view(v2d, rect->xmin, rect->ymin, &fxmin, &fymin);
|
||||
UI_view2d_region_to_view(v2d, rect->xmax, rect->ymax, &fxmax, &fymax);
|
||||
|
||||
BLI_init_rcti(&rect_view, (int)(v2d->tot.xmin + fxmin), (int)(v2d->tot.xmin + fxmax), (int)(v2d->tot.ymax - fymin), (int)(v2d->tot.ymax - fymax));
|
||||
BLI_rcti_init(&rect_view, (int)(v2d->tot.xmin + fxmin), (int)(v2d->tot.xmin + fxmax), (int)(v2d->tot.ymax - fymin), (int)(v2d->tot.ymax - fymax));
|
||||
|
||||
sel = ED_fileselect_layout_offset_rect(sfile->layout, &rect_view);
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
|
||||
|
||||
/* while dragging we need to update the rects, otherwise it doesn't end with correct one */
|
||||
|
||||
BLI_init_rctf(&dispf, 15.0f, (block->maxx - block->minx) - 15.0f, 15.0f, (block->maxy - block->miny) - 15.0f);
|
||||
BLI_rctf_init(&dispf, 15.0f, (block->maxx - block->minx) - 15.0f, 15.0f, (block->maxy - block->miny) - 15.0f);
|
||||
ui_graphics_to_window_rct(sa->win, &dispf, disprect);
|
||||
|
||||
/* correction for gla draw */
|
||||
|
||||
@@ -2928,8 +2928,11 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
// if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
|
||||
if (!RNA_string_length(op->ptr, "text")) {
|
||||
/* if alt/ctrl/super are pressed pass through */
|
||||
if (event->ctrl || event->oskey) {
|
||||
/* if alt/ctrl/super are pressed pass through except for utf8 character event
|
||||
* (when input method are used for utf8 inputs, the user may assign key event
|
||||
* including alt/ctrl/super like ctrl+m to commit utf8 string. in such case,
|
||||
* the modifiers in the utf8 character event make no sense.) */
|
||||
if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -640,7 +640,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
|
||||
short matnr = mp->mat_nr;
|
||||
int mf_smooth = mp->flag & ME_SMOOTH;
|
||||
Material *mat = me->mat[matnr];
|
||||
int mode = mat->game.flag;
|
||||
int mode = mat ? mat->game.flag : GEMAT_INVISIBLE;
|
||||
|
||||
if (!(mode & GEMAT_INVISIBLE) && (mode & GEMAT_TEXT) && mp->totloop >= 3) {
|
||||
/* get the polygon as a tri/quad */
|
||||
|
||||
@@ -758,7 +758,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
|
||||
|
||||
bNode *node;
|
||||
rcti rect;
|
||||
short node_cent[2];
|
||||
int node_cent[2];
|
||||
float node_centf[2];
|
||||
|
||||
BLI_lasso_boundbox(&rect, mcords, moves);
|
||||
@@ -770,7 +770,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
|
||||
node_centf[1] = (node->totr.ymin + node->totr.ymax) / 2;
|
||||
|
||||
ipoco_to_areaco_noclip(G.v2d, node_centf, node_cent);
|
||||
if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
|
||||
if (BLI_in_rcti_v(&rect, node_cent) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
|
||||
if (select) {
|
||||
node->flag |= SELECT;
|
||||
}
|
||||
@@ -1130,19 +1130,19 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff
|
||||
short a, hits15, hits9 = 0, hits5 = 0;
|
||||
short has_bones15 = 0, has_bones9 = 0, has_bones5 = 0;
|
||||
|
||||
BLI_init_rcti(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14);
|
||||
BLI_rcti_init(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14);
|
||||
hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
|
||||
if (hits15 > 0) {
|
||||
for (a = 0; a < hits15; a++) if (buffer[4 * a + 3] & 0xFFFF0000) has_bones15 = 1;
|
||||
|
||||
offs = 4 * hits15;
|
||||
BLI_init_rcti(&rect, mval[0] - 9, mval[0] + 9, mval[1] - 9, mval[1] + 9);
|
||||
BLI_rcti_init(&rect, mval[0] - 9, mval[0] + 9, mval[1] - 9, mval[1] + 9);
|
||||
hits9 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect);
|
||||
if (hits9 > 0) {
|
||||
for (a = 0; a < hits9; a++) if (buffer[offs + 4 * a + 3] & 0xFFFF0000) has_bones9 = 1;
|
||||
|
||||
offs += 4 * hits9;
|
||||
BLI_init_rcti(&rect, mval[0] - 5, mval[0] + 5, mval[1] - 5, mval[1] + 5);
|
||||
BLI_rcti_init(&rect, mval[0] - 5, mval[0] + 5, mval[1] - 5, mval[1] + 5);
|
||||
hits5 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect);
|
||||
if (hits5 > 0) {
|
||||
for (a = 0; a < hits5; a++) if (buffer[offs + 4 * a + 3] & 0xFFFF0000) has_bones5 = 1;
|
||||
|
||||
@@ -2479,7 +2479,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
||||
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
|
||||
if (uvedit_face_visible_test(scene, ima, efa, tf)) {
|
||||
uv_poly_center(em, efa, cent);
|
||||
if (BLI_in_rctf(&rectf, cent[0], cent[1])) {
|
||||
if (BLI_in_rctf_v(&rectf, cent)) {
|
||||
BM_elem_flag_enable(efa, BM_ELEM_TAG);
|
||||
change = 1;
|
||||
}
|
||||
@@ -2504,15 +2504,13 @@ static int border_select_exec(bContext *C, wmOperator *op)
|
||||
if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) {
|
||||
|
||||
/* UV_SYNC_SELECTION - can't do pinned selection */
|
||||
if (BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1])) {
|
||||
if (BLI_in_rctf_v(&rectf, luv->uv)) {
|
||||
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
|
||||
else uvedit_uv_select_disable(em, scene, l);
|
||||
}
|
||||
}
|
||||
else if (pinned) {
|
||||
if ((luv->flag & MLOOPUV_PINNED) &&
|
||||
BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1]))
|
||||
{
|
||||
if ((luv->flag & MLOOPUV_PINNED) && BLI_in_rctf_v(&rectf, luv->uv)) {
|
||||
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
|
||||
else uvedit_uv_select_disable(em, scene, l);
|
||||
}
|
||||
@@ -2685,7 +2683,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh
|
||||
float cent[2];
|
||||
uv_poly_center(em, efa, cent);
|
||||
UI_view2d_view_to_region(&ar->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]);
|
||||
if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) &&
|
||||
if (BLI_in_rcti_v(&rect, screen_uv) &&
|
||||
BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
|
||||
{
|
||||
uvedit_face_select_enable(scene, em, efa, FALSE);
|
||||
@@ -2702,7 +2700,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh
|
||||
if ((select) != (uvedit_uv_select_test(em, scene, l))) {
|
||||
MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
|
||||
UI_view2d_view_to_region(&ar->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]);
|
||||
if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) &&
|
||||
if (BLI_in_rcti_v(&rect, screen_uv) &&
|
||||
BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
|
||||
{
|
||||
if (select) {
|
||||
|
||||
@@ -1618,7 +1618,7 @@ static void execute_scene(Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, fl
|
||||
timestep = sts / 1000.0;
|
||||
}
|
||||
}
|
||||
// don't cache if we are reiterating because we don't want to distroy the cache unnecessarily
|
||||
// don't cache if we are reiterating because we don't want to destroy the cache unnecessarily
|
||||
ikscene->scene->update(timestamp, timestep, numstep, false, !reiterate, simulation);
|
||||
if (reiterate) {
|
||||
// how many times do we reiterate?
|
||||
|
||||
@@ -127,6 +127,8 @@ extern EnumPropertyItem ramp_blend_items[];
|
||||
|
||||
extern EnumPropertyItem prop_dynamicpaint_type_items[];
|
||||
|
||||
extern EnumPropertyItem clip_editor_mode_items[];
|
||||
|
||||
struct bContext;
|
||||
struct PointerRNA;
|
||||
struct PropertyRNA;
|
||||
|
||||
@@ -118,6 +118,15 @@ EnumPropertyItem viewport_shade_items[] = {
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
EnumPropertyItem clip_editor_mode_items[] = {
|
||||
{SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
|
||||
{SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
|
||||
"Show tracking/reconstruction tools"},
|
||||
{SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
|
||||
{SC_MODE_MASKEDIT, "MASKEDIT", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
#include "DNA_anim_types.h"
|
||||
@@ -3027,15 +3036,6 @@ static void rna_def_space_clip(BlenderRNA *brna)
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem mode_items[] = {
|
||||
{SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
|
||||
{SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
|
||||
"Show tracking/reconstruction tools"},
|
||||
{SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
|
||||
{SC_MODE_MASKEDIT, "MASKEDIT", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
static EnumPropertyItem view_items[] = {
|
||||
{SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"},
|
||||
{SC_VIEW_GRAPH, "GRAPH", ICON_IPO, "Graph", "Show graph view for active element"},
|
||||
@@ -3102,7 +3102,7 @@ static void rna_def_space_clip(BlenderRNA *brna)
|
||||
/* mode */
|
||||
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "mode");
|
||||
RNA_def_property_enum_items(prop, mode_items);
|
||||
RNA_def_property_enum_items(prop, clip_editor_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_clip_mode_update");
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ typedef enum {
|
||||
CAP_START = 1,
|
||||
CAP_END = 2,
|
||||
SEAM_FRAME = 4,
|
||||
ROOT = 8
|
||||
} SkinNodeFlag;
|
||||
|
||||
typedef struct Frame {
|
||||
@@ -502,6 +503,9 @@ static void end_node_frames(int v, SkinNode *skin_nodes, const MVert *mvert,
|
||||
/* End frame */
|
||||
create_frame(&skin_nodes[v].frames[0], mvert[v].co, rad, mat, 0);
|
||||
}
|
||||
|
||||
if (nodes[v].flag & MVERT_SKIN_ROOT)
|
||||
skin_nodes[v].flag |= ROOT;
|
||||
}
|
||||
|
||||
/* Returns 1 for seam, 0 otherwise */
|
||||
@@ -1493,18 +1497,27 @@ static void skin_output_end_nodes(SkinOutput *so, SkinNode *skin_nodes,
|
||||
}
|
||||
|
||||
if (sn->flag & CAP_START) {
|
||||
add_poly(so,
|
||||
sn->frames[0].verts[3],
|
||||
sn->frames[0].verts[2],
|
||||
sn->frames[0].verts[1],
|
||||
sn->frames[0].verts[0]);
|
||||
if (sn->flag & ROOT) {
|
||||
add_poly(so,
|
||||
sn->frames[0].verts[0],
|
||||
sn->frames[0].verts[1],
|
||||
sn->frames[0].verts[2],
|
||||
sn->frames[0].verts[3]);
|
||||
}
|
||||
else {
|
||||
add_poly(so,
|
||||
sn->frames[0].verts[3],
|
||||
sn->frames[0].verts[2],
|
||||
sn->frames[0].verts[1],
|
||||
sn->frames[0].verts[0]);
|
||||
}
|
||||
}
|
||||
if (sn->flag & CAP_END) {
|
||||
add_poly(so,
|
||||
sn->frames[1].verts[3],
|
||||
sn->frames[1].verts[2],
|
||||
sn->frames[1].verts[0],
|
||||
sn->frames[1].verts[1],
|
||||
sn->frames[1].verts[0]);
|
||||
sn->frames[1].verts[2],
|
||||
sn->frames[1].verts[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1824,7 +1824,7 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
|
||||
|
||||
if ((samp->facenr!=face->facenr || samp->obi!=face->obi) && samp->shadfac) {
|
||||
if (face->box.zmin < samp->zco[2]) {
|
||||
if (BLI_in_rctf((rctf *)&face->box, samp->zco[0], samp->zco[1])) {
|
||||
if (BLI_in_rctf_v((rctf *)&face->box, samp->zco)) {
|
||||
int inshadow= 0;
|
||||
|
||||
if (face->type) {
|
||||
|
||||
@@ -919,7 +919,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
|
||||
if (ar && ar->regiontype == RGN_TYPE_WINDOW && event &&
|
||||
BLI_in_rcti(&ar->winrct, event->x, event->y))
|
||||
BLI_in_rcti_v(&ar->winrct, &event->x))
|
||||
{
|
||||
winrect = &ar->winrct;
|
||||
}
|
||||
@@ -1638,17 +1638,17 @@ static int handler_boundbox_test(wmEventHandler *handler, wmEvent *event)
|
||||
rcti rect = *handler->bblocal;
|
||||
BLI_translate_rcti(&rect, handler->bbwin->xmin, handler->bbwin->ymin);
|
||||
|
||||
if (BLI_in_rcti(&rect, event->x, event->y))
|
||||
if (BLI_in_rcti_v(&rect, &event->x))
|
||||
return 1;
|
||||
else if (event->type == MOUSEMOVE && BLI_in_rcti(&rect, event->prevx, event->prevy))
|
||||
else if (event->type == MOUSEMOVE && BLI_in_rcti_v(&rect, &event->prevx))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (BLI_in_rcti(handler->bbwin, event->x, event->y))
|
||||
if (BLI_in_rcti_v(handler->bbwin, &event->x))
|
||||
return 1;
|
||||
else if (event->type == MOUSEMOVE && BLI_in_rcti(handler->bbwin, event->prevx, event->prevy))
|
||||
else if (event->type == MOUSEMOVE && BLI_in_rcti_v(handler->bbwin, &event->prevx))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
@@ -1826,10 +1826,10 @@ static int wm_event_inside_i(wmEvent *event, rcti *rect)
|
||||
{
|
||||
if (wm_event_always_pass(event))
|
||||
return 1;
|
||||
if (BLI_in_rcti(rect, event->x, event->y))
|
||||
if (BLI_in_rcti_v(rect, &event->x))
|
||||
return 1;
|
||||
if (event->type == MOUSEMOVE) {
|
||||
if (BLI_in_rcti(rect, event->prevx, event->prevy)) {
|
||||
if (BLI_in_rcti_v(rect, &event->prevx)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -1837,19 +1837,19 @@ static int wm_event_inside_i(wmEvent *event, rcti *rect)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ScrArea *area_event_inside(bContext *C, int x, int y)
|
||||
static ScrArea *area_event_inside(bContext *C, const int xy[2])
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
ScrArea *sa;
|
||||
|
||||
if (screen)
|
||||
for (sa = screen->areabase.first; sa; sa = sa->next)
|
||||
if (BLI_in_rcti(&sa->totrct, x, y))
|
||||
if (BLI_in_rcti_v(&sa->totrct, xy))
|
||||
return sa;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ARegion *region_event_inside(bContext *C, int x, int y)
|
||||
static ARegion *region_event_inside(bContext *C, const int xy[2])
|
||||
{
|
||||
bScreen *screen = CTX_wm_screen(C);
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
@@ -1857,7 +1857,7 @@ static ARegion *region_event_inside(bContext *C, int x, int y)
|
||||
|
||||
if (screen && area)
|
||||
for (ar = area->regionbase.first; ar; ar = ar->next)
|
||||
if (BLI_in_rcti(&ar->winrct, x, y))
|
||||
if (BLI_in_rcti_v(&ar->winrct, xy))
|
||||
return ar;
|
||||
return NULL;
|
||||
}
|
||||
@@ -1888,11 +1888,11 @@ static void wm_paintcursor_test(bContext *C, wmEvent *event)
|
||||
wm_paintcursor_tag(C, wm->paintcursors.first, ar);
|
||||
|
||||
/* if previous position was not in current region, we have to set a temp new context */
|
||||
if (ar == NULL || !BLI_in_rcti(&ar->winrct, event->prevx, event->prevy)) {
|
||||
if (ar == NULL || !BLI_in_rcti_v(&ar->winrct, &event->prevx)) {
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
|
||||
CTX_wm_area_set(C, area_event_inside(C, event->prevx, event->prevy));
|
||||
CTX_wm_region_set(C, region_event_inside(C, event->prevx, event->prevy));
|
||||
CTX_wm_area_set(C, area_event_inside(C, &event->prevx));
|
||||
CTX_wm_region_set(C, region_event_inside(C, &event->prevx));
|
||||
|
||||
wm_paintcursor_tag(C, wm->paintcursors.first, CTX_wm_region(C));
|
||||
|
||||
@@ -2000,8 +2000,8 @@ void wm_event_do_handlers(bContext *C)
|
||||
CTX_wm_window_set(C, win);
|
||||
|
||||
/* we let modal handlers get active area/region, also wm_paintcursor_test needs it */
|
||||
CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
|
||||
CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
|
||||
CTX_wm_area_set(C, area_event_inside(C, &event->x));
|
||||
CTX_wm_region_set(C, region_event_inside(C, &event->x));
|
||||
|
||||
/* MVC demands to not draw in event handlers... but we need to leave it for ogl selecting etc */
|
||||
wm_window_make_drawable(C, win);
|
||||
@@ -2061,7 +2061,7 @@ void wm_event_do_handlers(bContext *C)
|
||||
if (CTX_wm_window(C) == NULL)
|
||||
return;
|
||||
|
||||
doit |= (BLI_in_rcti(&ar->winrct, event->x, event->y));
|
||||
doit |= (BLI_in_rcti_v(&ar->winrct, &event->x));
|
||||
|
||||
if (action & WM_HANDLER_BREAK)
|
||||
break;
|
||||
@@ -2083,8 +2083,8 @@ void wm_event_do_handlers(bContext *C)
|
||||
|
||||
if ((action & WM_HANDLER_BREAK) == 0) {
|
||||
/* also some non-modal handlers need active area/region */
|
||||
CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
|
||||
CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
|
||||
CTX_wm_area_set(C, area_event_inside(C, &event->x));
|
||||
CTX_wm_region_set(C, region_event_inside(C, &event->x));
|
||||
|
||||
wm_region_mouse_co(C, event);
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ static void draw_filled_lasso(wmGesture *gt)
|
||||
|
||||
/* highly unlikely this will fail, but could crash if (gt->points == 0) */
|
||||
if (sf_vert_first) {
|
||||
float zvec[3] = {0.0f, 0.0f, 1.0f};
|
||||
const float zvec[3] = {0.0f, 0.0f, 1.0f};
|
||||
BLI_scanfill_edge_add(&sf_ctx, sf_vert_first, sf_vert);
|
||||
BLI_scanfill_calc_ex(&sf_ctx, FALSE, zvec);
|
||||
|
||||
|
||||
@@ -1336,7 +1336,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
|
||||
uiItemL(col, "Links", ICON_NONE);
|
||||
uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment");
|
||||
uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits");
|
||||
uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-263");
|
||||
uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-264");
|
||||
uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.6/Manual");
|
||||
uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org");
|
||||
uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community");
|
||||
|
||||
Reference in New Issue
Block a user