NLA SoC: Fixed merge errors. Manually copied over any files from 2.5 that were modified in a commit by Brecht between the time when I had done the previous merge and the time when the commit for that finally got through.
This commit is contained in:
@@ -45,6 +45,7 @@ void *copy_libblock(void *rt);
|
||||
|
||||
void id_lib_extern(struct ID *id);
|
||||
void id_us_plus(struct ID *id);
|
||||
void id_us_min(struct ID *id);
|
||||
|
||||
int check_for_dupid(struct ListBase *lb, struct ID *id, char *name);
|
||||
int new_id(struct ListBase *lb, struct ID *id, const char *name);
|
||||
|
||||
@@ -142,6 +142,12 @@ void id_us_plus(ID *id)
|
||||
}
|
||||
}
|
||||
|
||||
void id_us_min(ID *id)
|
||||
{
|
||||
if(id)
|
||||
id->us--;
|
||||
}
|
||||
|
||||
ListBase *wich_libbase(Main *mainlib, short type)
|
||||
{
|
||||
switch( type ) {
|
||||
|
||||
@@ -35,6 +35,7 @@ struct bContext;
|
||||
struct Base;
|
||||
struct View3D;
|
||||
struct bConstraint;
|
||||
struct bConstraintChannel;
|
||||
struct KeyBlock;
|
||||
struct Lattice;
|
||||
struct Mesh;
|
||||
@@ -71,8 +72,20 @@ void ED_object_base_init_from_view(struct bContext *C, struct Base *base);
|
||||
int object_data_is_libdata(struct Object *ob);
|
||||
|
||||
/* constraints */
|
||||
struct bConstraint *add_new_constraint (short type);
|
||||
void add_constraint_to_object (struct bConstraint *con, struct Object *ob);
|
||||
struct bConstraint *add_new_constraint(short type);
|
||||
void add_constraint_to_object(struct bConstraint *con, struct Object *ob);
|
||||
|
||||
struct ListBase *get_active_constraints(struct Object *ob);
|
||||
struct bConstraint *get_active_constraint(struct Object *ob);
|
||||
struct bConstraintChannel *get_active_constraint_channel(struct Scene *scene, struct Object *ob);
|
||||
|
||||
void object_test_constraints(struct Object *ob);
|
||||
|
||||
void ED_object_constraint_rename(struct Object *ob, struct bConstraint *con, char *oldname);
|
||||
void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con);
|
||||
int ED_object_constraint_delete(struct ReportList *reports, struct Object *ob, struct bConstraint *con);
|
||||
int ED_object_constraint_move_down(struct ReportList *reports, struct Object *ob, struct bConstraint *con);
|
||||
int ED_object_constraint_move_up(struct ReportList *reports, struct Object *ob, struct bConstraint *con);
|
||||
|
||||
/* editlattice.c */
|
||||
void mouse_lattice(struct bContext *C, short mval[2], int extend);
|
||||
|
||||
@@ -189,6 +189,8 @@ typedef struct uiLayout uiLayout;
|
||||
#define FTPREVIEW (35<<9)
|
||||
#define NUMABS (36<<9)
|
||||
#define TOGBUT (37<<9)
|
||||
#define OPTION (38<<9)
|
||||
#define OPTIONN (39<<9)
|
||||
#define BUTTYPE (63<<9)
|
||||
|
||||
/* Drawing
|
||||
@@ -579,7 +581,8 @@ uiBlock *uiLayoutFreeBlock(uiLayout *layout);
|
||||
void uiTemplateHeader(uiLayout *layout, struct bContext *C);
|
||||
void uiTemplateHeaderID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname,
|
||||
char *newop, char *openop, char *unlinkop);
|
||||
uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
|
||||
uiLayout *uiTemplateModifier(uiLayout *layout, struct PointerRNA *ptr);
|
||||
uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
|
||||
void uiTemplatePreview(uiLayout *layout, struct ID *id);
|
||||
|
||||
/* items */
|
||||
@@ -592,8 +595,8 @@ void uiItemFloatO(uiLayout *layout, char *name, int icon, char *opname, char *pr
|
||||
void uiItemStringO(uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value);
|
||||
void uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, struct IDProperty *properties, int context);
|
||||
|
||||
void uiItemR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int expand, int slider);
|
||||
void uiItemFullR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int expand, int slider);
|
||||
void uiItemR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int expand, int slider, int toggle);
|
||||
void uiItemFullR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int expand, int slider, int toggle);
|
||||
void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int value);
|
||||
void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname);
|
||||
|
||||
|
||||
@@ -679,7 +679,7 @@ static void ui_is_but_sel(uiBut *but)
|
||||
|
||||
value= ui_get_but_val(but);
|
||||
|
||||
if( but->type==TOGN || but->type==ICONTOGN) true= 0;
|
||||
if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) true= 0;
|
||||
|
||||
if( but->bit ) {
|
||||
lvalue= (int)value;
|
||||
@@ -700,10 +700,12 @@ static void ui_is_but_sel(uiBut *but)
|
||||
case TOG3:
|
||||
case BUT_TOGDUAL:
|
||||
case ICONTOG:
|
||||
case OPTION:
|
||||
if(value!=but->hardmin) push= 1;
|
||||
break;
|
||||
case ICONTOGN:
|
||||
case TOGN:
|
||||
case OPTIONN:
|
||||
if(value==0.0) push= 1;
|
||||
break;
|
||||
case ROW:
|
||||
@@ -1509,7 +1511,12 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
|
||||
* custom collection too for bones, vertex groups, .. */
|
||||
ui_rna_ID_collection(C, but, &ptr, &prop);
|
||||
|
||||
if(prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr)) {
|
||||
if(str == NULL || str[0] == '\0') {
|
||||
memset(&rptr, 0, sizeof(rptr));
|
||||
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr);
|
||||
return 11;
|
||||
}
|
||||
else if(prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr)) {
|
||||
RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr);
|
||||
return 1;
|
||||
}
|
||||
@@ -1989,7 +1996,7 @@ void uiBlockEndAlign(uiBlock *block)
|
||||
|
||||
int ui_but_can_align(uiBut *but)
|
||||
{
|
||||
return (but->type != LABEL);
|
||||
return !ELEM3(but->type, LABEL, OPTION, OPTIONN);
|
||||
}
|
||||
|
||||
static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr)
|
||||
|
||||
@@ -89,7 +89,8 @@ void RNA_api_ui_layout(StructRNA *srna)
|
||||
parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail.");
|
||||
RNA_def_boolean(func, "slider", 0, "", "Use slider for numeric values.");
|
||||
RNA_def_boolean(func, "slider", 0, "", "Use slider widget for numeric values.");
|
||||
RNA_def_boolean(func, "toggle", 0, "", "Use toggle widget for boolean values.");
|
||||
|
||||
func= RNA_def_function(srna, "items_enumR", "uiItemsEnumR");
|
||||
parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property.");
|
||||
@@ -198,13 +199,17 @@ void RNA_api_ui_layout(StructRNA *srna)
|
||||
RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block.");
|
||||
|
||||
func= RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
|
||||
parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm= RNA_def_pointer(func, "data", "AnyType", "", "Modifier data.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func= RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
|
||||
parm= RNA_def_pointer(func, "data", "AnyType", "", "Constraint data.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func= RNA_def_function(srna, "template_preview", "uiTemplatePreview");
|
||||
parm= RNA_def_pointer(func, "id", "ID", "", "ID datablock.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
|
||||
@@ -364,7 +364,7 @@ static void ui_apply_but_TOG(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
|
||||
if(value==0.0) push= 1;
|
||||
else push= 0;
|
||||
|
||||
if(but->type==TOGN || but->type==ICONTOGN) push= !push;
|
||||
if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) push= !push;
|
||||
ui_set_but_val(but, (double)push);
|
||||
if(but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
|
||||
}
|
||||
@@ -566,6 +566,8 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
|
||||
case ICONTOGN:
|
||||
case TOGN:
|
||||
case BUT_TOGDUAL:
|
||||
case OPTION:
|
||||
case OPTIONN:
|
||||
ui_apply_but_TOG(C, block, but, data);
|
||||
break;
|
||||
case ROW:
|
||||
@@ -2672,6 +2674,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
|
||||
case ICONTOGN:
|
||||
case TOGN:
|
||||
case BUT_TOGDUAL:
|
||||
case OPTION:
|
||||
case OPTIONN:
|
||||
retval= ui_do_but_TOG(C, but, data, event);
|
||||
break;
|
||||
#if 0
|
||||
|
||||
@@ -268,7 +268,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
|
||||
else if(icon)
|
||||
but= uiDefIconTextButR(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||
else
|
||||
but= uiDefButR(block, TOG, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||
but= uiDefButR(block, OPTION, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
|
||||
break;
|
||||
}
|
||||
case PROP_INT:
|
||||
@@ -338,7 +338,7 @@ void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr)
|
||||
name= (char*)RNA_property_ui_name(prop);
|
||||
|
||||
uiItemL(uiLayoutColumn(split, 0), name, 0);
|
||||
uiItemFullR(uiLayoutColumn(split, 0), "", 0, ptr, prop, -1, 0, 0, 0);
|
||||
uiItemFullR(uiLayoutColumn(split, 0), "", 0, ptr, prop, -1, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
RNA_property_collection_end(&iter);
|
||||
|
||||
@@ -1830,11 +1830,13 @@ void ui_draw_but(ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
|
||||
wt= widget_type(UI_WTYPE_NAME);
|
||||
break;
|
||||
case TOGBUT:
|
||||
wt= widget_type(UI_WTYPE_TOGGLE);
|
||||
break;
|
||||
case TOG:
|
||||
case TOGN:
|
||||
case TOG3:
|
||||
wt= widget_type(UI_WTYPE_TOGGLE);
|
||||
break;
|
||||
case OPTION:
|
||||
case OPTIONN:
|
||||
if (!(but->flag & UI_HAS_ICON)) {
|
||||
wt= widget_type(UI_WTYPE_OPTION);
|
||||
but->flag |= UI_TEXT_LEFT;
|
||||
|
||||
@@ -49,17 +49,27 @@
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_armature.h"
|
||||
#include "BKE_constraint.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_report.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
#include "BPY_extern.h"
|
||||
#endif
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
#include "RNA_enum_types.h"
|
||||
|
||||
#include "ED_object.h"
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "object_intern.h"
|
||||
|
||||
@@ -589,55 +599,6 @@ void ob_clear_constraints (Scene *scene)
|
||||
BIF_undo_push("Clear Constraint(s)");
|
||||
}
|
||||
|
||||
/* Rename the given constraint
|
||||
* - con already has the new name
|
||||
*/
|
||||
void rename_constraint (Object *ob, bConstraint *con, char *oldname)
|
||||
{
|
||||
bConstraint *tcon;
|
||||
ListBase *conlist= NULL;
|
||||
int from_object= 0;
|
||||
char *channame="";
|
||||
|
||||
/* get context by searching for con (primitive...) */
|
||||
for (tcon= ob->constraints.first; tcon; tcon= tcon->next) {
|
||||
if (tcon==con)
|
||||
break;
|
||||
}
|
||||
|
||||
if (tcon) {
|
||||
conlist= &ob->constraints;
|
||||
channame= "Object";
|
||||
from_object= 1;
|
||||
}
|
||||
else if (ob->pose) {
|
||||
bPoseChannel *pchan;
|
||||
|
||||
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
|
||||
for (tcon= pchan->constraints.first; tcon; tcon= tcon->next) {
|
||||
if (tcon==con)
|
||||
break;
|
||||
}
|
||||
if (tcon)
|
||||
break;
|
||||
}
|
||||
|
||||
if (tcon) {
|
||||
conlist= &pchan->constraints;
|
||||
channame= pchan->name;
|
||||
}
|
||||
}
|
||||
|
||||
if (conlist==NULL) {
|
||||
printf("rename constraint failed\n"); /* should not happen in UI */
|
||||
return;
|
||||
}
|
||||
|
||||
/* first make sure it's a unique name within context */
|
||||
unique_constraint_name (con, conlist);
|
||||
}
|
||||
|
||||
|
||||
/* ------------- Constraint Sanity Testing ------------------- */
|
||||
|
||||
/* checks validity of object pointers, and NULLs,
|
||||
@@ -889,3 +850,237 @@ void childof_const_clearinv (void *conv, void *unused)
|
||||
/* simply clear the matrix */
|
||||
Mat4One(data->invmat);
|
||||
}
|
||||
|
||||
/***************************** BUTTONS ****************************/
|
||||
|
||||
/* Rename the given constraint, con already has the new name */
|
||||
void ED_object_constraint_rename(Object *ob, bConstraint *con, char *oldname)
|
||||
{
|
||||
bConstraint *tcon;
|
||||
ListBase *conlist= NULL;
|
||||
int from_object= 0;
|
||||
char *channame="";
|
||||
|
||||
/* get context by searching for con (primitive...) */
|
||||
for (tcon= ob->constraints.first; tcon; tcon= tcon->next) {
|
||||
if (tcon==con)
|
||||
break;
|
||||
}
|
||||
|
||||
if (tcon) {
|
||||
conlist= &ob->constraints;
|
||||
channame= "Object";
|
||||
from_object= 1;
|
||||
}
|
||||
else if (ob->pose) {
|
||||
bPoseChannel *pchan;
|
||||
|
||||
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
|
||||
for (tcon= pchan->constraints.first; tcon; tcon= tcon->next) {
|
||||
if (tcon==con)
|
||||
break;
|
||||
}
|
||||
if (tcon)
|
||||
break;
|
||||
}
|
||||
|
||||
if (tcon) {
|
||||
conlist= &pchan->constraints;
|
||||
channame= pchan->name;
|
||||
}
|
||||
}
|
||||
|
||||
if (conlist==NULL) {
|
||||
printf("rename constraint failed\n"); /* should not happen in UI */
|
||||
return;
|
||||
}
|
||||
|
||||
/* first make sure it's a unique name within context */
|
||||
unique_constraint_name (con, conlist);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* make sure ipowin and buttons shows it */
|
||||
if(ob->ipowin==ID_CO) {
|
||||
// XXX allqueue(REDRAWIPO, ID_CO);
|
||||
// XXX allspace(REMAKEIPO, 0);
|
||||
// XXX allqueue(REDRAWNLA, 0);
|
||||
}
|
||||
// XXX allqueue(REDRAWBUTSOBJECT, 0);
|
||||
}
|
||||
|
||||
int ED_object_constraint_delete(ReportList *reports, Object *ob, bConstraint *con)
|
||||
{
|
||||
bConstraintChannel *chan;
|
||||
ListBase *lb;
|
||||
|
||||
/* remove ipo channel */
|
||||
lb= NULL; // XXX get_active_constraint_channels(ob, 0);
|
||||
if(lb) {
|
||||
chan = NULL; // XXX get_constraint_channel(lb, con->name);
|
||||
if(chan) {
|
||||
if(chan->ipo) chan->ipo->id.us--;
|
||||
BLI_freelinkN(lb, chan);
|
||||
}
|
||||
}
|
||||
|
||||
/* remove constraint itself */
|
||||
lb= get_active_constraints(ob);
|
||||
free_constraint_data(con);
|
||||
BLI_freelinkN(lb, con);
|
||||
|
||||
ED_object_constraint_set_active(ob, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ED_object_constraint_move_down(ReportList *reports, Object *ob, bConstraint *constr)
|
||||
{
|
||||
bConstraint *con;
|
||||
ListBase *conlist;
|
||||
|
||||
if(constr->next) {
|
||||
conlist = get_active_constraints(ob);
|
||||
for(con= conlist->first; con; con= con->next) {
|
||||
if(con==constr) {
|
||||
BLI_remlink(conlist, con);
|
||||
BLI_insertlink(conlist, con->next, con);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ED_object_constraint_move_up(ReportList *reports, Object *ob, bConstraint *constr)
|
||||
{
|
||||
bConstraint *con;
|
||||
ListBase *conlist;
|
||||
|
||||
if(constr->prev) {
|
||||
conlist = get_active_constraints(ob);
|
||||
for(con= conlist->first; con; con= con->next) {
|
||||
if(con==constr) {
|
||||
BLI_remlink(conlist, con);
|
||||
BLI_insertlink(conlist, con->prev->prev, con);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************** OPERATORS ****************************/
|
||||
|
||||
/************************ add constraint operator *********************/
|
||||
|
||||
static int constraint_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
bConstraint *con;
|
||||
ListBase *list= get_active_constraints(ob);
|
||||
bPoseChannel *pchan= get_active_posechannel(ob);
|
||||
int type= RNA_enum_get(op->ptr, "type");
|
||||
|
||||
con = add_new_constraint(type);
|
||||
|
||||
if(list) {
|
||||
unique_constraint_name(con, list);
|
||||
BLI_addtail(list, con);
|
||||
|
||||
if(proxylocked_constraints_owner(ob, pchan))
|
||||
con->flag |= CONSTRAINT_PROXY_LOCAL;
|
||||
|
||||
con->flag |= CONSTRAINT_ACTIVE;
|
||||
for(con= con->prev; con; con= con->prev)
|
||||
con->flag &= ~CONSTRAINT_ACTIVE;
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case CONSTRAINT_TYPE_CHILDOF:
|
||||
{
|
||||
/* if this constraint is being added to a posechannel, make sure
|
||||
* the constraint gets evaluated in pose-space */
|
||||
if(ob->flag & OB_POSEMODE) {
|
||||
con->ownspace = CONSTRAINT_SPACE_POSE;
|
||||
con->flag |= CONSTRAINT_SPACEONCE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CONSTRAINT_TYPE_RIGIDBODYJOINT:
|
||||
{
|
||||
bRigidBodyJointConstraint *data;
|
||||
|
||||
/* set selected first object as target - moved from new_constraint_data */
|
||||
data = (bRigidBodyJointConstraint*)con->data;
|
||||
|
||||
CTX_DATA_BEGIN(C, Object*, selob, selected_objects) {
|
||||
if(selob != ob) {
|
||||
data->tar= selob;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
object_test_constraints(ob);
|
||||
|
||||
if(ob->pose)
|
||||
update_pose_constraint_flags(ob->pose);
|
||||
|
||||
if(ob->type==OB_ARMATURE)
|
||||
DAG_object_flush_update(scene, ob, OB_RECALC_DATA|OB_RECALC_OB);
|
||||
else
|
||||
DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void OBJECT_OT_constraint_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Add Constraint";
|
||||
ot->description = "Add a constraint to the active object.";
|
||||
ot->idname= "OBJECT_OT_constraint_add";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke= WM_menu_invoke;
|
||||
ot->exec= constraint_add_exec;
|
||||
|
||||
ot->poll= ED_operator_object_active;
|
||||
|
||||
/* flags */
|
||||
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
||||
|
||||
RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
|
||||
}
|
||||
|
||||
|
||||
@@ -88,5 +88,8 @@ void GROUP_OT_objects_remove_active(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_modifier_add(struct wmOperatorType *ot);
|
||||
void OBJECT_OT_multires_subdivide(struct wmOperatorType *ot);
|
||||
|
||||
/* editconstraint.c */
|
||||
void OBJECT_OT_constraint_add(struct wmOperatorType *ot);
|
||||
|
||||
#endif /* ED_OBJECT_INTERN_H */
|
||||
|
||||
|
||||
@@ -368,6 +368,8 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
|
||||
RNA_def_enum(ot->srna, "type", modifier_type_items, 0, "Type", "");
|
||||
}
|
||||
|
||||
/****************** multires subdivide operator *********************/
|
||||
|
||||
static int multires_subdivide_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
@@ -101,6 +101,8 @@ void ED_operatortypes_object(void)
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_modifier_add);
|
||||
WM_operatortype_append(OBJECT_OT_multires_subdivide);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_constraint_add);
|
||||
}
|
||||
|
||||
void ED_keymap_object(wmWindowManager *wm)
|
||||
|
||||
@@ -150,8 +150,8 @@ static void image_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, NULL, 0, &spaceptr, "update_automatically", 0, 0);
|
||||
// XXX if(show_uvedit) uiItemR(layout, NULL, 0, &uvptr, "local_view", 0, 0); // "UV Local View", Numpad /
|
||||
uiItemR(layout, NULL, 0, &spaceptr, "update_automatically", 0, 0, 0);
|
||||
// XXX if(show_uvedit) uiItemR(layout, NULL, 0, &uvptr, "local_view", 0, 0, 0); // "UV Local View", Numpad /
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
@@ -234,7 +234,7 @@ static void image_imagemenu(bContext *C, uiLayout *layout, void *arg_unused)
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, NULL, 0, &spaceptr, "image_painting", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &spaceptr, "image_painting", 0, 0, 0);
|
||||
|
||||
/* move to realtime properties panel */
|
||||
RNA_id_pointer_create(&ima->id, &imaptr);
|
||||
@@ -338,12 +338,12 @@ static void image_uvsmenu(bContext *C, uiLayout *layout, void *arg_unused)
|
||||
RNA_id_pointer_create(&scene->id, &sceneptr);
|
||||
|
||||
/* create menu */
|
||||
uiItemR(layout, NULL, 0, &uvptr, "snap_to_pixels", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &uvptr, "constrain_to_image_bounds", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &uvptr, "snap_to_pixels", 0, 0, 0);
|
||||
uiItemR(layout, NULL, 0, &uvptr, "constrain_to_image_bounds", 0, 0, 0);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, NULL, 0, &uvptr, "live_unwrap", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &uvptr, "live_unwrap", 0, 0, 0);
|
||||
uiItemO(layout, NULL, 0, "UV_OT_unwrap");
|
||||
uiItemBooleanO(layout, "Unpin", 0, "UV_OT_pin", "clear", 1);
|
||||
uiItemO(layout, NULL, 0, "UV_OT_pin");
|
||||
@@ -363,7 +363,7 @@ static void image_uvsmenu(bContext *C, uiLayout *layout, void *arg_unused)
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, NULL, 0, &sceneptr, "proportional_editing", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &sceneptr, "proportional_editing", 0, 0, 0);
|
||||
uiItemMenuEnumR(layout, NULL, 0, &sceneptr, "proportional_editing_falloff");
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
@@ -3359,7 +3359,7 @@ static void view3d_edit_curvemenu(bContext *C, uiLayout *layout, void *arg_unuse
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, NULL, 0, &sceneptr, "proportional_editing", 0, 0); // |O
|
||||
uiItemR(layout, NULL, 0, &sceneptr, "proportional_editing", 0, 0, 0); // |O
|
||||
uiItemMenuEnumR(layout, NULL, 0, &sceneptr, "proportional_editing_falloff");
|
||||
|
||||
uiItemS(layout);
|
||||
@@ -4533,12 +4533,12 @@ static void view3d_sculpt_menu(bContext *C, uiLayout *layout, void *arg_unused)
|
||||
|
||||
RNA_pointer_create(&sc->id, &RNA_Sculpt, s, &rna);
|
||||
|
||||
uiItemR(layout, NULL, 0, &rna, "symmetry_x", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "symmetry_y", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "symmetry_z", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "lock_x", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "lock_y", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "lock_z", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "symmetry_x", 0, 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "symmetry_y", 0, 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "symmetry_z", 0, 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "lock_x", 0, 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "lock_y", 0, 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "lock_z", 0, 0, 0);
|
||||
|
||||
/* Brush settings */
|
||||
RNA_pointer_create(&sc->id, &RNA_Brush, s->brush, &rna);
|
||||
@@ -4551,12 +4551,12 @@ static void view3d_sculpt_menu(bContext *C, uiLayout *layout, void *arg_unused)
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, NULL, 0, &rna, "airbrush", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "rake", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "anchored", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "space", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "airbrush", 0, 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "rake", 0, 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "anchored", 0, 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "space", 0, 0, 0);
|
||||
|
||||
uiItemR(layout, NULL, 0, &rna, "flip_direction", 0, 0);
|
||||
uiItemR(layout, NULL, 0, &rna, "flip_direction", 0, 0, 0);
|
||||
}
|
||||
|
||||
uiBlock *view3d_sculptmenu(bContext *C, ARegion *ar, void *arg_unused)
|
||||
|
||||
@@ -33,6 +33,7 @@ extern EnumPropertyItem prop_mode_items[];
|
||||
extern EnumPropertyItem space_type_items[];
|
||||
extern EnumPropertyItem region_type_items[];
|
||||
extern EnumPropertyItem modifier_type_items[];
|
||||
extern EnumPropertyItem constraint_type_items[];
|
||||
|
||||
extern EnumPropertyItem beztriple_handle_type_items[];
|
||||
extern EnumPropertyItem beztriple_interpolation_mode_items[];
|
||||
|
||||
@@ -1558,4 +1558,4 @@ void RNA_def_constraint(BlenderRNA *brna)
|
||||
rna_def_constraint_shrinkwrap(brna);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -49,7 +49,7 @@ static void rna_Object_update(bContext *C, PointerRNA *ptr)
|
||||
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
|
||||
}
|
||||
|
||||
static void rna_Object_scene_update(bContext *C, PointerRNA *ptr)
|
||||
static void rna_Object_dependency_update(bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
|
||||
DAG_scene_sort(CTX_data_scene(C));
|
||||
@@ -774,7 +774,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
|
||||
RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
|
||||
RNA_def_property_enum_items(prop, dupli_items);
|
||||
RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use.");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_scene_update");
|
||||
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
|
||||
|
||||
prop= RNA_def_property(srna, "dupli_frames_no_speed", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
|
||||
|
||||
@@ -82,7 +82,6 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
||||
RNA_def_struct_idproperties_func(srna, "rna_PoseChannel_idproperties");
|
||||
|
||||
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "constraints", NULL);
|
||||
RNA_def_property_struct_type(prop, "Constraint");
|
||||
RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel.");
|
||||
|
||||
|
||||
@@ -64,30 +64,30 @@ static void rna_def_sample(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, prop_sample_type_items);
|
||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Types", "");
|
||||
|
||||
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
|
||||
RNA_def_property_string_sdna(prop, NULL, "name");
|
||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Filename", "Full path filename of the sample");
|
||||
|
||||
prop= RNA_def_property(srna, "length", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "len");
|
||||
RNA_def_property_ui_text(prop, "Length", "The length of sample in seconds");
|
||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
prop= RNA_def_property(srna, "rate", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_ui_text(prop, "Rate", "Sample rate in kHz");
|
||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
prop= RNA_def_property(srna, "bits", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_ui_text(prop, "Bits", "Bit-depth of sample");
|
||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
prop= RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_ui_text(prop, "Channels", "Number of channels (mono=1; stereo=2)");
|
||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
}
|
||||
|
||||
static void rna_def_soundlistener(BlenderRNA *brna)
|
||||
@@ -117,12 +117,12 @@ static void rna_def_soundlistener(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "num_sounds_blender", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "numsoundsblender");
|
||||
RNA_def_property_ui_text(prop, "Total Sounds in Blender", "The total number of sounds currently linked and available.");
|
||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
prop= RNA_def_property(srna, "num_sounds_gameengine", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "numsoundsgameengine");
|
||||
RNA_def_property_ui_text(prop, "Total Sounds in Game Engine", "The total number of sounds in the Game Engine.");
|
||||
RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi
|
||||
PanelType *pt, dummypt = {0};
|
||||
Panel dummypanel= {0};
|
||||
PointerRNA dummyptr;
|
||||
int have_function[2];
|
||||
int have_function[3];
|
||||
|
||||
/* setup dummy panel & panel type to store static properties in */
|
||||
dummypanel.type= &dummypt;
|
||||
|
||||
@@ -196,6 +196,7 @@ typedef struct wmNotifier {
|
||||
#define ND_MODIFIER (23<<16)
|
||||
#define ND_KEYS (24<<16)
|
||||
#define ND_GEOM_DATA (25<<16)
|
||||
#define ND_CONSTRAINT (26<<16)
|
||||
|
||||
/* NC_MATERIAL Material */
|
||||
#define ND_SHADING (30<<16)
|
||||
|
||||
Reference in New Issue
Block a user