Merging r50457 through r50469 from trunk into soc-2011-tomato
This commit is contained in:
@@ -16,6 +16,7 @@ set(SRC
|
||||
set(SRC_HEADERS
|
||||
kernel.h
|
||||
kernel_accumulate.h
|
||||
kernel_attribute.h
|
||||
kernel_bvh.h
|
||||
kernel_camera.h
|
||||
kernel_compat_cpu.h
|
||||
|
||||
68
intern/cycles/kernel/kernel_attribute.h
Normal file
68
intern/cycles/kernel/kernel_attribute.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __KERNEL_ATTRIBUTE_CL__
|
||||
#define __KERNEL_ATTRIBUTE_CL__
|
||||
|
||||
#include "util_types.h"
|
||||
|
||||
#ifdef __OSL__
|
||||
#include <string>
|
||||
#include "util_attribute.h"
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* note: declared in kernel.h, have to add it here because kernel.h is not available */
|
||||
bool kernel_osl_use(KernelGlobals *kg);
|
||||
|
||||
__device_inline int find_attribute(KernelGlobals *kg, ShaderData *sd, uint id)
|
||||
{
|
||||
|
||||
#ifdef __OSL__
|
||||
if (kernel_osl_use(kg)) {
|
||||
/* for OSL, a hash map is used to lookup the attribute by name. */
|
||||
OSLGlobals::AttributeMap &attr_map = kg->osl.attribute_map[sd->object];
|
||||
ustring stdname(std::string("std::") + std::string(attribute_standard_name((AttributeStandard)id)));
|
||||
OSLGlobals::AttributeMap::const_iterator it = attr_map.find(stdname);
|
||||
if (it != attr_map.end()) {
|
||||
const OSLGlobals::Attribute &osl_attr = it->second;
|
||||
/* return result */
|
||||
return (osl_attr.elem == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : osl_attr.offset;
|
||||
}
|
||||
else
|
||||
return (int)ATTR_STD_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* for SVM, find attribute by unique id */
|
||||
uint attr_offset = sd->object*kernel_data.bvh.attributes_map_stride;
|
||||
uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
|
||||
|
||||
while(attr_map.x != id)
|
||||
attr_map = kernel_tex_fetch(__attributes_map, ++attr_offset);
|
||||
|
||||
/* return result */
|
||||
return (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : attr_map.z;
|
||||
}
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __KERNEL_ATTRIBUTE_CL__ */
|
||||
@@ -16,6 +16,7 @@
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "kernel_attribute.h"
|
||||
#include "kernel_projection.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
@@ -183,48 +184,13 @@ __device float3 triangle_attribute_float3(KernelGlobals *kg, const ShaderData *s
|
||||
|
||||
/* motion */
|
||||
|
||||
/* note: declared in kernel.h, have to add it here because kernel.h is not available */
|
||||
bool kernel_osl_use(KernelGlobals *kg);
|
||||
|
||||
__device int triangle_find_attribute(KernelGlobals *kg, ShaderData *sd, uint id)
|
||||
{
|
||||
|
||||
#ifdef __OSL__
|
||||
if (kernel_osl_use(kg)) {
|
||||
/* for OSL, a hash map is used to lookup the attribute by name. */
|
||||
OSLGlobals::AttributeMap &attr_map = kg->osl.attribute_map[sd->object];
|
||||
ustring stdname = ustring(std::string("std::") + attribute_standard_name((AttributeStandard)id).c_str());
|
||||
OSLGlobals::AttributeMap::const_iterator it = attr_map.find(stdname);
|
||||
if (it != attr_map.end()) {
|
||||
const OSLGlobals::Attribute &osl_attr = it->second;
|
||||
/* return result */
|
||||
return (osl_attr.elem == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : osl_attr.offset;
|
||||
}
|
||||
else
|
||||
return (int)ATTR_STD_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* for SVM, find attribute by unique id */
|
||||
uint attr_offset = sd->object*kernel_data.bvh.attributes_map_stride;
|
||||
uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
|
||||
|
||||
while(attr_map.x != id)
|
||||
attr_map = kernel_tex_fetch(__attributes_map, ++attr_offset);
|
||||
|
||||
/* return result */
|
||||
return (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : attr_map.z;
|
||||
}
|
||||
}
|
||||
|
||||
__device float4 triangle_motion_vector(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
float3 motion_pre = sd->P, motion_post = sd->P;
|
||||
|
||||
/* deformation motion */
|
||||
int offset_pre = triangle_find_attribute(kg, sd, ATTR_STD_MOTION_PRE);
|
||||
int offset_post = triangle_find_attribute(kg, sd, ATTR_STD_MOTION_POST);
|
||||
int offset_pre = find_attribute(kg, sd, ATTR_STD_MOTION_PRE);
|
||||
int offset_post = find_attribute(kg, sd, ATTR_STD_MOTION_POST);
|
||||
|
||||
if(offset_pre != ATTR_STD_NOT_FOUND)
|
||||
motion_pre = triangle_attribute_float3(kg, sd, ATTR_ELEMENT_VERTEX, offset_pre, NULL, NULL);
|
||||
@@ -283,7 +249,7 @@ __device float4 triangle_motion_vector(KernelGlobals *kg, ShaderData *sd)
|
||||
|
||||
__device float3 triangle_uv(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
int offset_uv = triangle_find_attribute(kg, sd, ATTR_STD_UV);
|
||||
int offset_uv = find_attribute(kg, sd, ATTR_STD_UV);
|
||||
|
||||
if(offset_uv == ATTR_STD_NOT_FOUND)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#ifndef __KERNEL_TYPES_H__
|
||||
#define __KERNEL_TYPES_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "kernel_math.h"
|
||||
#include "svm/svm_types.h"
|
||||
|
||||
@@ -354,46 +352,6 @@ typedef enum AttributeElement {
|
||||
ATTR_ELEMENT_NONE
|
||||
} AttributeElement;
|
||||
|
||||
typedef enum AttributeStandard {
|
||||
ATTR_STD_NONE = 0,
|
||||
ATTR_STD_VERTEX_NORMAL,
|
||||
ATTR_STD_FACE_NORMAL,
|
||||
ATTR_STD_UV,
|
||||
ATTR_STD_GENERATED,
|
||||
ATTR_STD_POSITION_UNDEFORMED,
|
||||
ATTR_STD_POSITION_UNDISPLACED,
|
||||
ATTR_STD_MOTION_PRE,
|
||||
ATTR_STD_MOTION_POST,
|
||||
ATTR_STD_PARTICLE,
|
||||
ATTR_STD_NUM,
|
||||
|
||||
ATTR_STD_NOT_FOUND = ~0
|
||||
} AttributeStandard;
|
||||
|
||||
__device std::string attribute_standard_name(AttributeStandard std)
|
||||
{
|
||||
if(std == ATTR_STD_VERTEX_NORMAL)
|
||||
return std::string("N");
|
||||
else if(std == ATTR_STD_FACE_NORMAL)
|
||||
return std::string("Ng");
|
||||
else if(std == ATTR_STD_UV)
|
||||
return std::string("uv");
|
||||
else if(std == ATTR_STD_GENERATED)
|
||||
return std::string("generated");
|
||||
else if(std == ATTR_STD_POSITION_UNDEFORMED)
|
||||
return std::string("undeformed");
|
||||
else if(std == ATTR_STD_POSITION_UNDISPLACED)
|
||||
return std::string("undisplaced");
|
||||
else if(std == ATTR_STD_MOTION_PRE)
|
||||
return std::string("motion_pre");
|
||||
else if(std == ATTR_STD_MOTION_POST)
|
||||
return std::string("motion_post");
|
||||
else if(std == ATTR_STD_PARTICLE)
|
||||
return std::string("particle");
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
/* Closure data */
|
||||
|
||||
#define MAX_CLOSURE 8
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "kernel_types.h"
|
||||
|
||||
#include "util_attribute.h"
|
||||
#include "util_list.h"
|
||||
#include "util_param.h"
|
||||
#include "util_types.h"
|
||||
|
||||
@@ -366,7 +366,7 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att
|
||||
|
||||
if(req.std != ATTR_STD_NONE) {
|
||||
/* if standard attribute, add lookup by std:: name convention */
|
||||
ustring stdname = ustring(string("std::") + attribute_standard_name(req.std).c_str());
|
||||
ustring stdname(std::string("std::") + std::string(attribute_standard_name(req.std)));
|
||||
og->attribute_map[i][stdname] = osl_attr;
|
||||
}
|
||||
else if(req.name != ustring()) {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "kernel_types.h"
|
||||
|
||||
#include "util_attribute.h"
|
||||
#include "util_param.h"
|
||||
#include "util_string.h"
|
||||
#include "util_thread.h"
|
||||
|
||||
@@ -6,6 +6,7 @@ set(INC
|
||||
)
|
||||
|
||||
set(SRC
|
||||
util_attribute.cpp
|
||||
util_cache.cpp
|
||||
util_cuda.cpp
|
||||
util_dynlib.cpp
|
||||
@@ -29,6 +30,7 @@ endif()
|
||||
set(SRC_HEADERS
|
||||
util_algorithm.h
|
||||
util_args.h
|
||||
util_attribute.h
|
||||
util_boundbox.h
|
||||
util_cache.h
|
||||
util_cuda.h
|
||||
|
||||
47
intern/cycles/util/util_attribute.cpp
Normal file
47
intern/cycles/util/util_attribute.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "util_attribute.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
const char *attribute_standard_name(AttributeStandard std)
|
||||
{
|
||||
if(std == ATTR_STD_VERTEX_NORMAL)
|
||||
return "N";
|
||||
else if(std == ATTR_STD_FACE_NORMAL)
|
||||
return "Ng";
|
||||
else if(std == ATTR_STD_UV)
|
||||
return "uv";
|
||||
else if(std == ATTR_STD_GENERATED)
|
||||
return "generated";
|
||||
else if(std == ATTR_STD_POSITION_UNDEFORMED)
|
||||
return "undeformed";
|
||||
else if(std == ATTR_STD_POSITION_UNDISPLACED)
|
||||
return "undisplaced";
|
||||
else if(std == ATTR_STD_MOTION_PRE)
|
||||
return "motion_pre";
|
||||
else if(std == ATTR_STD_MOTION_POST)
|
||||
return "motion_post";
|
||||
else if(std == ATTR_STD_PARTICLE)
|
||||
return "particle";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
31
intern/cycles/util/util_attribute.h
Normal file
31
intern/cycles/util/util_attribute.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_ATTRIBUTE_H__
|
||||
#define __UTIL_ATTRIBUTE_H__
|
||||
|
||||
#include "util_types.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
const char *attribute_standard_name(AttributeStandard std);
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_ATTRIBUTE_H__ */
|
||||
|
||||
@@ -444,6 +444,22 @@ __device_inline int4 make_int4(const float3& f)
|
||||
|
||||
#endif
|
||||
|
||||
typedef enum AttributeStandard {
|
||||
ATTR_STD_NONE = 0,
|
||||
ATTR_STD_VERTEX_NORMAL,
|
||||
ATTR_STD_FACE_NORMAL,
|
||||
ATTR_STD_UV,
|
||||
ATTR_STD_GENERATED,
|
||||
ATTR_STD_POSITION_UNDEFORMED,
|
||||
ATTR_STD_POSITION_UNDISPLACED,
|
||||
ATTR_STD_MOTION_PRE,
|
||||
ATTR_STD_MOTION_POST,
|
||||
ATTR_STD_PARTICLE,
|
||||
ATTR_STD_NUM,
|
||||
|
||||
ATTR_STD_NOT_FOUND = ~0
|
||||
} AttributeStandard;
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_H__ */
|
||||
|
||||
@@ -980,6 +980,7 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel):
|
||||
|
||||
col = layout.column()
|
||||
|
||||
col.prop(wpaint, "use_all_faces")
|
||||
col.prop(wpaint, "use_normal")
|
||||
col.prop(wpaint, "use_spray")
|
||||
col.prop(wpaint, "use_group_restrict")
|
||||
|
||||
@@ -274,7 +274,7 @@ void POSE_OT_paths_calculate(wmOperatorType *ot)
|
||||
/* api callbacks */
|
||||
ot->invoke = pose_calculate_paths_invoke;
|
||||
ot->exec = pose_calculate_paths_exec;
|
||||
ot->poll = ED_operator_posemode;
|
||||
ot->poll = ED_operator_posemode_exclusive;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
@@ -319,7 +319,7 @@ void POSE_OT_paths_update(wmOperatorType *ot)
|
||||
|
||||
/* api callbakcs */
|
||||
ot->exec = pose_update_paths_exec;
|
||||
ot->poll = ED_operator_posemode; /* TODO: this should probably check for active bone and/or existing paths */
|
||||
ot->poll = ED_operator_posemode_exclusive; /* TODO: this should probably check for active bone and/or existing paths */
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
@@ -380,7 +380,7 @@ void POSE_OT_paths_clear(wmOperatorType *ot)
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = pose_clear_paths_exec;
|
||||
ot->poll = ED_operator_posemode;
|
||||
ot->poll = ED_operator_posemode_exclusive;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
@@ -2192,7 +2192,7 @@ void POSE_OT_bone_layers(wmOperatorType *ot)
|
||||
/* callbacks */
|
||||
ot->invoke = pose_bone_layers_invoke;
|
||||
ot->exec = pose_bone_layers_exec;
|
||||
ot->poll = ED_operator_posemode;
|
||||
ot->poll = ED_operator_posemode_exclusive;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
@@ -71,14 +71,8 @@ struct Material;
|
||||
struct Object;
|
||||
struct rcti;
|
||||
|
||||
intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, const float co[3], char mode);
|
||||
int mesh_mirrtopo_table(struct Object *ob, char mode);
|
||||
|
||||
/* editmesh_utils.c */
|
||||
|
||||
/* retrieves mirrored cache vert, or NULL if there isn't one.
|
||||
* note: calling this without ensuring the mirror cache state
|
||||
* is bad.*/
|
||||
void EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, const short use_select); /* note, replaces EM_cache_x_mirror_vert in trunk */
|
||||
void EDBM_verts_mirror_apply(struct BMEditMesh *em, const int sel_from, const int sel_to);
|
||||
struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v);
|
||||
@@ -86,7 +80,9 @@ void EDBM_verts_mirror_cache_clear(struct BMEditMesh *em, struct BMVer
|
||||
void EDBM_verts_mirror_cache_end(struct BMEditMesh *em);
|
||||
|
||||
void EDBM_mesh_normals_update(struct BMEditMesh *em);
|
||||
void EDBM_mesh_clear(struct BMEditMesh *em);
|
||||
|
||||
void EDBM_selectmode_to_scene(struct bContext *C);
|
||||
void EDBM_mesh_make(struct ToolSettings *ts, struct Scene *scene, struct Object *ob);
|
||||
void EDBM_mesh_free(struct BMEditMesh *tm);
|
||||
void EDBM_mesh_load(struct Object *ob);
|
||||
@@ -110,27 +106,15 @@ void EDBM_selectmode_flush(struct BMEditMesh *em);
|
||||
void EDBM_deselect_flush(struct BMEditMesh *em);
|
||||
void EDBM_select_flush(struct BMEditMesh *em);
|
||||
|
||||
void EDBM_selectmode_set(struct BMEditMesh *em);
|
||||
void EDBM_selectmode_convert(struct BMEditMesh *em, short oldmode, const short selectmode);
|
||||
void undo_push_mesh(struct bContext *C, const char *name);
|
||||
|
||||
int EDBM_vert_color_check(struct BMEditMesh *em);
|
||||
|
||||
|
||||
void EDBM_mesh_hide(struct BMEditMesh *em, int swap);
|
||||
void EDBM_mesh_reveal(struct BMEditMesh *em);
|
||||
|
||||
void EDBM_update_generic(struct bContext *C, struct BMEditMesh *em, const short do_tessface);
|
||||
|
||||
int EDBM_backbuf_check(unsigned int index);
|
||||
int EDBM_backbuf_border_mask_init(struct ViewContext *vc, int mcords[][2], short tot,
|
||||
short xmin, short ymin, short xmax, short ymax);
|
||||
void EDBM_backbuf_free(void);
|
||||
int EDBM_backbuf_border_init(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
|
||||
int EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads);
|
||||
|
||||
void EDBM_deselect_by_material(struct BMEditMesh *em, const short index, const short select);
|
||||
|
||||
struct UvElementMap *EDBM_uv_element_map_create(struct BMEditMesh *em, int selected, int doIslands);
|
||||
void EDBM_uv_element_map_free(struct UvElementMap *vmap);
|
||||
|
||||
@@ -141,60 +125,86 @@ void EDBM_uv_vert_map_free(struct UvVertMap *vmap);
|
||||
struct UvMapVert *EDBM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v);
|
||||
struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, const float limit[2]);
|
||||
|
||||
void EDBM_select_toggle_all(struct BMEditMesh *em);
|
||||
void EDBM_select_swap(struct BMEditMesh *em); /* exported for UV */
|
||||
int EDBM_select_interior_faces(struct BMEditMesh *em);
|
||||
|
||||
void EDBM_flag_enable_all(struct BMEditMesh *em, const char hflag);
|
||||
void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
|
||||
|
||||
|
||||
/* editmesh_select.c */
|
||||
void EDBM_select_mirrored(struct Object *obedit, struct BMEditMesh *em, int extend);
|
||||
void EDBM_automerge(struct Scene *scene, struct Object *ob, int update);
|
||||
|
||||
/* editmesh_mods.c */
|
||||
int EDBM_backbuf_border_init(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
|
||||
int EDBM_backbuf_check(unsigned int index);
|
||||
void EDBM_backbuf_free(void);
|
||||
|
||||
int EDBM_backbuf_border_mask_init(struct ViewContext *vc, int mcords[][2], short tot,
|
||||
short xmin, short ymin, short xmax, short ymax);
|
||||
int EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads);
|
||||
|
||||
struct BMVert *EDBM_vert_find_nearest(struct ViewContext *vc, int *dist, short sel, short strict);
|
||||
struct BMEdge *EDBM_edge_find_nearest(struct ViewContext *vc, int *dist);
|
||||
struct BMFace *EDBM_face_find_nearest(struct ViewContext *vc, int *dist);
|
||||
|
||||
int EDBM_select_pick(struct bContext *C, const int mval[2], short extend, short deselect, short toggle);
|
||||
|
||||
void EDBM_selectmode_set(struct BMEditMesh *em);
|
||||
void EDBM_selectmode_convert(struct BMEditMesh *em, short oldmode, const short selectmode);
|
||||
|
||||
void EDBM_deselect_by_material(struct BMEditMesh *em, const short index, const short select);
|
||||
|
||||
void EDBM_select_toggle_all(struct BMEditMesh *em);
|
||||
|
||||
void EDBM_select_swap(struct BMEditMesh *em); /* exported for UV */
|
||||
int EDBM_select_interior_faces(struct BMEditMesh *em);
|
||||
void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc); /* rename? */
|
||||
|
||||
extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
|
||||
|
||||
int mouse_mesh(struct bContext *C, const int mval[2], short extend, short deselect, short toggle);
|
||||
|
||||
struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, const float co[3], int index);
|
||||
int mesh_get_x_mirror_vert(struct Object *ob, int index);
|
||||
int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em);
|
||||
|
||||
int join_mesh_exec(struct bContext *C, struct wmOperator *op);
|
||||
int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op);
|
||||
|
||||
/* mesh_ops.c */
|
||||
void ED_operatortypes_mesh(void);
|
||||
void ED_operatormacros_mesh(void);
|
||||
void ED_keymap_mesh(struct wmKeyConfig *keyconf);
|
||||
|
||||
|
||||
/* editmesh.c */
|
||||
|
||||
void ED_spacetypes_init(void);
|
||||
void ED_keymap_mesh(struct wmKeyConfig *keyconf);
|
||||
|
||||
/* bmesh_mods.c */
|
||||
extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
|
||||
|
||||
/* bmesh_tools.c (could be moved) */
|
||||
/* spacetypes.c */
|
||||
void ED_spacetypes_init(void);
|
||||
|
||||
|
||||
/* editmesh_tools.c (could be moved) */
|
||||
void EMBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct BMEditMesh *em);
|
||||
|
||||
|
||||
/* editface.c */
|
||||
void paintface_flush_flags(struct Object *ob);
|
||||
int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], int extend, int deselect, int toggle);
|
||||
int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend);
|
||||
int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], int extend, int deselect, int toggle);
|
||||
int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend);
|
||||
void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags);
|
||||
void paintface_select_linked(struct bContext *C, struct Object *ob, int mval[2], int mode);
|
||||
int paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]);
|
||||
int paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]);
|
||||
|
||||
void paintface_hide(struct Object *ob, const int unselected);
|
||||
void paintface_reveal(struct Object *ob);
|
||||
|
||||
void paintvert_deselect_all_visible(struct Object *ob, int action, short flush_flags);
|
||||
void paintvert_flush_flags(struct Object *ob);
|
||||
void paintvert_flush_flags(struct Object *ob);
|
||||
|
||||
/* mirrtopo */
|
||||
typedef struct MirrTopoStore_t {
|
||||
intptr_t *index_lookup;
|
||||
int prev_vert_tot;
|
||||
int prev_edge_tot;
|
||||
int prev_ob_mode;
|
||||
} MirrTopoStore_t;
|
||||
|
||||
int ED_mesh_mirrtopo_recalc_check(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store);
|
||||
void ED_mesh_mirrtopo_init(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store,
|
||||
const short skip_em_vert_array_init);
|
||||
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store);
|
||||
|
||||
|
||||
/* object_vgroup.c */
|
||||
|
||||
#define WEIGHT_REPLACE 1
|
||||
#define WEIGHT_ADD 2
|
||||
#define WEIGHT_SUBTRACT 3
|
||||
@@ -215,9 +225,6 @@ void ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *
|
||||
void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum);
|
||||
float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum);
|
||||
|
||||
struct BMVert *EDBM_vert_find_nearest(struct ViewContext *vc, int *dist, short sel, short strict);
|
||||
struct BMEdge *EDBM_edge_find_nearest(struct ViewContext *vc, int *dist);
|
||||
struct BMFace *EDBM_face_find_nearest(struct ViewContext *vc, int *dist);
|
||||
|
||||
/* mesh_data.c */
|
||||
// void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
|
||||
@@ -245,25 +252,6 @@ int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob
|
||||
int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
|
||||
int ED_mesh_color_remove_named(struct bContext *C, struct Object *ob, struct Mesh *me, const char *name);
|
||||
|
||||
void EDBM_selectmode_to_scene(struct bContext *C);
|
||||
void EDBM_mesh_clear(struct BMEditMesh *em);
|
||||
|
||||
#include "../mesh/editmesh_bvh.h"
|
||||
|
||||
|
||||
/* mirrtopo */
|
||||
typedef struct MirrTopoStore_t {
|
||||
intptr_t *index_lookup;
|
||||
int prev_vert_tot;
|
||||
int prev_edge_tot;
|
||||
int prev_ob_mode;
|
||||
} MirrTopoStore_t;
|
||||
|
||||
int ED_mesh_mirrtopo_recalc_check(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store);
|
||||
void ED_mesh_mirrtopo_init(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store,
|
||||
const short skip_em_vert_array_init);
|
||||
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store);
|
||||
|
||||
/* mesh backup */
|
||||
typedef struct BMBackup {
|
||||
struct BMesh *bmcopy;
|
||||
@@ -276,6 +264,30 @@ void EDBM_redo_state_restore(struct BMBackup, struct BMEditMesh *em, int recalct
|
||||
/* delete the backup, optionally flushing it to an editmesh */
|
||||
void EDBM_redo_state_free(struct BMBackup *, struct BMEditMesh *em, int recalctess);
|
||||
|
||||
|
||||
/* meshtools.c */
|
||||
int join_mesh_exec(struct bContext *C, struct wmOperator *op);
|
||||
int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op);
|
||||
|
||||
intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, const float co[3], char mode);
|
||||
int mesh_mirrtopo_table(struct Object *ob, char mode);
|
||||
|
||||
/* retrieves mirrored cache vert, or NULL if there isn't one.
|
||||
* note: calling this without ensuring the mirror cache state
|
||||
* is bad.*/
|
||||
int mesh_get_x_mirror_vert(struct Object *ob, int index);
|
||||
struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, const float co[3], int index);
|
||||
int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em);
|
||||
|
||||
int ED_mesh_pick_vert(struct bContext *C, struct Mesh *me, const int mval[2], unsigned int *index, int size);
|
||||
int ED_mesh_pick_face(struct bContext *C, struct Mesh *me, const int mval[2], unsigned int *index, int size);
|
||||
int ED_mesh_pick_face_vert(struct bContext *C, struct Mesh *me, struct Object *ob, const int mval[2], unsigned int *index, int size);
|
||||
|
||||
#define ED_MESH_PICK_DEFAULT_VERT_SIZE 50
|
||||
#define ED_MESH_PICK_DEFAULT_FACE_SIZE 3
|
||||
|
||||
#include "../mesh/editmesh_bvh.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -169,6 +169,7 @@ int ED_operator_editlattice(struct bContext *C);
|
||||
int ED_operator_editmball(struct bContext *C);
|
||||
int ED_operator_uvedit(struct bContext *C);
|
||||
int ED_operator_uvmap(struct bContext *C);
|
||||
int ED_operator_posemode_exclusive(struct bContext *C);
|
||||
int ED_operator_posemode(struct bContext *C);
|
||||
int ED_operator_mask(struct bContext *C);
|
||||
|
||||
|
||||
@@ -123,43 +123,6 @@ void paintface_flush_flags(Object *ob)
|
||||
}
|
||||
}
|
||||
|
||||
/* returns 0 if not found, otherwise 1 */
|
||||
static int facesel_face_pick(struct bContext *C, Mesh *me, Object *ob, const int mval[2], unsigned int *index, short rect)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewContext vc;
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
|
||||
if (!me || me->totpoly == 0)
|
||||
return 0;
|
||||
|
||||
makeDerivedMesh(scene, ob, NULL, CD_MASK_BAREMESH, 0);
|
||||
|
||||
// XXX if (v3d->flag & V3D_INVALID_BACKBUF) {
|
||||
// XXX drawview.c! check_backbuf();
|
||||
// XXX persp(PERSP_VIEW);
|
||||
// XXX }
|
||||
|
||||
if (rect) {
|
||||
/* sample rect to increase changes of selecting, so that when clicking
|
||||
* on an edge in the backbuf, we can still select a face */
|
||||
|
||||
int dist;
|
||||
*index = view3d_sample_backbuf_rect(&vc, mval, 3, 1, me->totpoly + 1, &dist, 0, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
/* sample only on the exact position */
|
||||
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
|
||||
}
|
||||
|
||||
if ((*index) <= 0 || (*index) > (unsigned int)me->totpoly)
|
||||
return 0;
|
||||
|
||||
(*index)--;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void paintface_hide(Object *ob, const int unselected)
|
||||
{
|
||||
Mesh *me;
|
||||
@@ -331,7 +294,7 @@ void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2]
|
||||
if (mode == 0 || mode == 1) {
|
||||
/* XXX - Causes glitches, not sure why */
|
||||
#if 0
|
||||
if (!facesel_face_pick(C, me, mval, &index, 1))
|
||||
if (!ED_mesh_pick_face(C, me, mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE))
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
@@ -518,7 +481,7 @@ int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], in
|
||||
/* Get the face under the cursor */
|
||||
me = BKE_mesh_from_object(ob);
|
||||
|
||||
if (!facesel_face_pick(C, me, ob, mval, &index, 1))
|
||||
if (!ED_mesh_pick_face(C, me, mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE))
|
||||
return 0;
|
||||
|
||||
if (index >= me->totpoly)
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "ED_mesh.h"
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "editmesh_bvh.h" /* own include */
|
||||
|
||||
typedef struct BMBVHTree {
|
||||
BMEditMesh *em;
|
||||
@@ -394,15 +395,15 @@ int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Obje
|
||||
float co1[3], co2[3], co3[3], dir1[4], dir2[4], dir3[4];
|
||||
float origin[3], invmat[4][4];
|
||||
float epsilon = 0.01f;
|
||||
float mval_f[2], end[3];
|
||||
float end[3];
|
||||
const float mval_f[2] = {ar->winx / 2.0f,
|
||||
ar->winy / 2.0f};
|
||||
|
||||
if (!ar) {
|
||||
printf("error in BMBVH_EdgeVisible!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mval_f[0] = ar->winx / 2.0f;
|
||||
mval_f[1] = ar->winy / 2.0f;
|
||||
|
||||
ED_view3d_win_to_segment_clip(ar, v3d, mval_f, origin, end);
|
||||
|
||||
invert_m4_m4(invmat, obedit->obmat);
|
||||
|
||||
@@ -380,6 +380,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
|
||||
float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]};
|
||||
float dist = FLT_MAX;
|
||||
float d;
|
||||
int is_wire;
|
||||
|
||||
BMEditSelection ese;
|
||||
int totboundary_edge = 0;
|
||||
@@ -403,6 +404,8 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
|
||||
if (!v)
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
is_wire = BM_vert_is_wire(v);
|
||||
|
||||
e2 = NULL;
|
||||
|
||||
if (v->e) {
|
||||
@@ -430,8 +433,11 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
|
||||
* - we cant find an edge - this means we are ripping a faces vert that is connected to other
|
||||
* geometry only at the vertex.
|
||||
* - the boundary edge total is greater then 2,
|
||||
* in this case edge split _can_ work but we get far nicer results if we use this special case. */
|
||||
if (totboundary_edge > 2) {
|
||||
* in this case edge split _can_ work but we get far nicer results if we use this special case.
|
||||
* - there are only 2 edges but we are a wire vert. */
|
||||
if ((is_wire == FALSE && totboundary_edge > 2) ||
|
||||
(is_wire == TRUE && totboundary_edge > 1))
|
||||
{
|
||||
BMVert **vout;
|
||||
int vout_len;
|
||||
|
||||
@@ -459,20 +465,40 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
|
||||
dist = FLT_MAX;
|
||||
|
||||
for (i = 0; i < vout_len; i++) {
|
||||
BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
|
||||
if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
|
||||
float l_mid_co[3];
|
||||
BM_loop_calc_face_tangent(l, l_mid_co);
|
||||
|
||||
/* scale to average of surrounding edge size, only needs to be approx */
|
||||
mul_v3_fl(l_mid_co, (BM_edge_calc_length(l->e) + BM_edge_calc_length(l->prev->e)) / 2.0f);
|
||||
add_v3_v3(l_mid_co, v->co);
|
||||
if (BM_vert_is_wire(vout[i]) == FALSE) {
|
||||
/* find the best face corner */
|
||||
BM_ITER_ELEM (l, &iter, vout[i], BM_LOOPS_OF_VERT) {
|
||||
if (!BM_elem_flag_test(l->f, BM_ELEM_HIDDEN)) {
|
||||
float l_mid_co[3];
|
||||
BM_loop_calc_face_tangent(l, l_mid_co);
|
||||
|
||||
d = edbm_rip_rip_edgedist(ar, projectMat, v->co, l_mid_co, fmval);
|
||||
/* scale to average of surrounding edge size, only needs to be approx */
|
||||
mul_v3_fl(l_mid_co, (BM_edge_calc_length(l->e) + BM_edge_calc_length(l->prev->e)) / 2.0f);
|
||||
add_v3_v3(l_mid_co, v->co);
|
||||
|
||||
if (d < dist) {
|
||||
dist = d;
|
||||
vi_best = i;
|
||||
d = edbm_rip_rip_edgedist(ar, projectMat, v->co, l_mid_co, fmval);
|
||||
|
||||
if (d < dist) {
|
||||
dist = d;
|
||||
vi_best = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a wire vert, find the best edge */
|
||||
BM_ITER_ELEM (e, &iter, vout[i], BM_EDGES_OF_VERT) {
|
||||
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
|
||||
float e_mid_co[3];
|
||||
mid_v3_v3v3(e_mid_co, e->v1->co, e->v2->co);
|
||||
|
||||
d = edbm_rip_rip_edgedist(ar, projectMat, v->co, e_mid_co, fmval);
|
||||
|
||||
if (d < dist) {
|
||||
dist = d;
|
||||
vi_best = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1494,7 +1494,7 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot)
|
||||
/* ************************************************** */
|
||||
/* here actual select happens */
|
||||
/* gets called via generic mouse select operator */
|
||||
int mouse_mesh(bContext *C, const int mval[2], short extend, short deselect, short toggle)
|
||||
int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselect, short toggle)
|
||||
{
|
||||
ViewContext vc;
|
||||
BMVert *eve = NULL;
|
||||
|
||||
@@ -749,10 +749,13 @@ static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_u
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int edbm_vertex_slide_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
return edbm_vertex_slide_exec_ex(C, op, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
void MESH_OT_vert_slide(wmOperatorType *ot)
|
||||
{
|
||||
|
||||
@@ -751,10 +751,8 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
|
||||
float nor[3] = {0.0, 0.0, 0.0};
|
||||
|
||||
/* 2D normal calc */
|
||||
float mval_f[2];
|
||||
|
||||
mval_f[0] = (float)event->mval[0];
|
||||
mval_f[1] = (float)event->mval[1];
|
||||
const float mval_f[2] = {(float)event->mval[0],
|
||||
(float)event->mval[1]};
|
||||
|
||||
/* check for edges that are half selected, use for rotation */
|
||||
done = FALSE;
|
||||
|
||||
@@ -1063,7 +1063,7 @@ void EDBM_verts_mirror_cache_begin(BMEditMesh *em, const short use_select)
|
||||
int li, topo = 0;
|
||||
|
||||
/* one or the other is used depending if topo is enabled */
|
||||
BMBVHTree *tree = NULL;
|
||||
struct BMBVHTree *tree = NULL;
|
||||
MirrTopoStore_t mesh_topo_store = {NULL, -1, -1, -1};
|
||||
|
||||
if (me && (me->editflag & ME_EDIT_MIRROR_TOPO)) {
|
||||
|
||||
@@ -85,8 +85,6 @@ float labda_PdistVL2Dfl(const float v1[3], const float v2[3], const float v3[3])
|
||||
|
||||
/* ******************** editface.c */
|
||||
|
||||
void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc);
|
||||
|
||||
void MESH_OT_separate(struct wmOperatorType *ot);
|
||||
|
||||
/* ******************* editmesh_add.c */
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
@@ -877,7 +878,7 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char m
|
||||
return 0;
|
||||
}
|
||||
|
||||
MirrTopoStore_t mesh_topo_store = {NULL, -1. - 1, -1};
|
||||
static MirrTopoStore_t mesh_topo_store = {NULL, -1. - 1, -1};
|
||||
|
||||
/* mode is 's' start, or 'e' end, or 'u' use */
|
||||
/* if end, ob can be NULL */
|
||||
@@ -1146,3 +1147,125 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em)
|
||||
|
||||
return mirrorfaces;
|
||||
}
|
||||
|
||||
/* selection, vertex and face */
|
||||
/* returns 0 if not found, otherwise 1 */
|
||||
|
||||
/**
|
||||
* Face selection in object mode,
|
||||
* currently only weight-paint and vertex-paint use this.
|
||||
*
|
||||
* \return boolean TRUE == Found
|
||||
*/
|
||||
int ED_mesh_pick_face(bContext *C, Mesh *me, const int mval[2], unsigned int *index, int size)
|
||||
{
|
||||
ViewContext vc;
|
||||
|
||||
if (!me || me->totpoly == 0)
|
||||
return 0;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
|
||||
if (size) {
|
||||
/* sample rect to increase chances of selecting, so that when clicking
|
||||
* on an edge in the backbuf, we can still select a face */
|
||||
|
||||
int dummy_dist;
|
||||
*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totpoly + 1, &dummy_dist, 0, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
/* sample only on the exact position */
|
||||
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
|
||||
}
|
||||
|
||||
if ((*index) <= 0 || (*index) > (unsigned int)me->totpoly)
|
||||
return 0;
|
||||
|
||||
(*index)--;
|
||||
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* Use when the back buffer stores face index values. but we want a vert.
|
||||
* This gets the face then finds the closest vertex to mval.
|
||||
*/
|
||||
int ED_mesh_pick_face_vert(bContext *C, Mesh *me, Object *ob, const int mval[2], unsigned int *index, int size)
|
||||
{
|
||||
unsigned int poly_index;
|
||||
|
||||
if (ED_mesh_pick_face(C, me, mval, &poly_index, size)) {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
struct ARegion *ar = CTX_wm_region(C);
|
||||
|
||||
/* derived mesh to find deformed locations */
|
||||
DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
|
||||
int v_idx_best = -1;
|
||||
|
||||
if (dm->getVertCo) {
|
||||
/* find the vert closest to 'mval' */
|
||||
const float mval_f[2] = {(float)mval[0],
|
||||
(float)mval[1]};
|
||||
MPoly *mp = &me->mpoly[poly_index];
|
||||
int fidx;
|
||||
float len_best = FLT_MAX;
|
||||
|
||||
fidx = mp->totloop - 1;
|
||||
do {
|
||||
float co[3], sco[2], len;
|
||||
const int v_idx = me->mloop[mp->loopstart + fidx].v;
|
||||
dm->getVertCo(dm, v_idx, co);
|
||||
mul_m4_v3(ob->obmat, co);
|
||||
project_float_noclip(ar, co, sco);
|
||||
len = len_squared_v2v2(mval_f, sco);
|
||||
if (len < len_best) {
|
||||
len_best = len;
|
||||
v_idx_best = v_idx;
|
||||
}
|
||||
} while (fidx--);
|
||||
}
|
||||
|
||||
dm->release(dm);
|
||||
|
||||
if (v_idx_best != -1) {
|
||||
*index = v_idx_best;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vertex selection in object mode,
|
||||
* currently only weight paint uses this.
|
||||
*
|
||||
* \return boolean TRUE == Found
|
||||
*/
|
||||
int ED_mesh_pick_vert(bContext *C, Mesh *me, const int mval[2], unsigned int *index, int size)
|
||||
{
|
||||
ViewContext vc;
|
||||
|
||||
if (!me || me->totvert == 0)
|
||||
return 0;
|
||||
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
|
||||
if (size > 0) {
|
||||
/* sample rect to increase chances of selecting, so that when clicking
|
||||
* on an face in the backbuf, we can still select a vert */
|
||||
|
||||
int dummy_dist;
|
||||
*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totvert + 1, &dummy_dist, 0, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
/* sample only on the exact position */
|
||||
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
|
||||
}
|
||||
|
||||
if ((*index) <= 0 || (*index) > (unsigned int)me->totvert)
|
||||
return 0;
|
||||
|
||||
(*index)--;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1185,7 +1185,7 @@ void POSE_OT_constraints_clear(wmOperatorType *ot)
|
||||
|
||||
/* callbacks */
|
||||
ot->exec = pose_constraints_clear_exec;
|
||||
ot->poll = ED_operator_posemode; // XXX - do we want to ensure there are selected bones too?
|
||||
ot->poll = ED_operator_posemode_exclusive; // XXX - do we want to ensure there are selected bones too?
|
||||
}
|
||||
|
||||
|
||||
@@ -1266,7 +1266,7 @@ void POSE_OT_constraints_copy(wmOperatorType *ot)
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = pose_constraint_copy_exec;
|
||||
ot->poll = ED_operator_posemode;
|
||||
ot->poll = ED_operator_posemode_exclusive;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
@@ -1661,7 +1661,7 @@ void POSE_OT_constraint_add(wmOperatorType *ot)
|
||||
/* api callbacks */
|
||||
ot->invoke = WM_menu_invoke;
|
||||
ot->exec = pose_constraint_add_exec;
|
||||
ot->poll = ED_operator_posemode;
|
||||
ot->poll = ED_operator_posemode_exclusive;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
@@ -1680,7 +1680,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
|
||||
/* api callbacks */
|
||||
ot->invoke = WM_menu_invoke;
|
||||
ot->exec = pose_constraint_add_exec;
|
||||
ot->poll = ED_operator_posemode;
|
||||
ot->poll = ED_operator_posemode_exclusive;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
@@ -1766,7 +1766,7 @@ void POSE_OT_ik_add(wmOperatorType *ot)
|
||||
/* api callbacks */
|
||||
ot->invoke = pose_ik_add_invoke;
|
||||
ot->exec = pose_ik_add_exec;
|
||||
ot->poll = ED_operator_posemode;
|
||||
ot->poll = ED_operator_posemode_exclusive;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
@@ -1816,7 +1816,7 @@ void POSE_OT_ik_clear(wmOperatorType *ot)
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = pose_ik_clear_exec;
|
||||
ot->poll = ED_operator_posemode;
|
||||
ot->poll = ED_operator_posemode_exclusive;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
@@ -3540,7 +3540,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
|
||||
switch (pset->brushtype) {
|
||||
case PE_BRUSH_COMB:
|
||||
{
|
||||
float mval_f[2];
|
||||
const float mval_f[2] = {dx, dy};
|
||||
data.mval= mval;
|
||||
data.rad= (float)brush->size;
|
||||
|
||||
@@ -3552,8 +3552,6 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
|
||||
|
||||
invert_m4_m4(ob->imat, ob->obmat);
|
||||
|
||||
mval_f[0]= dx;
|
||||
mval_f[1]= dy;
|
||||
ED_view3d_win_to_delta(ar, mval_f, vec);
|
||||
data.dvec= vec;
|
||||
|
||||
|
||||
@@ -349,6 +349,29 @@ int ED_operator_editarmature(bContext *C)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief check for pose mode (no mixed modes)
|
||||
*
|
||||
* We wan't to enable most pose operations in weight paint mode,
|
||||
* when it comes to transforming bones, but managing bomes layers/groups
|
||||
* can be left for pose mode only. (not weight paint mode)
|
||||
*/
|
||||
int ED_operator_posemode_exclusive(bContext *C)
|
||||
{
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
|
||||
if (obact && !(obact->mode & OB_MODE_EDIT)) {
|
||||
Object *obpose;
|
||||
if ((obpose = BKE_object_pose_armature_get(obact))) {
|
||||
if (obact == obpose) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ED_operator_posemode(bContext *C)
|
||||
{
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
|
||||
@@ -159,14 +159,12 @@ float paint_calc_object_space_radius(ViewContext *vc, const float center[3],
|
||||
{
|
||||
Object *ob = vc->obact;
|
||||
float delta[3], scale, loc[3];
|
||||
float mval_f[2];
|
||||
const float mval_f[2] = {pixel_radius, 0.0f};
|
||||
|
||||
mul_v3_m4v3(loc, ob->obmat, center);
|
||||
|
||||
initgrabz(vc->rv3d, loc[0], loc[1], loc[2]);
|
||||
|
||||
mval_f[0] = pixel_radius;
|
||||
mval_f[1] = 0.0f;
|
||||
ED_view3d_win_to_delta(vc->ar, mval_f, delta);
|
||||
|
||||
scale = fabsf(mat4_to_scale(ob->obmat));
|
||||
|
||||
@@ -1009,52 +1009,34 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
me = BKE_mesh_from_object(vc.obact);
|
||||
|
||||
if (me && me->dvert && vc.v3d && vc.rv3d) {
|
||||
int index;
|
||||
const int use_vert_sel = (me->editflag & ME_EDIT_VERT_SEL) != 0;
|
||||
int v_idx_best = -1;
|
||||
unsigned int index;
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
index = view3d_sample_backbuf(&vc, event->mval[0], event->mval[1]);
|
||||
|
||||
if (index && index <= me->totpoly) {
|
||||
DerivedMesh *dm = mesh_get_derived_final(vc.scene, vc.obact, CD_MASK_BAREMESH);
|
||||
|
||||
if (dm->getVertCo == NULL) {
|
||||
if (use_vert_sel) {
|
||||
if (ED_mesh_pick_vert(C, me, event->mval, &index, ED_MESH_PICK_DEFAULT_VERT_SIZE)) {
|
||||
v_idx_best = index;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ED_mesh_pick_face_vert(C, me, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE)) {
|
||||
v_idx_best = index;
|
||||
}
|
||||
else if (ED_mesh_pick_face(C, me, event->mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE)) {
|
||||
/* this relies on knowning the internal worksings of ED_mesh_pick_face_vert() */
|
||||
BKE_report(op->reports, RPT_WARNING, "The modifier used does not support deformed locations");
|
||||
}
|
||||
else {
|
||||
MPoly *mp = ((MPoly *)me->mpoly) + (index - 1);
|
||||
const int vgroup_active = vc.obact->actdef - 1;
|
||||
Scene *scene = vc.scene;
|
||||
ToolSettings *ts = vc.scene->toolsettings;
|
||||
Brush *brush = paint_brush(&ts->wpaint->paint);
|
||||
float mval_f[2];
|
||||
int v_idx_best = -1;
|
||||
int fidx;
|
||||
float len_best = FLT_MAX;
|
||||
}
|
||||
|
||||
mval_f[0] = (float)event->mval[0];
|
||||
mval_f[1] = (float)event->mval[1];
|
||||
|
||||
fidx = mp->totloop - 1;
|
||||
do {
|
||||
float co[3], sco[3], len;
|
||||
const int v_idx = me->mloop[mp->loopstart + fidx].v;
|
||||
dm->getVertCo(dm, v_idx, co);
|
||||
project_float_noclip(vc.ar, co, sco);
|
||||
len = len_squared_v2v2(mval_f, sco);
|
||||
if (len < len_best) {
|
||||
len_best = len;
|
||||
v_idx_best = v_idx;
|
||||
}
|
||||
} while (fidx--);
|
||||
|
||||
if (v_idx_best != -1) { /* should always be valid */
|
||||
float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
|
||||
BKE_brush_weight_set(scene, brush, vgroup_weight);
|
||||
change = TRUE;
|
||||
}
|
||||
}
|
||||
dm->release(dm);
|
||||
if (v_idx_best != -1) { /* should always be valid */
|
||||
ToolSettings *ts = vc.scene->toolsettings;
|
||||
Brush *brush = paint_brush(&ts->wpaint->paint);
|
||||
const int vgroup_active = vc.obact->actdef - 1;
|
||||
float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
|
||||
BKE_brush_weight_set(vc.scene, brush, vgroup_weight);
|
||||
change = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,6 +1067,20 @@ void PAINT_OT_weight_sample(wmOperatorType *ot)
|
||||
}
|
||||
|
||||
/* samples cursor location, and gives menu with vertex groups to activate */
|
||||
static int weight_paint_sample_enum_itemf__helper(const MDeformVert *dvert, const int defbase_tot, int *groups)
|
||||
{
|
||||
/* this func fills in used vgroup's */
|
||||
int found = FALSE;
|
||||
int i = dvert->totweight;
|
||||
MDeformWeight *dw;
|
||||
for (dw = dvert->dw; i > 0; dw++, i--) {
|
||||
if (dw->def_nr < defbase_tot) {
|
||||
groups[dw->def_nr] = TRUE;
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
|
||||
{
|
||||
if (C) {
|
||||
@@ -1096,56 +1092,57 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
me = BKE_mesh_from_object(vc.obact);
|
||||
|
||||
if (me && me->dvert && vc.v3d && vc.rv3d) {
|
||||
int index;
|
||||
if (me && me->dvert && vc.v3d && vc.rv3d && vc.obact->defbase.first) {
|
||||
const int defbase_tot = BLI_countlist(&vc.obact->defbase);
|
||||
const int use_vert_sel = (me->editflag & ME_EDIT_VERT_SEL) != 0;
|
||||
int *groups = MEM_callocN(defbase_tot * sizeof(int), "groups");
|
||||
int found = FALSE;
|
||||
unsigned int index;
|
||||
|
||||
int mval[2] = {win->eventstate->x - vc.ar->winrct.xmin,
|
||||
win->eventstate->y - vc.ar->winrct.ymin};
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
index = view3d_sample_backbuf(&vc, win->eventstate->x - vc.ar->winrct.xmin, win->eventstate->y - vc.ar->winrct.ymin);
|
||||
|
||||
if (index && index <= me->totpoly) {
|
||||
const int defbase_tot = BLI_countlist(&vc.obact->defbase);
|
||||
if (defbase_tot) {
|
||||
MPoly *mp = ((MPoly *)me->mpoly) + (index - 1);
|
||||
if (use_vert_sel) {
|
||||
if (ED_mesh_pick_vert(C, me, mval, &index, ED_MESH_PICK_DEFAULT_VERT_SIZE)) {
|
||||
MDeformVert *dvert = &me->dvert[index];
|
||||
found |= weight_paint_sample_enum_itemf__helper(dvert, defbase_tot, groups);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ED_mesh_pick_face(C, me, mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE)) {
|
||||
MPoly *mp = &me->mpoly[index];
|
||||
unsigned int fidx = mp->totloop - 1;
|
||||
int *groups = MEM_callocN(defbase_tot * sizeof(int), "groups");
|
||||
int found = FALSE;
|
||||
|
||||
do {
|
||||
MDeformVert *dvert = me->dvert + me->mloop[mp->loopstart + fidx].v;
|
||||
int i = dvert->totweight;
|
||||
MDeformWeight *dw;
|
||||
for (dw = dvert->dw; i > 0; dw++, i--) {
|
||||
if (dw->def_nr < defbase_tot) {
|
||||
groups[dw->def_nr] = TRUE;
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
MDeformVert *dvert = &me->dvert[me->mloop[mp->loopstart + fidx].v];
|
||||
found |= weight_paint_sample_enum_itemf__helper(dvert, defbase_tot, groups);
|
||||
} while (fidx--);
|
||||
}
|
||||
}
|
||||
|
||||
if (found == FALSE) {
|
||||
MEM_freeN(groups);
|
||||
}
|
||||
else {
|
||||
EnumPropertyItem *item = NULL, item_tmp = {0};
|
||||
int totitem = 0;
|
||||
int i = 0;
|
||||
bDeformGroup *dg;
|
||||
for (dg = vc.obact->defbase.first; dg && i < defbase_tot; i++, dg = dg->next) {
|
||||
if (groups[i]) {
|
||||
item_tmp.identifier = item_tmp.name = dg->name;
|
||||
item_tmp.value = i;
|
||||
RNA_enum_item_add(&item, &totitem, &item_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
RNA_enum_item_end(&item, &totitem);
|
||||
*free = 1;
|
||||
|
||||
MEM_freeN(groups);
|
||||
return item;
|
||||
if (found == FALSE) {
|
||||
MEM_freeN(groups);
|
||||
}
|
||||
else {
|
||||
EnumPropertyItem *item = NULL, item_tmp = {0};
|
||||
int totitem = 0;
|
||||
int i = 0;
|
||||
bDeformGroup *dg;
|
||||
for (dg = vc.obact->defbase.first; dg && i < defbase_tot; i++, dg = dg->next) {
|
||||
if (groups[i]) {
|
||||
item_tmp.identifier = item_tmp.name = dg->name;
|
||||
item_tmp.value = i;
|
||||
RNA_enum_item_add(&item, &totitem, &item_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
RNA_enum_item_end(&item, &totitem);
|
||||
*free = 1;
|
||||
|
||||
MEM_freeN(groups);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3074,12 +3074,12 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
|
||||
/* BMESH ONLY --- at some point we should move sculpt code to use polygons only - but for now it needs tessfaces */
|
||||
BKE_mesh_tessface_ensure(me);
|
||||
|
||||
/* needs to be called after we ensure tessface */
|
||||
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
|
||||
|
||||
if (!mmd) ss->kb = ob_get_keyblock(ob);
|
||||
else ss->kb = NULL;
|
||||
|
||||
/* needs to be called after we ensure tessface */
|
||||
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
|
||||
|
||||
if (mmd) {
|
||||
ss->multires = mmd;
|
||||
ss->totvert = dm->getNumVerts(dm);
|
||||
|
||||
@@ -1389,14 +1389,17 @@ unsigned int view3d_sample_backbuf(ViewContext *vc, int x, int y)
|
||||
{
|
||||
unsigned int col;
|
||||
|
||||
if (x >= vc->ar->winx || y >= vc->ar->winy) return 0;
|
||||
if (x >= vc->ar->winx || y >= vc->ar->winy) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
x += vc->ar->winrct.xmin;
|
||||
y += vc->ar->winrct.ymin;
|
||||
|
||||
view3d_validate_backbuf(vc);
|
||||
|
||||
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
|
||||
glReadBuffer(GL_BACK);
|
||||
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
|
||||
glReadBuffer(GL_BACK);
|
||||
|
||||
if (ENDIAN_ORDER == B_ENDIAN) {
|
||||
BLI_endian_switch_uint32(&col);
|
||||
|
||||
@@ -475,8 +475,8 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
{
|
||||
/* for dolly */
|
||||
float mval_f[2];
|
||||
VECCOPY2D(mval_f, event->mval);
|
||||
const float mval_f[2] = {(float)event->mval[0],
|
||||
(float)event->mval[1]};
|
||||
ED_view3d_win_to_vector(vod->ar, mval_f, vod->mousevec);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,8 @@ int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int m
|
||||
initgrabz(vc->rv3d, fp[0], fp[1], fp[2]);
|
||||
|
||||
if (mval_cpy[0] != IS_CLIPPED) {
|
||||
float mval_f[2];
|
||||
VECSUB2D(mval_f, mval_cpy, mval);
|
||||
const float mval_f[2] = {(float)(mval_cpy[0] - mval[0]),
|
||||
(float)(mval_cpy[1] - mval[1])};
|
||||
ED_view3d_win_to_delta(vc->ar, mval_f, dvec);
|
||||
sub_v3_v3(fp, dvec);
|
||||
|
||||
@@ -2027,36 +2027,6 @@ void VIEW3D_OT_select_border(wmOperatorType *ot)
|
||||
WM_operator_properties_gesture_border(ot, TRUE);
|
||||
}
|
||||
|
||||
/* much like facesel_face_pick()*/
|
||||
/* returns 0 if not found, otherwise 1 */
|
||||
static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], unsigned int *index, int size)
|
||||
{
|
||||
ViewContext vc;
|
||||
view3d_set_viewcontext(C, &vc);
|
||||
|
||||
if (!me || me->totvert == 0)
|
||||
return 0;
|
||||
|
||||
if (size > 0) {
|
||||
/* sample rect to increase changes of selecting, so that when clicking
|
||||
* on an face in the backbuf, we can still select a vert */
|
||||
|
||||
int dist;
|
||||
*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totvert + 1, &dist, 0, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
/* sample only on the exact position */
|
||||
*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
|
||||
}
|
||||
|
||||
if ((*index) <= 0 || (*index) > (unsigned int)me->totvert)
|
||||
return 0;
|
||||
|
||||
(*index)--;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* mouse selection in weight paint */
|
||||
/* gets called via generic mouse select operator */
|
||||
static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], short extend, short deselect, short toggle, Object *obact)
|
||||
@@ -2065,8 +2035,8 @@ static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], shor
|
||||
unsigned int index = 0;
|
||||
MVert *mv;
|
||||
|
||||
if (vertsel_vert_pick(C, me, mval, &index, 50)) {
|
||||
mv = me->mvert + index;
|
||||
if (ED_mesh_pick_vert(C, me, mval, &index, ED_MESH_PICK_DEFAULT_VERT_SIZE)) {
|
||||
mv = &me->mvert[index];
|
||||
if (extend) {
|
||||
mv->flag |= SELECT;
|
||||
}
|
||||
@@ -2116,7 +2086,7 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
if (obedit && object == FALSE) {
|
||||
if (obedit->type == OB_MESH)
|
||||
retval = mouse_mesh(C, event->mval, extend, deselect, toggle);
|
||||
retval = EDBM_select_pick(C, event->mval, extend, deselect, toggle);
|
||||
else if (obedit->type == OB_ARMATURE)
|
||||
retval = mouse_armature(C, event->mval, extend, deselect, toggle);
|
||||
else if (obedit->type == OB_LATTICE)
|
||||
|
||||
@@ -87,8 +87,9 @@ void view3d_operator_needs_opengl(const bContext *C)
|
||||
void view3d_region_operator_needs_opengl(wmWindow *win, ARegion *ar)
|
||||
{
|
||||
/* for debugging purpose, context should always be OK */
|
||||
if ((ar == NULL) || (ar->regiontype != RGN_TYPE_WINDOW))
|
||||
if ((ar == NULL) || (ar->regiontype != RGN_TYPE_WINDOW)) {
|
||||
printf("view3d_region_operator_needs_opengl error, wrong region\n");
|
||||
}
|
||||
else {
|
||||
RegionView3D *rv3d = ar->regiondata;
|
||||
|
||||
|
||||
@@ -164,9 +164,7 @@ static void convertViewVec2D_mask(View2D *v2d, float r_vec[3], int dx, int dy)
|
||||
void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
|
||||
{
|
||||
if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
|
||||
float mval_f[2];
|
||||
mval_f[0] = dx;
|
||||
mval_f[1] = dy;
|
||||
const float mval_f[2] = {(float)dx, (float)dy};
|
||||
ED_view3d_win_to_delta(t->ar, mval_f, r_vec);
|
||||
}
|
||||
else if (t->spacetype == SPACE_IMAGE) {
|
||||
|
||||
Reference in New Issue
Block a user