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