Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/CMakeLists.txt1
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/include/UI_interface.h14
-rw-r--r--source/blender/editors/interface/interface.c254
-rw-r--r--source/blender/editors/interface/interface_handlers.c269
-rw-r--r--source/blender/editors/interface/interface_intern.h5
-rw-r--r--source/blender/editors/interface/interface_templates.c75
-rw-r--r--source/blender/editors/interface/interface_widgets.c57
-rw-r--r--source/blender/editors/interface/resources.c17
-rw-r--r--source/blender/editors/mesh/CMakeLists.txt12
-rw-r--r--source/blender/editors/mesh/mesh_intern.h8
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c736
-rw-r--r--source/blender/editors/mesh/mesh_ops.c8
-rw-r--r--source/blender/editors/object/CMakeLists.txt5
-rw-r--r--source/blender/editors/object/object_add.c37
-rw-r--r--source/blender/editors/object/object_constraint.c9
-rw-r--r--source/blender/editors/object/object_edit.c521
-rw-r--r--source/blender/editors/object/object_intern.h8
-rw-r--r--source/blender/editors/object/object_lod.c114
-rw-r--r--source/blender/editors/object/object_ops.c14
-rw-r--r--source/blender/editors/object/object_relations.c5
-rw-r--r--source/blender/editors/object/object_select.c38
-rw-r--r--source/blender/editors/screen/screen_ops.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c10
-rw-r--r--source/blender/editors/space_api/spacetypes.c2
-rw-r--r--source/blender/editors/space_logic/CMakeLists.txt58
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c166
-rw-r--r--source/blender/editors/space_logic/logic_intern.h55
-rw-r--r--source/blender/editors/space_logic/logic_ops.c753
-rw-r--r--source/blender/editors/space_logic/logic_window.c2594
-rw-r--r--source/blender/editors/space_logic/space_logic.c377
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt7
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c191
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c33
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c219
39 files changed, 16 insertions, 6671 deletions
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 06f412b7019..619b031e27a 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -49,7 +49,6 @@ if(WITH_BLENDER)
add_subdirectory(space_graph)
add_subdirectory(space_image)
add_subdirectory(space_info)
- add_subdirectory(space_logic)
add_subdirectory(space_nla)
add_subdirectory(space_node)
add_subdirectory(space_outliner)
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 3523e27f6ba..db19bc48fb3 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -233,7 +233,6 @@ int ED_operator_sequencer_active(struct bContext *C);
int ED_operator_sequencer_active_editable(struct bContext *C);
int ED_operator_image_active(struct bContext *C);
int ED_operator_nla_active(struct bContext *C);
-int ED_operator_logic_active(struct bContext *C);
int ED_operator_info_active(struct bContext *C);
int ED_operator_console_active(struct bContext *C);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index edf15d02e73..d85c77d55fb 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -268,8 +268,6 @@ typedef enum {
UI_BTYPE_SCROLL = (18 << 9),
UI_BTYPE_BLOCK = (19 << 9),
UI_BTYPE_LABEL = (20 << 9),
- UI_BTYPE_LINK = (22 << 9),
- UI_BTYPE_INLINK = (23 << 9),
UI_BTYPE_KEY_EVENT = (24 << 9),
UI_BTYPE_HSVCUBE = (26 << 9),
UI_BTYPE_PULLDOWN = (27 << 9), /* menu (often used in headers), **_MENU /w different draw-type */
@@ -704,16 +702,6 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block, struct wmOperatorType *ot, struct IDP
uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2);
int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align);
-/* Links
- *
- * Game engine logic brick links. Non-functional currently in 2.5,
- * code to handle and draw these is disabled internally. */
-
-void UI_but_link_set(struct uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to);
-
-void UI_block_links_compose(uiBlock *block);
-uiBut *UI_block_links_find_inlink(uiBlock *block, void *poin);
-
/* use inside searchfunc to add items */
bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid);
/* bfunc gets search item *poin as arg2, or if NULL the old string */
@@ -973,8 +961,6 @@ void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char
void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int color);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
PointerRNA *used_ptr, const char *used_propname, int active_layer);
-void uiTemplateGameStates(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
- PointerRNA *used_ptr, const char *used_propname, int active_state);
void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact, int multiview);
void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management);
void uiTemplateImageStereo3d(uiLayout *layout, struct PointerRNA *stereo3d_format_ptr);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index a98d62be3ca..20eb0ce50e5 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -510,87 +510,6 @@ static int ui_but_calc_float_precision(uiBut *but, double value)
return UI_calc_float_precision(prec, value);
}
-/* ************** LINK LINE DRAWING ************* */
-
-/* link line drawing is not part of buttons or theme.. so we stick with it here */
-
-static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines, int dashInactiveLines)
-{
- rcti rect;
- float color[4] = {1.0f};
-
- if (line->from == NULL || line->to == NULL) return;
-
- rect.xmin = BLI_rctf_cent_x(&line->from->rect);
- rect.ymin = BLI_rctf_cent_y(&line->from->rect);
- rect.xmax = BLI_rctf_cent_x(&line->to->rect);
- rect.ymax = BLI_rctf_cent_y(&line->to->rect);
-
- if (dashInactiveLines)
- UI_GetThemeColor4fv(TH_GRID, color);
- else if (line->flag & UI_SELECT)
- rgba_float_args_set_ch(color, 100, 100, 100, 255);
- else if (highlightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)))
- UI_GetThemeColor4fv(TH_TEXT_HI, color);
- else
- rgba_float_args_set_ch(color, 0, 0, 0, 255);
-
- ui_draw_link_bezier(&rect, color);
-}
-
-static void ui_draw_links(uiBlock *block)
-{
- uiBut *but;
- uiLinkLine *line;
-
- /* Draw the gray out lines. Do this first so they appear at the
- * bottom of inactive or active lines.
- * As we go, remember if we see any active or selected lines. */
- bool found_selectline = false;
- bool found_activeline = false;
-
- for (but = block->buttons.first; but; but = but->next) {
- if (but->type == UI_BTYPE_LINK && but->link) {
- for (line = but->link->lines.first; line; line = line->next) {
- if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE)) {
- if (line->deactive)
- ui_draw_linkline(line, 0, true);
- }
- else
- found_activeline = true;
-
- if ((line->from->flag & UI_SELECT) || (line->to->flag & UI_SELECT))
- found_selectline = true;
- }
- }
- }
-
- /* Draw the inactive lines (lines with neither button being hovered over) */
- for (but = block->buttons.first; but; but = but->next) {
- if (but->type == UI_BTYPE_LINK && but->link) {
- for (line = but->link->lines.first; line; line = line->next) {
- if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE)) {
- if (!line->deactive)
- ui_draw_linkline(line, 0, false);
- }
- }
- }
- }
-
- /* Draw any active lines (lines with either button being hovered over).
- * Do this last so they appear on top of inactive and gray out lines. */
- if (found_activeline) {
- for (but = block->buttons.first; but; but = but->next) {
- if (but->type == UI_BTYPE_LINK && but->link) {
- for (line = but->link->lines.first; line; line = line->next) {
- if ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE))
- ui_draw_linkline(line, !found_selectline, false);
- }
- }
- }
- }
-}
-
/* ************** BLOCK ENDING FUNCTION ************* */
/* NOTE: if but->poin is allocated memory for every defbut, things fail... */
@@ -633,38 +552,6 @@ uiBut *ui_but_find_new(uiBlock *block_new, const uiBut *but_old)
return but_new;
}
-/* oldbut is being inserted in new block, so we use the lines from new button, and replace button pointers */
-static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut)
-{
- uiLinkLine *line;
- uiBut *but;
-
- /* if active button is UI_BTYPE_LINK */
- if (newbut->type == UI_BTYPE_LINK && newbut->link) {
-
- SWAP(uiLink *, oldbut->link, newbut->link);
-
- for (line = oldbut->link->lines.first; line; line = line->next) {
- if (line->to == newbut)
- line->to = oldbut;
- if (line->from == newbut)
- line->from = oldbut;
- }
- }
-
- /* check all other button links */
- for (but = block->buttons.first; but; but = but->next) {
- if (but != newbut && but->type == UI_BTYPE_LINK && but->link) {
- for (line = but->link->lines.first; line; line = line->next) {
- if (line->to == newbut)
- line->to = oldbut;
- if (line->from == newbut)
- line->from = oldbut;
- }
- }
- }
-}
-
/**
* \return true when \a but_p is set (only done for active buttons).
*/
@@ -764,8 +651,6 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu
oldbut->a1 = but->a1;
}
- ui_but_update_linklines(block, oldbut, but);
-
if (!BLI_listbase_is_empty(&block->butstore)) {
UI_butstore_register_update(block, oldbut, but);
}
@@ -1453,8 +1338,6 @@ void UI_block_draw(const bContext *C, uiBlock *block)
/* restore matrix */
gpuPopProjectionMatrix();
gpuPopMatrix();
-
- ui_draw_links(block);
}
static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlock *block)
@@ -1573,83 +1456,6 @@ static void ui_but_update_select_flag(uiBut *but, double *value)
}
}
-static uiBut *ui_linkline_find_inlink(uiBlock *block, void *poin)
-{
- uiBut *but;
-
- but = block->buttons.first;
- while (but) {
- if (but->type == UI_BTYPE_INLINK) {
- if (but->poin == poin) return but;
- }
- but = but->next;
- }
- return NULL;
-}
-
-static void ui_linkline_add(ListBase *listb, uiBut *but, uiBut *bt, short deactive)
-{
- uiLinkLine *line;
-
- line = MEM_callocN(sizeof(uiLinkLine), "linkline");
- BLI_addtail(listb, line);
- line->from = but;
- line->to = bt;
- line->deactive = deactive;
-}
-
-uiBut *UI_block_links_find_inlink(uiBlock *block, void *poin)
-{
- return ui_linkline_find_inlink(block, poin);
-}
-
-void UI_block_links_compose(uiBlock *block)
-{
- uiBut *but, *bt;
- uiLink *link;
- void ***ppoin;
- int a;
-
- but = block->buttons.first;
- while (but) {
- if (but->type == UI_BTYPE_LINK) {
- link = but->link;
-
- /* for all pointers in the array */
- if (link) {
- if (link->ppoin) {
- ppoin = link->ppoin;
- for (a = 0; a < *(link->totlink); a++) {
- bt = ui_linkline_find_inlink(block, (*ppoin)[a]);
- if (bt) {
- if ((but->flag & UI_BUT_SCA_LINK_GREY) || (bt->flag & UI_BUT_SCA_LINK_GREY)) {
- ui_linkline_add(&link->lines, but, bt, true);
- }
- else {
- ui_linkline_add(&link->lines, but, bt, false);
- }
-
- }
- }
- }
- else if (link->poin) {
- bt = ui_linkline_find_inlink(block, *link->poin);
- if (bt) {
- if ((but->flag & UI_BUT_SCA_LINK_GREY) || (bt->flag & UI_BUT_SCA_LINK_GREY)) {
- ui_linkline_add(&link->lines, but, bt, true);
- }
- else {
- ui_linkline_add(&link->lines, but, bt, false);
- }
- }
- }
- }
- }
- but = but->next;
- }
-}
-
-
/* ************************************************ */
void UI_block_lock_set(uiBlock *block, bool val, const char *lockstr)
@@ -1666,44 +1472,6 @@ void UI_block_lock_clear(uiBlock *block)
block->lockstr = NULL;
}
-/* *************************************************************** */
-
-void ui_linkline_remove(uiLinkLine *line, uiBut *but)
-{
- uiLink *link;
- int a, b;
-
- BLI_remlink(&but->link->lines, line);
-
- link = line->from->link;
-
- /* are there more pointers allowed? */
- if (link->ppoin) {
-
- if (*(link->totlink) == 1) {
- *(link->totlink) = 0;
- MEM_freeN(*(link->ppoin));
- *(link->ppoin) = NULL;
- }
- else {
- b = 0;
- for (a = 0; a < (*(link->totlink)); a++) {
- if ((*(link->ppoin))[a] != line->to->poin) {
- (*(link->ppoin))[b] = (*(link->ppoin))[a];
- b++;
- }
- }
- (*(link->totlink))--;
- }
- }
- else {
- *(link->poin) = NULL;
- }
-
- MEM_freeN(line);
- //REDRAW
-}
-
/* *********************** data get/set ***********************
* this either works with the pointed to data, or can work with
* an edit override pointer while dragging for example */
@@ -2788,14 +2556,6 @@ static void ui_set_but_soft_range(uiBut *but)
/* ******************* Free ********************/
-static void ui_free_link(uiLink *link)
-{
- if (link) {
- BLI_freelistN(&link->lines);
- MEM_freeN(link);
- }
-}
-
/* can be called with C==NULL */
static void ui_but_free(const bContext *C, uiBut *but)
{
@@ -2836,7 +2596,6 @@ static void ui_but_free(const bContext *C, uiBut *but)
if (but->str && but->str != but->strdata) {
MEM_freeN(but->str);
}
- ui_free_link(but->link);
if ((but->type == UI_BTYPE_IMAGE) && but->poin) {
IMB_freeImBuf((struct ImBuf *)but->poin);
@@ -4113,19 +3872,6 @@ uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcon
/* END Button containing both string label and icon */
-void UI_but_link_set(uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to)
-{
- uiLink *link;
-
- link = but->link = MEM_callocN(sizeof(uiLink), "new uilink");
-
- link->poin = poin;
- link->ppoin = ppoin;
- link->totlink = tot;
- link->fromcode = from;
- link->tocode = to;
-}
-
/* cruft to make uiBlock and uiBut private */
int UI_blocklist_min_y_get(ListBase *lb)
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 11f78967315..63fe440b36c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -39,9 +39,6 @@
#include "MEM_guardedalloc.h"
#include "DNA_brush_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_controller_types.h"
-#include "DNA_actuator_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -117,8 +114,6 @@
#define USE_KEYMAP_ADD_HACK
/* proto */
-static void ui_but_smart_controller_add(bContext *C, uiBut *from, uiBut *to);
-static void ui_but_link_add(bContext *C, uiBut *from, uiBut *to);
static int ui_do_but_EXIT(bContext *C, uiBut *but, struct uiHandleButtonData *data, const wmEvent *event);
static bool ui_but_find_select_in_enum__cmp(const uiBut *but_a, const uiBut *but_b);
static void ui_textedit_string_set(uiBut *but, struct uiHandleButtonData *data, const char *str);
@@ -724,8 +719,7 @@ static void ui_apply_but_undo(uiBut *but)
const char *str = NULL;
/* define which string to use for undo */
- if (ELEM(but->type, UI_BTYPE_LINK, UI_BTYPE_INLINK)) str = "Add button link";
- else if (but->type == UI_BTYPE_MENU) str = but->drawstr;
+ if (but->type == UI_BTYPE_MENU) str = but->drawstr;
else if (but->drawstr[0]) str = but->drawstr;
else str = but->tip;
@@ -1782,223 +1776,6 @@ static bool ui_but_drag_init(
/* ********************** linklines *********************** */
-static void ui_linkline_remove_active(uiBlock *block)
-{
- uiBut *but;
- uiLink *link;
- uiLinkLine *line, *nline;
- int a, b;
-
- for (but = block->buttons.first; but; but = but->next) {
- if (but->type == UI_BTYPE_LINK && but->link) {
- for (line = but->link->lines.first; line; line = nline) {
- nline = line->next;
-
- if (line->flag & UI_SELECT) {
- BLI_remlink(&but->link->lines, line);
-
- link = line->from->link;
-
- /* are there more pointers allowed? */
- if (link->ppoin) {
-
- if (*(link->totlink) == 1) {
- *(link->totlink) = 0;
- MEM_freeN(*(link->ppoin));
- *(link->ppoin) = NULL;
- }
- else {
- b = 0;
- for (a = 0; a < (*(link->totlink)); a++) {
-
- if ((*(link->ppoin))[a] != line->to->poin) {
- (*(link->ppoin))[b] = (*(link->ppoin))[a];
- b++;
- }
- }
- (*(link->totlink))--;
- }
- }
- else {
- *(link->poin) = NULL;
- }
-
- MEM_freeN(line);
- }
- }
- }
- }
-}
-
-
-static uiLinkLine *ui_but_find_link(uiBut *from, uiBut *to)
-{
- uiLinkLine *line;
- uiLink *link;
-
- link = from->link;
- if (link) {
- for (line = link->lines.first; line; line = line->next) {
- if (line->from == from && line->to == to) {
- return line;
- }
- }
- }
- return NULL;
-}
-
-/* XXX BAD BAD HACK, fixme later **************** */
-/* Try to add an AND Controller between the sensor and the actuator logic bricks and to connect them all */
-static void ui_but_smart_controller_add(bContext *C, uiBut *from, uiBut *to)
-{
- Object *ob = NULL;
- bSensor *sens_iter;
- bActuator *act_to, *act_iter;
- bController *cont;
- bController ***sens_from_links;
- uiBut *tmp_but;
-
- uiLink *link = from->link;
-
- PointerRNA props_ptr, object_ptr;
-
- if (link->ppoin)
- sens_from_links = (bController ***)(link->ppoin);
- else return;
-
- act_to = (bActuator *)(to->poin);
-
- /* (1) get the object */
- CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects)
- {
- for (sens_iter = ob_iter->sensors.first; sens_iter; sens_iter = sens_iter->next) {
- if (&(sens_iter->links) == sens_from_links) {
- ob = ob_iter;
- break;
- }
- }
- if (ob) break;
- } CTX_DATA_END;
-
- if (!ob) return;
-
- /* (2) check if the sensor and the actuator are from the same object */
- for (act_iter = ob->actuators.first; act_iter; act_iter = (bActuator *)act_iter->next) {
- if (act_iter == act_to)
- break;
- }
-
- /* only works if the sensor and the actuator are from the same object */
- if (!act_iter) return;
-
- /* in case the linked controller is not the active one */
- RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
-
- WM_operator_properties_create(&props_ptr, "LOGIC_OT_controller_add");
- RNA_string_set(&props_ptr, "object", ob->id.name + 2);
-
- /* (3) add a new controller */
- if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, &props_ptr) & OPERATOR_FINISHED) {
- cont = (bController *)ob->controllers.last;
- /* Quick fix to make sure we always have an AND controller.
- * It might be nicer to make sure the operator gives us the right one though... */
- cont->type = CONT_LOGIC_AND;
-
- /* (4) link the sensor->controller->actuator */
- tmp_but = MEM_callocN(sizeof(uiBut), "uiBut");
- UI_but_link_set(
- tmp_but, (void **)&cont, (void ***)&(cont->links),
- &cont->totlinks, from->link->tocode, (int)to->hardmin);
- tmp_but->hardmin = from->link->tocode;
- tmp_but->poin = (char *)cont;
-
- tmp_but->type = UI_BTYPE_INLINK;
- ui_but_link_add(C, from, tmp_but);
-
- tmp_but->type = UI_BTYPE_LINK;
- ui_but_link_add(C, tmp_but, to);
-
- /* (5) garbage collection */
- MEM_freeN(tmp_but->link);
- MEM_freeN(tmp_but);
- }
- WM_operator_properties_free(&props_ptr);
-}
-
-static void ui_but_link_add(bContext *C, uiBut *from, uiBut *to)
-{
- /* in 'from' we have to add a link to 'to' */
- uiLink *link;
- uiLinkLine *line;
- void **oldppoin;
- int a;
-
- if ((line = ui_but_find_link(from, to))) {
- line->flag |= UI_SELECT;
- ui_linkline_remove_active(from->block);
- return;
- }
-
- if (from->type == UI_BTYPE_INLINK && to->type == UI_BTYPE_INLINK) {
- return;
- }
- else if (from->type == UI_BTYPE_LINK && to->type == UI_BTYPE_INLINK) {
- if (from->link->tocode != (int)to->hardmin) {
- ui_but_smart_controller_add(C, from, to);
- return;
- }
- }
- else if (from->type == UI_BTYPE_INLINK && to->type == UI_BTYPE_LINK) {
- if (to->link->tocode == (int)from->hardmin) {
- return;
- }
- }
-
- link = from->link;
-
- /* are there more pointers allowed? */
- if (link->ppoin) {
- oldppoin = *(link->ppoin);
-
- (*(link->totlink))++;
- *(link->ppoin) = MEM_callocN(*(link->totlink) * sizeof(void *), "new link");
-
- for (a = 0; a < (*(link->totlink)) - 1; a++) {
- (*(link->ppoin))[a] = oldppoin[a];
- }
- (*(link->ppoin))[a] = to->poin;
-
- if (oldppoin) MEM_freeN(oldppoin);
- }
- else {
- *(link->poin) = to->poin;
- }
-
-}
-
-
-static void ui_apply_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data)
-{
- ARegion *ar = CTX_wm_region(C);
- uiBut *bt;
-
- for (bt = but->block->buttons.first; bt; bt = bt->next) {
- if (ui_but_contains_point_px(ar, bt, but->linkto[0] + ar->winrct.xmin, but->linkto[1] + ar->winrct.ymin) )
- break;
- }
- if (bt && bt != but) {
- if (!ELEM(bt->type, UI_BTYPE_LINK, UI_BTYPE_INLINK) || !ELEM(but->type, UI_BTYPE_LINK, UI_BTYPE_INLINK))
- return;
-
- if (but->type == UI_BTYPE_LINK) ui_but_link_add(C, but, bt);
- else ui_but_link_add(C, bt, but);
-
- ui_apply_but_func(C, but);
- data->retval = but->retval;
- }
- data->applied = true;
-}
-
static void ui_apply_but_IMAGE(bContext *C, uiBut *but, uiHandleButtonData *data)
{
ui_apply_but_func(C, but);
@@ -2153,10 +1930,6 @@ static void ui_apply_but(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
case UI_BTYPE_HOTKEY_EVENT:
ui_apply_but_BUT(C, but, data);
break;
- case UI_BTYPE_LINK:
- case UI_BTYPE_INLINK:
- ui_apply_but_LINK(C, but, data);
- break;
case UI_BTYPE_IMAGE:
ui_apply_but_IMAGE(C, but, data);
break;
@@ -6445,35 +6218,6 @@ static int ui_do_but_WAVEFORM(
return WM_UI_HANDLER_CONTINUE;
}
-static int ui_do_but_LINK(
- bContext *C, uiBut *but,
- uiHandleButtonData *data, const wmEvent *event)
-{
- VECCOPY2D(but->linkto, event->mval);
-
- if (data->state == BUTTON_STATE_HIGHLIGHT) {
- if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
- button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
- return WM_UI_HANDLER_BREAK;
- }
- else if (event->type == LEFTMOUSE && but->block->handle) {
- button_activate_state(C, but, BUTTON_STATE_EXIT);
- return WM_UI_HANDLER_BREAK;
- }
- }
- else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
-
- if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
- if (!(but->flag & UI_SELECT))
- data->cancel = true;
- button_activate_state(C, but, BUTTON_STATE_EXIT);
- return WM_UI_HANDLER_BREAK;
- }
- }
-
- return WM_UI_HANDLER_CONTINUE;
-}
-
static bool ui_numedit_but_TRACKPREVIEW(
bContext *C, uiBut *but, uiHandleButtonData *data,
int mx, int my,
@@ -7289,10 +7033,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
case UI_BTYPE_HSVCIRCLE:
retval = ui_do_but_HSVCIRCLE(C, block, but, data, event);
break;
- case UI_BTYPE_LINK:
- case UI_BTYPE_INLINK:
- retval = ui_do_but_LINK(C, but, data, event);
- break;
case UI_BTYPE_TRACK_PREVIEW:
retval = ui_do_but_TRACKPREVIEW(C, block, but, data, event);
break;
@@ -8520,12 +8260,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
break;
}
case MOUSEMOVE:
- if (ELEM(but->type, UI_BTYPE_LINK, UI_BTYPE_INLINK)) {
- but->flag |= UI_SELECT;
- ui_do_button(C, block, but, event);
- ED_region_tag_redraw(ar);
- }
- else {
+ {
/* deselect the button when moving the mouse away */
/* also de-activate for buttons that only show higlights */
if (ui_but_contains_point_px(ar, but, event->x, event->y)) {
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index bb9bfdd4429..0d2a8da265d 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -270,9 +270,6 @@ struct uiBut {
uiButHandleHoldFunc hold_func;
void *hold_argN;
- uiLink *link;
- short linkto[2]; /* region relative coords */
-
const char *tip;
uiButToolTipFunc tip_func;
void *tip_argN;
@@ -451,8 +448,6 @@ typedef struct uiSafetyRct {
/* interface.c */
-extern void ui_linkline_remove(uiLinkLine *line, uiBut *but);
-
void ui_fontscale(short *points, float aspect);
extern bool ui_block_is_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 375027a84d0..ae2b8c8060c 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -70,7 +70,6 @@
#include "BKE_particle.h"
#include "BKE_paint.h"
#include "BKE_report.h"
-#include "BKE_sca.h"
#include "BKE_screen.h"
#include "DEG_depsgraph.h"
@@ -1316,8 +1315,7 @@ static uiLayout *draw_modifier(
UI_block_emboss_set(block, UI_EMBOSS_NONE);
/* When Modifier is a simulation, show button to switch to context rather than the delete button. */
if (modifier_can_delete(md) &&
- (!modifier_is_simulation(md) ||
- STREQ(scene->view_render.engine_id, RE_engine_id_BLENDER_GAME)))
+ !modifier_is_simulation(md))
{
uiItemO(row, "", ICON_X, "OBJECT_OT_modifier_remove");
}
@@ -2927,77 +2925,6 @@ void uiTemplateLayers(
}
}
-void uiTemplateGameStates(
- uiLayout *layout, PointerRNA *ptr, const char *propname,
- PointerRNA *used_ptr, const char *used_propname, int active_state)
-{
- uiLayout *uRow, *uCol;
- PropertyRNA *prop, *used_prop = NULL;
- int groups, cols, states;
- int group, col, state, row;
- int cols_per_group = 5;
- Object *ob = (Object *)ptr->id.data;
-
- prop = RNA_struct_find_property(ptr, propname);
- if (!prop) {
- RNA_warning("states property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
-
- /* the number of states determines the way we group them
- * - we want 2 rows only (for now)
- * - the number of columns (cols) is the total number of buttons per row
- * the 'remainder' is added to this, as it will be ok to have first row slightly wider if need be
- * - for now, only split into groups if group will have at least 5 items
- */
- states = RNA_property_array_length(ptr, prop);
- cols = (states / 2) + (states % 2);
- groups = ((cols / 2) < cols_per_group) ? (1) : (cols / cols_per_group);
-
- if (used_ptr && used_propname) {
- used_prop = RNA_struct_find_property(used_ptr, used_propname);
- if (!used_prop) {
- RNA_warning("used layers property not found: %s.%s", RNA_struct_identifier(ptr->type), used_propname);
- return;
- }
-
- if (RNA_property_array_length(used_ptr, used_prop) < states)
- used_prop = NULL;
- }
-
- /* layers are laid out going across rows, with the columns being divided into groups */
-
- for (group = 0; group < groups; group++) {
- uCol = uiLayoutColumn(layout, true);
-
- for (row = 0; row < 2; row++) {
- uiBlock *block;
- uiBut *but;
-
- uRow = uiLayoutRow(uCol, true);
- block = uiLayoutGetBlock(uRow);
- state = groups * cols_per_group * row + cols_per_group * group;
-
- /* add layers as toggle buts */
- for (col = 0; (col < cols_per_group) && (state < states); col++, state++) {
- int icon = 0;
- int butlay = 1 << state;
-
- if (active_state & butlay)
- icon = ICON_LAYER_ACTIVE;
- else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, state))
- icon = ICON_LAYER_USED;
-
- but = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop,
- state, 0, 0, -1, -1, sca_state_name_get(ob, state));
- UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(state));
- but->type = UI_BTYPE_TOGGLE;
- }
- }
- }
-}
-
-
/************************* List Template **************************/
static void uilist_draw_item_default(
struct uiList *ui_list, struct bContext *UNUSED(C), struct uiLayout *layout,
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index d72e59beb91..71eb764918d 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3177,36 +3177,6 @@ bool ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol)
return true;
}
-#define LINK_RESOL 24
-void ui_draw_link_bezier(const rcti *rect, const float color[4])
-{
- float coord_array[LINK_RESOL + 1][2];
-
- if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
- unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
- immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
-
-#if 0 /* unused */
- /* we can reuse the dist variable here to increment the GL curve eval amount*/
- const float dist = 1.0f / (float)LINK_RESOL;
-#endif
- glEnable(GL_BLEND);
- glEnable(GL_LINE_SMOOTH);
-
- immUniformColor4fv(color);
-
- immBegin(GWN_PRIM_LINE_STRIP, LINK_RESOL + 1);
- for (int i = 0; i <= LINK_RESOL; ++i)
- immVertex2fv(pos, coord_array[i]);
- immEnd();
-
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
-
- immUnbindProgram();
- }
-}
-
/* function in use for buttons and for view2d sliders */
void UI_draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *slider, int state)
{
@@ -3380,24 +3350,6 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
rect->xmax += (BLI_rcti_size_x(&rect_prog) / 2);
}
-static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
-{
-
- if (but->flag & UI_SELECT) {
- rcti rectlink;
- float color[4];
-
- UI_GetThemeColor4fv(TH_TEXT_HI, color);
-
- rectlink.xmin = BLI_rcti_cent_x(rect);
- rectlink.ymin = BLI_rcti_cent_y(rect);
- rectlink.xmax = but->linkto[0];
- rectlink.ymax = but->linkto[1];
-
- ui_draw_link_bezier(&rectlink, color);
- }
-}
-
static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
uiWidgetBase wtb, wtb1;
@@ -4342,14 +4294,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case UI_BTYPE_LISTBOX:
wt = widget_type(UI_WTYPE_BOX);
break;
-
- case UI_BTYPE_LINK:
- case UI_BTYPE_INLINK:
- wt = widget_type(UI_WTYPE_ICON);
- wt->custom = widget_link;
-
- break;
-
+
case UI_BTYPE_EXTRA:
widget_draw_extra_mask(C, but, widget_type(UI_WTYPE_BOX), rect);
break;
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index de9469a48cb..d13b7e8ea74 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -162,9 +162,6 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case SPACE_NODE:
ts = &btheme->tnode;
break;
- case SPACE_LOGIC:
- ts = &btheme->tlogic;
- break;
case SPACE_CLIP:
ts = &btheme->tclip;
break;
@@ -1210,10 +1207,6 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tnode.console_output, 223, 202, 53, 255); /* interface nodes */
btheme->tnode.noodle_curving = 5;
- /* space logic */
- btheme->tlogic = btheme->tv3d;
- rgba_char_args_set(btheme->tlogic.back, 100, 100, 100, 255);
-
/* space clip */
btheme->tclip = btheme->tv3d;
@@ -2104,13 +2097,6 @@ void init_userdef_do_versions(void)
if (btheme->tui.wcol_num.outline[3] == 0)
ui_widget_color_init(&btheme->tui);
-
- /* Logic editor theme, check for alpha==0 is safe, then color was never set */
- if (btheme->tlogic.syntaxn[3] == 0) {
- /* re-uses syntax color storage */
- btheme->tlogic = btheme->tv3d;
- rgba_char_args_set(btheme->tlogic.back, 100, 100, 100, 255);
- }
rgba_char_args_set_fl(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
rgba_char_args_set_fl(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
@@ -2924,9 +2910,6 @@ void init_userdef_do_versions(void)
U.transopts &= ~(
USER_TR_DEPRECATED_2 | USER_TR_DEPRECATED_3 | USER_TR_DEPRECATED_4 |
USER_TR_DEPRECATED_6 | USER_TR_DEPRECATED_7);
- U.gameflags &= ~(
- USER_GL_RENDER_DEPRECATED_0 | USER_GL_RENDER_DEPRECATED_1 |
- USER_GL_RENDER_DEPRECATED_3 | USER_GL_RENDER_DEPRECATED_4);
U.uiflag |= USER_LOCK_CURSOR_ADJUST;
}
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index eae6b7192d7..91656bf6bd0 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -68,18 +68,6 @@ set(SRC
mesh_intern.h
)
-if(WITH_GAMEENGINE)
- add_definitions(-DWITH_GAMEENGINE)
-
- list(APPEND INC
- ../../../../extern/recastnavigation
- )
-
- list(APPEND SRC
- mesh_navmesh.c
- )
-endif()
-
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 99342222d52..788887e872a 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -254,12 +254,4 @@ void MESH_OT_customdata_custom_splitnormals_clear(struct wmOperatorType *ot);
void MESH_OT_drop_named_image(struct wmOperatorType *ot);
-/* *** mesh_navmesh.c *** */
-void MESH_OT_navmesh_make(struct wmOperatorType *ot);
-void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot);
-void MESH_OT_navmesh_face_add(struct wmOperatorType *ot);
-void MESH_OT_navmesh_reset(struct wmOperatorType *ot);
-void MESH_OT_navmesh_clear(struct wmOperatorType *ot);
-
-
#endif /* __MESH_INTERN_H__ */
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
deleted file mode 100644
index c94015de0f6..00000000000
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ /dev/null
@@ -1,736 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2011 by Blender Foundation
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Benoit Bolsee,
- * Nick Samarin
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/mesh/mesh_navmesh.c
- * \ingroup edmesh
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-
-#include "BLI_listbase.h"
-#include "BLI_math_vector.h"
-#include "BLI_linklist.h"
-
-#include "BKE_layer.h"
-#include "BKE_library.h"
-#include "BKE_context.h"
-#include "BKE_mesh.h"
-#include "BKE_scene.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_report.h"
-#include "BKE_editmesh.h"
-
-#include "ED_object.h"
-#include "ED_mesh.h"
-#include "ED_screen.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "recast-capi.h"
-
-#include "DEG_depsgraph.h"
-
-#include "mesh_intern.h" /* own include */
-
-
-static void createVertsTrisData(bContext *C, LinkNode *obs,
- int *nverts_r, float **verts_r, int *ntris_r, int **tris_r, unsigned int *r_lay)
-{
- MVert *mvert;
- int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces;
- MFace *mface;
- float co[3], wco[3];
- Object *ob;
- LinkNode *oblink, *dmlink;
- DerivedMesh *dm;
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
- Scene *scene = CTX_data_scene(C);
- LinkNodePair dms_pair = {NULL, NULL};
-
- int nverts, ntris, *tris;
- float *verts;
-
- nverts = 0;
- ntris = 0;
-
- /* calculate number of verts and tris */
- for (oblink = obs; oblink; oblink = oblink->next) {
- ob = (Object *) oblink->link;
- dm = mesh_create_derived_no_virtual(depsgraph, scene, ob, NULL, CD_MASK_MESH);
- DM_ensure_tessface(dm);
- BLI_linklist_append(&dms_pair, dm);
-
- nverts += dm->getNumVerts(dm);
- nfaces = dm->getNumTessFaces(dm);
- ntris += nfaces;
-
- /* resolve quad faces */
- mface = dm->getTessFaceArray(dm);
- for (i = 0; i < nfaces; i++) {
- MFace *mf = &mface[i];
- if (mf->v4)
- ntris += 1;
- }
-
- *r_lay |= ob->lay;
- }
- LinkNode *dms = dms_pair.list;
-
- /* create data */
- verts = MEM_mallocN(sizeof(float) * 3 * nverts, "createVertsTrisData verts");
- tris = MEM_mallocN(sizeof(int) * 3 * ntris, "createVertsTrisData faces");
-
- basenverts = 0;
- tri = tris;
- for (oblink = obs, dmlink = dms; oblink && dmlink;
- oblink = oblink->next, dmlink = dmlink->next)
- {
- ob = (Object *) oblink->link;
- dm = (DerivedMesh *) dmlink->link;
-
- curnverts = dm->getNumVerts(dm);
- mvert = dm->getVertArray(dm);
-
- /* copy verts */
- for (i = 0; i < curnverts; i++) {
- MVert *v = &mvert[i];
-
- copy_v3_v3(co, v->co);
- mul_v3_m4v3(wco, ob->obmat, co);
-
- verts[3 * (basenverts + i) + 0] = wco[0];
- verts[3 * (basenverts + i) + 1] = wco[2];
- verts[3 * (basenverts + i) + 2] = wco[1];
- }
-
- /* create tris */
- curnfaces = dm->getNumTessFaces(dm);
- mface = dm->getTessFaceArray(dm);
-
- for (i = 0; i < curnfaces; i++) {
- MFace *mf = &mface[i];
-
- tri[0] = basenverts + mf->v1;
- tri[1] = basenverts + mf->v3;
- tri[2] = basenverts + mf->v2;
- tri += 3;
-
- if (mf->v4) {
- tri[0] = basenverts + mf->v1;
- tri[1] = basenverts + mf->v4;
- tri[2] = basenverts + mf->v3;
- tri += 3;
- }
- }
-
- basenverts += curnverts;
- }
-
- /* release derived mesh */
- for (dmlink = dms; dmlink; dmlink = dmlink->next) {
- dm = (DerivedMesh *) dmlink->link;
- dm->release(dm);
- }
-
- BLI_linklist_free(dms, NULL);
-
- *nverts_r = nverts;
- *verts_r = verts;
- *ntris_r = ntris;
- *tris_r = tris;
-}
-
-static bool buildNavMesh(const RecastData *recastParams, int nverts, float *verts, int ntris, int *tris,
- struct recast_polyMesh **pmesh, struct recast_polyMeshDetail **dmesh,
- ReportList *reports)
-{
- float bmin[3], bmax[3];
- struct recast_heightfield *solid;
- unsigned char *triflags;
- struct recast_compactHeightfield *chf;
- struct recast_contourSet *cset;
- int width, height, walkableHeight, walkableClimb, walkableRadius;
- int minRegionArea, mergeRegionArea, maxEdgeLen;
- float detailSampleDist, detailSampleMaxError;
-
- recast_calcBounds(verts, nverts, bmin, bmax);
-
- /* ** Step 1. Initialize build config ** */
- walkableHeight = (int)ceilf(recastParams->agentheight / recastParams->cellheight);
- walkableClimb = (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight);
- walkableRadius = (int)ceilf(recastParams->agentradius / recastParams->cellsize);
- minRegionArea = (int)(recastParams->regionminsize * recastParams->regionminsize);
- mergeRegionArea = (int)(recastParams->regionmergesize * recastParams->regionmergesize);
- maxEdgeLen = (int)(recastParams->edgemaxlen / recastParams->cellsize);
- detailSampleDist = recastParams->detailsampledist < 0.9f ? 0 :
- recastParams->cellsize * recastParams->detailsampledist;
- detailSampleMaxError = recastParams->cellheight * recastParams->detailsamplemaxerror;
-
- /* Set the area where the navigation will be build. */
- recast_calcGridSize(bmin, bmax, recastParams->cellsize, &width, &height);
-
- /* zero dimensions cause zero alloc later on [#33758] */
- if (width <= 0 || height <= 0) {
- BKE_report(reports, RPT_ERROR, "Object has a width or height of zero");
- return false;
- }
-
- /* ** Step 2: Rasterize input polygon soup ** */
- /* Allocate voxel heightfield where we rasterize our input data to */
- solid = recast_newHeightfield();
-
- if (!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) {
- recast_destroyHeightfield(solid);
- BKE_report(reports, RPT_ERROR, "Failed to create height field");
- return false;
- }
-
- /* Allocate array that can hold triangle flags */
- triflags = MEM_callocN(sizeof(unsigned char) * ntris, "buildNavMesh triflags");
-
- /* Find triangles which are walkable based on their slope and rasterize them */
- recast_markWalkableTriangles(RAD2DEGF(recastParams->agentmaxslope), verts, nverts, tris, ntris, triflags);
- recast_rasterizeTriangles(verts, nverts, tris, triflags, ntris, solid, 1);
- MEM_freeN(triflags);
-
- /* ** Step 3: Filter walkables surfaces ** */
- recast_filterLowHangingWalkableObstacles(walkableClimb, solid);
- recast_filterLedgeSpans(walkableHeight, walkableClimb, solid);
- recast_filterWalkableLowHeightSpans(walkableHeight, solid);
-
- /* ** Step 4: Partition walkable surface to simple regions ** */
-
- chf = recast_newCompactHeightfield();
- if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) {
- recast_destroyHeightfield(solid);
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to create compact height field");
- return false;
- }
-
- recast_destroyHeightfield(solid);
- solid = NULL;
-
- if (!recast_erodeWalkableArea(walkableRadius, chf)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to erode walkable area");
- return false;
- }
-
- if (recastParams->partitioning == RC_PARTITION_WATERSHED) {
- /* Prepare for region partitioning, by calculating distance field along the walkable surface */
- if (!recast_buildDistanceField(chf)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to build distance field");
- return false;
- }
-
- /* Partition the walkable surface into simple regions without holes */
- if (!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to build watershed regions");
- return false;
- }
- }
- else if (recastParams->partitioning == RC_PARTITION_MONOTONE) {
- /* Partition the walkable surface into simple regions without holes */
- /* Monotone partitioning does not need distancefield. */
- if (!recast_buildRegionsMonotone(chf, 0, minRegionArea, mergeRegionArea)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to build monotone regions");
- return false;
- }
- }
- else { /* RC_PARTITION_LAYERS */
- /* Partition the walkable surface into simple regions without holes */
- if (!recast_buildLayerRegions(chf, 0, minRegionArea)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to build layer regions");
- return false;
- }
- }
-
- /* ** Step 5: Trace and simplify region contours ** */
- /* Create contours */
- cset = recast_newContourSet();
-
- if (!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset, RECAST_CONTOUR_TESS_WALL_EDGES)) {
- recast_destroyCompactHeightfield(chf);
- recast_destroyContourSet(cset);
-
- BKE_report(reports, RPT_ERROR, "Failed to build contours");
- return false;
- }
-
- /* ** Step 6: Build polygons mesh from contours ** */
- *pmesh = recast_newPolyMesh();
- if (!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) {
- recast_destroyCompactHeightfield(chf);
- recast_destroyContourSet(cset);
- recast_destroyPolyMesh(*pmesh);
-
- BKE_report(reports, RPT_ERROR, "Failed to build poly mesh");
- return false;
- }
-
-
- /* ** Step 7: Create detail mesh which allows to access approximate height on each polygon ** */
-
- *dmesh = recast_newPolyMeshDetail();
- if (!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) {
- recast_destroyCompactHeightfield(chf);
- recast_destroyContourSet(cset);
- recast_destroyPolyMesh(*pmesh);
- recast_destroyPolyMeshDetail(*dmesh);
-
- BKE_report(reports, RPT_ERROR, "Failed to build poly mesh detail");
- return false;
- }
-
- recast_destroyCompactHeightfield(chf);
- recast_destroyContourSet(cset);
-
- return true;
-}
-
-static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh,
- Base *base, unsigned int lay)
-{
- float co[3], rot[3];
- BMEditMesh *em;
- int i, j, k;
- unsigned short *v;
- int face[3];
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *obedit;
- int createob = base == NULL;
- int nverts, nmeshes, nvp;
- unsigned short *verts, *polys;
- unsigned int *meshes;
- float bmin[3], cs, ch, *dverts;
- unsigned char *tris;
-
- zero_v3(co);
- zero_v3(rot);
-
- if (createob) {
- /* create new object */
- obedit = ED_object_add_type(C, OB_MESH, "Navmesh", co, rot, false, lay);
- }
- else {
- obedit = base->object;
- BKE_view_layer_base_deselect_all(view_layer);
- BKE_view_layer_base_select(view_layer, base);
- copy_v3_v3(obedit->loc, co);
- copy_v3_v3(obedit->rot, rot);
- }
-
- ED_object_editmode_enter(C, EM_DO_UNDO | EM_IGNORE_LAYER);
- em = BKE_editmesh_from_object(obedit);
-
- if (!createob) {
- /* clear */
- EDBM_mesh_clear(em);
- }
-
- /* create verts for polygon mesh */
- verts = recast_polyMeshGetVerts(pmesh, &nverts);
- recast_polyMeshGetBoundbox(pmesh, bmin, NULL);
- recast_polyMeshGetCell(pmesh, &cs, &ch);
-
- for (i = 0; i < nverts; i++) {
- v = &verts[3 * i];
- co[0] = bmin[0] + v[0] * cs;
- co[1] = bmin[1] + v[1] * ch;
- co[2] = bmin[2] + v[2] * cs;
- SWAP(float, co[1], co[2]);
- BM_vert_create(em->bm, co, NULL, BM_CREATE_NOP);
- }
-
- /* create custom data layer to save polygon idx */
- CustomData_add_layer_named(&em->bm->pdata, CD_RECAST, CD_CALLOC, NULL, 0, "createRepresentation recastData");
- CustomData_bmesh_init_pool(&em->bm->pdata, 0, BM_FACE);
-
- /* create verts and faces for detailed mesh */
- meshes = recast_polyMeshDetailGetMeshes(dmesh, &nmeshes);
- polys = recast_polyMeshGetPolys(pmesh, NULL, &nvp);
- dverts = recast_polyMeshDetailGetVerts(dmesh, NULL);
- tris = recast_polyMeshDetailGetTris(dmesh, NULL);
-
- for (i = 0; i < nmeshes; i++) {
- int uniquevbase = em->bm->totvert;
- unsigned int vbase = meshes[4 * i + 0];
- unsigned short ndv = meshes[4 * i + 1];
- unsigned short tribase = meshes[4 * i + 2];
- unsigned short trinum = meshes[4 * i + 3];
- const unsigned short *p = &polys[i * nvp * 2];
- int nv = 0;
-
- for (j = 0; j < nvp; ++j) {
- if (p[j] == 0xffff) break;
- nv++;
- }
-
- /* create unique verts */
- for (j = nv; j < ndv; j++) {
- copy_v3_v3(co, &dverts[3 * (vbase + j)]);
- SWAP(float, co[1], co[2]);
- BM_vert_create(em->bm, co, NULL, BM_CREATE_NOP);
- }
-
- /* need to rebuild entirely because array size changes */
- BM_mesh_elem_table_init(em->bm, BM_VERT);
-
- /* create faces */
- for (j = 0; j < trinum; j++) {
- unsigned char *tri = &tris[4 * (tribase + j)];
- BMFace *newFace;
- int *polygonIdx;
-
- for (k = 0; k < 3; k++) {
- if (tri[k] < nv)
- face[k] = p[tri[k]]; /* shared vertex */
- else
- face[k] = uniquevbase + tri[k] - nv; /* unique vertex */
- }
- newFace = BM_face_create_quad_tri(em->bm,
- BM_vert_at_index(em->bm, face[0]),
- BM_vert_at_index(em->bm, face[2]),
- BM_vert_at_index(em->bm, face[1]), NULL,
- NULL, BM_CREATE_NOP);
-
- /* set navigation polygon idx to the custom layer */
- polygonIdx = (int *)CustomData_bmesh_get(&em->bm->pdata, newFace->head.data, CD_RECAST);
- *polygonIdx = i + 1; /* add 1 to avoid zero idx */
- }
- }
-
- recast_destroyPolyMesh(pmesh);
- recast_destroyPolyMeshDetail(dmesh);
-
- DEG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
-
-
- ED_object_editmode_exit(C, EM_FREEDATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
-
- if (createob) {
- obedit->gameflag &= ~OB_COLLISION;
- obedit->gameflag |= OB_NAVMESH;
- obedit->body_type = OB_BODY_TYPE_NAVMESH;
- }
-
- BKE_mesh_ensure_navmesh(obedit->data);
-
- return obedit;
-}
-
-static int navmesh_create_exec(bContext *C, wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- LinkNode *obs = NULL;
- Base *navmeshBase = NULL;
-
- CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
- {
- if (base->object->type == OB_MESH) {
- if (base->object->body_type == OB_BODY_TYPE_NAVMESH) {
- if (!navmeshBase || base == view_layer->basact) {
- navmeshBase = base;
- }
- }
- else {
- BLI_linklist_prepend(&obs, base->object);
- }
- }
- }
- CTX_DATA_END;
-
- if (obs) {
- struct recast_polyMesh *pmesh = NULL;
- struct recast_polyMeshDetail *dmesh = NULL;
- bool ok;
- unsigned int lay = 0;
-
- int nverts = 0, ntris = 0;
- int *tris = NULL;
- float *verts = NULL;
-
- createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris, &lay);
- BLI_linklist_free(obs, NULL);
- if ((ok = buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh, op->reports))) {
- createRepresentation(C, pmesh, dmesh, navmeshBase, lay);
- }
-
- MEM_freeN(verts);
- MEM_freeN(tris);
-
- return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
- }
- else {
- BKE_report(op->reports, RPT_ERROR, "No mesh objects found");
-
- return OPERATOR_CANCELLED;
- }
-}
-
-void MESH_OT_navmesh_make(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Create Navigation Mesh";
- ot->description = "Create navigation mesh for selected objects";
- ot->idname = "MESH_OT_navmesh_make";
-
- /* api callbacks */
- ot->exec = navmesh_create_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
-{
- Object *obedit = CTX_data_edit_object(C);
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
-
- /* do work here */
- BMFace *efa_act = BM_mesh_active_face_get(em->bm, false, false);
-
- if (efa_act) {
- if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
- BMFace *efa;
- BMIter iter;
- int targetPolyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, efa_act->head.data, CD_RECAST);
- targetPolyIdx = targetPolyIdx >= 0 ? targetPolyIdx : -targetPolyIdx;
-
- if (targetPolyIdx > 0) {
- /* set target poly idx to other selected faces */
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) {
- int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_RECAST);
- *recastDataBlock = targetPolyIdx;
- }
- }
- }
- else {
- BKE_report(op->reports, RPT_ERROR, "Active face has no index set");
- }
- }
- }
-
- DEG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "NavMesh Copy Face Index";
- ot->description = "Copy the index from the active face";
- ot->idname = "MESH_OT_navmesh_face_copy";
-
- /* api callbacks */
- ot->poll = ED_operator_editmesh;
- ot->exec = navmesh_face_copy_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int compare(const void *a, const void *b)
-{
- return (*(int *)a - *(int *)b);
-}
-
-static int findFreeNavPolyIndex(BMEditMesh *em)
-{
- /* construct vector of indices */
- int numfaces = em->bm->totface;
- int *indices = MEM_callocN(sizeof(int) * numfaces, "findFreeNavPolyIndex(indices)");
- BMFace *ef;
- BMIter iter;
- int i, idx = em->bm->totface - 1, freeIdx = 1;
-
- /*XXX this originally went last to first, but that isn't possible anymore*/
- BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) {
- int polyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
- indices[idx] = polyIdx;
- idx--;
- }
-
- qsort(indices, numfaces, sizeof(int), compare);
-
- /* search first free index */
- freeIdx = 1;
- for (i = 0; i < numfaces; i++) {
- if (indices[i] == freeIdx)
- freeIdx++;
- else if (indices[i] > freeIdx)
- break;
- }
-
- MEM_freeN(indices);
-
- return freeIdx;
-}
-
-static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *obedit = CTX_data_edit_object(C);
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
- BMFace *ef;
- BMIter iter;
-
- if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
- int targetPolyIdx = findFreeNavPolyIndex(em);
-
- if (targetPolyIdx > 0) {
- /* set target poly idx to selected faces */
- /*XXX this originally went last to first, but that isn't possible anymore*/
-
- BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) {
- if (BM_elem_flag_test(ef, BM_ELEM_SELECT)) {
- int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
- *recastDataBlock = targetPolyIdx;
- }
- }
- }
- }
-
- DEG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_navmesh_face_add(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "NavMesh New Face Index";
- ot->description = "Add a new index and assign it to selected faces";
- ot->idname = "MESH_OT_navmesh_face_add";
-
- /* api callbacks */
- ot->poll = ED_operator_editmesh;
- ot->exec = navmesh_face_add_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int navmesh_obmode_data_poll(bContext *C)
-{
- Object *ob = ED_object_active_context(C);
- if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
- Mesh *me = ob->data;
- return CustomData_has_layer(&me->pdata, CD_RECAST);
- }
- return false;
-}
-
-static int navmesh_obmode_poll(bContext *C)
-{
- Object *ob = ED_object_active_context(C);
- if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
- return true;
- }
- return false;
-}
-
-static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *ob = ED_object_active_context(C);
- Mesh *me = ob->data;
-
- CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
-
- BKE_mesh_ensure_navmesh(me);
-
- DEG_id_tag_update(&me->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_navmesh_reset(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "NavMesh Reset Index Values";
- ot->description = "Assign a new index to every face";
- ot->idname = "MESH_OT_navmesh_reset";
-
- /* api callbacks */
- ot->poll = navmesh_obmode_poll;
- ot->exec = navmesh_reset_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *ob = ED_object_active_context(C);
- Mesh *me = ob->data;
-
- CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
-
- DEG_id_tag_update(&me->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_navmesh_clear(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "NavMesh Clear Data";
- ot->description = "Remove navmesh data from this mesh";
- ot->idname = "MESH_OT_navmesh_clear";
-
- /* api callbacks */
- ot->poll = navmesh_obmode_data_poll;
- ot->exec = navmesh_clear_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index b9920f9deca..a2c996c7f42 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -197,14 +197,6 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_bisect);
WM_operatortype_append(MESH_OT_symmetrize);
WM_operatortype_append(MESH_OT_symmetry_snap);
-
-#ifdef WITH_GAMEENGINE
- WM_operatortype_append(MESH_OT_navmesh_make);
- WM_operatortype_append(MESH_OT_navmesh_face_copy);
- WM_operatortype_append(MESH_OT_navmesh_face_add);
- WM_operatortype_append(MESH_OT_navmesh_reset);
- WM_operatortype_append(MESH_OT_navmesh_clear);
-#endif
}
#if 0 /* UNUSED, remove? */
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 646b8137b2d..e25b04668bc 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -50,7 +50,6 @@ set(SRC
object_facemap_ops.c
object_group.c
object_hook.c
- object_lod.c
object_modes.c
object_modifier.c
object_ops.c
@@ -72,10 +71,6 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-if(WITH_GAMEENGINE)
- add_definitions(-DWITH_GAMEENGINE)
-endif()
-
if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 4abd80a18e8..6f9f18d301e 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -48,7 +48,6 @@
#include "DNA_lightprobe_types.h"
#include "DNA_scene_types.h"
#include "DNA_vfont_types.h"
-#include "DNA_actuator_types.h"
#include "DNA_gpencil_types.h"
#include "BLI_utildefines.h"
@@ -88,7 +87,6 @@
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_report.h"
-#include "BKE_sca.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_speaker.h"
@@ -440,12 +438,6 @@ Object *ED_object_add_type(
/* more editor stuff */
ED_object_base_init_transform(C, view_layer->basact, loc, rot);
- /* Ignore collisions by default for non-mesh objects */
- if (type != OB_MESH) {
- ob->body_type = OB_BODY_TYPE_NO_COLLISION;
- ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_OCCLUDER | OB_DYNAMIC | OB_NAVMESH); /* copied from rna_object.c */
- }
-
/* TODO(sergey): This is weird to manually tag objects for update, better to
* use DEG_id_tag_update here perhaps.
*/
@@ -1347,8 +1339,6 @@ static void copy_object_set_idnew(bContext *C)
}
CTX_DATA_END;
- set_sca_new_poins();
-
BKE_main_id_clear_newpoins(bmain);
}
@@ -1502,7 +1492,6 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
/* Remap new object to itself, and clear again newid pointer of orig object. */
BKE_libblock_relink_to_newid(&ob_dst->id);
- set_sca_new_poins_ob(ob_dst);
DEG_id_tag_update(&ob_dst->id, OB_RECALC_DATA);
@@ -1659,10 +1648,6 @@ static void curvetomesh(Depsgraph *depsgraph, Scene *scene, Object *ob)
if (ob->type == OB_MESH) {
BKE_object_free_modifiers(ob, 0);
-
- /* Game engine defaults for mesh objects */
- ob->body_type = OB_BODY_TYPE_STATIC;
- ob->gameflag = OB_PROP | OB_COLLISION;
}
}
@@ -2277,25 +2262,10 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
}
if (dupflag & USER_DUP_ACT) {
- bActuator *act;
-
BKE_animdata_copy_id_action((ID *)obn->data, true);
if (key) {
BKE_animdata_copy_id_action((ID *)key, true);
}
-
- /* Update the duplicated action in the action actuators */
- /* XXX TODO this code is all wrong! actact->act is user-refcounted (see readfile.c),
- * and what about other ID pointers of other BGE logic bricks,
- * and since this is object-level, why is it only ran if obdata was duplicated??? -mont29 */
- for (act = obn->actuators.first; act; act = act->next) {
- if (act->type == ACT_ACTION) {
- bActionActuator *actact = (bActionActuator *) act->data;
- if (ob->adt && actact->act == ob->adt->action) {
- actact->act = obn->adt->action;
- }
- }
- }
}
if (dupflag & USER_DUP_MAT) {
@@ -2331,8 +2301,6 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, ViewLayer *view_layer,
Base *basen;
Object *ob;
- clear_sca_new_poins(); /* BGE logic */
-
basen = object_add_duplicate_internal(bmain, scene, view_layer, base->object, dupflag);
if (basen == NULL) {
return NULL;
@@ -2342,7 +2310,6 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, ViewLayer *view_layer,
/* link own references to the newly duplicated data [#26816] */
BKE_libblock_relink_to_newid(&ob->id);
- set_sca_new_poins_ob(ob);
/* DAG_relations_tag_update(bmain); */ /* caller must do */
@@ -2364,8 +2331,6 @@ static int duplicate_exec(bContext *C, wmOperator *op)
const bool linked = RNA_boolean_get(op->ptr, "linked");
int dupflag = (linked) ? 0 : U.dupflag;
- clear_sca_new_poins(); /* BGE logic */
-
CTX_DATA_BEGIN (C, Base *, base, selected_bases)
{
Base *basen = object_add_duplicate_internal(bmain, scene, view_layer, base->object, dupflag);
@@ -2449,8 +2414,6 @@ static int add_named_exec(bContext *C, wmOperator *op)
}
/* prepare dupli */
- clear_sca_new_poins(); /* BGE logic */
-
basen = object_add_duplicate_internal(bmain, scene, view_layer, ob, dupflag);
if (basen == NULL) {
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index ca742222d81..95778b73e55 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1615,11 +1615,6 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob
only_ob = true;
add = false;
break;
-
- /* object only - add here is ok? */
- case CONSTRAINT_TYPE_RIGIDBODYJOINT:
- only_ob = true;
- break;
}
/* if the active Object is Armature, and we can search for bones, do so... */
@@ -1748,10 +1743,6 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
if (type == CONSTRAINT_TYPE_NULL) {
return OPERATOR_CANCELLED;
}
- if ((type == CONSTRAINT_TYPE_RIGIDBODYJOINT) && (list != &ob->constraints)) {
- BKE_report(op->reports, RPT_ERROR, "Rigid Body Joint constraint can only be added to objects");
- return OPERATOR_CANCELLED;
- }
if ((type == CONSTRAINT_TYPE_KINEMATIC) && ((!pchan) || (list != &pchan->constraints))) {
BKE_report(op->reports, RPT_ERROR, "IK constraint can only be added to bones");
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index e884989b6b5..5565565c679 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -51,7 +51,6 @@
#include "DNA_group_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
-#include "DNA_property_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_object_force_types.h"
@@ -80,8 +79,6 @@
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_pointcache.h"
-#include "BKE_property.h"
-#include "BKE_sca.h"
#include "BKE_softbody.h"
#include "BKE_modifier.h"
#include "BKE_editlattice.h"
@@ -613,102 +610,6 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static void copymenu_properties(ViewLayer *view_layer, Object *ob)
-{
-//XXX no longer used - to be removed - replaced by game_properties_copy_exec
- bProperty *prop;
- Base *base;
- int nr, tot = 0;
- char *str;
-
- prop = ob->prop.first;
- while (prop) {
- tot++;
- prop = prop->next;
- }
-
- str = MEM_callocN(50 + 33 * tot, "copymenu prop");
-
- if (tot)
- strcpy(str, "Copy Property %t|Replace All|Merge All|%l");
- else
- strcpy(str, "Copy Property %t|Clear All (no properties on active)");
-
- tot = 0;
- prop = ob->prop.first;
- while (prop) {
- tot++;
- strcat(str, "|");
- strcat(str, prop->name);
- prop = prop->next;
- }
-
- nr = pupmenu(str);
-
- if (nr == 1 || nr == 2) {
- for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if ((base != BASACT(view_layer)) && (TESTBASELIB(base))) {
- if (nr == 1) { /* replace */
- BKE_bproperty_copy_list(&base->object->prop, &ob->prop);
- }
- else {
- for (prop = ob->prop.first; prop; prop = prop->next) {
- BKE_bproperty_object_set(base->object, prop);
- }
- }
- }
- }
- }
- else if (nr > 0) {
- prop = BLI_findlink(&ob->prop, nr - 4); /* account for first 3 menu items & menu index starting at 1*/
-
- if (prop) {
- for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if ((base != BASACT(view_layer)) && (TESTBASELIB(base))) {
- BKE_bproperty_object_set(base->object, prop);
- }
- }
- }
- }
- MEM_freeN(str);
-
-}
-
-static void copymenu_logicbricks(ViewLayer *view_layer, Object *ob)
-{
-//XXX no longer used - to be removed - replaced by logicbricks_copy_exec
- Base *base;
-
- for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if (base->object != ob) {
- if (TESTBASELIB(base)) {
-
- /* first: free all logic */
- free_sensors(&base->object->sensors);
- unlink_controllers(&base->object->controllers);
- free_controllers(&base->object->controllers);
- unlink_actuators(&base->object->actuators);
- free_actuators(&base->object->actuators);
-
- /* now copy it, this also works without logicbricks! */
- clear_sca_new_poins_ob(ob);
- copy_sensors(&base->object->sensors, &ob->sensors, 0);
- copy_controllers(&base->object->controllers, &ob->controllers, 0);
- copy_actuators(&base->object->actuators, &ob->actuators, 0);
- set_sca_new_poins_ob(base->object);
-
- /* some menu settings */
- base->object->scavisflag = ob->scavisflag;
- base->object->scaflag = ob->scaflag;
-
- /* set the initial state */
- base->object->state = ob->state;
- base->object->init_state = ob->init_state;
- }
- }
- }
-}
-
/* both pointers should exist */
static void copy_texture_space(Object *to, Object *ob)
{
@@ -776,15 +677,8 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
/* obedit_copymenu(); */
return;
}
- if (event == 9) {
- copymenu_properties(view_layer, ob);
- return;
- }
- else if (event == 10) {
- copymenu_logicbricks(view_layer, ob);
- return;
- }
- else if (event == 24) {
+
+ if (event == 24) {
/* moved to BKE_object_link_modifiers */
/* copymenu_modifiers(bmain, scene, v3d, ob); */
return;
@@ -832,30 +726,6 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
if (ob->dup_group)
id_us_plus(&ob->dup_group->id);
}
- else if (event == 7) { /* mass */
- base->object->mass = ob->mass;
- }
- else if (event == 8) { /* damping */
- base->object->damping = ob->damping;
- base->object->rdamping = ob->rdamping;
- }
- else if (event == 11) { /* all physical attributes */
- base->object->gameflag = ob->gameflag;
- base->object->inertia = ob->inertia;
- base->object->formfactor = ob->formfactor;
- base->object->damping = ob->damping;
- base->object->rdamping = ob->rdamping;
- base->object->min_vel = ob->min_vel;
- base->object->max_vel = ob->max_vel;
- base->object->min_angvel = ob->min_angvel;
- base->object->max_angvel = ob->max_angvel;
- if (ob->gameflag & OB_BOUNDS) {
- base->object->collision_boundtype = ob->collision_boundtype;
- }
- base->object->margin = ob->margin;
- base->object->bsoft = copy_bulletsoftbody(ob->bsoft, 0);
-
- }
else if (event == 17) { /* tex space */
copy_texture_space(base->object, ob);
}
@@ -1641,393 +1511,6 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
-/************************ Game Properties ***********************/
-
-static int game_property_new_exec(bContext *C, wmOperator *op)
-{
- Object *ob = CTX_data_active_object(C);
- bProperty *prop;
- char name[MAX_NAME];
- int type = RNA_enum_get(op->ptr, "type");
-
- prop = BKE_bproperty_new(type);
- BLI_addtail(&ob->prop, prop);
-
- RNA_string_get(op->ptr, "name", name);
- if (name[0] != '\0') {
- BLI_strncpy(prop->name, name, sizeof(prop->name));
- }
-
- BLI_uniquename(&ob->prop, prop, DATA_("Property"), '.', offsetof(bProperty, name), sizeof(prop->name));
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
- return OPERATOR_FINISHED;
-}
-
-
-void OBJECT_OT_game_property_new(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "New Game Property";
- ot->description = "Create a new property available to the game engine";
- ot->idname = "OBJECT_OT_game_property_new";
-
- /* api callbacks */
- ot->exec = game_property_new_exec;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- RNA_def_enum(ot->srna, "type", rna_enum_gameproperty_type_items, GPROP_FLOAT, "Type", "Type of game property to add");
- RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the game property to add");
-}
-
-static int game_property_remove_exec(bContext *C, wmOperator *op)
-{
- Object *ob = CTX_data_active_object(C);
- bProperty *prop;
- int index = RNA_int_get(op->ptr, "index");
-
- if (!ob)
- return OPERATOR_CANCELLED;
-
- prop = BLI_findlink(&ob->prop, index);
-
- if (prop) {
- BLI_remlink(&ob->prop, prop);
- BKE_bproperty_free(prop);
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
- return OPERATOR_FINISHED;
- }
- else {
- return OPERATOR_CANCELLED;
- }
-}
-
-void OBJECT_OT_game_property_remove(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Remove Game Property";
- ot->description = "Remove game property";
- ot->idname = "OBJECT_OT_game_property_remove";
-
- /* api callbacks */
- ot->exec = game_property_remove_exec;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to remove ", 0, INT_MAX);
-}
-
-#define GAME_PROPERTY_MOVE_UP 1
-#define GAME_PROPERTY_MOVE_DOWN -1
-
-static int game_property_move(bContext *C, wmOperator *op)
-{
- Object *ob = CTX_data_active_object(C);
- bProperty *prop;
- bProperty *otherprop = NULL;
- const int index = RNA_int_get(op->ptr, "index");
- const int dir = RNA_enum_get(op->ptr, "direction");
-
- if (ob == NULL)
- return OPERATOR_CANCELLED;
-
- prop = BLI_findlink(&ob->prop, index);
- /* invalid index */
- if (prop == NULL)
- return OPERATOR_CANCELLED;
-
- if (dir == GAME_PROPERTY_MOVE_UP) {
- otherprop = prop->prev;
- }
- else if (dir == GAME_PROPERTY_MOVE_DOWN) {
- otherprop = prop->next;
- }
- else {
- BLI_assert(0);
- }
-
- if (prop && otherprop) {
- BLI_listbase_swaplinks(&ob->prop, prop, otherprop);
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
- return OPERATOR_FINISHED;
- }
- else {
- return OPERATOR_CANCELLED;
- }
-}
-
-void OBJECT_OT_game_property_move(wmOperatorType *ot)
-{
- static const EnumPropertyItem direction_property_move[] = {
- {GAME_PROPERTY_MOVE_UP, "UP", 0, "Up", ""},
- {GAME_PROPERTY_MOVE_DOWN, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL}
- };
- PropertyRNA *prop;
-
- /* identifiers */
- ot->name = "Move Game Property";
- ot->description = "Move game property";
- ot->idname = "OBJECT_OT_game_property_move";
-
- /* api callbacks */
- ot->exec = game_property_move;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- /* properties */
- prop = RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to move", 0, INT_MAX);
- RNA_def_property_flag(prop, PROP_HIDDEN);
- RNA_def_enum(ot->srna, "direction", direction_property_move, 0, "Direction",
- "Direction for moving the property");
-}
-
-#undef GAME_PROPERTY_MOVE_UP
-#undef GAME_PROPERTY_MOVE_DOWN
-
-#define COPY_PROPERTIES_REPLACE 1
-#define COPY_PROPERTIES_MERGE 2
-#define COPY_PROPERTIES_COPY 3
-
-static const EnumPropertyItem game_properties_copy_operations[] = {
- {COPY_PROPERTIES_REPLACE, "REPLACE", 0, "Replace Properties", ""},
- {COPY_PROPERTIES_MERGE, "MERGE", 0, "Merge Properties", ""},
- {COPY_PROPERTIES_COPY, "COPY", 0, "Copy a Property", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
-static const EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
-{
- Object *ob = ED_object_active_context(C);
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- EnumPropertyItem *item = NULL;
- bProperty *prop;
- int a, totitem = 0;
-
- if (!ob)
- return DummyRNA_NULL_items;
-
- for (a = 1, prop = ob->prop.first; prop; prop = prop->next, a++) {
- tmp.value = a;
- tmp.identifier = prop->name;
- tmp.name = prop->name;
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
-}
-
-static int game_property_copy_exec(bContext *C, wmOperator *op)
-{
- Object *ob = ED_object_active_context(C);
- bProperty *prop;
- int type = RNA_enum_get(op->ptr, "operation");
- int propid = RNA_enum_get(op->ptr, "property");
-
- if (propid > 0) { /* copy */
- prop = BLI_findlink(&ob->prop, propid - 1);
-
- if (prop) {
- CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects)
- {
- if (ob != ob_iter)
- BKE_bproperty_object_set(ob_iter, prop);
- } CTX_DATA_END;
- }
- }
-
- else {
- CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects)
- {
- if (ob != ob_iter) {
- if (type == COPY_PROPERTIES_REPLACE) {
- BKE_bproperty_copy_list(&ob_iter->prop, &ob->prop);
- }
- else {
- /* merge - the default when calling with no argument */
- for (prop = ob->prop.first; prop; prop = prop->next) {
- BKE_bproperty_object_set(ob_iter, prop);
- }
- }
- }
- }
- CTX_DATA_END;
- }
-
- return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_game_property_copy(wmOperatorType *ot)
-{
- PropertyRNA *prop;
- /* identifiers */
- ot->name = "Copy Game Property";
- ot->idname = "OBJECT_OT_game_property_copy";
- ot->description = "Copy/merge/replace a game property from active object to all selected objects";
-
- /* api callbacks */
- ot->exec = game_property_copy_exec;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- RNA_def_enum(ot->srna, "operation", game_properties_copy_operations, 3, "Operation", "");
- prop = RNA_def_enum(ot->srna, "property", DummyRNA_NULL_items, 0, "Property", "Properties to copy");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_ENUM_NO_TRANSLATE);
- RNA_def_enum_funcs(prop, gameprops_itemf);
- ot->prop = prop;
-}
-
-static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op))
-{
- CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects)
- {
- BKE_bproperty_free_list(&ob_iter->prop);
- }
- CTX_DATA_END;
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
- return OPERATOR_FINISHED;
-}
-void OBJECT_OT_game_property_clear(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Clear Game Properties";
- ot->idname = "OBJECT_OT_game_property_clear";
- ot->description = "Remove all game properties from all selected objects";
-
- /* api callbacks */
- ot->exec = game_property_clear_exec;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-/************************ Copy Logic Bricks ***********************/
-
-static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *ob = ED_object_active_context(C);
-
- CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects)
- {
- if (ob != ob_iter) {
- /* first: free all logic */
- free_sensors(&ob_iter->sensors);
- unlink_controllers(&ob_iter->controllers);
- free_controllers(&ob_iter->controllers);
- unlink_actuators(&ob_iter->actuators);
- free_actuators(&ob_iter->actuators);
-
- /* now copy it, this also works without logicbricks! */
- clear_sca_new_poins_ob(ob);
- copy_sensors(&ob_iter->sensors, &ob->sensors, 0);
- copy_controllers(&ob_iter->controllers, &ob->controllers, 0);
- copy_actuators(&ob_iter->actuators, &ob->actuators, 0);
- set_sca_new_poins_ob(ob_iter);
-
- /* some menu settings */
- ob_iter->scavisflag = ob->scavisflag;
- ob_iter->scaflag = ob->scaflag;
-
- /* set the initial state */
- ob_iter->state = ob->state;
- ob_iter->init_state = ob->init_state;
-
- if (ob_iter->totcol == ob->totcol) {
- ob_iter->actcol = ob->actcol;
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob_iter);
- }
- }
- }
- CTX_DATA_END;
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Copy Logic Bricks to Selected";
- ot->description = "Copy logic bricks to other selected objects";
- ot->idname = "OBJECT_OT_logic_bricks_copy";
-
- /* api callbacks */
- ot->exec = logicbricks_copy_exec;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *ob = ED_object_active_context(C);
-
- CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects)
- {
- if (ob != ob_iter) {
- ob_iter->gameflag = ob->gameflag;
- ob_iter->gameflag2 = ob->gameflag2;
- ob_iter->inertia = ob->inertia;
- ob_iter->formfactor = ob->formfactor;
- ob_iter->damping = ob->damping;
- ob_iter->rdamping = ob->rdamping;
- ob_iter->min_vel = ob->min_vel;
- ob_iter->max_vel = ob->max_vel;
- ob_iter->min_angvel = ob->min_angvel;
- ob_iter->max_angvel = ob->max_angvel;
- ob_iter->obstacleRad = ob->obstacleRad;
- ob_iter->mass = ob->mass;
- copy_v3_v3(ob_iter->anisotropicFriction, ob->anisotropicFriction);
- ob_iter->collision_boundtype = ob->collision_boundtype;
- ob_iter->margin = ob->margin;
- ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft, 0);
- if (ob->restrictflag & OB_RESTRICT_RENDER)
- ob_iter->restrictflag |= OB_RESTRICT_RENDER;
- else
- ob_iter->restrictflag &= ~OB_RESTRICT_RENDER;
-
- ob_iter->col_group = ob->col_group;
- ob_iter->col_mask = ob->col_mask;
- }
- }
- CTX_DATA_END;
-
- return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Copy Game Physics Properties to Selected";
- ot->description = "Copy game physics properties to other selected objects";
- ot->idname = "OBJECT_OT_game_physics_copy";
-
- /* api callbacks */
- ot->exec = game_physics_copy_exec;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
bool ED_object_editmode_calc_active_center(Object *obedit, const bool select_only, float r_center[3])
{
switch (obedit->type) {
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 75117ccdce3..5025ca5bb96 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -87,14 +87,6 @@ void OBJECT_OT_paths_update(struct wmOperatorType *ot);
void OBJECT_OT_paths_clear(struct wmOperatorType *ot);
void OBJECT_OT_forcefield_toggle(struct wmOperatorType *ot);
-void OBJECT_OT_game_property_new(struct wmOperatorType *ot);
-void OBJECT_OT_game_property_remove(struct wmOperatorType *ot);
-void OBJECT_OT_game_property_copy(struct wmOperatorType *ot);
-void OBJECT_OT_game_property_clear(struct wmOperatorType *ot);
-void OBJECT_OT_game_property_move(struct wmOperatorType *ot);
-void OBJECT_OT_logic_bricks_copy(struct wmOperatorType *ot);
-void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot);
-
void OBJECT_OT_move_to_collection(struct wmOperatorType *ot);
/* object_select.c */
diff --git a/source/blender/editors/object/object_lod.c b/source/blender/editors/object/object_lod.c
deleted file mode 100644
index ced306178b8..00000000000
--- a/source/blender/editors/object/object_lod.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) Blender Foundation
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/object/object_lod.c
- * \ingroup edobj
- */
-
-#include "DNA_object_types.h"
-
-#include "BKE_context.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "ED_screen.h"
-#include "ED_object.h"
-
-#ifdef WITH_GAMEENGINE
-# include "BKE_object.h"
-
-# include "RNA_enum_types.h"
-#endif
-
-#include "object_intern.h"
-
-static int object_lod_add_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *ob = ED_object_context(C);
-
-#ifdef WITH_GAMEENGINE
- BKE_object_lod_add(ob);
-#else
- (void)ob;
-#endif
-
- return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_lod_add(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Add Level of Detail";
- ot->description = "Add a level of detail to this object";
- ot->idname = "OBJECT_OT_lod_add";
-
- /* api callbacks */
- ot->exec = object_lod_add_exec;
- ot->poll = ED_operator_object_active;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int object_lod_remove_exec(bContext *C, wmOperator *op)
-{
- Object *ob = ED_object_context(C);
- int index = RNA_int_get(op->ptr, "index");
-
-#ifdef WITH_GAMEENGINE
- if (!BKE_object_lod_remove(ob, index))
- return OPERATOR_CANCELLED;
-#else
- (void)ob;
- (void)index;
-#endif
-
- WM_event_add_notifier(C, NC_OBJECT | ND_LOD, CTX_wm_view3d(C));
- return OPERATOR_FINISHED;
-}
-
-void OBJECT_OT_lod_remove(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Remove Level of Detail";
- ot->description = "Remove a level of detail from this object";
- ot->idname = "OBJECT_OT_lod_remove";
-
- /* api callbacks */
- ot->exec = object_lod_remove_exec;
- ot->poll = ED_operator_object_active;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- /* properties */
- ot->prop = RNA_def_int(ot->srna, "index", 1, 1, INT_MAX, "Index", "", 1, INT_MAX);
-}
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 66dc17fe77d..c4c86b3932d 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -212,14 +212,6 @@ void ED_operatortypes_object(void)
WM_operatortype_append(TRANSFORM_OT_vertex_warp);
- WM_operatortype_append(OBJECT_OT_game_property_new);
- WM_operatortype_append(OBJECT_OT_game_property_remove);
- WM_operatortype_append(OBJECT_OT_game_property_copy);
- WM_operatortype_append(OBJECT_OT_game_property_clear);
- WM_operatortype_append(OBJECT_OT_game_property_move);
- WM_operatortype_append(OBJECT_OT_logic_bricks_copy);
- WM_operatortype_append(OBJECT_OT_game_physics_copy);
-
WM_operatortype_append(OBJECT_OT_move_to_collection);
WM_operatortype_append(OBJECT_OT_shape_key_add);
@@ -249,9 +241,6 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_unlink_data);
WM_operatortype_append(OBJECT_OT_laplaciandeform_bind);
- WM_operatortype_append(OBJECT_OT_lod_add);
- WM_operatortype_append(OBJECT_OT_lod_remove);
-
WM_operatortype_append(TRANSFORM_OT_vertex_random);
WM_operatortype_append(OBJECT_OT_data_transfer);
@@ -327,9 +316,6 @@ void ED_keymap_object(wmKeyConfig *keyconf)
ED_keymap_proportional_cycle(keyconf, keymap);
ED_keymap_proportional_obmode(keyconf, keymap);
- /* game-engine only, leave free for users to define */
- WM_keymap_add_item(keymap, "VIEW3D_OT_game_start", PKEY, KM_PRESS, 0, 0);
-
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", AKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 417c32a71e9..0e0f2784936 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -89,7 +89,6 @@
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_report.h"
-#include "BKE_sca.h"
#include "BKE_scene.h"
#include "BKE_speaker.h"
#include "BKE_texture.h"
@@ -1681,8 +1680,6 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
{
Group *group, *groupn;
- clear_sca_new_poins(); /* BGE logic */
-
/* duplicate all the objects of the scene */
SceneCollection *msc = BKE_collection_master(&scene->id);
single_object_users_scene_collection(bmain, scene, msc, flag, copy_groups);
@@ -1728,8 +1725,6 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
/* object and group pointers */
libblock_relink_scene_collection(msc);
-
- set_sca_new_poins();
}
/* not an especially efficient function, only added so the single user
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index cd1300dd52e..d958381efe7 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -37,7 +37,6 @@
#include "DNA_group_types.h"
#include "DNA_material_types.h"
#include "DNA_modifier_types.h"
-#include "DNA_property_types.h"
#include "DNA_scene_types.h"
#include "DNA_armature_types.h"
#include "DNA_lamp_types.h"
@@ -59,7 +58,6 @@
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_paint.h"
-#include "BKE_property.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_workspace.h"
@@ -504,9 +502,8 @@ enum {
OBJECT_GRPSEL_HOOK = 7,
OBJECT_GRPSEL_PASS = 8,
OBJECT_GRPSEL_COLOR = 9,
- OBJECT_GRPSEL_PROPERTIES = 10,
- OBJECT_GRPSEL_KEYINGSET = 11,
- OBJECT_GRPSEL_LAMP_TYPE = 12,
+ OBJECT_GRPSEL_KEYINGSET = 10,
+ OBJECT_GRPSEL_LAMP_TYPE = 11,
};
static const EnumPropertyItem prop_select_grouped_types[] = {
@@ -520,7 +517,6 @@ static const EnumPropertyItem prop_select_grouped_types[] = {
{OBJECT_GRPSEL_HOOK, "HOOK", 0, "Hook", ""},
{OBJECT_GRPSEL_PASS, "PASS", 0, "Pass", "Render pass Index"},
{OBJECT_GRPSEL_COLOR, "COLOR", 0, "Color", "Object Color"},
- {OBJECT_GRPSEL_PROPERTIES, "PROPERTIES", 0, "Properties", "Game Properties"},
{OBJECT_GRPSEL_KEYINGSET, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"},
{OBJECT_GRPSEL_LAMP_TYPE, "LAMP_TYPE", 0, "Lamp Type", "Matching lamp types"},
{0, NULL, 0, NULL, NULL}
@@ -773,33 +769,6 @@ static bool select_grouped_color(bContext *C, Object *ob)
return changed;
}
-static bool objects_share_gameprop(Object *a, Object *b)
-{
- bProperty *prop;
-
- for (prop = a->prop.first; prop; prop = prop->next) {
- if (BKE_bproperty_object_get(b, prop->name)) {
- return 1;
- }
- }
- return 0;
-}
-
-static bool select_grouped_gameprops(bContext *C, Object *ob)
-{
- bool changed = false;
-
- CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
- {
- if (((base->flag & BASE_SELECTED) == 0) && (objects_share_gameprop(base->object, ob))) {
- ED_object_base_select(base, BA_SELECT);
- changed = true;
- }
- }
- CTX_DATA_END;
- return changed;
-}
-
static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList *reports)
{
KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C));
@@ -907,9 +876,6 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
case OBJECT_GRPSEL_COLOR:
changed |= select_grouped_color(C, ob);
break;
- case OBJECT_GRPSEL_PROPERTIES:
- changed |= select_grouped_gameprops(C, ob);
- break;
case OBJECT_GRPSEL_KEYINGSET:
changed |= select_grouped_keyingset(C, ob, op->reports);
break;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index c944d94fac5..25d5fbbdc4c 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -288,11 +288,6 @@ int ED_operator_nla_active(bContext *C)
return ed_spacetype_test(C, SPACE_NLA);
}
-int ED_operator_logic_active(bContext *C)
-{
- return ed_spacetype_test(C, SPACE_LOGIC);
-}
-
int ED_operator_info_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_INFO);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index ef125da46a7..4eea4fed9b6 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -5693,7 +5693,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
Object *ob = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
Material *ma;
- bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene);
+ bool is_bi = BKE_scene_uses_blender_internal(scene);
Image *ima = NULL;
if (!ob)
@@ -5846,7 +5846,7 @@ static int texture_paint_delete_texture_paint_slot_exec(bContext *C, wmOperator
Object *ob = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
Material *ma;
- bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene);
+ bool is_bi = BKE_scene_uses_blender_internal(scene);
TexPaintSlot *slot;
/* not supported for node-based engines */
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 82589857ba5..f8888ad9809 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -497,10 +497,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr
if (ibuf->rect_float) {
float rgba_f[4];
- if (U.gameflags & USER_DISABLE_MIPMAP)
- nearest_interpolation_color_wrap(ibuf, NULL, rgba_f, u, v);
- else
- bilinear_interpolation_color_wrap(ibuf, NULL, rgba_f, u, v);
+ bilinear_interpolation_color_wrap(ibuf, NULL, rgba_f, u, v);
straight_to_premul_v4(rgba_f);
if (use_palette) {
linearrgb_to_srgb_v3_v3(color->rgb, rgba_f);
@@ -512,10 +509,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr
}
else {
unsigned char rgba[4];
- if (U.gameflags & USER_DISABLE_MIPMAP)
- nearest_interpolation_color_wrap(ibuf, rgba, NULL, u, v);
- else
- bilinear_interpolation_color_wrap(ibuf, rgba, NULL, u, v);
+ bilinear_interpolation_color_wrap(ibuf, rgba, NULL, u, v);
if (use_palette) {
rgb_uchar_to_float(color->rgb, rgba);
}
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 4455b117370..3f3cb8bce4b 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -95,7 +95,6 @@ void ED_spacetypes_init(void)
ED_spacetype_script();
ED_spacetype_text();
ED_spacetype_sequencer();
- ED_spacetype_logic();
ED_spacetype_console();
ED_spacetype_userpref();
ED_spacetype_clip();
@@ -121,7 +120,6 @@ void ED_spacetypes_init(void)
ED_operatortypes_metaball();
ED_operatortypes_sound();
ED_operatortypes_render();
- ED_operatortypes_logic();
ED_operatortypes_mask();
ED_operatortypes_io();
diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt
deleted file mode 100644
index 349c003cf56..00000000000
--- a/source/blender/editors/space_logic/CMakeLists.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-set(INC
- ../include
- ../interface
- ../../blenkernel
- ../../blenlib
- ../../blentranslation
- ../../gpu
- ../../makesdna
- ../../makesrna
- ../../windowmanager
- ../../../../intern/guardedalloc
- ../../../../intern/glew-mx
-)
-
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
-set(SRC
- logic_buttons.c
- logic_ops.c
- logic_window.c
- space_logic.c
-
- logic_intern.h
-)
-
-if(WITH_GAMEENGINE)
- add_definitions(-DWITH_GAMEENGINE)
-endif()
-
-add_definitions(${GL_DEFINITIONS})
-
-if(WITH_INTERNATIONAL)
- add_definitions(-DWITH_INTERNATIONAL)
-endif()
-
-blender_add_lib(bf_editor_space_logic "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
deleted file mode 100644
index 54e6e217b77..00000000000
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 by Blender Foundation
- * All rights reserved.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_logic/logic_buttons.c
- * \ingroup splogic
- */
-
-
-#include <string.h>
-#include <stdio.h>
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
-
-#include "ED_screen.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "UI_interface.h"
-#include "UI_view2d.h"
-
-#include "interface_intern.h"
-#include "logic_intern.h"
-
-static int logic_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
-{
- ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = logic_has_buttons_region(sa);
-
- if (ar)
- ED_region_toggle_hidden(C, ar);
-
- return OPERATOR_FINISHED;
-}
-
-void LOGIC_OT_properties(wmOperatorType *ot)
-{
- ot->name = "Properties";
- ot->description = "Toggle the properties region visibility";
- ot->idname = "LOGIC_OT_properties";
-
- ot->exec = logic_properties_toggle_exec;
- ot->poll = ED_operator_logic_active;
-
- /* flags */
- ot->flag = 0;
-}
-
-/* Remove Logic Bricks Connections */
-/* ********************** Cut Link operator ***************** */
-
-#define LINK_RESOL 12
-static int cut_links_intersect(uiLinkLine *line, float mcoords[][2], int tot)
-{
- float coord_array[LINK_RESOL+1][2];
- int i, b;
- rcti rectlink;
-
- rectlink.xmin = (int)BLI_rctf_cent_x(&line->from->rect);
- rectlink.ymin = (int)BLI_rctf_cent_y(&line->from->rect);
- rectlink.xmax = (int)BLI_rctf_cent_x(&line->to->rect);
- rectlink.ymax = (int)BLI_rctf_cent_y(&line->to->rect);
-
- if (ui_link_bezier_points(&rectlink, coord_array, LINK_RESOL)) {
- for (i=0; i<tot-1; i++)
- for (b=0; b<LINK_RESOL-1; b++)
- if (isect_seg_seg_v2(mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1]) > 0)
- return 1;
- }
- return 0;
-}
-
-static int cut_links_exec(bContext *C, wmOperator *op)
-{
- ARegion *ar = CTX_wm_region(C);
- float mcoords[256][2];
- int i = 0;
-
- RNA_BEGIN (op->ptr, itemptr, "path")
- {
- float loc[2];
-
- RNA_float_get_array(&itemptr, "loc", loc);
- UI_view2d_region_to_view(&ar->v2d,
- (int)loc[0], (int)loc[1],
- &mcoords[i][0], &mcoords[i][1]);
- i++;
- if (i >= 256) break;
- }
- RNA_END;
-
- if (i>1) {
- uiBlock *block;
- uiLinkLine *line, *nline;
- uiBut *but;
- for (block = ar->uiblocks.first; block; block = block->next) {
- but = block->buttons.first;
- while (but) {
- if (but->type==UI_BTYPE_LINK && but->link) {
- for (line = but->link->lines.first; line; line = nline) {
- nline = line->next;
-
- if (cut_links_intersect(line, mcoords, i)) {
- ui_linkline_remove(line, but);
- }
- }
- }
- but = but->next;
- }
- }
- return OPERATOR_FINISHED;
- }
- return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
-}
-
-void LOGIC_OT_links_cut(wmOperatorType *ot)
-{
- ot->name = "Cut Links";
- ot->idname = "LOGIC_OT_links_cut";
- ot->description = "Remove logic brick connections";
-
- ot->invoke = WM_gesture_lines_invoke;
- ot->modal = WM_gesture_lines_modal;
- ot->exec = cut_links_exec;
- ot->cancel = WM_gesture_lines_cancel;
-
- ot->poll = ED_operator_logic_active;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* properties */
- PropertyRNA *prop;
- prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
- RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- /* internal */
- RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
-}
-
diff --git a/source/blender/editors/space_logic/logic_intern.h b/source/blender/editors/space_logic/logic_intern.h
deleted file mode 100644
index 13146621d1b..00000000000
--- a/source/blender/editors/space_logic/logic_intern.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_logic/logic_intern.h
- * \ingroup splogic
- */
-
-
-#ifndef __LOGIC_INTERN_H__
-#define __LOGIC_INTERN_H__
-
-/* internal exports only */
-struct bContext;
-struct ARegion;
-struct ScrArea;
-struct wmOperatorType;
-
-/* space_logic.c */
-struct ARegion *logic_has_buttons_region(struct ScrArea *sa);
-
-/* logic_ops.c */
-
-/* logic_buttons.c */
-void LOGIC_OT_properties(struct wmOperatorType *ot);
-void LOGIC_OT_links_cut(struct wmOperatorType *ot);
-
-/* logic_window.c */
-void logic_buttons(struct bContext *C, struct ARegion *ar);
-void make_unique_prop_names(struct bContext *C, char *str);
-
-#endif /* __LOGIC_INTERN_H__ */
-
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
deleted file mode 100644
index 7b9a8634490..00000000000
--- a/source/blender/editors/space_logic/logic_ops.c
+++ /dev/null
@@ -1,753 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_logic/logic_ops.c
- * \ingroup splogic
- */
-
-#include <stddef.h>
-
-#include "DNA_object_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_controller_types.h"
-#include "DNA_actuator_types.h"
-#include "DNA_scene_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_string_utils.h"
-#include "BLI_utildefines.h"
-
-#include "BLT_translation.h"
-
-#include "BKE_context.h"
-#include "BKE_main.h"
-#include "BKE_sca.h"
-
-#include "ED_logic.h"
-#include "ED_object.h"
-#include "ED_screen.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-#include "RNA_enum_types.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "UI_view2d.h"
-
-#include "logic_intern.h"
-
-/* ************* Generic Operator Helpers ************* */
-static int edit_sensor_poll(bContext *C)
-{
- PointerRNA ptr = CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor);
-
- if (ptr.data && ID_IS_LINKED(ptr.id.data)) return 0;
- return 1;
-}
-
-static int edit_controller_poll(bContext *C)
-{
- PointerRNA ptr = CTX_data_pointer_get_type(C, "controller", &RNA_Controller);
-
- if (ptr.data && ID_IS_LINKED(ptr.id.data)) return 0;
- return 1;
-}
-
-static int edit_actuator_poll(bContext *C)
-{
- PointerRNA ptr = CTX_data_pointer_get_type(C, "actuator", &RNA_Actuator);
-
- if (ptr.data && ID_IS_LINKED(ptr.id.data)) return 0;
- return 1;
-}
-
-static void edit_sensor_properties(wmOperatorType *ot)
-{
- RNA_def_string(ot->srna, "sensor", NULL, MAX_NAME, "Sensor", "Name of the sensor to edit");
- RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the object the sensor belongs to");
-}
-
-static int edit_sensor_invoke_properties(bContext *C, wmOperator *op)
-{
- PointerRNA ptr = CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor);
-
- if (RNA_struct_property_is_set(op->ptr, "sensor") && RNA_struct_property_is_set(op->ptr, "object") )
- return 1;
-
- if (ptr.data) {
- bSensor *sens = ptr.data;
- Object *ob = ptr.id.data;
-
- RNA_string_set(op->ptr, "sensor", sens->name);
- RNA_string_set(op->ptr, "object", ob->id.name + 2);
- return 1;
- }
-
- return 0;
-}
-
-static Object *edit_object_property_get(bContext *C, wmOperator *op)
-{
- char ob_name[MAX_NAME];
- Object *ob;
-
- RNA_string_get(op->ptr, "object", ob_name);
-
- /* if ob_name is valid try to find the object with this name
- * otherwise gets the active object */
- if (*ob_name)
- ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
- else
- ob = ED_object_active_context(C);
-
- return ob;
-}
-
-static bSensor *edit_sensor_property_get(bContext *C, wmOperator *op, Object **ob)
-{
- char sensor_name[MAX_NAME];
- bSensor *sens;
-
- RNA_string_get(op->ptr, "sensor", sensor_name);
-
- *ob = edit_object_property_get(C, op);
- if (!*ob) return NULL;
-
- sens = BLI_findstring(&((*ob)->sensors), sensor_name, offsetof(bSensor, name));
- return sens;
-}
-
-static void edit_controller_properties(wmOperatorType *ot)
-{
- RNA_def_string(ot->srna, "controller", NULL, MAX_NAME, "Controller", "Name of the controller to edit");
- RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the object the controller belongs to");
-}
-
-static int edit_controller_invoke_properties(bContext *C, wmOperator *op)
-{
- PointerRNA ptr = CTX_data_pointer_get_type(C, "controller", &RNA_Controller);
-
- if (RNA_struct_property_is_set(op->ptr, "controller") && RNA_struct_property_is_set(op->ptr, "object") )
- return 1;
-
- if (ptr.data) {
- bController *cont = ptr.data;
- Object *ob = ptr.id.data;
-
- RNA_string_set(op->ptr, "controller", cont->name);
- RNA_string_set(op->ptr, "object", ob->id.name + 2);
- return 1;
- }
-
- return 0;
-}
-
-static bController *edit_controller_property_get(bContext *C, wmOperator *op, Object **ob)
-{
- char controller_name[MAX_NAME];
- bController *cont;
-
- RNA_string_get(op->ptr, "controller", controller_name);
-
- *ob = edit_object_property_get(C, op);
- if (!*ob) return NULL;
-
- cont = BLI_findstring(&((*ob)->controllers), controller_name, offsetof(bController, name));
- return cont;
-}
-
-static void edit_actuator_properties(wmOperatorType *ot)
-{
- RNA_def_string(ot->srna, "actuator", NULL, MAX_NAME, "Actuator", "Name of the actuator to edit");
- RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the object the actuator belongs to");
-}
-
-static int edit_actuator_invoke_properties(bContext *C, wmOperator *op)
-{
- PointerRNA ptr = CTX_data_pointer_get_type(C, "actuator", &RNA_Actuator);
-
- if (RNA_struct_property_is_set(op->ptr, "actuator") && RNA_struct_property_is_set(op->ptr, "object") )
- return 1;
-
- if (ptr.data) {
- bActuator *act = ptr.data;
- Object *ob = ptr.id.data;
-
- RNA_string_set(op->ptr, "actuator", act->name);
- RNA_string_set(op->ptr, "object", ob->id.name + 2);
- return 1;
- }
-
- return 0;
-}
-
-static bActuator *edit_actuator_property_get(bContext *C, wmOperator *op, Object **ob)
-{
- char actuator_name[MAX_NAME];
- bActuator *act;
-
- RNA_string_get(op->ptr, "actuator", actuator_name);
-
- *ob = edit_object_property_get(C, op);
- if (!*ob) return NULL;
-
- act = BLI_findstring(&((*ob)->actuators), actuator_name, offsetof(bActuator, name));
- return act;
-}
-
-static int logicbricks_move_property_get(wmOperator *op)
-{
- int type = RNA_enum_get(op->ptr, "direction");
-
- if (type == 1)
- return true;
- else
- return false;
-}
-
-/* ************* Add/Remove Sensor Operator ************* */
-
-static int sensor_remove_exec(bContext *C, wmOperator *op)
-{
- Object *ob = NULL;
- bSensor *sens = edit_sensor_property_get(C, op, &ob);
-
- if (!sens)
- return OPERATOR_CANCELLED;
-
- BLI_remlink(&(ob->sensors), sens);
- free_sensor(sens);
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static int sensor_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- if (edit_sensor_invoke_properties(C, op))
- return sensor_remove_exec(C, op);
- else
- return OPERATOR_CANCELLED;
-}
-
-static void LOGIC_OT_sensor_remove(wmOperatorType *ot)
-{
- ot->name = "Remove Sensor";
- ot->description = "Remove a sensor from the active object";
- ot->idname = "LOGIC_OT_sensor_remove";
-
- ot->invoke = sensor_remove_invoke;
- ot->exec = sensor_remove_exec;
- ot->poll = edit_sensor_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
- edit_sensor_properties(ot);
-}
-
-static int sensor_add_exec(bContext *C, wmOperator *op)
-{
- Object *ob;
- bSensor *sens;
- PointerRNA sens_ptr;
- PropertyRNA *prop;
- const char *sens_name;
- char name[MAX_NAME];
- int type = RNA_enum_get(op->ptr, "type");
-
- ob = edit_object_property_get(C, op);
- if (!ob)
- return OPERATOR_CANCELLED;
-
- sens = new_sensor(type);
- BLI_addtail(&(ob->sensors), sens);
-
- /* set the sensor name based on rna type enum */
- RNA_pointer_create((ID *)ob, &RNA_Sensor, sens, &sens_ptr);
- prop = RNA_struct_find_property(&sens_ptr, "type");
-
- RNA_string_get(op->ptr, "name", name);
- if (*name) {
- BLI_strncpy(sens->name, name, sizeof(sens->name));
- }
- else {
- RNA_property_enum_name(C, &sens_ptr, prop, RNA_property_enum_get(&sens_ptr, prop), &sens_name);
- BLI_strncpy(sens->name, sens_name, sizeof(sens->name));
- }
-
- BLI_uniquename(&ob->sensors, sens, DATA_("Sensor"), '.', offsetof(bSensor, name), sizeof(sens->name));
- ob->scaflag |= OB_SHOWSENS;
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static void LOGIC_OT_sensor_add(wmOperatorType *ot)
-{
- PropertyRNA *prop;
-
- /* identifiers */
- ot->name = "Add Sensor";
- ot->description = "Add a sensor to the active object";
- ot->idname = "LOGIC_OT_sensor_add";
-
- /* api callbacks */
- ot->invoke = WM_menu_invoke;
- ot->exec = sensor_add_exec;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
-
- /* properties */
- ot->prop = prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
- RNA_def_enum_funcs(prop, rna_Sensor_type_itemf);
- prop = RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the Sensor to add");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- prop = RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the Object to add the Sensor to");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-}
-
-/* ************* Add/Remove Controller Operator ************* */
-
-static int controller_remove_exec(bContext *C, wmOperator *op)
-{
- Object *ob = NULL;
- bController *cont = edit_controller_property_get(C, op, &ob);
-
- if (!cont)
- return OPERATOR_CANCELLED;
-
- BLI_remlink(&(ob->controllers), cont);
- unlink_controller(cont);
- free_controller(cont);
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static int controller_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- if (edit_controller_invoke_properties(C, op))
- return controller_remove_exec(C, op);
- else
- return OPERATOR_CANCELLED;
-}
-
-static void LOGIC_OT_controller_remove(wmOperatorType *ot)
-{
- ot->name = "Remove Controller";
- ot->description = "Remove a controller from the active object";
- ot->idname = "LOGIC_OT_controller_remove";
-
- ot->invoke = controller_remove_invoke;
- ot->exec = controller_remove_exec;
- ot->poll = edit_controller_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
- edit_controller_properties(ot);
-}
-
-static int controller_add_exec(bContext *C, wmOperator *op)
-{
- Object *ob;
- bController *cont;
- PointerRNA cont_ptr;
- PropertyRNA *prop;
- const char *cont_name;
- int bit;
- char name[MAX_NAME];
- int type = RNA_enum_get(op->ptr, "type");
-
- ob = edit_object_property_get(C, op);
- if (!ob)
- return OPERATOR_CANCELLED;
-
- cont = new_controller(type);
- BLI_addtail(&(ob->controllers), cont);
-
- /* set the controller name based on rna type enum */
- RNA_pointer_create((ID *)ob, &RNA_Controller, cont, &cont_ptr);
- prop = RNA_struct_find_property(&cont_ptr, "type");
-
- RNA_string_get(op->ptr, "name", name);
- if (*name) {
- BLI_strncpy(cont->name, name, sizeof(cont->name));
- }
- else {
- RNA_property_enum_name(C, &cont_ptr, prop, RNA_property_enum_get(&cont_ptr, prop), &cont_name);
- BLI_strncpy(cont->name, cont_name, sizeof(cont->name));
- }
-
- BLI_uniquename(&ob->controllers, cont, DATA_("Controller"), '.', offsetof(bController, name), sizeof(cont->name));
-
- /* set the controller state mask from the current object state.
- * A controller is always in a single state, so select the lowest bit set
- * from the object state */
- for (bit = 0; bit < OB_MAX_STATES; bit++) {
- if (ob->state & (1 << bit))
- break;
- }
- cont->state_mask = (1 << bit);
- if (cont->state_mask == 0) {
- /* shouldn't happen, object state is never 0 */
- cont->state_mask = 1;
- }
-
- ob->scaflag |= OB_SHOWCONT;
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static void LOGIC_OT_controller_add(wmOperatorType *ot)
-{
- PropertyRNA *prop;
-
- /* identifiers */
- ot->name = "Add Controller";
- ot->description = "Add a controller to the active object";
- ot->idname = "LOGIC_OT_controller_add";
-
- /* api callbacks */
- ot->invoke = WM_menu_invoke;
- ot->exec = controller_add_exec;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
-
- /* properties */
- ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add");
- prop = RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the Controller to add");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- prop = RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the Object to add the Controller to");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-}
-
-/* ************* Add/Remove Actuator Operator ************* */
-
-static int actuator_remove_exec(bContext *C, wmOperator *op)
-{
- Object *ob = NULL;
- bActuator *act = edit_actuator_property_get(C, op, &ob);
-
- if (!act)
- return OPERATOR_CANCELLED;
-
- BLI_remlink(&(ob->actuators), act);
- unlink_actuator(act);
- free_actuator(act);
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static int actuator_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- if (edit_actuator_invoke_properties(C, op))
- return actuator_remove_exec(C, op);
- else
- return OPERATOR_CANCELLED;
-}
-
-static void LOGIC_OT_actuator_remove(wmOperatorType *ot)
-{
- ot->name = "Remove Actuator";
- ot->description = "Remove an actuator from the active object";
- ot->idname = "LOGIC_OT_actuator_remove";
-
- ot->invoke = actuator_remove_invoke;
- ot->exec = actuator_remove_exec;
- ot->poll = edit_actuator_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
- edit_actuator_properties(ot);
-}
-
-static int actuator_add_exec(bContext *C, wmOperator *op)
-{
- Object *ob;
- bActuator *act;
- PointerRNA act_ptr;
- PropertyRNA *prop;
- const char *act_name;
- char name[MAX_NAME];
- int type = RNA_enum_get(op->ptr, "type");
-
- ob = edit_object_property_get(C, op);
- if (!ob)
- return OPERATOR_CANCELLED;
-
- act = new_actuator(type);
- BLI_addtail(&(ob->actuators), act);
-
- /* set the actuator name based on rna type enum */
- RNA_pointer_create((ID *)ob, &RNA_Actuator, act, &act_ptr);
- prop = RNA_struct_find_property(&act_ptr, "type");
-
- RNA_string_get(op->ptr, "name", name);
- if (*name) {
- BLI_strncpy(act->name, name, sizeof(act->name));
- }
- else {
- RNA_property_enum_name(C, &act_ptr, prop, RNA_property_enum_get(&act_ptr, prop), &act_name);
- BLI_strncpy(act->name, act_name, sizeof(act->name));
- }
-
- BLI_uniquename(&ob->actuators, act, DATA_("Actuator"), '.', offsetof(bActuator, name), sizeof(act->name));
- ob->scaflag |= OB_SHOWACT;
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static void LOGIC_OT_actuator_add(wmOperatorType *ot)
-{
- PropertyRNA *prop;
-
- /* identifiers */
- ot->name = "Add Actuator";
- ot->description = "Add an actuator to the active object";
- ot->idname = "LOGIC_OT_actuator_add";
-
- /* api callbacks */
- ot->invoke = WM_menu_invoke;
- ot->exec = actuator_add_exec;
- ot->poll = ED_operator_object_active_editable;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
-
- /* properties */
- ot->prop = prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
- RNA_def_enum_funcs(prop, rna_Actuator_type_itemf);
- prop = RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the Actuator to add");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- prop = RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the Object to add the Actuator to");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-}
-
-/* ************* Move Logic Bricks Operator ************* */
-static const EnumPropertyItem logicbricks_move_direction[] = {
- {1, "UP", 0, "Move Up", ""},
- {2, "DOWN", 0, "Move Down", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
-
-static int sensor_move_exec(bContext *C, wmOperator *op)
-{
- Object *ob = NULL;
- bSensor *sens = edit_sensor_property_get(C, op, &ob);
- int move_up = logicbricks_move_property_get(op);
-
- if (!sens)
- return OPERATOR_CANCELLED;
-
- sca_move_sensor(sens, ob, move_up);
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static int sensor_move_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- if (edit_sensor_invoke_properties(C, op)) {
- return sensor_move_exec(C, op);
- }
- else
- return OPERATOR_CANCELLED;
-}
-
-static void LOGIC_OT_sensor_move(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Move Sensor";
- ot->description = "Move Sensor";
- ot->idname = "LOGIC_OT_sensor_move";
-
- /* api callbacks */
- ot->invoke = sensor_move_invoke;
- ot->exec = sensor_move_exec;
- ot->poll = edit_sensor_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
-
- /* properties */
- edit_sensor_properties(ot);
- RNA_def_enum(ot->srna, "direction", logicbricks_move_direction, 1, "Direction", "Move Up or Down");
-}
-
-static int controller_move_exec(bContext *C, wmOperator *op)
-{
- Object *ob = NULL;
- bController *cont = edit_controller_property_get(C, op, &ob);
- int move_up = logicbricks_move_property_get(op);
-
- if (!cont)
- return OPERATOR_CANCELLED;
-
- sca_move_controller(cont, ob, move_up);
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static int controller_move_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- if (edit_controller_invoke_properties(C, op)) {
- return controller_move_exec(C, op);
- }
- else
- return OPERATOR_CANCELLED;
-}
-
-static void LOGIC_OT_controller_move(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Move Controller";
- ot->description = "Move Controller";
- ot->idname = "LOGIC_OT_controller_move";
-
- /* api callbacks */
- ot->invoke = controller_move_invoke;
- ot->exec = controller_move_exec;
- ot->poll = edit_controller_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
-
- /* properties */
- edit_controller_properties(ot);
- RNA_def_enum(ot->srna, "direction", logicbricks_move_direction, 1, "Direction", "Move Up or Down");
-}
-
-static int actuator_move_exec(bContext *C, wmOperator *op)
-{
- Object *ob = NULL;
- bActuator *act = edit_actuator_property_get(C, op, &ob);
- int move_up = logicbricks_move_property_get(op);
-
- if (!act)
- return OPERATOR_CANCELLED;
-
- sca_move_actuator(act, ob, move_up);
-
- WM_event_add_notifier(C, NC_LOGIC, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static int actuator_move_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- if (edit_actuator_invoke_properties(C, op)) {
- return actuator_move_exec(C, op);
- }
- else
- return OPERATOR_CANCELLED;
-}
-
-static void LOGIC_OT_actuator_move(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Move Actuator";
- ot->description = "Move Actuator";
- ot->idname = "LOGIC_OT_actuator_move";
-
- /* api callbacks */
- ot->invoke = actuator_move_invoke;
- ot->exec = actuator_move_exec;
- ot->poll = edit_actuator_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
-
- /* properties */
- edit_actuator_properties(ot);
- RNA_def_enum(ot->srna, "direction", logicbricks_move_direction, 1, "Direction", "Move Up or Down");
-}
-
-/* ************************ view ********************* */
-
-static int logic_view_all_exec(bContext *C, wmOperator *op)
-{
- ARegion *ar = CTX_wm_region(C);
- rctf cur_new = ar->v2d.tot;
- float aspect = BLI_rctf_size_y(&ar->v2d.cur) / BLI_rctf_size_x(&ar->v2d.cur);
- const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
-
- /* force the view2d code to zoom to width, not height */
- cur_new.ymin = cur_new.ymax - BLI_rctf_size_x(&cur_new) * aspect;
-
- UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx);
-
- return OPERATOR_FINISHED;
-}
-
-static void LOGIC_OT_view_all(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "View All";
- ot->idname = "LOGIC_OT_view_all";
- ot->description = "Resize view so you can see all logic bricks";
-
- /* api callbacks */
- ot->exec = logic_view_all_exec;
- ot->poll = ED_operator_logic_active;
-
- /* flags */
- ot->flag = 0;
-}
-
-/* ************************* */
-
-void ED_operatortypes_logic(void)
-{
- WM_operatortype_append(LOGIC_OT_sensor_remove);
- WM_operatortype_append(LOGIC_OT_sensor_add);
- WM_operatortype_append(LOGIC_OT_sensor_move);
- WM_operatortype_append(LOGIC_OT_controller_remove);
- WM_operatortype_append(LOGIC_OT_controller_add);
- WM_operatortype_append(LOGIC_OT_controller_move);
- WM_operatortype_append(LOGIC_OT_actuator_remove);
- WM_operatortype_append(LOGIC_OT_actuator_add);
- WM_operatortype_append(LOGIC_OT_actuator_move);
- WM_operatortype_append(LOGIC_OT_view_all);
-}
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
deleted file mode 100644
index 9bdc92f98ab..00000000000
--- a/source/blender/editors/space_logic/logic_window.c
+++ /dev/null
@@ -1,2594 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_logic/logic_window.c
- * \ingroup splogic
- */
-
-
-#include <string.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <float.h>
-
-#include "DNA_actuator_types.h"
-#include "DNA_controller_types.h"
-#include "DNA_property_types.h"
-#include "DNA_space_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_object_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_string_utils.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_action.h"
-#include "BKE_context.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_sca.h"
-
-#include "ED_undo.h"
-
-#include "BLT_translation.h"
-
-#include "UI_interface.h"
-#include "UI_view2d.h"
-
-#include "RNA_access.h"
-
-/* XXX BAD BAD */
-#include "../interface/interface_intern.h"
-
-#include "logic_intern.h"
-
-#define B_REDR 1
-
-#define B_ADD_SENS 2703
-#define B_CHANGE_SENS 2704
-#define B_DEL_SENS 2705
-
-#define B_ADD_CONT 2706
-#define B_CHANGE_CONT 2707
-#define B_DEL_CONT 2708
-
-#define B_ADD_ACT 2709
-#define B_CHANGE_ACT 2710
-#define B_DEL_ACT 2711
-
-#define B_SOUNDACT_BROWSE 2712
-
-#define B_SETPROP 2714
-#define B_SETACTOR 2715
-#define B_SETMAINACTOR 2716
-#define B_SETDYNA 2717
-#define B_SET_STATE_BIT 2718
-#define B_INIT_STATE_BIT 2719
-
-/* proto */
-static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag);
-
-static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
-{
- Main *bmain= CTX_data_main(C);
- bSensor *sens;
- bController *cont;
- bActuator *act;
- Object *ob;
- int didit, bit;
-
- ob= CTX_data_active_object(C);
- if (ob==NULL) return;
-
- switch (event) {
-
- case B_SETPROP:
- /* check for inconsistent types */
- ob->gameflag &= ~(OB_SECTOR|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR);
- break;
-
- case B_SETACTOR:
- case B_SETDYNA:
- case B_SETMAINACTOR:
- ob->gameflag &= ~(OB_SECTOR|OB_PROP);
- break;
-
- case B_ADD_SENS:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- if (ob->scaflag & OB_ADDSENS) {
- ob->scaflag &= ~OB_ADDSENS;
- sens= new_sensor(SENS_ALWAYS);
- BLI_addtail(&(ob->sensors), sens);
- BLI_uniquename(&ob->sensors, sens, DATA_("Sensor"), '.', offsetof(bSensor, name), sizeof(sens->name));
- ob->scaflag |= OB_SHOWSENS;
- }
- }
-
- ED_undo_push(C, "Add sensor");
- break;
-
- case B_CHANGE_SENS:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- sens= ob->sensors.first;
- while (sens) {
- if (sens->type != sens->otype) {
- init_sensor(sens);
- sens->otype= sens->type;
- break;
- }
- sens= sens->next;
- }
- }
- break;
-
- case B_DEL_SENS:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- sens= ob->sensors.first;
- while (sens) {
- if (sens->flag & SENS_DEL) {
- BLI_remlink(&(ob->sensors), sens);
- free_sensor(sens);
- break;
- }
- sens= sens->next;
- }
- }
- ED_undo_push(C, "Delete sensor");
- break;
-
- case B_ADD_CONT:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- if (ob->scaflag & OB_ADDCONT) {
- ob->scaflag &= ~OB_ADDCONT;
- cont= new_controller(CONT_LOGIC_AND);
- BLI_uniquename(&ob->controllers, cont, DATA_("Controller"), '.', offsetof(bController, name), sizeof(cont->name));
- ob->scaflag |= OB_SHOWCONT;
- BLI_addtail(&(ob->controllers), cont);
- /* set the controller state mask from the current object state.
- * A controller is always in a single state, so select the lowest bit set
- * from the object state */
- for (bit=0; bit<32; bit++) {
- if (ob->state & (1<<bit))
- break;
- }
- cont->state_mask = (1<<bit);
- if (cont->state_mask == 0) {
- /* shouldn't happen, object state is never 0 */
- cont->state_mask = 1;
- }
- }
- }
- ED_undo_push(C, "Add controller");
- break;
-
- case B_SET_STATE_BIT:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- if (ob->scaflag & OB_ALLSTATE) {
- ob->scaflag &= ~OB_ALLSTATE;
- ob->state = 0x3FFFFFFF;
- }
- }
- break;
-
- case B_INIT_STATE_BIT:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- if (ob->scaflag & OB_INITSTBIT) {
- ob->scaflag &= ~OB_INITSTBIT;
- ob->state = ob->init_state;
- if (!ob->state)
- ob->state = 1;
- }
- }
- break;
-
- case B_CHANGE_CONT:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- cont= ob->controllers.first;
- while (cont) {
- if (cont->type != cont->otype) {
- init_controller(cont);
- cont->otype= cont->type;
- break;
- }
- cont= cont->next;
- }
- }
- break;
-
-
- case B_DEL_CONT:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- cont= ob->controllers.first;
- while (cont) {
- if (cont->flag & CONT_DEL) {
- BLI_remlink(&(ob->controllers), cont);
- unlink_controller(cont);
- free_controller(cont);
- break;
- }
- cont= cont->next;
- }
- }
- ED_undo_push(C, "Delete controller");
- break;
-
- case B_ADD_ACT:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- if (ob->scaflag & OB_ADDACT) {
- ob->scaflag &= ~OB_ADDACT;
- act= new_actuator(ACT_OBJECT);
- BLI_uniquename(&ob->actuators, act, DATA_("Actuator"), '.', offsetof(bActuator, name), sizeof(act->name));
- BLI_addtail(&(ob->actuators), act);
- ob->scaflag |= OB_SHOWACT;
- }
- }
- ED_undo_push(C, "Add actuator");
- break;
-
- case B_CHANGE_ACT:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- act= ob->actuators.first;
- while (act) {
- if (act->type != act->otype) {
- init_actuator(act);
- act->otype= act->type;
- break;
- }
- act= act->next;
- }
- }
- break;
-
- case B_DEL_ACT:
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- act= ob->actuators.first;
- while (act) {
- if (act->flag & ACT_DEL) {
- BLI_remlink(&(ob->actuators), act);
- unlink_actuator(act);
- free_actuator(act);
- break;
- }
- act= act->next;
- }
- }
- ED_undo_push(C, "Delete actuator");
- break;
-
- case B_SOUNDACT_BROWSE:
- /* since we don't know which... */
- didit= 0;
- for (ob=bmain->object.first; ob; ob=ob->id.next) {
- act= ob->actuators.first;
- while (act) {
- if (act->type==ACT_SOUND) {
- bSoundActuator *sa= act->data;
- if (sa->sndnr) {
- ID *sound= bmain->sound.first;
- int nr= 1;
-
- if (sa->sndnr == -2) {
-// XXX activate_databrowse((ID *)bmain->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE,
-// &sa->sndnr, do_logic_buts);
- break;
- }
-
- while (sound) {
- if (nr==sa->sndnr)
- break;
- nr++;
- sound= sound->next;
- }
-
- if (sa->sound)
- id_us_min(((ID *)sa->sound));
-
- sa->sound= (struct bSound *)sound;
-
- if (sound) {
- id_us_plus(sound);
- }
-
- sa->sndnr= 0;
- didit= 1;
- }
- }
- act= act->next;
- }
- if (didit)
- break;
- }
-
- break;
- }
-}
-
-
-static const char *sensor_name(int type)
-{
- switch (type) {
- case SENS_ALWAYS:
- return N_("Always");
- case SENS_NEAR:
- return N_("Near");
- case SENS_KEYBOARD:
- return N_("Keyboard");
- case SENS_PROPERTY:
- return N_("Property");
- case SENS_ARMATURE:
- return N_("Armature");
- case SENS_ACTUATOR:
- return N_("Actuator");
- case SENS_DELAY:
- return N_("Delay");
- case SENS_MOUSE:
- return N_("Mouse");
- case SENS_COLLISION:
- return N_("Collision");
- case SENS_RADAR:
- return N_("Radar");
- case SENS_RANDOM:
- return N_("Random");
- case SENS_RAY:
- return N_("Ray");
- case SENS_MESSAGE:
- return N_("Message");
- case SENS_JOYSTICK:
- return N_("Joystick");
- }
- return N_("Unknown");
-}
-
-static const char *controller_name(int type)
-{
- switch (type) {
- case CONT_LOGIC_AND:
- return N_("And");
- case CONT_LOGIC_OR:
- return N_("Or");
- case CONT_LOGIC_NAND:
- return N_("Nand");
- case CONT_LOGIC_NOR:
- return N_("Nor");
- case CONT_LOGIC_XOR:
- return N_("Xor");
- case CONT_LOGIC_XNOR:
- return N_("Xnor");
- case CONT_EXPRESSION:
- return N_("Expression");
- case CONT_PYTHON:
- return N_("Python");
- }
- return N_("Unknown");
-}
-
-static const char *actuator_name(int type)
-{
- switch (type) {
- case ACT_SHAPEACTION:
- return N_("Shape Action");
- case ACT_ACTION:
- return N_("Action");
- case ACT_OBJECT:
- return N_("Motion");
- case ACT_LAMP:
- return N_("Lamp");
- case ACT_CAMERA:
- return N_("Camera");
- case ACT_MATERIAL:
- return N_("Material");
- case ACT_SOUND:
- return N_("Sound");
- case ACT_PROPERTY:
- return N_("Property");
- case ACT_EDIT_OBJECT:
- return N_("Edit Object");
- case ACT_CONSTRAINT:
- return N_("Constraint");
- case ACT_SCENE:
- return N_("Scene");
- case ACT_GROUP:
- return N_("Group");
- case ACT_RANDOM:
- return N_("Random");
- case ACT_MESSAGE:
- return N_("Message");
- case ACT_GAME:
- return N_("Game");
- case ACT_VISIBILITY:
- return N_("Visibility");
- case ACT_2DFILTER:
- return N_("Filter 2D");
- case ACT_PARENT:
- return N_("Parent");
- case ACT_STATE:
- return N_("State");
- case ACT_ARMATURE:
- return N_("Armature");
- case ACT_STEERING:
- return N_("Steering");
- case ACT_MOUSE:
- return N_("Mouse");
- }
- return N_("Unknown");
-}
-
-static void set_sca_ob(Object *ob)
-{
- bController *cont;
- bActuator *act;
-
- cont= ob->controllers.first;
- while (cont) {
- cont->mynew= (bController *)ob;
- cont= cont->next;
- }
- act= ob->actuators.first;
- while (act) {
- act->mynew= (bActuator *)ob;
- act= act->next;
- }
-}
-
-static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag)
-{
- Base *base;
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob, *obt, *obact = CTX_data_active_object(C);
- ID **idar;
- bSensor *sens;
- bController *cont;
- int a, nr, do_it;
-
- /* we need a sorted object list */
- /* set scavisflags flags in Objects to indicate these should be evaluated */
- /* also hide ob pointers in ->new entries of controllerss/actuators */
-
- *count= 0;
-
- if (scene==NULL) return NULL;
-
- ob= bmain->object.first;
- while (ob) {
- ob->scavisflag= 0;
- set_sca_ob(ob);
- ob= ob->id.next;
- }
-
- for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if ((base->flag & BASE_VISIBLED) && (base->flag & SELECT)) {
- if (scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
- if (scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
- if (scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT;
- }
- }
-
- if (obact) {
- if (scavisflag & BUTS_SENS_ACT) obact->scavisflag |= OB_VIS_SENS;
- if (scavisflag & BUTS_CONT_ACT) obact->scavisflag |= OB_VIS_CONT;
- if (scavisflag & BUTS_ACT_ACT) obact->scavisflag |= OB_VIS_ACT;
- }
-
- /* BUTS_XXX_STATE are similar to BUTS_XXX_LINK for selecting the object */
- if (scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) {
- do_it = true;
- while (do_it) {
- do_it = false;
-
- ob= bmain->object.first;
- while (ob) {
-
- /* 1st case: select sensor when controller selected */
- if ((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) {
- sens= ob->sensors.first;
- while (sens) {
- for (a=0; a<sens->totlinks; a++) {
- if (sens->links[a]) {
- obt= (Object *)sens->links[a]->mynew;
- if (obt && (obt->scavisflag & OB_VIS_CONT)) {
- do_it = true;
- ob->scavisflag |= OB_VIS_SENS;
- break;
- }
- }
- }
- if (do_it) break;
- sens= sens->next;
- }
- }
-
- /* 2nd case: select cont when act selected */
- if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) {
- cont= ob->controllers.first;
- while (cont) {
- for (a=0; a<cont->totlinks; a++) {
- if (cont->links[a]) {
- obt= (Object *)cont->links[a]->mynew;
- if (obt && (obt->scavisflag & OB_VIS_ACT)) {
- do_it = true;
- ob->scavisflag |= OB_VIS_CONT;
- break;
- }
- }
- }
- if (do_it) break;
- cont= cont->next;
- }
- }
-
- /* 3rd case: select controller when sensor selected */
- if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) {
- sens= ob->sensors.first;
- while (sens) {
- for (a=0; a<sens->totlinks; a++) {
- if (sens->links[a]) {
- obt= (Object *)sens->links[a]->mynew;
- if (obt && (obt->scavisflag & OB_VIS_CONT)==0) {
- do_it = true;
- obt->scavisflag |= OB_VIS_CONT;
- }
- }
- }
- sens= sens->next;
- }
- }
-
- /* 4th case: select actuator when controller selected */
- if ((scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE)) && (ob->scavisflag & OB_VIS_CONT)) {
- cont= ob->controllers.first;
- while (cont) {
- for (a=0; a<cont->totlinks; a++) {
- if (cont->links[a]) {
- obt= (Object *)cont->links[a]->mynew;
- if (obt && (obt->scavisflag & OB_VIS_ACT)==0) {
- do_it = true;
- obt->scavisflag |= OB_VIS_ACT;
- }
- }
- }
- cont= cont->next;
- }
-
- }
- ob= ob->id.next;
- }
- }
- }
-
- /* now we count */
- ob= bmain->object.first;
- while (ob) {
- if ( ob->scavisflag ) (*count)++;
- ob= ob->id.next;
- }
-
- if (*count == 0) return NULL;
- if (*count > 24) *count = 24; /* temporal */
-
- idar= MEM_callocN((*count)*sizeof(void *), "idar");
-
- ob= bmain->object.first;
- nr= 0;
-
- /* make the active object always the first one of the list */
- if (obact) {
- idar[0] = (ID *)obact;
- nr++;
- }
-
- while (ob) {
- if ((ob->scavisflag) && (ob != obact)) {
- idar[nr] = (ID *)ob;
- nr++;
- }
- if (nr >= 24) break;
- ob= ob->id.next;
- }
-
- /* just to be sure... these were set in set_sca_done_ob() */
- clear_sca_new_poins();
-
- return idar;
-}
-
-static void get_armature_bone_constraint(Object *ob, const char *posechannel, const char *constraint_name, bConstraint **constraint)
-{
- /* check that bone exist in the active object */
- if (ob->type == OB_ARMATURE && ob->pose) {
- bPoseChannel *pchan= BKE_pose_channel_find_name(ob->pose, posechannel);
- if (pchan) {
- bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name));
- if (con) {
- *constraint= con;
- }
- }
- }
- /* didn't find any */
-}
-
-static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event)
-{
- SpaceLogic *slogic= CTX_wm_space_logic(C);
- ID **idar;
- Object *ob;
- bSensor *sens;
- short count, a;
-
- idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
-
- for (a=0; a<count; a++) {
- ob= (Object *)idar[a];
- if (event==0 || event==2) ob->scaflag |= OB_SHOWSENS;
- else if (event==1) ob->scaflag &= ~OB_SHOWSENS;
- }
-
- for (a=0; a<count; a++) {
- ob= (Object *)idar[a];
- sens= ob->sensors.first;
- while (sens) {
- if (event==2) sens->flag |= SENS_SHOW;
- else if (event==3) sens->flag &= ~SENS_SHOW;
- sens= sens->next;
- }
- }
-
- if (idar) MEM_freeN(idar);
-}
-
-static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
-{
- uiBlock *block;
- int yco=0;
-
- block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN);
- UI_block_func_butmenu_set(block, do_sensor_menu, NULL);
-
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- UI_block_direction_set(block, UI_DIR_UP);
- UI_block_end(C, block);
-
- return block;
-}
-
-static void do_controller_menu(bContext *C, void *UNUSED(arg), int event)
-{
- SpaceLogic *slogic= CTX_wm_space_logic(C);
- ID **idar;
- Object *ob;
- bController *cont;
- short count, a;
-
- idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
-
- for (a=0; a<count; a++) {
- ob= (Object *)idar[a];
- if (event==0 || event==2) ob->scaflag |= OB_SHOWCONT;
- else if (event==1) ob->scaflag &= ~OB_SHOWCONT;
- }
-
- for (a=0; a<count; a++) {
- ob= (Object *)idar[a];
- cont= ob->controllers.first;
- while (cont) {
- if (event==2) cont->flag |= CONT_SHOW;
- else if (event==3) cont->flag &= ~CONT_SHOW;
- cont= cont->next;
- }
- }
-
- if (idar) MEM_freeN(idar);
-}
-
-static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
-{
- uiBlock *block;
- int yco=0;
-
- block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN);
- UI_block_func_butmenu_set(block, do_controller_menu, NULL);
-
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, "");
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, "");
-
- UI_block_direction_set(block, UI_DIR_UP);
- UI_block_end(C, block);
-
- return block;
-}
-
-static void do_actuator_menu(bContext *C, void *UNUSED(arg), int event)
-{
- SpaceLogic *slogic= CTX_wm_space_logic(C);
- ID **idar;
- Object *ob;
- bActuator *act;
- short count, a;
-
- idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
-
- for (a=0; a<count; a++) {
- ob= (Object *)idar[a];
- if (event==0 || event==2) ob->scaflag |= OB_SHOWACT;
- else if (event==1) ob->scaflag &= ~OB_SHOWACT;
- }
-
- for (a=0; a<count; a++) {
- ob= (Object *)idar[a];
- act= ob->actuators.first;
- while (act) {
- if (event==2) act->flag |= ACT_SHOW;
- else if (event==3) act->flag &= ~ACT_SHOW;
- act= act->next;
- }
- }
-
- if (idar) MEM_freeN(idar);
-}
-
-static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
-{
- uiBlock *block;
- int xco=0;
-
- block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN);
- UI_block_func_butmenu_set(block, do_actuator_menu, NULL);
-
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- UI_block_direction_set(block, UI_DIR_UP);
- UI_block_end(C, block);
-
- return block;
-}
-
-static void check_controller_state_mask(bContext *UNUSED(C), void *arg1_but, void *arg2_mask)
-{
- unsigned int *cont_mask = arg2_mask;
- uiBut *but = arg1_but;
-
- /* a controller is always in a single state */
- *cont_mask = (1<<but->retval);
- but->retval = B_REDR;
-}
-
-static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_cont)
-{
- uiBlock *block;
- uiBut *but;
- bController *cont = arg_cont;
-
- short yco = 12, xco = 0, stbit, offset;
-
- block= UI_block_begin(C, ar, __func__, UI_EMBOSS);
-
- /* use this for a fake extra empy space around the buttons */
- uiDefBut(block, UI_BTYPE_LABEL, 0, "", -5, -5, 200, 34, NULL, 0, 0, 0, 0, "");
-
- for (offset=0; offset<15; offset += 5) {
- UI_block_align_begin(block);
- for (stbit=0; stbit<5; stbit++) {
- but = uiDefButBitI(block, UI_BTYPE_TOGGLE, (1<<(stbit+offset)), (stbit+offset), "", (short)(xco+12*stbit+13*offset), yco, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, "");
- UI_but_func_set(but, check_controller_state_mask, but, &(cont->state_mask));
- }
- for (stbit=0; stbit<5; stbit++) {
- but = uiDefButBitI(block, UI_BTYPE_TOGGLE, (1<<(stbit+offset+15)), (stbit+offset+15), "", (short)(xco+12*stbit+13*offset), yco-12, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, "");
- UI_but_func_set(but, check_controller_state_mask, but, &(cont->state_mask));
- }
- }
- UI_block_align_end(block);
-
- UI_block_direction_set(block, UI_DIR_UP);
- UI_block_end(C, block);
-
- return block;
-}
-
-static bool is_sensor_linked(uiBlock *block, bSensor *sens)
-{
- bController *cont;
- int i;
-
- for (i=0; i<sens->totlinks; i++) {
- cont = sens->links[i];
- if (UI_block_links_find_inlink(block, cont) != NULL)
- return 1;
- }
- return 0;
-}
-
-/* Sensors code */
-
-static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr)
-{
- uiLayout *box, *row, *sub;
- bSensor *sens= (bSensor *)ptr->data;
-
- box = uiLayoutBox(layout);
- row = uiLayoutRow(box, false);
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemR(sub, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
- if (RNA_boolean_get(ptr, "show_expanded")) {
- uiItemR(sub, ptr, "type", 0, "", ICON_NONE);
- uiItemR(sub, ptr, "name", 0, "", ICON_NONE);
- }
- else {
- uiItemL(sub, IFACE_(sensor_name(sens->type)), ICON_NONE);
- uiItemL(sub, sens->name, ICON_NONE);
- }
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, (((RNA_boolean_get(logic_ptr, "show_sensors_active_states") &&
- RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")) &&
- RNA_boolean_get(ptr, "active")));
- uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
-
- if (RNA_boolean_get(ptr, "show_expanded")==0) {
- sub = uiLayoutRow(row, true);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up
- uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down
- }
-
- sub = uiLayoutRow(row, false);
- uiItemR(sub, ptr, "active", 0, "", ICON_NONE);
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemO(sub, "", ICON_X, "LOGIC_OT_sensor_remove");
-}
-
-static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *box, *split, *sub, *row;
-
- box = uiLayoutBox(layout);
- uiLayoutSetActive(box, RNA_boolean_get(ptr, "active"));
- split = uiLayoutSplit(box, 0.45f, false);
-
- row = uiLayoutRow(split, true);
- uiItemR(row, ptr, "use_pulse_true_level", 0, "", ICON_DOTSUP);
- uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN);
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") ||
- RNA_boolean_get(ptr, "use_pulse_false_level")));
- uiItemR(sub, ptr, "tick_skip", 0, IFACE_("Skip"), ICON_NONE);
-
- row = uiLayoutRow(split, true);
- uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, IFACE_("Invert"), ICON_NONE);
-}
-/* sensors in alphabetical order */
-
-static void draw_sensor_actuator(uiLayout *layout, PointerRNA *ptr)
-{
- Object *ob = (Object *)ptr->id.data;
- PointerRNA settings_ptr;
-
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- uiItemPointerR(layout, ptr, "actuator", &settings_ptr, "actuators", NULL, ICON_LOGIC);
-}
-
-static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
-{
- bSensor *sens = (bSensor *)ptr->data;
- bArmatureSensor *as = (bArmatureSensor *) sens->data;
- Object *ob = (Object *)ptr->id.data;
- uiLayout *row;
-
- if (ob->type != OB_ARMATURE) {
- uiItemL(layout, IFACE_("Sensor only available for armatures"), ICON_NONE);
- return;
- }
-
- if (ob->pose) {
- PointerRNA pose_ptr, pchan_ptr;
- PropertyRNA *bones_prop;
-
- RNA_pointer_create((ID *)ob, &RNA_Pose, ob->pose, &pose_ptr);
- bones_prop = RNA_struct_find_property(&pose_ptr, "bones");
-
- uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
-
- if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, as->posechannel, &pchan_ptr))
- uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE);
- }
- row = uiLayoutRow(layout, true);
- uiItemR(row, ptr, "test_type", 0, NULL, ICON_NONE);
- if (RNA_enum_get(ptr, "test_type") != SENS_ARM_STATE_CHANGED)
- uiItemR(row, ptr, "value", 0, NULL, ICON_NONE);
-}
-
-static void draw_sensor_collision(uiLayout *layout, PointerRNA *ptr, bContext *C)
-{
- uiLayout *row, *split;
- PointerRNA main_ptr;
-
- RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
-
- split = uiLayoutSplit(layout, 0.3f, false);
- row = uiLayoutRow(split, true);
- uiItemR(row, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemR(row, ptr, "use_material", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- switch (RNA_boolean_get(ptr, "use_material")) {
- case SENS_COLLISION_PROPERTY:
- uiItemR(split, ptr, "property", 0, NULL, ICON_NONE);
- break;
- case SENS_COLLISION_MATERIAL:
- uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA);
- break;
- }
-}
-
-static void draw_sensor_delay(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *row;
-
- row = uiLayoutRow(layout, false);
-
- uiItemR(row, ptr, "delay", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "duration", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "use_repeat", 0, NULL, ICON_NONE);
-}
-
-static void draw_sensor_joystick(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *col, *row;
-
- uiItemR(layout, ptr, "joystick_index", 0, NULL, ICON_NONE);
- uiItemR(layout, ptr, "event_type", 0, NULL, ICON_NONE);
-
- switch (RNA_enum_get(ptr, "event_type")) {
- case SENS_JOY_BUTTON:
- uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE);
-
- col = uiLayoutColumn(layout, false);
- uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == false);
- uiItemR(col, ptr, "button_number", 0, NULL, ICON_NONE);
- break;
- case SENS_JOY_AXIS:
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "axis_number", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NONE);
-
- uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, false);
- uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == false);
- uiItemR(col, ptr, "axis_direction", 0, NULL, ICON_NONE);
- break;
- case SENS_JOY_HAT:
- uiItemR(layout, ptr, "hat_number", 0, NULL, ICON_NONE);
- uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE);
-
- col = uiLayoutColumn(layout, false);
- uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == false);
- uiItemR(col, ptr, "hat_direction", 0, NULL, ICON_NONE);
- break;
- case SENS_JOY_AXIS_SINGLE:
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "single_axis_number", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NONE);
- break;
- }
-}
-
-static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
-{
- Object *ob = (Object *)ptr->id.data;
- PointerRNA settings_ptr;
- uiLayout *row, *col;
-
- row = uiLayoutRow(layout, false);
- uiItemL(row, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Key:"), ICON_NONE);
- col = uiLayoutColumn(row, false);
- uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == false);
- uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE);
- col = uiLayoutColumn(row, false);
- uiItemR(col, ptr, "use_all_keys", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- col = uiLayoutColumn(layout, false);
- uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == false);
- row = uiLayoutRow(col, false);
- uiItemL(row, IFACE_("First Modifier:"), ICON_NONE);
- uiItemR(row, ptr, "modifier_key_1", UI_ITEM_R_EVENT, "", ICON_NONE);
-
- row = uiLayoutRow(col, false);
- uiItemL(row, IFACE_("Second Modifier:"), ICON_NONE);
- uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", ICON_NONE);
-
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- uiItemPointerR(layout, ptr, "log", &settings_ptr, "properties", NULL, ICON_NONE);
- uiItemPointerR(layout, ptr, "target", &settings_ptr, "properties", NULL, ICON_NONE);
-}
-
-static void draw_sensor_message(uiLayout *layout, PointerRNA *ptr)
-{
- uiItemR(layout, ptr, "subject", 0, NULL, ICON_NONE);
-}
-
-static void draw_sensor_mouse(uiLayout *layout, PointerRNA *ptr, bContext *C)
-{
- uiLayout *split, *split2;
- PointerRNA main_ptr;
-
- split = uiLayoutSplit(layout, 0.8f, false);
- uiItemR(split, ptr, "mouse_event", 0, NULL, ICON_NONE);
-
- if (RNA_enum_get(ptr, "mouse_event") == BL_SENS_MOUSE_MOUSEOVER_ANY) {
- uiItemR(split, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.3f, false);
- uiItemR(split, ptr, "use_material", 0, "", ICON_NONE);
-
- split2 = uiLayoutSplit(split, 0.7f, false);
- if (RNA_enum_get(ptr, "use_material") == SENS_RAY_PROPERTY) {
- uiItemR(split2, ptr, "property", 0, "", ICON_NONE);
- }
- else {
- RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
- uiItemPointerR(split2, ptr, "material", &main_ptr, "materials", "", ICON_MATERIAL_DATA);
- }
- uiItemR(split2, ptr, "use_x_ray", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- }
-}
-
-static void draw_sensor_near(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *row;
-
- uiItemR(layout, ptr, "property", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, true);
- uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "reset_distance", 0, NULL, ICON_NONE);
-}
-
-static void draw_sensor_property(uiLayout *layout, PointerRNA *ptr)
-{
- Object *ob = (Object *)ptr->id.data;
- PointerRNA settings_ptr;
-
- uiLayout *row;
- uiItemR(layout, ptr, "evaluation_type", 0, NULL, ICON_NONE);
-
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
-
- switch (RNA_enum_get(ptr, "evaluation_type")) {
- case SENS_PROP_INTERVAL:
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "value_min", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "value_max", 0, NULL, ICON_NONE);
- break;
- case SENS_PROP_EQUAL:
- case SENS_PROP_NEQUAL:
- case SENS_PROP_LESSTHAN:
- case SENS_PROP_GREATERTHAN:
- uiItemR(layout, ptr, "value", 0, NULL, ICON_NONE);
- break;
- case SENS_PROP_CHANGED:
- break;
- }
-}
-
-static void draw_sensor_radar(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *row;
-
- uiItemR(layout, ptr, "property", 0, NULL, ICON_NONE);
- uiItemR(layout, ptr, "axis", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "angle", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE);
-}
-
-static void draw_sensor_random(uiLayout *layout, PointerRNA *ptr)
-{
- uiItemR(layout, ptr, "seed", 0, NULL, ICON_NONE);
-}
-
-static void draw_sensor_ray(uiLayout *layout, PointerRNA *ptr, bContext *C)
-{
- uiLayout *split, *row;
- PointerRNA main_ptr;
-
- RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
- split = uiLayoutSplit(layout, 0.3f, false);
- uiItemR(split, ptr, "ray_type", 0, "", ICON_NONE);
- switch (RNA_enum_get(ptr, "ray_type")) {
- case SENS_RAY_PROPERTY:
- uiItemR(split, ptr, "property", 0, "", ICON_NONE);
- break;
- case SENS_RAY_MATERIAL:
- uiItemPointerR(split, ptr, "material", &main_ptr, "materials", "", ICON_MATERIAL_DATA);
- break;
- }
-
- split = uiLayoutSplit(layout, 0.3, false);
- uiItemR(split, ptr, "axis", 0, "", ICON_NONE);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "range", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "use_x_ray", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-}
-
-static void draw_brick_sensor(uiLayout *layout, PointerRNA *ptr, bContext *C)
-{
- uiLayout *box;
-
- if (!RNA_boolean_get(ptr, "show_expanded"))
- return;
-
- draw_sensor_internal_header(layout, ptr);
-
- box = uiLayoutBox(layout);
- uiLayoutSetActive(box, RNA_boolean_get(ptr, "active"));
-
- switch (RNA_enum_get(ptr, "type")) {
-
- case SENS_ACTUATOR:
- draw_sensor_actuator(box, ptr);
- break;
- case SENS_ALWAYS:
- break;
- case SENS_ARMATURE:
- draw_sensor_armature(box, ptr);
- break;
- case SENS_COLLISION:
- draw_sensor_collision(box, ptr, C);
- break;
- case SENS_DELAY:
- draw_sensor_delay(box, ptr);
- break;
- case SENS_JOYSTICK:
- draw_sensor_joystick(box, ptr);
- break;
- case SENS_KEYBOARD:
- draw_sensor_keyboard(box, ptr);
- break;
- case SENS_MESSAGE:
- draw_sensor_message(box, ptr);
- break;
- case SENS_MOUSE:
- draw_sensor_mouse(box, ptr, C);
- break;
- case SENS_NEAR:
- draw_sensor_near(box, ptr);
- break;
- case SENS_PROPERTY:
- draw_sensor_property(box, ptr);
- break;
- case SENS_RADAR:
- draw_sensor_radar(box, ptr);
- break;
- case SENS_RANDOM:
- draw_sensor_random(box, ptr);
- break;
- case SENS_RAY:
- draw_sensor_ray(box, ptr, C);
- break;
- }
-}
-
-/* Controller code */
-static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, int width, int yco)
-{
- uiLayout *box, *row, *sub;
- bController *cont= (bController *)ptr->data;
-
- char state[3];
- BLI_snprintf(state, sizeof(state), "%d", RNA_int_get(ptr, "states"));
-
- box = uiLayoutBox(layout);
- row = uiLayoutRow(box, false);
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemR(sub, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
- if (RNA_boolean_get(ptr, "show_expanded")) {
- uiItemR(sub, ptr, "type", 0, "", ICON_NONE);
- uiItemR(sub, ptr, "name", 0, "", ICON_NONE);
- /* XXX provisory for Blender 2.50Beta */
- uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, IFACE_("Set controller state index (from 1 to 30)"));
- }
- else {
- uiItemL(sub, IFACE_(controller_name(cont->type)), ICON_NONE);
- uiItemL(sub, cont->name, ICON_NONE);
- uiItemL(sub, state, ICON_NONE);
- }
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemR(sub, ptr, "use_priority", 0, "", ICON_NONE);
-
- if (RNA_boolean_get(ptr, "show_expanded")==0) {
- sub = uiLayoutRow(row, true);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up
- uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down
- }
-
- sub = uiLayoutRow(row, false);
- uiItemR(sub, ptr, "active", 0, "", ICON_NONE);
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemO(sub, "", ICON_X, "LOGIC_OT_controller_remove");
-}
-
-static void draw_controller_expression(uiLayout *layout, PointerRNA *ptr)
-{
- uiItemR(layout, ptr, "expression", 0, "", ICON_NONE);
-}
-
-static void draw_controller_python(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *split, *sub;
-
- split = uiLayoutSplit(layout, 0.3, true);
- uiItemR(split, ptr, "mode", 0, "", ICON_NONE);
- if (RNA_enum_get(ptr, "mode") == CONT_PY_SCRIPT) {
- uiItemR(split, ptr, "text", 0, "", ICON_NONE);
- }
- else {
- sub = uiLayoutSplit(split, 0.8f, false);
- uiItemR(sub, ptr, "module", 0, "", ICON_NONE);
- uiItemR(sub, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- }
-}
-
-static void draw_controller_state(uiLayout *UNUSED(layout), PointerRNA *UNUSED(ptr))
-{
-
-}
-
-static void draw_brick_controller(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *box;
-
- if (!RNA_boolean_get(ptr, "show_expanded"))
- return;
-
- box = uiLayoutBox(layout);
- uiLayoutSetActive(box, RNA_boolean_get(ptr, "active"));
-
- draw_controller_state(box, ptr);
-
- switch (RNA_enum_get(ptr, "type")) {
- case CONT_LOGIC_AND:
- break;
- case CONT_LOGIC_OR:
- break;
- case CONT_EXPRESSION:
- draw_controller_expression(box, ptr);
- break;
- case CONT_PYTHON:
- draw_controller_python(box, ptr);
- break;
- case CONT_LOGIC_NAND:
- break;
- case CONT_LOGIC_NOR:
- break;
- case CONT_LOGIC_XOR:
- break;
- case CONT_LOGIC_XNOR:
- break;
- }
-}
-
-/* Actuator code */
-static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr)
-{
- uiLayout *box, *row, *sub;
- bActuator *act= (bActuator *)ptr->data;
-
- box = uiLayoutBox(layout);
- row = uiLayoutRow(box, false);
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemR(sub, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
- if (RNA_boolean_get(ptr, "show_expanded")) {
- uiItemR(sub, ptr, "type", 0, "", ICON_NONE);
- uiItemR(sub, ptr, "name", 0, "", ICON_NONE);
- }
- else {
- uiItemL(sub, IFACE_(actuator_name(act->type)), ICON_NONE);
- uiItemL(sub, act->name, ICON_NONE);
- }
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, (((RNA_boolean_get(logic_ptr, "show_actuators_active_states") &&
- RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")) &&
- RNA_boolean_get(ptr, "active")));
- uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
-
- if (RNA_boolean_get(ptr, "show_expanded")==0) {
- sub = uiLayoutRow(row, true);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up
- uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down
- }
-
- sub = uiLayoutRow(row, false);
- uiItemR(sub, ptr, "active", 0, "", ICON_NONE);
-
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active"));
- uiItemO(sub, "", ICON_X, "LOGIC_OT_actuator_remove");
-}
-
-static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
-{
- Object *ob = (Object *)ptr->id.data;
- PointerRNA settings_ptr;
- uiLayout *row, *sub;
-
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "play_mode", 0, "", ICON_NONE);
-
- sub = uiLayoutRow(row, true);
- uiItemR(sub, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemR(sub, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- row = uiLayoutColumn(sub, false);
- uiLayoutSetActive(row, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force")));
- uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "action", 0, "", ICON_NONE);
- uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- if ((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP))
- uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
-
- else {
- uiItemR(row, ptr, "frame_start", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "frame_end", 0, NULL, ICON_NONE);
- }
-
- uiItemR(row, ptr, "apply_to_children", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "priority", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "layer", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "layer_weight", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "blend_mode", 0, "", ICON_NONE);
-
- uiItemPointerR(layout, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE);
-
-#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
- uiItemR(layout, "stride_length", 0, NULL, ICON_NONE);
-#endif
-}
-
-static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
-{
- bActuator *act = (bActuator *)ptr->data;
- bArmatureActuator *aa = (bArmatureActuator *) act->data;
- Object *ob = (Object *)ptr->id.data;
- bConstraint *constraint = NULL;
- PointerRNA pose_ptr, pchan_ptr;
- PropertyRNA *bones_prop = NULL;
-
- if (ob->type != OB_ARMATURE) {
- uiItemL(layout, IFACE_("Actuator only available for armatures"), ICON_NONE);
- return;
- }
-
- if (ob->pose) {
- RNA_pointer_create((ID *)ob, &RNA_Pose, ob->pose, &pose_ptr);
- bones_prop = RNA_struct_find_property(&pose_ptr, "bones");
- }
-
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
-
- switch (RNA_enum_get(ptr, "mode")) {
- case ACT_ARM_RUN:
- break;
- case ACT_ARM_ENABLE:
- case ACT_ARM_DISABLE:
- if (ob->pose) {
- uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
-
- if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
- uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE);
- }
- break;
- case ACT_ARM_SETTARGET:
- if (ob->pose) {
- uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
-
- if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
- uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE);
- }
-
- uiItemR(layout, ptr, "target", 0, NULL, ICON_NONE);
-
- /* show second target only if the constraint supports it */
- get_armature_bone_constraint(ob, aa->posechannel, aa->constraint, &constraint);
- if (constraint && constraint->type == CONSTRAINT_TYPE_KINEMATIC) {
- uiItemR(layout, ptr, "secondary_target", 0, NULL, ICON_NONE);
- }
- break;
- case ACT_ARM_SETWEIGHT:
- if (ob->pose) {
- uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
-
- if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
- uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE);
- }
-
- uiItemR(layout, ptr, "weight", 0, NULL, ICON_NONE);
- break;
- case ACT_ARM_SETINFLUENCE:
- if (ob->pose) {
- uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
-
- if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
- uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE);
- }
-
- uiItemR(layout, ptr, "influence", 0, NULL, ICON_NONE);
- break;
- }
-}
-
-static void draw_actuator_camera(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *row;
- uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "height", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "axis", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, true);
- uiItemR(row, ptr, "min", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "max", 0, NULL, ICON_NONE);
-
- uiItemR(layout, ptr, "damping", 0, NULL, ICON_NONE);
-}
-
-static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext *C)
-{
- uiLayout *row, *col, *sub, *split;
- PointerRNA main_ptr;
-
- RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
-
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode")) {
- case ACT_CONST_TYPE_LOC:
- uiItemR(layout, ptr, "limit", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, true);
- uiItemR(row, ptr, "limit_min", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "limit_max", 0, NULL, ICON_NONE);
-
- uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- break;
-
- case ACT_CONST_TYPE_DIST:
- split = uiLayoutSplit(layout, 0.8, false);
- uiItemR(split, ptr, "direction", 0, NULL, ICON_NONE);
- row = uiLayoutRow(split, true);
- uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemR(row, ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- col = uiLayoutColumn(row, true);
- uiItemL(col, IFACE_("Range:"), ICON_NONE);
- uiItemR(col, ptr, "range", 0, "", ICON_NONE);
-
- col = uiLayoutColumn(row, true);
- uiItemR(col, ptr, "use_force_distance", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, false);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance") == true);
- uiItemR(sub, ptr, "distance", 0, "", ICON_NONE);
-
- uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.15f, false);
- uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- if (RNA_boolean_get(ptr, "use_material_detect"))
- uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA);
- else
- uiItemR(split, ptr, "property", 0, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.15, false);
- uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- row = uiLayoutRow(split, true);
- uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- break;
-
- case ACT_CONST_TYPE_ORI:
- uiItemR(layout, ptr, "direction_axis_pos", 0, NULL, ICON_NONE);
-
- row=uiLayoutRow(layout, true);
- uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
-
- row=uiLayoutRow(layout, false);
- uiItemR(row, ptr, "rotation_max", 0, NULL, ICON_NONE);
-
- row=uiLayoutRow(layout, true);
- uiItemR(row, ptr, "angle_min", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "angle_max", 0, NULL, ICON_NONE);
- break;
-
- case ACT_CONST_TYPE_FH:
- split = uiLayoutSplit(layout, 0.75, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-
- uiItemR(row, ptr, "fh_height", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "direction_axis", 0, NULL, ICON_NONE);
- split = uiLayoutSplit(row, 0.9f, false);
- uiItemR(split, ptr, "fh_force", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.15, false);
- uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- if (RNA_boolean_get(ptr, "use_material_detect"))
- uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA);
- else
- uiItemR(split, ptr, "property", 0, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.15, false);
- uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- break;
- }
-}
-
-static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
-{
- Object *ob = (Object *)ptr->id.data;
- uiLayout *row, *split, *sub;
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
-
- switch (RNA_enum_get(ptr, "mode")) {
- case ACT_EDOB_ADD_OBJECT:
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "object", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- break;
- case ACT_EDOB_END_OBJECT:
- break;
- case ACT_EDOB_REPLACE_MESH:
- if (ob->type != OB_MESH) {
- uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE);
- break;
- }
- split = uiLayoutSplit(layout, 0.6, false);
- uiItemR(split, ptr, "mesh", 0, NULL, ICON_NONE);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "use_replace_display_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemR(row, ptr, "use_replace_physics_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- break;
- case ACT_EDOB_TRACK_TO:
- split = uiLayoutSplit(layout, 0.5, false);
- uiItemR(split, ptr, "track_object", 0, NULL, ICON_NONE);
- sub = uiLayoutSplit(split, 0.7f, false);
- uiItemR(sub, ptr, "time", 0, NULL, ICON_NONE);
- uiItemR(sub, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "up_axis", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "track_axis", 0, NULL, ICON_NONE);
- break;
- case ACT_EDOB_DYNAMICS:
- if (ob->type != OB_MESH) {
- uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE);
- break;
- }
- uiItemR(layout, ptr, "dynamic_operation", 0, NULL, ICON_NONE);
- if (RNA_enum_get(ptr, "dynamic_operation") == ACT_EDOB_SET_MASS)
- uiItemR(layout, ptr, "mass", 0, NULL, ICON_NONE);
- break;
- }
-}
-
-static void draw_actuator_filter_2d(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *row, *split;
-
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode")) {
- case ACT_2DFILTER_CUSTOMFILTER:
- uiItemR(layout, ptr, "filter_pass", 0, NULL, ICON_NONE);
- uiItemR(layout, ptr, "glsl_shader", 0, NULL, ICON_NONE);
- break;
- case ACT_2DFILTER_MOTIONBLUR:
- split=uiLayoutSplit(layout, 0.75f, true);
- row = uiLayoutRow(split, false);
- uiLayoutSetActive(row, RNA_boolean_get(ptr, "use_motion_blur") == true);
- uiItemR(row, ptr, "motion_blur_factor", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_motion_blur", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- break;
- default: // all other 2D Filters
- uiItemR(layout, ptr, "filter_pass", 0, NULL, ICON_NONE);
- break;
- }
-}
-
-static void draw_actuator_game(uiLayout *layout, PointerRNA *ptr)
-{
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- if (ELEM(RNA_enum_get(ptr, "mode"), ACT_GAME_LOAD, ACT_GAME_SCREENSHOT))
- uiItemR(layout, ptr, "filename", 0, NULL, ICON_NONE);
-}
-
-static void draw_actuator_message(uiLayout *layout, PointerRNA *ptr, bContext *C)
-{
- Object *ob;
- PointerRNA main_ptr, settings_ptr;
- uiLayout *row;
-
- RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
-
- ob = (Object *)ptr->id.data;
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
-
- uiItemPointerR(layout, ptr, "to_property", &main_ptr, "objects", NULL, ICON_OBJECT_DATA);
- uiItemR(layout, ptr, "subject", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, true);
- uiItemR(row, ptr, "body_type", 0, NULL, ICON_NONE);
-
- if (RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG)
- uiItemR(row, ptr, "body_message", 0, "", ICON_NONE);
- else // mode == ACT_MESG_PROP
- uiItemPointerR(row, ptr, "body_property", &settings_ptr, "properties", "", ICON_NONE);
-}
-
-static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
-{
- Object *ob;
- PointerRNA settings_ptr;
- uiLayout *split, *row, *col, *sub;
- int physics_type;
-
- ob = (Object *)ptr->id.data;
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- physics_type = RNA_enum_get(&settings_ptr, "physics_type");
-
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
-
- switch (RNA_enum_get(ptr, "mode")) {
- case ACT_OBJECT_NORMAL:
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- if (ELEM(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) {
- uiItemL(layout, IFACE_("Dynamic Object Settings:"), ICON_NONE);
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "force", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_local_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "torque", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_local_torque", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE);
- row = uiLayoutRow(split, true);
- uiItemR(row, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemR(row, ptr, "use_add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- uiItemR(layout, ptr, "damping", 0, NULL, ICON_NONE);
- }
- break;
- case ACT_OBJECT_SERVO:
- uiItemR(layout, ptr, "reference_object", 0, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- col = uiLayoutColumn(row, false);
- uiItemR(col, ptr, "use_servo_limit_x", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, true);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_x") == true);
- uiItemR(sub, ptr, "force_max_x", 0, NULL, ICON_NONE);
- uiItemR(sub, ptr, "force_min_x", 0, NULL, ICON_NONE);
-
- col = uiLayoutColumn(row, false);
- uiItemR(col, ptr, "use_servo_limit_y", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, true);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_y") == true);
- uiItemR(sub, ptr, "force_max_y", 0, NULL, ICON_NONE);
- uiItemR(sub, ptr, "force_min_y", 0, NULL, ICON_NONE);
-
- col = uiLayoutColumn(row, false);
- uiItemR(col, ptr, "use_servo_limit_z", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, true);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_z") == true);
- uiItemR(sub, ptr, "force_max_z", 0, NULL, ICON_NONE);
- uiItemR(sub, ptr, "force_min_z", 0, NULL, ICON_NONE);
-
- //XXXACTUATOR missing labels from original 2.49 ui (e.g. Servo, Min, Max, Fast)
- //Layout designers willing to help on that, please compare with 2.49 ui
- // (since the old code is going to be deleted ... soon)
-
- col = uiLayoutColumn(layout, true);
- uiItemR(col, ptr, "proportional_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- uiItemR(col, ptr, "integral_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- uiItemR(col, ptr, "derivate_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- break;
- case ACT_OBJECT_CHARACTER:
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NONE);
- row = uiLayoutRow(split, true);
- uiItemR(row, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemR(row, ptr, "use_add_character_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
-
- split = uiLayoutSplit(layout, 0.9, false);
- row = uiLayoutRow(split, false);
- split = uiLayoutSplit(row, 0.7, false);
- uiItemL(split, "", ICON_NONE); /*Just use this for some spacing */
- uiItemR(split, ptr, "use_character_jump", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- break;
- }
-}
-
-static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *row, *sub;
-
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
-
- if (RNA_enum_get(ptr, "mode") == ACT_PARENT_SET) {
- uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "use_compound", 0, NULL, ICON_NONE);
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_compound") == true);
- uiItemR(sub, ptr, "use_ghost", 0, NULL, ICON_NONE);
- }
-}
-
-static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr)
-{
- Object *ob = (Object *)ptr->id.data;
- bActuator *act = (bActuator *)ptr->data;
- bPropertyActuator *pa = (bPropertyActuator *) act->data;
- Object *ob_from= pa->ob;
- PointerRNA settings_ptr, obj_settings_ptr;
-
- uiLayout *row, *sub;
-
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
-
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
-
- switch (RNA_enum_get(ptr, "mode")) {
- case ACT_PROP_TOGGLE:
- case ACT_PROP_LEVEL:
- break;
- case ACT_PROP_ADD:
- uiItemR(layout, ptr, "value", 0, NULL, ICON_NONE);
- break;
- case ACT_PROP_ASSIGN:
- uiItemR(layout, ptr, "value", 0, NULL, ICON_NONE);
- break;
- case ACT_PROP_COPY:
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "object", 0, NULL, ICON_NONE);
- if (ob_from) {
- RNA_pointer_create((ID *)ob_from, &RNA_GameObjectSettings, ob_from, &obj_settings_ptr);
- uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NONE);
- }
- else {
- sub = uiLayoutRow(row, false);
- uiLayoutSetActive(sub, false);
- uiItemR(sub, ptr, "object_property", 0, NULL, ICON_NONE);
- }
- break;
- }
-}
-
-static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr)
-{
- Object *ob;
- PointerRNA settings_ptr;
- uiLayout *row;
-
- ob = (Object *)ptr->id.data;
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
-
- row = uiLayoutRow(layout, false);
-
- uiItemR(row, ptr, "seed", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "distribution", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
-
- switch (RNA_enum_get(ptr, "distribution")) {
- case ACT_RANDOM_BOOL_CONST:
- uiItemR(row, ptr, "use_always_true", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- break;
-
- case ACT_RANDOM_BOOL_UNIFORM:
- uiItemL(row, IFACE_("Choose between true and false, 50% chance each"), ICON_NONE);
- break;
-
- case ACT_RANDOM_BOOL_BERNOUILLI:
- uiItemR(row, ptr, "chance", 0, NULL, ICON_NONE);
- break;
-
- case ACT_RANDOM_INT_CONST:
- uiItemR(row, ptr, "int_value", 0, NULL, ICON_NONE);
- break;
-
- case ACT_RANDOM_INT_UNIFORM:
- uiItemR(row, ptr, "int_min", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "int_max", 0, NULL, ICON_NONE);
- break;
-
- case ACT_RANDOM_INT_POISSON:
- uiItemR(row, ptr, "int_mean", 0, NULL, ICON_NONE);
- break;
-
- case ACT_RANDOM_FLOAT_CONST:
- uiItemR(row, ptr, "float_value", 0, NULL, ICON_NONE);
- break;
-
- case ACT_RANDOM_FLOAT_UNIFORM:
- uiItemR(row, ptr, "float_min", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "float_max", 0, NULL, ICON_NONE);
- break;
-
- case ACT_RANDOM_FLOAT_NORMAL:
- uiItemR(row, ptr, "float_mean", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "standard_derivation", 0, NULL, ICON_NONE);
- break;
-
- case ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL:
- uiItemR(row, ptr, "half_life_time", 0, NULL, ICON_NONE);
- break;
- }
-}
-
-static void draw_actuator_scene(uiLayout *layout, PointerRNA *ptr)
-{
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
-
- switch (RNA_enum_get(ptr, "mode")) {
- case ACT_SCENE_CAMERA:
- uiItemR(layout, ptr, "camera", 0, NULL, ICON_NONE);
- break;
- case ACT_SCENE_RESTART:
- break;
- default: // ACT_SCENE_SET|ACT_SCENE_ADD_FRONT|ACT_SCENE_ADD_BACK|ACT_SCENE_REMOVE|ACT_SCENE_SUSPEND|ACT_SCENE_RESUME
- uiItemR(layout, ptr, "scene", 0, NULL, ICON_NONE);
- break;
- }
-}
-
-static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
-{
- Object *ob = (Object *)ptr->id.data;
- PointerRNA settings_ptr;
- uiLayout *row;
-
- if (ob->type != OB_MESH) {
- uiItemL(layout, IFACE_("Actuator only available for mesh objects"), ICON_NONE);
- return;
- }
-
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "mode", 0, "", ICON_NONE);
- uiItemR(row, ptr, "action", 0, "", ICON_NONE);
- uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- if ((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
- uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
-
- else {
- uiItemR(row, ptr, "frame_start", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "frame_end", 0, NULL, ICON_NONE);
- }
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "priority", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE);
-
-#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
- uiItemR(row, "stride_length", 0, NULL, ICON_NONE);
-#endif
-}
-
-static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C)
-{
- uiLayout *row, *col;
-
- uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL);
- if (!RNA_pointer_get(ptr, "sound").data) {
- uiItemL(layout, IFACE_("Select a sound from the list or load a new one"), ICON_NONE);
- return;
- }
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "volume", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "pitch", 0, NULL, ICON_NONE);
-
- uiItemR(layout, ptr, "use_sound_3d", 0, NULL, ICON_NONE);
-
- col = uiLayoutColumn(layout, false);
- uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_sound_3d") == true);
-
- row = uiLayoutRow(col, false);
- uiItemR(row, ptr, "gain_3d_min", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "gain_3d_max", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(col, false);
- uiItemR(row, ptr, "distance_3d_reference", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "distance_3d_max", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(col, false);
- uiItemR(row, ptr, "rolloff_factor_3d", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "cone_outer_gain_3d", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(col, false);
- uiItemR(row, ptr, "cone_outer_angle_3d", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "cone_inner_angle_3d", 0, NULL, ICON_NONE);
-}
-
-static void draw_actuator_state(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *split;
- Object *ob = (Object *)ptr->id.data;
- PointerRNA settings_ptr;
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
-
- split = uiLayoutSplit(layout, 0.35, false);
- uiItemR(split, ptr, "operation", 0, NULL, ICON_NONE);
-
- uiTemplateLayers(split, ptr, "states", &settings_ptr, "used_states", 0);
-}
-
-static void draw_actuator_visibility(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *row;
- row = uiLayoutRow(layout, false);
-
- uiItemR(row, ptr, "use_visible", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "use_occlusion", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "apply_to_children", 0, NULL, ICON_NONE);
-}
-
-static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *row;
- uiLayout *col;
-
- uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- uiItemR(layout, ptr, "target", 0, NULL, ICON_NONE);
- uiItemR(layout, ptr, "navmesh", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "velocity", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "acceleration", 0, NULL, ICON_NONE);
- uiItemR(row, ptr, "turn_speed", 0, NULL, ICON_NONE);
-
- row = uiLayoutRow(layout, false);
- col = uiLayoutColumn(row, false);
- uiItemR(col, ptr, "facing", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(row, false);
- uiItemR(col, ptr, "facing_axis", 0, NULL, ICON_NONE);
- if (!RNA_boolean_get(ptr, "facing")) {
- uiLayoutSetActive(col, false);
- }
- col = uiLayoutColumn(row, false);
- uiItemR(col, ptr, "normal_up", 0, NULL, ICON_NONE);
- if (!RNA_pointer_get(ptr, "navmesh").data) {
- uiLayoutSetActive(col, false);
- }
-
- row = uiLayoutRow(layout, false);
- col = uiLayoutColumn(row, false);
- uiItemR(col, ptr, "self_terminated", 0, NULL, ICON_NONE);
- if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) {
- col = uiLayoutColumn(row, false);
- uiItemR(col, ptr, "update_period", 0, NULL, ICON_NONE);
- }
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "lock_z_velocity", 1, NULL, ICON_NONE);
- row = uiLayoutRow(layout, false);
- uiItemR(row, ptr, "show_visualization", 0, NULL, ICON_NONE);
- if (RNA_enum_get(ptr, "mode") != ACT_STEERING_PATHFOLLOWING) {
- uiLayoutSetActive(row, false);
- }
-}
-
-static void draw_actuator_mouse(uiLayout *layout, PointerRNA *ptr)
-{
- uiLayout *row, *col, *subcol, *split, *subsplit;
-
- uiItemR(layout, ptr, "mode", 0, NULL, 0);
-
- switch (RNA_enum_get(ptr, "mode")) {
- case ACT_MOUSE_VISIBILITY:
- row = uiLayoutRow(layout, 0);
- uiItemR(row, ptr, "visible", UI_ITEM_R_TOGGLE, NULL, 0);
- break;
-
- case ACT_MOUSE_LOOK:
- /* X axis */
- row = uiLayoutRow(layout, 0);
- col = uiLayoutColumn(row, 1);
-
- uiItemR(col, ptr, "use_axis_x", UI_ITEM_R_TOGGLE, NULL, 0);
-
- subcol = uiLayoutColumn(col, 1);
- uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_axis_x")==1);
- uiItemR(subcol, ptr, "sensitivity_x", 0, NULL, 0);
- uiItemR(subcol, ptr, "threshold_x", 0, NULL, 0);
-
- uiItemR(subcol, ptr, "min_x", 0, NULL, 0);
- uiItemR(subcol, ptr, "max_x", 0, NULL, 0);
-
- uiItemR(subcol, ptr, "object_axis_x", 0, NULL, 0);
-
- /* Y Axis */
- col = uiLayoutColumn(row, 1);
-
- uiItemR(col, ptr, "use_axis_y", UI_ITEM_R_TOGGLE, NULL, 0);
-
- subcol = uiLayoutColumn(col, 1);
- uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_axis_y")==1);
- uiItemR(subcol, ptr, "sensitivity_y", 0, NULL, 0);
- uiItemR(subcol, ptr, "threshold_y", 0, NULL, 0);
-
- uiItemR(subcol, ptr, "min_y", 0, NULL, 0);
- uiItemR(subcol, ptr, "max_y", 0, NULL, 0);
-
- uiItemR(subcol, ptr, "object_axis_y", 0, NULL, 0);
-
- /* Lower options */
- row = uiLayoutRow(layout, 0);
- split = uiLayoutSplit(row, 0.5, 0);
-
- subsplit = uiLayoutSplit(split, 0.5, 1);
- uiLayoutSetActive(subsplit, RNA_boolean_get(ptr, "use_axis_x")==1);
- uiItemR(subsplit, ptr, "local_x", UI_ITEM_R_TOGGLE, NULL, 0);
- uiItemR(subsplit, ptr, "reset_x", UI_ITEM_R_TOGGLE, NULL, 0);
-
- subsplit = uiLayoutSplit(split, 0.5, 1);
- uiLayoutSetActive(subsplit, RNA_boolean_get(ptr, "use_axis_y")==1);
- uiItemR(subsplit, ptr, "local_y", UI_ITEM_R_TOGGLE, NULL, 0);
- uiItemR(subsplit, ptr, "reset_y", UI_ITEM_R_TOGGLE, NULL, 0);
-
- break;
- }
-}
-
-static void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C)
-{
- uiLayout *box;
-
- if (!RNA_boolean_get(ptr, "show_expanded"))
- return;
-
- box = uiLayoutBox(layout);
- uiLayoutSetActive(box, RNA_boolean_get(ptr, "active"));
-
- switch (RNA_enum_get(ptr, "type")) {
- case ACT_ACTION:
- draw_actuator_action(box, ptr);
- break;
- case ACT_ARMATURE:
- draw_actuator_armature(box, ptr);
- break;
- case ACT_CAMERA:
- draw_actuator_camera(box, ptr);
- break;
- case ACT_CONSTRAINT:
- draw_actuator_constraint(box, ptr, C);
- break;
- case ACT_EDIT_OBJECT:
- draw_actuator_edit_object(box, ptr);
- break;
- case ACT_2DFILTER:
- draw_actuator_filter_2d(box, ptr);
- break;
- case ACT_GAME:
- draw_actuator_game(box, ptr);
- break;
- case ACT_MESSAGE:
- draw_actuator_message(box, ptr, C);
- break;
- case ACT_OBJECT:
- draw_actuator_motion(box, ptr);
- break;
- case ACT_PARENT:
- draw_actuator_parent(box, ptr);
- break;
- case ACT_PROPERTY:
- draw_actuator_property(box, ptr);
- break;
- case ACT_RANDOM:
- draw_actuator_random(box, ptr);
- break;
- case ACT_SCENE:
- draw_actuator_scene(box, ptr);
- break;
- case ACT_SHAPEACTION:
- draw_actuator_shape_action(box, ptr);
- break;
- case ACT_SOUND:
- draw_actuator_sound(box, ptr, C);
- break;
- case ACT_STATE:
- draw_actuator_state(box, ptr);
- break;
- case ACT_VISIBILITY:
- draw_actuator_visibility(box, ptr);
- break;
- case ACT_STEERING:
- draw_actuator_steering(box, ptr);
- break;
- case ACT_MOUSE:
- draw_actuator_mouse(box, ptr);
- break;
- }
-}
-
-void logic_buttons(bContext *C, ARegion *ar)
-{
- SpaceLogic *slogic= CTX_wm_space_logic(C);
- Object *ob= CTX_data_active_object(C);
- ID **idar;
- PointerRNA logic_ptr, settings_ptr, object_ptr;
- uiLayout *layout, *row, *box;
- uiBlock *block;
- uiBut *but;
- char uiblockstr[32];
- short a, count;
- int xco, yco, width, height;
-
- if (ob==NULL) return;
-
- RNA_pointer_create(NULL, &RNA_SpaceLogicEditor, slogic, &logic_ptr);
- idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
-
- BLI_snprintf(uiblockstr, sizeof(uiblockstr), "buttonswin %p", (void *)ar);
- block= UI_block_begin(C, ar, uiblockstr, UI_EMBOSS);
- UI_block_func_handle_set(block, do_logic_buts, NULL);
- UI_block_bounds_set_normal(block, U.widget_unit/2);
-
- /* loop over all objects and set visible/linked flags for the logic bricks */
- for (a=0; a<count; a++) {
- bActuator *act;
- bSensor *sens;
- bController *cont;
- int iact;
- short flag;
-
- ob= (Object *)idar[a];
-
- /* clean ACT_LINKED and ACT_VISIBLE of all potentially visible actuators so that we can determine which is actually linked/visible */
- act = ob->actuators.first;
- while (act) {
- act->flag &= ~(ACT_LINKED|ACT_VISIBLE);
- act = act->next;
- }
- /* same for sensors */
- sens= ob->sensors.first;
- while (sens) {
- sens->flag &= ~(SENS_VISIBLE);
- sens = sens->next;
- }
-
- /* mark the linked and visible actuators */
- cont= ob->controllers.first;
- while (cont) {
- flag = ACT_LINKED;
-
- /* this controller is visible, mark all its actuator */
- if ((ob->scaflag & OB_ALLSTATE) || (ob->state & cont->state_mask))
- flag |= ACT_VISIBLE;
-
- for (iact=0; iact<cont->totlinks; iact++) {
- act = cont->links[iact];
- if (act)
- act->flag |= flag;
- }
- cont = cont->next;
- }
- }
-
- /* ****************** Controllers ****************** */
-
- xco= 21 * U.widget_unit; yco= - U.widget_unit / 2; width= 15 * U.widget_unit;
- layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get());
- row = uiLayoutRow(layout, true);
-
- uiDefBlockBut(block, controller_menu, NULL, IFACE_("Controllers"), xco - U.widget_unit / 2, yco, width, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
-
- uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, IFACE_("Sel"), ICON_NONE);
- uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, IFACE_("Act"), ICON_NONE);
- uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, IFACE_("Link"), ICON_NONE);
-
- for (a=0; a<count; a++) {
- bController *cont;
- PointerRNA ptr;
- uiLayout *split, *subsplit, *col;
-
-
- ob= (Object *)idar[a];
-
- /* only draw the controller common header if "use_visible" */
- if ( (ob->scavisflag & OB_VIS_CONT) == 0) {
- continue;
- }
-
- /* Drawing the Controller Header common to all Selected Objects */
-
- RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
-
- split = uiLayoutSplit(layout, 0.05f, false);
- uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT);
-
- row = uiLayoutRow(split, true);
- uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWCONT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide controllers"));
-
- RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
- uiLayoutSetContextPointer(row, "object", &object_ptr);
- uiItemMenuEnumO(row, C, "LOGIC_OT_controller_add", "type", IFACE_("Add Controller"), ICON_NONE);
-
- if (RNA_boolean_get(&settings_ptr, "show_state_panel")) {
-
- box = uiLayoutBox(layout);
- split = uiLayoutSplit(box, 0.2f, false);
-
- col = uiLayoutColumn(split, false);
- uiItemL(col, IFACE_("Visible"), ICON_NONE);
- uiItemL(col, IFACE_("Initial"), ICON_NONE);
-
- subsplit = uiLayoutSplit(split, 0.85f, false);
- col = uiLayoutColumn(subsplit, false);
- row = uiLayoutRow(col, false);
- uiLayoutSetActive(row, RNA_boolean_get(&settings_ptr, "use_all_states") == false);
- uiTemplateGameStates(row, &settings_ptr, "states_visible", &settings_ptr, "used_states", 0);
- row = uiLayoutRow(col, false);
- uiTemplateGameStates(row, &settings_ptr, "states_initial", &settings_ptr, "used_states", 0);
-
- col = uiLayoutColumn(subsplit, false);
- uiItemR(col, &settings_ptr, "use_all_states", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- uiItemR(col, &settings_ptr, "show_debug_state", 0, "", ICON_NONE);
- }
-
- /* End of Drawing the Controller Header common to all Selected Objects */
-
- if ((ob->scaflag & OB_SHOWCONT) == 0) continue;
-
-
- uiItemS(layout);
-
- for (cont= ob->controllers.first; cont; cont=cont->next) {
- RNA_pointer_create((ID *)ob, &RNA_Controller, cont, &ptr);
-
- if (!(ob->scaflag & OB_ALLSTATE) && !(ob->state & cont->state_mask))
- continue;
-
- /* use two nested splits to align inlinks/links properly */
- split = uiLayoutSplit(layout, 0.05f, false);
-
- /* put inlink button to the left */
- col = uiLayoutColumn(split, false);
- uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active"));
- uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT);
- but = uiDefIconBut(block, UI_BTYPE_INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
- if (!RNA_boolean_get(&ptr, "active")) {
- UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY);
- }
-
- //col = uiLayoutColumn(split, true);
- /* nested split for middle and right columns */
- subsplit = uiLayoutSplit(split, 0.95f, false);
-
- col = uiLayoutColumn(subsplit, true);
- uiLayoutSetContextPointer(col, "controller", &ptr);
-
- /* should make UI template for controller header.. function will do for now */
-// draw_controller_header(col, &ptr);
- draw_controller_header(col, &ptr, xco, width, yco); //provisory for 2.50 beta
-
- /* draw the brick contents */
- draw_brick_controller(col, &ptr);
-
- /* put link button to the right */
- col = uiLayoutColumn(subsplit, false);
- uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active"));
- uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT);
- but = uiDefIconBut(block, UI_BTYPE_LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- if (!RNA_boolean_get(&ptr, "active")) {
- UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY);
- }
-
- UI_but_link_set(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
-
- }
- }
- UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */
- height = yco;
-
- /* ****************** Sensors ****************** */
-
- xco= U.widget_unit / 2; yco= -U.widget_unit / 2; width= 17 * U.widget_unit;
- layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get());
- row = uiLayoutRow(layout, true);
-
- uiDefBlockBut(block, sensor_menu, NULL, IFACE_("Sensors"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
-
- uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, IFACE_("Sel"), ICON_NONE);
- uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, IFACE_("Act"), ICON_NONE);
- uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, IFACE_("Link"), ICON_NONE);
- uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, IFACE_("State"), ICON_NONE);
-
- for (a=0; a<count; a++) {
- bSensor *sens;
- PointerRNA ptr;
-
- ob= (Object *)idar[a];
-
- /* only draw the sensor common header if "use_visible" */
- if ((ob->scavisflag & OB_VIS_SENS) == 0) continue;
-
- row = uiLayoutRow(layout, true);
- uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWSENS, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide sensors"));
-
- RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
- uiLayoutSetContextPointer(row, "object", &object_ptr);
- uiItemMenuEnumO(row, C, "LOGIC_OT_sensor_add", "type", IFACE_("Add Sensor"), ICON_NONE);
-
- if ((ob->scaflag & OB_SHOWSENS) == 0) continue;
-
- uiItemS(layout);
-
- for (sens= ob->sensors.first; sens; sens=sens->next) {
- RNA_pointer_create((ID *)ob, &RNA_Sensor, sens, &ptr);
-
- if ((ob->scaflag & OB_ALLSTATE) ||
- !(slogic->scaflag & BUTS_SENS_STATE) ||
- (sens->totlinks == 0) || /* always display sensor without links so that is can be edited */
- (sens->flag & SENS_PIN && slogic->scaflag & BUTS_SENS_STATE) || /* states can hide some sensors, pinned sensors ignore the visible state */
- (is_sensor_linked(block, sens))
- )
- { // gotta check if the current state is visible or not
- uiLayout *split, *col;
-
- /* make as visible, for move operator */
- sens->flag |= SENS_VISIBLE;
-
- split = uiLayoutSplit(layout, 0.95f, false);
- col = uiLayoutColumn(split, true);
- uiLayoutSetContextPointer(col, "sensor", &ptr);
-
- /* should make UI template for sensor header.. function will do for now */
- draw_sensor_header(col, &ptr, &logic_ptr);
-
- /* draw the brick contents */
- draw_brick_sensor(col, &ptr, C);
-
- /* put link button to the right */
- col = uiLayoutColumn(split, false);
- uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active"));
- but = uiDefIconBut(block, UI_BTYPE_LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- if (!RNA_boolean_get(&ptr, "active")) {
- UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY);
- }
-
- /* use old-school uiButtons for links for now */
- UI_but_link_set(but, NULL, (void ***)&sens->links, &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
- }
- }
- }
- UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */
- height = MIN2(height, yco);
-
- /* ****************** Actuators ****************** */
-
- xco= 40 * U.widget_unit; yco= -U.widget_unit / 2; width= 17 * U.widget_unit;
- layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get());
- row = uiLayoutRow(layout, true);
-
- uiDefBlockBut(block, actuator_menu, NULL, IFACE_("Actuators"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
-
- uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, IFACE_("Sel"), ICON_NONE);
- uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, IFACE_("Act"), ICON_NONE);
- uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, IFACE_("Link"), ICON_NONE);
- uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, IFACE_("State"), ICON_NONE);
-
- for (a=0; a<count; a++) {
- bActuator *act;
- PointerRNA ptr;
-
- ob= (Object *)idar[a];
-
- /* only draw the actuator common header if "use_visible" */
- if ((ob->scavisflag & OB_VIS_ACT) == 0) {
- continue;
- }
-
- row = uiLayoutRow(layout, true);
- uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWACT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide actuators"));
-
- RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr);
- uiLayoutSetContextPointer(row, "object", &object_ptr);
- uiItemMenuEnumO(row, C, "LOGIC_OT_actuator_add", "type", IFACE_("Add Actuator"), ICON_NONE);
-
- if ((ob->scaflag & OB_SHOWACT) == 0) continue;
-
- uiItemS(layout);
-
- for (act= ob->actuators.first; act; act=act->next) {
-
- RNA_pointer_create((ID *)ob, &RNA_Actuator, act, &ptr);
-
- if ((ob->scaflag & OB_ALLSTATE) ||
- !(slogic->scaflag & BUTS_ACT_STATE) ||
- !(act->flag & ACT_LINKED) || /* always display actuators without links so that is can be edited */
- (act->flag & ACT_VISIBLE) || /* this actuator has visible connection, display it */
- (act->flag & ACT_PIN && slogic->scaflag & BUTS_ACT_STATE) /* states can hide some sensors, pinned sensors ignore the visible state */
- )
- { // gotta check if the current state is visible or not
- uiLayout *split, *col;
-
- /* make as visible, for move operator */
- act->flag |= ACT_VISIBLE;
-
- split = uiLayoutSplit(layout, 0.05f, false);
-
- /* put inlink button to the left */
- col = uiLayoutColumn(split, false);
- uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active"));
- but = uiDefIconBut(block, UI_BTYPE_INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, "");
- if (!RNA_boolean_get(&ptr, "active")) {
- UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY);
- }
-
- col = uiLayoutColumn(split, true);
- uiLayoutSetContextPointer(col, "actuator", &ptr);
-
- /* should make UI template for actuator header.. function will do for now */
- draw_actuator_header(col, &ptr, &logic_ptr);
-
- /* draw the brick contents */
- draw_brick_actuator(col, &ptr, C);
-
- }
- }
- }
- UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */
- height = MIN2(height, yco);
-
- UI_view2d_totRect_set(&ar->v2d, 57.5f * U.widget_unit, height - U.widget_unit);
-
- /* set the view */
- UI_view2d_view_ortho(&ar->v2d);
-
- UI_block_links_compose(block);
-
- UI_block_end(C, block);
- UI_block_draw(C, block);
-
- /* restore view matrix */
- UI_view2d_view_restore(C);
-
- if (idar) MEM_freeN(idar);
-}
-
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
deleted file mode 100644
index af90ef487e0..00000000000
--- a/source/blender/editors/space_logic/space_logic.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2009 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_logic/space_logic.c
- * \ingroup splogic
- */
-
-
-#include <string.h>
-#include <stdio.h>
-
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-
-#include "DNA_gpencil_types.h"
-
-#include "BKE_context.h"
-#include "BKE_library.h"
-#include "BKE_screen.h"
-
-#include "ED_space_api.h"
-#include "ED_screen.h"
-
-#include "BIF_gl.h"
-
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "logic_intern.h"
-
-/* ******************** manage regions ********************* */
-
-ARegion *logic_has_buttons_region(ScrArea *sa)
-{
- ARegion *ar, *arnew;
-
- ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if (ar) return ar;
-
- /* add subdiv level; after header */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
-
- /* is error! */
- if (ar == NULL) return NULL;
-
- arnew= MEM_callocN(sizeof(ARegion), "buttons for image");
-
- BLI_insertlinkafter(&sa->regionbase, ar, arnew);
- arnew->regiontype = RGN_TYPE_UI;
- arnew->alignment = RGN_ALIGN_RIGHT;
-
- arnew->flag = RGN_FLAG_HIDDEN;
-
- return arnew;
-}
-
-/* ******************** default callbacks for image space ***************** */
-
-static SpaceLink *logic_new(const bContext *C)
-{
- ScrArea *sa= CTX_wm_area(C);
- ARegion *ar;
- SpaceLogic *slogic;
-
- slogic= MEM_callocN(sizeof(SpaceLogic), "initlogic");
- slogic->spacetype= SPACE_LOGIC;
-
- /* default options */
- slogic->scaflag = ((BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_SENS_LINK) |
- (BUTS_CONT_SEL|BUTS_CONT_ACT|BUTS_CONT_LINK) |
- (BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_ACT_LINK) |
- (BUTS_SENS_STATE|BUTS_ACT_STATE));
-
-
- /* header */
- ar= MEM_callocN(sizeof(ARegion), "header for logic");
-
- BLI_addtail(&slogic->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
-
- /* buttons/list view */
- ar= MEM_callocN(sizeof(ARegion), "buttons for logic");
-
- BLI_addtail(&slogic->regionbase, ar);
- ar->regiontype= RGN_TYPE_UI;
- ar->alignment= RGN_ALIGN_RIGHT;
-
- /* main region */
- ar= MEM_callocN(sizeof(ARegion), "main region for logic");
-
- BLI_addtail(&slogic->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
-
- ar->v2d.tot.xmin = 0.0f;
- ar->v2d.tot.ymax = 0.0f;
- ar->v2d.tot.xmax = 1150.0f;
- ar->v2d.tot.ymin = ( 1150.0f/(float)sa->winx ) * (float)-sa->winy;
-
- ar->v2d.cur = ar->v2d.tot;
-
- ar->v2d.min[0] = 1.0f;
- ar->v2d.min[1] = 1.0f;
-
- ar->v2d.max[0] = 32000.0f;
- ar->v2d.max[1] = 32000.0f;
-
- ar->v2d.minzoom = 0.5f;
- ar->v2d.maxzoom = 1.5f;
-
- ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
- ar->v2d.keepzoom = V2D_KEEPZOOM | V2D_LIMITZOOM | V2D_KEEPASPECT;
- ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
- ar->v2d.align = V2D_ALIGN_NO_POS_Y | V2D_ALIGN_NO_NEG_X;
- ar->v2d.keepofs = V2D_KEEPOFS_Y;
-
- return (SpaceLink *)slogic;
-}
-
-/* not spacelink itself */
-static void logic_free(SpaceLink *UNUSED(sl))
-{
-// Spacelogic *slogic= (SpaceLogic *) sl;
-
-// if (slogic->gpd)
-// XXX BKE_gpencil_free(slogic->gpd);
-
-}
-
-
-/* spacetype; init callback */
-static void logic_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
-{
-
-}
-
-static SpaceLink *logic_duplicate(SpaceLink *sl)
-{
- SpaceLogic *slogicn= MEM_dupallocN(sl);
-
- return (SpaceLink *)slogicn;
-}
-
-static void logic_operatortypes(void)
-{
- WM_operatortype_append(LOGIC_OT_properties);
- WM_operatortype_append(LOGIC_OT_links_cut);
-}
-
-static void logic_keymap(struct wmKeyConfig *keyconf)
-{
- wmKeyMap *keymap = WM_keymap_find(keyconf, "Logic Editor", SPACE_LOGIC, 0);
-
- WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "LOGIC_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
- WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0);
-
- WM_keymap_add_item(keymap, "LOGIC_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
-#ifdef WITH_INPUT_NDOF
- WM_keymap_add_item(keymap, "LOGIC_OT_view_all", NDOF_BUTTON_FIT, KM_PRESS, 0, 0);
-#endif
-}
-
-static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa))
-{
-// SpaceLogic *slogic= CTX_wm_space_logic(C);
-// Object *obedit= CTX_data_edit_object(C);
-
-}
-
-static void logic_listener(
- bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar,
- wmNotifier *wmn, const Scene *UNUSED(scene))
-{
- /* context changes */
- switch (wmn->category) {
- case NC_LOGIC:
- ED_region_tag_redraw(ar);
- break;
- case NC_SCENE:
- switch (wmn->data) {
- case ND_FRAME:
- ED_region_tag_redraw(ar);
- break;
-
- case ND_OB_ACTIVE:
- ED_region_tag_redraw(ar);
- break;
- }
- break;
- case NC_OBJECT:
- break;
- case NC_ID:
- if (wmn->action == NA_RENAME)
- ED_region_tag_redraw(ar);
- break;
- }
-}
-
-static int logic_context(const bContext *UNUSED(C), const char *UNUSED(member), bContextDataResult *UNUSED(result))
-{
-// SpaceLogic *slogic= CTX_wm_space_logic(C);
- return 0;
-}
-
-/************************** main region ***************************/
-
-
-/* add handlers, stuff you only do once or on area/region changes */
-static void logic_main_region_init(wmWindowManager *wm, ARegion *ar)
-{
- wmKeyMap *keymap;
-
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
-
- /* own keymaps */
- keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
-}
-
-static void logic_main_region_draw(const bContext *C, ARegion *ar)
-{
- /* draw entirely, view changes should be handled here */
-// SpaceLogic *slogic= CTX_wm_space_logic(C);
- View2D *v2d= &ar->v2d;
- View2DScrollers *scrollers;
-
- /* clear and setup matrix */
- UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
-
- UI_view2d_view_ortho(v2d);
-
- logic_buttons((bContext *)C, ar);
-
- /* reset view matrix */
- UI_view2d_view_restore(C);
-
- /* scrollers */
- scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
- UI_view2d_scrollers_draw(C, v2d, scrollers);
- UI_view2d_scrollers_free(scrollers);
-
-}
-
-
-/* *********************** buttons region ************************ */
-
-/* add handlers, stuff you only do once or on area/region changes */
-static void logic_buttons_region_init(wmWindowManager *wm, ARegion *ar)
-{
- wmKeyMap *keymap;
-
- ED_region_panels_init(wm, ar);
-
- keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
- WM_event_add_keymap_handler(&ar->handlers, keymap);
-}
-
-static void logic_buttons_region_draw(const bContext *C, ARegion *ar)
-{
- ED_region_panels(C, ar, NULL, -1, true);
-}
-
-/************************* header region **************************/
-
-/* add handlers, stuff you only do once or on area/region changes */
-static void logic_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar)
-{
- ED_region_header_init(ar);
-}
-
-static void logic_header_region_draw(const bContext *C, ARegion *ar)
-{
- ED_region_header(C, ar);
-}
-
-/**************************** spacetype *****************************/
-
-static void logic_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id)
-{
- SpaceLogic *slog = (SpaceLogic *)slink;
-
- if (!ELEM(GS(old_id->name), ID_GD)) {
- return;
- }
-
- if ((ID *)slog->gpd == old_id) {
- slog->gpd = (bGPdata *)new_id;
- id_us_min(old_id);
- id_us_plus(new_id);
- }
-}
-
-/* only called once, from space/spacetypes.c */
-void ED_spacetype_logic(void)
-{
- SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype logic");
- ARegionType *art;
-
- st->spaceid = SPACE_LOGIC;
- strncpy(st->name, "Logic", BKE_ST_MAXNAME);
-
- st->new = logic_new;
- st->free = logic_free;
- st->init = logic_init;
- st->duplicate = logic_duplicate;
- st->operatortypes = logic_operatortypes;
- st->keymap = logic_keymap;
- st->refresh = logic_refresh;
- st->context = logic_context;
- st->id_remap = logic_id_remap;
-
- /* regions: main window */
- art = MEM_callocN(sizeof(ARegionType), "spacetype logic region");
- art->regionid = RGN_TYPE_WINDOW;
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES | ED_KEYMAP_VIEW2D;
- art->init = logic_main_region_init;
- art->draw = logic_main_region_draw;
- art->listener = logic_listener;
-
- BLI_addhead(&st->regiontypes, art);
-
- /* regions: listview/buttons */
- art = MEM_callocN(sizeof(ARegionType), "spacetype logic region");
- art->regionid = RGN_TYPE_UI;
- art->prefsizex= 220; // XXX
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
- art->listener = logic_listener;
- art->init = logic_buttons_region_init;
- art->draw = logic_buttons_region_draw;
- BLI_addhead(&st->regiontypes, art);
-
- /* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
- art->regionid = RGN_TYPE_HEADER;
- art->prefsizey = HEADERY;
- art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
- art->init = logic_header_region_init;
- art->draw = logic_header_region_draw;
-
- BLI_addhead(&st->regiontypes, art);
-
- BKE_spacetype_register(st);
-}
-
-
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index d148ef3c6fe..d027729c7a7 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -84,13 +84,6 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
-if(WITH_GAMEENGINE)
- list(APPEND INC
- ../../../gameengine/BlenderRoutines
- )
- add_definitions(-DWITH_GAMEENGINE)
-endif()
-
add_definitions(${GL_DEFINITIONS})
if(WITH_INTERNATIONAL)
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 0d4ec4d42d1..2b3678c4812 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -41,7 +41,6 @@
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
-#include "DNA_property_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
@@ -51,7 +50,6 @@
#include "BKE_image.h"
#include "BKE_material.h"
#include "BKE_paint.h"
-#include "BKE_property.h"
#include "BKE_editmesh.h"
#include "BKE_scene.h"
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 287613c847b..1d54a1937eb 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -328,7 +328,7 @@ bool draw_glsl_material(Scene *scene, ViewLayer *view_layer, Object *ob, View3D
return true;
if (v3d->drawtype == OB_TEXTURE)
- return (scene->gm.matmode == GAME_MAT_GLSL && !BKE_scene_use_new_shading_nodes(scene));
+ return !BKE_scene_use_new_shading_nodes(scene);
else if (v3d->drawtype == OB_MATERIAL && dt > OB_SOLID)
return true;
else
@@ -1189,51 +1189,6 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z, unsigned pos)
glDisable(GL_CULL_FACE);
}
-#ifdef WITH_GAMEENGINE
-static void draw_transp_sun_volume(Lamp *la, unsigned pos)
-{
- float box[8][3];
-
- /* construct box */
- box[0][0] = box[1][0] = box[2][0] = box[3][0] = -la->shadow_frustum_size;
- box[4][0] = box[5][0] = box[6][0] = box[7][0] = +la->shadow_frustum_size;
- box[0][1] = box[1][1] = box[4][1] = box[5][1] = -la->shadow_frustum_size;
- box[2][1] = box[3][1] = box[6][1] = box[7][1] = +la->shadow_frustum_size;
- box[0][2] = box[3][2] = box[4][2] = box[7][2] = -la->clipend;
- box[1][2] = box[2][2] = box[5][2] = box[6][2] = -la->clipsta;
-
- /* draw edges */
- imm_draw_box(box, false, pos);
-
- /* draw faces */
- glEnable(GL_CULL_FACE);
- glEnable(GL_BLEND);
- glDepthMask(GL_FALSE);
-
- /* draw backside darkening */
- glCullFace(GL_FRONT);
-
- glBlendFunc(GL_ZERO, GL_SRC_ALPHA);
- immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f);
-
- imm_draw_box(box, true, pos);
-
- /* draw front side lighting */
- glCullFace(GL_BACK);
-
- glBlendFunc(GL_ONE, GL_ONE);
- immUniformColor3f(0.2f, 0.2f, 0.2f);
-
- imm_draw_box(box, true, pos);
-
- /* restore state */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glDisable(GL_BLEND);
- glDepthMask(GL_TRUE);
- glDisable(GL_CULL_FACE);
-}
-#endif
-
void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
const char dt, const short dflag, const unsigned char ob_wire_col[4], const bool is_obact)
{
@@ -1253,22 +1208,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
!(base->flag_legacy & OB_FROMDUPLI) &&
!is_view);
-#ifdef WITH_GAMEENGINE
- const bool drawshadowbox = (
- (rv3d->rflag & RV3D_IS_GAME_ENGINE) &&
- (dt > OB_WIRE) &&
- !(G.f & G_PICKSEL) &&
- (la->type == LA_SUN) &&
- ((la->mode & LA_SHAD_BUF) ||
- (la->mode & LA_SHAD_RAY)) &&
- (la->mode & LA_SHOW_SHADOW_BOX) &&
- !(base->flag_legacy & OB_FROMDUPLI) &&
- !is_view);
-#else
- const bool drawshadowbox = false;
-#endif
-
- if ((drawcone || drawshadowbox) && !v3d->transp) {
+ if (drawcone && !v3d->transp) {
/* in this case we need to draw delayed */
ED_view3d_after_add(&v3d->afterdraw_transp, base, dflag);
return;
@@ -1576,11 +1516,6 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
}
}
-#ifdef WITH_GAMEENGINE
- if (drawshadowbox) {
- draw_transp_sun_volume(la, pos);
- }
-#endif
}
else if (la->type == LA_AREA) {
setlinestyle(3);
@@ -4300,11 +4235,7 @@ static void draw_mesh_fancy(
Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base,
const char dt, const unsigned char ob_wire_col[4], const short dflag)
{
-#ifdef WITH_GAMEENGINE
- Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, view_layer) : base->object;
-#else
Object *ob = base->object;
-#endif
Mesh *me = ob->data;
eWireDrawMode draw_wire = OBDRAW_WIRE_OFF;
bool /* no_verts,*/ no_edges, no_faces;
@@ -4718,11 +4649,7 @@ static void draw_mesh_fancy_new(
return;
}
-#ifdef WITH_GAMEENGINE
- Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, view_layer) : base->object;
-#else
Object *ob = base->object;
-#endif
Mesh *me = ob->data;
eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; /* could be bool draw_wire_overlay */
bool no_edges, no_faces;
@@ -8177,33 +8104,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col
if (bb == NULL)
return;
- if (ob->gameflag & OB_BOUNDS) { /* bounds need to be drawn around origin for game engine */
-
- if (type == OB_BOUND_BOX) {
- float vec[8][3], size[3];
-
- unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
-
- BKE_boundbox_calc_size_aabb(bb, size);
-
- vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = -size[0];
- vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = +size[0];
- vec[0][1] = vec[1][1] = vec[4][1] = vec[5][1] = -size[1];
- vec[2][1] = vec[3][1] = vec[6][1] = vec[7][1] = +size[1];
- vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = -size[2];
- vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = +size[2];
-
- imm_draw_box(vec, false, pos);
-
- immUnbindProgram();
- }
- else {
- imm_draw_bb(bb, type, true, ob_wire_col);
- }
- }
- else {
+ {
if (type == OB_BOUND_BOX) {
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -8384,48 +8285,6 @@ static void draw_hooks(Object *ob, unsigned int pos)
}
}
-static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data,
- const short dflag, const unsigned char ob_wire_col[4])
-{
- const char *axis_str[3] = {"px", "py", "pz"};
- float mat[4][4];
-
- unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
-
- if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
-
- eul_to_mat4(mat, &data->axX);
- glLineWidth(4.0f);
- setlinestyle(2);
-
- immBegin(GWN_PRIM_LINES, 6);
- for (int axis = 0; axis < 3; axis++) {
- float dir[3] = {0, 0, 0};
- float v[3];
-
- copy_v3_v3(v, &data->pivX);
-
- dir[axis] = 1.0f;
- mul_m4_v3(mat, dir);
- add_v3_v3(v, dir);
- immVertex3fv(pos, &data->pivX);
- immVertex3fv(pos, v);
-
- /* when const color is set wirecolor is NULL - we could get the current color but
- * with selection and group instancing its not needed to draw the text */
- if ((dflag & DRAW_CONSTCOLOR) == 0) {
- view3d_cached_text_draw_add(v, axis_str[axis], 2, 0, V3D_CACHE_TEXT_ASCII, ob_wire_col);
- }
- }
- immEnd();
-
- setlinestyle(0);
- glLineWidth(1.0f);
-
- immUnbindProgram();
-}
-
void draw_object_wire_color(ViewLayer *view_layer, Base *base, unsigned char r_ob_wire_col[4])
{
Object *ob = base->object;
@@ -9059,23 +8918,6 @@ afterdraw:
}
if (!render_override) {
- bConstraint *con;
-
- for (con = ob->constraints.first; con; con = con->next) {
- if (con->type == CONSTRAINT_TYPE_RIGIDBODYJOINT) {
- bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)con->data;
- if (data->flag & CONSTRAINT_DRAW_PIVOT)
- draw_rigid_body_pivot(data, dflag, ob_wire_col);
- }
- }
-
- if ((ob->gameflag & OB_BOUNDS) && (ob->mode == OB_MODE_OBJECT)) {
- if (ob->boundtype != ob->collision_boundtype || (dtx & OB_DRAWBOUNDOX) == 0) {
- setlinestyle(2);
- draw_bounding_volume(ob, ob->collision_boundtype, ob_wire_col);
- setlinestyle(0);
- }
- }
if (ob->rigidbody_object) {
draw_rigidbody_shape(ob, ob_wire_col);
}
@@ -9120,33 +8962,6 @@ afterdraw:
}
}
- if ((dt <= OB_SOLID) && !render_override) {
- if (((ob->gameflag & OB_DYNAMIC) &&
- ((ob->gameflag & OB_BOUNDS) == 0)) ||
-
- ((ob->gameflag & OB_BOUNDS) &&
- (ob->collision_boundtype == OB_BOUND_SPHERE)))
- {
- float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f};
-
- unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
-
- invert_m4_m4(imat, rv3d->viewmatob);
-
- if ((dflag & DRAW_CONSTCOLOR) == 0) {
- /* prevent random colors being used */
- immUniformColor3ubv(ob_wire_col);
- }
-
- setlinestyle(2);
- imm_drawcircball(vec, ob->inertia, imat, pos);
- setlinestyle(0);
-
- immUnbindProgram();
- }
- }
-
/* return warning, this is cached text draw */
invert_m4_m4(ob->imat, ob->obmat);
view3d_cached_text_draw_end(v3d, ar, 1);
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index dcdcf95bf86..807a4f212f6 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -990,12 +990,6 @@ static void draw_dupli_objects_color(
/* Make sure lod is updated from dupli's position */
savedlod = dob->ob->currentlod;
-#ifdef WITH_GAMEENGINE
- if (rv3d->rflag & RV3D_IS_GAME_ENGINE) {
- BKE_object_lod_update(dob->ob, rv3d->viewinv[3]);
- }
-#endif
-
/* extra service: draw the duplicator in drawtype of parent, minimum taken
* to allow e.g. boundbox box objects in groups for LOD */
dt = tbase.object->dt;
@@ -1467,9 +1461,7 @@ CustomDataMask ED_view3d_datamask(const Scene *scene, const View3D *v3d)
mask |= CD_MASK_ORCO;
}
else {
- if ((scene->gm.matmode == GAME_MAT_GLSL && drawtype == OB_TEXTURE) ||
- (drawtype == OB_MATERIAL))
- {
+ if (drawtype == OB_MATERIAL) {
mask |= CD_MASK_ORCO;
}
}
@@ -1925,19 +1917,6 @@ static void view3d_main_region_draw_engine_info(View3D *v3d, RegionView3D *rv3d,
ED_region_info_draw(ar, rv3d->render_engine->text, fill_color, true);
}
-#ifdef WITH_GAMEENGINE
-static void update_lods(Scene *scene, float camera_pos[3])
-{
- Scene *sce_iter;
- Base *base;
-
- for (SETLOOPER(scene, sce_iter, base)) {
- Object *ob = base->object;
- BKE_object_lod_update(ob, camera_pos);
- }
-}
-#endif
-
static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, ViewLayer *view_layer, View3D *v3d,
ARegion *ar, const char **grid_unit)
{
@@ -1964,16 +1943,6 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie
VP_legacy_view3d_main_region_setup_view(depsgraph, scene, v3d, ar, NULL, NULL);
}
- rv3d->rflag &= ~RV3D_IS_GAME_ENGINE;
-#ifdef WITH_GAMEENGINE
- if (STREQ(scene->view_render.engine_id, RE_engine_id_BLENDER_GAME)) {
- rv3d->rflag |= RV3D_IS_GAME_ENGINE;
-
- /* Make sure LoDs are up to date */
- update_lods(scene, rv3d->viewinv[3]);
- }
-#endif
-
/* main drawing call */
view3d_draw_objects(C, depsgraph, scene, v3d, ar, grid_unit, true, false);
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 4b005185638..64927ff55c7 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -251,8 +251,6 @@ void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
void VIEW3D_OT_camera_to_view(struct wmOperatorType *ot);
void VIEW3D_OT_camera_to_view_selected(struct wmOperatorType *ot);
void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot);
-void VIEW3D_OT_game_start(struct wmOperatorType *ot);
-
bool ED_view3d_boundbox_clip_ex(const RegionView3D *rv3d, const struct BoundBox *bb, float obmat[4][4]);
bool ED_view3d_boundbox_clip(RegionView3D *rv3d, const struct BoundBox *bb);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 8e6f5228b09..0274ddd82fc 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -203,7 +203,6 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_camera_to_view);
WM_operatortype_append(VIEW3D_OT_camera_to_view_selected);
WM_operatortype_append(VIEW3D_OT_object_as_camera);
- WM_operatortype_append(VIEW3D_OT_game_start);
WM_operatortype_append(VIEW3D_OT_fly);
WM_operatortype_append(VIEW3D_OT_walk);
WM_operatortype_append(VIEW3D_OT_navigate);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 1d44f3d3fd5..b6ea68c8fe4 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -64,15 +64,6 @@
#include "DEG_depsgraph_query.h"
-#ifdef WITH_GAMEENGINE
-# include "BLI_listbase.h"
-# include "BLI_callbacks.h"
-
-# include "GPU_draw.h"
-
-# include "BL_System.h"
-#endif
-
#include "view3d_intern.h" /* own include */
/* -------------------------------------------------------------------- */
@@ -1090,213 +1081,3 @@ int ED_view3d_view_layer_set(int lay, const int *values, int *active)
}
/** \} */
-
-/* -------------------------------------------------------------------- */
-/** \name Game Engine Operator
- *
- * Start the game engine (handles context switching).
- * \{ */
-
-#ifdef WITH_GAMEENGINE
-
-static ListBase queue_back;
-static void game_engine_save_state(bContext *C, wmWindow *win)
-{
- Object *obact = CTX_data_active_object(C);
-
- glPushAttrib(GL_ALL_ATTRIB_BITS);
-
- if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
- GPU_paint_set_mipmap(1);
- }
-
- queue_back = win->queue;
-
- BLI_listbase_clear(&win->queue);
-}
-
-static void game_engine_restore_state(bContext *C, wmWindow *win)
-{
- Object *obact = CTX_data_active_object(C);
-
- if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
- GPU_paint_set_mipmap(0);
- }
- /* check because closing win can set to NULL */
- if (win) {
- win->queue = queue_back;
- }
-
- GPU_state_init();
-
- glPopAttrib();
-}
-
-/* was space_set_commmandline_options in 2.4x */
-static void game_set_commmandline_options(GameData *gm)
-{
- SYS_SystemHandle syshandle;
- int test;
-
- if ((syshandle = SYS_GetSystem())) {
- /* User defined settings */
- test = (U.gameflags & USER_DISABLE_MIPMAP);
- GPU_set_mipmap(!test);
- SYS_WriteCommandLineInt(syshandle, "nomipmap", test);
-
- /* File specific settings: */
- /* Only test the first one. These two are switched
- * simultaneously. */
- test = (gm->flag & GAME_SHOW_FRAMERATE);
- SYS_WriteCommandLineInt(syshandle, "show_framerate", test);
- SYS_WriteCommandLineInt(syshandle, "show_profile", test);
-
- test = (gm->flag & GAME_SHOW_DEBUG_PROPS);
- SYS_WriteCommandLineInt(syshandle, "show_properties", test);
-
- test = (gm->flag & GAME_SHOW_PHYSICS);
- SYS_WriteCommandLineInt(syshandle, "show_physics", test);
-
- test = (gm->flag & GAME_ENABLE_ALL_FRAMES);
- SYS_WriteCommandLineInt(syshandle, "fixedtime", test);
-
- test = (gm->flag & GAME_ENABLE_ANIMATION_RECORD);
- SYS_WriteCommandLineInt(syshandle, "animation_record", test);
-
- test = (gm->flag & GAME_IGNORE_DEPRECATION_WARNINGS);
- SYS_WriteCommandLineInt(syshandle, "ignore_deprecation_warnings", test);
-
- test = (gm->matmode == GAME_MAT_MULTITEX);
- SYS_WriteCommandLineInt(syshandle, "blender_material", test);
- test = (gm->matmode == GAME_MAT_GLSL);
- SYS_WriteCommandLineInt(syshandle, "blender_glsl_material", test);
- }
-}
-
-#endif /* WITH_GAMEENGINE */
-
-static int game_engine_poll(bContext *C)
-{
- const wmWindow *win = CTX_wm_window(C);
- const Scene *scene = WM_window_get_active_scene(win);
-
- /* we need a context and area to launch BGE
- * it's a temporary solution to avoid crash at load time
- * if we try to auto run the BGE. Ideally we want the
- * context to be set as soon as we load the file. */
-
- if (win == NULL) return 0;
- if (CTX_wm_screen(C) == NULL) return 0;
-
- if (CTX_data_mode_enum(C) != CTX_MODE_OBJECT)
- return 0;
-
- if (!BKE_scene_uses_blender_game(scene))
- return 0;
-
- return 1;
-}
-
-static int game_engine_exec(bContext *C, wmOperator *op)
-{
-#ifdef WITH_GAMEENGINE
- Scene *startscene = CTX_data_scene(C);
- Main *bmain = CTX_data_main(C);
- ScrArea /* *sa, */ /* UNUSED */ *prevsa = CTX_wm_area(C);
- ARegion *ar, *prevar = CTX_wm_region(C);
- wmWindow *prevwin = CTX_wm_window(C);
- RegionView3D *rv3d;
- rcti cam_frame;
-
- UNUSED_VARS(op);
-
- /* bad context switch .. */
- if (!ED_view3d_context_activate(C))
- return OPERATOR_CANCELLED;
-
- /* redraw to hide any menus/popups, we don't go back to
- * the window manager until after this operator exits */
- WM_redraw_windows(C);
-
- BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_PRE);
-
- rv3d = CTX_wm_region_view3d(C);
- /* sa = CTX_wm_area(C); */ /* UNUSED */
- ar = CTX_wm_region(C);
-
- view3d_operator_needs_opengl(C);
-
- game_set_commmandline_options(&startscene->gm);
-
- if ((rv3d->persp == RV3D_CAMOB) &&
- (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) &&
- (startscene->gm.stereoflag != STEREO_DOME))
- {
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
- /* Letterbox */
- rctf cam_framef;
- ED_view3d_calc_camera_border(startscene, depsgraph, ar, CTX_wm_view3d(C), rv3d, &cam_framef, false);
- cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;
- cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin;
- cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin;
- cam_frame.ymax = cam_framef.ymax + ar->winrct.ymin;
- BLI_rcti_isect(&ar->winrct, &cam_frame, &cam_frame);
- }
- else {
- cam_frame.xmin = ar->winrct.xmin;
- cam_frame.xmax = ar->winrct.xmax;
- cam_frame.ymin = ar->winrct.ymin;
- cam_frame.ymax = ar->winrct.ymax;
- }
-
-
- game_engine_save_state(C, prevwin);
-
- StartKetsjiShell(C, ar, &cam_frame, 1);
-
- /* window wasnt closed while the BGE was running */
- if (BLI_findindex(&CTX_wm_manager(C)->windows, prevwin) == -1) {
- prevwin = NULL;
- CTX_wm_window_set(C, NULL);
- }
-
- ED_area_tag_redraw(CTX_wm_area(C));
-
- if (prevwin) {
- /* restore context, in case it changed in the meantime, for
- * example by working in another window or closing it */
- CTX_wm_region_set(C, prevar);
- CTX_wm_window_set(C, prevwin);
- CTX_wm_area_set(C, prevsa);
- }
-
- game_engine_restore_state(C, prevwin);
-
- //XXX restore_all_scene_cfra(scene_cfra_store);
- BKE_scene_set_background(CTX_data_main(C), startscene);
- //XXX BKE_scene_graph_update_for_newframe(depsgraph, bmain);
-
- BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_POST);
-
- return OPERATOR_FINISHED;
-#else
- UNUSED_VARS(C);
- BKE_report(op->reports, RPT_ERROR, "Game engine is disabled in this build");
- return OPERATOR_CANCELLED;
-#endif
-}
-
-void VIEW3D_OT_game_start(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Start Game Engine";
- ot->description = "Start game engine";
- ot->idname = "VIEW3D_OT_game_start";
-
- /* api callbacks */
- ot->exec = game_engine_exec;
-
- ot->poll = game_engine_poll;
-}
-
-/** \} */