Merged changes in the trunk up to revision 26439.
This commit is contained in:
@@ -45,9 +45,8 @@ This module contains application values that remain unchanged during runtime.
|
||||
"""
|
||||
# constants
|
||||
import _bpy
|
||||
import sys as _sys
|
||||
version = _bpy._VERSION
|
||||
version_string = _bpy._VERSION_STR
|
||||
home = _bpy._HOME
|
||||
binary_path = _bpy._BINPATH
|
||||
debug = ("-d" in _sys.argv)
|
||||
debug = _bpy._DEBUG
|
||||
|
||||
@@ -72,7 +72,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
test_reload(_sys.modules[module_name])
|
||||
|
||||
for base_path in script_paths():
|
||||
for path_subdir in ("ui", "op", "io", "cfg"):
|
||||
for path_subdir in ("", "ui", "op", "io", "cfg"):
|
||||
path = _os.path.join(base_path, path_subdir)
|
||||
if _os.path.isdir(path):
|
||||
|
||||
@@ -87,7 +87,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
if f.endswith(".py"):
|
||||
# python module
|
||||
mod = test_import(f[0:-3])
|
||||
elif "." not in f:
|
||||
elif ("." not in f) and (_os.path.isdir(_os.path.join(path, f, "__init__.py"))):
|
||||
# python package
|
||||
mod = test_import(f)
|
||||
else:
|
||||
|
||||
@@ -38,8 +38,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
|
||||
wide_ui = context.region.width > narrowui
|
||||
compact_mod = context.region.width < narrowmod
|
||||
|
||||
row = layout.row()
|
||||
row.operator_menu_enum("object.modifier_add", "type")
|
||||
layout.operator_menu_enum("object.modifier_add", "type")
|
||||
|
||||
for md in ob.modifiers:
|
||||
box = layout.template_modifier(md, compact=compact_mod)
|
||||
|
||||
@@ -730,13 +730,10 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
ob = context.object
|
||||
wide_ui = context.region.width > narrowui
|
||||
|
||||
row = layout.row()
|
||||
row.operator_menu_enum("object.constraint_add", "type")
|
||||
if wide_ui:
|
||||
row.label()
|
||||
ob = context.object
|
||||
|
||||
layout.operator_menu_enum("object.constraint_add", "type")
|
||||
|
||||
for con in ob.constraints:
|
||||
self.draw_constraint(context, con)
|
||||
@@ -755,12 +752,8 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
|
||||
|
||||
ob = context.object
|
||||
pchan = ob.pose.bones[context.bone.name]
|
||||
wide_ui = context.region.width > narrowui
|
||||
|
||||
row = layout.row()
|
||||
row.operator_menu_enum("pose.constraint_add", "type")
|
||||
if wide_ui:
|
||||
row.label()
|
||||
layout.operator_menu_enum("pose.constraint_add", "type")
|
||||
|
||||
for con in pchan.constraints:
|
||||
self.draw_constraint(context, con)
|
||||
|
||||
@@ -237,6 +237,13 @@ class USERPREF_PT_interface(bpy.types.Panel):
|
||||
col.prop(view, "smooth_view")
|
||||
col.prop(view, "rotation_angle")
|
||||
|
||||
col.separator()
|
||||
col.separator()
|
||||
|
||||
col.label(text="2D Viewports:")
|
||||
col.prop(view, "view2d_grid_minimum_spacing", text="Minimum Grid Spacing")
|
||||
col.prop(view, "timecode_style")
|
||||
|
||||
row.separator()
|
||||
row.separator()
|
||||
|
||||
|
||||
@@ -1740,15 +1740,21 @@ class VIEW3D_PT_3dview_display(bpy.types.Panel):
|
||||
col.prop(gs, "material_mode", text="")
|
||||
col.prop(view, "textured_solid")
|
||||
|
||||
# XXX - the Quad View options don't work yet
|
||||
# layout.separator()
|
||||
#
|
||||
# layout.operator("screen.region_foursplit", text="Toggle Quad View")
|
||||
# col = layout.column()
|
||||
# col.prop(view, "lock_rotation")
|
||||
# col.prop(view, "box_preview")
|
||||
# col.prop(view, "box_clip")
|
||||
layout.separator()
|
||||
|
||||
region = view.region_quadview
|
||||
|
||||
layout.operator("screen.region_quadview", text="Toggle Quad View")
|
||||
|
||||
if region:
|
||||
col = layout.column()
|
||||
col.prop(region, "lock_rotation")
|
||||
row = col.row()
|
||||
row.enabled = region.lock_rotation
|
||||
row.prop(region, "box_preview")
|
||||
row = col.row()
|
||||
row.enabled = region.lock_rotation and region.box_preview
|
||||
row.prop(region, "box_clip")
|
||||
|
||||
class VIEW3D_PT_3dview_meshdisplay(bpy.types.Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
|
||||
@@ -94,7 +94,15 @@ void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, ch
|
||||
/* Fix all the paths for the entire database... */
|
||||
void BKE_all_animdata_fix_paths_rename(char *prefix, char *oldName, char *newName);
|
||||
|
||||
void BKE_animdata_main_cb(struct Main *main, void (*func)(struct ID *, struct AnimData *, void *), void *user_data);
|
||||
/* ************************************* */
|
||||
/* Batch AnimData API */
|
||||
|
||||
/* Define for callback looper used in BKE_animdata_main_cb */
|
||||
typedef void (*ID_AnimData_Edit_Callback)(struct ID *id, struct AnimData *adt, void *user_data);
|
||||
|
||||
|
||||
/* Loop over all datablocks applying callback */
|
||||
void BKE_animdata_main_cb(struct Main *main, ID_AnimData_Edit_Callback func, void *user_data);
|
||||
|
||||
/* ************************************* */
|
||||
// TODO: overrides, remapping, and path-finding api's
|
||||
|
||||
@@ -467,12 +467,10 @@ static void *_edge_getCo(CCGEdge *e, int lvl, int x, int dataSize) {
|
||||
int levelBase = lvl + (1<<lvl) - 1;
|
||||
return &EDGE_getLevelData(e)[dataSize*(levelBase + x)];
|
||||
}
|
||||
#if 0
|
||||
static float *_edge_getNo(CCGEdge *e, int lvl, int x, int dataSize, int normalDataOffset) {
|
||||
int levelBase = lvl + (1<<lvl) - 1;
|
||||
return (float*) &EDGE_getLevelData(e)[dataSize*(levelBase + x) + normalDataOffset];
|
||||
}
|
||||
#endif
|
||||
static void *_edge_getCoVert(CCGEdge *e, CCGVert *v, int lvl, int x, int dataSize) {
|
||||
int levelBase = lvl + (1<<lvl) - 1;
|
||||
if (v==e->v0) {
|
||||
@@ -535,6 +533,12 @@ static CCG_INLINE void *_face_getIECo(CCGFace *f, int lvl, int S, int x, int lev
|
||||
byte *gridBase = FACE_getCenterData(f) + dataSize*(1 + S*(maxGridSize + maxGridSize*maxGridSize));
|
||||
return &gridBase[dataSize*x*spacing];
|
||||
}
|
||||
static CCG_INLINE void *_face_getIENo(CCGFace *f, int lvl, int S, int x, int levels, int dataSize, int normalDataOffset) {
|
||||
int maxGridSize = 1 + (1<<(levels-1));
|
||||
int spacing = 1<<(levels-lvl);
|
||||
byte *gridBase = FACE_getCenterData(f) + dataSize*(1 + S*(maxGridSize + maxGridSize*maxGridSize));
|
||||
return &gridBase[dataSize*x*spacing + normalDataOffset];
|
||||
}
|
||||
static CCG_INLINE void *_face_getIFCo(CCGFace *f, int lvl, int S, int x, int y, int levels, int dataSize) {
|
||||
int maxGridSize = 1 + (1<<(levels-1));
|
||||
int spacing = 1<<(levels-lvl);
|
||||
@@ -1139,8 +1143,11 @@ CCGError ccgSubSurf_processSync(CCGSubSurf *ss) {
|
||||
return eCCGError_None;
|
||||
}
|
||||
|
||||
#define VERT_getNo(e, lvl) _vert_getNo(e, lvl, vertDataSize, normalDataOffset)
|
||||
#define EDGE_getNo(e, lvl, x) _edge_getNo(e, lvl, x, vertDataSize, normalDataOffset)
|
||||
#define FACE_getIFNo(f, lvl, S, x, y) _face_getIFNo(f, lvl, S, x, y, subdivLevels, vertDataSize, normalDataOffset)
|
||||
#define FACE_calcIFNo(f, lvl, S, x, y, no) _face_calcIFNo(f, lvl, S, x, y, no, subdivLevels, vertDataSize)
|
||||
#define FACE_getIENo(f, lvl, S, x) _face_getIENo(f, lvl, S, x, subdivLevels, vertDataSize, normalDataOffset)
|
||||
static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
|
||||
CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
|
||||
int numEffectedV, int numEffectedE, int numEffectedF) {
|
||||
@@ -1304,6 +1311,26 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VertDataCopy((float*)((byte*)FACE_getCenterData(f) + normalDataOffset),
|
||||
FACE_getIFNo(f, lvl, S, 0, 0));
|
||||
|
||||
for (x=1; x<gridSize-1; x++)
|
||||
NormCopy(FACE_getIENo(f, lvl, S, x),
|
||||
FACE_getIFNo(f, lvl, S, x, 0));
|
||||
}
|
||||
}
|
||||
|
||||
for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) {
|
||||
CCGEdge *e = (CCGEdge*) effectedE[ptrIdx];
|
||||
|
||||
if (e->numFaces) {
|
||||
CCGFace *f = e->faces[0];
|
||||
int x;
|
||||
|
||||
for (x=0; x<edgeSize; x++)
|
||||
NormCopy(EDGE_getNo(e, lvl, x),
|
||||
_face_getIFNoEdge(f, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1769,7 +1769,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
||||
CDDM_calc_normals(dm);
|
||||
}
|
||||
|
||||
if(dataMask & CD_MASK_WEIGHT_MCOL)
|
||||
if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT))
|
||||
add_weight_mcol_dm(ob, dm);
|
||||
}
|
||||
|
||||
@@ -1835,7 +1835,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
||||
CDDM_apply_vert_coords(finaldm, deformedVerts);
|
||||
CDDM_calc_normals(finaldm);
|
||||
|
||||
if(dataMask & CD_MASK_WEIGHT_MCOL)
|
||||
if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT))
|
||||
add_weight_mcol_dm(ob, finaldm);
|
||||
} else if(dm) {
|
||||
finaldm = dm;
|
||||
@@ -1847,7 +1847,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
|
||||
CDDM_calc_normals(finaldm);
|
||||
}
|
||||
|
||||
if(dataMask & CD_MASK_WEIGHT_MCOL)
|
||||
if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT))
|
||||
add_weight_mcol_dm(ob, finaldm);
|
||||
}
|
||||
|
||||
|
||||
@@ -422,14 +422,17 @@ void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, char *prefix, c
|
||||
MEM_freeN(newN);
|
||||
}
|
||||
|
||||
void BKE_animdata_main_cb(Main *main, void (*func)(ID *, AnimData *, void *), void *user_data)
|
||||
/* Whole Database Ops -------------------------------------------- */
|
||||
|
||||
/* apply the given callback function on all data in main database */
|
||||
void BKE_animdata_main_cb (Main *main, ID_AnimData_Edit_Callback func, void *user_data)
|
||||
{
|
||||
ID *id;
|
||||
|
||||
#define ANIMDATA_IDS_CB(first) \
|
||||
for (id= first; id; id= id->next) { \
|
||||
AnimData *adt= BKE_animdata_from_id(id); \
|
||||
if(adt) func(id, adt, user_data); \
|
||||
if (adt) func(id, adt, user_data); \
|
||||
}
|
||||
|
||||
ANIMDATA_IDS_CB(main->nodetree.first); /* nodes */
|
||||
@@ -454,11 +457,11 @@ void BKE_animdata_main_cb(Main *main, void (*func)(ID *, AnimData *, void *), vo
|
||||
/* do compositing nodes first (since these aren't included in main tree) */
|
||||
if (scene->nodetree) {
|
||||
AnimData *adt2= BKE_animdata_from_id((ID *)scene->nodetree);
|
||||
if(adt2) func(id, adt2, user_data);
|
||||
if (adt2) func(id, adt2, user_data);
|
||||
}
|
||||
|
||||
/* now fix scene animation data as per normal */
|
||||
if(adt) func((ID *)id, adt, user_data);
|
||||
if (adt) func((ID *)id, adt, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -304,8 +304,9 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
|
||||
if(G.main->versionfile < 250)
|
||||
do_versions_ipos_to_animato(G.main); // XXX fixme... complicated versionpatching
|
||||
|
||||
/* in case of autosave or quit.blend, use original filename instead */
|
||||
if(recover && bfd->filename[0])
|
||||
/* in case of autosave or quit.blend, use original filename instead
|
||||
* use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */
|
||||
if(recover && bfd->filename[0] && G.relbase_valid)
|
||||
filename= bfd->filename;
|
||||
|
||||
/* these are the same at times, should never copy to the same location */
|
||||
|
||||
@@ -493,7 +493,7 @@ float defvert_find_weight(const struct MDeformVert *dvert, int group_num)
|
||||
float defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index, int group_num)
|
||||
{
|
||||
if(group_num == -1 || dvert == NULL)
|
||||
return 0.0f;
|
||||
return 1.0f;
|
||||
|
||||
return defvert_find_weight(dvert+index, group_num);
|
||||
}
|
||||
|
||||
@@ -562,6 +562,12 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
|
||||
int i;
|
||||
float vec[3];
|
||||
|
||||
if(totvert == 0) {
|
||||
zero_v3(start);
|
||||
zero_v3(size);
|
||||
return;
|
||||
}
|
||||
|
||||
VECCOPY(vec, mvert[0].co);
|
||||
mul_m4_v3(obmat, vec);
|
||||
bbsx = vec[0]; bbsy = vec[1]; bbsz = vec[2];
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
#include "BKE_idprop.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_gpencil.h"
|
||||
#include "BKE_fcurve.h"
|
||||
|
||||
#define MAX_IDPUP 60 /* was 24 */
|
||||
|
||||
@@ -710,12 +711,12 @@ void animdata_dtar_clear_cb(ID *id, AnimData *adt, void *userdata)
|
||||
if (driver) {
|
||||
DriverVar *dvar;
|
||||
for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
|
||||
DriverTarget *dtar= &dvar->targets[0];
|
||||
int tarIndex= 0;
|
||||
for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++) {
|
||||
if(dtar->id == userdata)
|
||||
DRIVER_TARGETS_USED_LOOPER(dvar)
|
||||
{
|
||||
if (dtar->id == userdata)
|
||||
dtar->id= NULL;
|
||||
}
|
||||
DRIVER_TARGETS_LOOPER_END
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1980,7 +1980,7 @@ void set_no_parent_ipo(int val)
|
||||
void where_is_object_time(Scene *scene, Object *ob, float ctime)
|
||||
{
|
||||
float *fp1, *fp2, slowmat[4][4] = MAT4_UNITY;
|
||||
float stime=ctime, fac1, fac2, vec[3];
|
||||
float stime=ctime, fac1, fac2;
|
||||
int a;
|
||||
|
||||
/* new version: correct parent+vertexparent and track+parent */
|
||||
@@ -2050,8 +2050,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
|
||||
}
|
||||
|
||||
/* set negative scale flag in object */
|
||||
cross_v3_v3v3(vec, ob->obmat[0], ob->obmat[1]);
|
||||
if( dot_v3v3(vec, ob->obmat[2]) < 0.0 ) ob->transflag |= OB_NEG_SCALE;
|
||||
if(is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
|
||||
else ob->transflag &= ~OB_NEG_SCALE;
|
||||
}
|
||||
|
||||
|
||||
@@ -819,7 +819,6 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
|
||||
for(x = 1; x < edgeSize - 1; x++, i++) {
|
||||
vd= ccgSubSurf_getEdgeData(ss, e, x);
|
||||
copy_v3_v3(mvert[i].co, vd->co);
|
||||
/* TODO CCGSubsurf does not set these */
|
||||
normal_float_to_short_v3(mvert[i].no, vd->no);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +148,9 @@ void loc_quat_size_to_mat4(float R[4][4],
|
||||
void blend_m3_m3m3(float R[3][3], float A[3][3], float B[3][3], float t);
|
||||
void blend_m4_m4m4(float R[4][4], float A[4][4], float B[4][4], float t);
|
||||
|
||||
int is_negative_m3(float mat[3][3]);
|
||||
int is_negative_m4(float mat[4][4]);
|
||||
|
||||
/*********************************** Other ***********************************/
|
||||
|
||||
void print_m3(char *str, float M[3][3]);
|
||||
|
||||
@@ -1037,6 +1037,21 @@ void blend_m4_m4m4(float out[][4], float dst[][4], float src[][4], float srcweig
|
||||
loc_quat_size_to_mat4(out, floc, fquat, fsize);
|
||||
}
|
||||
|
||||
|
||||
int is_negative_m3(float mat[][3])
|
||||
{
|
||||
float vec[3];
|
||||
cross_v3_v3v3(vec, mat[0], mat[1]);
|
||||
return (dot_v3v3(vec, mat[2]) < 0.0f);
|
||||
}
|
||||
|
||||
int is_negative_m4(float mat[][4])
|
||||
{
|
||||
float vec[3];
|
||||
cross_v3_v3v3(vec, mat[0], mat[1]);
|
||||
return (dot_v3v3(vec, mat[2]) < 0.0f);
|
||||
}
|
||||
|
||||
/* make a 4x4 matrix out of 3 transform components */
|
||||
/* matrices are made in the order: scale * rot * loc */
|
||||
// TODO: need to have a version that allows for rotation order...
|
||||
@@ -1128,4 +1143,3 @@ void print_m4(char *str, float m[][4])
|
||||
printf("%f %f %f %f\n",m[0][3],m[1][3],m[2][3],m[3][3]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,125 @@
|
||||
/* XXX */
|
||||
extern void ui_rasterpos_safe(float x, float y, float aspect);
|
||||
|
||||
/* *************************************************** */
|
||||
/* TIME CODE FORMATTING */
|
||||
|
||||
/* Generate timecode/frame number string and store in the supplied string
|
||||
* - buffer: must be at least 13 chars long
|
||||
* - power: special setting for View2D grid drawing,
|
||||
* used to specify how detailed we need to be
|
||||
* - timecodes: boolean specifying whether timecodes or
|
||||
* frame numbers get drawn
|
||||
* - cfra: time in frames or seconds, consistent with the values shown by timecodes
|
||||
*/
|
||||
// TODO: have this in kernel instead under scene?
|
||||
void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short timecodes, float cfra)
|
||||
{
|
||||
if (timecodes) {
|
||||
int hours=0, minutes=0, seconds=0, frames=0;
|
||||
float raw_seconds= cfra;
|
||||
char neg[2]= "";
|
||||
|
||||
/* get cframes */
|
||||
if (cfra < 0) {
|
||||
/* correction for negative cfraues */
|
||||
sprintf(neg, "-");
|
||||
cfra = -cfra;
|
||||
}
|
||||
if (cfra >= 3600) {
|
||||
/* hours */
|
||||
/* XXX should we only display a single digit for hours since clips are
|
||||
* VERY UNLIKELY to be more than 1-2 hours max? However, that would
|
||||
* go against conventions...
|
||||
*/
|
||||
hours= (int)cfra / 3600;
|
||||
cfra= (float)fmod(cfra, 3600);
|
||||
}
|
||||
if (cfra >= 60) {
|
||||
/* minutes */
|
||||
minutes= (int)cfra / 60;
|
||||
cfra= (float)fmod(cfra, 60);
|
||||
}
|
||||
if (power <= 0) {
|
||||
/* seconds + frames
|
||||
* Frames are derived from 'fraction' of second. We need to perform some additional rounding
|
||||
* to cope with 'half' frames, etc., which should be fine in most cases
|
||||
*/
|
||||
seconds= (int)cfra;
|
||||
frames= (int)floor( ((cfra - seconds) * FPS) + 0.5f );
|
||||
}
|
||||
else {
|
||||
/* seconds (with pixel offset rounding) */
|
||||
seconds= (int)floor(cfra + 0.375f);
|
||||
}
|
||||
|
||||
switch (U.timecode_style) {
|
||||
case USER_TIMECODE_MINIMAL:
|
||||
{
|
||||
/* - In general, minutes and seconds should be shown, as most clips will be
|
||||
* within this length. Hours will only be included if relevant.
|
||||
* - Only show frames when zoomed in enough for them to be relevant
|
||||
* (using separator of '+' for frames).
|
||||
* When showing frames, use slightly different display to avoid confusion with mm:ss format
|
||||
*/
|
||||
if (power <= 0) {
|
||||
/* include "frames" in display */
|
||||
if (hours) sprintf(str, "%s%02d:%02d:%02d+%02d", neg, hours, minutes, seconds, frames);
|
||||
else if (minutes) sprintf(str, "%s%02d:%02d+%02d", neg, minutes, seconds, frames);
|
||||
else sprintf(str, "%s%d+%02d", neg, seconds, frames);
|
||||
}
|
||||
else {
|
||||
/* don't include 'frames' in display */
|
||||
if (hours) sprintf(str, "%s%02d:%02d:%02d", neg, hours, minutes, seconds);
|
||||
else sprintf(str, "%s%02d:%02d", neg, minutes, seconds);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case USER_TIMECODE_SMPTE_MSF:
|
||||
{
|
||||
/* reduced SMPTE format that always shows minutes, seconds, frames. Hours only shown as needed. */
|
||||
if (hours) sprintf(str, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
|
||||
else sprintf(str, "%s%02d:%02d:%02d", neg, minutes, seconds, frames);
|
||||
}
|
||||
break;
|
||||
|
||||
case USER_TIMECODE_MILLISECONDS:
|
||||
{
|
||||
/* reduced SMPTE. Instead of frames, milliseconds are shown */
|
||||
int ms_dp= (power <= 0) ? (1 - power) : 1; /* precision of decimal part */
|
||||
int s_pad= ms_dp+3; /* to get 2 digit whole-number part for seconds display (i.e. 3 is for 2 digits + radix, on top of full length) */
|
||||
|
||||
if (hours) sprintf(str, "%s%02d:%02d:%0*.*f", neg, hours, minutes, s_pad, ms_dp, cfra);
|
||||
else sprintf(str, "%s%02d:%0*.*f", neg, minutes, s_pad, ms_dp, cfra);
|
||||
}
|
||||
break;
|
||||
|
||||
case USER_TIMECODE_SECONDS_ONLY:
|
||||
{
|
||||
/* only show the original seconds display */
|
||||
/* round to whole numbers if power is >= 1 (i.e. scale is coarse) */
|
||||
if (power <= 0) sprintf(str, "%.*f", 1-power, raw_seconds);
|
||||
else sprintf(str, "%d", (int)floor(raw_seconds + 0.375f));
|
||||
}
|
||||
break;
|
||||
|
||||
case USER_TIMECODE_SMPTE_FULL:
|
||||
default:
|
||||
{
|
||||
/* full SMPTE format */
|
||||
sprintf(str, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* round to whole numbers if power is >= 1 (i.e. scale is coarse) */
|
||||
if (power <= 0) sprintf(str, "%.*f", 1-power, cfra);
|
||||
else sprintf(str, "%d", (int)floor(cfra + 0.375f));
|
||||
}
|
||||
}
|
||||
|
||||
/* *************************************************** */
|
||||
/* CURRENT FRAME DRAWING */
|
||||
|
||||
@@ -81,65 +200,22 @@ extern void ui_rasterpos_safe(float x, float y, float aspect);
|
||||
static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
|
||||
{
|
||||
float xscale, yscale, x, y;
|
||||
char str[32];
|
||||
char str[32] = " t"; /* t is the character to start replacing from */
|
||||
short slen;
|
||||
|
||||
/* because the frame number text is subject to the same scaling as the contents of the view */
|
||||
UI_view2d_getscale(v2d, &xscale, &yscale);
|
||||
glScalef(1.0f/xscale, 1.0f, 1.0f);
|
||||
|
||||
if (time) {
|
||||
/* Timecode:
|
||||
* - In general, minutes and seconds should be shown, as most clips will be
|
||||
* within this length. Hours will only be included if relevant.
|
||||
* - Only show frames when zoomed in enough for them to be relevant
|
||||
* (using separator of '!' for frames).
|
||||
* When showing frames, use slightly different display to avoid confusion with mm:ss format
|
||||
* TODO: factor into reusable function.
|
||||
* Meanwhile keep in sync:
|
||||
* source/blender/editors/animation/anim_draw.c
|
||||
* source/blender/editors/interface/view2d.c
|
||||
/* get timecode string
|
||||
* - padding on str-buf passed so that it doesn't sit on the frame indicator
|
||||
* - power = 0, gives 'standard' behaviour for time
|
||||
* but power = 1 is required for frames (to get integer frames)
|
||||
*/
|
||||
float val= FRA2TIME(CFRA);
|
||||
int hours=0, minutes=0, seconds=0, frames=0;
|
||||
char neg[2]= "";
|
||||
|
||||
/* get values */
|
||||
if (val < 0) {
|
||||
/* correction for negative values */
|
||||
sprintf(neg, "-");
|
||||
val = -val;
|
||||
}
|
||||
if (val >= 3600) {
|
||||
/* hours */
|
||||
/* XXX should we only display a single digit for hours since clips are
|
||||
* VERY UNLIKELY to be more than 1-2 hours max? However, that would
|
||||
* go against conventions...
|
||||
*/
|
||||
hours= (int)val / 3600;
|
||||
val= (float)fmod(val, 3600);
|
||||
}
|
||||
if (val >= 60) {
|
||||
/* minutes */
|
||||
minutes= (int)val / 60;
|
||||
val= (float)fmod(val, 60);
|
||||
}
|
||||
{
|
||||
/* seconds + frames
|
||||
* Frames are derived from 'fraction' of second. We need to perform some additional rounding
|
||||
* to cope with 'half' frames, etc., which should be fine in most cases
|
||||
*/
|
||||
seconds= (int)val;
|
||||
frames= (int)floor( ((val - seconds) * FPS) + 0.5f );
|
||||
}
|
||||
|
||||
/* print timecode to temp string buffer */
|
||||
if (hours) sprintf(str, " %s%02d:%02d:%02d!%02d", neg, hours, minutes, seconds, frames);
|
||||
else if (minutes) sprintf(str, " %s%02d:%02d!%02d", neg, minutes, seconds, frames);
|
||||
else sprintf(str, " %s%d!%02d", neg, seconds, frames);
|
||||
}
|
||||
if (time)
|
||||
ANIM_timecode_string_from_frame(&str[4], scene, 0, time, FRA2TIME(cfra));
|
||||
else
|
||||
sprintf(str, " %d", CFRA);
|
||||
ANIM_timecode_string_from_frame(&str[4], scene, 1, time, cfra);
|
||||
slen= (short)UI_GetStringWidth(str) - 1;
|
||||
|
||||
/* get starting coordinates for drawing */
|
||||
|
||||
@@ -409,6 +409,9 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, struct AnimData *adt, st
|
||||
/* DRAWING API */
|
||||
/* anim_draw.c */
|
||||
|
||||
/* Get string representing the given frame number as an appropriately represented frame or timecode */
|
||||
void ANIM_timecode_string_from_frame(char *str, struct Scene *scene, int power, short timecodes, float cfra);
|
||||
|
||||
/* ---------- Current Frame Drawing ---------------- */
|
||||
|
||||
/* flags for Current Frame Drawing */
|
||||
|
||||
@@ -133,6 +133,7 @@ void EM_selectmode_set(struct EditMesh *em);
|
||||
void EM_select_flush(struct EditMesh *em);
|
||||
void EM_convertsel(struct EditMesh *em, short oldmode, short selectmode);
|
||||
void EM_validate_selections(struct EditMesh *em);
|
||||
void EM_selectmode_to_scene(struct Scene *scene, struct Object *obedit);
|
||||
|
||||
/* exported to transform */
|
||||
int EM_get_actSelection(struct EditMesh *em, struct EditSelection *ese);
|
||||
|
||||
@@ -160,6 +160,7 @@ void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct AR
|
||||
void view3d_clipping_local(struct RegionView3D *rv3d, float mat[][4]);
|
||||
|
||||
Base *ED_view3d_give_base_under_cursor(struct bContext *C, short *mval);
|
||||
void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar);
|
||||
|
||||
#endif /* ED_VIEW3D_H */
|
||||
|
||||
|
||||
@@ -1491,11 +1491,14 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
|
||||
}
|
||||
else if(but->type == IDPOIN) {
|
||||
/* ID pointer */
|
||||
if(but->idpoin_idpp) { /* Can be NULL for ID properties by python */
|
||||
ID *id= *(but->idpoin_idpp);
|
||||
|
||||
if(id) BLI_strncpy(str, id->name+2, maxlen);
|
||||
else BLI_strncpy(str, "", maxlen);
|
||||
|
||||
if(id)
|
||||
BLI_strncpy(str, id->name+2, maxlen);
|
||||
}
|
||||
else {
|
||||
str[0] = '\0';
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if(but->type == TEX) {
|
||||
|
||||
@@ -5254,7 +5254,7 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
|
||||
|
||||
/* if we are didn't handle the event yet, lets pass it on to
|
||||
* buttons inside this region. disabled inside check .. not sure
|
||||
* anymore why it was there? but i meant enter enter didn't work
|
||||
* anymore why it was there? but it meant enter didn't work
|
||||
* for example when mouse was not over submenu */
|
||||
if((/*inside &&*/ (!menu->menuretval || menu->menuretval == UI_RETURN_UPDATE) && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
|
||||
but= ui_but_find_activated(ar);
|
||||
@@ -5313,8 +5313,6 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo
|
||||
}
|
||||
|
||||
update= (submenu->menuretval == UI_RETURN_UPDATE);
|
||||
if(update)
|
||||
menu->menuretval = UI_RETURN_UPDATE;
|
||||
|
||||
/* now let activated button in this menu exit, which
|
||||
* will actually close the submenu too */
|
||||
|
||||
@@ -1377,6 +1377,9 @@ void init_userdef_do_versions(void)
|
||||
U.scrcastfps = 10;
|
||||
U.scrcastwait = 50;
|
||||
}
|
||||
if (U.v2d_min_gridsize == 0) {
|
||||
U.v2d_min_gridsize= 35;
|
||||
}
|
||||
|
||||
/* funny name, but it is GE stuff, moves userdef stuff to engine */
|
||||
// XXX space_set_commmandline_options();
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
|
||||
#include "BLF_api.h"
|
||||
|
||||
#include "ED_anim_api.h"
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
@@ -1038,9 +1039,6 @@ void UI_view2d_view_restore(const bContext *C)
|
||||
/* *********************************************************************** */
|
||||
/* Gridlines */
|
||||
|
||||
/* minimum pixels per gridstep */
|
||||
#define MINGRIDSTEP 35
|
||||
|
||||
/* View2DGrid is typedef'd in UI_view2d.h */
|
||||
struct View2DGrid {
|
||||
float dx, dy; /* stepsize (in pixels) between gridlines */
|
||||
@@ -1131,7 +1129,7 @@ View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, sh
|
||||
space= v2d->cur.xmax - v2d->cur.xmin;
|
||||
pixels= (float)(v2d->mask.xmax - v2d->mask.xmin);
|
||||
|
||||
grid->dx= (MINGRIDSTEP * space) / (seconddiv * pixels);
|
||||
grid->dx= (U.v2d_min_gridsize * space) / (seconddiv * pixels);
|
||||
step_to_grid(&grid->dx, &grid->powerx, xunits);
|
||||
grid->dx *= seconddiv;
|
||||
|
||||
@@ -1147,7 +1145,7 @@ View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, sh
|
||||
space= v2d->cur.ymax - v2d->cur.ymin;
|
||||
pixels= (float)winy;
|
||||
|
||||
grid->dy= MINGRIDSTEP * space / pixels;
|
||||
grid->dy= U.v2d_min_gridsize * space / pixels;
|
||||
step_to_grid(&grid->dy, &grid->powery, yunits);
|
||||
|
||||
if (yclamp == V2D_GRID_CLAMP) {
|
||||
@@ -1192,7 +1190,7 @@ void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int f
|
||||
vec2[1]= v2d->cur.ymax;
|
||||
|
||||
/* minor gridlines */
|
||||
step= (v2d->mask.xmax - v2d->mask.xmin + 1) / MINGRIDSTEP;
|
||||
step= (v2d->mask.xmax - v2d->mask.xmin + 1) / U.v2d_min_gridsize;
|
||||
UI_ThemeColor(TH_GRID);
|
||||
|
||||
for (a=0; a<step; a++) {
|
||||
@@ -1226,7 +1224,7 @@ void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int f
|
||||
vec1[0]= grid->startx;
|
||||
vec2[0]= v2d->cur.xmax;
|
||||
|
||||
step= (v2d->mask.ymax - v2d->mask.ymin + 1) / MINGRIDSTEP;
|
||||
step= (v2d->mask.ymax - v2d->mask.ymin + 1) / U.v2d_min_gridsize;
|
||||
|
||||
UI_ThemeColor(TH_GRID);
|
||||
for (a=0; a<=step; a++) {
|
||||
@@ -1491,72 +1489,7 @@ static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, f
|
||||
}
|
||||
|
||||
/* get string to print */
|
||||
if (unit == V2D_UNIT_SECONDS) {
|
||||
/* Timecode:
|
||||
* - In general, minutes and seconds should be shown, as most clips will be
|
||||
* within this length. Hours will only be included if relevant.
|
||||
* - Only show frames when zoomed in enough for them to be relevant
|
||||
* (using separator of '!' for frames).
|
||||
* When showing frames, use slightly different display to avoid confusion with mm:ss format
|
||||
* TODO: factor into reusable function.
|
||||
* Meanwhile keep in sync:
|
||||
* source/blender/editors/animation/anim_draw.c
|
||||
* source/blender/editors/interface/view2d.c
|
||||
*/
|
||||
int hours=0, minutes=0, seconds=0, frames=0;
|
||||
char neg[2]= "";
|
||||
|
||||
/* get values */
|
||||
if (val < 0) {
|
||||
/* correction for negative values */
|
||||
sprintf(neg, "-");
|
||||
val = -val;
|
||||
}
|
||||
if (val >= 3600) {
|
||||
/* hours */
|
||||
/* XXX should we only display a single digit for hours since clips are
|
||||
* VERY UNLIKELY to be more than 1-2 hours max? However, that would
|
||||
* go against conventions...
|
||||
*/
|
||||
hours= (int)val / 3600;
|
||||
val= (float)fmod(val, 3600);
|
||||
}
|
||||
if (val >= 60) {
|
||||
/* minutes */
|
||||
minutes= (int)val / 60;
|
||||
val= (float)fmod(val, 60);
|
||||
}
|
||||
if (power <= 0) {
|
||||
/* seconds + frames
|
||||
* Frames are derived from 'fraction' of second. We need to perform some additional rounding
|
||||
* to cope with 'half' frames, etc., which should be fine in most cases
|
||||
*/
|
||||
seconds= (int)val;
|
||||
frames= (int)floor( ((val - seconds) * FPS) + 0.5f );
|
||||
}
|
||||
else {
|
||||
/* seconds (with pixel offset) */
|
||||
seconds= (int)floor(val + 0.375f);
|
||||
}
|
||||
|
||||
/* print timecode to temp string buffer */
|
||||
if (power <= 0) {
|
||||
/* include "frames" in display */
|
||||
if (hours) sprintf(str, "%s%02d:%02d:%02d!%02d", neg, hours, minutes, seconds, frames);
|
||||
else if (minutes) sprintf(str, "%s%02d:%02d!%02d", neg, minutes, seconds, frames);
|
||||
else sprintf(str, "%s%d!%02d", neg, seconds, frames);
|
||||
}
|
||||
else {
|
||||
/* don't include 'frames' in display */
|
||||
if (hours) sprintf(str, "%s%02d:%02d:%02d", neg, hours, minutes, seconds);
|
||||
else sprintf(str, "%s%02d:%02d", neg, minutes, seconds);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* round to whole numbers if power is >= 1 (i.e. scale is coarse) */
|
||||
if (power <= 0) sprintf(str, "%.*f", 1-power, val);
|
||||
else sprintf(str, "%d", (int)floor(val + 0.375f));
|
||||
}
|
||||
ANIM_timecode_string_from_frame(str, scene, power, (unit == V2D_UNIT_SECONDS), val);
|
||||
|
||||
/* get length of string, and adjust printing location to fit it into the horizontal scrollbar */
|
||||
len= strlen(str);
|
||||
@@ -1753,7 +1686,6 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
|
||||
val= grid->starty;
|
||||
|
||||
/* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), apply correction */
|
||||
// XXX only relevant to Sequencer, so need to review this when we port that code
|
||||
if (vs->yclamp == V2D_GRID_CLAMP)
|
||||
fac += 0.5f * dfac;
|
||||
|
||||
|
||||
@@ -743,6 +743,11 @@ void EM_convertsel(EditMesh *em, short oldmode, short selectmode)
|
||||
EM_nfaces_selected(em);
|
||||
}
|
||||
|
||||
void EM_selectmode_to_scene(struct Scene *scene, struct Object *obedit)
|
||||
{
|
||||
scene->toolsettings->selectmode= get_mesh(obedit)->edit_mesh->selectmode;
|
||||
}
|
||||
|
||||
/* when switching select mode, makes sure selection is consistent for editing */
|
||||
/* also for paranoia checks to make sure edge or face mode works */
|
||||
void EM_selectmode_set(EditMesh *em)
|
||||
|
||||
@@ -379,7 +379,7 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
|
||||
BLI_addtail(curve_get_editcurve(ob), add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_PATH, 1));
|
||||
|
||||
if(!enter_editmode)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
|
||||
ED_object_exit_editmode(C, EM_FREEDATA);
|
||||
}
|
||||
else {
|
||||
ob= ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
|
||||
@@ -517,7 +517,7 @@ static int object_add_curve_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* userdef */
|
||||
if (newob && !enter_editmode) {
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
|
||||
ED_object_exit_editmode(C, EM_FREEDATA);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
|
||||
@@ -603,7 +603,7 @@ static int object_add_surface_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* userdef */
|
||||
if (newob && !enter_editmode) {
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
|
||||
ED_object_exit_editmode(C, EM_FREEDATA);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
|
||||
@@ -668,7 +668,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* userdef */
|
||||
if (newob && !enter_editmode) {
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
|
||||
ED_object_exit_editmode(C, EM_FREEDATA);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
|
||||
@@ -783,9 +783,8 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
|
||||
add_primitive_bone(CTX_data_scene(C), v3d, rv3d);
|
||||
|
||||
/* userdef */
|
||||
if (newob && !enter_editmode) {
|
||||
ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
|
||||
}
|
||||
if (newob && !enter_editmode)
|
||||
ED_object_exit_editmode(C, EM_FREEDATA);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
|
||||
|
||||
|
||||
@@ -3403,7 +3403,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
|
||||
|
||||
rr= RE_AcquireResultWrite(oglrender->re);
|
||||
if(rr->rectf==NULL)
|
||||
rr->rectf= MEM_mallocN(sizeof(float)*4*sizex*sizex, "32 bits rects");
|
||||
rr->rectf= MEM_mallocN(sizeof(float)*4*sizex*sizey, "32 bits rects");
|
||||
RE_ReleaseResult(oglrender->re);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -2078,6 +2078,11 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *stroke)
|
||||
if(ss->refkb) sculpt_key_to_mesh(ss->refkb, ob);
|
||||
|
||||
ss->partial_redraw = 0;
|
||||
|
||||
/* try to avoid calling this, only for e.g. linked duplicates now */
|
||||
if(((Mesh*)ob->data)->id.us > 1)
|
||||
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,6 +623,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX this timer is never removed, cause smooth view operator
|
||||
to get executed all the time after closing file browser */
|
||||
if (!sfile->loadimage_timer)
|
||||
sfile->loadimage_timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER1, 1.0/30.0); /* max 30 frames/sec. */
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel)
|
||||
}
|
||||
|
||||
|
||||
void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
|
||||
static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu, int do_handles)
|
||||
{
|
||||
View2D *v2d= &ar->v2d;
|
||||
|
||||
@@ -314,8 +314,7 @@ void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve
|
||||
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
|
||||
|
||||
/* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
|
||||
if ((fcu->flag & FCURVE_PROTECTED)==0 && (fcu->flag & FCURVE_INT_VALUES)==0 &&
|
||||
(sipo->flag & SIPO_NOHANDLES)==0 && (fcu->totvert > 1))
|
||||
if (do_handles)
|
||||
{
|
||||
set_fcurve_vertex_color(sipo, fcu, 0);
|
||||
draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 0);
|
||||
@@ -336,16 +335,28 @@ void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve
|
||||
|
||||
/* Handles ---------------- */
|
||||
|
||||
/* draw lines for F-Curve handles only (this is only done in EditMode) */
|
||||
static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
|
||||
{
|
||||
/* don't draw handle lines if handles are not shown */
|
||||
if ( (sipo->flag & SIPO_NOHANDLES) ||
|
||||
(fcu->flag & FCURVE_PROTECTED) ||
|
||||
(fcu->flag & FCURVE_INT_VALUES) ||
|
||||
((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED))
|
||||
/* || (fcu->totvert <= 1) */
|
||||
) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* draw lines for F-Curve handles only (this is only done in EditMode)
|
||||
* note: draw_fcurve_handles_check must be checked before running this. */
|
||||
static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
|
||||
{
|
||||
extern unsigned int nurbcol[];
|
||||
int sel, b;
|
||||
|
||||
/* don't draw handle lines if handles are not shown */
|
||||
if ((sipo->flag & SIPO_NOHANDLES) || (fcu->flag & FCURVE_PROTECTED) || (fcu->flag & FCURVE_INT_VALUES))
|
||||
return;
|
||||
|
||||
/* a single call to GL_LINES here around these calls should be sufficient to still
|
||||
* get separate line segments, but which aren't wrapped with GL_LINE_STRIP everytime we
|
||||
* want a single line
|
||||
@@ -491,11 +502,6 @@ static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar,
|
||||
|
||||
/* Curve ---------------- */
|
||||
|
||||
/* minimum pixels per gridstep
|
||||
* XXX: defined in view2d.c - must keep these in sync or relocate to View2D header!
|
||||
*/
|
||||
#define MINGRIDSTEP 35
|
||||
|
||||
/* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */
|
||||
static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DGrid *grid)
|
||||
{
|
||||
@@ -523,10 +529,10 @@ static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *
|
||||
* loop (i.e. too close to FLT_EPSILON), fall back to default of 0.001
|
||||
*/
|
||||
/* grid->dx is the first float in View2DGrid struct, so just cast to float pointer, and use it
|
||||
* It represents the number of 'frames' between gridlines, but we divide by MINGRIDSTEP to get pixels-steps
|
||||
* It represents the number of 'frames' between gridlines, but we divide by U.v2d_min_gridsize to get pixels-steps
|
||||
*/
|
||||
// TODO: perhaps we should have 1.0 frames as upper limit so that curves don't get too distorted?
|
||||
samplefreq= *((float *)grid) / MINGRIDSTEP;
|
||||
samplefreq= *((float *)grid) / U.v2d_min_gridsize;
|
||||
if (IS_EQ(samplefreq, 0)) samplefreq= 0.001f;
|
||||
|
||||
|
||||
@@ -915,12 +921,16 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
|
||||
ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, 0);
|
||||
|
||||
if (fcu->bezt) {
|
||||
int do_handles = draw_fcurve_handles_check(sipo, fcu);
|
||||
|
||||
if(do_handles) {
|
||||
/* only draw handles/vertices on keyframes */
|
||||
glEnable(GL_BLEND);
|
||||
draw_fcurve_handles(ac, sipo, ar, fcu);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
draw_fcurve_vertices(ac, sipo, ar, fcu);
|
||||
draw_fcurve_vertices(ac, sipo, ar, fcu, do_handles);
|
||||
}
|
||||
else {
|
||||
/* samples: only draw two indicators at either end as indicators */
|
||||
|
||||
@@ -290,6 +290,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
|
||||
{
|
||||
View3D *v3do= (View3D *)sl;
|
||||
View3D *v3dn= MEM_dupallocN(sl);
|
||||
BGpic *bgpic;
|
||||
|
||||
/* clear or remove stuff from old */
|
||||
|
||||
@@ -304,13 +305,11 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
|
||||
|
||||
/* copy or clear inside new stuff */
|
||||
|
||||
if(v3dn->bgpicbase.first) {
|
||||
BGpic *bgpic;
|
||||
for ( bgpic= v3dn->bgpicbase.first; bgpic; bgpic= bgpic->next ) {
|
||||
bgpic= MEM_dupallocN(bgpic);
|
||||
if(bgpic->ima) bgpic->ima->id.us++;
|
||||
}
|
||||
}
|
||||
BLI_duplicatelist(&v3dn->bgpicbase, &v3do->bgpicbase);
|
||||
for(bgpic= v3dn->bgpicbase.first; bgpic; bgpic= bgpic->next)
|
||||
if(bgpic->ima)
|
||||
bgpic->ima->id.us++;
|
||||
|
||||
v3dn->properties_storage= NULL;
|
||||
|
||||
return (SpaceLink *)v3dn;
|
||||
|
||||
@@ -162,6 +162,8 @@ static void view3d_boxview_clip(ScrArea *sa)
|
||||
if(rv3d->viewlock & RV3D_BOXCLIP) {
|
||||
rv3d->rflag |= RV3D_CLIPPING;
|
||||
memcpy(rv3d->clip, clip, sizeof(clip));
|
||||
if(rv3d->clipbb) MEM_freeN(rv3d->clipbb);
|
||||
rv3d->clipbb= MEM_dupallocN(bb);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,6 +229,34 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
|
||||
view3d_boxview_clip(sa);
|
||||
}
|
||||
|
||||
void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar)
|
||||
{
|
||||
RegionView3D *rv3d= ar->regiondata;
|
||||
short viewlock;
|
||||
|
||||
/* this function copies flags from the first of the 3 other quadview
|
||||
regions to the 2 other, so it assumes this is the region whose
|
||||
properties are always being edited, weak */
|
||||
viewlock= rv3d->viewlock;
|
||||
|
||||
if((viewlock & RV3D_LOCKED)==0)
|
||||
viewlock= 0;
|
||||
else if((viewlock & RV3D_BOXVIEW)==0)
|
||||
viewlock &= ~RV3D_BOXCLIP;
|
||||
|
||||
for(; ar; ar= ar->prev) {
|
||||
if(ar->alignment==RGN_ALIGN_QSPLIT) {
|
||||
rv3d= ar->regiondata;
|
||||
rv3d->viewlock= viewlock;
|
||||
}
|
||||
}
|
||||
|
||||
if(rv3d->viewlock & RV3D_BOXVIEW)
|
||||
view3d_boxview_copy(sa, sa->regionbase.last);
|
||||
|
||||
ED_area_tag_redraw(sa);
|
||||
}
|
||||
|
||||
/* ************************** init for view ops **********************************/
|
||||
|
||||
typedef struct ViewOpsData {
|
||||
|
||||
@@ -187,6 +187,7 @@ static int layers_exec(bContext *C, wmOperator *op)
|
||||
v3d->layact= 1;
|
||||
}
|
||||
else {
|
||||
int bit;
|
||||
nr--;
|
||||
|
||||
if(RNA_boolean_get(op->ptr, "extend")) {
|
||||
@@ -194,21 +195,30 @@ static int layers_exec(bContext *C, wmOperator *op)
|
||||
v3d->lay &= ~(1<<nr);
|
||||
else
|
||||
v3d->lay |= (1<<nr);
|
||||
} else
|
||||
} else {
|
||||
v3d->lay = (1<<nr);
|
||||
|
||||
/* sanity check - when in editmode disallow switching the editmode layer off since its confusing
|
||||
* an alternative would be to always draw the editmode object. */
|
||||
if(scene->obedit && (scene->obedit->lay & v3d->lay)==0) {
|
||||
for(bit=0; bit<32; bit++) {
|
||||
if(scene->obedit->lay & (1<<bit)) {
|
||||
v3d->lay |= 1<<bit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* set active layer, ensure to always have one */
|
||||
if(v3d->lay & (1<<nr))
|
||||
v3d->layact= 1<<nr;
|
||||
else if((v3d->lay & v3d->layact)==0) {
|
||||
int bit= 0;
|
||||
|
||||
while(bit<32) {
|
||||
for(bit=0; bit<32; bit++) {
|
||||
if(v3d->lay & (1<<bit)) {
|
||||
v3d->layact= 1<<bit;
|
||||
break;
|
||||
}
|
||||
bit++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,6 +269,11 @@ void undo_editmode_step(bContext *C, int step)
|
||||
}
|
||||
}
|
||||
|
||||
/* special case for editmesh, mode must be copied back to the scene */
|
||||
if(obedit->type == OB_MESH) {
|
||||
EM_selectmode_to_scene(CTX_data_scene(C), obedit);
|
||||
}
|
||||
|
||||
DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
|
||||
|
||||
/* XXX notifiers */
|
||||
|
||||
@@ -103,7 +103,7 @@ int GPU_non_power_of_two_support()
|
||||
/* Exception for buggy ATI/Apple driver in Mac OS X 10.5/10.6,
|
||||
* they claim to support this but can cause system freeze */
|
||||
#ifdef __APPLE__
|
||||
if(strcmp(glGetString(GL_VENDOR), "ATI Technologies Inc.") == 0)
|
||||
if(strcmp((char*)glGetString(GL_VENDOR), "ATI Technologies Inc.") == 0)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@@ -372,6 +372,13 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
|
||||
GPU_print_error("3D glTexImage3D");
|
||||
|
||||
if (fpixels) {
|
||||
if(!GPU_non_power_of_two_support() && (w != tex->w || h != tex->h || depth != tex->depth)) {
|
||||
/* clear first to avoid unitialized pixels */
|
||||
float *zero= MEM_callocN(sizeof(float)*tex->w*tex->h*tex->depth, "zero");
|
||||
glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->depth, format, type, zero);
|
||||
MEM_freeN(zero);
|
||||
}
|
||||
|
||||
glTexSubImage3D(tex->target, 0, 0, 0, 0, w, h, depth, format, type, fpixels);
|
||||
GPU_print_error("3D glTexSubImage3D");
|
||||
}
|
||||
|
||||
@@ -80,6 +80,10 @@ struct ImBuf *imb_load_dds(unsigned char *mem, int size, int flags)
|
||||
|
||||
/* check if DDS is valid and supported */
|
||||
if (!dds.isValid()) {
|
||||
/* no need to print error here, just testing if it is a DDS */
|
||||
if(flags & IB_test)
|
||||
return (0);
|
||||
|
||||
printf("DDS: not valid; header follows\n");
|
||||
dds.printInfo();
|
||||
return(0);
|
||||
|
||||
@@ -85,40 +85,58 @@ void libtiff_loadlibtiff(void)
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
//inside the blender app package contents/resources
|
||||
libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
//inside the blender app package contents/frameworks
|
||||
libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
//along side the blender app package
|
||||
libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
//inside the blender app package contents/MacOS
|
||||
libtiff = PIL_dynlib_open("@executable_path/libtiff.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
#else
|
||||
libtiff = PIL_dynlib_open("libtiff.so");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("libtiff.so.3");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("libtiff.so.4");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("libtiff.dll");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/lib/libtiff.so");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.3");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.4");
|
||||
if (libtiff != NULL) return;
|
||||
#ifdef __x86_64__
|
||||
libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.3");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.4");
|
||||
if (libtiff != NULL) return;
|
||||
#endif
|
||||
libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.so");
|
||||
if (libtiff != NULL) return;
|
||||
|
||||
@@ -117,25 +117,71 @@ void libtiff_loadlibtiff(void)
|
||||
if (libtiff != NULL) return;
|
||||
|
||||
/* Try to find libtiff in a couple of standard places */
|
||||
#ifdef __APPLE__
|
||||
/* OSX has version specific library */
|
||||
//standard install location
|
||||
libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
//inside the blender app package contents/resources
|
||||
libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
//inside the blender app package contents/frameworks
|
||||
libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
//along side the blender app package
|
||||
libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
//inside the blender app package contents/MacOS
|
||||
libtiff = PIL_dynlib_open("@executable_path/libtiff.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/libtiff.3.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("@executable_path/libtiff.4.dylib");
|
||||
if (libtiff != NULL) return;
|
||||
#else
|
||||
libtiff = PIL_dynlib_open("libtiff.so");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("libtiff.so.3");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("libtiff.so.4");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("libtiff.dll");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/lib/libtiff.so");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.3");
|
||||
if (libtiff != NULL) return;
|
||||
/* OSX has version specific library */
|
||||
libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.4");
|
||||
if (libtiff != NULL) return;
|
||||
#ifdef __x86_64__
|
||||
libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.3");
|
||||
if (libtiff != NULL) return;
|
||||
libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.4");
|
||||
if (libtiff != NULL) return;
|
||||
#endif
|
||||
libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.so");
|
||||
if (libtiff != NULL) return;
|
||||
/* For solaris */
|
||||
libtiff = PIL_dynlib_open("/usr/openwin/lib/libtiff.so");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -145,8 +191,11 @@ void *libtiff_findsymbol(char *name)
|
||||
assert(libtiff != NULL);
|
||||
symbol = PIL_dynlib_find_symbol(libtiff, name);
|
||||
if (symbol == NULL) {
|
||||
printf("libtiff_findsymbol: error %s\\n",
|
||||
PIL_dynlib_get_error_as_string(libtiff));
|
||||
char *err = PIL_dynlib_get_error_as_string(libtiff);
|
||||
|
||||
if (err) printf("libtiff_findsymbol: error %s\\n",err);
|
||||
else printf("libtiff_findsymbol: error Unknown.\\n");
|
||||
|
||||
libtiff = NULL;
|
||||
G.have_libtiff = (0);
|
||||
return NULL;
|
||||
|
||||
@@ -291,7 +291,9 @@ typedef struct UserDef {
|
||||
char sounddir[160];
|
||||
char anim_player[240]; // FILE_MAX length
|
||||
int anim_player_preset;
|
||||
int pad;
|
||||
|
||||
short v2d_min_gridsize; /* minimum spacing between gridlines in View2D grids */
|
||||
short timecode_style; /* style of timecode display */
|
||||
|
||||
short versions;
|
||||
short dbl_click_time;
|
||||
@@ -496,6 +498,21 @@ extern UserDef U; /* from blenkernel blender.c */
|
||||
#define USER_CP_SQUARE_HS 2
|
||||
#define USER_CP_SQUARE_HV 3
|
||||
|
||||
/* timecode display styles */
|
||||
/* as little info as is necessary to show relevant info
|
||||
* with '+' to denote the frames
|
||||
* i.e. HH:MM:SS+FF, MM:SS+FF, SS+FF, or MM:SS
|
||||
*/
|
||||
#define USER_TIMECODE_MINIMAL 0
|
||||
/* reduced SMPTE - (HH:)MM:SS:FF */
|
||||
#define USER_TIMECODE_SMPTE_MSF 1
|
||||
/* full SMPTE - HH:MM:SS:FF */
|
||||
#define USER_TIMECODE_SMPTE_FULL 2
|
||||
/* milliseconds for sub-frames - HH:MM:SS.sss */
|
||||
#define USER_TIMECODE_MILLISECONDS 3
|
||||
/* seconds only */
|
||||
#define USER_TIMECODE_SECONDS_ONLY 4
|
||||
|
||||
/* theme drawtypes */
|
||||
#define TH_MINIMAL 0
|
||||
#define TH_ROUNDSHADED 1
|
||||
|
||||
@@ -158,6 +158,40 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
static ScrArea *rna_area_from_space(PointerRNA *ptr)
|
||||
{
|
||||
bScreen *sc = (bScreen*)ptr->id.data;
|
||||
SpaceLink *link= (SpaceLink*)ptr->data;
|
||||
ScrArea *sa;
|
||||
|
||||
for(sa=sc->areabase.first; sa; sa=sa->next)
|
||||
if(BLI_findindex(&sa->spacedata, link) != -1)
|
||||
return sa;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void rna_area_region_from_regiondata(PointerRNA *ptr, ScrArea **sa_r, ARegion **ar_r)
|
||||
{
|
||||
bScreen *sc = (bScreen*)ptr->id.data;
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
void *regiondata= ptr->data;
|
||||
|
||||
*sa_r= NULL;
|
||||
*ar_r= NULL;
|
||||
|
||||
for(sa=sc->areabase.first; sa; sa=sa->next) {
|
||||
for(ar=sa->regionbase.first; ar; ar=ar->next) {
|
||||
if(ar->regiondata == regiondata) {
|
||||
*sa_r= sa;
|
||||
*ar_r= ar;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static PointerRNA rna_CurrentOrientation_get(PointerRNA *ptr)
|
||||
{
|
||||
Scene *scene = ((bScreen*)ptr->id.data)->scene;
|
||||
@@ -243,6 +277,38 @@ static void rna_Space3DView_layer_set(PointerRNA *ptr, const int *values)
|
||||
v3d->lay= ED_view3d_scene_layer_set(v3d->lay, values);
|
||||
}
|
||||
|
||||
static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr)
|
||||
{
|
||||
View3D *v3d= (View3D*)(ptr->data);
|
||||
ScrArea *sa= rna_area_from_space(ptr);
|
||||
ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
|
||||
ARegion *ar= regionbase->last; /* always last in list, weak .. */
|
||||
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_Region3DView, ar->regiondata);
|
||||
}
|
||||
|
||||
static PointerRNA rna_SpaceView3D_region_quadview_get(PointerRNA *ptr)
|
||||
{
|
||||
View3D *v3d= (View3D*)(ptr->data);
|
||||
ScrArea *sa= rna_area_from_space(ptr);
|
||||
ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
|
||||
ARegion *ar= regionbase->last; /* always before last in list, weak .. */
|
||||
|
||||
ar= (ar->alignment == RGN_ALIGN_QSPLIT)? ar->prev: NULL;
|
||||
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_Region3DView, (ar)? ar->regiondata: NULL);
|
||||
}
|
||||
|
||||
static void rna_Region3DView_quadview_update(Main *main, Scene *scene, PointerRNA *ptr)
|
||||
{
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
|
||||
rna_area_region_from_regiondata(ptr, &sa, &ar);
|
||||
if(sa && ar && ar->alignment==RGN_ALIGN_QSPLIT)
|
||||
ED_view3d_quadview_update(sa, ar);
|
||||
}
|
||||
|
||||
/* Space Image Editor */
|
||||
|
||||
static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
|
||||
@@ -914,21 +980,6 @@ static void rna_def_space_3dview(BlenderRNA *brna)
|
||||
RNA_def_property_pointer_funcs(prop, "rna_CurrentOrientation_get", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current Transformation orientation.");
|
||||
|
||||
prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, "RegionView3D", "viewlock", RV3D_LOCKED);
|
||||
RNA_def_property_ui_text(prop, "Lock", "Lock View Rotation");
|
||||
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "box_preview", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, "RegionView3D", "viewlock", RV3D_BOXVIEW);
|
||||
RNA_def_property_ui_text(prop, "Box", "");
|
||||
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "box_clip", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, "RegionView3D", "viewlock", RV3D_BOXCLIP);
|
||||
RNA_def_property_ui_text(prop, "Clip", "");
|
||||
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
prop= RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1);
|
||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_Space3DView_lock_camera_and_layers_set");
|
||||
@@ -948,6 +999,37 @@ static void rna_def_space_3dview(BlenderRNA *brna)
|
||||
RNA_def_property_array(prop, 20);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Used Layers", "Layers that contain something.");
|
||||
|
||||
prop= RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Region3DView");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_3d_get", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "3D Region", "3D region in this space, in case of quad view the camera region.");
|
||||
|
||||
prop= RNA_def_property(srna, "region_quadview", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Region3DView");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_quadview_get", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Quad View Region", "3D region that defines the quad view settings.");
|
||||
|
||||
/* region */
|
||||
|
||||
srna= RNA_def_struct(brna, "Region3DView", "Region");
|
||||
RNA_def_struct_sdna(srna, "RegionView3D");
|
||||
RNA_def_struct_ui_text(srna, "3D View Region", "3D View region data");
|
||||
|
||||
prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_LOCKED);
|
||||
RNA_def_property_ui_text(prop, "Lock", "Lock view rotation in side views.");
|
||||
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_Region3DView_quadview_update");
|
||||
|
||||
prop= RNA_def_property(srna, "box_preview", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXVIEW);
|
||||
RNA_def_property_ui_text(prop, "Box", "Sync view position between side views.");
|
||||
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_Region3DView_quadview_update");
|
||||
|
||||
prop= RNA_def_property(srna, "box_clip", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXCLIP);
|
||||
RNA_def_property_ui_text(prop, "Clip", "Clip objects based on what's visible in other side views.");
|
||||
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_Region3DView_quadview_update");
|
||||
}
|
||||
|
||||
static void rna_def_space_buttons(BlenderRNA *brna)
|
||||
|
||||
@@ -107,6 +107,40 @@ static void rna_userdef_autokeymode_set(PointerRNA *ptr,int value)
|
||||
}
|
||||
}
|
||||
|
||||
static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value)
|
||||
{
|
||||
UserDef *userdef = (UserDef*)ptr->data;
|
||||
int required_size = userdef->v2d_min_gridsize;
|
||||
|
||||
/* set the timecode style */
|
||||
userdef->timecode_style= value;
|
||||
|
||||
/* adjust the v2d gridsize if needed so that timecodes don't overlap
|
||||
* NOTE: most of these have been hand-picked to avoid overlaps while still keeping
|
||||
* things from getting too blown out
|
||||
*/
|
||||
switch (value) {
|
||||
case USER_TIMECODE_MINIMAL:
|
||||
case USER_TIMECODE_SECONDS_ONLY:
|
||||
/* 35 is great most of the time, but not that great for full-blown */
|
||||
required_size= 35;
|
||||
break;
|
||||
case USER_TIMECODE_SMPTE_MSF:
|
||||
required_size= 50;
|
||||
break;
|
||||
case USER_TIMECODE_SMPTE_FULL:
|
||||
/* the granddaddy! */
|
||||
required_size= 65;
|
||||
break;
|
||||
case USER_TIMECODE_MILLISECONDS:
|
||||
required_size= 45;
|
||||
break;
|
||||
}
|
||||
|
||||
if (U.v2d_min_gridsize < required_size)
|
||||
U.v2d_min_gridsize= required_size;
|
||||
}
|
||||
|
||||
static PointerRNA rna_UserDef_view_get(PointerRNA *ptr)
|
||||
{
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesView, ptr->data);
|
||||
@@ -1682,6 +1716,14 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna)
|
||||
|
||||
static void rna_def_userdef_view(BlenderRNA *brna)
|
||||
{
|
||||
static EnumPropertyItem timecode_styles[] = {
|
||||
{USER_TIMECODE_MINIMAL, "MINIMAL", 0, "Minimal Info", "Most compact representation. Uses '+' as separator for sub-second frame numbers, with left and right truncation of the timecode as necessary."},
|
||||
{USER_TIMECODE_SMPTE_FULL, "SMPTE", 0, "SMPTE (Full)", "Full SMPTE timecode. Format is HH:MM:SS:FF."},
|
||||
{USER_TIMECODE_SMPTE_MSF, "SMPTE_COMPACT", 0, "SMPTE (Compact)", "SMPTE timecode showing minutes, seconds, and frames only. Hours are also shown if necessary, but not by default."},
|
||||
{USER_TIMECODE_MILLISECONDS, "MILLISECONDS", 0, "Compact with Milliseconds", "Similar to SMPTE (Compact), except that instead of frames, milliseconds are shown instead."},
|
||||
{USER_TIMECODE_SECONDS_ONLY, "SECONDS_ONLY", 0, "Only Seconds", "Direct conversion of frame numbers to seconds."},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
PropertyRNA *prop;
|
||||
StructRNA *srna;
|
||||
|
||||
@@ -1769,13 +1811,11 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Auto Depth", "Use the depth under the mouse to improve view pan/rotate/zoom functionality.");
|
||||
|
||||
/* view zoom */
|
||||
|
||||
prop= RNA_def_property(srna, "zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS);
|
||||
RNA_def_property_ui_text(prop, "Zoom To Mouse Position", "Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center.");
|
||||
|
||||
/* view rotation */
|
||||
|
||||
prop= RNA_def_property(srna, "auto_perspective", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_AUTOPERSP);
|
||||
RNA_def_property_ui_text(prop, "Auto Perspective", "Automatically switch between orthographic and perspective when changing from top/front/side views.");
|
||||
@@ -1784,16 +1824,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_SELECTION);
|
||||
RNA_def_property_ui_text(prop, "Rotate Around Selection", "Use selection as the pivot point.");
|
||||
|
||||
/* select with */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
prop= RNA_def_property(srna, "use_middle_mouse_paste", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MMB_PASTE);
|
||||
RNA_def_property_ui_text(prop, "Middle Mouse Paste", "In text window, paste with middle mouse button instead of panning.");
|
||||
|
||||
/* mini axis */
|
||||
prop= RNA_def_property(srna, "show_mini_axis", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_ROTVIEWICON);
|
||||
RNA_def_property_ui_text(prop, "Show Mini Axis", "Show a small rotating 3D axis in the bottom left corner of the 3D View.");
|
||||
@@ -1812,8 +1843,9 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
/* middle mouse button */
|
||||
|
||||
|
||||
prop= RNA_def_property(srna, "use_middle_mouse_paste", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MMB_PASTE);
|
||||
RNA_def_property_ui_text(prop, "Middle Mouse Paste", "In text window, paste with middle mouse button instead of panning.");
|
||||
|
||||
prop= RNA_def_property(srna, "wheel_invert_zoom", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_WHEELZOOMDIR);
|
||||
@@ -1862,6 +1894,21 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
||||
RNA_def_property_range(prop, 4, 10);
|
||||
RNA_def_property_ui_text(prop, "Object Origin Size", "Diameter in Pixels for Object/Lamp origin display.");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
/* View2D Grid Displays */
|
||||
prop= RNA_def_property(srna, "view2d_grid_minimum_spacing", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "v2d_min_gridsize");
|
||||
RNA_def_property_range(prop, 1, 500); // XXX: perhaps the lower range should only go down to 5?
|
||||
RNA_def_property_ui_text(prop, "2D View Minimum Grid Spacing", "Minimum number of pixels between each gridline in 2D Viewports");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
// TODO: add a setter for this, so that we can bump up the minimum size as necessary...
|
||||
prop= RNA_def_property(srna, "timecode_style", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, timecode_styles);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "timecode_style");
|
||||
RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_timecode_style_set", NULL);
|
||||
RNA_def_property_ui_text(prop, "TimeCode Style", "Format of Time Codes displayed when not displaying timing in terms of frames.");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
}
|
||||
|
||||
static void rna_def_userdef_edit(BlenderRNA *brna)
|
||||
@@ -1874,6 +1921,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
|
||||
{AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
// XXX: we could just use the one that is defined in rna_curve.h
|
||||
static EnumPropertyItem new_interpolation_types[] = {
|
||||
{BEZT_IPO_CONST, "CONSTANT", 0, "Constant", ""},
|
||||
{BEZT_IPO_LIN, "LINEAR", 0, "Linear", ""},
|
||||
|
||||
@@ -571,7 +571,7 @@ static PyGetSetDef Euler_getseters[] = {
|
||||
{"y", (getter)Euler_getAxis, (setter)Euler_setAxis, "Euler Y axis in radians. **type** float", (void *)1},
|
||||
{"z", (getter)Euler_getAxis, (setter)Euler_setAxis, "Euler Z axis in radians. **type** float", (void *)2},
|
||||
|
||||
{"wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
|
||||
{"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
|
||||
{"_owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
|
||||
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
@@ -1231,6 +1231,23 @@ static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type )
|
||||
return PyFloat_FromDouble(mat3_to_scale(mat));
|
||||
}
|
||||
|
||||
static PyObject *Matrix_getIsNegative( MatrixObject * self, void *type )
|
||||
{
|
||||
if(!BaseMath_ReadCallback(self))
|
||||
return NULL;
|
||||
|
||||
/*must be 3-4 cols, 3-4 rows, square matrix*/
|
||||
if(self->colSize == 4 && self->rowSize == 4)
|
||||
return PyBool_FromLong(is_negative_m4((float (*)[4])*self->matrix));
|
||||
else if(self->colSize == 3 && self->rowSize == 3)
|
||||
return PyBool_FromLong(is_negative_m3((float (*)[3])*self->matrix));
|
||||
else {
|
||||
PyErr_SetString(PyExc_AttributeError, "Matrix.is_negative: inappropriate matrix size - expects 3x3 or 4x4 matrix\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python attributes get/set structure: */
|
||||
/*****************************************************************************/
|
||||
@@ -1238,7 +1255,8 @@ static PyGetSetDef Matrix_getseters[] = {
|
||||
{"row_size", (getter)Matrix_getRowSize, (setter)NULL, "The row size of the matrix (readonly). **type** int", NULL},
|
||||
{"col_size", (getter)Matrix_getColSize, (setter)NULL, "The column size of the matrix (readonly). **type** int", NULL},
|
||||
{"median_scale", (getter)Matrix_getMedianScale, (setter)NULL, "The average scale applied to each axis (readonly). **type** float", NULL},
|
||||
{"wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
|
||||
{"is_negative", (getter)Matrix_getIsNegative, (setter)NULL, "True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly). **type** bool", NULL},
|
||||
{"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
|
||||
{"_owner",(getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
|
||||
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
@@ -854,7 +854,7 @@ static PyGetSetDef Quaternion_getseters[] = {
|
||||
{"magnitude", (getter)Quaternion_getMagnitude, (setter)NULL, "Size of the quaternion (readonly). **type** float", NULL},
|
||||
{"angle", (getter)Quaternion_getAngle, (setter)NULL, "angle of the quaternion (readonly). **type** float", NULL},
|
||||
{"axis",(getter)Quaternion_getAxisVec, (setter)NULL, "quaternion axis as a vector (readonly). **type** :class:`Vector`", NULL},
|
||||
{"wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
|
||||
{"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
|
||||
{"_owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
|
||||
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
@@ -1635,7 +1635,7 @@ static PyGetSetDef Vector_getseters[] = {
|
||||
{"w", (getter)Vector_getAxis, (setter)Vector_setAxis, "Vector W axis (4D Vectors only). **type** float", (void *)3},
|
||||
{"length", (getter)Vector_getLength, (setter)Vector_setLength, "Vector Length. **type** float", NULL},
|
||||
{"magnitude", (getter)Vector_getLength, (setter)Vector_setLength, "Vector Length. **type** float", NULL},
|
||||
{"wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
|
||||
{"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
|
||||
{"_owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
|
||||
|
||||
/* autogenerated swizzle attrs, see python script below */
|
||||
|
||||
@@ -238,6 +238,7 @@ static void bpy_init_modules( void )
|
||||
sprintf(tmpstr, "%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
|
||||
PyModule_AddStringConstant(mod, "_VERSION_STR", tmpstr);
|
||||
PyModule_AddStringConstant(mod, "_BINPATH", bprogname);
|
||||
PyModule_AddIntConstant(mod, "_DEBUG", G.f & G_DEBUG ? 1:0);
|
||||
}
|
||||
|
||||
/* add our own modules dir, this is a python package */
|
||||
|
||||
@@ -3575,6 +3575,7 @@ PyObject *BPY_rna_types(void)
|
||||
}
|
||||
|
||||
self= (BPy_BaseTypeRNA *)PyObject_NEW( BPy_BaseTypeRNA, &pyrna_basetype_Type );
|
||||
self->arraydim = self->arrayoffset = 0; /* unused but better set */
|
||||
|
||||
/* avoid doing this lookup for every getattr */
|
||||
RNA_blender_rna_pointer_create(&self->ptr);
|
||||
|
||||
@@ -2108,7 +2108,7 @@ void do_material_tex(ShadeInput *shi)
|
||||
texres.nor[0] = -texres.nor[0];
|
||||
texres.nor[1] = -texres.nor[1];
|
||||
}
|
||||
fact = Tnor*tex->norfac;
|
||||
fact = Tnor*fabs(tex->norfac);
|
||||
if (fact>1.f) fact = 1.f;
|
||||
facm = 1.f-fact;
|
||||
if(mtex->normapspace == MTEX_NSPACE_TANGENT) {
|
||||
|
||||
@@ -190,11 +190,10 @@ void WM_keymap_init(bContext *C)
|
||||
/* create default key config */
|
||||
wm_window_keymap(wm->defaultconf);
|
||||
ED_spacetypes_keymap(wm->defaultconf);
|
||||
WM_keyconfig_userdef(wm);
|
||||
|
||||
wm->initialized |= WM_INIT_KEYMAP;
|
||||
}
|
||||
|
||||
WM_keyconfig_userdef(wm);
|
||||
}
|
||||
|
||||
void WM_check(bContext *C)
|
||||
|
||||
Reference in New Issue
Block a user