forked from bartvdbraak/blender
split some >120 lines, no functional changes
This commit is contained in:
parent
d53034d9c9
commit
96bd647c4f
@ -299,7 +299,8 @@ static bUnitDef *unit_best_fit(double value, bUnitCollection *usys, bUnitDef *un
|
|||||||
if(suppress && (unit->flag & B_UNIT_DEF_SUPPRESS))
|
if(suppress && (unit->flag & B_UNIT_DEF_SUPPRESS))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (value_abs >= unit->scalar*(1.0-EPS)) /* scale down scalar so 1cm doesnt convert to 10mm because of float error */
|
/* scale down scalar so 1cm doesnt convert to 10mm because of float error */
|
||||||
|
if (value_abs >= unit->scalar*(1.0-EPS))
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,11 +482,14 @@ static int ch_is_op(char op)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit, const char *replace_str)
|
static int unit_scale_str(char *str, int len_max, char *str_tmp,
|
||||||
|
double scale_pref, bUnitDef *unit, const char *replace_str)
|
||||||
{
|
{
|
||||||
char *str_found;
|
char *str_found;
|
||||||
|
|
||||||
if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) { /* XXX - investigate, does not respect len_max properly */
|
if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) {
|
||||||
|
/* XXX - investigate, does not respect len_max properly */
|
||||||
|
|
||||||
int len, len_num, len_name, len_move, found_ofs;
|
int len, len_num, len_name, len_move, found_ofs;
|
||||||
|
|
||||||
found_ofs = (int)(str_found-str);
|
found_ofs = (int)(str_found-str);
|
||||||
|
@ -1548,8 +1548,10 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
|
|||||||
|
|
||||||
/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
|
/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
|
||||||
* but for now just dont change handle types */
|
* but for now just dont change handle types */
|
||||||
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0)
|
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) {
|
||||||
testhandlesNurb(nu); /* sets the handles based on their selection, do this after the data is copied to the TransData */
|
/* sets the handles based on their selection, do this after the data is copied to the TransData */
|
||||||
|
testhandlesNurb(nu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TransData *head, *tail;
|
TransData *head, *tail;
|
||||||
@ -4443,7 +4445,8 @@ static int count_proportional_objects(TransInfo *t)
|
|||||||
/* mark all children */
|
/* mark all children */
|
||||||
for (base= scene->base.first; base; base= base->next) {
|
for (base= scene->base.first; base; base= base->next) {
|
||||||
/* all base not already selected or marked that is editable */
|
/* all base not already selected or marked that is editable */
|
||||||
if ((base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
|
if ( (base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
|
||||||
|
(BASE_EDITABLE_BGMODE(v3d, scene, base)))
|
||||||
{
|
{
|
||||||
mark_children(base->object);
|
mark_children(base->object);
|
||||||
}
|
}
|
||||||
@ -4454,7 +4457,8 @@ static int count_proportional_objects(TransInfo *t)
|
|||||||
Object *ob= base->object;
|
Object *ob= base->object;
|
||||||
|
|
||||||
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
|
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
|
||||||
if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
|
if ( (ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
|
||||||
|
(BASE_EDITABLE_BGMODE(v3d, scene, base)))
|
||||||
{
|
{
|
||||||
|
|
||||||
/* used for flush, depgraph will change recalcs if needed :) */
|
/* used for flush, depgraph will change recalcs if needed :) */
|
||||||
@ -4530,7 +4534,9 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
|
|||||||
if (adt && adt->action) {
|
if (adt && adt->action) {
|
||||||
for (fcu= adt->action->curves.first; fcu; fcu= fcu->next) {
|
for (fcu= adt->action->curves.first; fcu; fcu= fcu->next) {
|
||||||
fcu->flag &= ~FCURVE_SELECTED;
|
fcu->flag &= ~FCURVE_SELECTED;
|
||||||
insert_keyframe(reports, id, adt->action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
|
insert_keyframe(reports, id, adt->action,
|
||||||
|
(fcu->grp ? fcu->grp->name : NULL),
|
||||||
|
fcu->rna_path, fcu->array_index, cfra, flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5048,8 +5054,12 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
|
|||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(t->scene->basact && (ob = t->scene->basact->object) && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, ob)) {
|
else if ( (t->scene->basact) &&
|
||||||
;
|
(ob = t->scene->basact->object) &&
|
||||||
|
(ob->mode & OB_MODE_PARTICLE_EDIT) &&
|
||||||
|
PE_get_current(t->scene, ob))
|
||||||
|
{
|
||||||
|
/* do nothing */ ;
|
||||||
}
|
}
|
||||||
else { /* Objects */
|
else { /* Objects */
|
||||||
int i, recalcObPaths=0;
|
int i, recalcObPaths=0;
|
||||||
|
@ -837,12 +837,17 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index)
|
|||||||
PropertySubType subtype= rna_ensure_property(prop)->subtype;
|
PropertySubType subtype= rna_ensure_property(prop)->subtype;
|
||||||
|
|
||||||
/* get string to use for array index */
|
/* get string to use for array index */
|
||||||
if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE))
|
if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
|
||||||
return quatitem[index];
|
return quatitem[index];
|
||||||
else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
|
}
|
||||||
|
else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
|
||||||
|
PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
|
||||||
|
{
|
||||||
return vectoritem[index];
|
return vectoritem[index];
|
||||||
else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA))
|
}
|
||||||
|
else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
|
||||||
return coloritem[index];
|
return coloritem[index];
|
||||||
|
}
|
||||||
|
|
||||||
return '\0';
|
return '\0';
|
||||||
}
|
}
|
||||||
@ -865,7 +870,9 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name)
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION)) {
|
else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ,
|
||||||
|
PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
|
||||||
|
{
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case 'x':
|
case 'x':
|
||||||
return 0;
|
return 0;
|
||||||
@ -1519,7 +1526,8 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
|
|||||||
/* find cache element for which key matches... */
|
/* find cache element for which key matches... */
|
||||||
for (uce = rna_updates_cache.first; uce; uce = uce->next) {
|
for (uce = rna_updates_cache.first; uce; uce = uce->next) {
|
||||||
/* just match by id only for now, since most update calls that we'll encounter only really care about this */
|
/* just match by id only for now, since most update calls that we'll encounter only really care about this */
|
||||||
// TODO: later, the cache might need to have some nesting on L1 to cope better with these problems + some tagging to indicate we need this
|
/* TODO: later, the cache might need to have some nesting on L1 to cope better
|
||||||
|
* with these problems + some tagging to indicate we need this */
|
||||||
if (uce->ptr.id.data == ptr->id.data)
|
if (uce->ptr.id.data == ptr->id.data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4969,7 +4977,9 @@ static int rna_function_format_array_length(const char *format, int ofs, int fle
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type, char ftype, int len, void *dest, void *src, StructRNA *srna, const char *tid, const char *fid, const char *pid)
|
static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type,
|
||||||
|
char ftype, int len, void *dest, void *src, StructRNA *srna,
|
||||||
|
const char *tid, const char *fid, const char *pid)
|
||||||
{
|
{
|
||||||
/* ptr is always a function pointer, prop always a parameter */
|
/* ptr is always a function pointer, prop always a parameter */
|
||||||
|
|
||||||
@ -5055,7 +5065,9 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
|
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
|
||||||
fprintf(stderr, "%s.%s: wrong type for parameter %s, an object of type %s was expected, passed an object of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
|
fprintf(stderr, "%s.%s: wrong type for parameter %s, "
|
||||||
|
"an object of type %s was expected, passed an object of type %s\n",
|
||||||
|
tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5080,7 +5092,10 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
|
|||||||
ptype= RNA_property_pointer_type(ptr, prop);
|
ptype= RNA_property_pointer_type(ptr, prop);
|
||||||
|
|
||||||
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
|
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
|
||||||
fprintf(stderr, "%s.%s: wrong type for parameter %s, a collection of objects of type %s was expected, passed a collection of objects of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
|
fprintf(stderr, "%s.%s: wrong type for parameter %s, "
|
||||||
|
"a collection of objects of type %s was expected, "
|
||||||
|
"passed a collection of objects of type %s\n",
|
||||||
|
tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5159,7 +5174,10 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
|
|||||||
|
|
||||||
if (len!=alen) {
|
if (len!=alen) {
|
||||||
err= -1;
|
err= -1;
|
||||||
fprintf(stderr, "%s.%s: for parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen);
|
fprintf(stderr, "%s.%s: for parameter %s, "
|
||||||
|
"was expecting an array of %i elements, "
|
||||||
|
"passed %i elements instead\n",
|
||||||
|
tid, fid, pid, len, alen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5224,7 +5242,9 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
|
|||||||
|
|
||||||
if (len!=alen) {
|
if (len!=alen) {
|
||||||
err= -1;
|
err= -1;
|
||||||
fprintf(stderr, "%s.%s: for return parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen);
|
fprintf(stderr, "%s.%s: for return parameter %s, "
|
||||||
|
"was expecting an array of %i elements, passed %i elements instead\n",
|
||||||
|
tid, fid, pid, len, alen);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -5278,7 +5298,8 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args)
|
int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr,
|
||||||
|
const char *identifier, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
FunctionRNA *func;
|
FunctionRNA *func;
|
||||||
|
|
||||||
|
@ -145,6 +145,14 @@ PyInit_gpu(void)
|
|||||||
PyObject_SetAttrString(d, #f, val); \
|
PyObject_SetAttrString(d, #f, val); \
|
||||||
Py_DECREF(val)
|
Py_DECREF(val)
|
||||||
|
|
||||||
|
PyDoc_STRVAR(GPU_export_shader_doc,
|
||||||
|
"export_shader(scene, material)\n"
|
||||||
|
"\n"
|
||||||
|
" Returns the GLSL shader that produces the visual effect of material in scene.\n"
|
||||||
|
"\n"
|
||||||
|
" :return: Dictionary defining the shader, uniforms and attributes.\n"
|
||||||
|
" :rtype: Dict"
|
||||||
|
);
|
||||||
static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds)
|
static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
PyObject* pyscene;
|
PyObject* pyscene;
|
||||||
@ -279,11 +287,9 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef meth_export_shader[] = {{ "export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS,
|
static PyMethodDef meth_export_shader[] = {
|
||||||
"export_shader(scene,material)\n\n"
|
{"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc}
|
||||||
"Returns the GLSL shader that produces the visual effect of material in scene.\n\n"
|
};
|
||||||
":return: Dictionary defining the shader, uniforms and attributes.\n"
|
|
||||||
":rtype: Dict"}};
|
|
||||||
|
|
||||||
PyObject* GPU_initPython(void)
|
PyObject* GPU_initPython(void)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user