From 15f728ad080bb78db49937c060c36f06070b1af6 Mon Sep 17 00:00:00 2001 From: Mike Christel Date: Tue, 27 Apr 2010 16:01:44 +0000 Subject: [PATCH] simplified; functionality moved out to maxscript --- pandatool/src/maxegg/maxEgg.rc | 27 +-- pandatool/src/maxegg/maxNodeTree.cxx | 192 +++++++++++------ pandatool/src/maxegg/maxNodeTree.h | 7 +- pandatool/src/maxegg/maxOptionsDialog.cxx | 238 +--------------------- pandatool/src/maxegg/maxOptionsDialog.h | 37 +--- pandatool/src/maxegg/maxResource.h | 16 -- 6 files changed, 151 insertions(+), 366 deletions(-) diff --git a/pandatool/src/maxegg/maxEgg.rc b/pandatool/src/maxegg/maxEgg.rc index 8898f5c41c..161b0ec456 100755 --- a/pandatool/src/maxegg/maxEgg.rc +++ b/pandatool/src/maxegg/maxEgg.rc @@ -8,7 +8,6 @@ // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" - ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -26,7 +25,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // Dialog // -IDD_EGG_DETAILS DIALOGEX 0, 0, 256, 266 +IDD_EGG_DETAILS DIALOGEX 0, 0, 256, 203 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Export Settings" FONT 8, "MS Shell Dlg", 400, 0, 0x1 @@ -36,7 +35,6 @@ BEGIN CONTROL "Animation",IDC_ANIMATION,"Button",BS_AUTORADIOBUTTON | BS_LEFT,108,4,50,12 CONTROL "Both",IDC_BOTH,"Button",BS_AUTORADIOBUTTON | BS_LEFT,164,4,35,12 CONTROL "Static",IDC_POSE,"Button",BS_AUTORADIOBUTTON | BS_LEFT,206,4,38,12 - GROUPBOX "Options",IDC_STATIC,5,17,246,230,WS_GROUP LTEXT "Filename",IDC_STATIC,12,30,66,8,NOT WS_GROUP CONTROL "Custom1",IDC_FILENAME,"CustEdit",WS_TABSTOP,12,42,180,12 CONTROL "Browse...",IDC_BROWSE,"CustButton",WS_TABSTOP,198,42,48,12 @@ -52,26 +50,9 @@ BEGIN LTEXT "End Frame",IDC_EF_LABEL,143,104,42,8,WS_DISABLED | NOT WS_GROUP CONTROL "Custom5",IDC_EF,"CustEdit",WS_DISABLED | WS_TABSTOP,186,102,48,12 CONTROL "Double-sided Polygons",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,144,126,102,12 - CONTROL "OK",IDC_OK,"CustButton",WS_TABSTOP,163,250,42,12 - CONTROL "Cancel",IDC_CANCEL,"CustButton",WS_TABSTOP,209,250,42,12 - CONTROL "Add Collision",IDC_COLLISION,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,15,146,52,10 - LTEXT "Collision Solid Type",IDC_STATIC,16,159,66,8,NOT WS_GROUP - LTEXT "Collide Flags",IDC_STATIC,16,200,66,8,NOT WS_GROUP - CONTROL "Plane",IDC_PLANE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,75,170,50,10 - CONTROL "Sphere",IDC_SPHERE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,129,170,50,10 - CONTROL "Polygon",IDC_POLYGON,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,183,170,50,10 - CONTROL "PolySet",IDC_POLYSET,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,21,170,50,9 - CONTROL "Tube",IDC_TUBE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,21,183,50,10 - CONTROL "Inv-sphere",IDC_INSPHERE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,75,183,50,10 - CONTROL "FloorMesh",IDC_FLOORMESH,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,129,183,50,10 - CONTROL "Descend",IDC_DESCEND,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,21,211,50,10 - CONTROL "Keep",IDC_KEEP,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,75,211,50,10 - CONTROL "Event",IDC_EVENT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,129,211,50,10 - CONTROL "Solid",IDC_SOLID,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,183,211,50,10 - CONTROL "Center",IDC_CENTER,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,21,225,50,10 - CONTROL "Turnstile",IDC_TURNSTILE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,183,225,50,10 - CONTROL "Level",IDC_LEVEL,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,129,225,50,10 - CONTROL "Intangible",IDC_INTANGIBLE,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,75,225,50,10 + CONTROL "OK",IDC_OK,"CustButton",WS_TABSTOP,162,179,42,12 + CONTROL "Cancel",IDC_CANCEL,"CustButton",WS_TABSTOP,208,179,42,12 + LTEXT "The collision tags are now defined within each object's User Defined properties window. For more information and help please consult the panda3d manual at www.panda3d.org",IDC_STATIC,12,146,225,26 END diff --git a/pandatool/src/maxegg/maxNodeTree.cxx b/pandatool/src/maxegg/maxNodeTree.cxx index daa0e661ee..3da9b97fbc 100755 --- a/pandatool/src/maxegg/maxNodeTree.cxx +++ b/pandatool/src/maxegg/maxNodeTree.cxx @@ -24,10 +24,7 @@ MaxNodeTree:: MaxNodeTree() { _root = new MaxNodeDesc; _fps = 0.0; - _has_collision = false; _export_mesh = false; - _cs_type = EggGroup::CST_none; - _cf_type = EggGroup::CF_none; _egg_data = (EggData *)NULL; _egg_root = (EggGroupNode *)NULL; _skeleton_node = (EggGroupNode *)NULL; @@ -175,85 +172,29 @@ get_egg_group(MaxNodeDesc *node_desc) { if (node_desc->is_joint()) { egg_group->set_group_type(EggGroup::GT_joint); } - if (node_desc->_parent == _root) { // The parent is the root. // Set collision properties for the root if it has them: - if(_has_collision && !_export_mesh) + if(!_export_mesh) { - egg_group->set_collision_name(node_desc->get_name()); - egg_group->set_cs_type(_cs_type); - egg_group->set_collide_flags(_cf_type); + set_collision_tags(node_desc, egg_group); } _egg_root->add_child(egg_group); } else { // The parent is another node. // if export mesh, the tag should be added at the second level - if(_has_collision && _export_mesh) + if(_export_mesh) { if(node_desc->_parent->_parent == _root) { - egg_group->set_collision_name(node_desc->get_name()); - egg_group->set_cs_type(_cs_type); - egg_group->set_collide_flags(_cf_type); + set_collision_tags(node_desc, egg_group); } } EggGroup *parent_egg_group = get_egg_group(node_desc->_parent); parent_egg_group->add_child(egg_group); } - // *** This is probably something that a Max plugin would need to be - // written for. May want to ask Disney about it - /* - if (node_desc->has_dag_path()) { - // Check for an object type setting, from Oliver's plug-in. - MObject dag_object = node_desc->get_dag_path().node(); - string object_type; - if (get_enum_attribute(dag_object, "eggObjectTypes1", object_type)) { - egg_group->add_object_type(object_type); - } - if (get_enum_attribute(dag_object, "eggObjectTypes2", object_type)) { - egg_group->add_object_type(object_type); - } - if (get_enum_attribute(dag_object, "eggObjectTypes3", object_type)) { - egg_group->add_object_type(object_type); - } - - // We treat the object type "billboard" as a special case: we - // apply this one right away and also flag the group as an - // instance. - if (egg_group->has_object_type("billboard")) { - egg_group->remove_object_type("billboard"); - egg_group->set_group_type(EggGroup::GT_instance); - egg_group->set_billboard_type(EggGroup::BT_axis); - - } else if (egg_group->has_object_type("billboard-point")) { - egg_group->remove_object_type("billboard-point"); - egg_group->set_group_type(EggGroup::GT_instance); - egg_group->set_billboard_type(EggGroup::BT_point_camera_relative); - } - - // We also treat the object type "dcs" and "model" as a special - // case, so we can test for these flags later. - if (egg_group->has_object_type("dcs")) { - egg_group->remove_object_type("dcs"); - egg_group->set_dcs_type(EggGroup::DC_default); - } - if (egg_group->has_object_type("model")) { - egg_group->remove_object_type("model"); - egg_group->set_model_flag(true); - } - - // And "vertex-color" has meaning only to this converter. - if (egg_group->has_object_type("vertex-color")) { - egg_group->remove_object_type("vertex-color"); - MaxEggGroupUserData *user_data = new MaxEggGroupUserData; - user_data->_vertex_color = true; - egg_group->set_user_data(user_data); - } - } - */ node_desc->_egg_group = egg_group; } @@ -421,3 +362,128 @@ find_joint(INode* max_node) node = build_node(max_node); return node->_joint_entry; } + +//////////////////////////////////////////////////////////////////// +// Function: MaxNodeTree::set_collision_tags +// Access: Private +// Description: Sets the corresponding collision tag to the egg_group +// based on the User Defined Tab in the object properties +// panel +//////////////////////////////////////////////////////////////////// +void MaxNodeTree::set_collision_tags(MaxNodeDesc *node_desc, EggGroup *egg_group) { + //Max has huge problems passing strings and bools to Get and SetUserProp + //So instead we have to use Integers. Now we have to check + //for every collide type, then get its collide flags and + //do some number crunching to get the actual flag into the group + + int check = 1; //is the value true. This could be anything really + + //We have to check each collision type in turn to see if it's true + //Ugly but it works per object, not globaly + if (node_desc->get_max_node()->GetUserPropInt(_M("polyset"), check)) { + //we have a polyset. + if (check == 1) { + egg_group->set_collision_name(node_desc->get_name()); + egg_group->set_cs_type(EggGroup::CST_polyset); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("plane"), check)) { + //plane + if (check == 1) { + egg_group->set_collision_name(node_desc->get_name()); + egg_group->set_cs_type(EggGroup::CST_plane); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("polygon"), check)) { + //polygon + if (check == 1) { + egg_group->set_collision_name(node_desc->get_name()); + egg_group->set_cs_type(EggGroup::CST_polygon); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("sphere"), check)) { + //sphere + if (check == 1) { + egg_group->set_collision_name(node_desc->get_name()); + egg_group->set_cs_type(EggGroup::CST_sphere); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("inv-sphere"), check)) { + //invsphere + if (check == 1) { + egg_group->set_collision_name(node_desc->get_name()); + egg_group->set_cs_type(EggGroup::CST_inv_sphere); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("invsphere"), check)) { + //invsphere (different spelling) + if (check == 1) { + egg_group->set_collision_name(node_desc->get_name()); + egg_group->set_cs_type(EggGroup::CST_inv_sphere); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("tube"), check)) { + //tube + if (check == 1) { + egg_group->set_collision_name(node_desc->get_name()); + egg_group->set_cs_type(EggGroup::CST_tube); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("floor-mesh"), check)) { + //floor-mesh + if (check == 1) { + egg_group->set_collision_name(node_desc->get_name()); + egg_group->set_cs_type(EggGroup::CST_floor_mesh); + } + } + + if (node_desc->get_max_node()->GetUserPropInt(_M("descend"), check)) { + if (check == 1) { + //we have the descend flag specified + egg_group->set_collide_flags(EggGroup::CF_descend); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("event"), check)) { + if (check == 1) { + //we have the event flag specified + egg_group->set_collide_flags(EggGroup::CF_event); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("keep"), check)) { + if (check == 1) { + //we have the keep flag specified + egg_group->set_collide_flags(EggGroup::CF_keep); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("solid"), check)) { + if (check == 1) { + //we have the solid flag specified + egg_group->set_collide_flags(EggGroup::CF_solid); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("center"), check)) { + if (check == 1) { + //we have the center flag specified + egg_group->set_collide_flags(EggGroup::CF_center); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("turnstile"), check)) { + if (check == 1) { + //we have the turnstile flag specified + egg_group->set_collide_flags(EggGroup::CF_turnstile); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("level"), check)) { + if (check == 1) { + //we have the level flag specified + egg_group->set_collide_flags(EggGroup::CF_level); + } + } + if (node_desc->get_max_node()->GetUserPropInt(_M("intangible"), check)) { + if (check == 1) { + //we have the intangible flag specified + egg_group->set_collide_flags(EggGroup::CF_intangible); + } + } + return; +} \ No newline at end of file diff --git a/pandatool/src/maxegg/maxNodeTree.h b/pandatool/src/maxegg/maxNodeTree.h index 63f087f99a..5b5c65c8a9 100755 --- a/pandatool/src/maxegg/maxNodeTree.h +++ b/pandatool/src/maxegg/maxNodeTree.h @@ -45,9 +45,9 @@ public: MaxNodeDesc* _root; float _fps; // the flag for the setting up collision - bool _has_collision; - EggGroup::CollideFlags _cf_type; - EggGroup::CollisionSolidType _cs_type; + //bool _has_collision; + //EggGroup::CollideFlags _cf_type; + //EggGroup::CollisionSolidType _cs_type; bool _export_mesh; private: @@ -60,6 +60,7 @@ private: bool node_in_list(ULONG handle, ULONG *list, int len); bool r_build_hierarchy(INode *root, ULONG *selection_list, int len); bool is_joint(INode *node); + void set_collision_tags(MaxNodeDesc *node_desc, EggGroup *egg_group); typedef pmap NodesByPath; NodesByPath _nodes_by_path; diff --git a/pandatool/src/maxegg/maxOptionsDialog.cxx b/pandatool/src/maxegg/maxOptionsDialog.cxx index c2b69347c8..59403df561 100644 --- a/pandatool/src/maxegg/maxOptionsDialog.cxx +++ b/pandatool/src/maxegg/maxOptionsDialog.cxx @@ -144,28 +144,6 @@ void enableChooserControls(HWND hWnd, BOOL val) { EnableWindow(GetDlgItem(hWnd, IDC_REMOVE_EXPORT), val); } -void enableAddCollision(HWND hWnd, BOOL val) { - EnableWindow(GetDlgItem(hWnd, IDC_COLLISION), val); -} - -void enableAddCollisionChoices(HWND hWnd, BOOL val) { - EnableWindow(GetDlgItem(hWnd, IDC_PLANE), val); - EnableWindow(GetDlgItem(hWnd, IDC_SPHERE), val); - EnableWindow(GetDlgItem(hWnd, IDC_POLYGON), val); - EnableWindow(GetDlgItem(hWnd, IDC_POLYSET), val); - EnableWindow(GetDlgItem(hWnd, IDC_TUBE), val); - EnableWindow(GetDlgItem(hWnd, IDC_INSPHERE), val); - EnableWindow(GetDlgItem(hWnd, IDC_FLOORMESH), val); - EnableWindow(GetDlgItem(hWnd, IDC_DESCEND), val); - EnableWindow(GetDlgItem(hWnd, IDC_KEEP), val); - EnableWindow(GetDlgItem(hWnd, IDC_EVENT), val); - EnableWindow(GetDlgItem(hWnd, IDC_SOLID), val); - EnableWindow(GetDlgItem(hWnd, IDC_CENTER), val); - EnableWindow(GetDlgItem(hWnd, IDC_TURNSTILE), val); - EnableWindow(GetDlgItem(hWnd, IDC_LEVEL), val); - EnableWindow(GetDlgItem(hWnd, IDC_INTANGIBLE), val); -} - #define ANIM_RAD_NONE 0 #define ANIM_RAD_EXPALL 1 @@ -211,7 +189,7 @@ int AddNodeCB::filter(INode *node) { return is_bone && !ph->FindNode(node->GetHandle()); else return ( - is_bone || + is_bone || ((obj->SuperClassID() == HELPER_CLASS_ID && obj->ClassID() != MaxEggPlugin_CLASS_ID)) || ((obj->SuperClassID() == GEOMOBJECT_CLASS_ID && //Allow geometrics obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0))) || (obj->SuperClassID() == SHAPE_CLASS_ID && //Allow CV NURBS @@ -259,10 +237,7 @@ MaxEggOptions::MaxEggOptions() { _start_frame = INT_MIN; _end_frame = INT_MIN; _double_sided = false; - // initialize newly added collision options, too - _add_collision = false; - _cs_type = CS_none; - _cf_type = CF_none; + _file_name[0]=0; _short_name[0]=0; @@ -286,10 +261,7 @@ INT_PTR CALLBACK MaxOptionsDialogProc( HWND hWnd, UINT message, WPARAM wParam, L // this line is very necessary to pass the plugin as the lParam SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam); ((MaxOptionsDialog*)lParam)->UpdateUI(hWnd); - if(IsDlgButtonChecked(hWnd,IDC_COLLISION) && !IsDlgButtonChecked(hWnd, IDC_ANIMATION)) - enableAddCollisionChoices(hWnd, TRUE); - else - enableAddCollisionChoices(hWnd, FALSE); + return TRUE; break; case WM_CLOSE: @@ -308,11 +280,7 @@ INT_PTR CALLBACK MaxOptionsDialogProc( HWND hWnd, UINT message, WPARAM wParam, L enableAnimControls(hWnd, FALSE); if (imp->_prev_type == MaxEggOptions::AT_chan) imp->ClearNodeList(hWnd); imp->_prev_type = MaxEggOptions::AT_model; - enableAddCollision(hWnd, TRUE); - if(IsDlgButtonChecked(hWnd,IDC_COLLISION)) - { - enableAddCollisionChoices(hWnd, TRUE); - } + return TRUE; } break; @@ -327,8 +295,7 @@ INT_PTR CALLBACK MaxOptionsDialogProc( HWND hWnd, UINT message, WPARAM wParam, L if (imp->_prev_type != MaxEggOptions::AT_chan) imp->ClearNodeList(hWnd); imp->_prev_type = MaxEggOptions::AT_chan; CheckRadioButton(hWnd, IDC_EXP_ALL_FRAMES, IDC_EXP_SEL_FRAMES, IDC_EXP_ALL_FRAMES); - enableAddCollision(hWnd, FALSE); - enableAddCollisionChoices(hWnd, FALSE); + return TRUE; } break; @@ -342,11 +309,7 @@ INT_PTR CALLBACK MaxOptionsDialogProc( HWND hWnd, UINT message, WPARAM wParam, L if (imp->_prev_type == MaxEggOptions::AT_chan) imp->ClearNodeList(hWnd); imp->_prev_type = MaxEggOptions::AT_both; CheckRadioButton(hWnd, IDC_EXP_ALL_FRAMES, IDC_EXP_SEL_FRAMES, IDC_EXP_ALL_FRAMES); - enableAddCollision(hWnd, TRUE); - if(IsDlgButtonChecked(hWnd,IDC_COLLISION)) - { - enableAddCollisionChoices(hWnd, TRUE); - } + return TRUE; } break; @@ -360,11 +323,7 @@ INT_PTR CALLBACK MaxOptionsDialogProc( HWND hWnd, UINT message, WPARAM wParam, L CheckRadioButton(hWnd, IDC_EXP_ALL_FRAMES, IDC_EXP_SEL_FRAMES, IDC_EXP_SEL_FRAMES); if (imp->_prev_type == MaxEggOptions::AT_chan) imp->ClearNodeList(hWnd); imp->_prev_type = MaxEggOptions::AT_pose; - enableAddCollision(hWnd, TRUE); - if(IsDlgButtonChecked(hWnd,IDC_COLLISION)) - { - enableAddCollisionChoices(hWnd, TRUE); - } + return TRUE; } break; @@ -471,100 +430,7 @@ INT_PTR CALLBACK MaxOptionsDialogProc( HWND hWnd, UINT message, WPARAM wParam, L "Panda3D Exporter", MB_YESNO | MB_ICONQUESTION) != IDYES) CheckDlgButton(hWnd, IDC_CHECK1, BST_UNCHECKED); return TRUE; break; - // add IDC_COLLISION and related: - case IDC_COLLISION: - if(IsDlgButtonChecked(hWnd,IDC_COLLISION)) - { - enableAddCollisionChoices(hWnd, TRUE); - if(MessageBox(hWnd, "Exporting the egg with collision tag in it? Some choices may hurt performance in Panda3D","Panda3D Exporter", - MB_YESNO | MB_ICONQUESTION) != IDYES) - { - CheckDlgButton(hWnd,IDC_COLLISION, BST_UNCHECKED); - enableAddCollisionChoices(hWnd, FALSE); - } - } - else - { - enableAddCollisionChoices(hWnd, FALSE); - } - return TRUE; break; - case IDC_PLANE: - if(IsDlgButtonChecked(hWnd,IDC_PLANE)) - { - CheckDlgButton(hWnd,IDC_SPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYSET, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYGON, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_TUBE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_INSPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_FLOORMESH, BST_UNCHECKED); - } - return TRUE; break; - case IDC_SPHERE: - if(IsDlgButtonChecked(hWnd,IDC_SPHERE)) - { - CheckDlgButton(hWnd,IDC_PLANE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYSET, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYGON, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_TUBE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_INSPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_FLOORMESH, BST_UNCHECKED); - } - return TRUE; break; - case IDC_POLYGON: - if(IsDlgButtonChecked(hWnd,IDC_POLYGON)) - { - CheckDlgButton(hWnd,IDC_PLANE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYSET, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_SPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_TUBE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_INSPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_FLOORMESH, BST_UNCHECKED); - } - return TRUE; break; - case IDC_POLYSET: - if(IsDlgButtonChecked(hWnd,IDC_POLYSET)) - { - CheckDlgButton(hWnd,IDC_PLANE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_SPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYGON, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_TUBE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_INSPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_FLOORMESH, BST_UNCHECKED); - } - return TRUE; break; - case IDC_TUBE: - if(IsDlgButtonChecked(hWnd,IDC_TUBE)) - { - CheckDlgButton(hWnd,IDC_PLANE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYSET, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYGON, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_SPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_INSPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_FLOORMESH, BST_UNCHECKED); - } - return TRUE; break; - case IDC_INSPHERE: - if(IsDlgButtonChecked(hWnd,IDC_INSPHERE)) - { - CheckDlgButton(hWnd,IDC_PLANE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYSET, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYGON, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_TUBE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_SPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_FLOORMESH, BST_UNCHECKED); - } - return TRUE; break; - case IDC_FLOORMESH: - if(IsDlgButtonChecked(hWnd,IDC_FLOORMESH)) - { - CheckDlgButton(hWnd,IDC_PLANE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYSET, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_POLYGON, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_TUBE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_INSPHERE, BST_UNCHECKED); - CheckDlgButton(hWnd,IDC_SPHERE, BST_UNCHECKED); - } - return TRUE; break; + default: //char buf[255]; //sprintf(buf, "%d", LOWORD(wParam)); @@ -620,54 +486,6 @@ void MaxOptionsDialog::UpdateUI(HWND hWnd) { CheckDlgButton(hWnd, IDC_CHECK1, _double_sided ? BST_CHECKED : BST_UNCHECKED); - // update collision button - CheckDlgButton(hWnd, IDC_COLLISION, - _add_collision ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_PLANE, - (_cs_type==CS_plane)? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_SPHERE, - (_cs_type==CS_sphere)? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_POLYGON, - (_cs_type==CS_polygon)? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_POLYSET, - (_cs_type==CS_polyset)? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_TUBE, - (_cs_type==CS_tube)? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_INSPHERE, - (_cs_type==CS_insphere)? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_FLOORMESH, - (_cs_type==CS_floormesh)? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_DESCEND, - (_cf_type&CF_descend) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_KEEP, - (_cf_type&CF_keep) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_EVENT, - (_cf_type&CF_event) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_SOLID, - (_cf_type&CF_solid) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_CENTER, - (_cf_type&CF_center) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_TURNSTILE, - (_cf_type&CF_turnstile) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_LEVEL, - (_cf_type&CF_level) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hWnd, IDC_INTANGIBLE, - (_cf_type&CF_intangible) ? BST_CHECKED : BST_UNCHECKED); SetICustEdit(hWnd, IDC_FILENAME, _file_name); @@ -769,38 +587,7 @@ bool MaxOptionsDialog::UpdateFromUI(HWND hWnd) { _end_frame = newEF; _anim_type = newAnimType; _double_sided = IsDlgButtonChecked(hWnd, IDC_CHECK1); - _add_collision = IsDlgButtonChecked(hWnd, IDC_COLLISION); - if(IsDlgButtonChecked(hWnd, IDC_PLANE)) - _cs_type = CS_plane; - if(IsDlgButtonChecked(hWnd, IDC_SPHERE)) - _cs_type = CS_sphere; - if(IsDlgButtonChecked(hWnd, IDC_POLYSET)) - _cs_type = CS_polyset; - if(IsDlgButtonChecked(hWnd, IDC_POLYGON)) - _cs_type = CS_polygon; - if(IsDlgButtonChecked(hWnd, IDC_TUBE)) - _cs_type = CS_tube; - if(IsDlgButtonChecked(hWnd, IDC_INSPHERE)) - _cs_type = CS_insphere; - if(IsDlgButtonChecked(hWnd, IDC_FLOORMESH)) - _cs_type = CS_floormesh; - if(IsDlgButtonChecked(hWnd, IDC_DESCEND)) - _cf_type = (CF_Type)(_cf_type | CF_descend); - if(IsDlgButtonChecked(hWnd, IDC_KEEP)) - _cf_type = (CF_Type)(_cf_type | CF_keep); - if(IsDlgButtonChecked(hWnd, IDC_EVENT)) - _cf_type = (CF_Type)(_cf_type | CF_event); - if(IsDlgButtonChecked(hWnd, IDC_SOLID)) - _cf_type = (CF_Type)(_cf_type | CF_solid); - if(IsDlgButtonChecked(hWnd, IDC_CENTER)) - _cf_type = (CF_Type)(_cf_type | CF_center); - if(IsDlgButtonChecked(hWnd, IDC_TURNSTILE)) - _cf_type = (CF_Type)(_cf_type | CF_turnstile); - if(IsDlgButtonChecked(hWnd, IDC_LEVEL)) - _cf_type = (CF_Type)(_cf_type | CF_level); - if(IsDlgButtonChecked(hWnd, IDC_INTANGIBLE)) - _cf_type = (CF_Type)(_cf_type | CF_intangible); _export_whole_scene = IsDlgButtonChecked(hWnd, IDC_EXPORT_ALL); _export_all_frames = IsDlgButtonChecked(hWnd, IDC_EXP_ALL_FRAMES); @@ -856,11 +643,6 @@ IOResult MaxOptionsDialog::Save(ISave *isave) { ChunkSave(isave, CHUNK_SF, _start_frame); ChunkSave(isave, CHUNK_EF, _end_frame); ChunkSave(isave, CHUNK_DBL_SIDED, _double_sided); - // save the collision options: - ChunkSave(isave, CHUNK_ADD_COLLISION, _add_collision); - ChunkSave(isave, CHUNK_CS_TYPE, _cs_type); - ChunkSave(isave, CHUNK_CF_TYPE, _cf_type); - ChunkSave(isave, CHUNK_EGG_CHECKED, _checked); ChunkSave(isave, CHUNK_ALL_FRAMES, _export_all_frames); ChunkSave(isave, CHUNK_EXPORT_FULL, _export_whole_scene); @@ -884,10 +666,6 @@ IOResult MaxOptionsDialog::Load(ILoad *iload) { case CHUNK_SF: _start_frame = ChunkLoadInt(iload); break; case CHUNK_EF: _end_frame = ChunkLoadInt(iload); break; case CHUNK_DBL_SIDED: _double_sided = ChunkLoadBool(iload); break; - case CHUNK_ADD_COLLISION: _add_collision = ChunkLoadBool(iload); break; - case CHUNK_CS_TYPE: _cs_type = (CS_Type)ChunkLoadInt(iload); break; - case CHUNK_CF_TYPE: _cf_type = (CF_Type)ChunkLoadInt(iload); break; - case CHUNK_EGG_CHECKED: _checked = ChunkLoadBool(iload); break; case CHUNK_ALL_FRAMES: _export_all_frames = ChunkLoadBool(iload); break; case CHUNK_EXPORT_FULL: _export_whole_scene = ChunkLoadBool(iload); break; diff --git a/pandatool/src/maxegg/maxOptionsDialog.h b/pandatool/src/maxegg/maxOptionsDialog.h index 34e62f3b65..3e95ca2686 100644 --- a/pandatool/src/maxegg/maxOptionsDialog.h +++ b/pandatool/src/maxegg/maxOptionsDialog.h @@ -31,10 +31,10 @@ extern HINSTANCE hInstance; #define CHUNK_ALL_FRAMES 0x1109 #define CHUNK_NODE_LIST 0x1200 #define CHUNK_NODE_HANDLE 0x1201 - -#define CHUNK_ADD_COLLISION 0x1202 -#define CHUNK_CS_TYPE 0x1203 -#define CHUNK_CF_TYPE 0x1204 +// +//#define CHUNK_ADD_COLLISION 0x1202 +//#define CHUNK_CS_TYPE 0x1203 +//#define CHUNK_CF_TYPE 0x1204 //Global functions void ChunkSave(ISave *isave, int chunkid, int value); @@ -60,39 +60,12 @@ struct MaxEggOptions AT_both }; - enum CS_Type{ - CS_none = 0x00000000, - CS_plane = 0x00010000, - CS_polygon = 0x00020000, - CS_polyset = 0x00030000, - CS_sphere = 0x00040000, - CS_tube = 0x00050000, - CS_insphere = 0x00060000, - CS_floormesh = 0x00080000 - }; - - enum CF_Type{ - CF_none = 0x00000000, - CF_descend = 0x00100000, - CF_event = 0x00200000, - CF_keep = 0x00400000, - CF_solid = 0x00800000, - CF_center = 0x01000000, - CF_turnstile = 0x02000000, - CF_level = 0x04000000, - CF_intangible = 0x08000000, - }; IObjParam *_max_interface; Anim_Type _anim_type; int _start_frame; int _end_frame; bool _double_sided; - - bool _add_collision; - CS_Type _cs_type; - CF_Type _cf_type; - bool _successful; bool _export_whole_scene; bool _export_all_frames; @@ -115,6 +88,8 @@ class MaxOptionsDialog : public MaxEggOptions MaxOptionsDialog(); ~MaxOptionsDialog(); + //All these List functions should probably take what list they need to operate on + //rather than just operating on a global list void SetMaxInterface(IObjParam *iface) { _max_interface = iface; } void UpdateUI(HWND hWnd); bool UpdateFromUI(HWND hWnd); diff --git a/pandatool/src/maxegg/maxResource.h b/pandatool/src/maxegg/maxResource.h index e1d1da9921..004a17b8be 100755 --- a/pandatool/src/maxegg/maxResource.h +++ b/pandatool/src/maxegg/maxResource.h @@ -40,22 +40,6 @@ #define IDC_OK 1058 #define IDC_CANCEL 1059 #define IDC_LOGGING 1060 -#define IDC_COLLISION 1061 -#define IDC_PLANE 1062 -#define IDC_SPHERE 1063 -#define IDC_POLYGON 1064 -#define IDC_POLYSET 1067 -#define IDC_TUBE 1068 -#define IDC_INSPHERE 1069 -#define IDC_FLOORMESH 1070 -#define IDC_DESCEND 1071 -#define IDC_KEEP 1072 -#define IDC_EVENT 1073 -#define IDC_SOLID 1074 -#define IDC_CENTER 1076 -#define IDC_TURNSTILE 1077 -#define IDC_LEVEL 1078 -#define IDC_INTANGIBLE 1079 // Next default values for new objects //