Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-01-29 07:42:19 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-01-29 07:42:19 +0400
commitfe26492538edefe60a342bce109e17b9536e5a16 (patch)
treedf81d2485abd06be9cd2f4536a661b05153dff94 /source/blender/editors
parent8f969fdc40cded16ec58f6810585411adbb5538d (diff)
parentcf9e619889fdcdc457e44d4b384cda091de55673 (diff)
Merged changes in the trunk up to revision 54171.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_markers.c4
-rw-r--r--source/blender/editors/animation/keyframing.c62
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt1
-rw-r--r--source/blender/editors/datafiles/SConscript1
-rw-r--r--source/blender/editors/include/ED_datafiles.h6
-rw-r--r--source/blender/editors/interface/interface_icons.c2
-rw-r--r--source/blender/editors/interface/interface_panel.c8
-rw-r--r--source/blender/editors/interface/interface_templates.c14
-rw-r--r--source/blender/editors/mask/mask_add.c2
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c17
-rw-r--r--source/blender/editors/object/object_edit.c7
-rw-r--r--source/blender/editors/object/object_ops.c2
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/editors/physics/rigidbody_object.c3
-rw-r--r--source/blender/editors/render/render_preview.c157
-rw-r--r--source/blender/editors/screen/screen_ops.c10
-rw-r--r--source/blender/editors/screen/screendump.c4
-rw-r--r--source/blender/editors/sound/sound_ops.c4
-rw-r--r--source/blender/editors/space_clip/clip_ops.c2
-rw-r--r--source/blender/editors/space_info/info_intern.h1
-rw-r--r--source/blender/editors/space_info/info_ops.c74
-rw-r--r--source/blender/editors/space_info/info_report.c2
-rw-r--r--source/blender/editors/space_info/space_info.c1
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c2
-rw-r--r--source/blender/editors/space_logic/logic_ops.c24
-rw-r--r--source/blender/editors/space_node/node_add.c2
-rw-r--r--source/blender/editors/space_node/node_edit.c6
-rw-r--r--source/blender/editors/space_node/node_relationships.c2
-rw-r--r--source/blender/editors/space_script/script_edit.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c12
-rw-r--r--source/blender/editors/transform/transform.c113
33 files changed, 371 insertions, 184 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index f684e57c2bc..ef1b73fc58f 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -1203,7 +1203,7 @@ static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, w
static void MARKER_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Marker Border select";
+ ot->name = "Marker Border Select";
ot->description = "Select all time markers using border selection";
ot->idname = "MARKER_OT_select_border";
@@ -1260,7 +1260,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
static void MARKER_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "(De)select all markers";
+ ot->name = "(De)select all Markers";
ot->description = "Change selection of all time markers";
ot->idname = "MARKER_OT_select_all";
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 9add193a514..64832a1311f 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -52,6 +52,7 @@
#include "DNA_material_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
+#include "DNA_rigidbody_types.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
@@ -550,11 +551,12 @@ enum {
* blocktypes, when using "standard" keying but 'Visual Keying' option in Auto-Keying
* settings is on.
*/
-static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
+static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
{
bConstraint *con = NULL;
short searchtype = VISUALKEY_NONE;
- short has_parent = FALSE;
+ bool has_rigidbody = false;
+ bool has_parent = false;
const char *identifier = NULL;
/* validate data */
@@ -569,10 +571,14 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
if (ptr->type == &RNA_Object) {
/* Object */
Object *ob = (Object *)ptr->data;
+ RigidBodyOb *rbo = ob->rigidbody_object;
con = ob->constraints.first;
identifier = RNA_property_identifier(prop);
has_parent = (ob->parent != NULL);
+
+ /* active rigidbody objects only, as only those are affected by sim */
+ has_rigidbody = ((rbo) && (rbo->type == RBO_TYPE_ACTIVE));
}
else if (ptr->type == &RNA_PoseBone) {
/* Pose Channel */
@@ -584,13 +590,13 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
}
/* check if any data to search using */
- if (ELEM(NULL, con, identifier) && (has_parent == FALSE))
- return 0;
+ if (ELEM(NULL, con, identifier) && (has_parent == false) && (has_rigidbody == false))
+ return false;
/* location or rotation identifiers only... */
if (identifier == NULL) {
printf("%s failed: NULL identifier\n", __func__);
- return 0;
+ return false;
}
else if (strstr(identifier, "location")) {
searchtype = VISUALKEY_LOC;
@@ -603,15 +609,15 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
}
else {
printf("%s failed: identifier - '%s'\n", __func__, identifier);
- return 0;
+ return false;
}
/* only search if a searchtype and initial constraint are available */
if (searchtype) {
- /* parent is always matching */
- if (has_parent)
- return 1;
+ /* parent or rigidbody are always matching */
+ if (has_parent || has_rigidbody)
+ return true;
/* constraints */
for (; con; con = con->next) {
@@ -623,48 +629,48 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
switch (con->type) {
/* multi-transform constraints */
case CONSTRAINT_TYPE_CHILDOF:
- return 1;
+ return true;
case CONSTRAINT_TYPE_TRANSFORM:
case CONSTRAINT_TYPE_TRANSLIKE:
- return 1;
+ return true;
case CONSTRAINT_TYPE_FOLLOWPATH:
- return 1;
+ return true;
case CONSTRAINT_TYPE_KINEMATIC:
- return 1;
+ return true;
/* single-transform constraits */
case CONSTRAINT_TYPE_TRACKTO:
- if (searchtype == VISUALKEY_ROT) return 1;
+ if (searchtype == VISUALKEY_ROT) return true;
break;
case CONSTRAINT_TYPE_DAMPTRACK:
- if (searchtype == VISUALKEY_ROT) return 1;
+ if (searchtype == VISUALKEY_ROT) return true;
break;
case CONSTRAINT_TYPE_ROTLIMIT:
- if (searchtype == VISUALKEY_ROT) return 1;
+ if (searchtype == VISUALKEY_ROT) return true;
break;
case CONSTRAINT_TYPE_LOCLIMIT:
- if (searchtype == VISUALKEY_LOC) return 1;
+ if (searchtype == VISUALKEY_LOC) return true;
break;
case CONSTRAINT_TYPE_SIZELIMIT:
- if (searchtype == VISUALKEY_SCA) return 1;
+ if (searchtype == VISUALKEY_SCA) return true;
break;
case CONSTRAINT_TYPE_DISTLIMIT:
- if (searchtype == VISUALKEY_LOC) return 1;
+ if (searchtype == VISUALKEY_LOC) return true;
break;
case CONSTRAINT_TYPE_ROTLIKE:
- if (searchtype == VISUALKEY_ROT) return 1;
+ if (searchtype == VISUALKEY_ROT) return true;
break;
case CONSTRAINT_TYPE_LOCLIKE:
- if (searchtype == VISUALKEY_LOC) return 1;
+ if (searchtype == VISUALKEY_LOC) return true;
break;
case CONSTRAINT_TYPE_SIZELIKE:
- if (searchtype == VISUALKEY_SCA) return 1;
+ if (searchtype == VISUALKEY_SCA) return true;
break;
case CONSTRAINT_TYPE_LOCKTRACK:
- if (searchtype == VISUALKEY_ROT) return 1;
+ if (searchtype == VISUALKEY_ROT) return true;
break;
case CONSTRAINT_TYPE_MINMAX:
- if (searchtype == VISUALKEY_LOC) return 1;
+ if (searchtype == VISUALKEY_LOC) return true;
break;
default:
@@ -673,8 +679,8 @@ static short visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
}
}
- /* when some condition is met, this function returns, so here it can be 0 */
- return 0;
+ /* when some condition is met, this function returns, so that means we've got nothing */
+ return false;
}
/* This helper function extracts the value to use for visual-keyframing
@@ -696,12 +702,12 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i
*/
if (ptr->type == &RNA_Object) {
Object *ob = (Object *)ptr->data;
-
+
/* Loc code is specific... */
if (strstr(identifier, "location")) {
return ob->obmat[3][array_index];
}
-
+
copy_m4_m4(tmat, ob->obmat);
rotmode = ob->rotmode;
}
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index e9b33a6c2a6..ed3088696b1 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -43,6 +43,7 @@ if(WITH_BLENDER)
# blends
data_to_c_simple(../../../../release/datafiles/preview.blend SRC)
+ data_to_c_simple(../../../../release/datafiles/preview_cycles.blend SRC)
# images
data_to_c_simple(../../../../release/datafiles/splash.png SRC)
diff --git a/source/blender/editors/datafiles/SConscript b/source/blender/editors/datafiles/SConscript
index 49888d573a0..fb1f9f37975 100644
--- a/source/blender/editors/datafiles/SConscript
+++ b/source/blender/editors/datafiles/SConscript
@@ -46,6 +46,7 @@ sources.extend((
os.path.join(env['DATA_SOURCES'], "startup.blend.c"),
os.path.join(env['DATA_SOURCES'], "preview.blend.c"),
+ os.path.join(env['DATA_SOURCES'], "preview_cycles.blend.c"),
os.path.join(env['DATA_SOURCES'], "add.png.c"),
os.path.join(env['DATA_SOURCES'], "blob.png.c"),
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index afe23090ae3..19552d60387 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -36,6 +36,12 @@
extern int datatoc_startup_blend_size;
extern char datatoc_startup_blend[];
+extern int datatoc_preview_blend_size;
+extern char datatoc_preview_blend[];
+
+extern int datatoc_preview_cycles_blend_size;
+extern char datatoc_preview_cycles_blend[];
+
extern int datatoc_blender_icons16_png_size;
extern char datatoc_blender_icons16_png[];
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 8b4b1752774..619fb18cd7a 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -169,7 +169,7 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs,
/* this code assumes square images */
imgsize = bbuf->x;
for (y = 0; y < size; y++) {
- memcpy(&iimg->rect[y * size], &bbuf->rect[(y + yofs) * imgsize + xofs], imgsize * sizeof(int));
+ memcpy(&iimg->rect[y * size], &bbuf->rect[(y + yofs) * imgsize + xofs], size * sizeof(int));
}
}
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 00c45e41587..c2c1de9cbd7 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -247,6 +247,14 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
}
}
+ /* Do not allow closed panels without headers! Else user could get "disappeared" UI! */
+ if ((pt->flag & PNL_NO_HEADER) && (pa->flag & PNL_CLOSED)) {
+ pa->flag &= ~PNL_CLOSED;
+ /* Force update of panels' positions! */
+ pa->sizex = 0;
+ pa->sizey = 0;
+ }
+
BLI_strncpy(pa->drawname, drawname, UI_MAX_NAME_STR);
/* if a new panel is added, we insert it right after the panel
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index ec2b4f5adf0..58d59391939 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -58,6 +58,7 @@
#include "BKE_material.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
+#include "BKE_packedFile.h"
#include "BKE_particle.h"
#include "BKE_report.h"
#include "BKE_sca.h"
@@ -546,7 +547,18 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
uiButSetFlag(but, UI_BUT_DISABLED);
}
- if (flag & UI_ID_OPEN) {
+ /* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack.
+ Only for images, sound and fonts */
+ if (id && BKE_pack_check(id)) {
+
+ but = uiDefIconButO(block, BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "Packed File");
+ uiButGetOperatorPtrRNA(but);
+
+ RNA_string_set(but->opptr, "id_name", id->name + 2);
+ RNA_int_set(but->opptr, "id_type", GS(id->name));
+
+ }
+ else if (flag & UI_ID_OPEN) {
int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
if (openop) {
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index e43c8a2b53b..77abe43bba7 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -720,7 +720,7 @@ static int add_feather_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event
void MASK_OT_add_feather_vertex(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Add feather Vertex";
+ ot->name = "Add Feather Vertex";
ot->description = "Add vertex to feather";
ot->idname = "MASK_OT_add_feather_vertex";
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 99fa85b3ee7..8d5bfe624fd 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -56,7 +56,8 @@
#include "recast-capi.h"
-static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r)
+static void createVertsTrisData(bContext *C, LinkNode *obs,
+ int *nverts_r, float **verts_r, int *ntris_r, int **tris_r, unsigned int *r_lay)
{
MVert *mvert;
int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces;
@@ -91,6 +92,8 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float
if (mf->v4)
ntris += 1;
}
+
+ *r_lay |= ob->lay;
}
/* create data */
@@ -295,7 +298,8 @@ static bool buildNavMesh(const RecastData *recastParams, int nverts, float *vert
return true;
}
-static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base *base)
+static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh,
+ Base *base, unsigned int lay)
{
float co[3], rot[3];
BMEditMesh *em;
@@ -316,7 +320,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
if (createob) {
/* create new object */
- obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1);
+ obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, lay);
}
else {
obedit = base->object;
@@ -452,15 +456,16 @@ static int navmesh_create_exec(bContext *C, wmOperator *op)
struct recast_polyMesh *pmesh = NULL;
struct recast_polyMeshDetail *dmesh = NULL;
bool ok;
+ unsigned int lay = 0;
int nverts = 0, ntris = 0;
int *tris = 0;
float *verts = NULL;
- createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris);
+ createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris, &lay);
BLI_linklist_free(obs, NULL);
if ((ok = buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh, op->reports))) {
- createRepresentation(C, pmesh, dmesh, navmeshBase);
+ createRepresentation(C, pmesh, dmesh, navmeshBase, lay);
}
MEM_freeN(verts);
@@ -478,7 +483,7 @@ static int navmesh_create_exec(bContext *C, wmOperator *op)
void MESH_OT_navmesh_make(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Create navigation mesh";
+ ot->name = "Create Navigation Mesh";
ot->description = "Create navigation mesh for selected objects";
ot->idname = "MESH_OT_navmesh_make";
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 5e5e38c3e43..4807e7364ea 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1864,9 +1864,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
ob_iter->max_vel = ob->max_vel;
ob_iter->obstacleRad = ob->obstacleRad;
ob_iter->mass = ob->mass;
- ob_iter->anisotropicFriction[0] = ob->anisotropicFriction[0];
- ob_iter->anisotropicFriction[1] = ob->anisotropicFriction[1];
- ob_iter->anisotropicFriction[2] = ob->anisotropicFriction[2];
+ copy_v3_v3(ob_iter->anisotropicFriction, ob->anisotropicFriction);
ob_iter->collision_boundtype = ob->collision_boundtype;
ob_iter->margin = ob->margin;
ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft);
@@ -1874,6 +1872,9 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
ob_iter->restrictflag |= OB_RESTRICT_RENDER;
else
ob_iter->restrictflag &= ~OB_RESTRICT_RENDER;
+
+ ob_iter->col_group = ob->col_group;
+ ob_iter->col_mask = ob->col_mask;
}
}
CTX_DATA_END;
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 5c65e543cc9..d26ea89bd1e 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -399,7 +399,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
RNA_enum_set(kmi->ptr, "type", 0); /* active */
kmi = WM_keymap_add_item(keymap, "RIGIDBODY_OT_objects_add", RKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", 1); /* passive */
- kmi = WM_keymap_add_item(keymap, "RIGIDBODY_OT_objects_remove", RKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+ WM_keymap_add_item(keymap, "RIGIDBODY_OT_objects_remove", RKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_object_specials", WKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 9749494bc66..da12db50cc5 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1069,7 +1069,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
void OBJECT_OT_track_clear(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Clear track";
+ ot->name = "Clear Track";
ot->description = "Clear tracking constraint or flag from object";
ot->idname = "OBJECT_OT_track_clear";
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index fc1e24840a4..38ed903a161 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -615,8 +615,7 @@ void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot)
ot->prop = prop = RNA_def_enum(ot->srna, "material",
DummyRNA_DEFAULT_items, 0,
"Material Preset",
- "Type of material that objects are made of. "
- "Determines material density");
+ "Type of material that objects are made of (determines material density)");
RNA_def_enum_funcs(prop, rigidbody_materials_itemf);
RNA_def_float(ot->srna, "density", 1.0, FLT_MIN, FLT_MAX,
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 25ad1f61aaf..16ebaf58a59 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -97,6 +97,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "ED_datafiles.h"
#include "ED_render.h"
#include "ED_view3d.h"
@@ -168,7 +169,8 @@ typedef struct ShaderPreview {
int sizex, sizey;
unsigned int *pr_rect;
int pr_method;
-
+
+ Main *pr_main;
} ShaderPreview;
typedef struct IconPreviewSize {
@@ -187,23 +189,33 @@ typedef struct IconPreview {
/* *************************** Preview for buttons *********************** */
static Main *pr_main = NULL;
+static Main *pr_main_cycles = NULL;
-void ED_preview_init_dbase(void)
-{
#ifndef WITH_HEADLESS
- BlendFileData *bfd;
- extern int datatoc_preview_blend_size;
- extern char datatoc_preview_blend[];
+static Main *load_main_from_memory(char *blend, int blend_size)
+{
const int fileflags = G.fileflags;
-
+ Main *bmain = NULL;
+ BlendFileData *bfd;
+
G.fileflags |= G_FILE_NO_UI;
- bfd = BLO_read_from_memory(datatoc_preview_blend, datatoc_preview_blend_size, NULL);
+ bfd = BLO_read_from_memory(blend, blend_size, NULL);
if (bfd) {
- pr_main = bfd->main;
-
+ bmain = bfd->main;
+
MEM_freeN(bfd);
}
G.fileflags = fileflags;
+
+ return bmain;
+}
+#endif
+
+void ED_preview_init_dbase(void)
+{
+#ifndef WITH_HEADLESS
+ pr_main = load_main_from_memory(datatoc_preview_blend, datatoc_preview_blend_size);
+ pr_main_cycles = load_main_from_memory(datatoc_preview_cycles_blend, datatoc_preview_cycles_blend_size);
#endif
}
@@ -211,6 +223,9 @@ void ED_preview_free_dbase(void)
{
if (pr_main)
free_main(pr_main);
+
+ if (pr_main_cycles)
+ free_main(pr_main_cycles);
}
static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
@@ -239,7 +254,7 @@ static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
return 0;
}
-static Scene *preview_get_scene(void)
+static Scene *preview_get_scene(Main *pr_main)
{
if (pr_main == NULL) return NULL;
@@ -253,8 +268,9 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
{
Scene *sce;
Base *base;
+ Main *pr_main = sp->pr_main;
- sce = preview_get_scene();
+ sce = preview_get_scene(pr_main);
if (sce) {
/* this flag tells render to not execute depsgraph or ipos etc */
@@ -299,45 +315,47 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sp->matcopy = mat;
BLI_addtail(&pr_main->mat, mat);
- init_render_material(mat, 0, NULL); /* call that retrieves mode_l */
- end_render_material(mat);
-
- /* un-useful option */
- if (sp->pr_method == PR_ICON_RENDER)
- mat->shade_flag &= ~MA_OBCOLOR;
-
- /* turn on raytracing if needed */
- if (mat->mode_l & MA_RAYMIRROR)
- sce->r.mode |= R_RAYTRACE;
- if (mat->material_type == MA_TYPE_VOLUME)
- sce->r.mode |= R_RAYTRACE;
- if ((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP))
- sce->r.mode |= R_RAYTRACE;
- if (preview_mat_has_sss(mat, NULL))
- sce->r.mode |= R_SSS;
-
- /* turn off fake shadows if needed */
- /* this only works in a specific case where the preview.blend contains
- * an object starting with 'c' which has a material linked to it (not the obdata)
- * and that material has a fake shadow texture in the active texture slot */
- for (base = sce->base.first; base; base = base->next) {
- if (base->object->id.name[2] == 'c') {
- Material *shadmat = give_current_material(base->object, base->object->actcol);
- if (shadmat) {
- if (mat->mode & MA_SHADBUF) shadmat->septex = 0;
- else shadmat->septex |= 1;
+ if (!BKE_scene_use_new_shading_nodes(scene)) {
+ init_render_material(mat, 0, NULL); /* call that retrieves mode_l */
+ end_render_material(mat);
+
+ /* un-useful option */
+ if (sp->pr_method == PR_ICON_RENDER)
+ mat->shade_flag &= ~MA_OBCOLOR;
+
+ /* turn on raytracing if needed */
+ if (mat->mode_l & MA_RAYMIRROR)
+ sce->r.mode |= R_RAYTRACE;
+ if (mat->material_type == MA_TYPE_VOLUME)
+ sce->r.mode |= R_RAYTRACE;
+ if ((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP))
+ sce->r.mode |= R_RAYTRACE;
+ if (preview_mat_has_sss(mat, NULL))
+ sce->r.mode |= R_SSS;
+
+ /* turn off fake shadows if needed */
+ /* this only works in a specific case where the preview.blend contains
+ * an object starting with 'c' which has a material linked to it (not the obdata)
+ * and that material has a fake shadow texture in the active texture slot */
+ for (base = sce->base.first; base; base = base->next) {
+ if (base->object->id.name[2] == 'c') {
+ Material *shadmat = give_current_material(base->object, base->object->actcol);
+ if (shadmat) {
+ if (mat->mode & MA_SHADBUF) shadmat->septex = 0;
+ else shadmat->septex |= 1;
+ }
}
}
- }
-
- /* turn off bounce lights for volume,
- * doesn't make much visual difference and slows it down too */
- if (mat->material_type == MA_TYPE_VOLUME) {
- for (base = sce->base.first; base; base = base->next) {
- if (base->object->type == OB_LAMP) {
- /* if doesn't match 'Lamp.002' --> main key light */
- if (strcmp(base->object->id.name + 2, "Lamp.002") != 0) {
- base->object->restrictflag |= OB_RESTRICT_RENDER;
+
+ /* turn off bounce lights for volume,
+ * doesn't make much visual difference and slows it down too */
+ if (mat->material_type == MA_TYPE_VOLUME) {
+ for (base = sce->base.first; base; base = base->next) {
+ if (base->object->type == OB_LAMP) {
+ /* if doesn't match 'Lamp.002' --> main key light */
+ if (strcmp(base->object->id.name + 2, "Lamp.002") != 0) {
+ base->object->restrictflag |= OB_RESTRICT_RENDER;
+ }
}
}
}
@@ -432,19 +450,21 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sp->lampcopy = la;
BLI_addtail(&pr_main->lamp, la);
}
-
- if (la && la->type == LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
- sce->lay = 1 << MA_ATMOS;
- sce->world = scene->world;
- sce->camera = (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name) + 2);
- }
- else {
- sce->lay = 1 << MA_LAMP;
- sce->world = NULL;
- sce->camera = (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name) + 2);
+
+ sce->lay = 1 << MA_LAMP;
+
+ if (!BKE_scene_use_new_shading_nodes(scene)) {
+ if (la && la->type == LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
+ sce->lay = 1 << MA_ATMOS;
+ sce->world = scene->world;
+ sce->camera = (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name) + 2);
+ }
+ else {
+ sce->world = NULL;
+ sce->camera = (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name) + 2);
+ }
}
- sce->r.mode &= ~R_SHADOW;
-
+
for (base = sce->base.first; base; base = base->next) {
if (base->object->id.name[2] == 'p') {
if (base->object->type == OB_LAMP)
@@ -639,6 +659,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
short idtype = GS(id->name);
char name[32];
int sizex;
+ Main *pr_main = sp->pr_main;
/* in case of split preview, use border render */
if (split) {
@@ -648,7 +669,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
else sizex = sp->sizex;
/* we have to set preview variables first */
- sce = preview_get_scene();
+ sce = preview_get_scene(pr_main);
if (sce) {
sce->r.xsch = sizex;
sce->r.ysch = sp->sizey;
@@ -749,6 +770,7 @@ static void shader_preview_startjob(void *customdata, short *stop, short *do_upd
static void shader_preview_free(void *customdata)
{
ShaderPreview *sp = customdata;
+ Main *pr_main = sp->pr_main;
if (sp->matcopy) {
struct IDProperty *properties;
@@ -1076,13 +1098,14 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
Object *ob = CTX_data_active_object(C);
wmJob *wm_job;
ShaderPreview *sp;
+ Scene *scene = CTX_data_scene(C);
wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview",
WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
sp = MEM_callocN(sizeof(ShaderPreview), "shader preview");
/* customdata for preview thread */
- sp->scene = CTX_data_scene(C);
+ sp->scene = scene;
sp->owner = owner;
sp->sizex = sizex;
sp->sizey = sizey;
@@ -1090,6 +1113,14 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
sp->id = id;
sp->parent = parent;
sp->slot = slot;
+
+ /* hardcoded preview .blend for cycles/internal, this should be solved
+ * once with custom preview .blend path for external engines */
+ if (BKE_scene_use_new_shading_nodes(scene))
+ sp->pr_main = pr_main_cycles;
+ else
+ sp->pr_main = pr_main;
+
if (ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
else sp->col[0] = sp->col[1] = sp->col[2] = sp->col[3] = 1.0f;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index a22faea9eec..e7f5e57552c 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -729,7 +729,7 @@ static int actionzone_cancel(bContext *UNUSED(C), wmOperator *op)
static void SCREEN_OT_actionzone(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Handle area action zones";
+ ot->name = "Handle Area Action Zones";
ot->description = "Handle area action zones for mouse actions/gestures";
ot->idname = "SCREEN_OT_actionzone";
@@ -851,7 +851,7 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
static void SCREEN_OT_area_swap(wmOperatorType *ot)
{
- ot->name = "Swap areas";
+ ot->name = "Swap Areas";
ot->description = "Swap selected areas screen positions";
ot->idname = "SCREEN_OT_area_swap";
@@ -1169,7 +1169,7 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
static void SCREEN_OT_area_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Move area edges";
+ ot->name = "Move Area Edges";
ot->description = "Move selected area edges";
ot->idname = "SCREEN_OT_area_move";
@@ -2568,7 +2568,7 @@ static int spacedata_cleanup(bContext *C, wmOperator *op)
static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Clean-up space-data";
+ ot->name = "Clean-up Space-data";
ot->description = "Remove unused settings for invisible editors";
ot->idname = "SCREEN_OT_spacedata_cleanup";
@@ -3368,7 +3368,7 @@ static int border_select_do(bContext *C, wmOperator *op)
static void SCREEN_OT_border_select(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Border select";
+ ot->name = "Border Select";
ot->idname = "SCREEN_OT_border_select";
/* api callbacks */
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 1763e62582a..efd0db3b442 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -272,7 +272,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE, FILE_SPECIAL, FILE_SAVE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
- RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screenshot the whole Blender window");
+ RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Capture the whole window. Otherwise only capture the active area");
}
/* *************** screenshot movie job ************************* */
@@ -500,5 +500,5 @@ void SCREEN_OT_screencast(wmOperatorType *ot)
ot->flag = 0;
RNA_def_property(ot->srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Screencast the whole Blender window");
+ RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "Capture the whole window. Otherwise only capture the active area");
}
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index aaa1328f9f6..eb138bfeeef 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -264,7 +264,7 @@ static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
*/
/* identifiers */
- ot->name = "Update animation";
+ ot->name = "Update Animation";
ot->description = "Update animation flags";
ot->idname = "SOUND_OT_update_animation_flags";
@@ -300,7 +300,7 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
static void SOUND_OT_bake_animation(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Update animation cache";
+ ot->name = "Update Animation Cache";
ot->description = "Update the audio animation cache";
ot->idname = "SOUND_OT_bake_animation";
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 26bae6e3978..cf4e76a8427 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -908,7 +908,7 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
void CLIP_OT_change_frame(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Change frame";
+ ot->name = "Change Frame";
ot->idname = "CLIP_OT_change_frame";
ot->description = "Interactively change the current frame number";
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h
index 62e9a3a7f73..b5426fe15e1 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@ -39,6 +39,7 @@ struct ReportList;
void FILE_OT_pack_all(struct wmOperatorType *ot);
void FILE_OT_unpack_all(struct wmOperatorType *ot);
+void FILE_OT_unpack_item(struct wmOperatorType *ot);
void FILE_OT_pack_libraries(struct wmOperatorType *ot);
void FILE_OT_unpack_libraries(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 104349e172a..663d136fdf2 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -46,9 +46,11 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
+#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_packedFile.h"
#include "BKE_report.h"
+#include "BKE_screen.h"
#include "WM_api.h"
@@ -249,6 +251,78 @@ void FILE_OT_unpack_all(wmOperatorType *ot)
RNA_def_enum(ot->srna, "method", unpack_all_method_items, PF_USE_LOCAL, "Method", "How to unpack");
}
+/********************* unpack single item operator *********************/
+
+static const EnumPropertyItem unpack_item_method_items[] = {
+ {PF_USE_LOCAL, "USE_LOCAL", 0, "Use file from current directory (create when necessary)", ""},
+ {PF_WRITE_LOCAL, "WRITE_LOCAL", 0, "Write file to current directory (overwrite existing file)", ""},
+ {PF_USE_ORIGINAL, "USE_ORIGINAL", 0, "Use file in original location (create when necessary)", ""},
+ {PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write file to original location (overwrite existing file)", ""},
+ /* {PF_ASK, "ASK", 0, "Ask for each file", ""}, */
+ {0, NULL, 0, NULL, NULL}};
+
+
+static int unpack_item_exec(bContext *C, wmOperator *op)
+{
+ Main *bmain = CTX_data_main(C);
+ ID *id;
+ char idname[BKE_ST_MAXNAME];
+ int type = RNA_int_get(op->ptr, "id_type");
+ int method = RNA_enum_get(op->ptr, "method");
+
+ RNA_string_get(op->ptr, "id_name", idname);
+ id = BKE_libblock_find_name(type, idname);
+
+ if (id == NULL) {
+ BKE_report(op->reports, RPT_WARNING, "No packed file");
+ return OPERATOR_CANCELLED;
+ }
+
+ if (method != PF_KEEP)
+ BKE_unpack_id(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */
+
+ G.fileflags &= ~G_AUTOPACK;
+
+ return OPERATOR_FINISHED;
+}
+
+static int unpack_item_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+ uiPopupMenu *pup;
+ uiLayout *layout;
+
+ pup = uiPupMenuBegin(C, "Unpack", ICON_NONE);
+ layout = uiPupMenuLayout(pup);
+
+ uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
+ uiItemsFullEnumO(layout, op->type->idname, "method", op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
+
+ uiPupMenuEnd(C, pup);
+
+ return OPERATOR_CANCELLED;
+}
+
+void FILE_OT_unpack_item(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Unpack Item";
+ ot->idname = "FILE_OT_unpack_item";
+ ot->description = "Unpack this file to an external file";
+
+ /* api callbacks */
+ ot->exec = unpack_item_exec;
+ ot->invoke = unpack_item_invoke;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_enum(ot->srna, "method", unpack_item_method_items, PF_USE_LOCAL, "Method", "How to unpack");
+ RNA_def_string(ot->srna, "id_name", "", BKE_ST_MAXNAME, "ID name", "Name of ID block to unpack");
+ RNA_def_int(ot->srna, "id_type", 0, 0, INT_MAX, "ID Type", "Identifier type of ID block", 0, INT_MAX);
+}
+
+
/********************* make paths relative operator *********************/
static int make_paths_relative_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index 023ffa50272..3050563e538 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -148,7 +148,7 @@ static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
void INFO_OT_select_pick(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Select report";
+ ot->name = "Select Report";
ot->description = "Select reports by index";
ot->idname = "INFO_OT_select_pick";
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 60b04f7b029..1577ac338e7 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -180,6 +180,7 @@ static void info_operatortypes(void)
WM_operatortype_append(FILE_OT_pack_all);
WM_operatortype_append(FILE_OT_pack_libraries);
WM_operatortype_append(FILE_OT_unpack_all);
+ WM_operatortype_append(FILE_OT_unpack_item);
WM_operatortype_append(FILE_OT_unpack_libraries);
WM_operatortype_append(FILE_OT_make_paths_relative);
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index e898a1baf74..a55da0e3b2c 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -145,7 +145,7 @@ void LOGIC_OT_links_cut(wmOperatorType *ot)
{
PropertyRNA *prop;
- ot->name = "Cut links";
+ ot->name = "Cut Links";
ot->idname = "LOGIC_OT_links_cut";
ot->description = "Remove logic brick connections";
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
index f28757bb431..2313885dbaf 100644
--- a/source/blender/editors/space_logic/logic_ops.c
+++ b/source/blender/editors/space_logic/logic_ops.c
@@ -330,8 +330,10 @@ static void LOGIC_OT_sensor_add(wmOperatorType *ot)
/* properties */
ot->prop = prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
RNA_def_enum_funcs(prop, rna_Sensor_type_itemf);
- RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Sensor to add");
- RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Sensor to");
+ prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Sensor to add");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Sensor to");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ************* Add/Remove Controller Operator ************* */
@@ -423,16 +425,14 @@ static int controller_add_exec(bContext *C, wmOperator *op)
ob->scaflag |= OB_SHOWCONT;
WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- /* prevent the operator to get stuck with the "object" of the previous call -
- * it only happens when it's called from the "smart controller", see bug #54102 */
- RNA_string_set(op->ptr, "object", "");
return OPERATOR_FINISHED;
}
static void LOGIC_OT_controller_add(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Add Controller";
ot->description = "Add a controller to the active object";
@@ -448,8 +448,10 @@ static void LOGIC_OT_controller_add(wmOperatorType *ot)
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add");
- RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Controller to add");
- RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Controller to");
+ prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Controller to add");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Controller to");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ************* Add/Remove Actuator Operator ************* */
@@ -551,8 +553,10 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot)
/* properties */
ot->prop = prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
RNA_def_enum_funcs(prop, rna_Actuator_type_itemf);
- RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Actuator to add");
- RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Actuator to");
+ prop = RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Actuator to add");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Actuator to");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ************* Move Logic Bricks Operator ************* */
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 18ce2c81716..b47be150417 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -305,7 +305,7 @@ void NODE_OT_add_reroute(wmOperatorType *ot)
{
PropertyRNA *prop;
- ot->name = "Add reroute";
+ ot->name = "Add Reroute";
ot->idname = "NODE_OT_add_reroute";
ot->invoke = WM_gesture_lines_invoke;
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 2fae92d674c..321eaa32e80 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1749,7 +1749,7 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_delete_reconnect(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Delete with reconnect";
+ ot->name = "Delete with Reconnect";
ot->description = "Delete nodes; will reconnect nodes as if deletion was muted";
ot->idname = "NODE_OT_delete_reconnect";
@@ -2031,7 +2031,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op))
void NODE_OT_clipboard_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Copy to clipboard";
+ ot->name = "Copy to Clipboard";
ot->description = "Copies selected nodes to the clipboard";
ot->idname = "NODE_OT_clipboard_copy";
@@ -2152,7 +2152,7 @@ static int node_clipboard_paste_invoke(bContext *C, wmOperator *op, wmEvent *eve
void NODE_OT_clipboard_paste(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Paste from clipboard";
+ ot->name = "Paste from Clipboard";
ot->description = "Pastes nodes from the clipboard to the active node tree";
ot->idname = "NODE_OT_clipboard_paste";
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 7fa48c48ad6..8d7eef22822 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -876,7 +876,7 @@ void NODE_OT_links_cut(wmOperatorType *ot)
{
PropertyRNA *prop;
- ot->name = "Cut links";
+ ot->name = "Cut Links";
ot->idname = "NODE_OT_links_cut";
ot->description = "Use the mouse to cut (remove) some links";
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 4e6783e1862..96008004ee4 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -71,7 +71,7 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
void SCRIPT_OT_python_file_run(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Run python file";
+ ot->name = "Run Python File";
ot->description = "Run Python file";
ot->idname = "SCRIPT_OT_python_file_run";
ot->flag = OPTYPE_UNDO;
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index c6c70ccb424..15528093869 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1124,7 +1124,7 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
void SEQUENCER_OT_snap(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Snap strips";
+ ot->name = "Snap Strips";
ot->idname = "SEQUENCER_OT_snap";
ot->description = "Frame where selected strips will be snapped";
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 192f45ac918..0d1ecb76d0e 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -704,7 +704,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv
void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Select pick linked";
+ ot->name = "Select Pick Linked";
ot->idname = "SEQUENCER_OT_select_linked_pick";
ot->description = "Select a chain of linked strips nearest to the mouse pointer";
@@ -739,7 +739,7 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
void SEQUENCER_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Select linked";
+ ot->name = "Select Linked";
ot->idname = "SEQUENCER_OT_select_linked";
ot->description = "Select all strips adjacent to the current selection";
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index a1e132c6601..562d1ec4b64 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -972,7 +972,7 @@ static int viewrotate_cancel(bContext *C, wmOperator *op)
void VIEW3D_OT_rotate(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Rotate view";
+ ot->name = "Rotate View";
ot->description = "Rotate the view";
ot->idname = "VIEW3D_OT_rotate";
@@ -1330,7 +1330,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
void VIEW3D_OT_ndof_orbit_zoom(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name = "NDOF Orbit View with zoom";
+ ot->name = "NDOF Orbit View with Zoom";
ot->description = "Explore every angle of an object using the 3D mouse";
ot->idname = "VIEW3D_OT_ndof_orbit_zoom";
@@ -1590,7 +1590,7 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
void VIEW3D_OT_ndof_all(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name = "NDOF move View";
+ ot->name = "NDOF Move View";
ot->description = "Position your viewpoint with the 3D mouse";
ot->idname = "VIEW3D_OT_ndof_all";
@@ -1753,7 +1753,7 @@ void VIEW3D_OT_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Move view";
+ ot->name = "Move View";
ot->description = "Move the view";
ot->idname = "VIEW3D_OT_move";
@@ -2375,7 +2375,7 @@ static int viewdolly_cancel(bContext *C, wmOperator *op)
void VIEW3D_OT_dolly(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Dolly view";
+ ot->name = "Dolly View";
ot->description = "Dolly in/out in the view";
ot->idname = "VIEW3D_OT_dolly";
@@ -3457,7 +3457,7 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name = "View numpad";
+ ot->name = "View Numpad";
ot->description = "Use a preset viewpoint";
ot->idname = "VIEW3D_OT_viewnumpad";
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index d29326db6b0..c4960de1e19 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2336,7 +2336,7 @@ static void constraintTransLim(TransInfo *t, TransData *td)
ListBase targets = {NULL, NULL};
/* only consider constraint if enabled */
- if (con->flag & CONSTRAINT_DISABLE) continue;
+ if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
if (con->enforce == 0.0f) continue;
/* only use it if it's tagged for this purpose (and the right type) */
@@ -2427,7 +2427,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
/* Evaluate valid constraints */
for (con = td->con; con; con = con->next) {
/* only consider constraint if enabled */
- if (con->flag & CONSTRAINT_DISABLE) continue;
+ if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
if (con->enforce == 0.0f) continue;
/* we're only interested in Limit-Rotation constraints */
@@ -2517,7 +2517,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
/* Evaluate valid constraints */
for (con = td->con; con; con = con->next) {
/* only consider constraint if enabled */
- if (con->flag & CONSTRAINT_DISABLE) continue;
+ if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
if (con->enforce == 0.0f) continue;
/* we're only interested in Limit-Scale constraints */
@@ -4872,70 +4872,102 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
static BMEdge *get_other_edge(BMVert *v, BMEdge *e)
{
BMIter iter;
- BMEdge *e2;
+ BMEdge *e_iter;
- BM_ITER_ELEM (e2, &iter, v, BM_EDGES_OF_VERT) {
- if (BM_elem_flag_test(e2, BM_ELEM_SELECT) && e2 != e)
- return e2;
+ BM_ITER_ELEM (e_iter, &iter, v, BM_EDGES_OF_VERT) {
+ if (BM_elem_flag_test(e_iter, BM_ELEM_SELECT) && e_iter != e) {
+ return e_iter;
+ }
}
return NULL;
}
+static void len_v3_ensure(float v[3], const float length)
+{
+ normalize_v3(v);
+ mul_v3_fl(v, length);
+}
+
+/**
+ * Given 2 edges and a loop, step over the loops
+ * and calculate a direction to slide along.
+ *
+ * \param r_slide_vec the direction to slide,
+ * the length of the vector defines the slide distance.
+ */
static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
- BMEdge *olde, BMEdge *nexte, float vec[3])
+ BMEdge *e_prev, BMEdge *e_next, float r_slide_vec[3])
{
- BMLoop *firstl;
- float a[3] = {0.0f, 0.0f, 0.0f}, n[3] = {0.0f, 0.0f, 0.0f};
+ BMLoop *l_first;
+ float vec_accum[3] = {0.0f, 0.0f, 0.0f};
+ float vec_accum_len = 0.0f;
int i = 0;
- firstl = l;
+ BLI_assert(BM_edge_share_vert(e_prev, e_next) == v);
+
+ l_first = l;
do {
l = BM_face_other_edge_loop(l->f, l->e, v);
if (l->radial_next == l)
return NULL;
- if (l->e == nexte) {
+ if (l->e == e_next) {
if (i) {
- mul_v3_fl(a, 1.0f / (float)i);
+ len_v3_ensure(vec_accum, vec_accum_len / (float)i);
}
else {
- float f1[3], f2[3], f3[3];
+ /* When there is no edge to slide along,
+ * we must slide along the vector defined by the face we're attach to */
+ float e_dir_prev[3], e_dir_next[3], tvec[3];
- sub_v3_v3v3(f1, BM_edge_other_vert(olde, v)->co, v->co);
- sub_v3_v3v3(f2, BM_edge_other_vert(nexte, v)->co, v->co);
+ sub_v3_v3v3(e_dir_prev, BM_edge_other_vert(e_prev, v)->co, v->co);
+ sub_v3_v3v3(e_dir_next, BM_edge_other_vert(e_next, v)->co, v->co);
- cross_v3_v3v3(f3, f1, l->f->no);
- cross_v3_v3v3(a, f2, l->f->no);
- mul_v3_fl(a, -1.0f);
+ cross_v3_v3v3(tvec, l->f->no, e_dir_prev);
+ cross_v3_v3v3(vec_accum, e_dir_next, l->f->no);
- mid_v3_v3v3(a, a, f3);
+ mid_v3_v3v3(vec_accum, vec_accum, tvec);
+
+ /* check if we need to flip
+ * (compare the normal defines by the edges with the face normal) */
+ cross_v3_v3v3(tvec, e_dir_prev, e_dir_next);
+ if (dot_v3v3(tvec, l->f->no) > 0.0f) {
+ negate_v3(vec_accum);
+ }
}
-
- copy_v3_v3(vec, a);
+
+ copy_v3_v3(r_slide_vec, vec_accum);
return l;
}
else {
- sub_v3_v3v3(n, BM_edge_other_vert(l->e, v)->co, v->co);
- add_v3_v3v3(a, a, n);
+ /* accumulate the normalized edge vector,
+ * normalize so some edges don't skew the result */
+ float tvec[3];
+ sub_v3_v3v3(tvec, BM_edge_other_vert(l->e, v)->co, v->co);
+ vec_accum_len += normalize_v3(tvec);
+ add_v3_v3(vec_accum, tvec);
i += 1;
}
- if (BM_face_other_edge_loop(l->f, l->e, v)->e == nexte) {
- if (i)
- mul_v3_fl(a, 1.0f / (float)i);
-
- copy_v3_v3(vec, a);
+ if (BM_face_other_edge_loop(l->f, l->e, v)->e == e_next) {
+ if (i) {
+ len_v3_ensure(vec_accum, vec_accum_len / (float)i);
+ }
+
+ copy_v3_v3(r_slide_vec, vec_accum);
return BM_face_other_edge_loop(l->f, l->e, v);
}
+ BLI_assert(l != l->radial_next);
l = l->radial_next;
- } while (l != firstl);
+ } while (l != l_first);
- if (i)
- mul_v3_fl(a, 1.0f / (float)i);
+ if (i) {
+ len_v3_ensure(vec_accum, vec_accum_len / (float)i);
+ }
- copy_v3_v3(vec, a);
+ copy_v3_v3(r_slide_vec, vec_accum);
return NULL;
}
@@ -4991,7 +5023,7 @@ static int createEdgeSlideVerts(TransInfo *t)
BMesh *bm = em->bm;
BMIter iter;
BMEdge *e, *e1;
- BMVert *v, *v2, *first;
+ BMVert *v, *v2;
TransDataEdgeSlideVert *sv_array;
BMBVHTree *btree;
SmallHash table;
@@ -5098,6 +5130,7 @@ static int createEdgeSlideVerts(TransInfo *t)
j = 0;
while (1) {
BMLoop *l, *l1, *l2;
+ BMVert *v_first;
v = NULL;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
@@ -5112,7 +5145,7 @@ static int createEdgeSlideVerts(TransInfo *t)
if (!v->e)
continue;
- first = v;
+ v_first = v;
/*walk along the edge loop*/
e = v->e;
@@ -5132,7 +5165,7 @@ static int createEdgeSlideVerts(TransInfo *t)
break;
v = BM_edge_other_vert(e, v);
- } while (e != first->e);
+ } while (e != v_first->e);
BM_elem_flag_disable(v, BM_ELEM_TAG);
@@ -5152,10 +5185,12 @@ static int createEdgeSlideVerts(TransInfo *t)
}
/*iterate over the loop*/
- first = v;
+ v_first = v;
do {
TransDataEdgeSlideVert *sv = sv_array + j;
+ BLI_assert(j < MEM_allocN_len(sv_array) / sizeof(*sv));
+
sv->v = v;
sv->origvert = *v;
sv->loop_nr = loop_nr;
@@ -5179,6 +5214,8 @@ static int createEdgeSlideVerts(TransInfo *t)
if (!e) {
//v2=v, v = BM_edge_other_vert(l1->e, v);
+ BLI_assert(j + 1 < MEM_allocN_len(sv_array) / sizeof(*sv));
+
sv = sv_array + j + 1;
sv->v = v;
sv->origvert = *v;
@@ -5208,7 +5245,7 @@ static int createEdgeSlideVerts(TransInfo *t)
BM_elem_flag_disable(v, BM_ELEM_TAG);
BM_elem_flag_disable(v2, BM_ELEM_TAG);
- } while (e != first->e && l1);
+ } while (e != v_first->e && l1);
loop_nr++;
}