RNA:
* Added Particle wrapping patch by Roelf de Kock. It's not complete yet and I haven't reviewed it, but committing anyway, will get to it later. * Added "Percentage" subtype for floats. Doesn't really do much besides making auto rna buttons into sliders rather than numeric inputs, but can later display in % rather than 0.0-1.0.
This commit is contained in:
@@ -1077,7 +1077,7 @@ void CURVE_OT_set_weight(wmOperatorType *ot)
|
|||||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
RNA_def_float(ot->srna, "weight", 1.0f, 0.0f, 1.0f, "Weight", "", 0.0f, 1.0f);
|
RNA_def_float_percentage(ot->srna, "weight", 1.0f, 0.0f, 1.0f, "Weight", "", 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************* set radius operator ******************/
|
/******************* set radius operator ******************/
|
||||||
@@ -4195,7 +4195,7 @@ void CURVE_OT_select_random(wmOperatorType *ot)
|
|||||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
RNA_def_float(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of vertices to select randomly.", 0.0001f, 1.0f);
|
RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of vertices to select randomly.", 0.0001f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************** select every nth *********************/
|
/********************** select every nth *********************/
|
||||||
|
|||||||
@@ -249,6 +249,8 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
|
|||||||
if(RNA_property_subtype(ptr, prop) == PROP_COLOR)
|
if(RNA_property_subtype(ptr, prop) == PROP_COLOR)
|
||||||
but= uiDefButR(block, COL, 0, name, x1, y1, x2, y2, ptr, propname, 0, 0, 0, -1, -1, NULL);
|
but= uiDefButR(block, COL, 0, name, x1, y1, x2, y2, ptr, propname, 0, 0, 0, -1, -1, NULL);
|
||||||
}
|
}
|
||||||
|
else if(RNA_property_subtype(ptr, prop) == PROP_PERCENTAGE)
|
||||||
|
but= uiDefButR(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||||
else
|
else
|
||||||
but= uiDefButR(block, NUM, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
but= uiDefButR(block, NUM, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -3448,10 +3448,10 @@ void MESH_OT_select_random(wmOperatorType *ot)
|
|||||||
ot->poll= ED_operator_editmesh;
|
ot->poll= ED_operator_editmesh;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||||
|
|
||||||
/* props */
|
/* props */
|
||||||
RNA_def_float(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of vertices to select randomly.", 0.0001f, 1.0f);
|
RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of vertices to select randomly.", 0.0001f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void editmesh_select_by_material(EditMesh *em, int index)
|
void editmesh_select_by_material(EditMesh *em, int index)
|
||||||
|
|||||||
@@ -1770,7 +1770,7 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
|
|||||||
{
|
{
|
||||||
float percent;
|
float percent;
|
||||||
|
|
||||||
percent = RNA_float_get(op->ptr, "percent") / 100.0f;
|
percent = RNA_float_get(op->ptr, "percent");
|
||||||
|
|
||||||
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
|
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
|
||||||
if ((!base->flag & SELECT && BLI_frand() < percent)) {
|
if ((!base->flag & SELECT && BLI_frand() < percent)) {
|
||||||
@@ -1798,7 +1798,7 @@ void OBJECT_OT_select_random(wmOperatorType *ot)
|
|||||||
/* flags */
|
/* flags */
|
||||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||||
|
|
||||||
RNA_def_float(ot->srna, "percent", 50.0f, 0.0f, 100.0f, "Percent", "percentage of objects to randomly select", 0.01f, 100.0f);
|
RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "percentage of objects to randomly select", 0.0001f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ******** Clear object Translation *********** */
|
/* ******** Clear object Translation *********** */
|
||||||
|
|||||||
@@ -282,8 +282,6 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar, Scene *sce
|
|||||||
float x1, y1, w, h;
|
float x1, y1, w, h;
|
||||||
int width, height, winx, winy;
|
int width, height, winx, winy;
|
||||||
|
|
||||||
ED_space_image_size(sima, &width, &height);
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(image_preview_active(curarea, &width, &height));
|
if(image_preview_active(curarea, &width, &height));
|
||||||
#endif
|
#endif
|
||||||
@@ -294,14 +292,18 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar, Scene *sce
|
|||||||
ED_image_aspect(sima->image, &xuser_asp, &yuser_asp);
|
ED_image_aspect(sima->image, &xuser_asp, &yuser_asp);
|
||||||
if(ibuf) {
|
if(ibuf) {
|
||||||
width= ibuf->x*xuser_asp;
|
width= ibuf->x*xuser_asp;
|
||||||
width= ibuf->y * yuser_asp;
|
height= ibuf->y*yuser_asp;
|
||||||
}
|
}
|
||||||
else if(sima->image->type==IMA_TYPE_R_RESULT) {
|
else if(sima->image->type==IMA_TYPE_R_RESULT) {
|
||||||
/* not very important, just nice */
|
/* not very important, just nice */
|
||||||
width= (scene->r.xsch*scene->r.size)/100;
|
width= (scene->r.xsch*scene->r.size)/100;
|
||||||
height= (scene->r.ysch*scene->r.size)/100;
|
height= (scene->r.ysch*scene->r.size)/100;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ED_space_image_size(sima, &width, &height);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ED_space_image_size(sima, &width, &height);
|
||||||
|
|
||||||
w= width;
|
w= width;
|
||||||
h= height;
|
h= height;
|
||||||
|
|||||||
@@ -390,7 +390,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot)
|
|||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
RNA_def_boolean(ot->srna, "fill_holes", 1, "Fill Holes", "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry.");
|
RNA_def_boolean(ot->srna, "fill_holes", 1, "Fill Holes", "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry.");
|
||||||
RNA_def_float(ot->srna, "blend", 0.0f, 0.0f, 1.0f, "Blend", "Blend factor between stretch minimized and original.", 0.0f, 1.0f);
|
RNA_def_float_percentage(ot->srna, "blend", 0.0f, 0.0f, 1.0f, "Blend", "Blend factor between stretch minimized and original.", 0.0f, 1.0f);
|
||||||
RNA_def_int(ot->srna, "iterations", 0, 0, INT_MAX, "Iterations", "Number of iterations to run, 0 is unlimited when run interactively.", 0, 100);
|
RNA_def_int(ot->srna, "iterations", 0, 0, INT_MAX, "Iterations", "Number of iterations to run, 0 is unlimited when run interactively.", 0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ PropertyRNA *RNA_def_float_rotation(StructRNA *srna, const char *identifier, int
|
|||||||
float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
|
float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
|
||||||
PropertyRNA *RNA_def_float_array(StructRNA *srna, const char *identifier, int len, const float *default_value,
|
PropertyRNA *RNA_def_float_array(StructRNA *srna, const char *identifier, int len, const float *default_value,
|
||||||
float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
|
float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
|
||||||
|
PropertyRNA *RNA_def_float_percentage(StructRNA *srna, const char *identifier, float default_value, float hardmin, float hardmax,
|
||||||
|
const char *ui_name, const char *ui_description, float softmin, float softmax);
|
||||||
|
|
||||||
PropertyRNA *RNA_def_pointer_runtime(StructRNA *srna, const char *identifier, StructRNA *type,
|
PropertyRNA *RNA_def_pointer_runtime(StructRNA *srna, const char *identifier, StructRNA *type,
|
||||||
const char *ui_name, const char *ui_description);
|
const char *ui_name, const char *ui_description);
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ typedef enum PropertySubType {
|
|||||||
PROP_VECTOR = 5,
|
PROP_VECTOR = 5,
|
||||||
PROP_MATRIX = 6,
|
PROP_MATRIX = 6,
|
||||||
PROP_ROTATION = 7,
|
PROP_ROTATION = 7,
|
||||||
PROP_NEVER_NULL = 8
|
PROP_NEVER_NULL = 8,
|
||||||
|
PROP_PERCENTAGE = 9
|
||||||
} PropertySubType;
|
} PropertySubType;
|
||||||
|
|
||||||
typedef enum PropertyFlag {
|
typedef enum PropertyFlag {
|
||||||
|
|||||||
@@ -959,6 +959,7 @@ static const char *rna_property_subtypename(PropertyType type)
|
|||||||
case PROP_MATRIX: return "PROP_MATRIX";
|
case PROP_MATRIX: return "PROP_MATRIX";
|
||||||
case PROP_ROTATION: return "PROP_ROTATION";
|
case PROP_ROTATION: return "PROP_ROTATION";
|
||||||
case PROP_NEVER_NULL: return "PROP_NEVER_NULL";
|
case PROP_NEVER_NULL: return "PROP_NEVER_NULL";
|
||||||
|
case PROP_PERCENTAGE: return "PROP_PERCENTAGE";
|
||||||
default: return "PROP_UNKNOWN";
|
default: return "PROP_UNKNOWN";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ StructRNA *rna_ID_refine(PointerRNA *ptr)
|
|||||||
case ID_NT: return &RNA_NodeTree;
|
case ID_NT: return &RNA_NodeTree;
|
||||||
case ID_ME: return &RNA_Mesh;
|
case ID_ME: return &RNA_Mesh;
|
||||||
case ID_OB: return &RNA_Object;
|
case ID_OB: return &RNA_Object;
|
||||||
|
case ID_PA: return &RNA_ParticleSettings;
|
||||||
case ID_SCE: return &RNA_Scene;
|
case ID_SCE: return &RNA_Scene;
|
||||||
case ID_SCR: return &RNA_Screen;
|
case ID_SCR: return &RNA_Screen;
|
||||||
case ID_SO: return &RNA_Sound;
|
case ID_SO: return &RNA_Sound;
|
||||||
|
|||||||
@@ -584,6 +584,10 @@ PropertyRNA *RNA_def_property(StructRNA *srna, const char *identifier, int type,
|
|||||||
fprop->softmin= 0.0f;
|
fprop->softmin= 0.0f;
|
||||||
fprop->softmax= 1.0f;
|
fprop->softmax= 1.0f;
|
||||||
}
|
}
|
||||||
|
else if(subtype == PROP_PERCENTAGE) {
|
||||||
|
fprop->softmin= fprop->hardmin= 0.0f;
|
||||||
|
fprop->softmax= fprop->hardmax= 1.0f;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
fprop->softmin= (subtype == PROP_UNSIGNED)? 0.0f: -10000.0f; /* rather arbitrary .. */
|
fprop->softmin= (subtype == PROP_UNSIGNED)? 0.0f: -10000.0f; /* rather arbitrary .. */
|
||||||
fprop->softmax= 10000.0f;
|
fprop->softmax= 10000.0f;
|
||||||
@@ -1712,6 +1716,20 @@ PropertyRNA *RNA_def_float_array(StructRNA *srna, const char *identifier, int le
|
|||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PropertyRNA *RNA_def_float_percentage(StructRNA *srna, const char *identifier, float default_value,
|
||||||
|
float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
|
||||||
|
{
|
||||||
|
PropertyRNA *prop;
|
||||||
|
|
||||||
|
prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_PERCENTAGE);
|
||||||
|
RNA_def_property_float_default(prop, default_value);
|
||||||
|
if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
|
||||||
|
RNA_def_property_ui_text(prop, ui_name, ui_description);
|
||||||
|
RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
|
||||||
|
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
PropertyRNA *RNA_def_pointer_runtime(StructRNA *srna, const char *identifier, StructRNA *type,
|
PropertyRNA *RNA_def_pointer_runtime(StructRNA *srna, const char *identifier, StructRNA *type,
|
||||||
const char *ui_name, const char *ui_description)
|
const char *ui_name, const char *ui_description)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ void RNA_def_main(BlenderRNA *brna)
|
|||||||
{"sounds", "ID", "rna_Main_sound_begin", "Sounds", "Sound datablocks."},
|
{"sounds", "ID", "rna_Main_sound_begin", "Sounds", "Sound datablocks."},
|
||||||
{"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks."},
|
{"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks."},
|
||||||
{"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks."},
|
{"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks."},
|
||||||
{"particles", "ID", "rna_Main_particle_begin", "Particles", "Particle datablocks."},
|
{"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks."},
|
||||||
{NULL, NULL, NULL, NULL, NULL}};
|
{NULL, NULL, NULL, NULL, NULL}};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -532,6 +532,7 @@ static void rna_def_property(BlenderRNA *brna)
|
|||||||
{PROP_MATRIX, "MATRIX", "Matrix", ""},
|
{PROP_MATRIX, "MATRIX", "Matrix", ""},
|
||||||
{PROP_ROTATION, "ROTATION", "Rotation", ""},
|
{PROP_ROTATION, "ROTATION", "Rotation", ""},
|
||||||
{PROP_NEVER_NULL, "NEVER_NULL", "Never Null", ""},
|
{PROP_NEVER_NULL, "NEVER_NULL", "Never Null", ""},
|
||||||
|
{PROP_PERCENTAGE, "PERCENTAGE", "Percentage", ""},
|
||||||
{0, NULL, NULL, NULL}};
|
{0, NULL, NULL, NULL}};
|
||||||
|
|
||||||
srna= RNA_def_struct(brna, "Property", NULL);
|
srna= RNA_def_struct(brna, "Property", NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user