merge own commits into render branch into trunk since 27560

27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
This commit is contained in:
2010-03-20 16:41:01 +00:00
parent 7178f10b81
commit 391cc2d004
44 changed files with 619 additions and 240 deletions

View File

@@ -181,11 +181,12 @@ IF(UNIX AND NOT APPLE)
ENDIF(NOT SDL_FOUND)
ENDIF(WITH_SDL)
SET(OPENEXR /usr CACHE FILEPATH "OPENEXR Directory")
FIND_PATH(OPENEXR_INC
ImfXdr.h
PATHS
${OPENEXR}/include/OpenEXR
/usr/local/include/OpenEXR
/usr/include/OpenEXR
/sw/include/OpenEXR
/opt/local/include/OpenEXR
/opt/csw/include/OpenEXR

View File

@@ -316,7 +316,7 @@ def line_value(line_split):
def load_image(imagepath, dirname):
if os.path.exists(imagepath):
return bpy.data.add_image(imagepath)
return bpy.data.images.load(imagepath)
variants = [os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))]

View File

@@ -19,30 +19,63 @@
# <pep8 compliant>
import bpy
from bpy.props import StringProperty
class EditExternally(bpy.types.Operator):
'''Edit image in an external application'''
bl_idname = "image.external_edit"
bl_label = "Image Edit Externally"
bl_options = {'REGISTER'}
def image_editor_guess(context):
import platform
system = platform.system()
image_editor = context.user_preferences.filepaths.image_editor
path = StringProperty(name="File Path", description="Path to an image file", maxlen= 1024, default= "")
# use image editor in the preferences when available.
if not image_editor:
if system == 'Windows':
image_editor = ["start"] # not tested!
elif system == 'Darwin':
image_editor = ["open"]
def _editor_guess(self, context):
import platform
system = platform.system()
image_editor = context.user_preferences.filepaths.image_editor
# use image editor in the preferences when available.
if not image_editor:
if system == 'Windows':
image_editor = ["start"] # not tested!
elif system == 'Darwin':
image_editor = ["open"]
else:
image_editor = ["gimp"]
else:
image_editor = ["gimp"]
else:
if system == 'Darwin':
# blender file selector treats .app as a folder
# and will include a trailing backslash, so we strip it.
image_editor.rstrip('\\')
image_editor = ["open", "-a", image_editor]
if system == 'Darwin':
# blender file selector treats .app as a folder
# and will include a trailing backslash, so we strip it.
image_editor.rstrip('\\')
image_editor = ["open", "-a", image_editor]
return image_editor
return image_editor
def execute(self, context):
import subprocess
path = self.properties.path
image_editor = self._editor_guess(context)
cmd = []
cmd.extend(image_editor)
cmd.append(bpy.utils.expandpath(path))
subprocess.Popen(cmd)
return {'FINISHED'}
def invoke(self, context, event):
try:
path = context.space_data.image.filename
except:
self.report({'ERROR'}, "Image not found on disk")
return {'CANCELLED'}
self.properties.path = path
self.execute(context)
return {'FINISHED'}
class SaveDirty(bpy.types.Operator):
@@ -79,7 +112,6 @@ class ProjectEdit(bpy.types.Operator):
import subprocess
EXT = "png" # could be made an option but for now ok
image_editor = image_editor_guess(context)
for image in bpy.data.images:
image.tag = True
@@ -124,11 +156,7 @@ class ProjectEdit(bpy.types.Operator):
image_new.file_format = 'PNG'
image_new.save()
cmd = []
cmd.extend(image_editor)
cmd.append(bpy.utils.expandpath(filename_final))
subprocess.Popen(cmd)
bpy.ops.image.external_edit(path=filename_final)
return {'FINISHED'}
@@ -155,6 +183,7 @@ class ProjectApply(bpy.types.Operator):
classes = [
EditExternally,
SaveDirty,
ProjectEdit,
ProjectApply]

View File

@@ -44,7 +44,7 @@ class DataButtonsPanelActive(DataButtonsPanel):
def poll(self, context):
curve = context.curve
return (curve and curve.active_spline)
return (curve and curve.splines.active)
class DATA_PT_context_curve(DataButtonsPanel):
@@ -205,7 +205,7 @@ class DATA_PT_active_spline(DataButtonsPanelActive):
ob = context.object
curve = context.curve
act_spline = curve.active_spline
act_spline = curve.splines.active
is_surf = (ob.type == 'SURFACE')
is_poly = (act_spline.type == 'POLY')

View File

@@ -115,6 +115,8 @@ class IMAGE_MT_image(bpy.types.Menu):
if ima.source == 'SEQUENCE':
layout.operator("image.save_sequence")
layout.operator("image.external_edit", "Edit Externally")
if not show_render:
layout.separator()

View File

@@ -1413,8 +1413,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
addons = [(mod, addon_info_get(mod)) for mod in self._addon_list()]
cats = {info["category"] for mod, info in addons}
cats.add("")
cats.remove("")
cats.discard("")
cats = ['All', 'Disabled', 'Enabled'] + sorted(cats)
@@ -1489,6 +1488,24 @@ class USERPREF_PT_addons(bpy.types.Panel):
split.separator()
split.separator()
# Append missing scripts
# First collect scripts that are used but have no script file.
module_names = {mod.__name__ for mod, info in addons}
missing_modules = {ext for ext in used_ext if ext not in module_names}
if missing_modules and filter in ("All", "Enabled"):
layout.column().separator()
layout.column().label(text="Missing script files")
module_names = {mod.__name__ for mod, info in addons}
for ext in sorted(missing_modules):
# Addon UI Code
box = layout.column().box()
column = box.column()
row = column.row()
row.label(text=ext, icon="ERROR")
row.operator("wm.addon_disable").module = ext
from bpy.props import *
@@ -1537,21 +1554,8 @@ class WM_OT_addon_enable(bpy.types.Operator):
# check if add-on is written for current blender version, or raise a warning
info = addon_info_get(mod)
if info["blender"]:
version = info["blender"].split(".", 2)
for i in range(len(version)):
try:
version[i] = int(version[i])
except:
break
if version[i] > bpy.app.version[i]:
self.report("WARNING','This script was written for a newer version of Blender \
and might not function (correctly).\nThe script is enabled though.")
elif version[i] == bpy.app.version[i]:
continue
else:
break
if info.get("blender", (0, 0, 0)) > bpy.app.version:
self.report("WARNING','This script was written for a newer version of Blender and might not function (correctly).\nThe script is enabled though.")
return {'FINISHED'}
@@ -1668,7 +1672,6 @@ class WM_OT_addon_expand(bpy.types.Operator):
info = addon_info_get(mod)
info["expanded"] = not info["expanded"]
print(info["expanded"])
return {'FINISHED'}

View File

@@ -40,12 +40,12 @@ struct ListBase;
struct BezTriple;
struct BevList;
#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_CYCLIC) ? (nu->orderu-1) : 0) )
#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_CYCLIC) ? (nu->orderv-1) : 0) )
#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_NURB_CYCLIC) ? (nu->orderu-1) : 0) )
#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_NURB_CYCLIC) ? (nu->orderv-1) : 0) )
/* Non cyclic nurbs have 1 less segment */
#define SEGMENTSU(nu) ( ((nu)->flagu & CU_CYCLIC) ? (nu)->pntsu : (nu)->pntsu-1 )
#define SEGMENTSV(nu) ( ((nu)->flagv & CU_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 )
#define SEGMENTSU(nu) ( ((nu)->flagu & CU_NURB_CYCLIC) ? (nu)->pntsu : (nu)->pntsu-1 )
#define SEGMENTSV(nu) ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 )
#define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1)
#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || cu->bevobj || cu->ext1!=0.0 || cu->ext2!=0.0) ? 1:0)
@@ -89,6 +89,9 @@ void sethandlesNurb(ListBase *editnurb, short code);
void switchdirectionNurb( struct Nurb *nu);
void addNurbPoints(struct Nurb *nu, int number);
void addNurbPointsBezier(struct Nurb *nu, int number);
float (*curve_getVertexCos(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3];
void curve_applyVertexCos(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]);

View File

@@ -771,6 +771,8 @@ static short animsys_remap_path (AnimMapper *remap, char *path, char **dst)
/* Write the given value to a setting using RNA, and return success */
static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_index, float value)
{
// printf("%p %s %i %f\n", ptr, path, array_index, value);
PropertyRNA *prop;
PointerRNA new_ptr;
@@ -780,22 +782,35 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
/* set value - only for animatable numerical values */
if (RNA_property_animateable(&new_ptr, prop))
{
int array_len= RNA_property_array_length(&new_ptr, prop);
if(array_len && array_index >= array_len)
{
if (G.f & G_DEBUG) {
printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d \n",
(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>",
path, array_index, array_len-1);
}
return 0;
}
switch (RNA_property_type(prop))
{
case PROP_BOOLEAN:
if (RNA_property_array_length(&new_ptr, prop))
if (array_len)
RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value);
else
RNA_property_boolean_set(&new_ptr, prop, (int)value);
break;
case PROP_INT:
if (RNA_property_array_length(&new_ptr, prop))
if (array_len)
RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value);
else
RNA_property_int_set(&new_ptr, prop, (int)value);
break;
case PROP_FLOAT:
if (RNA_property_array_length(&new_ptr, prop))
if (array_len)
RNA_property_float_set_index(&new_ptr, prop, array_index, value);
else
RNA_property_float_set(&new_ptr, prop, value);
@@ -817,7 +832,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
// XXX don't tag as failed yet though, as there are some legit situations (Action Constraint)
// where some channels will not exist, but shouldn't lock up Action
if (G.f & G_DEBUG) {
printf("Animato: Invalid path. ID = '%s', '%s [%d]' \n",
printf("Animato: Invalid path. ID = '%s', '%s[%d]' \n",
(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>",
path, array_index);
}
@@ -989,6 +1004,9 @@ static void nlastrip_evaluate_controls (NlaStrip *strip, float ctime)
/* execute these settings as per normal */
animsys_evaluate_fcurves(&strip_ptr, &strip->fcurves, NULL, ctime);
}
if (strip->flag & NLASTRIP_FLAG_USR_TIME && strip->flag & NLASTRIP_FLAG_USR_TIME_CYCLIC)
strip->strip_time= fmod(strip->strip_time - strip->actstart, strip->actend - strip->actstart);
}
/* gets the strip active at the current time for a list of strips for evaluation purposes */

View File

@@ -519,7 +519,47 @@ void minmaxNurb(Nurb *nu, float *min, float *max)
bp++;
}
}
}
/* be sure to call makeknots after this */
void addNurbPoints(Nurb *nu, int number)
{
BPoint *tmp= nu->bp;
int i;
nu->bp= (BPoint *)MEM_mallocN((nu->pntsu + number) * sizeof(BPoint), "rna_Curve_spline_points_add");
if(tmp) {
memmove(nu->bp, tmp, nu->pntsu * sizeof(BPoint));
MEM_freeN(tmp);
}
memset(nu->bp + nu->pntsu, 0, number * sizeof(BPoint));
for(i=0, tmp= nu->bp + nu->pntsu; i < number; i++, tmp++) {
tmp->radius= 1.0f;
}
nu->pntsu += number;
}
void addNurbPointsBezier(Nurb *nu, int number)
{
BezTriple *tmp= nu->bezt;
int i;
nu->bezt= (BezTriple *)MEM_mallocN((nu->pntsu + number) * sizeof(BezTriple), "rna_Curve_spline_points_add");
if(tmp) {
memmove(nu->bezt, tmp, nu->pntsu * sizeof(BezTriple));
MEM_freeN(tmp);
}
memset(nu->bezt + nu->pntsu, 0, number * sizeof(BezTriple));
for(i=0, tmp= nu->bezt + nu->pntsu; i < number; i++, tmp++) {
tmp->radius= 1.0f;
}
nu->pntsu += number;
}
/* ~~~~~~~~~~~~~~~~~~~~Non Uniform Rational B Spline calculations ~~~~~~~~~~~ */
@@ -603,7 +643,7 @@ void makeknots(Nurb *nu, short uv)
if(nu->knotsu) MEM_freeN(nu->knotsu);
if(check_valid_nurb_u(nu)) {
nu->knotsu= MEM_callocN(4+sizeof(float)*KNOTSU(nu), "makeknots");
if(nu->flagu & CU_CYCLIC) {
if(nu->flagu & CU_NURB_CYCLIC) {
calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0); /* cyclic should be uniform */
makecyclicknots(nu->knotsu, nu->pntsu, nu->orderu);
} else {
@@ -616,7 +656,7 @@ void makeknots(Nurb *nu, short uv)
if(nu->knotsv) MEM_freeN(nu->knotsv);
if(check_valid_nurb_v(nu)) {
nu->knotsv= MEM_callocN(4+sizeof(float)*KNOTSV(nu), "makeknots");
if(nu->flagv & CU_CYCLIC) {
if(nu->flagv & CU_NURB_CYCLIC) {
calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0); /* cyclic should be uniform */
makecyclicknots(nu->knotsv, nu->pntsv, nu->orderv);
} else {
@@ -734,18 +774,18 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
fp= nu->knotsu;
ustart= fp[nu->orderu-1];
if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
else uend= fp[nu->pntsu];
ustep= (uend-ustart)/((nu->flagu & CU_CYCLIC) ? totu : totu - 1);
ustep= (uend-ustart)/((nu->flagu & CU_NURB_CYCLIC) ? totu : totu - 1);
basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbfaces3");
fp= nu->knotsv;
vstart= fp[nu->orderv-1];
if(nu->flagv & CU_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1];
if(nu->flagv & CU_NURB_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1];
else vend= fp[nu->pntsv];
vstep= (vend-vstart)/((nu->flagv & CU_CYCLIC) ? totv : totv - 1);
vstep= (vend-vstart)/((nu->flagv & CU_NURB_CYCLIC) ? totv : totv - 1);
len= KNOTSV(nu);
basisv= (float *)MEM_mallocN(sizeof(float)*len*totv, "makeNurbfaces3");
@@ -753,7 +793,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
jend= (int *)MEM_mallocN(sizeof(float)*totv, "makeNurbfaces5");
/* precalculation of basisv and jstart,jend */
if(nu->flagv & CU_CYCLIC) cycl= nu->orderv-1;
if(nu->flagv & CU_NURB_CYCLIC) cycl= nu->orderv-1;
else cycl= 0;
v= vstart;
basis= basisv;
@@ -764,7 +804,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride)
v+= vstep;
}
if(nu->flagu & CU_CYCLIC) cycl= nu->orderu-1;
if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1;
else cycl= 0;
in= coord_array;
u= ustart;
@@ -882,13 +922,13 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
fp= nu->knotsu;
ustart= fp[nu->orderu-1];
if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
else uend= fp[nu->pntsu];
ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_CYCLIC) ? 0 : 1));
ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_NURB_CYCLIC) ? 0 : 1));
basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbcurve3");
if(nu->flagu & CU_CYCLIC) cycl= nu->orderu-1;
if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1;
else cycl= 0;
u= ustart;
@@ -1022,8 +1062,8 @@ float *make_orco_surf(Object *ob)
sizeu = nu->pntsu*nu->resolu;
sizev = nu->pntsv*nu->resolv;
if (nu->flagu & CU_CYCLIC) sizeu++;
if (nu->flagv & CU_CYCLIC) sizev++;
if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
if (nu->flagv & CU_NURB_CYCLIC) sizev++;
if(nu->pntsv>1) tot+= sizeu * sizev;
nu= nu->next;
@@ -1036,8 +1076,8 @@ float *make_orco_surf(Object *ob)
if(nu->pntsv>1) {
sizeu = nu->pntsu*nu->resolu;
sizev = nu->pntsv*nu->resolv;
if (nu->flagu & CU_CYCLIC) sizeu++;
if (nu->flagv & CU_CYCLIC) sizev++;
if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
if (nu->flagv & CU_NURB_CYCLIC) sizev++;
if(cu->flag & CU_UV_ORCO) {
for(b=0; b< sizeu; b++) {
@@ -1063,12 +1103,12 @@ float *make_orco_surf(Object *ob)
for(b=0; b<sizeu; b++) {
int use_b= b;
if (b==sizeu-1 && (nu->flagu & CU_CYCLIC))
if (b==sizeu-1 && (nu->flagu & CU_NURB_CYCLIC))
use_b= 0;
for(a=0; a<sizev; a++) {
int use_a= a;
if (a==sizev-1 && (nu->flagv & CU_CYCLIC))
if (a==sizev-1 && (nu->flagv & CU_NURB_CYCLIC))
use_a= 0;
tdata = _tdata + 3 * (use_b * (nu->pntsv*nu->resolv) + use_a);
@@ -1511,14 +1551,14 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
/* returns a point */
if(prevbezt==nu->bezt) {
if(nu->flagu & CU_CYCLIC) pprev= last;
if(nu->flagu & CU_NURB_CYCLIC) pprev= last;
else pprev= prevbezt;
}
else pprev= prevbezt-1;
/* next point */
if(bezt==last) {
if(nu->flagu & CU_CYCLIC) next= nu->bezt;
if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
else next= bezt;
}
else next= bezt+1;
@@ -1977,7 +2017,7 @@ void makeBevelList(Object *ob)
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList2");
BLI_addtail(&(cu->bev), bl);
if(nu->flagu & CU_CYCLIC) bl->poly= 0;
if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
else bl->poly= -1;
bl->nr= len;
bl->dupe_nr= 0;
@@ -1995,17 +2035,17 @@ void makeBevelList(Object *ob)
}
else if(nu->type == CU_BEZIER) {
len= resolu*(nu->pntsu+ (nu->flagu & CU_CYCLIC) -1)+1; /* in case last point is not cyclic */
len= resolu*(nu->pntsu+ (nu->flagu & CU_NURB_CYCLIC) -1)+1; /* in case last point is not cyclic */
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelBPoints");
BLI_addtail(&(cu->bev), bl);
if(nu->flagu & CU_CYCLIC) bl->poly= 0;
if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
else bl->poly= -1;
bevp= (BevPoint *)(bl+1);
a= nu->pntsu-1;
bezt= nu->bezt;
if(nu->flagu & CU_CYCLIC) {
if(nu->flagu & CU_NURB_CYCLIC) {
a++;
prevbezt= nu->bezt+(nu->pntsu-1);
}
@@ -2066,7 +2106,7 @@ void makeBevelList(Object *ob)
bezt++;
}
if((nu->flagu & CU_CYCLIC)==0) { /* not cyclic: endpoint */
if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic: endpoint */
VECCOPY(bevp->vec, prevbezt->vec[1]);
bevp->alfa= prevbezt->alfa;
bevp->radius= prevbezt->radius;
@@ -2081,7 +2121,7 @@ void makeBevelList(Object *ob)
BLI_addtail(&(cu->bev), bl);
bl->nr= len;
bl->dupe_nr= 0;
if(nu->flagu & CU_CYCLIC) bl->poly= 0;
if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
else bl->poly= -1;
bevp= (BevPoint *)(bl+1);
@@ -2521,7 +2561,7 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
a= nu->pntsu;
bezt= nu->bezt;
if(nu->flagu & CU_CYCLIC) prev= bezt+(a-1);
if(nu->flagu & CU_NURB_CYCLIC) prev= bezt+(a-1);
else prev= 0;
next= bezt+1;
@@ -2529,7 +2569,7 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
calchandleNurb(bezt, prev, next, 0);
prev= bezt;
if(a==1) {
if(nu->flagu & CU_CYCLIC) next= nu->bezt;
if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
else next= 0;
}
else next++;
@@ -2986,7 +3026,7 @@ int check_valid_nurb_u( struct Nurb *nu )
if (nu->type != CU_NURBS) return 1; /* not a nurb, lets assume its valid */
if (nu->pntsu < nu->orderu) return 0;
if (((nu->flag & CU_CYCLIC)==0) && ((nu->flagu>>1) & 2)) { /* Bezier U Endpoints */
if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) { /* Bezier U Endpoints */
if (nu->orderu==4) {
if (nu->pntsu < 5) return 0; /* bezier with 4 orderu needs 5 points */
} else if (nu->orderu != 3) return 0; /* order must be 3 or 4 */
@@ -3000,7 +3040,7 @@ int check_valid_nurb_v( struct Nurb *nu)
if (nu->type != CU_NURBS) return 1; /* not a nurb, lets assume its valid */
if (nu->pntsv < nu->orderv) return 0;
if (((nu->flag & CU_CYCLIC)==0) && ((nu->flagv>>1) & 2)) { /* Bezier V Endpoints */
if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) { /* Bezier V Endpoints */
if (nu->orderv==4) {
if (nu->pntsv < 5) return 0; /* bezier with 4 orderu needs 5 points */
} else if (nu->orderv != 3) return 0; /* order must be 3 or 4 */
@@ -3015,7 +3055,7 @@ int clamp_nurb_order_u( struct Nurb *nu )
nu->orderu= nu->pntsu;
change= 1;
}
if(((nu->flag & CU_CYCLIC)==0) && (nu->flagu>>1)&2) {
if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) {
CLAMP(nu->orderu, 3,4);
change= 1;
}
@@ -3029,7 +3069,7 @@ int clamp_nurb_order_v( struct Nurb *nu)
nu->orderv= nu->pntsv;
change= 1;
}
if(((nu->flag & CU_CYCLIC)==0) && (nu->flagv>>1)&2) {
if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) {
CLAMP(nu->orderv, 3,4);
change= 1;
}

View File

@@ -840,17 +840,17 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
/* count */
len= 0;
a= nu->pntsu-1;
if(nu->flagu & CU_CYCLIC) a++;
if(nu->flagu & CU_NURB_CYCLIC) a++;
prevbezt= nu->bezt;
bezt= prevbezt+1;
while(a--) {
if(a==0 && (nu->flagu & CU_CYCLIC)) bezt= nu->bezt;
if(a==0 && (nu->flagu & CU_NURB_CYCLIC)) bezt= nu->bezt;
if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) len++;
else len+= resolu;
if(a==0 && (nu->flagu & CU_CYCLIC)==0) len++;
if(a==0 && (nu->flagu & CU_NURB_CYCLIC)==0) len++;
prevbezt= bezt;
bezt++;
@@ -867,7 +867,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
data= dl->verts;
if(nu->flagu & CU_CYCLIC) {
if(nu->flagu & CU_NURB_CYCLIC) {
dl->type= DL_POLY;
a= nu->pntsu;
}
@@ -920,7 +920,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
dl->charidx = nu->charidx;
data= dl->verts;
if(nu->flagu & CU_CYCLIC) dl->type= DL_POLY;
if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
makeNurbcurve(nu, data, NULL, NULL, resolu, 3*sizeof(float));
}
@@ -935,7 +935,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
dl->charidx = nu->charidx;
data= dl->verts;
if(nu->flagu & CU_CYCLIC) dl->type= DL_POLY;
if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
a= len;
@@ -1610,7 +1610,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
dl->rt= nu->flag;
data= dl->verts;
if(nu->flagu & CU_CYCLIC) dl->type= DL_POLY;
if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
makeNurbcurve(nu, data, NULL, NULL, nu->resolu, 3*sizeof(float));
@@ -1631,8 +1631,8 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
dl->parts= (nu->pntsu*nu->resolu); /* in reverse, because makeNurbfaces works that way */
dl->nr= (nu->pntsv*nu->resolv);
if(nu->flagv & CU_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
if(nu->flagu & CU_CYCLIC) dl->flag|= DL_CYCL_V;
if(nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
if(nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V;
makeNurbfaces(nu, data, 0);

View File

@@ -473,7 +473,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
nu2->pntsv = 1;
nu2->orderu = 4;
nu2->orderv = 1;
nu2->flagu = CU_CYCLIC;
nu2->flagu = CU_NURB_CYCLIC;
bp = (BPoint*)MEM_callocN(4 * sizeof(BPoint),"underline_bp");
if (bp == 0){

View File

@@ -1165,7 +1165,7 @@ void mesh_to_curve(Scene *scene, Object *ob)
nu->pntsu= totpoly;
nu->pntsv= 1;
nu->orderu= 4;
nu->flagu= 2 | (closed ? CU_CYCLIC:0); /* endpoint */
nu->flagu= CU_NURB_ENDPOINT | (closed ? CU_NURB_CYCLIC:0); /* endpoint */
nu->resolu= 12;
nu->bp= (BPoint *)MEM_callocN(sizeof(BPoint)*totpoly, "bpoints");

View File

@@ -49,6 +49,7 @@ int BLI_findstringindex(struct ListBase *listbase, const char *id, int offset);
void BLI_freelistN(struct ListBase *listbase);
void BLI_addtail(struct ListBase *listbase, void *vlink);
void BLI_remlink(struct ListBase *listbase, void *vlink);
int BLI_remlink_safe(struct ListBase *listbase, void *vlink);
void BLI_addhead(struct ListBase *listbase, void *vlink);
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink);

View File

@@ -150,7 +150,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
nu->pntsu = onpoints[j];
nu->resolu= 8;
nu->flag= CU_2D;
nu->flagu= CU_CYCLIC;
nu->flagu= CU_NURB_CYCLIC;
nu->bezt = bezt;
//individual curve loop, start-end

View File

@@ -108,6 +108,17 @@ void BLI_remlink(ListBase *listbase, void *vlink)
if (listbase->first == link) listbase->first = link->next;
}
int BLI_remlink_safe(ListBase *listbase, void *vlink)
{
if(BLI_findindex(listbase, vlink) != -1) {
BLI_remlink(listbase, vlink);
return 1;
}
else {
return 0;
}
}
void BLI_freelinkN(ListBase *listbase, void *vlink)
{

View File

@@ -545,7 +545,7 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob)
/* apply current transform from parent (not yet destroyed),
* then calculate new parent inverse matrix
*/
ED_object_apply_obmat(ob);
object_apply_mat4(ob, ob->obmat);
what_does_parent(scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);

View File

@@ -929,9 +929,9 @@ static void adduplicateflagNurb(Object *obedit, short flag)
bezt1++;
}
if(nu->flagu & CU_CYCLIC) {
if(nu->flagu & CU_NURB_CYCLIC) {
if(starta!=0 || enda!=nu->pntsu-1) {
newnu->flagu &= ~CU_CYCLIC;
newnu->flagu &= ~CU_NURB_CYCLIC;
}
}
}
@@ -966,9 +966,9 @@ static void adduplicateflagNurb(Object *obedit, short flag)
bp1++;
}
if(nu->flagu & CU_CYCLIC) {
if(nu->flagu & CU_NURB_CYCLIC) {
if(starta!=0 || enda!=nu->pntsu-1) {
newnu->flagu &= ~CU_CYCLIC;
newnu->flagu &= ~CU_NURB_CYCLIC;
}
}
@@ -1904,7 +1904,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
newly created. Old points are discarded.
*/
/* count */
if(nu->flagu & CU_CYCLIC) {
if(nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bezt= nu->bezt;
prevbezt= bezt+(a-1);
@@ -1925,7 +1925,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
beztnew =
(BezTriple*)MEM_mallocN((amount + nu->pntsu) * sizeof(BezTriple), "subdivNurb");
beztn= beztnew;
if(nu->flagu & CU_CYCLIC) {
if(nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bezt= nu->bezt;
prevbezt= bezt+(a-1);
@@ -1957,7 +1957,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
mid_v3_v3v3(beztn->vec[1], vec+9, vec+12);
VECCOPY(beztn->vec[2], vec+12);
/* handle of next bezt */
if(a==0 && (nu->flagu & CU_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);}
if(a==0 && (nu->flagu & CU_NURB_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);}
else {VECCOPY(bezt->vec[0], vec+6);}
beztn->radius = (prevbezt->radius + bezt->radius)/2.0f;
@@ -1970,7 +1970,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
bezt++;
}
/* last point */
if((nu->flagu & CU_CYCLIC)==0) memcpy(beztn, prevbezt, sizeof(BezTriple));
if((nu->flagu & CU_NURB_CYCLIC)==0) memcpy(beztn, prevbezt, sizeof(BezTriple));
MEM_freeN(nu->bezt);
nu->bezt= beztnew;
@@ -1987,7 +1987,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
stable... nzc 30-5-'00
*/
/* count */
if(nu->flagu & CU_CYCLIC) {
if(nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bp= nu->bp;
prevbp= bp+(a-1);
@@ -2009,7 +2009,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
(BPoint*)MEM_mallocN((amount + nu->pntsu) * sizeof(BPoint), "subdivNurb2");
bpn= bpnew;
if(nu->flagu & CU_CYCLIC) {
if(nu->flagu & CU_NURB_CYCLIC) {
a= nu->pntsu;
bp= nu->bp;
prevbp= bp+(a-1);
@@ -2036,7 +2036,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
prevbp= bp;
bp++;
}
if((nu->flagu & CU_CYCLIC)==0) memcpy(bpn, prevbp, sizeof(BPoint)); /* last point */
if((nu->flagu & CU_NURB_CYCLIC)==0) memcpy(bpn, prevbp, sizeof(BPoint)); /* last point */
MEM_freeN(nu->bp);
nu->bp= bpnew;
@@ -2423,8 +2423,8 @@ static int convertspline(short type, Nurb *nu)
else if(type==CU_NURBS) {
nu->type = CU_NURBS;
nu->orderu= 4;
nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */
nu->flagu += 4;
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
nu->flagu |= CU_NURB_BEZIER;
makeknots(nu, 1);
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
@@ -2473,11 +2473,11 @@ static int convertspline(short type, Nurb *nu)
nu->orderu= 4;
nu->orderv= 1;
nu->type = type;
if(nu->flagu & CU_CYCLIC) c= nu->orderu-1;
if(nu->flagu & CU_NURB_CYCLIC) c= nu->orderu-1;
else c= 0;
if(type== CU_NURBS) {
nu->flagu &= CU_CYCLIC; /* disable all flags except for cyclic */
nu->flagu += 4;
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
nu->flagu |= CU_NURB_BEZIER;
makeknots(nu, 1);
}
}
@@ -2992,7 +2992,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
/* find both nurbs and points, nu1 will be put behind nu2 */
for(nu= editnurb->first; nu; nu= nu->next) {
if((nu->flagu & CU_CYCLIC)==0) { /* not cyclic */
if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic */
if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
if(nu1==0) {
@@ -3284,7 +3284,7 @@ static int spin_nurb(bContext *C, Scene *scene, Object *obedit, float *dvec, flo
for(nu= editnurb->first; nu; nu= nu->next) {
if(isNurbsel(nu)) {
nu->orderv= 4;
nu->flagv |= CU_CYCLIC;
nu->flagv |= CU_NURB_CYCLIC;
makeknots(nu, 2);
}
}
@@ -3587,7 +3587,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
bp= nu->bp;
while(a--) {
if( bp->f1 & SELECT ) {
nu->flagu ^= CU_CYCLIC;
nu->flagu ^= CU_NURB_CYCLIC;
break;
}
bp++;
@@ -3598,7 +3598,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
bezt= nu->bezt;
while(a--) {
if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
nu->flagu ^= CU_CYCLIC;
nu->flagu ^= CU_NURB_CYCLIC;
break;
}
bezt++;
@@ -3611,7 +3611,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
bp= nu->bp;
while(a--) {
if( bp->f1 & SELECT ) {
nu->flagu ^= CU_CYCLIC;
nu->flagu ^= CU_NURB_CYCLIC;
makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */
break;
}
@@ -3626,11 +3626,11 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
if( bp->f1 & SELECT) {
if(direction==0 && nu->pntsu>1) {
nu->flagu ^= CU_CYCLIC;
nu->flagu ^= CU_NURB_CYCLIC;
makeknots(nu, 1); /* 1==u type is ignored for cyclic curves */
}
if(direction==1 && nu->pntsv>1) {
nu->flagv ^= CU_CYCLIC;
nu->flagv ^= CU_NURB_CYCLIC;
makeknots(nu, 2); /* 2==v type is ignored for cyclic curves */
}
break;
@@ -4430,10 +4430,10 @@ static int delete_exec(bContext *C, wmOperator *op)
bezt2= bezt+1;
if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) ;
else { /* maybe do not make cyclic */
if(a==0 && (nu->flagu & CU_CYCLIC) ) {
if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
bezt2= bezt+(nu->pntsu-1);
if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
nu->flagu &= ~CU_CYCLIC;
nu->flagu &= ~CU_NURB_CYCLIC;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
@@ -4456,10 +4456,10 @@ static int delete_exec(bContext *C, wmOperator *op)
bp2= bp+1;
if( bp2->f1 & 1 ) ;
else { /* maybe do not make cyclic */
if(a==0 && (nu->flagu & CU_CYCLIC) ) {
if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
bp2= bp+(nu->pntsu-1);
if( bp2->f1 & SELECT ) {
nu->flagu &= ~CU_CYCLIC;
nu->flagu &= ~CU_NURB_CYCLIC;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
}
@@ -4484,14 +4484,14 @@ static int delete_exec(bContext *C, wmOperator *op)
BLI_remlink(editnurb, nu);
freeNurb(nu); nu = NULL;
}
else if(nu1->flagu & CU_CYCLIC) { /* cyclic */
else if(nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bezt =
(BezTriple*)MEM_mallocN((cut+1) * sizeof(BezTriple), "delNurb1");
memcpy(bezt, nu1->bezt,(cut+1)*sizeof(BezTriple));
a= nu1->pntsu-cut-1;
memcpy(nu1->bezt, bezt2, a*sizeof(BezTriple));
memcpy(nu1->bezt+a, bezt, (cut+1)*sizeof(BezTriple));
nu1->flagu &= ~CU_CYCLIC;
nu1->flagu &= ~CU_NURB_CYCLIC;
MEM_freeN(bezt);
calchandlesNurb(nu);
}
@@ -4526,14 +4526,14 @@ static int delete_exec(bContext *C, wmOperator *op)
BLI_remlink(editnurb, nu);
freeNurb(nu); nu= NULL;
}
else if(nu1->flagu & CU_CYCLIC) { /* cyclic */
else if(nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bp =
(BPoint*)MEM_mallocN((cut+1) * sizeof(BPoint), "delNurb5");
memcpy(bp, nu1->bp,(cut+1)*sizeof(BPoint));
a= nu1->pntsu-cut-1;
memcpy(nu1->bp, bp2, a*sizeof(BPoint));
memcpy(nu1->bp+a, bp, (cut+1)*sizeof(BPoint));
nu1->flagu &= ~CU_CYCLIC;
nu1->flagu &= ~CU_NURB_CYCLIC;
MEM_freeN(bp);
}
else { /* add new curve */
@@ -4849,7 +4849,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
nu->pntsu= 5;
nu->pntsv= 1;
nu->orderu= 5;
nu->flagu= 2; /* endpoint */
nu->flagu= CU_NURB_ENDPOINT; /* endpoint */
nu->resolu= 8;
nu->bp= callocstructN(BPoint, 5, "addNurbprim3");
@@ -4888,7 +4888,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
if (!force_3d) nu->flag |= CU_2D;
nu->pntsu= 4;
nu->bezt= callocstructN(BezTriple, 4, "addNurbprim1");
nu->flagu= CU_CYCLIC;
nu->flagu= CU_NURB_CYCLIC;
bezt= nu->bezt;
bezt->h1= bezt->h2= HD_AUTO;
@@ -4925,7 +4925,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
nu->pntsv= 1;
nu->orderu= 4;
nu->bp= callocstructN(BPoint, 8, "addNurbprim6");
nu->flagu= CU_CYCLIC;
nu->flagu= CU_NURB_CYCLIC;
bp= nu->bp;
for(a=0; a<8; a++) {
@@ -5047,7 +5047,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
mul_m4_v3(mat,bp->vec);
bp++;
}
nu->flagu= 4;
nu->flagu= CU_NURB_BEZIER;
makeknots(nu, 1);
BLI_addtail(editnurb, nu); /* temporal for spin */

View File

@@ -423,7 +423,7 @@ static void gp_stroke_to_path (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cur
nu->pntsu= gps->totpoints;
nu->pntsv= 1;
nu->orderu= gps->totpoints;
nu->flagu= 2; /* endpoint */
nu->flagu= CU_NURB_ENDPOINT;
nu->resolu= 32;
nu->bp= (BPoint *)MEM_callocN(sizeof(BPoint)*gps->totpoints, "bpoints");

View File

@@ -62,7 +62,6 @@ void ED_base_object_activate(struct bContext *C, struct Base *base);
void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base);
void ED_object_apply_obmat(struct Object *ob);
/* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */
struct Base *ED_object_add_duplicate(struct Scene *scene, struct Base *base, int dupflag);

View File

@@ -413,6 +413,15 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
data->linedark[data->totline]= 1;
data->totline++;
if(but->rnapoin.id.data) {
ID *id= but->rnapoin.id.data;
if(id->lib && id->lib->name) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Library: %s", id->lib->name);
data->linedark[data->totline]= 1;
data->totline++;
}
}
}
else if (but->optype) {
PointerRNA *opptr;

View File

@@ -1118,7 +1118,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base)
ob->lay= base->lay;
copy_m4_m4(ob->obmat, dob->mat);
ED_object_apply_obmat(ob);
object_apply_mat4(ob, ob->obmat);
}
copy_object_set_idnew(C, 0);

View File

@@ -150,34 +150,6 @@ static int pupmenu(const char *msg) {return 0;}
static bContext *C;
static void error_libdata() {}
/* ********************************** */
/* --------------------------------- */
void ED_object_apply_obmat(Object *ob)
{
float mat[3][3], imat[3][3], tmat[3][3];
/* from obmat to loc rot size */
if(ob==NULL) return;
copy_m3_m4(mat, ob->obmat);
VECCOPY(ob->loc, ob->obmat[3]);
mat3_to_eul( ob->rot,mat);
eul_to_mat3( tmat,ob->rot);
invert_m3_m3(imat, tmat);
mul_m3_m3m3(tmat, imat, mat);
ob->size[0]= tmat[0][0];
ob->size[1]= tmat[1][1];
ob->size[2]= tmat[2][2];
}
/* ********* clear/set restrict view *********/
static int object_restrictview_clear_exec(bContext *C, wmOperator *op)
{

View File

@@ -430,7 +430,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
else if(type == 1) {
ob->parent= NULL;
ob->track= NULL;
ED_object_apply_obmat(ob);
object_apply_mat4(ob, ob->obmat);
}
else if(type == 2)
unit_m4(ob->parentinv);
@@ -572,7 +572,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
Object workob;
/* apply transformation of previous parenting */
ED_object_apply_obmat(ob);
object_apply_mat4(ob, ob->obmat);
/* set the parent (except for follow-path constraint option) */
if(partype != PAR_PATH_CONST)
@@ -887,7 +887,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
}
if(type == 1)
ED_object_apply_obmat(ob);
object_apply_mat4(ob, ob->obmat);
}
CTX_DATA_END;

View File

@@ -392,7 +392,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
/* a change was made, adjust the children to compensate */
for(ob_child=bmain->object.first; ob_child; ob_child=ob_child->id.next) {
if(ob_child->parent == ob) {
ED_object_apply_obmat(ob_child);
object_apply_mat4(ob_child, ob_child->obmat);
what_does_parent(scene, ob_child, &workob);
invert_m4_m4(ob_child->parentinv, workob.obmat);
}

View File

@@ -40,6 +40,7 @@
#include "DNA_space_types.h"
#include "DNA_world_types.h"
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_font.h"

View File

@@ -379,7 +379,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
{
PointerRNA strip_ptr;
uiLayout *layout= pa->layout;
uiLayout *column, *subcolumn;
uiLayout *column, *subcolumn, *subrow;
uiBlock *block;
/* check context and also validity of pointer */
@@ -398,10 +398,13 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
column= uiLayoutColumn(layout, 1);
uiItemR(column, NULL, 0, &strip_ptr, "animated_time", 0);
subrow= uiLayoutRow(column, 0);
uiItemR(subrow, NULL, 0, &strip_ptr, "animated_time", 0);
uiItemR(subrow, NULL, 0, &strip_ptr, "animated_time_cyclic", 0);
subcolumn= uiLayoutColumn(column, 1);
uiLayoutSetEnabled(subcolumn, RNA_boolean_get(&strip_ptr, "animated_time"));
subrow= uiLayoutRow(subcolumn, 0);
uiLayoutSetEnabled(subrow, RNA_boolean_get(&strip_ptr, "animated_time"));
uiItemR(subcolumn, NULL, 0, &strip_ptr, "strip_time", 0);
}

View File

@@ -5773,7 +5773,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
break;
case OB_CAMERA:
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0 || (rv3d->persp==RV3D_CAMOB && v3d->camera==ob)) /* special exception for active camera */
drawcamera(scene, v3d, rv3d, ob, flag);
break;
case OB_LATTICE:

View File

@@ -2352,11 +2352,11 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
/* Draw particle edit brush XXX (removed) */
if(rv3d->persp==RV3D_CAMOB) drawviewborder(scene, ar, v3d);
if(rv3d->rflag & RV3D_FLYMODE) drawviewborder_flymode(ar);
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if(rv3d->persp==RV3D_CAMOB) drawviewborder(scene, ar, v3d);
if(rv3d->rflag & RV3D_FLYMODE) drawviewborder_flymode(ar);
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
// if (v3d->flag2 & V3D_DISPGP)
draw_gpencil_3dview((bContext *)C, 0);

View File

@@ -1353,11 +1353,12 @@ static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview wi
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if(pchan->bone->flag & BONE_SELECTED) {
if(pchan->bone->layer & arm->layer) {
bPoseChannel *pchan_tx= pchan->custom_tx ? pchan->custom_tx : pchan;
ok= 1;
VECCOPY(vec, pchan->pose_head);
VECCOPY(vec, pchan_tx->pose_head);
mul_m4_v3(ob->obmat, vec);
DO_MINMAX(vec, min, max);
VECCOPY(vec, pchan->pose_tail);
VECCOPY(vec, pchan_tx->pose_tail);
mul_m4_v3(ob->obmat, vec);
DO_MINMAX(vec, min, max);
}

View File

@@ -2288,12 +2288,12 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
break;
case FLY_MODAL_DIR_UP:
if (fly->speed < 0.0f) fly->speed= -fly->speed;
if (fly->speed > 0.0f) fly->speed= -fly->speed;
fly->axis= 1;
break;
case FLY_MODAL_DIR_DOWN:
if (fly->speed > 0.0f) fly->speed= -fly->speed;
if (fly->speed < 0.0f) fly->speed= -fly->speed;
fly->axis= 1;
break;

View File

@@ -601,6 +601,7 @@ typedef enum eNlaStrip_Flag {
/* strip influence is controlled by local F-Curve */
NLASTRIP_FLAG_USR_INFLUENCE = (1<<5),
NLASTRIP_FLAG_USR_TIME = (1<<6),
NLASTRIP_FLAG_USR_TIME_CYCLIC = (1<<7),
/* NLA strip length is synced to the length of the referenced action */
NLASTRIP_FLAG_SYNC_LENGTH = (1<<9),

View File

@@ -288,7 +288,9 @@ typedef struct Curve {
/* flagu flagv (nurb) */
#define CU_CYCLIC 1
#define CU_NURB_CYCLIC 1
#define CU_NURB_ENDPOINT 2
#define CU_NURB_BEZIER 4
/* *************** BEZTRIPLE **************** */

View File

@@ -334,6 +334,7 @@ typedef struct ExtensionRNA {
#define MainMaterials Main
#define MainMeshes Main
#define MainLamps Main
#define MainImages Main
#define MainObjects Main
#define MainTexts Main
#define MainActions Main

View File

@@ -50,6 +50,14 @@ EnumPropertyItem beztriple_interpolation_mode_items[] = {
{BEZT_IPO_BEZ, "BEZIER", 0, "Bezier", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem curve_type_items[] = {
{CU_POLY, "POLY", 0, "Poly", ""},
{CU_BEZIER, "BEZIER", 0, "Bezier", ""},
{CU_BSPLINE, "BSPLINE", 0, "BSpline", ""},
{CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
{CU_NURBS, "NURBS", 0, "Ease", ""},
{0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
#include "DNA_object_types.h"
@@ -72,22 +80,6 @@ static StructRNA *rna_Curve_refine(PointerRNA *ptr)
else return &RNA_Curve;
}
static PointerRNA rna_Curve_active_nurb_get(PointerRNA *ptr)
{
Curve *cu= (Curve*)ptr->data;
Nurb *nu= NULL;
if(cu->editnurb)
nu = BLI_findlink(cu->editnurb, cu->actnu);
if(nu)
return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu);
return rna_pointer_inherit_refine(ptr, NULL, NULL);
}
static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
{
BezTriple *bt= (BezTriple*)ptr->data;
@@ -208,14 +200,17 @@ static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA
rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
}
static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_Curve_update_data_id(Main *bmain, Scene *scene, ID *id)
{
ID *id= ptr->id.data;
DAG_id_flush_update(id, OB_RECALC_DATA);
WM_main_add_notifier(NC_GEOM|ND_DATA, id);
}
static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
rna_Curve_update_data_id(bmain, scene, ptr->id.data);
}
static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
{
DAG_scene_sort(scene);
@@ -316,6 +311,119 @@ static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Curve_spline_points_add(ID *id, Nurb *nu, bContext *C, ReportList *reports, int number)
{
if(nu->type == CU_BEZIER) {
BKE_report(reports, RPT_ERROR, "Bezier spline can't have points added");
}
else if(number==0) {
// do nothing
} else {
addNurbPoints(nu, number);
/* update */
makeknots(nu, 1);
rna_Curve_update_data_id(CTX_data_main(C), CTX_data_scene(C), id);
}
}
static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, bContext *C, ReportList *reports, int number)
{
if(nu->type != CU_BEZIER) {
BKE_report(reports, RPT_ERROR, "Only bezier splines can be added");
}
else if(number==0) {
// do nothing
} else {
addNurbPointsBezier(nu, number);
/* update */
makeknots(nu, 1);
rna_Curve_update_data_id(CTX_data_main(C), CTX_data_scene(C), id);
}
}
static Nurb *rna_Curve_spline_new(Curve *cu, int type)
{
Nurb *nu= ( Nurb * ) MEM_callocN( sizeof( Nurb ), "spline.new" );
if(type==CU_BEZIER) {
BezTriple *bezt= (BezTriple *)MEM_callocN(sizeof(BezTriple), "spline.new.bezt");
bezt->radius= 1.0;
nu->bezt= bezt;
}
else {
BPoint *bp= (BPoint *)MEM_callocN(sizeof(BPoint), "spline.new.bp");
bp->radius= 1.0f;
nu->bp= bp;
}
nu->type= type;
nu->pntsu= 1;
nu->pntsv= 1;
nu->orderu= nu->orderv= 4;
nu->resolu= nu->resolv= 12;
nu->flag= CU_SMOOTH;
BLI_addtail(&cu->nurb, nu);
return nu;
}
static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
{
/* todo, check we're in the list */
int found= 0;
if(cu->editnurb) {
found= BLI_remlink_safe(cu->editnurb, nu);
}
else {
found= BLI_remlink_safe(&cu->nurb, nu);
}
if(!found) {
BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" does not contain spline given", cu->id.name+2);
return;
}
freeNurb(nu);
/* invalidate pointer!, no can do */
}
static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr)
{
Curve *cu= (Curve*)ptr->data;
Nurb *nu;
if(cu->editnurb)
nu= BLI_findlink(cu->editnurb, cu->actnu);
else
nu= BLI_findlink(&cu->nurb, cu->actnu); // currently set to -1, should be changed to be allowed outside of editmode.
if(nu)
return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu);
return rna_pointer_inherit_refine(ptr, NULL, NULL);
}
static void rna_Curve_active_spline_set(PointerRNA *ptr, PointerRNA value)
{
Curve *cu= (Curve*)ptr->data;
Nurb *nu= value.data;
/* -1 is ok for an unset index */
if(nu==NULL)
cu->actnu= -1;
else if(cu->editnurb)
cu->actnu= BLI_findindex(cu->editnurb, nu);
else
cu->actnu= BLI_findindex(&cu->nurb, nu);
}
#else
static void rna_def_bpoint(BlenderRNA *brna)
@@ -725,6 +833,100 @@ static void rna_def_text(BlenderRNA *brna)
rna_def_nurbs(brna, srna);
}
/* curve.splines[0].points */
static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
//PropertyRNA *prop;
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "SplinePoints");
srna= RNA_def_struct(brna, "SplinePoints", NULL);
RNA_def_struct_sdna(srna, "Nurb");
RNA_def_struct_ui_text(srna, "Spline Points", "Collection of spline points");
func= RNA_def_function(srna, "add", "rna_Curve_spline_points_add");
RNA_def_function_ui_description(func, "Add a number of points to this spline.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_SELF_ID|FUNC_USE_REPORTS);
parm= RNA_def_int(func, "number", 1, INT_MIN, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
/*
func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
RNA_def_property_flag(parm, PROP_REQUIRED);
*/
}
static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
//PropertyRNA *prop;
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "SplineBezierPoints");
srna= RNA_def_struct(brna, "SplineBezierPoints", NULL);
RNA_def_struct_sdna(srna, "Nurb");
RNA_def_struct_ui_text(srna, "Spline Bezier Points", "Collection of spline bezirt points");
func= RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add");
RNA_def_function_ui_description(func, "Add a number of points to this spline.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_SELF_ID|FUNC_USE_REPORTS);
parm= RNA_def_int(func, "number", 1, INT_MIN, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
/*
func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
RNA_def_property_flag(parm, PROP_REQUIRED);
*/
}
/* curve.splines */
static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
PropertyRNA *prop;
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "CurveSplines");
srna= RNA_def_struct(brna, "CurveSplines", NULL);
RNA_def_struct_sdna(srna, "Curve");
RNA_def_struct_ui_text(srna, "Curve Splines", "Collection of curve splines");
func= RNA_def_function(srna, "new", "rna_Curve_spline_new");
RNA_def_function_ui_description(func, "Add a new spline to the curve.");
parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline.");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline.");
RNA_def_function_return(func, parm);
func= RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
RNA_def_property_flag(parm, PROP_REQUIRED);
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_pointer_funcs(prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", NULL);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Spline", "Active curve spline");
/* Could call: ED_base_object_activate(C, scene->basact);
* but would be a bad level call and it seems the notifier is enough */
RNA_def_property_update(prop, NC_SCENE|ND_OB_ACTIVE, NULL);
}
static void rna_def_curve(BlenderRNA *brna)
{
StructRNA *srna;
@@ -757,12 +959,7 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL);
RNA_def_property_struct_type(prop, "Spline");
RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object");
prop= RNA_def_property(srna, "active_spline", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Spline");
RNA_def_property_pointer_funcs(prop, "rna_Curve_active_nurb_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Active Spline", "The active editmode spline");
rna_def_curve_splines(brna, prop);
prop= RNA_def_property(srna, "draw_handles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES);
@@ -888,14 +1085,6 @@ static void rna_def_curve(BlenderRNA *brna)
static void rna_def_curve_nurb(BlenderRNA *brna)
{
static EnumPropertyItem curve_type_items[] = {
{CU_POLY, "POLY", 0, "Poly", ""},
{CU_BEZIER, "BEZIER", 0, "Bezier", ""},
{CU_BSPLINE, "BSPLINE", 0, "BSpline", ""},
{CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
{CU_NURBS, "NURBS", 0, "Ease", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem spline_interpolation_items[] = {
{BEZT_IPO_CONST, "LINEAR", 0, "Linear", ""},
{BEZT_IPO_LIN, "CARDINAL", 0, "Cardinal", ""},
@@ -915,11 +1104,13 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "SplinePoint");
RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", 0, 0);
RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline");
rna_def_curve_spline_points(brna, prop);
prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "BezierSplinePoint");
RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu");
RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for bezier curves only");
rna_def_curve_spline_bezpoints(brna, prop);
prop= RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE);
@@ -982,34 +1173,34 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop= RNA_def_property(srna, "cyclic_u", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_CYCLIC);
RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_CYCLIC);
RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction");
RNA_def_property_update(prop, 0, "rna_Nurb_update_handle_data"); /* only needed for cyclic_u because cyclic_v cant do bezier */
prop= RNA_def_property(srna, "cyclic_v", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_CYCLIC);
RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC);
RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
/* Note, endpoint and bezier flags should never be on at the same time! */
prop= RNA_def_property(srna, "endpoint_u", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagu", 2);
RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT);
RNA_def_property_ui_text(prop, "Endpoint U", "Make this nurbs curve or surface meet the endpoints in the U direction (Cyclic U must be disabled)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
prop= RNA_def_property(srna, "endpoint_v", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagv", 2);
RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT);
RNA_def_property_ui_text(prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction (Cyclic V must be disabled)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
prop= RNA_def_property(srna, "bezier_u", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagu", 4);
RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER);
RNA_def_property_ui_text(prop, "Bezier U", "Make this nurbs curve or surface act like a bezier spline in the U direction (Order U must be 3 or 4, Cyclic U must be disabled)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
prop= RNA_def_property(srna, "bezier_v", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flagv", 4);
RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER);
RNA_def_property_ui_text(prop, "Bezier V", "Make this nurbs surface act like a bezier spline in the V direction (Order V must be 3 or 4, Cyclic V must be disabled)");
RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");

View File

@@ -69,11 +69,6 @@ Tex *rna_Main_add_texture(Main *bmain, char *name)
return add_texture(name);
}
Image *rna_Main_add_image(Main *bmain, char *filename)
{
return BKE_add_image_file(filename, 0);
}
Camera *rna_Main_cameras_new(Main *bmain, char* name)
{
return add_camera(name);
@@ -227,6 +222,27 @@ void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
/* XXX python now has invalid pointer? */
}
Image *rna_Main_images_new(Main *bmain, char* name, int width, int height, int float_buffer)
{
float color[4]= {0.0, 0.0, 0.0, 1.0};
Image *image= BKE_add_image_size(width, height, name, float_buffer, 0, color);
image->id.us--;
return image;
}
Image *rna_Main_images_load(Main *bmain, char *filename)
{
return BKE_add_image_file(filename, 0);
}
void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
{
if(ID_REAL_USERS(image) <= 0)
free_libblock(&bmain->image, image);
else
BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d.", image->id.name+2, ID_REAL_USERS(image));
/* XXX python now has invalid pointer? */
}
Tex *rna_Main_textures_new(Main *bmain, char* name)
{
Tex *tex= add_texture(name);
@@ -309,15 +325,20 @@ void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
void RNA_api_main(StructRNA *srna)
{
/*
FunctionRNA *func;
PropertyRNA *parm;
*/
/* maybe we want to add functions in 'bpy.data' still?
* for now they are all in collections bpy.data.images.new(...) */
/*
func= RNA_def_function(srna, "add_image", "rna_Main_add_image");
RNA_def_function_ui_description(func, "Add a new image.");
parm= RNA_def_string(func, "filename", "", 0, "", "Filename to load image from.");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_pointer(func, "image", "Image", "", "New image.");
RNA_def_function_return(func, parm);
*/
}
@@ -491,8 +512,40 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
}
void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "MainImages");
srna= RNA_def_struct(brna, "MainImages", NULL);
RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
func= RNA_def_function(srna, "new", "rna_Main_images_new");
RNA_def_function_ui_description(func, "Add a new image to the main database");
parm= RNA_def_string(func, "name", "Image", 0, "", "New name for the datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image.", 0, INT_MAX);
parm= RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image.", 0, INT_MAX);
parm= RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
/* return type */
parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
RNA_def_function_return(func, parm);
func= RNA_def_function(srna, "load", "rna_Main_images_load");
RNA_def_function_ui_description(func, "Load a new image into the main database");
parm= RNA_def_string(func, "filename", "File Name", 0, "", "path of the file to load.");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock.");
RNA_def_function_return(func, parm);
func= RNA_def_function(srna, "remove", "rna_Main_images_remove");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove an image from the current blendfile.");
parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove.");
RNA_def_property_flag(parm, PROP_REQUIRED);
}
void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
{

View File

@@ -411,6 +411,11 @@ static void rna_def_nlastrip(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME);
RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_time_set");
RNA_def_property_ui_text(prop, "Animated Strip Time", "Strip time is controlled by an F-Curve rather than automatically determined");
prop= RNA_def_property(srna, "animated_time_cyclic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME_CYCLIC);
RNA_def_property_ui_text(prop, "Cyclic Strip Time", "Cycle the animated time within the action start & end");
RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); // is there a better update flag?
/* settings */
prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);

View File

@@ -125,7 +125,7 @@ void rna_Object_update(Main *bmain, Scene *scene, PointerRNA *ptr)
void rna_Object_matrix_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ED_object_apply_obmat(ptr->id.data);
object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat);
rna_Object_update(bmain, scene, ptr);
}

View File

@@ -178,12 +178,12 @@ static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base*)internal->link)->object);
}
static Base *rna_Scene_link_object(Scene *scene, ReportList *reports, Object *ob)
static Base *rna_Scene_object_link(Scene *scene, ReportList *reports, Object *ob)
{
Base *base;
if (ob->type != OB_EMPTY && ob->data==NULL) {
BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not an Empty type and has no Object Data set.");
BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not an Empty type and has no Object Data set.", ob->id.name+2);
return NULL;
}
@@ -204,7 +204,7 @@ static Base *rna_Scene_link_object(Scene *scene, ReportList *reports, Object *ob
return base;
}
static void rna_Scene_unlink_object(Scene *scene, bContext *C, ReportList *reports, Object *ob)
static void rna_Scene_object_unlink(Scene *scene, bContext *C, ReportList *reports, Object *ob)
{
Base *base= object_in_scene(ob, scene);
if (!base) {
@@ -2604,7 +2604,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "Scene");
RNA_def_struct_ui_text(srna, "Scene Objects", "Collection of scene objects");
func= RNA_def_function(srna, "link", "rna_Scene_link_object");
func= RNA_def_function(srna, "link", "rna_Scene_object_link");
RNA_def_function_ui_description(func, "Link object to scene.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "object", "Object", "", "Object to add to scene.");
@@ -2612,7 +2612,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base.");
RNA_def_function_return(func, parm);
func= RNA_def_function(srna, "unlink", "rna_Scene_unlink_object");
func= RNA_def_function(srna, "unlink", "rna_Scene_object_unlink");
RNA_def_function_ui_description(func, "Unlink object from scene.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene.");

View File

@@ -277,6 +277,8 @@ def rna2sphinx(BASEPATH):
fw("\n")
fw("An introduction to blender and python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
fw("\n")
fw("`A PDF version of this document is also available <blender_python_reference_250.pdf>`__\n")
fw("\n")
fw(".. warning:: The Python API in Blender is **UNSTABLE**, It should only be used for testing, any script written now may break in future releases.\n")
fw(" \n")
fw(" The following areas are subject to change.\n")

View File

@@ -0,0 +1,25 @@
#!/bin/sh
# run from the blender source dir
# bash source/blender/python/doc/sphinx_doc_gen.sh
# ssh upload means you need a login into the server
BLENDER="./blender.bin"
SSH_HOST="ideasman42@emo.blender.org"
SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc"
# clear doc dir
rm -rf ./source/blender/python/doc/sphinx-in ./source/blender/python/doc/sphinx-out
$BLENDER -b -P ./source/blender/python/doc/sphinx_doc_gen.py
# html
sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html
ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD'/*'
rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD/
# pdf
sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
cd source/blender/python/doc/sphinx-out
make
cd ../../../../../
rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD/blender_python_reference_250.pdf

View File

@@ -24,10 +24,8 @@
*/
#include "BKE_idprop.h"
#include "IDProp.h"
#define BSTR_EQ(a, b) (*(a) == *(b) && !strcmp(a, b))
#include "MEM_guardedalloc.h"
/*** Function to wrap ID properties ***/
PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent);

View File

@@ -359,7 +359,7 @@ static PyObject *pyrna_struct_repr( BPy_StructRNA *self )
return pyob;
}
return PyUnicode_FromFormat( "<bpy_struct, %.200s>", RNA_struct_identifier(self->ptr.type));
return PyUnicode_FromFormat( "<bpy_struct, %.200s at %p>", RNA_struct_identifier(self->ptr.type), self->ptr.data);
}
static PyObject *pyrna_prop_repr( BPy_PropertyRNA *self )
@@ -1663,8 +1663,9 @@ int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_pre
{
char *path;
PropertyRNA *prop;
int array_len;
if (!PyArg_ParseTuple(args, "s|if", &path, &index, &cfra)) {
if (!PyArg_ParseTuple(args, "s|if", &path, index, cfra)) {
PyErr_Format(PyExc_TypeError, "%.200s expected a string and optionally an int and float arguments", error_prefix);
return -1;
}
@@ -1693,6 +1694,12 @@ int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_pre
return -1;
}
array_len= RNA_property_array_length(ptr, prop);
if((*index) != -1 && (*index) >= array_len) {
PyErr_Format( PyExc_TypeError, "%.200s index out of range \"%s\", given %d, array length is %d", error_prefix, path, *index, array_len);
return -1;
}
if(*cfra==FLT_MAX)
*cfra= CTX_data_scene(BPy_GetContext())->r.cfra;

View File

@@ -225,7 +225,6 @@ void ED_mesh_transform(struct Mesh *me, float *mat){}
void ED_mesh_update(struct Mesh *mesh, struct bContext *C){}
int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;}
int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;}
void ED_object_apply_obmat(struct Object *ob){}
void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob){}
void ED_object_constraint_update(struct Object *ob){}
struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, char *name){return (struct bDeformGroup *) NULL;}

View File

@@ -162,6 +162,7 @@ static void blender_esc(int sig)
}
/* buildinfo can have quotes */
#ifdef BUILD_DATE
static void strip_quotes(char *str)
{
if(str[0] == '"') {
@@ -172,6 +173,7 @@ static void strip_quotes(char *str)
}
}
}
#endif
static int print_version(int argc, char **argv, void *data)
{