144 lines
5.5 KiB
Python
144 lines
5.5 KiB
Python
from django.db import models
|
|
from django.utils.text import slugify
|
|
import uuid
|
|
import random
|
|
import string
|
|
|
|
class StudioConfig(models.Model):
|
|
"""Singleton model to store studio-wide settings and the unique admin key."""
|
|
admin_access_key = models.CharField(max_length=100, unique=True)
|
|
is_setup = models.BooleanField(default=False)
|
|
|
|
def save(self, *args, **kwargs):
|
|
if not self.admin_access_key:
|
|
self.admin_access_key = "61823dbc-ee05-455f-8924-764f15104fc1"
|
|
super().save(*args, **kwargs)
|
|
|
|
def __str__(self):
|
|
return "Studio Configuration"
|
|
|
|
class Project(models.Model):
|
|
TYPES = (
|
|
('MOVIE', 'Feature Film'),
|
|
('SERIES', 'TV Series'),
|
|
('DOCUMENTARY', 'Documentary'),
|
|
('SHORT', 'Short Film'),
|
|
)
|
|
STATUS_CHOICES = (
|
|
('PRE', 'Pre-Production'),
|
|
('PROD', 'Production'),
|
|
('POST', 'Post-Production'),
|
|
('DONE', 'Completed'),
|
|
)
|
|
VOICE_CHOICES = (
|
|
('male_1', 'James (Natural Male)'),
|
|
('male_2', 'Robert (Deep Narrative)'),
|
|
('female_1', 'Emma (Soft Female)'),
|
|
('female_2', 'Sophia (Professional)'),
|
|
('robot', 'CGI Assist (Neural)'),
|
|
)
|
|
|
|
title = models.CharField(max_length=255)
|
|
slug = models.SlugField(unique=True, blank=True)
|
|
project_type = models.CharField(max_length=20, choices=TYPES, default='MOVIE')
|
|
category = models.CharField(max_length=100, default='Sci-Fi')
|
|
status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='PRE')
|
|
description = models.TextField(blank=True)
|
|
full_script = models.TextField(blank=True)
|
|
thumbnail_url = models.URLField(blank=True, max_length=500)
|
|
banner_url = models.URLField(blank=True, max_length=500)
|
|
video_url = models.CharField(max_length=500, blank=True, help_text="Path to generated video file")
|
|
voice_preset = models.CharField(max_length=50, choices=VOICE_CHOICES, default='male_1')
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
is_ai_generated = models.BooleanField(default=False)
|
|
|
|
# New fields for "Super Production"
|
|
estimated_budget = models.CharField(max_length=100, blank=True, default="$150M")
|
|
rating = models.CharField(max_length=10, default="PG-13")
|
|
duration = models.CharField(max_length=50, blank=True, default="120 min")
|
|
|
|
def save(self, *args, **kwargs):
|
|
if not self.slug:
|
|
base_slug = slugify(self.title)
|
|
if not base_slug:
|
|
base_slug = "project"
|
|
|
|
unique_slug = base_slug
|
|
while Project.objects.filter(slug=unique_slug).exists():
|
|
random_string = ''.join(random.choices(string.ascii_lowercase + string.digits, k=4))
|
|
unique_slug = f"{base_slug}-{random_string}"
|
|
|
|
self.slug = unique_slug
|
|
super().save(*args, **kwargs)
|
|
|
|
def __str__(self):
|
|
return self.title
|
|
|
|
class Scene(models.Model):
|
|
project = models.ForeignKey(Project, related_name='scenes', on_delete=models.CASCADE)
|
|
number = models.PositiveIntegerField(default=1)
|
|
title = models.CharField(max_length=255)
|
|
description = models.TextField()
|
|
visual_prompt = models.TextField(blank=True)
|
|
image_url = models.CharField(max_length=500, blank=True)
|
|
video_url = models.CharField(max_length=500, blank=True)
|
|
|
|
class Meta:
|
|
ordering = ['number']
|
|
|
|
def __str__(self):
|
|
return f"Scene {self.number}: {self.title}"
|
|
|
|
class PipelineStep(models.Model):
|
|
STAGES = (
|
|
('SCRIPT', 'Roteiro & Storyboard'),
|
|
('CONCEPT', 'Concept Art'),
|
|
('ANIMATIC', 'Animatic'),
|
|
('MODELING', 'Modelagem 3D'),
|
|
('TEXTURING', 'Texturização'),
|
|
('RIGGING', 'Rigging'),
|
|
('ANIMATION', 'Animação'),
|
|
('LIGHTING', 'Iluminação'),
|
|
('FX', 'Simulação (FX)'),
|
|
('RENDERING', 'Renderização'),
|
|
('COMPOSITING', 'Composição'),
|
|
('EDITING', 'Edição & Sonoplastia'),
|
|
)
|
|
project = models.ForeignKey(Project, related_name='steps', on_delete=models.CASCADE)
|
|
name = models.CharField(max_length=20, choices=STAGES)
|
|
progress = models.PositiveIntegerField(default=0)
|
|
is_completed = models.BooleanField(default=False)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
class Meta:
|
|
ordering = ['id']
|
|
|
|
def __str__(self):
|
|
return f"{self.project.title} - {self.get_name_display()}"
|
|
|
|
class CgiAsset(models.Model):
|
|
ASSET_TYPES = (
|
|
('CHAR', 'Character'),
|
|
('PROP', 'Prop'),
|
|
('ENV', 'Environment'),
|
|
)
|
|
VOICE_CHOICES = (
|
|
('v_male_1', 'Actor 1 (Adult Male)'),
|
|
('v_male_2', 'Actor 2 (Mature Male)'),
|
|
('v_female_1', 'Actress 1 (Adult Female)'),
|
|
('v_female_2', 'Actress 2 (Young Female)'),
|
|
)
|
|
project = models.ForeignKey(Project, related_name='assets', on_delete=models.CASCADE)
|
|
name = models.CharField(max_length=255)
|
|
asset_type = models.CharField(max_length=10, choices=ASSET_TYPES)
|
|
is_realistic = models.BooleanField(default=True)
|
|
physical_description = models.TextField(blank=True)
|
|
voice_preset = models.CharField(max_length=50, choices=VOICE_CHOICES, default='v_male_1')
|
|
current_stage = models.CharField(max_length=100, default='Modeling')
|
|
version = models.PositiveIntegerField(default=1)
|
|
file_location = models.CharField(max_length=500, blank=True)
|
|
assigned_artist = models.CharField(max_length=100, blank=True)
|
|
|
|
def __str__(self):
|
|
return f"{self.name} ({self.get_asset_type_display()})" |