Adding to Cart…
Licensing Agreement | Terms of Service | Privacy Policy | EULA
© 2024 Daz Productions Inc. All Rights Reserved.You currently have no notifications.
Licensing Agreement | Terms of Service | Privacy Policy | EULA
© 2024 Daz Productions Inc. All Rights Reserved.
Comments
Wow. Rock On, mindsong!
Love and Art!
Very sweet of both of you Fenric & Omega Man, I was missing one, who knows why! Wishing you all the best Fenric, have website, will email you tomorrow. - Rebecca
Thanks to Fenric, I decided to look at the source code of "FixPoseChannels". It's programmed in C#.
Although I haven't programmed in C# before, I decided to take a close look at the source code, and made some adjustments:
---// source code of Form1.cs //---
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace FixPoseChannels
{
public partial class Form1 : Form
{
public string folder;
public string countItems;
public Form1()
{
InitializeComponent();
}
private void SelectFigure_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Poser character|*.cr2";
if (dlg.ShowDialog() == DialogResult.OK)
{
Figure.Text = dlg.FileName;
Properties.Settings.Default.PoserChar = Figure.Text;
SaveAllSettings();
}
}
private void SelectPose_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Select pose|*.pz2";
if (dlg.ShowDialog() == DialogResult.OK)
{
Pose.Text = dlg.FileName;
}
}
private void Go_Click(object sender, EventArgs e)
{
PoserFigure figure = new PoserFigure();
string testIfAlreadyUsed;
testIfAlreadyUsed = Pose.Text + ".old";
if (File.Exists(testIfAlreadyUsed))
{
MessageBox.Show(Pose.Text + " is already fixed.");
//--> Get next pz2 file from PoseList
try
{
if (PoseBox.Items.Count > 0)
{
PoseBox.Items.RemoveAt(0);
PoseBox.SelectedIndex = 0;
return;
}
}
catch (Exception)
{
return;
}
}
else
{
// First, read in the figure and build a list of channels
using (StreamReader reader = File.OpenText(Figure.Text))
{
FigureParseMachine.Start();
string CurrentLine = reader.ReadLine();
while (CurrentLine != null)
{
Status.Text = "Reading CR2 File.";
Application.DoEvents();
if (CurrentLine.Contains("readScript"))
{
string scriptFileName = CurrentLine.Replace("readScript ", "").Replace("\"", "").Trim();
Status.Text = "ReadScript '" + scriptFileName + "'";
Application.DoEvents();
ReadScriptResolver resolver = new ReadScriptResolver(runtimeFolder.Text, scriptFileName);
string subLine = resolver.readLine();
while (subLine != null)
{
PoserActor actor = FigureParseMachine.ProcessLine(subLine);
if (actor != null) figure.Actors.Add(actor);
subLine = resolver.readLine();
}
}
else
{
PoserActor actor = FigureParseMachine.ProcessLine(CurrentLine);
if (actor != null) figure.Actors.Add(actor);
}
CurrentLine = reader.ReadLine();
}
}
PoserActor lastActor = FigureParseMachine.getLastActor();
if (lastActor != null) figure.Actors.Add(lastActor);
// Step one: Inject the names into the channels - otherwise you have to start with
// a CR2 that was already injected, which rather defeats the purpose.
try
{
using (StreamReader reader = File.OpenText(Pose.Text))
{
PoseParseMachine.StartForName();
Status.Text = "Reading PZ2 file and modifying channel names.";
Application.DoEvents();
string CurrentLine = reader.ReadLine();
while (CurrentLine != null)
{
PoseFix fix = PoseParseMachine.ProcessLineForName(CurrentLine);
if (fix != null)
{
if (!String.IsNullOrEmpty(fix.Name)) figure.UpdateDisplayName(fix);
}
CurrentLine = reader.ReadLine();
}
}
}
catch (Exception Err)
{
MessageBox.Show(Err.Message);
return;
}
// Step two: build the new PZ2.
try
{
using (StreamReader reader = File.OpenText(Pose.Text))
{
using (StreamWriter writer = File.CreateText(Pose.Text + ".fix"))
{
Status.Text = "Resolving ERC link names and creating new PZ2 file.";
Application.DoEvents();
PoseParseMachine.Start();
string CurrentLine = reader.ReadLine();
while (CurrentLine != null)
{
PoseFix fix = PoseParseMachine.ProcessLine(CurrentLine);
if (fix != null)
{
string newChannel = figure.LookForAlternate(fix);
if (newChannel != null)
{
CurrentLine = CurrentLine.Replace(fix.Channel, newChannel);
}
}
writer.WriteLine(CurrentLine);
CurrentLine = reader.ReadLine();
}
}
}
}
catch (Exception Err)
{
MessageBox.Show(Err.Message);
return;
}
Status.Text = "Backing up old pose file";
Application.DoEvents();
try
{
File.Move(Pose.Text, Pose.Text + ".old");
File.Move(Pose.Text + ".fix", Pose.Text);
countItems=PoseBox.Items.Count.ToString();
// MessageBox.Show("All done!", "Channel Name Repair");
if (string.IsNullOrEmpty(countItems))
{
}
else
{
PoseBox.Items.RemoveAt(0);
PoseBox.SelectedIndex = 0;
}
Status.Text = "Ready...";
Application.DoEvents();
}
catch (Exception Err)
{
MessageBox.Show(Err.Message);
return;
}
try
{
//--> Get next pz2 file from PoseList
if (PoseBox.Items.Count > 0)
{
if (PoseBox.Items.Count == 0)
{
MessageBox.Show("Nothing to see here, move along 1");
return;
}
else
{
PoseBox.Items.RemoveAt(0);
PoseBox.SelectedIndex = 0;
}
}
}
catch (Exception)
{
MessageBox.Show("Nothing to see here, move along 3");
return;
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
runtimeFolder.Text = Properties.Settings.Default.PoserDir;
Figure.Text = Properties.Settings.Default.PoserChar;
folder = Properties.Settings.Default.PoserRuntime;
}
private void runtimeFolder_TextChanged(object sender, EventArgs e)
{
}
private void Status_Click(object sender, EventArgs e)
{
}
private void SelectDirectory_Click(object sender, EventArgs e)
{
// if a directory is already selected, retrieve selected directory
FolderBrowserDialog dlg = new FolderBrowserDialog();
// if a directory is already selected, retrieve selected directory
if (string.IsNullOrEmpty(folder))
{
// do nothing
}
else
{
dlg.SelectedPath = folder;
PoseBox.Items.Clear();
}
if (dlg.ShowDialog() == DialogResult.OK)
{
folder = dlg.SelectedPath;
string[] posefiles = Directory.GetFiles(folder, "*.pz2");
// Test if selected directory contains pose files.
try
{
if (posefiles[0] != null)
{
PoseBox.Items.AddRange(posefiles);
PoseBox.SelectedIndex = 0;
}
}
catch (Exception)
{
MessageBox.Show("Selected directory " + folder + " doesn't contain Pose files.");
return;
}
}
}
private void PoseBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (PoseBox.Items.Count >= 0)
{
if (PoseBox.SelectedIndex ==-1)
{
// there's nothing to do.
return;
}
PoseBox.SelectedIndex = 0;
Pose.Text = PoseBox.SelectedItem.ToString();
}
}
private void Figure_Click(object sender, EventArgs e)
{
}
public void SaveAllSettings()
{
// Save all settings
Properties.Settings.Default.PoserRuntime = folder;
Properties.Settings.Default.PoserChar = Figure.Text;
Properties.Settings.Default.PoserDir = runtimeFolder.Text;
Properties.Settings.Default.Save();
}
}
}
----// end of source code //--
I used Fenric's code, and added some sub routines to make the fix pose easier to working on, also using settings, so that the program now keeps the 'selected figure' and remembers the poser directory. Default is C:\Poser 7, but on my PC it's D:\Poser 7\
Also added a list box with poses. It's still buggy but this is how the programs looks:
If I'm done, debugging, I'll put it online as open source :-)
Sorry about the delay, life got busy the last few months - can't imagine why :D
Anyway, I've decided to just give up on the open source notion, as these are plugins the license just gets too weird and verbose. So, I'm going to go to the other end of the spectrum: free for all. Here you go, public domain, go nuts.
Nearly 12 megabytes, so be warned!
http://www.fenric.com/download/CarraraSources.zip
hopefully someone can do something with that
we would rather you back in our fold though to be honest
Thanks, last programing I did was Fortran at Uni, glad someone is doing an update of Fenric's excellent work !
+1
++
(lol on the "the heck with it - here!" for the source code - I soo get that sometimes! :)
As I like to tell my good friends: "You're alright, I don't care *what* they say about you!" ...
Thanks a bunch for doing the plugins to start with - I bought them all and they were worth every penny, and thanks a zillions for giving them a chance to live on in the Carrara world!
Even if you leave us, your legacy is treasured and appreciated.
Best to you - and stop in when you can and vote for your favorite challenge entries - and let us know when you add updates to your Fox Den novel.
cheers and beers!
--ms
This is exciting - and having a capable helping-hand available that might be able to advise those of us who feel ambitious with this code is inspiring too. I hope it wouldn't be presumptuous to ask for help if we get stuck along the way.
cheers,
--ms
the shader tweaker tool is so sublimely awesome
Yes a land in itself
I use it all the time
It allows you to change shasder setting outside the shader room?
yep.. I always use it to adjust the highlight, shine, texture bump and sampling settings