svn merge ^/trunk/blender -r42466:42495
This commit is contained in:
6
extern/libmv/libmv-capi.cpp
vendored
6
extern/libmv/libmv-capi.cpp
vendored
@@ -111,12 +111,13 @@ void libmv_setLoggingVerbosity(int verbosity)
|
||||
|
||||
/* ************ RegionTracker ************ */
|
||||
|
||||
libmv_RegionTracker *libmv_pyramidRegionTrackerNew(int max_iterations, int pyramid_level, int half_window_size)
|
||||
libmv_RegionTracker *libmv_pyramidRegionTrackerNew(int max_iterations, int pyramid_level, int half_window_size, double minimum_correlation)
|
||||
{
|
||||
libmv::EsmRegionTracker *esm_region_tracker = new libmv::EsmRegionTracker;
|
||||
esm_region_tracker->half_window_size = half_window_size;
|
||||
esm_region_tracker->max_iterations = max_iterations;
|
||||
esm_region_tracker->min_determinant = 1e-4;
|
||||
esm_region_tracker->minimum_correlation = minimum_correlation;
|
||||
|
||||
libmv::PyramidRegionTracker *pyramid_region_tracker =
|
||||
new libmv::PyramidRegionTracker(esm_region_tracker, pyramid_level);
|
||||
@@ -124,12 +125,13 @@ libmv_RegionTracker *libmv_pyramidRegionTrackerNew(int max_iterations, int pyram
|
||||
return (libmv_RegionTracker *)pyramid_region_tracker;
|
||||
}
|
||||
|
||||
libmv_RegionTracker *libmv_hybridRegionTrackerNew(int max_iterations, int half_window_size)
|
||||
libmv_RegionTracker *libmv_hybridRegionTrackerNew(int max_iterations, int half_window_size, double minimum_correlation)
|
||||
{
|
||||
libmv::EsmRegionTracker *esm_region_tracker = new libmv::EsmRegionTracker;
|
||||
esm_region_tracker->half_window_size = half_window_size;
|
||||
esm_region_tracker->max_iterations = max_iterations;
|
||||
esm_region_tracker->min_determinant = 1e-4;
|
||||
esm_region_tracker->minimum_correlation = minimum_correlation;
|
||||
|
||||
libmv::BruteRegionTracker *brute_region_tracker = new libmv::BruteRegionTracker;
|
||||
brute_region_tracker->half_window_size = half_window_size;
|
||||
|
||||
4
extern/libmv/libmv-capi.h
vendored
4
extern/libmv/libmv-capi.h
vendored
@@ -43,8 +43,8 @@ void libmv_startDebugLogging(void);
|
||||
void libmv_setLoggingVerbosity(int verbosity);
|
||||
|
||||
/* RegionTracker */
|
||||
struct libmv_RegionTracker *libmv_pyramidRegionTrackerNew(int max_iterations, int pyramid_level, int half_window_size);
|
||||
struct libmv_RegionTracker *libmv_hybridRegionTrackerNew(int max_iterations, int half_window_size);
|
||||
struct libmv_RegionTracker *libmv_pyramidRegionTrackerNew(int max_iterations, int pyramid_level, int half_window_size, double minimum_correlation);
|
||||
struct libmv_RegionTracker *libmv_hybridRegionTrackerNew(int max_iterations, int half_window_size, double minimum_correlation);
|
||||
int libmv_regionTrackerTrack(struct libmv_RegionTracker *libmv_tracker, const float *ima1, const float *ima2,
|
||||
int width, int height, double x1, double y1, double *x2, double *y2);
|
||||
void libmv_regionTrackerDestroy(struct libmv_RegionTracker *libmv_tracker);
|
||||
|
||||
@@ -273,10 +273,30 @@ bool EsmRegionTracker::Track(const FloatImage &image1,
|
||||
|
||||
// If the step was accepted, then check for termination.
|
||||
if (d.squaredNorm() < min_update_squared_distance) {
|
||||
if (new_error > reasonable_error) {
|
||||
LG << "Update size shrank but reasonable error ("
|
||||
<< reasonable_error << ") not achieved; failing.";
|
||||
return true; // XXX
|
||||
// Compute the Pearson product-moment correlation coefficient to check
|
||||
// for sanity.
|
||||
// TODO(keir): Put this somewhere smarter.
|
||||
double sX=0,sY=0,sXX=0,sYY=0,sXY=0;
|
||||
for (int r = 0; r < width; ++r) {
|
||||
for (int c = 0; c < width; ++c) {
|
||||
double x = image_and_gradient1_sampled(r, c, 0);
|
||||
double y = image_and_gradient2_sampled[new_image](r, c, 0);
|
||||
sX += x;
|
||||
sY += y;
|
||||
sXX += x*x;
|
||||
sYY += y*y;
|
||||
sXY += x*y;
|
||||
}
|
||||
}
|
||||
double N = width*width;
|
||||
sX /= N, sY /= N, sXX /= N, sYY /= N, sXY /= N;
|
||||
double correlation = (sXY-sX*sY)/sqrt(double((sXX-sX*sX)*(sYY-sY*sY)));
|
||||
LG << "Final correlation: " << correlation;
|
||||
|
||||
if (correlation < minimum_correlation) {
|
||||
LG << "Correlation " << correlation << " greater than "
|
||||
<< minimum_correlation << "; bailing.";
|
||||
return false;
|
||||
}
|
||||
LG << "Successful track in " << (i + 1) << " iterations.";
|
||||
return true;
|
||||
|
||||
@@ -38,7 +38,8 @@ struct EsmRegionTracker : public RegionTracker {
|
||||
max_iterations(16),
|
||||
min_determinant(1e-6),
|
||||
min_update_squared_distance(1e-4),
|
||||
sigma(0.9) {}
|
||||
sigma(0.9),
|
||||
minimum_correlation(0.78) {}
|
||||
|
||||
virtual ~EsmRegionTracker() {}
|
||||
|
||||
@@ -54,6 +55,7 @@ struct EsmRegionTracker : public RegionTracker {
|
||||
double min_determinant;
|
||||
double min_update_squared_distance;
|
||||
double sigma;
|
||||
double minimum_correlation;
|
||||
};
|
||||
|
||||
} // namespace libmv
|
||||
|
||||
@@ -129,7 +129,7 @@ include_directories(${INC})
|
||||
add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_SVM_HEADERS})
|
||||
|
||||
if(WITH_CYCLES_OPTIMIZED_KERNEL)
|
||||
SET_SOURCE_FILES_PROPERTIES(kernel_optimized.cpp PROPERTIES COMPILE_FLAGS ${CYCLES_OPTIMIZED_KERNEL_FLAGS})
|
||||
set_source_files_properties(kernel_optimized.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_OPTIMIZED_KERNEL_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_CUDA)
|
||||
|
||||
11
release/scripts/presets/tracking_settings/blurry_footage.py
Normal file
11
release/scripts/presets/tracking_settings/blurry_footage.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import bpy
|
||||
settings = bpy.context.edit_movieclip.tracking.settings
|
||||
|
||||
settings.default_tracker = 'Hybrid'
|
||||
settings.default_pyramid_levels = 2
|
||||
settings.default_correlation_min = 0.75
|
||||
settings.default_pattern_size = 21
|
||||
settings.default_search_size = 100
|
||||
settings.default_frames_limit = 0
|
||||
settings.default_pattern_match = 'PREV_FRAME'
|
||||
settings.default_margin = 0
|
||||
@@ -1,11 +0,0 @@
|
||||
import bpy
|
||||
settings = bpy.context.edit_movieclip.tracking.settings
|
||||
|
||||
settings.default_tracker = 'KLT'
|
||||
settings.default_pyramid_levels = 4
|
||||
settings.default_correlation_min = 0.75
|
||||
settings.default_pattern_size = 11
|
||||
settings.default_search_size = 202
|
||||
settings.default_frames_limit = 25
|
||||
settings.default_pattern_match = 'KEYFRAME'
|
||||
settings.default_margin = 0
|
||||
@@ -1,11 +1,11 @@
|
||||
import bpy
|
||||
settings = bpy.context.edit_movieclip.tracking.settings
|
||||
|
||||
settings.default_tracker = 'KLT'
|
||||
settings.default_tracker = 'Hybrid'
|
||||
settings.default_pyramid_levels = 2
|
||||
settings.default_correlation_min = 0.75
|
||||
settings.default_pattern_size = 11
|
||||
settings.default_search_size = 51
|
||||
settings.default_search_size = 61
|
||||
settings.default_frames_limit = 0
|
||||
settings.default_pattern_match = 'KEYFRAME'
|
||||
settings.default_margin = 0
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import bpy
|
||||
settings = bpy.context.edit_movieclip.tracking.settings
|
||||
|
||||
settings.default_tracker = 'KLT'
|
||||
settings.default_tracker = 'Hybrid'
|
||||
settings.default_pyramid_levels = 2
|
||||
settings.default_correlation_min = 0.75
|
||||
settings.default_pattern_size = 11
|
||||
settings.default_search_size = 121
|
||||
settings.default_correlation_min = 0.7
|
||||
settings.default_pattern_size = 31
|
||||
settings.default_search_size = 300
|
||||
settings.default_frames_limit = 0
|
||||
settings.default_pattern_match = 'KEYFRAME'
|
||||
settings.default_margin = 0
|
||||
settings.default_pattern_match = 'PREV_FRAME'
|
||||
settings.default_margin = 5
|
||||
|
||||
@@ -129,8 +129,7 @@ class CLIP_PT_tools_marker(Panel):
|
||||
|
||||
if settings.default_tracker == 'KLT':
|
||||
col.prop(settings, "default_pyramid_levels")
|
||||
elif settings.default_tracker == 'SAD':
|
||||
col.prop(settings, "default_correlation_min")
|
||||
col.prop(settings, "default_correlation_min")
|
||||
|
||||
col.separator()
|
||||
|
||||
@@ -497,8 +496,7 @@ class CLIP_PT_track_settings(Panel):
|
||||
|
||||
if active.tracker == 'KLT':
|
||||
col.prop(active, "pyramid_levels")
|
||||
elif active.tracker == 'SAD':
|
||||
col.prop(active, "correlation_min")
|
||||
col.prop(active, "correlation_min")
|
||||
|
||||
col.separator()
|
||||
col.prop(active, "frames_limit")
|
||||
|
||||
@@ -889,6 +889,8 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
|
||||
sub.label(text="NDOF Device:")
|
||||
sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity")
|
||||
|
||||
col.prop(inputs, "tweak_threshold")
|
||||
|
||||
row.separator()
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
@@ -255,7 +255,7 @@ class VIEW3D_MT_uv_map(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_context = 'EXEC_DEFAULT'
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator("uv.cube_project")
|
||||
layout.operator("uv.cylinder_project")
|
||||
layout.operator("uv.sphere_project")
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_tessmesh.h"
|
||||
#include "BKE_bvhutils.h"
|
||||
#include "BKE_deform.h"
|
||||
|
||||
#ifdef WITH_GAMEENGINE
|
||||
#include "BKE_navmesh_conversion.h"
|
||||
@@ -866,40 +867,51 @@ void weight_to_rgb(float r_rgb[3], const float weight)
|
||||
r_rgb[1]= blend * (1.0f-((weight-0.75f)*4.0f));
|
||||
r_rgb[2]= 0.0f;
|
||||
}
|
||||
else {
|
||||
/* exceptional value, unclamped or nan,
|
||||
* avoid uninitialized memory use */
|
||||
r_rgb[0]= 1.0f;
|
||||
r_rgb[1]= 0.0f;
|
||||
r_rgb[2]= 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* draw_flag's for calc_weightpaint_vert_color */
|
||||
enum {
|
||||
CALC_WP_MULTIPAINT= (1<<0),
|
||||
CALC_WP_AUTO_NORMALIZE= (1<<1),
|
||||
CALC_WP_AUTO_NORMALIZE= (1<<1)
|
||||
};
|
||||
|
||||
static void calc_weightpaint_vert_color(Object *ob, ColorBand *coba, int vert, unsigned char *col, char *dg_flags, int selected, int UNUSED(unselected), const int draw_flag)
|
||||
static void calc_weightpaint_vert_color(
|
||||
Object *ob, ColorBand *coba, int vert, unsigned char *col,
|
||||
const char *dg_flags, int selected, int UNUSED(unselected), const int draw_flag)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
float colf[4], input = 0.0f;
|
||||
int i;
|
||||
|
||||
float input = 0.0f;
|
||||
|
||||
int make_black= FALSE;
|
||||
|
||||
if (me->dvert) {
|
||||
MDeformVert *dvert= &me->dvert[vert];
|
||||
|
||||
if ((selected > 1) && (draw_flag & CALC_WP_MULTIPAINT)) {
|
||||
|
||||
int was_a_nonzero= FALSE;
|
||||
for (i=0; i<me->dvert[vert].totweight; i++) {
|
||||
int i;
|
||||
|
||||
MDeformWeight *dw= dvert->dw;
|
||||
for (i = dvert->totweight; i > 0; i--, dw++) {
|
||||
/* in multipaint, get the average if auto normalize is inactive
|
||||
* get the sum if it is active */
|
||||
if(dg_flags[me->dvert[vert].dw[i].def_nr]) {
|
||||
if(me->dvert[vert].dw[i].weight) {
|
||||
input+= me->dvert[vert].dw[i].weight;
|
||||
if (dg_flags[dw->def_nr]) {
|
||||
if (dw->weight) {
|
||||
input += dw->weight;
|
||||
was_a_nonzero= TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* make it black if the selected groups have no weight on a vertex */
|
||||
if(was_a_nonzero == FALSE) {
|
||||
if (was_a_nonzero == FALSE) {
|
||||
make_black = TRUE;
|
||||
}
|
||||
else if ((draw_flag & CALC_WP_AUTO_NORMALIZE) == FALSE) {
|
||||
@@ -908,11 +920,7 @@ static void calc_weightpaint_vert_color(Object *ob, ColorBand *coba, int vert, u
|
||||
}
|
||||
else {
|
||||
/* default, non tricky behavior */
|
||||
for (i=0; i<me->dvert[vert].totweight; i++) {
|
||||
if (me->dvert[vert].dw[i].def_nr==ob->actdef-1) {
|
||||
input+=me->dvert[vert].dw[i].weight;
|
||||
}
|
||||
}
|
||||
input= defvert_find_weight(dvert, ob->actdef-1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,20 +929,19 @@ static void calc_weightpaint_vert_color(Object *ob, ColorBand *coba, int vert, u
|
||||
col[2] = 0;
|
||||
col[1] = 0;
|
||||
col[0] = 255;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
float colf[4];
|
||||
CLAMP(input, 0.0f, 1.0f);
|
||||
|
||||
CLAMP(input, 0.0f, 1.0f);
|
||||
if(coba) do_colorband(coba, input, colf);
|
||||
else weight_to_rgb(colf, input);
|
||||
|
||||
if(coba)
|
||||
do_colorband(coba, input, colf);
|
||||
else
|
||||
weight_to_rgb(colf, input);
|
||||
|
||||
col[3] = (unsigned char)(colf[0] * 255.0f);
|
||||
col[2] = (unsigned char)(colf[1] * 255.0f);
|
||||
col[1] = (unsigned char)(colf[2] * 255.0f);
|
||||
col[0] = 255;
|
||||
col[3] = (unsigned char)(colf[0] * 255.0f);
|
||||
col[2] = (unsigned char)(colf[1] * 255.0f);
|
||||
col[1] = (unsigned char)(colf[2] * 255.0f);
|
||||
col[0] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
static ColorBand *stored_cb= NULL;
|
||||
|
||||
@@ -76,8 +76,7 @@ void BKE_tracking_init_settings(MovieTracking *tracking)
|
||||
tracking->camera.pixel_aspect= 1.0f;
|
||||
tracking->camera.units= CAMERA_UNITS_MM;
|
||||
|
||||
tracking->settings.default_tracker= TRACKER_KLT;
|
||||
tracking->settings.default_pyramid_levels= 2;
|
||||
tracking->settings.default_tracker= TRACKER_HYBRID;
|
||||
tracking->settings.default_minimum_correlation= 0.75;
|
||||
tracking->settings.default_pattern_size= 11;
|
||||
tracking->settings.default_search_size= 51;
|
||||
@@ -810,9 +809,9 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
|
||||
int level= MIN2(track->pyramid_levels, max_pyramid_levels);
|
||||
|
||||
if(track->tracker==TRACKER_KLT)
|
||||
track_context.region_tracker= libmv_pyramidRegionTrackerNew(100, level, MAX2(wndx, wndy));
|
||||
track_context.region_tracker= libmv_pyramidRegionTrackerNew(100, level, MAX2(wndx, wndy), track->minimum_correlation);
|
||||
else
|
||||
track_context.region_tracker= libmv_hybridRegionTrackerNew(100, MAX2(wndx, wndy));
|
||||
track_context.region_tracker= libmv_hybridRegionTrackerNew(100, MAX2(wndx, wndy), track->minimum_correlation);
|
||||
}
|
||||
else if(track->tracker==TRACKER_SAD) {
|
||||
track_context.pattern_size= MAX2(patx, paty);
|
||||
@@ -1158,7 +1157,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
|
||||
if(marker && (marker->flag&MARKER_DISABLED)==0) {
|
||||
#ifdef WITH_LIBMV
|
||||
int width, height, origin[2], tracked= 0, need_readjust= 0;
|
||||
float pos[2], margin[2];
|
||||
float pos[2], margin[2], dim[2];
|
||||
double x1, y1, x2, y2;
|
||||
ImBuf *ibuf= NULL;
|
||||
MovieTrackingMarker marker_new, *marker_keyed;
|
||||
@@ -1174,7 +1173,8 @@ int BKE_tracking_next(MovieTrackingContext *context)
|
||||
else nextfra= curfra+1;
|
||||
|
||||
/* margin from frame boundaries */
|
||||
sub_v2_v2v2(margin, track->pat_max, track->pat_min);
|
||||
sub_v2_v2v2(dim, track->pat_max, track->pat_min);
|
||||
margin[0]= margin[1]= MAX2(dim[0], dim[1]) / 2.0f;
|
||||
|
||||
margin[0]= MAX2(margin[0], (float)track->margin / ibuf_new->x);
|
||||
margin[1]= MAX2(margin[1], (float)track->margin / ibuf_new->y);
|
||||
@@ -1281,13 +1281,13 @@ int BKE_tracking_next(MovieTrackingContext *context)
|
||||
}
|
||||
|
||||
coords_correct= !isnan(x2) && !isnan(y2) && finite(x2) && finite(y2);
|
||||
if(coords_correct && (tracked || !context->disable_failed)) {
|
||||
if(coords_correct && !onbound && (tracked || !context->disable_failed)) {
|
||||
if(context->first_time) {
|
||||
#pragma omp critical
|
||||
{
|
||||
/* check if there's no keyframe/tracked markers before tracking marker.
|
||||
if so -- create disabled marker before currently tracking "segment" */
|
||||
put_disabled_marker(track, marker, 1, 0);
|
||||
put_disabled_marker(track, marker, !context->backwards, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1311,7 +1311,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
|
||||
/* make currently tracked segment be finished with disabled marker */
|
||||
#pragma omp critical
|
||||
{
|
||||
put_disabled_marker(track, &marker_new, 0, 0);
|
||||
put_disabled_marker(track, &marker_new, context->backwards, 0);
|
||||
}
|
||||
} else {
|
||||
marker_new= *marker;
|
||||
|
||||
@@ -494,7 +494,7 @@ static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pr
|
||||
|
||||
len_name = strlen(replace_str);
|
||||
len_move= (len - (found_ofs+len_name)) + 1; /* 1+ to copy the string terminator */
|
||||
len_num= BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%lg"SEP_STR, unit->scalar/scale_pref); /* # removed later */
|
||||
len_num= BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%g"SEP_STR, unit->scalar/scale_pref); /* # removed later */
|
||||
|
||||
if(len_num > len_max)
|
||||
len_num= len_max;
|
||||
|
||||
@@ -1715,6 +1715,8 @@ void init_userdef_do_versions(void)
|
||||
U.ndof_flag = NDOF_LOCK_HORIZON |
|
||||
NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE;
|
||||
}
|
||||
if (U.tweak_threshold == 0 )
|
||||
U.tweak_threshold= 10;
|
||||
|
||||
/* funny name, but it is GE stuff, moves userdef stuff to engine */
|
||||
// XXX space_set_commmandline_options();
|
||||
|
||||
@@ -1608,7 +1608,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
|
||||
sel, sel_mirr, \
|
||||
flip_map, flip_map_len, \
|
||||
mirror_weights, flip_vgroups, \
|
||||
all_vgroups, act_vgroup \
|
||||
all_vgroups, def_nr \
|
||||
)
|
||||
|
||||
BMVert *eve, *eve_mirr;
|
||||
@@ -1616,14 +1616,30 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
|
||||
MDeformVert *dvert, *dvert_mirr;
|
||||
short sel, sel_mirr;
|
||||
int *flip_map, flip_map_len;
|
||||
const int act_vgroup= ob->actdef > 0 ? ob->actdef-1 : 0;
|
||||
const int def_nr= ob->actdef-1;
|
||||
|
||||
if(mirror_weights==0 && flip_vgroups==0)
|
||||
if ( (mirror_weights==0 && flip_vgroups==0) ||
|
||||
(BLI_findlink(&ob->defbase, def_nr) == NULL) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
flip_map= all_vgroups ?
|
||||
defgroup_flip_map(ob, &flip_map_len, FALSE) :
|
||||
defgroup_flip_map_single(ob, &flip_map_len, FALSE, act_vgroup);
|
||||
if (flip_vgroups) {
|
||||
flip_map= all_vgroups ?
|
||||
defgroup_flip_map(ob, &flip_map_len, FALSE) :
|
||||
defgroup_flip_map_single(ob, &flip_map_len, FALSE, def_nr);
|
||||
|
||||
BLI_assert(flip_map != NULL);
|
||||
|
||||
if (flip_map == NULL) {
|
||||
/* something went wrong!, possibly no groups */
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
flip_map= NULL;
|
||||
flip_map_len= 0;
|
||||
}
|
||||
|
||||
/* only the active group */
|
||||
if(ob->type == OB_MESH) {
|
||||
@@ -1634,8 +1650,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
|
||||
BMIter iter;
|
||||
|
||||
if(!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT)) {
|
||||
MEM_freeN(flip_map);
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
EDBM_CacheMirrorVerts(em, FALSE);
|
||||
@@ -1659,7 +1674,6 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
|
||||
EDBM_ClearMirrorVert(em, eve_mirr);
|
||||
}
|
||||
}
|
||||
|
||||
EDBM_EndMirrorCache(em);
|
||||
}
|
||||
else {
|
||||
@@ -1669,8 +1683,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
|
||||
const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
|
||||
|
||||
if (me->dvert == NULL) {
|
||||
MEM_freeN(flip_map);
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!use_vert_sel) {
|
||||
@@ -1717,8 +1730,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
|
||||
if(lt->editlatt) lt= lt->editlatt->latt;
|
||||
|
||||
if(lt->pntsu == 1 || lt->dvert == NULL) {
|
||||
MEM_freeN(flip_map);
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* unlike editmesh we know that by only looping over the first hald of
|
||||
@@ -1754,9 +1766,11 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN(flip_map);
|
||||
cleanup:
|
||||
if (flip_map) MEM_freeN(flip_map);
|
||||
|
||||
#undef VGROUP_MIRR_OP
|
||||
|
||||
}
|
||||
|
||||
static void vgroup_remap_update_users(Object *ob, int *map)
|
||||
@@ -2738,6 +2752,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op)
|
||||
int nr= RNA_enum_get(op->ptr, "group");
|
||||
|
||||
ob->actdef= nr+1;
|
||||
BLI_assert(ob->actdef >= 0);
|
||||
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
|
||||
@@ -2816,7 +2831,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
|
||||
MDeformVert *dvert= NULL;
|
||||
bDeformGroup *def;
|
||||
int def_tot = BLI_countlist(&ob->defbase);
|
||||
int *sort_map_update= MEM_mallocN(MAX_VGROUP_NAME * sizeof(int) * def_tot + 1, "sort vgroups"); /* needs a dummy index at the start*/
|
||||
int *sort_map_update= MEM_mallocN(sizeof(int) * (def_tot + 1), "sort vgroups"); /* needs a dummy index at the start*/
|
||||
int *sort_map= sort_map_update + 1;
|
||||
char *name;
|
||||
int i;
|
||||
@@ -2825,6 +2840,8 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
|
||||
for(def= ob->defbase.first, i=0; def; def=def->next, i++){
|
||||
sort_map[i]= BLI_findstringindex(&ob->defbase, name, offsetof(bDeformGroup, name));
|
||||
name += MAX_VGROUP_NAME;
|
||||
|
||||
BLI_assert(sort_map[i] != -1);
|
||||
}
|
||||
|
||||
if(ob->mode == OB_MODE_EDIT) {
|
||||
@@ -2867,6 +2884,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
|
||||
vgroup_remap_update_users(ob, sort_map_update);
|
||||
|
||||
ob->actdef= sort_map_update[ob->actdef];
|
||||
BLI_assert(ob->actdef >= 0);
|
||||
|
||||
MEM_freeN(sort_map_update);
|
||||
|
||||
|
||||
@@ -378,8 +378,12 @@ static void render_progress_update(void *rjv, float progress)
|
||||
{
|
||||
RenderJob *rj= rjv;
|
||||
|
||||
if(rj->progress)
|
||||
if(rj->progress && *rj->progress != progress) {
|
||||
*rj->progress = progress;
|
||||
|
||||
/* make jobs timer to send notifier */
|
||||
*(rj->do_update)= 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
|
||||
|
||||
@@ -1102,6 +1102,7 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op)
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
|
||||
vc.obact->actdef= type + 1;
|
||||
BLI_assert(vc.obact->actdef >= 0);
|
||||
|
||||
DAG_id_tag_update(&vc.obact->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, vc.obact);
|
||||
@@ -1959,10 +1960,13 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
|
||||
|
||||
if(pchan) {
|
||||
bDeformGroup *dg= defgroup_find_name(ob, pchan->name);
|
||||
if(dg==NULL)
|
||||
if(dg==NULL) {
|
||||
dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */
|
||||
else
|
||||
}
|
||||
else {
|
||||
ob->actdef= 1 + defgroup_find_index(ob, dg);
|
||||
BLI_assert(ob->actdef >= 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2034,7 +2038,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
|
||||
wpi.defbase_tot= wpd->defbase_tot;
|
||||
wpi.defbase_sel= MEM_mallocN(wpi.defbase_tot*sizeof(char), "wpi.defbase_sel");
|
||||
wpi.defbase_tot_sel= get_selected_defgroups(ob, wpi.defbase_sel, wpi.defbase_tot);
|
||||
if(wpi.defbase_tot_sel == 0 && ob->actdef) wpi.defbase_tot_sel = 1;
|
||||
if(wpi.defbase_tot_sel == 0 && ob->actdef > 0) wpi.defbase_tot_sel = 1;
|
||||
wpi.defbase_tot_unsel= wpi.defbase_tot - wpi.defbase_tot_sel;
|
||||
wpi.vgroup_mirror= wpd->vgroup_mirror;
|
||||
wpi.lock_flags= wpd->lock_flags;
|
||||
|
||||
@@ -397,6 +397,8 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
|
||||
ob= (Object *)tselem->id;
|
||||
if(set) {
|
||||
ob->actdef= te->index+1;
|
||||
BLI_assert(ob->actdef >= 0);
|
||||
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
|
||||
}
|
||||
|
||||
@@ -94,9 +94,7 @@ static int tottrans= 0;
|
||||
/* copied from editobject.c, now uses (almost) proper depgraph */
|
||||
static void special_transvert_update(Object *obedit)
|
||||
{
|
||||
|
||||
if(obedit) {
|
||||
|
||||
DAG_id_tag_update(obedit->data, 0);
|
||||
|
||||
if(obedit->type==OB_MESH) {
|
||||
@@ -180,7 +178,7 @@ static void special_transvert_update(Object *obedit)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(arm->flag & ARM_MIRROR_EDIT)
|
||||
if(arm->flag & ARM_MIRROR_EDIT)
|
||||
transform_armature_mirror_update(obedit);
|
||||
}
|
||||
else if(obedit->type==OB_LATTICE) {
|
||||
@@ -209,7 +207,7 @@ static void set_mapped_co(void *vuserdata, int index, float *co, float *UNUSED(n
|
||||
/* mode flags: */
|
||||
#define TM_ALL_JOINTS 1 /* all joints (for bones only) */
|
||||
#define TM_SKIP_HANDLES 2 /* skip handles when control point is selected (for curves only) */
|
||||
static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
|
||||
static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
|
||||
{
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
@@ -337,7 +335,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
|
||||
if ((tipsel && rootsel) || (rootsel)) {
|
||||
/* Don't add the tip (unless mode & TM_ALL_JOINTS, for getting all joints),
|
||||
* otherwise we get zero-length bones as tips will snap to the same
|
||||
* location as heads.
|
||||
* location as heads.
|
||||
*/
|
||||
if (rootok) {
|
||||
copy_v3_v3(tv->oldloc, ebo->head);
|
||||
@@ -355,7 +353,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
|
||||
tv->flag= 1;
|
||||
tv++;
|
||||
tottrans++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tipsel) {
|
||||
copy_v3_v3(tv->oldloc, ebo->tail);
|
||||
@@ -365,7 +363,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
|
||||
tv++;
|
||||
tottrans++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
|
||||
@@ -524,7 +522,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
|
||||
if(obedit) {
|
||||
tottrans= 0;
|
||||
|
||||
if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
|
||||
if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
|
||||
make_trans_verts(obedit, bmat[0], bmat[1], 0);
|
||||
if(tottrans==0) return OPERATOR_CANCELLED;
|
||||
|
||||
@@ -533,7 +531,6 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
tv= transvmain;
|
||||
for(a=0; a<tottrans; a++, tv++) {
|
||||
|
||||
copy_v3_v3(vec, tv->loc);
|
||||
mul_m3_v3(bmat, vec);
|
||||
add_v3_v3(vec, obedit->obmat[3]);
|
||||
@@ -550,7 +547,6 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
MEM_freeN(transvmain);
|
||||
transvmain= NULL;
|
||||
|
||||
}
|
||||
else {
|
||||
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
|
||||
@@ -560,34 +556,42 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
|
||||
bPoseChannel *pchan;
|
||||
bArmature *arm= ob->data;
|
||||
|
||||
invert_m4_m4(ob->imat, ob->obmat);
|
||||
|
||||
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
||||
if(pchan->bone->flag & BONE_SELECTED) {
|
||||
if(pchan->bone->layer & arm->layer) {
|
||||
if((pchan->bone->flag & BONE_CONNECTED)==0) {
|
||||
float vecN[3], nLoc[3];
|
||||
if((pchan->bone->flag & BONE_CONNECTED)==0) {
|
||||
float nLoc[3];
|
||||
float inv_restmat[4][4];
|
||||
|
||||
/* get nearest grid point to snap to */
|
||||
copy_v3_v3(nLoc, pchan->pose_mat[3]);
|
||||
/* We must operate in world space! */
|
||||
mul_m4_v3(ob->obmat, nLoc);
|
||||
vec[0]= gridf * (float)(floor(0.5f+ nLoc[0]/gridf));
|
||||
vec[1]= gridf * (float)(floor(0.5f+ nLoc[1]/gridf));
|
||||
vec[2]= gridf * (float)(floor(0.5f+ nLoc[2]/gridf));
|
||||
/* Back in object space... */
|
||||
mul_m4_v3(ob->imat, vec);
|
||||
|
||||
/* get bone-space location of grid point */
|
||||
armature_loc_pose_to_bone(pchan, vec, vecN);
|
||||
/* get location of grid point in *rest* bone-space */
|
||||
invert_m4_m4(inv_restmat, pchan->bone->arm_mat);
|
||||
mul_m4_v3(inv_restmat, vec);
|
||||
|
||||
/* adjust location */
|
||||
if ((pchan->protectflag & OB_LOCK_LOCX)==0)
|
||||
pchan->loc[0]= vecN[0];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCY)==0)
|
||||
pchan->loc[0]= vecN[1];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCZ)==0)
|
||||
pchan->loc[0]= vecN[2];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCX)==0)
|
||||
pchan->loc[0]= vec[0];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCY)==0)
|
||||
pchan->loc[1]= vec[1];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCZ)==0)
|
||||
pchan->loc[2]= vec[2];
|
||||
|
||||
/* auto-keyframing */
|
||||
ED_autokeyframe_pchan(C, scene, ob, pchan, ks);
|
||||
}
|
||||
/* if the bone has a parent and is connected to the parent,
|
||||
* don't do anything - will break chain unless we do auto-ik.
|
||||
/* if the bone has a parent and is connected to the parent,
|
||||
* don't do anything - will break chain unless we do auto-ik.
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -631,7 +635,6 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Snap Selection to Grid";
|
||||
ot->description= "Snap selected item(s) to nearest grid node";
|
||||
@@ -662,7 +665,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
|
||||
if(obedit) {
|
||||
tottrans= 0;
|
||||
|
||||
if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
|
||||
if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
|
||||
make_trans_verts(obedit, bmat[0], bmat[1], 0);
|
||||
if(tottrans==0) return OPERATOR_CANCELLED;
|
||||
|
||||
@@ -680,7 +683,6 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
MEM_freeN(transvmain);
|
||||
transvmain= NULL;
|
||||
|
||||
}
|
||||
else {
|
||||
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
|
||||
@@ -689,34 +691,34 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
|
||||
if(ob->mode & OB_MODE_POSE) {
|
||||
bPoseChannel *pchan;
|
||||
bArmature *arm= ob->data;
|
||||
float cursp[3];
|
||||
|
||||
invert_m4_m4(ob->imat, ob->obmat);
|
||||
copy_v3_v3(cursp, curs);
|
||||
mul_m4_v3(ob->imat, cursp);
|
||||
copy_v3_v3(vec, curs);
|
||||
mul_m4_v3(ob->imat, vec);
|
||||
|
||||
for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
|
||||
if(pchan->bone->flag & BONE_SELECTED) {
|
||||
if(pchan->bone->layer & arm->layer) {
|
||||
if((pchan->bone->flag & BONE_CONNECTED)==0) {
|
||||
float curspn[3];
|
||||
if((pchan->bone->flag & BONE_CONNECTED)==0) {
|
||||
float inv_restmat[4][4];
|
||||
|
||||
/* get location of cursor in bone-space */
|
||||
armature_loc_pose_to_bone(pchan, cursp, curspn);
|
||||
/* get location of cursor in *rest* bone-space */
|
||||
invert_m4_m4(inv_restmat, pchan->bone->arm_mat);
|
||||
mul_m4_v3(inv_restmat, vec);
|
||||
|
||||
/* copy new position */
|
||||
if ((pchan->protectflag & OB_LOCK_LOCX)==0)
|
||||
pchan->loc[0]= curspn[0];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCY)==0)
|
||||
pchan->loc[1]= curspn[1];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCZ)==0)
|
||||
pchan->loc[2]= curspn[2];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCX)==0)
|
||||
pchan->loc[0]= vec[0];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCY)==0)
|
||||
pchan->loc[1]= vec[1];
|
||||
if ((pchan->protectflag & OB_LOCK_LOCZ)==0)
|
||||
pchan->loc[2]= vec[2];
|
||||
|
||||
/* auto-keyframing */
|
||||
ED_autokeyframe_pchan(C, scene, ob, pchan, ks);
|
||||
}
|
||||
/* if the bone has a parent and is connected to the parent,
|
||||
* don't do anything - will break chain unless we do auto-ik.
|
||||
/* if the bone has a parent and is connected to the parent,
|
||||
* don't do anything - will break chain unless we do auto-ik.
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -760,7 +762,6 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Snap Selection to Cursor";
|
||||
ot->description= "Snap selected item(s) to cursor";
|
||||
@@ -797,7 +798,6 @@ static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Snap Cursor to Grid";
|
||||
ot->description= "Snap cursor to nearest grid node";
|
||||
@@ -862,7 +862,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
|
||||
if(obedit) {
|
||||
tottrans=0;
|
||||
|
||||
if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
|
||||
if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
|
||||
make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS|TM_SKIP_HANDLES);
|
||||
if(tottrans==0) return OPERATOR_CANCELLED;
|
||||
|
||||
@@ -940,10 +940,9 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Snap Cursor to Selected";
|
||||
ot->description= "Snap cursor to center of selected item(s)";
|
||||
ot->description= "Snap cursor to center of selected item(s)";
|
||||
ot->idname= "VIEW3D_OT_snap_cursor_to_selected";
|
||||
|
||||
/* api callbacks */
|
||||
@@ -991,7 +990,6 @@ static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Snap Cursor to Active";
|
||||
ot->description= "Snap cursor to active item";
|
||||
@@ -1025,13 +1023,12 @@ static int snap_curs_to_center(bContext *C, wmOperator *UNUSED(op))
|
||||
|
||||
void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot)
|
||||
{
|
||||
|
||||
/* identifiers */
|
||||
ot->name= "Snap Cursor to Center";
|
||||
ot->description= "Snap cursor to the Center";
|
||||
ot->idname= "VIEW3D_OT_snap_cursor_to_center";
|
||||
|
||||
/* api callbacks */
|
||||
/* api callbacks */
|
||||
ot->exec= snap_curs_to_center;
|
||||
ot->poll= ED_operator_view3d_active;
|
||||
|
||||
@@ -1049,7 +1046,7 @@ int minmax_verts(Object *obedit, float *min, float *max)
|
||||
int a;
|
||||
|
||||
tottrans=0;
|
||||
if ELEM5(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE)
|
||||
if ELEM5(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE)
|
||||
make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS);
|
||||
|
||||
if(tottrans==0) return 0;
|
||||
@@ -1057,12 +1054,12 @@ int minmax_verts(Object *obedit, float *min, float *max)
|
||||
copy_m3_m4(bmat, obedit->obmat);
|
||||
|
||||
tv= transvmain;
|
||||
for(a=0; a<tottrans; a++, tv++) {
|
||||
for(a=0; a<tottrans; a++, tv++) {
|
||||
copy_v3_v3(vec, tv->maploc);
|
||||
mul_m3_v3(bmat, vec);
|
||||
add_v3_v3(vec, obedit->obmat[3]);
|
||||
add_v3_v3(centroid, vec);
|
||||
DO_MINMAX(vec, min, max);
|
||||
DO_MINMAX(vec, min, max);
|
||||
}
|
||||
|
||||
MEM_freeN(transvmain);
|
||||
|
||||
@@ -219,7 +219,7 @@ typedef struct Object {
|
||||
ListBase controllers; /* game logic controllers */
|
||||
ListBase actuators; /* game logic actuators */
|
||||
|
||||
float bbsize[3];
|
||||
float bbsize[3] DNA_DEPRECATED;
|
||||
short index; /* custom index, for renderpasses */
|
||||
unsigned short actdef; /* current deformation group, note: index starts at 1 */
|
||||
float col[4]; /* object color */
|
||||
|
||||
@@ -408,7 +408,9 @@ typedef struct UserDef {
|
||||
struct ColorBand coba_weight; /* from texture.h */
|
||||
|
||||
float sculpt_paint_overlay_col[3];
|
||||
int pad3;
|
||||
|
||||
short tweak_threshold;
|
||||
short pad3;
|
||||
|
||||
char author[80]; /* author name for file formats supporting it */
|
||||
} UserDef;
|
||||
|
||||
@@ -2929,6 +2929,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
|
||||
RNA_def_property_range(prop, 3, 40);
|
||||
RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens");
|
||||
|
||||
prop= RNA_def_property(srna, "tweak_threshold", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "tweak_threshold");
|
||||
RNA_def_property_range(prop, 3, 1024);
|
||||
RNA_def_property_ui_text(prop, "Tweak Threshold", "Number of pixels you have to drag before tweak event is triggered");
|
||||
|
||||
/* 3D mouse settings */
|
||||
/* global options */
|
||||
prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE);
|
||||
|
||||
@@ -82,9 +82,10 @@ int bpy_pydriver_create_dict(void)
|
||||
}
|
||||
|
||||
/* add noise to global namespace */
|
||||
mod= PyImport_ImportModuleLevel((char *)"mathutils.noise", NULL, NULL, NULL, 0);
|
||||
mod= PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0);
|
||||
if (mod) {
|
||||
PyDict_SetItemString(bpy_pydriver_Dict, "noise", mod);
|
||||
PyObject *modsub= PyDict_GetItemString(PyModule_GetDict(mod), "noise");
|
||||
PyDict_SetItemString(bpy_pydriver_Dict, "noise", modsub);
|
||||
Py_DECREF(mod);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,14 +124,13 @@ void WM_gestures_remove(bContext *C)
|
||||
|
||||
|
||||
/* tweak and line gestures */
|
||||
#define TWEAK_THRESHOLD 10
|
||||
int wm_gesture_evaluate(wmGesture *gesture)
|
||||
{
|
||||
if(gesture->type==WM_GESTURE_TWEAK) {
|
||||
rcti *rect= gesture->customdata;
|
||||
int dx= rect->xmax - rect->xmin;
|
||||
int dy= rect->ymax - rect->ymin;
|
||||
if(ABS(dx)+ABS(dy) > TWEAK_THRESHOLD) {
|
||||
if(ABS(dx)+ABS(dy) > U.tweak_threshold) {
|
||||
int theta= (int)floor(4.0f*atan2f((float)dy, (float)dx)/(float)M_PI + 0.5f);
|
||||
int val= EVT_GESTURE_W;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user