Duplicate works!
This commit is contained in:
@@ -16,9 +16,9 @@ Instance::Instance(void)
|
||||
|
||||
Instance::Instance(const Instance &oinst)
|
||||
{
|
||||
parent = oinst.parent;
|
||||
setParent(oinst.parent);
|
||||
name = oinst.name;
|
||||
className = "BaseInstance";
|
||||
className = oinst.className;
|
||||
}
|
||||
|
||||
void Instance::render(RenderDevice* rd)
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
void addChild(Instance*);
|
||||
void removeChild(Instance*);
|
||||
Instance* getParent();
|
||||
Instance* clone() const { return new Instance(*this); }
|
||||
virtual Instance* clone() const { return new Instance(*this); }
|
||||
protected:
|
||||
std::string className;
|
||||
Instance* parent; // Another pointer.
|
||||
|
||||
@@ -28,7 +28,7 @@ PhysicalInstance::PhysicalInstance(const PhysicalInstance &oinst)
|
||||
name = oinst.name;
|
||||
className = "Part";
|
||||
canCollide = oinst.canCollide;
|
||||
|
||||
setParent(oinst.parent);
|
||||
anchored = oinst.anchored;
|
||||
size = oinst.size;
|
||||
setCFrame(oinst.cFrame);
|
||||
|
||||
4
main.cpp
4
main.cpp
@@ -252,9 +252,7 @@ void GUDButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||
std::vector<Instance*> newinst;
|
||||
for(size_t i = 0; i < selectedInstances.size(); i++)
|
||||
{
|
||||
Instance* inst = selectedInstances.at(i)->clone();
|
||||
newinst.push_back(inst);
|
||||
inst->setParent(selectedInstances.at(i)->getParent());
|
||||
newinst.push_back(selectedInstances.at(i)->clone());
|
||||
}
|
||||
selectedInstances = newinst;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user