CSerialEntityXML::~CSerialEntityXML(void) { if (m_bReleaseName && m_pName) delete [] m_pName; FreeChildren(); if (m_pParent) m_pParent->RemoveChild(this); }
Bool InitValues() { // Initialize the force items. FreeChildren(CMB_FORCE); AddForceCycleElement(ID_SPRING); AddForceCycleElement(ID_CONNECTOR); AddForceCycleElement(ID_MOTOR); SetInt32(CMB_FORCE, ID_CONNECTOR); SetInt32(CMB_TYPE, -1); SetInt32(CMB_MODE, CMB_MODE_ALL); SetInt32(EDT_MAXCONN, 0, 0, 20, 1, false, 0, LIMIT<Int32>::MAX); SetFloat(EDT_RADIUS, (Float) 0, 0, 500, 1.0, FORMAT_METER, 0, MAXVALUE_FLOAT, false, false); SetBool(CHK_ADDDYNAMICS, false); SetBool(CHK_COMPOUND, false); SetBool(CHK_CLOSED, false); UpdateGadgets(true); return super::InitValues(); }
void UpdateGadgets(Bool relevants=false) { Int32 mode; Bool add_dynamics; GetBool(CHK_ADDDYNAMICS, add_dynamics); GetInt32(CMB_MODE, mode); BaseDocument* doc = GetActiveDocument(); BaseObject* op = doc ? doc->GetActiveObject() : nullptr; Enable(EDT_MAXCONN, mode != CMB_MODE_CHAIN); Enable(EDT_RADIUS, mode != CMB_MODE_CHAIN); Enable(CHK_CLOSED, mode == CMB_MODE_CHAIN); Enable(CHK_COMPOUND, add_dynamics); // Need at least two child objects on the active object. Bool execEnabled = op != nullptr && op->GetDown() != nullptr && op->GetDown()->GetNext() != nullptr; Enable(BTN_EXECUTE, execEnabled); if (relevants) { FreeChildren(CMB_TYPE); Int32 pluginid; GetInt32(CMB_FORCE, pluginid); do { BaseObject* op = BaseObject::Alloc(pluginid); if (!op) break; AutoFree<BaseObject> free(op); AutoAlloc<Description> desc; if (!op->GetDescription(desc, DESCFLAGS_DESC_0)) break; BaseContainer temp; AutoAlloc<AtomArray> arr; const BaseContainer* param = desc->GetParameter(FORCE_TYPE, temp, arr); if (!param) break; const BaseContainer* cycle = param->GetContainerInstance(DESC_CYCLE); if (!cycle) break; const BaseContainer* icons = param->GetContainerInstance(DESC_CYCLEICONS); Int32 i = 0; Int32 last_id = -1; while (true) { Int32 id = cycle->GetIndexId(i++); if (id == NOTOK) break; Int32 icon = icons ? icons->GetInt32(id) : -1; String name = cycle->GetString(id); if (name.Content()) { if (icon > 0) name += "&i" + String::IntToString(icon); if (last_id < 0) last_id = id; AddChild(CMB_TYPE, id, name); } } SetInt32(CMB_TYPE, last_id); } while (0); LayoutChanged(CMB_TYPE); } }
//destructor ~CLTAHuffmanNode() { FreeChildren(); }
CLightBSPNode::~CLightBSPNode() { //don't free the polygons, they are stored in a global list, but //do free the children FreeChildren(); }