Skip to content

Commit

Permalink
from Kage Studio's sourceforge r815
Browse files Browse the repository at this point in the history
  • Loading branch information
creek23 committed Feb 25, 2024
1 parent 5d87dea commit 480c10a
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 116 deletions.
2 changes: 1 addition & 1 deletion studio/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Current version is v0.8.240210
Current version is v0.8.240224
Kage Studio is a simple, Free and Open Source 2D Animation Software
written by Mj Mendoza IV <mj.mendoza.iv at gmail dot com>

Expand Down
2 changes: 1 addition & 1 deletion studio/installers/debian/kagestudio/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: kagestudio
Version: 0.8-240210
Version: 0.8-240224
Architecture: amd64
Maintainer: Mj Mendoza IV <mj.mendoza.iv@gmail.com>
Depends: libcairomm-1.0-1v5,libgtkmm-3.0-1v5, libgdk-pixbuf2.0-0, ffmpeg
Expand Down
4 changes: 2 additions & 2 deletions studio/installers/debian/makedeb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
cp ../../kagestudio ./kagestudio/usr/bin/kagestudio
cp ../../LICENSE.txt ./kagestudio/usr/share/doc/copyright
cp ../../README.txt ./kagestudio/usr/share/doc/README
cp ../../LICENSE.txt ./kagestudio/usr/share/doc/kagestudio/copyright
cp ../../README.txt ./kagestudio/usr/share/doc/kagestudio/README
sudo chmod 777 kagestudio*.deb
sudo rm kagestudio*amd64.deb
sudo chmod 775 ./kagestudio/DEBIAN/post*
Expand Down
Binary file modified studio/installers/windows/ffmpeg.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion studio/installers/windows/kage_installer_info.nsh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!define PRODUCT_NAME "Kage Studio"
!define PRODUCT_VERSION "0.8.240210"
!define PRODUCT_VERSION "0.8.240224"
!define PRODUCT_PUBLISHER "Mj Mendoza IV"
!define PRODUCT_WEB_SITE "https://kage.sourceforge.io"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\kagestudio.exe"
Expand Down
49 changes: 30 additions & 19 deletions studio/kage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,11 @@ void Kage::Copy_onClick() {
if (g_copiedData.size() > 0) {
//if ( _stage.copySelectedShapes() == true) {
//forceRenderFrames(); //why re-render the frames?
updateStatus("Selection copied");
} else {
std::ostringstream tmpStringStream;
tmpStringStream << _stage.selectedShapes.size();
updateStatus("Copy failed; Selected " + tmpStringStream.str());
}
} catch (std::exception& e) {
std::cout << "Kage::Copy_onClick Exception : " << e.what() << std::endl;
Expand All @@ -1268,6 +1273,8 @@ void Kage::Paste_onClick() {
if (g_selectedItems.size() > 0) {
forceRenderFrames();
stackDo();
} else {
updateStatus("Paste failed; Copy-buffer is empty");
}
} catch (std::exception& e) {
std::cout << "Kage::Paste_onClick Exception : " << e.what() << std::endl;
Expand Down Expand Up @@ -1538,6 +1545,7 @@ void Kage::Delete_onClick() {
if (KageStage::toolMode == KageStage::MODE_SELECT) {
Kage::timestamp_IN(); std::cout << " Kage::Delete_onClick SHAPE" << std::endl;
try {
stackDo(); //store current scene/layer/frame before deletion
if (_document.getScene()->getLayer()->getFrame()->deleteSelectedShapes(_stage.selectedShapes) == true) {
forceRenderFrames();
stackDo();
Expand Down Expand Up @@ -1754,6 +1762,11 @@ void Kage::CopyFrame_onClick() {
unsigned int l_sceneIndex = _document.getCurrentScene()-1;
unsigned int l_layerBufferCount = 0;
unsigned int l_frameBufferCount = 0;

unsigned int l_sceneBufferIndex = _documentCopyBuffer.getCurrentScene()-1;
unsigned int l_layerBufferIndex = 0;
unsigned int l_frameBufferIndex = 0;

//count all selected frames/layers
for (unsigned int l_layerIndex = 0; l_layerIndex < _document.Scenes[l_sceneIndex]->Layers.size(); ++l_layerIndex) {
for (unsigned int l_frameIndex = 0; l_frameIndex < _document.Scenes[l_sceneIndex]->Layers[l_layerIndex]->Frames.size(); ++l_frameIndex) {
Expand All @@ -1770,18 +1783,16 @@ void Kage::CopyFrame_onClick() {
l_frameBufferCount = l_frameBufferCount / l_layerBufferCount;
//resize copybuffer
for (unsigned int l_layerIndex = 0; l_layerIndex < l_layerBufferCount; ++l_layerIndex) {
if (_documentCopyBuffer.Scenes[l_sceneIndex]->Layers.size() < l_layerIndex+1) {
_documentCopyBuffer.Scenes[l_sceneIndex]->addLayer();
if (_documentCopyBuffer.Scenes[l_sceneBufferIndex]->Layers.size() < l_layerIndex+1) {
_documentCopyBuffer.Scenes[l_sceneBufferIndex]->addLayer();
}
for (unsigned int l_frameIndex = 0; l_frameIndex < l_frameBufferCount; ++l_frameIndex) {
if (_documentCopyBuffer.Scenes[l_sceneIndex]->Layers[l_layerIndex]->Frames.size() < l_frameIndex+1) {
_documentCopyBuffer.Scenes[l_sceneIndex]->Layers[l_layerIndex]->addFrame();
if (_documentCopyBuffer.Scenes[l_sceneBufferIndex]->Layers[l_layerIndex]->Frames.size() < l_frameIndex+1) {
_documentCopyBuffer.Scenes[l_sceneBufferIndex]->Layers[l_layerIndex]->addFrame();
}
}
}
unsigned int l_sceneBufferIndex = 0;
unsigned int l_layerBufferIndex = 0;
unsigned int l_frameBufferIndex = 0;

//copy selected frame/layer
for (unsigned int l_layerIndex = 0; l_layerIndex < _document.Scenes[l_sceneIndex]->Layers.size(); ++l_layerIndex) {
for (unsigned int l_frameIndex = 0; l_frameIndex < _document.Scenes[l_sceneIndex]->Layers[l_layerIndex]->Frames.size(); ++l_frameIndex) {
Expand Down Expand Up @@ -1825,7 +1836,7 @@ void Kage::CopyFrame_onClick() {
void Kage::PasteFrame_onClick() {
bool l_existingLayerBufferUsed = false;
//for (unsigned int l_sceneIndex = 0; l_sceneIndex < _document.Scenes.size(); ++l_sceneIndex) {
int l_sceneIndex = _document.getCurrentScene()-1;
int l_sceneIndex = 0;//_document.getCurrentScene()-1;
int l_currentLayerIndex = getDocumentSceneCurrentLayer() - _documentCopyBuffer.Scenes[l_sceneIndex]->Layers.size();
int l_currentFrameIndex = getDocumentSceneLayerCurrentFrame()-1;

Expand Down Expand Up @@ -3726,21 +3737,21 @@ void Kage::doSaveProject(std::string p_filename) {
"fps=\"" + StringHelper::integerToString(_document._fps) + "\" " +
"assets=\"" + StringHelper::unsignedIntegerToString(l_assetMax) + "\" " +
"scenes=\"" + StringHelper::unsignedIntegerToString(l_sceneMax) + "\" />");

//get parent
std::string l_ksfPath = l_projectFileName.parent_path().u8string();
if (l_filename == p_filename) {
//keep l_kslPath
} else {
l_ksfPath = l_filename;
}

saveKageStudio(p_filename, _assetManager.saveAssetsTo(l_filename + l_directory));
saveKageStudio(p_filename, _assetManager.saveAssetsTo(l_ksfPath + l_directory));

l_currentScene = _document.getCurrentScene();
std::string l_sceneName;
bool l_saved = false;

//get parent
std::string l_ksfPath = l_projectFileName.parent_path().u8string();
if (l_filename == p_filename) {
//keep l_kslPath
} else {
l_ksfPath = l_filename;
}

try {
for (i = 1; i <= l_sceneMax; ++i) {
_document.setCurrentScene(i);
Expand Down Expand Up @@ -4922,4 +4933,4 @@ Gdk::Color Kage::getStageBG() {
l_c.set_blue((gushort)_document._backgroundColor.getB() * 255);

return l_c;
}
}
8 changes: 4 additions & 4 deletions studio/kage.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,17 @@
void ToggleOnion_onClick();
void ToolButtons_onClick(Gtk::ToggleButton *p_sourceButton);
void onActionActivate();
//void Undo_onClick();
//void Redo_onClick();
public:
void Undo_onClick();
void Redo_onClick();
void Cut_onClick();
void Copy_onClick();
void Paste_onClick();
void Delete_onClick();
void Duplicate_onClick();
void SelectAll_onClick();
void Deselect_onClick();
protected:
void ToggleTimeline_onClick();
void ToggleProperties_onClick();
void TogglePropertiesFill_onClick();
Expand Down Expand Up @@ -433,8 +435,6 @@
PropertyFrameTween m_propFrameTween;
KageLibrary _library;
Gdk::Color m_Color; //fill or stroke?
void Undo_onClick();
void Redo_onClick();
void Stop_onClick();
bool _isPlaying;

Expand Down
24 changes: 21 additions & 3 deletions studio/kage/data/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,31 @@ void KageFrame::addDataToFrame(VectorDataManager v) {
}

std::vector<VectorData> KageFrame::copySelectedShapes(std::vector<unsigned int> p_selectedShapes) {
return vectorsData.copySelectedShapes(p_selectedShapes);
if ( _extension == KageFrame::extension::EXTENSION_NOT
|| _extension == KageFrame::extension::EXTENSION_START) {
return vectorsData.copySelectedShapes(p_selectedShapes);
} else {
VectorDataManager l_vectorData = _layer->getPreviousFrameData(frameID);
return l_vectorData.copySelectedShapes(p_selectedShapes);
}
}

std::vector<unsigned int> KageFrame::pasteSelectedShapes(std::vector<VectorData> p_copiedShapes) {
return vectorsData.pasteSelectedShapes(p_copiedShapes);
if ( _extension == KageFrame::extension::EXTENSION_NOT
|| _extension == KageFrame::extension::EXTENSION_START) {
return vectorsData.pasteSelectedShapes(p_copiedShapes);
} else {
VectorDataManager l_vectorData = _layer->getPreviousFrameData(frameID);
return l_vectorData.pasteSelectedShapes(p_copiedShapes);
}
}

bool KageFrame::deleteSelectedShapes(std::vector<unsigned int> p_selectedShapes) {
return vectorsData.deleteSelectedShapes(p_selectedShapes);
if ( _extension == KageFrame::extension::EXTENSION_NOT
|| _extension == KageFrame::extension::EXTENSION_START) {
return vectorsData.deleteSelectedShapes(p_selectedShapes);
} else {
VectorDataManager l_vectorData = _layer->getPreviousFrameData(frameID);
return l_vectorData.deleteSelectedShapes(p_selectedShapes);
}
}
1 change: 1 addition & 0 deletions studio/kage/data/layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ KageFrame *KageLayer::getFrame() {
} else {
for (unsigned int i = 0; i < Frames.size(); ++i) {
if (Frames[i]->frameID == _currentFrameID) {
_currentFrameIndex = i;
return Frames[i];
}
}
Expand Down
Loading

0 comments on commit 480c10a

Please sign in to comment.