- fcurve modifiers.new()/remove()/active
- renamed .add() to .new() for rna collection functions since they dont add an existing item. - remove 'name' as an argument from the new driver target function, better to keep the api minimal and let scripters use the data api for editing values after. - added some api functions to keep rna api from becoming a mess.
This commit is contained in:
@@ -105,6 +105,13 @@ bConstraintTypeInfo *get_constraint_typeinfo(int type);
|
||||
struct bConstraint *add_ob_constraint(struct Object *ob, const char *name, short type);
|
||||
struct bConstraint *add_pose_constraint(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type);
|
||||
|
||||
struct bConstraint *find_active_constraint(ListBase *constraints);
|
||||
void set_active_constraint(ListBase *constraints, struct bConstraint *con);
|
||||
|
||||
|
||||
int remove_constraint(ListBase *constraints, struct bConstraint *con);
|
||||
int remove_constraint_index(ListBase *constraints, int index);
|
||||
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* Useful macros for testing various common flag combinations */
|
||||
|
||||
|
||||
@@ -130,7 +130,8 @@ FModifierTypeInfo *get_fmodifier_typeinfo(int type);
|
||||
|
||||
struct FModifier *add_fmodifier(ListBase *modifiers, int type);
|
||||
void copy_fmodifiers(ListBase *dst, ListBase *src);
|
||||
void remove_fmodifier(ListBase *modifiers, struct FModifier *fcm);
|
||||
int remove_fmodifier(ListBase *modifiers, struct FModifier *fcm);
|
||||
int remove_fmodifier_index(ListBase *modifiers, int index);
|
||||
void free_fmodifiers(ListBase *modifiers);
|
||||
|
||||
struct FModifier *find_active_fmodifier(ListBase *modifiers);
|
||||
|
||||
@@ -3690,6 +3690,52 @@ bConstraint *add_ob_constraint(Object *ob, const char *name, short type)
|
||||
return add_new_constraint(ob, NULL, name, type);
|
||||
}
|
||||
|
||||
struct bConstraint *find_active_constraint(ListBase *constraints)
|
||||
{
|
||||
bConstraint *con;
|
||||
if (constraints==NULL)
|
||||
return NULL;
|
||||
|
||||
for(con= constraints->first; con; con= con->next) {
|
||||
if(con->flag & CONSTRAINT_ACTIVE)
|
||||
return con;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void set_active_constraint(ListBase *constraints, struct bConstraint *con)
|
||||
{
|
||||
bConstraint *con_i;
|
||||
for(con_i= constraints->first; con_i; con_i= con_i->next) {
|
||||
if(con_i==con) con->flag |= CONSTRAINT_ACTIVE;
|
||||
else con->flag &= ~CONSTRAINT_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
int remove_constraint(ListBase *constraints, struct bConstraint *con)
|
||||
{
|
||||
if(con) {
|
||||
free_constraint_data(con);
|
||||
BLI_freelinkN(constraints, con);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int remove_constraint_index(ListBase *constraints, int index)
|
||||
{
|
||||
bConstraint *con= BLI_findlink(constraints, index);
|
||||
if(con) {
|
||||
return remove_constraint(constraints, con);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************* General Constraints API ************************** */
|
||||
/* The functions here are called by various parts of Blender. Very few (should be none if possible)
|
||||
* constraint-specific code should occur here.
|
||||
|
||||
@@ -992,13 +992,13 @@ void copy_fmodifiers (ListBase *dst, ListBase *src)
|
||||
}
|
||||
|
||||
/* Remove and free the given F-Modifier from the given stack */
|
||||
void remove_fmodifier (ListBase *modifiers, FModifier *fcm)
|
||||
int remove_fmodifier (ListBase *modifiers, FModifier *fcm)
|
||||
{
|
||||
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
|
||||
|
||||
/* sanity check */
|
||||
if (fcm == NULL)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
/* free modifier's special data (stored inside fcm->data) */
|
||||
if (fcm->data) {
|
||||
@@ -1010,12 +1010,24 @@ void remove_fmodifier (ListBase *modifiers, FModifier *fcm)
|
||||
}
|
||||
|
||||
/* remove modifier from stack */
|
||||
if (modifiers)
|
||||
if (modifiers) {
|
||||
BLI_freelinkN(modifiers, fcm);
|
||||
else {
|
||||
return 1;
|
||||
} else {
|
||||
// XXX this case can probably be removed some day, as it shouldn't happen...
|
||||
printf("remove_fmodifier() - no modifier stack given \n");
|
||||
MEM_freeN(fcm);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
int remove_fmodifier_index (ListBase *modifiers, int index)
|
||||
{
|
||||
FModifier *fcm= BLI_findlink(modifiers, index);
|
||||
if(fcm) {
|
||||
return remove_fmodifier(modifiers, fcm);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,18 +101,7 @@ ListBase *get_active_constraints (Object *ob)
|
||||
/* single constraint */
|
||||
bConstraint *get_active_constraint (Object *ob)
|
||||
{
|
||||
ListBase *lb= get_active_constraints(ob);
|
||||
|
||||
if (lb) {
|
||||
bConstraint *con;
|
||||
|
||||
for (con= lb->first; con; con=con->next) {
|
||||
if (con->flag & CONSTRAINT_ACTIVE)
|
||||
return con;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return find_active_constraint(get_active_constraints(ob));
|
||||
}
|
||||
/* -------------- Constraint Management (Add New, Remove, Rename) -------------------- */
|
||||
/* ------------- PyConstraints ------------------ */
|
||||
@@ -655,22 +644,12 @@ void ED_object_constraint_rename(Object *ob, bConstraint *con, char *oldname)
|
||||
|
||||
|
||||
void ED_object_constraint_set_active(Object *ob, bConstraint *con)
|
||||
{
|
||||
ListBase *lb;
|
||||
bConstraint *origcon= con;
|
||||
|
||||
{
|
||||
/* lets be nice and escape if its active already */
|
||||
if(con && (con->flag & CONSTRAINT_ACTIVE))
|
||||
return ;
|
||||
|
||||
lb= get_active_constraints(ob);
|
||||
if(lb == NULL)
|
||||
return;
|
||||
|
||||
for(con= lb->first; con; con= con->next) {
|
||||
if(con==origcon) con->flag |= CONSTRAINT_ACTIVE;
|
||||
else con->flag &= ~CONSTRAINT_ACTIVE;
|
||||
}
|
||||
set_active_constraint(get_active_constraints(ob), con);
|
||||
}
|
||||
|
||||
void ED_object_constraint_update(Object *ob)
|
||||
@@ -1373,8 +1352,7 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *op)
|
||||
for (con= pchan->constraints.first; con; con= next) {
|
||||
next= con->next;
|
||||
if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
|
||||
free_constraint_data(con);
|
||||
BLI_freelinkN(&pchan->constraints, con);
|
||||
remove_constraint(&pchan->constraints, con);
|
||||
}
|
||||
}
|
||||
pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET);
|
||||
|
||||
@@ -633,11 +633,11 @@ static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
// FunctionRNA *func;
|
||||
// PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "ArmatureBones");
|
||||
srna= RNA_def_struct(brna, "ArmatureBones", NULL);
|
||||
RNA_def_struct_sdna(srna, "bArmature");
|
||||
RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones.");
|
||||
|
||||
RNA_def_property_srna(cprop, "ArmatureBones");
|
||||
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Bone");
|
||||
@@ -659,12 +659,11 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
// FunctionRNA *func;
|
||||
// PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "ArmatureEditBones");
|
||||
srna= RNA_def_struct(brna, "ArmatureEditBones", NULL);
|
||||
RNA_def_struct_sdna(srna, "bArmature");
|
||||
RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones.");
|
||||
|
||||
RNA_def_property_srna(cprop, "ArmatureEditBones");
|
||||
|
||||
prop= RNA_def_property(srna, "edit_bones", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "EditBone");
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
|
||||
|
||||
@@ -190,18 +190,9 @@ static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value)
|
||||
fcu->rna_path= NULL;
|
||||
}
|
||||
|
||||
DriverTarget *rna_Driver_add_target(ChannelDriver *driver, char *name)
|
||||
DriverTarget *rna_Driver_new_target(ChannelDriver *driver)
|
||||
{
|
||||
DriverTarget *dtar= driver_add_new_target(driver);
|
||||
|
||||
/* set the name if given */
|
||||
if (name && name[0]) {
|
||||
BLI_strncpy(dtar->name, name, 64);
|
||||
BLI_uniquename(&driver->targets, dtar, "var", '_', offsetof(DriverTarget, name), 64);
|
||||
}
|
||||
|
||||
/* return this target for the users to play with */
|
||||
return dtar;
|
||||
return driver_add_new_target(driver);
|
||||
}
|
||||
|
||||
void rna_Driver_remove_target(ChannelDriver *driver, DriverTarget *dtar)
|
||||
@@ -210,8 +201,31 @@ void rna_Driver_remove_target(ChannelDriver *driver, DriverTarget *dtar)
|
||||
driver_free_target(driver, dtar);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static PointerRNA rna_FCurve_active_modifier_get(PointerRNA *ptr)
|
||||
{
|
||||
FCurve *fcu= (FCurve*)ptr->data;
|
||||
FModifier *fcm= find_active_fmodifier(&fcu->modifiers);
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_FModifier, fcm);
|
||||
}
|
||||
|
||||
static void rna_FCurve_active_modifier_set(PointerRNA *ptr, PointerRNA value)
|
||||
{
|
||||
FCurve *fcu= (FCurve*)ptr->data;
|
||||
set_active_fmodifier(&fcu->modifiers, (FModifier *)value.data);
|
||||
}
|
||||
|
||||
static FModifier *rna_FCurve_modifiers_new(FCurve *fcu, bContext *C, int type)
|
||||
{
|
||||
return add_fmodifier(&fcu->modifiers, type);
|
||||
}
|
||||
|
||||
static int rna_FCurve_modifiers_remove(FCurve *fcu, bContext *C, int index)
|
||||
{
|
||||
return remove_fmodifier_index(&fcu->modifiers, index);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void rna_def_fmodifier_generator(BlenderRNA *brna)
|
||||
{
|
||||
@@ -623,21 +637,18 @@ static void rna_def_channeldriver_targets(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "ChannelDriverTargets");
|
||||
srna= RNA_def_struct(brna, "ChannelDriverTargets", NULL);
|
||||
RNA_def_struct_sdna(srna, "ChannelDriver");
|
||||
RNA_def_struct_ui_text(srna, "ChannelDriver Targets", "Collection of channel driver Targets.");
|
||||
|
||||
RNA_def_property_srna(cprop, "ChannelDriverTargets");
|
||||
|
||||
|
||||
/* add target */
|
||||
func= RNA_def_function(srna, "add", "rna_Driver_add_target");
|
||||
func= RNA_def_function(srna, "new", "rna_Driver_new_target");
|
||||
RNA_def_function_ui_description(func, "Add a new target for the driver.");
|
||||
/* return type */
|
||||
parm= RNA_def_pointer(func, "target", "DriverTarget", "", "Newly created Driver Target.");
|
||||
RNA_def_function_return(func, parm);
|
||||
/* optional name parameter */
|
||||
parm= RNA_def_string(func, "name", "", 64, "Name", "Name to use in scripted expressions/functions. (No spaces or dots are allowed. Also, must not start with a symbol or digit)");
|
||||
|
||||
/* remove target */
|
||||
func= RNA_def_function(srna, "remove", "rna_Driver_remove_target");
|
||||
@@ -708,6 +719,52 @@ static void rna_def_fpoint(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Point", "Point coordinates");
|
||||
}
|
||||
|
||||
/* channeldriver.targets.* */
|
||||
static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
/* add target */
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "FCurveModifiers");
|
||||
srna= RNA_def_struct(brna, "FCurveModifiers", NULL);
|
||||
RNA_def_struct_sdna(srna, "FCurve");
|
||||
RNA_def_struct_ui_text(srna, "FCurve Modifiers", "Collection of fcurve modifiers.");
|
||||
|
||||
|
||||
/* Collection active property */
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "FModifier");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_FCurve_active_modifier_get", "rna_FCurve_active_modifier_set", NULL);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Active fcurve modifier", "Active fcurve modifier.");
|
||||
|
||||
|
||||
/* Constraint collection */
|
||||
func= RNA_def_function(srna, "new", "rna_FCurve_modifiers_new");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Add a constraint to this object");
|
||||
/* return type */
|
||||
parm= RNA_def_pointer(func, "fmodifier", "FModifier", "", "New fmodifier.");
|
||||
RNA_def_function_return(func, parm);
|
||||
/* object to add */
|
||||
parm= RNA_def_enum(func, "type", fmodifier_type_items, 1, "", "Constraint type to add.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
|
||||
func= RNA_def_function(srna, "remove", "rna_FCurve_modifiers_remove");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Remove a modifier from this fcurve.");
|
||||
/* return type */
|
||||
parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully.");
|
||||
RNA_def_function_return(func, parm);
|
||||
/* object to add */
|
||||
parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
}
|
||||
|
||||
static void rna_def_fcurve(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
@@ -769,6 +826,8 @@ static void rna_def_fcurve(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "FModifier");
|
||||
RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the shape of the F-Curve.");
|
||||
|
||||
rna_def_fcurve_modifiers(brna, prop);
|
||||
}
|
||||
|
||||
/* *********************** */
|
||||
|
||||
@@ -72,11 +72,10 @@ static void rna_def_group_objects(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
srna= RNA_def_struct(brna, "GroupObjectCollection", NULL);
|
||||
RNA_def_property_srna(cprop, "GroupObjects");
|
||||
srna= RNA_def_struct(brna, "GroupObjects", NULL);
|
||||
RNA_def_struct_sdna(srna, "Group");
|
||||
RNA_def_struct_ui_text(srna, "GroupObjects", "Collection of group objects.");
|
||||
|
||||
RNA_def_property_srna(cprop, "GroupObjectCollection");
|
||||
RNA_def_struct_ui_text(srna, "Group Objects", "Collection of group objects.");
|
||||
|
||||
/* add object */
|
||||
func= RNA_def_function(srna, "link", "rna_Group_objects_link");
|
||||
|
||||
@@ -865,29 +865,17 @@ static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
|
||||
static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
bConstraint *con;
|
||||
for(con= ob->constraints.first; con; con= con->next) {
|
||||
if(con->flag & CONSTRAINT_ACTIVE)
|
||||
break;
|
||||
}
|
||||
|
||||
bConstraint *con= find_active_constraint(&ob->constraints);
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
|
||||
}
|
||||
|
||||
static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
|
||||
{
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
bConstraint *con;
|
||||
for(con= ob->constraints.first; con; con= con->next) {
|
||||
if(value.data==con)
|
||||
con->flag |= CONSTRAINT_ACTIVE;
|
||||
else
|
||||
con->flag &= ~CONSTRAINT_ACTIVE;
|
||||
}
|
||||
set_active_constraint(&ob->constraints, (bConstraint *)value.data);
|
||||
}
|
||||
|
||||
|
||||
static bConstraint *rna_Object_constraints_add(Object *object, bContext *C, int type)
|
||||
static bConstraint *rna_Object_constraints_new(Object *object, bContext *C, int type)
|
||||
{
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
|
||||
return add_ob_constraint(object, NULL, type);
|
||||
@@ -895,20 +883,13 @@ static bConstraint *rna_Object_constraints_add(Object *object, bContext *C, int
|
||||
|
||||
static int rna_Object_constraints_remove(Object *object, bContext *C, int index)
|
||||
{
|
||||
bConstraint *con= BLI_findlink(&object->constraints, index);
|
||||
|
||||
if(con) {
|
||||
free_constraint_data(con);
|
||||
BLI_freelinkN(&object->constraints, con);
|
||||
|
||||
int ok = remove_constraint_index(&object->constraints, index);
|
||||
if(ok) {
|
||||
ED_object_constraint_set_active(object, NULL);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, object);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -1187,12 +1168,11 @@ static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "ObjectConstraints");
|
||||
srna= RNA_def_struct(brna, "ObjectConstraints", NULL);
|
||||
RNA_def_struct_sdna(srna, "Object");
|
||||
RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints.");
|
||||
|
||||
RNA_def_property_srna(cprop, "ObjectConstraints");
|
||||
|
||||
|
||||
/* Collection active property */
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
@@ -1203,9 +1183,9 @@ static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
||||
|
||||
/* Constraint collection */
|
||||
func= RNA_def_function(srna, "add", "rna_Object_constraints_add");
|
||||
func= RNA_def_function(srna, "new", "rna_Object_constraints_new");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Add a constraint to this object");
|
||||
RNA_def_function_ui_description(func, "Add a new constraint to this object");
|
||||
/* return type */
|
||||
parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
@@ -419,30 +419,17 @@ static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *r
|
||||
static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr)
|
||||
{
|
||||
bPoseChannel *pchan= (bPoseChannel*)ptr->data;
|
||||
|
||||
bConstraint *con;
|
||||
for(con= pchan->constraints.first; con; con= con->next) {
|
||||
if(con->flag & CONSTRAINT_ACTIVE)
|
||||
break;
|
||||
}
|
||||
|
||||
bConstraint *con= find_active_constraint(&pchan->constraints);
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
|
||||
}
|
||||
|
||||
static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA value)
|
||||
{
|
||||
bPoseChannel *pchan= (bPoseChannel*)ptr->data;
|
||||
|
||||
bConstraint *con;
|
||||
for(con= pchan->constraints.first; con; con= con->next) {
|
||||
if(value.data==con)
|
||||
con->flag |= CONSTRAINT_ACTIVE;
|
||||
else
|
||||
con->flag &= ~CONSTRAINT_ACTIVE;
|
||||
}
|
||||
set_active_constraint(&pchan->constraints, (bConstraint *)value.data);
|
||||
}
|
||||
|
||||
static bConstraint *rna_PoseChannel_constraints_add(bPoseChannel *pchan, bContext *C, int type)
|
||||
static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, bContext *C, int type)
|
||||
{
|
||||
//WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
|
||||
// TODO, pass object also
|
||||
@@ -452,20 +439,10 @@ static bConstraint *rna_PoseChannel_constraints_add(bPoseChannel *pchan, bContex
|
||||
|
||||
static int rna_PoseChannel_constraints_remove(bPoseChannel *pchan, bContext *C, int index)
|
||||
{
|
||||
bConstraint *con= BLI_findlink(&pchan->constraints, index);
|
||||
|
||||
if(con) {
|
||||
free_constraint_data(con);
|
||||
BLI_freelinkN(&pchan->constraints, con);
|
||||
|
||||
//ED_object_constraint_set_active(object, NULL);
|
||||
//WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, object);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
// TODO
|
||||
//ED_object_constraint_set_active(object, NULL);
|
||||
//WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, object);
|
||||
return remove_constraint_index(&pchan->constraints, index);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -549,12 +526,11 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "PoseChannelConstraints");
|
||||
srna= RNA_def_struct(brna, "PoseChannelConstraints", NULL);
|
||||
RNA_def_struct_sdna(srna, "bPoseChannel");
|
||||
RNA_def_struct_ui_text(srna, "PoseChannel Constraints", "Collection of object constraints.");
|
||||
|
||||
RNA_def_property_srna(cprop, "PoseChannelConstraints");
|
||||
|
||||
/* Collection active property */
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Constraint");
|
||||
@@ -564,7 +540,7 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
|
||||
|
||||
|
||||
/* Constraint collection */
|
||||
func= RNA_def_function(srna, "add", "rna_PoseChannel_constraints_add");
|
||||
func= RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
RNA_def_function_ui_description(func, "Add a constraint to this object");
|
||||
/* return type */
|
||||
|
||||
@@ -2178,13 +2178,12 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
|
||||
RNA_def_property_srna(cprop, "SceneObjects");
|
||||
srna= RNA_def_struct(brna, "SceneObjects", NULL);
|
||||
RNA_def_struct_sdna(srna, "Object");
|
||||
RNA_def_struct_ui_text(srna, "Scene Objects", "Collection of scene objects.");
|
||||
|
||||
RNA_def_property_srna(cprop, "SceneObjects");
|
||||
|
||||
#if 0
|
||||
/* add object */
|
||||
func= RNA_def_function(srna, "link", "rna_Scene_objects_link");
|
||||
@@ -2229,12 +2228,11 @@ static void rna_def_scene_bases(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
// FunctionRNA *func;
|
||||
// PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "SceneBases");
|
||||
srna= RNA_def_struct(brna, "SceneBases", NULL);
|
||||
RNA_def_struct_sdna(srna, "Scene");
|
||||
RNA_def_struct_ui_text(srna, "Scene Bases", "Collection of scene bases.");
|
||||
|
||||
RNA_def_property_srna(cprop, "SceneBases");
|
||||
|
||||
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "ObjectBase");
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "basact");
|
||||
|
||||
Reference in New Issue
Block a user